jPCT-AE - a 3d engine for Android > Support

Caching Vertex/UV/Normal data

(1/1)

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.


--- Code: ---Object3D secondObject = new Object3D(firstObject, true);
--- End code ---

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. 

Navigation

[0] Message Index

Go to full version