Caching Vertex/UV/Normal data

Started by nathan, May 01, 2013, 10:41:20 PM

Previous topic - Next topic

nathan

I don't want to open an InputStream to my 3DS model every time I want to instantiate a new one.  I would like to load that data somehow. From what I have read, there is no simple way of doing this.  Why?

I can get the UV coordinates from the Object3D.getPolygonManager().getTextureUV()
I can get the Vertex coordinates from the GenericVertexController.getSourceMesh()
I can get the Normal coordinates from the GenericVertexController.getSourceNormals()

Then I can flatten all the information into a bunch of float arrays. 

Then, I can instantiate new Object3D with the UV and Vertex information
But to get the normal data back in, I have to then make another GenericVertexController to modify the DestinationNormals.

Why is this so complicated? There should be a simple method to cache this information.
When I instantiate the new object, what should I put into the int[] index field?

Thomas.

You can do it very simple. Look at the javadoc.

Object3D secondObject = new Object3D(firstObject, true);

nathan

Okay, that would work.  I wanted to have a MeshData class that handled all this by itself, but I guess I can just hold an Object3D inside my MeshData, and just use that to copy it.