From: <aco...@mi...> - 2003-07-03 09:39:53
|
Hi Rene, >1.) Is the octree implementation used by default, or do I have to=20 >implement some thing by myself to take profit from the octree? If so,=20 >is there an example for that? In order to use the octree feature, you currently need to manually convert the OmSimpleMesh containing your geometry to an OmOctree object. This can be done in the init() method of your OmSceneManager extension using the following code : int maxPolygons =3D 5000; OmOctree oct =3D new OmOctree("myOctree",myOmSimpleMesh,maxPolygons); OmNode parentNode =3D myOmSimpleMesh.getParent(); parentNode.removeChild(myOmSimpleMesh); parentNode.addChild(oct); The processing for converting a regular node to an octree takes some time, thus we plan in the future to have octrees loaded pre-computed, but we need to have our own OpenMind file format first for this purpose. Till then, you'll have to convert you mesh to an octree at initialisation time. >2.) I tried to integrate a custom object to a scene which is _NOT_=20 >loaded from a ASE file. >I tried the following: >[...code...] >The problem now is that object will not appear within the scene. Unsing >the debugger I found out that the display() method is _not_ called.=20 >What did I wrong? OpenMind does texture sorting. It means it renders objects sorted by material : OpenMind loads a material/texture set into the graphic adapter and renders all objects using this material. This allows minimizing the texture load/unload traffic into the graphic adapter memory, texture loading being the most time consuming task when doing real-time 3D rendering.=20 Thus if your object doesn't have any material assigned, it won't be rendered, and its display() method will not be called. This is why OmMaterialManager defines a material named "defaultMaterial" that you can assign to objects which don't have any particular material ready for them, so you can display them. So, adding the following code into your initializeScene() method should make your object show up : testSceneObject.setMaterial(OmConfig.getCanvas().getScene().materialMana ger. defaultMaterial); Regards, Alban Cousini=E9 |