Jump to content

convert mesh


photo

Recommended Posts

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

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

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
×
×
  • Create New...