Author Topic: Caching Vertex/UV/Normal data  (Read 660 times)

Offline nathan

  • byte
  • *
  • Posts: 15
    • View Profile
Caching Vertex/UV/Normal data
« on: May 01, 2013, 10:41:20 pm »
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?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Caching Vertex/UV/Normal data
« Reply #1 on: May 02, 2013, 01:00:09 am »
You can do it very simple. Look at the javadoc.

Code: [Select]
Object3D secondObject = new Object3D(firstObject, true);

Offline nathan

  • byte
  • *
  • Posts: 15
    • View Profile
Re: Caching Vertex/UV/Normal data
« Reply #2 on: May 02, 2013, 03:16:22 am »
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.