Login  Register

Re: how to transform objects not using Transform3D

Posted by philjord on Dec 03, 2021; 2:26am
URL: https://forum.jogamp.org/how-to-transform-objects-not-using-Transform3D-tp4041515p4041516.html

Hi,
I'm currently moving house so I can't give a good reply.

If the basic concept of what you want to do is transform/alter the vertices of a geometry then that can be done by simply changing all the flats or Point3f and then telling the geometry about it.

Because the geometry might be being used by the renderering pipeline at any moment we aren't allowed to call the data setting methods  (e.g.  setCoordinates(int index, float coordinates[]) ) unless we call it from within a GeometryUpdater handed into the updateGeometry method of the geometry.

updateGeometry will be called in sync with the renderer before the next frame.

You will probably be using a TriangleArray, so you'll need to know if it's a byref or not, because a byref will actually allow you to edit the original float array inside the updateGeometry/GeometryUpdater call.

I'd suggest you don't use anything but IndexedTriangleArray and raw float[] data as your geometry data, the unindexed and Pioint3f etc are handy but they aren't like the underlying data and so cause performance loss.


One interesting aside for this is that if you mix and match TransformGroup updates with updateGeometry the updateGeometry will be called before the next frame, but the TransformGroup has a 2 frame delay before it gets seen, so skin/bone animations will leave cracks.