-----------------------------------------------------------------------------------
| 891 | } |
| 892 | //----------------------------------------------------------------------------------- |
| 893 | void SceneFormatExporter::_exportScene( String &outJson, set<String>::type &savedTextures, |
| 894 | uint32 exportFlags ) |
| 895 | { |
| 896 | mNodeToIdxMap.clear(); |
| 897 | mExportedMeshes.clear(); |
| 898 | mExportedMeshesV1.clear(); |
| 899 | |
| 900 | for( int i = 0; i < 3; ++i ) |
| 901 | { |
| 902 | mDecalsTexNames[i].clear(); |
| 903 | mDecalsTex[i] = 0; |
| 904 | mDecalsTexManaged[i] = false; |
| 905 | } |
| 906 | |
| 907 | mDecalsTex[0] = mSceneManager->getDecalsDiffuse(); |
| 908 | mDecalsTex[1] = mSceneManager->getDecalsNormals(); |
| 909 | mDecalsTex[2] = mSceneManager->getDecalsEmissive(); |
| 910 | |
| 911 | mListener->setSceneFlags( exportFlags, this ); |
| 912 | |
| 913 | char tmpBuffer[4096]; |
| 914 | LwString jsonStr( LwString::FromEmptyPointer( tmpBuffer, sizeof( tmpBuffer ) ) ); |
| 915 | |
| 916 | // Old importers cannot import our scenes if they use float literals |
| 917 | if( mUseBinaryFloatingPoint ) |
| 918 | jsonStr.a( "{\n\t\"version\" : ", (int)VERSION_0, "" ); |
| 919 | else |
| 920 | { |
| 921 | jsonStr.a( "{\n\t\"version\" : ", (int)VERSION_1, "" ); |
| 922 | } |
| 923 | jsonStr.a( ",\n\t\"use_binary_floating_point\" : ", toQuotedStr( mUseBinaryFloatingPoint ) ); |
| 924 | jsonStr.a( ",\n\t\"MovableObject_msDefaultVisibilityFlags\" : ", |
| 925 | MovableObject::getDefaultVisibilityFlags() ); |
| 926 | jsonStr.a( ",\n\t\"MovableObject_msDefaultQueryFlags\" : ", |
| 927 | MovableObject::getDefaultQueryFlags() ); |
| 928 | jsonStr.a( ",\n\t\"MovableObject_msDefaultLightMask\" : ", |
| 929 | MovableObject::getDefaultLightMask() ); |
| 930 | |
| 931 | if( exportFlags & SceneFlags::TexturesOitd ) |
| 932 | jsonStr.a( ",\n\t\"saved_oitd_textures\" : true" ); |
| 933 | if( exportFlags & SceneFlags::TexturesOriginal ) |
| 934 | jsonStr.a( ",\n\t\"saved_original_textures\" : true" ); |
| 935 | |
| 936 | flushLwString( jsonStr, outJson ); |
| 937 | |
| 938 | if( exportFlags & SceneFlags::SceneNodes ) |
| 939 | { |
| 940 | uint32 nodeCount = 0; |
| 941 | |
| 942 | outJson += ",\n\t\"scene_nodes\" :\n\t["; |
| 943 | for( size_t i = 0; i < NUM_SCENE_MEMORY_MANAGER_TYPES; ++i ) |
| 944 | { |
| 945 | SceneNode *rootSceneNode = |
| 946 | mSceneManager->getRootSceneNode( static_cast<SceneMemoryMgrTypes>( i ) ); |
| 947 | |
| 948 | mNodeToIdxMap[rootSceneNode] = nodeCount++; |
| 949 | if( i == 0 ) |
| 950 | outJson += "\n\t\t{"; |
nothing calls this directly
no test coverage detected