wxywxy.ji Posted June 2, 2011 Share Posted June 2, 2011 Is able to convert from ObjectMeshDynamic to ObjectMesh? Scripts within ObjectMeshDynamic has lod surfaces. Is another way? Link to comment
frustum Posted June 2, 2011 Share Posted June 2, 2011 Mesh saving function is ObjectMeshDynamic::save("name.mesh"); Or "export selected into the mesh" button in Nodes window. Multiple surfaces of ObjectMeshDynamic example is samples/objects/dynamic_02.cpp Link to comment
wxywxy.ji Posted June 3, 2011 Author Share Posted June 3, 2011 Mesh saving function is ObjectMeshDynamic::save("name.mesh"); Or "export selected into the mesh" button in Nodes window. Multiple surfaces of ObjectMeshDynamic example is samples/objects/dynamic_02.cpp Save or load, not the way Script on Ex) ObjectMeshDynamic Dmesh; ObjectMesh mesh; for( int i = 0 ; i < Dmesh.getSurface() ; i++ ) { mesh.setMaterial( Dmesh.getMaterial( i ) ); mesh.addSurface( Dmesh.getSurface( i ) ); //...... Etc Property } In this way , How to do? Link to comment
ulf.schroeter Posted June 4, 2011 Share Posted June 4, 2011 Save or load, not the way Script on Ex) It's not possible to add surfaces to static meshes during runtime (there is no addSurface() etc for static meshes). Therefore you have to save your ObjectMeshDynamic to a file and create a new static ObjectMesh based on this file. Afterwards you could copy surface attributes (e.g. materials, properties,..) and probably save static mesh to node file via engine.world.saveNode() to persist material/property assignments for reload. ObjectMeshDynamic Dmesh = ...; // your creation code Dmesh.save("your filename"); // saves dynamically created surfaces, vertices, normals, texcoords etc. ObjectMesh mesh = new ObjectMesh("your filename"); // creates matching static mesh variant for( int i = 0 ; i < Dmesh.getSurface() ; i++ ) { // copy additional node/surface attributes mesh.setMaterial( Dmesh.getMaterial( i ) ); //...... Etc Property } // add ObjectMesh to editor, remove/delete converted ObjectMeshDynamic, save to node file etc Link to comment
Recommended Posts