-----------------------------------------------------------------------------------
| 485 | } |
| 486 | //----------------------------------------------------------------------------------- |
| 487 | void SceneFormatExporter::exportEntity( LwString &jsonStr, String &outJson, v1::Entity *entity, |
| 488 | bool exportMesh ) |
| 489 | { |
| 490 | const v1::Mesh *mesh = entity->getMesh().get(); |
| 491 | |
| 492 | outJson += "\n\t\t\t\"mesh\" : \""; |
| 493 | outJson += mesh->getName(); |
| 494 | outJson += "\""; |
| 495 | |
| 496 | outJson += ",\n\t\t\t\"mesh_resource_group\" : \""; |
| 497 | outJson += mesh->getGroup(); |
| 498 | outJson += "\""; |
| 499 | |
| 500 | outJson += ",\n"; |
| 501 | exportMovableObject( jsonStr, outJson, entity ); |
| 502 | |
| 503 | outJson += ",\n\t\t\t\"sub_entities\" :\n\t\t\t["; |
| 504 | const size_t numSubEntities = entity->getNumSubEntities(); |
| 505 | for( size_t i = 0; i < numSubEntities; ++i ) |
| 506 | { |
| 507 | if( i != 0 ) |
| 508 | outJson += ",\n"; |
| 509 | else |
| 510 | outJson += "\n"; |
| 511 | outJson += "\t\t\t\t{"; |
| 512 | exportRenderable( jsonStr, outJson, entity->getSubEntity( i ) ); |
| 513 | outJson += "\t\t\t\t}"; |
| 514 | } |
| 515 | outJson += "\n\t\t\t]"; |
| 516 | |
| 517 | // Export the mesh, if we haven't done that already |
| 518 | if( exportMesh && mExportedMeshesV1.find( mesh ) == mExportedMeshesV1.end() && |
| 519 | mListener->exportMesh( mesh ) ) |
| 520 | { |
| 521 | FileSystemLayer::createDirectory( mCurrentExportFolder + "/v1/" ); |
| 522 | |
| 523 | Ogre::v1::MeshSerializer meshSerializer; |
| 524 | meshSerializer.exportMesh( mesh, mCurrentExportFolder + "/v1/" + mesh->getName(), |
| 525 | v1::MESH_VERSION_LATEST ); |
| 526 | mExportedMeshesV1.insert( mesh ); |
| 527 | } |
| 528 | } |
| 529 | //----------------------------------------------------------------------------------- |
| 530 | void SceneFormatExporter::exportDecalTex( LwString &jsonStr, String &outJson, |
| 531 | const DecalTex &decalTex, set<String>::type &savedTextures, |
no test coverage detected