www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: ap on May 14, 2015, 10:35:29 am

Title: Clone and transform objects
Post by: ap on May 14, 2015, 10:35:29 am
Hello

I'm cloning an object, for sharing the mesh data, and I'm a bit confused.
I am trying to transform the mesh data at start-up by using rotateMesh() and translateMesh() after applying proper transformations (for aligning the objects properly).

I am wondering what is the better option (in terms of performance and memory consumption) - cloning the original object (with the original mesh data) and then applying rotateMesh/translateMesh OR first applying mesh transformations and then cloning? Is there a difference?
What happens to the mesh data after rotateMesh/translateMesh? Is it still being shared, so a transformation on one object affects the other?

Thanks
AP
Title: Re: Clone and transform objects
Post by: EgonOlsen on May 14, 2015, 01:06:52 pm
Doing this on a shared mesh will apply the operations on same mesh. So doing it after cloning and sharing doesn't do any harm performance or memory wise, but you might apply the same operations twice. IMHO, it's better to apply these operarions before the cloning...it's just more logical.