Trying to figure out how can I implement transforming elements that already went 'live', but not using Transform3D.
Searching for transformations in Java3D just points me to Transform3D 'way' and I need to do the leg work.
What I do now is group Points3d into a LineArray and then into a Shape3D and then add them to a BranchGroup.
This allows me to display these wireframe cubes on the screen.
I went through some APIs for a SimpleUniverse, Canvas, Locale, BranchGroup trying to find a method that would allow me to clean the display, (transform basic points in the background) and display refreshed objects, but to no avail.
I tried using SimpleUniverse->Locale->BranchGroup and then using SU.removeAllLocales() on a key press, but I'm missing something as the window does not refresh and I see 'old' cubes. I don't know what to expect.
I couldn't find how this method is supposed to work in detail, except for a succint description that just expanded this method's name. The name is promising :)
I also tried smash&grab method of just creating a new object, but it gets created in a new (default) frame.
Maybe somebody could tell me how to keep it in the same frame? Haven't done anything with frames so far, but that could do (even though it feels wrong). I don't need to make it ideal, just working.
Maybe there is a way to extract points back in an orderly manner after placing them in a BranchGroup?
Attached is what I have now.
This is not finished, I'm struggling as I lack a general concept of how to omit Transform3D usage.
I would be thankful if somebody could point me the right way.
Commenting on attached files:
On key press 'a' new object gets created with a new universe and a small translation.
On key press 'c' I was trying to see what removeAllLocales() really does, but nothing visible happens.
There's a bunch of RealMatrix methods in tuval1 that I'm intending to use for transformations, but right now they don't matter and tuval1 is just for 'new tuval7()'.
Re: how to transform objects not using Transform3D
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.