zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
114 stars 22 forks source link

Ortho view should have 0 for Z translation? #141

Open m-7761 opened 4 years ago

m-7761 commented 4 years ago

Today I discovered a weird problem in my code that I think is new where Tool::addPosition put new joints down according to a Z offset. I don't know why it started, but it made me to supply 0 to the Z component in my ortho matrices, and I think that's correct, so you might want to revert the code below back to the old way?

https://github.com/zturtleman/mm3d/blob/fb66ccb21f772a2f7f168880dced412c50547fb4/src/depui/modelviewport.cc#L1265-L1269

I don't know why I'm noticing this now. I have simplified a lot of code, since managing Z is redundant. I think your code must be doing something somewhere to cancel this behavior out, but in general I think it's a mistake to offset ortho matrices and whatever is canceling it won't be broken by having 0 instead.

m-7761 commented 4 years ago

Not directly related, but in the same wheelhouse, I just noticed the Vertex Snap feature is discarding the "Z" component of vertices relative to the orthographic projection. I don't know, this seems like a mistake right?

m-7761 commented 4 years ago

Not directly related, but in the same wheelhouse, I just noticed the Vertex Snap feature is discarding the "Z" component of vertices relative to the orthographic projection. I don't know, this seems like a mistake right?

Just for the record this seems to work easily if you just add a "zval" parameter to the snapping routine. It already produces a z component, it just isn't accessible.

(At first it seemed to fail because in my test case there was more than one vertex to snap to in the initial pick so that created an offset since it didn't prefer the thing I was trying to move. I think what could help there is to give priority to "selected" elements. Another approach is to prioritize elements close to the screen, but I don't see a reason for the snap feature to be stuck on the ortho plane, and I don't think anyone would expect it to by default.)