Re: how to transform objects not using Transform3D
Posted by
Mr. Broccoli on
Aug 07, 2022; 10:24pm
URL: https://forum.jogamp.org/how-to-transform-objects-not-using-Transform3D-tp4041515p4041810.html
Phil,
Looks like... it's almost done(?).
No errors, by the looks of it works OKish.
The only thing that is not OK is the 'zooming'. If I move when the geometry is scaled('zoomed') and then get back to original 0,0,0 (judging by the on-screen coords) then the cube alignment looks different than initially.
You gave me a code snip to change camera position, haven't tried that out yet, but I'm worried moving the camera will be the same as moving the objects and I'm already doing that with W/S keys.
Maybe playing with FOV could be the key to do it properly?
Or , just thought of it now - I could multiply translation deltas by scale factor, so that even if I don't end up in the same position that I started from, at least the coords would be realistic?
Anyway, have a look:
notusingtransform3D.javatrianglesToDraw.javaThe second file is a class introduced to marry a triangle and it's Z depth to enable easier sorting.
In the original file I introduced a 'addTTDs' method which calculates centroid's Z and adds a triangleToDraw to the list I iterate through in renderField.
There is also a new 'updateDataEmpty' method which get's called for each key press for each cube reference.
This marks some triangles as 'dirty' (as you phrased it) plus helps populate the TTD list.
I also restored flush() method to its original simplicity - having just one line, being called once per key press.
Regards, Mr. B.