LoaderDFF::GeometryList LoaderDFF::readGeometryList(const RWBStream &stream) { auto listStream = stream.getInnerStream(); auto listStructID = listStream.getNextChunk(); if (listStructID != CHUNK_STRUCT) { throw DFFLoaderException("Geometry List missing struct chunk"); } char *headerPtr = listStream.getCursor(); unsigned int numGeometries = *(std::uint32_t *)headerPtr; headerPtr += sizeof(std::uint32_t); std::vector<GeometryPtr> geometrylist; geometrylist.reserve(numGeometries); for (auto chunkID = listStream.getNextChunk(); chunkID != 0; chunkID = listStream.getNextChunk()) { switch (chunkID) { case CHUNK_GEOMETRY: { geometrylist.push_back(readGeometry(listStream)); } break; default: break; } } return geometrylist; }
int main(int argc, char* argv[]) { ApplicationsLib::LogogSetup logo_setup; TCLAP::CmdLine cmd( "Converts a geometry defined on a given mesh to distinct meshes.\n\n" "OpenGeoSys-6 software, version " + BaseLib::BuildInfo::git_describe + ".\n" "Copyright (c) 2012-2018, OpenGeoSys Community " "(http://www.opengeosys.org)", ' ', BaseLib::BuildInfo::git_describe); TCLAP::ValueArg<double> search_length_arg( "s", "searchlength", "search length determining radius for the node search algorithm. " "Non-negative floating point number (default 1e-16) ", false, 1e-16, "float"); cmd.add(search_length_arg); TCLAP::ValueArg<std::string> geometry_arg("g", "geometry", "the file name the geometry", true, "", "geometry file name"); cmd.add(geometry_arg); TCLAP::ValueArg<std::string> mesh_arg( "m", "mesh", "the file name of the mesh where the geometry is defined", true, "", "mesh file name"); cmd.add(mesh_arg); cmd.parse(argc, argv); std::unique_ptr<MeshLib::Mesh> mesh{ MeshLib::IO::readMeshFromFile(mesh_arg.getValue())}; auto const geo_objects = readGeometry(geometry_arg.getValue()); double const search_length = search_length_arg.getValue(); auto const extracted_meshes = constructAdditionalMeshesFromGeoObjects( *geo_objects, *mesh, std::make_unique<MeshGeoToolsLib::SearchLength>(search_length)); for (auto const& m_ptr : extracted_meshes) { MeshLib::IO::writeMeshToFile(*m_ptr, m_ptr->getName() + ".vtu"); } return EXIT_SUCCESS; }
dae_reader_t *createDAEReader(char *path) { dae_reader_t *reader = init(); MSXML2::IXMLDOMDocument2Ptr xmlDoc = setupXMLParser(path); if (!xmlDoc) { printf("Cannot open model file %s\n", path); return NULL; } getAxisOrientation(reader, xmlDoc); readGeometry(reader, xmlDoc); long l0 = clock(); for (uint32_t i = 0; i < reader->geometry.size(); i++) { buildIndices(reader, i); } long l1 = clock(); printf("%i\n", l1 - l0); return reader; }
void ConfigurationParser::readMap() { Q_ASSERT(isStartElement() && name() == "map"); while(!atEnd()) { readNext(); if(isEndElement()) break; if(isStartElement()) { if(name() == "geometry") { readGeometry(); } else if (name() == "layer") { DataLayer *layer = readLayer(); if(layer) { m_layers.insert(layer->name(), layer); } } else if (name() == "colorMap") { ColorMap colorMap = ColorMap::readColorMap(this); m_colorMaps.insert(colorMap.name(), colorMap); } else { readUnknownElement(); } } } }
int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum ) { char line[1024], * text; int err = 1; while( GetLine( file, line, LineNum, 512 ) ) { text = strtok( line, sep_chars ); if( *text == '}' ) { err = 0; break; } if( stricmp( text, "appearance" ) == 0 ) { readAppearance( file, LineNum ); } else if( stricmp( text, "geometry" ) == 0 ) { readGeometry( file, LineNum ); } else { DBG( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) ); break; } } return err; }
void ASELoader::loadModel(vector<Vertex3> &vertices, vector<int> &triangles, vector<Vertex3> &textures, vector<int> &texturedTriangles, string &textureFile, string fileName) { vertices.clear(); triangles.clear(); m_modelFile.clear(); // this is needed otherwise file report eof. m_modelFile.open(fileName.c_str()); if (m_modelFile.is_open()) { char line[255]; while (!m_modelFile.eof()) { m_modelFile.getline(line,255); string currentLine = line; // check the line to see if it starts a block if (currentLine.find("*MATERIAL_LIST")!= string::npos) { // read materials.... readMaterial(textureFile); } else if (currentLine.find("*GEOMOBJECT")!= string::npos) { // read geometry... readGeometry(vertices, triangles, textures, texturedTriangles); } else if (currentLine.find("*GROUP")!= string::npos) { } else if (currentLine.find("*LIGHTOBJECT")!= string::npos) { // read light objects... } else if (currentLine.find("*CAMERAOBJECT")!= string::npos) { // read camera objects... } else { // read an unknown object... // if the line of the unknown line contains an open curly // bracket, skip to after the next close curly bracket. if (currentLine.find("{")!= string::npos) { do { m_modelFile.getline(line,255); currentLine = line; } while (currentLine.find("}") == string::npos); } } } m_modelFile.close(); } }
int main(int argc, char **argv) { //example_volume_mesher( "cube.off"); //exit(0); int err, result; string geomfile; if (argc == 2) { geomfile = argv[1]; } else { cout << "Usage: executable geomfile (*.brep) " << endl; if (argc != 1) return 1; printf(" No file specified. Defaulting to: %s\n", "brick.brep"); geomfile = "brick.brep"; } //////////////////////////////////////////////////////////////////////////// //Read the BRep geometric file //////////////////////////////////////////////////////////////////////////// iGeom_Instance geom; readGeometry(geomfile, geom); //////////////////////////////////////////////////////////////////////////// // Generate the mesh. //////////////////////////////////////////////////////////////////////////// EdgeMesher *edgeMesher = new EdgeMesher; SurfaceMesher *surfMesher = SurfaceMesherFactory::getProduct("TetGen"); VolumeMesher *volMesher = VolumeMesherFactory::getProduct("TetGen"); GeomMesh geomesh; geomesh.setGeometry(geom); geomesh.edgeMesher = edgeMesher; geomesh.surfMesher = surfMesher; geomesh.volMesher = volMesher; Discretize_Geometric_Model(geomesh); //////////////////////////////////////////////////////////////////////////// //Save the mesh //////////////////////////////////////////////////////////////////////////// const char *outfile = "brick.vtk"; int namelen = strlen(outfile); const char *options = NULL; int optlen = 0; iMesh_Instance mesh = geomesh.mesh; iBase_EntitySetHandle meshRootSet = geomesh.meshRootSet; iMesh_save(mesh, meshRootSet, outfile, options, &err, namelen, optlen); return 0; }
// Read in the scene data, and load the necessary resources scene_data* loadScene(const std::string& fileName) { scene_data* scene = new scene_data; boost::property_tree::ptree pt; boost::property_tree::read_json(fileName, pt); readGeometry(scene, pt.get_child("geometry")); readTextures(scene, pt.get_child("textures")); readMaterials(scene, pt.get_child("materials")); readObjects(scene, pt.get_child("objects")); readLighting(scene, pt.get_child("lighting")); readDynamicLights(scene, pt.get_child("dynamic_lighting")); return scene; }
//--------------------------------------------------------------------- void OgreMeshDeserializer::readMesh() { //First value is whether it's skeletally animated m_stream.seekg(sizeof(bool), std::ios_base::cur); // Find all substreams if (!m_stream.eof()) { unsigned short streamID = readChunk(m_stream); while (!m_stream.eof() && (streamID == M_GEOMETRY || streamID == M_SUBMESH || streamID == M_MESH_SKELETON_LINK || streamID == M_MESH_BONE_ASSIGNMENT || streamID == M_MESH_LOD_LEVEL || streamID == M_MESH_BOUNDS || streamID == M_SUBMESH_NAME_TABLE || streamID == M_EDGE_LISTS || streamID == M_POSES || streamID == M_ANIMATIONS || streamID == M_TABLE_EXTREMES)) { switch (streamID) { case M_GEOMETRY: readGeometry(); break; case M_SUBMESH: readSubMesh(); break; case M_MESH_BOUNDS: readBoundsInfo(); break; default: skipChunk(m_stream); } if (!m_stream.eof()) { streamID = readChunk(m_stream); } } if (!m_stream.eof()) { // Backpedal back to start of m_stream backpedalChunkHeader(m_stream); } } }
Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh ( const objectRegistry& registry ) { readGeometry(); Info<< "Creating a polyMesh" << endl; createPolyCells(); Info<< "Number of internal faces: " << nInternalFaces_ << endl; createPolyBoundary(); clearExtraStorage(); autoPtr<polyMesh> mesh ( new polyMesh ( IOobject ( polyMesh::defaultRegion, "constant", registry ), xferMove(points_), xferMove(meshFaces_), xferMove(cellPolys_) ) ); // adding patches also checks the mesh mesh().addPatches(polyBoundaryPatches(mesh)); warnDuplicates("boundaries", mesh().boundaryMesh().names()); addCellZones(mesh()); addFaceZones(mesh()); return mesh; }
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); } }
void OgreMeshReader::readMesh(void) { OSG_OGRE_LOG(("OgreMeshReader::readMesh\n")); bool skelAnim = readBool(_is); bool stop = false; Int16 boneIdxVE = -1; Int16 boneWeightVE = -1; VertexElementStore sharedVertexElements; SubMeshStore subMeshInfo; while(_is) { readChunkHeader(_is); switch(_header.chunkId) { case CHUNK_SUBMESH: readSubMesh(subMeshInfo, sharedVertexElements, skelAnim); break; case CHUNK_GEOMETRY: readGeometry(sharedVertexElements); break; case CHUNK_MESH_SKELETON_LINK: readMeshSkeletonLink(subMeshInfo); break; case CHUNK_MESH_BONE_ASSIGNMENT: readMeshBoneAssignment(sharedVertexElements, boneIdxVE, boneWeightVE); break; case CHUNK_MESH_LOD: readMeshLOD(); break; case CHUNK_MESH_BOUNDS: readMeshBounds(); break; case CHUNK_SUBMESH_NAME_TABLE: readSubMeshNameTable(subMeshInfo); break; case CHUNK_EDGE_LISTS: readEdgeLists(); break; case CHUNK_POSES: readPoses(); break; case CHUNK_ANIMATIONS: readAnimations(); break; case CHUNK_TABLE_EXTREMES: readTableExtremes(); break; default: OSG_OGRE_LOG(("OgreMeshReader::readMesh: Unknown chunkId '0x%x'\n", _header.chunkId)); stop = true; break; }; if(stop == true) { skip(_is, -_chunkHeaderSize); break; } } if(boneIdxVE >= 0 || boneWeightVE >= 0) { verifyBoneAssignment(sharedVertexElements, boneIdxVE, boneWeightVE); } SubMeshStore::iterator smIt = subMeshInfo.begin(); SubMeshStore::iterator smEnd = subMeshInfo.end (); for(; smIt != smEnd; ++smIt) { if((*smIt).sharedVertex == true) { constructSubMesh(*smIt, sharedVertexElements); } else { constructSubMesh(*smIt, (*smIt).vertexElements); } } }
//--------------------------------------------------------------------- void OgreMeshDeserializer::readSubMesh() { unsigned short streamID; std::string materialName = readString(m_stream); bool useSharedVertices; readBools(m_stream, &useSharedVertices, 1); size_t offset = 0; if (!useSharedVertices) { offset = m_vertices.size() / 3; } unsigned int indexCount = 0; readInts(m_stream, &indexCount, 1); bool idx32bit; readBools(m_stream, &idx32bit, 1); if (indexCount > 0) { if (idx32bit) { std::vector<std::uint32_t> indices; indices.resize(indexCount); readInts(m_stream, indices.data(), indexCount); for (auto& index : indices) { m_indices.emplace_back(index + offset); } } else // 16-bit { std::vector<std::uint16_t> indices; indices.resize(indexCount); readShorts(m_stream, indices.data(), indexCount); for (auto& index : indices) { m_indices.emplace_back(index + offset); } } } { // M_GEOMETRY m_stream (Optional: present only if useSharedVertices = false) if (!useSharedVertices) { streamID = readChunk(m_stream); if (streamID != M_GEOMETRY) { std::runtime_error("Missing geometry data in mesh file"); } readGeometry(); } // Find all bone assignments, submesh operation, and texture aliases (if present) if (!m_stream.eof()) { streamID = readChunk(m_stream); while (!m_stream.eof() && (streamID == M_SUBMESH_BONE_ASSIGNMENT || streamID == M_SUBMESH_OPERATION || streamID == M_SUBMESH_TEXTURE_ALIAS)) { skipChunk(m_stream); if (!m_stream.eof()) { streamID = readChunk(m_stream); } } if (!m_stream.eof()) { // Backpedal back to start of m_stream backpedalChunkHeader(m_stream); } } } }
CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::CMainWindow) { ui->setupUi(this); networkDisconnected(); disableBattleroom(); setWindowTitle(QString("HoSpLo v") + VERSION); ui->ChannelSplitter->setSizes(QList<int>() << 100 << 300); ui->ChatSplitter->setSizes(QList<int>() << 300 << 100); ui->graphicsView->setScene(&MapScene); ui->BattleMapView->setScene(&CBattleroomManager::instance()->MapScene); ui->SmallBattleMapView->setScene(&CBattleroomManager::instance()->MapScene); ui->graphicsView->setRenderHint(QPainter::Antialiasing, true); ui->ChatTabWidget->chatView()->setVisible(false); Map = new CMap("DeltaSiegeDry.smf"); Map->loadFromUnitSync(); static QList<CUser *> Users; /*Users << new CUser("Kosyak1", 1000, "RU") << new CUser("Kosyak2", 1000, "RU") << new CUser("Kosyak3", 1000, "RU") << new CUser("Kosyak4", 1000, "RU") << new CUser("Kosyak5", 1000, "RU"); Users[0]->Command = 1; Users[0]->Color = QColor(255, 255, 255); Users[1]->Command = 2; Users[1]->Color = QColor(0, 0, 0); Users[2]->Command = 3; Users[2]->Color = QColor(255, 0, 0); Users[3]->Command = 4; Users[3]->Color = QColor(0, 255, 0); Users[4]->Command = 5; Users[4]->Color = QColor(0, 0, 255);*/ MapScene.setMap(Map, StartPosition::IN_GAME); MapScene.addBox(1, QRect(0, 0, 50, 200)); MapScene.addBox(2, QRect(150, 0, 50, 200)); //MapScene.setUsers(&Users); ui->ChannelUserView->setModel(CUserManager::instance()->chatModel()); ui->ChannelsView->setModel(CChatManager::instance()->channelSortModel()); ui->BattleListView->setModel(CBattleManager::instance()->battleListModel()); ui->BattleListView->addAction(ui->actionDownloadMap); ui->BattleListView->addAction(ui->actionDownloadMod); ui->BattlePreviewView->setModel(CBattleManager::instance()->battlePreviewModel()); ui->DownloadView->setModel(CDownloadManager::instance()->sortModel()); ui->DownloadView->setItemDelegateForColumn(Downloader::COL_PROGRESS, new CProgressDelegate()); ui->DownloadView->addAction(ui->actionDeleteDownload); ui->BattleUserView->setModel(&CBattleroomManager::instance()->UserProxy); ui->BattleUserView->setItemDelegateForColumn(BattleroomManager::COL_SIDE, &CBattleroomManager::instance()->sideDelegate); ui->ChatMessageEdit->addAction(ui->actionChatSend); ui->actionChatSend->setShortcutContext(Qt::WidgetShortcut); ui->BattleMessageEdit->addAction(ui->actionBattleSend); ui->actionBattleSend->setShortcutContext(Qt::WidgetShortcut); DownloadContextMenu = new QMenu(ui->DownloadView); DownloadContextMenu->addActions(ui->DownloadView->actions()); BattleContextMenu = new QMenu(ui->BattleListView); BattleContextMenu->addActions(ui->BattleListView->actions()); connectSignals(); readGeometry(); if(Settings.value("Network/AutoConnect", false).toBool()) ConnectDialog.accept(); }
void getSegmentStrings(const std::string& wkt, SegStrVct& vct) { GeomPtr g = readGeometry(wkt); getSegmentStrings(*g, vct); }
void readSubMesh(IOReadBase* pRead, iModelData* pModelData, const CSubMesh& sharedSubMesh) { iLodMesh* pMesh = &pModelData->getMesh(); std::string strMaterialName = readString(pRead); int nSubID=pMesh->getSubCount(); pModelData->setRenderPass(nSubID,nSubID,strMaterialName); // if(listener) // listener->processMaterialName(pMesh, &materialName); // sm->setMaterialName(materialName); // bool useSharedVertices bool useSharedVertices; pRead->Read(&useSharedVertices,sizeof(bool)); CSubMesh& subMesh=pMesh->addSubMesh(); if (useSharedVertices) { subMesh.pos =sharedSubMesh.pos; subMesh.weight =sharedSubMesh.weight; subMesh.bone =sharedSubMesh.bone; subMesh.normal =sharedSubMesh.normal; subMesh.color =sharedSubMesh.color; subMesh.texcoord =sharedSubMesh.texcoord; subMesh.texcoord2 =sharedSubMesh.texcoord2; } // sm->indexData->indexStart = 0; unsigned int indexCount = 0; pRead->Read(&indexCount,sizeof(unsigned int)); //sm->indexData->indexCount = indexCount; // bool indexes32Bit bool idx32bit; pRead->Read(&idx32bit,sizeof(bool)); if (idx32bit) { MessageBoxW(0,L"Can't read idx32bit",L"Error",0); VertexIndex vertexIndex; for (size_t i=0;i<indexCount;++i) { unsigned int uVertexIndex; pRead->Read(&uVertexIndex,sizeof(unsigned int)); vertexIndex.p=uVertexIndex; vertexIndex.n=uVertexIndex; vertexIndex.c=uVertexIndex; vertexIndex.uv1=uVertexIndex; vertexIndex.b=uVertexIndex; vertexIndex.w=uVertexIndex; subMesh.m_setVertexIndex.push_back(vertexIndex); } } else // 16-bit { VertexIndex vertexIndex; for (size_t i=0;i<indexCount;++i) { unsigned short uVertexIndex; pRead->Read(&uVertexIndex,sizeof(unsigned short)); vertexIndex.p=uVertexIndex; vertexIndex.n=uVertexIndex; vertexIndex.c=uVertexIndex; vertexIndex.uv1=uVertexIndex; vertexIndex.b=uVertexIndex; vertexIndex.w=uVertexIndex; subMesh.m_setVertexIndex.push_back(vertexIndex); } } // M_GEOMETRY stream (Optional: present only if useSharedVertices = false) if (!useSharedVertices) { unsigned short streamID; unsigned int uLength; pRead->Read(&streamID,sizeof(unsigned short)); pRead->Read(&uLength,sizeof(unsigned int)); if (streamID != M_GEOMETRY) { MessageBoxW(0,L"Missing geometry data in mesh file",L"readSubMesh",0); } readGeometry(pRead, subMesh); } // Find all bone assignments, submesh operation, and texture aliases (if present) if (!pRead->IsEof()) { unsigned short streamID; unsigned int uLength; pRead->Read(&streamID,sizeof(unsigned short)); pRead->Read(&uLength,sizeof(unsigned int)); while(!pRead->IsEof() && (streamID == M_SUBMESH_BONE_ASSIGNMENT || streamID == M_SUBMESH_OPERATION || streamID == M_SUBMESH_TEXTURE_ALIAS)) { switch(streamID) { case M_SUBMESH_OPERATION: // readSubMeshOperation(stream, pMesh, sm); // unsigned short operationType unsigned short opType; pRead->Read(&opType,sizeof(unsigned short)); //sm->operationType = static_cast<RenderOperation::OperationType>(opType); break; case M_SUBMESH_BONE_ASSIGNMENT: { //readSubMeshBoneAssignment(stream, pMesh, sm); VertexBoneAssignment assign; // unsigned int vertexIndex; pRead->Read(&(assign.vertexIndex),sizeof(unsigned int)); // unsigned short boneIndex; pRead->Read(&(assign.boneIndex),sizeof(unsigned short)); // float weight; pRead->Read(&(assign.weight),sizeof(float)); break; unsigned long uBone = 0; unsigned long uWeight = 0; // get subMesh.getBone(assign.vertexIndex,uBone); subMesh.getWeight(assign.vertexIndex,uWeight); // add for (size_t i=0;i<4;++i) { if (((unsigned char*)&uWeight)[i]==0) { ((unsigned char*)&uWeight)[i] = assign.weight*255; ((unsigned char*)&uBone)[i] = assign.boneIndex; break; } } // set subMesh.setBone(assign.vertexIndex,uBone); subMesh.setWeight(assign.vertexIndex,uWeight); //sub->addBoneAssignment(assign); } break; case M_SUBMESH_TEXTURE_ALIAS: //readSubMeshTextureAlias(stream, pMesh, sm); std::string aliasName = readString(pRead); std::string textureName = readString(pRead); //sub->addTextureAlias(aliasName, textureName); break; } if (!pRead->IsEof()) { pRead->Read(&streamID,sizeof(unsigned short)); pRead->Read(&uLength,sizeof(unsigned int)); } } if (!pRead->IsEof()) { // Backpedal back to start of non-submesh stream pRead->Move(-STREAM_OVERHEAD_SIZE); } } }
void readMesh(IOReadBase* pRead, iModelData* pModelData) { bool skeletallyAnimated; pRead->Read(&skeletallyAnimated,sizeof(bool)); // Find all substreams if (!pRead->IsEof()) { CSubMesh sharedSubMesh; unsigned short streamID; unsigned int uLength; pRead->Read(&streamID,sizeof(unsigned short)); pRead->Read(&uLength,sizeof(unsigned int)); while(!pRead->IsEof() && (streamID == M_GEOMETRY || streamID == M_SUBMESH || streamID == M_MESH_SKELETON_LINK || streamID == M_MESH_BONE_ASSIGNMENT || streamID == M_MESH_LOD || streamID == M_MESH_BOUNDS || streamID == M_SUBMESH_NAME_TABLE || streamID == M_EDGE_LISTS || streamID == M_POSES || streamID == M_ANIMATIONS || streamID == M_TABLE_EXTREMES)) { switch(streamID) { case M_GEOMETRY: { //MessageBoxW(NULL, L"M_GEOMETRY", L"readMesh",0); readGeometry(pRead, sharedSubMesh); } break; case M_SUBMESH: readSubMesh(pRead, pModelData, sharedSubMesh); break; case M_MESH_SKELETON_LINK: { std::string skelName = readString(pRead); // if(listener) // listener->processSkeletonName(pMesh, &skelName); // // pMesh->setSkeletonName(skelName); //readSkeletonLink(stream, pMesh, listener); } break; case M_MESH_BONE_ASSIGNMENT: //readMeshBoneAssignment(stream, pMesh); { VertexBoneAssignment assign; // unsigned int vertexIndex; pRead->Read(&(assign.vertexIndex),sizeof(unsigned int)); // unsigned short boneIndex; pRead->Read(&(assign.boneIndex),sizeof(unsigned short)); // float weight; pRead->Read(&(assign.weight),sizeof(float)); //sub->addBoneAssignment(assign); } break; case M_MESH_LOD: MessageBoxW(NULL,L"M_MESH_LOD",0,0); //readMeshLodInfo(stream, pMesh); break; case M_MESH_BOUNDS: //readBoundsInfo(stream, pMesh); { Vec3D min, max; // float minx, miny, minz pRead->Read(&min,sizeof(Vec3D)); // float maxx, maxy, maxz pRead->Read(&max,sizeof(Vec3D)); //AxisAlignedBox box(min, max); //pMesh->_setBounds(box, true); // float radius float radius; pRead->Read(&radius,sizeof(float)); //pMesh->_setBoundingSphereRadius(radius); } break; case M_SUBMESH_NAME_TABLE: MessageBoxW(NULL,L"M_SUBMESH_NAME_TABLE",0,0); //readSubMeshNameTable(stream, pMesh); break; case M_EDGE_LISTS: MessageBoxW(NULL,L"M_EDGE_LISTS",0,0); //readEdgeList(stream, pMesh); break; case M_POSES: MessageBoxW(NULL,L"M_POSES",0,0); //readPoses(stream, pMesh); break; case M_ANIMATIONS: MessageBoxW(NULL,L"M_ANIMATIONS",0,0); //readAnimations(stream, pMesh); break; case M_TABLE_EXTREMES: MessageBoxW(NULL,L"M_TABLE_EXTREMES",0,0); //readExtremes(stream, pMesh); break; } if (!pRead->IsEof()) { pRead->Read(&streamID,sizeof(unsigned short)); pRead->Read(&uLength,sizeof(unsigned int)); } } if (!pRead->IsEof()) { // Backpedal back to start of non-submesh stream pRead->Move(-STREAM_OVERHEAD_SIZE); } } }