void OgreMeshReader::readSubMesh(SubMeshStore &subMeshInfo, VertexElementStore &sharedVertexElements, bool skelAnim ) { OSG_OGRE_LOG(("OgreMeshReader::readSubMesh\n")); subMeshInfo.push_back((SubMeshInfo())); SubMeshInfo &smInfo = subMeshInfo.back(); smInfo.matName = readString(_is); smInfo.sharedVertex = readBool (_is); UInt32 idxCount = readUInt32(_is); bool idx32Bit = readBool (_is); OSG_OGRE_LOG(("OgreMeshReader::readSubMesh: matName '%s' sharedVert '%d' " "idxCount '%d' idx32Bit '%d'\n", smInfo.matName.c_str(), smInfo.sharedVertex, idxCount, idx32Bit)); smInfo.skelAnim = skelAnim; smInfo.meshOp = SMO_TRIANGLE_LIST; if(idx32Bit == true) { GeoUInt32PropertyUnrecPtr pi = GeoUInt32Property::create(); pi->resize(idxCount); _is.read(reinterpret_cast<Char8 *>(&pi->editField().front()), idxCount * sizeof(UInt32)); smInfo.propIdx = pi; } else { GeoUInt16PropertyUnrecPtr pi = GeoUInt16Property::create(); pi->resize(idxCount); _is.read(reinterpret_cast<Char8 *>(&pi->editField().front()), idxCount * sizeof(UInt16)); smInfo.propIdx = pi; } Int16 boneIdxVE = -1; Int16 boneWeightVE = -1; bool stop = false; while(_is) { readChunkHeader(_is); switch(_header.chunkId) { case CHUNK_GEOMETRY: readGeometry(smInfo.vertexElements); break; case CHUNK_SUBMESH_OPERATION: readSubMeshOperation(smInfo); break; case CHUNK_SUBMESH_BONE_ASSIGNMENT: readSubMeshBoneAssignment(smInfo, boneIdxVE, boneWeightVE); break; case CHUNK_SUBMESH_TEXTURE_ALIAS: readSubMeshTextureAlias(); break; default: OSG_OGRE_LOG(("OgreMeshReader::readSubMesh: Unknown chunkId '0x%x'\n", _header.chunkId)); stop = true; break; }; if(stop == true) { skip(_is, -_chunkHeaderSize); break; } } if(boneIdxVE >= 0 || boneWeightVE >= 0) { verifyBoneAssignment(smInfo.vertexElements, boneIdxVE, boneWeightVE); } }