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

compile

(1/6) > >>

raft:
i know compile() method is removed because all objects are compiled in AE but it may still make sense to put it back. it's is useful as a preperation before game begins. if i dont miss something, at the moment we are forced to serialize even the simplest objects like particles. particles are typically cloned from a master and at each cloning a compile occurs

EgonOlsen:
 ??? You don't have to serialize particles...at least i don't. I create a particle pool, pre-fill it with, let's say, 50 instances all cloned from the master. They all share the same mesh and the same compiled data (Object3d.shareCompiledData(<Object3D>); ).
If you want to make sure that everything is compiled before the game begins, just call World.compileAllObjects(). However, that doesn't include the actual filling of the native structures at runtime, which i can't push up to an earlier stage. It's pretty cheap anyway.

raft:
mm, i tried sharedCompileData thingy but couldn't manage to work, i must have messed something that time ::)

now it works in desktop version. i create my master particle in a static initializer block (like in Robombs). it works in desktop since i can compile it there. no such option for AE. so you do create master for each level ?

is compileAllObjects() thread safe ?

EgonOlsen:
The master object needs no explicit compile even if you use shareCompiledData() on it. The object compiler will compile it if needed once it encouters an object that shares data with it.

compileAllObjects() isn't thread safe, but i can easily make it if that does any good!?

raft:
i was getting this exception in AE when trying to share:

--- Code: ---E/AndroidRuntime(10098): Caused by: java.lang.RuntimeException: [ 1282329180107 ] - ERROR: Can't enable data sharing after calling compile on object object28!
E/AndroidRuntime(10098): at com.threed.jpct.Logger.log(Logger.java:159)
E/AndroidRuntime(10098): at com.threed.jpct.Object3D.shareCompiledData(Object3D.java:837)

--- End code ---

i was calling shareCompiledData() after build(). after your post i reversed the order and now it works. i suppose build is not even necessary there.
but the thing is, same code is now broken in desktop version. if it won't be trouble, adding compile to AE may really help.

for compileAllObjects(), it doesnt really matter. i can live both way.

Navigation

[0] Message Index

[#] Next page

Go to full version