Hi everyone,
I'm new to j3d and am trying to programm a game, where I need to run on a uneven surface.
for that purpose I added every single polygon of the worldmap to an ArrayList<Polygon>, where Polygon is a self written class which contains some important methods.
But with this setup, it's not only way too slow, but also uses tons of memory. In fact, I get a OutOfMemoryException when I load an object with about 3million polygons, which is a nogo ;).
Now I'm looking for some alternative to get the polygon from x and z coodinates of an object I created in blender. I'm sure, that this polygon is in rendering region, but how to read this region?
I think you will be better off using a game engine like Ardor3D or jMonkeyEngine (http://hub.jmonkeyengine.org) that has a lot of game related things built in, for example collision detection, model loading and terrain handling.
This is not helpful at all...
There must be a way to do so, without changing the objects...
Could you explain, how the interleaved array is actually arranged? Maybe I can predict, where the point is from that array.
I only know that 6 indices build a point, with the last 3 indices as their normals. The polygon is made of three points, so one polygon takes 18 places in the array, in my case
But how are the polygons sorted?
Maybe you should look at the source code of intersection tools for Java 3D in order to check which assumptions are done on the way polygons are sorted:
http://code.j3d.org/using/geom_intersect.html
If I understood the code correctly - and I'm not sure I did - there is no prediction at all...
Nevertheless, I optimized my code in that manner, that it will load all objects, that ObjectFile can handle as well, that is good enough for now. The calculation of huge objects now takes about 3-5 ms, but it's allright, for it's way below the minimum framerate.