//------------------------------------------------------------------------------ // TriMesh implementation bool TriMesh::loadFile(QString fileName, size_t /*maxVertexCount*/) { // maxVertexCount is ignored - not sure there's anything useful we can do // to respect it when loading a mesh... PlyLoadInfo info; if (!loadPlyFile(fileName, info)) return false; setFileName(fileName); V3d offset = V3d(info.offset[0], info.offset[1], info.offset[2]); setOffset(offset); setCentroid(getCentroid(offset, info.verts)); setBoundingBox(getBoundingBox(offset, info.verts)); m_verts.swap(info.verts); m_colors.swap(info.colors); m_texcoords.swap(info.texcoords); m_triangles.swap(info.triangles); m_edges.swap(info.edges); if (!info.textureFileName.isEmpty()) { QImage image; if (image.load(info.textureFileName)) m_texture.reset(new Texture(image)); else g_logger.warning("Could not load texture %s for model %s", info.textureFileName, fileName); } //makeSmoothNormals(m_normals, m_verts, m_triangles); //makeEdges(m_edges, m_triangles); return true; }
void minescapeSetup() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glScalef(0.1f, 0.1f, 0.1f); loadPlyFile(); return; }
//------------------------------------------------------------------------------ // TriMesh implementation bool TriMesh::loadFile(QString fileName, size_t /*maxVertexCount*/) { // maxVertexCount is ignored - not sure there's anything useful we can do // to respect it when loading a mesh... PlyLoadInfo info; if (!loadPlyFile(fileName, info)) return false; setFileName(fileName); V3d offset = V3d(info.offset[0], info.offset[1], info.offset[2]); setOffset(offset); setCentroid(getCentroid(offset, info.verts)); setBoundingBox(getBoundingBox(offset, info.verts)); m_verts.swap(info.verts); m_colors.swap(info.colors); m_faces.swap(info.faces); m_edges.swap(info.edges); //makeSmoothNormals(m_normals, m_verts, m_faces); //makeEdges(m_edges, m_faces); return true; }