50 for(
size_t i = 0; i < n; i++)
69 m_faces = mesh->getFaceIndices();
78 for (
size_t i = 0; i < mesh->getTextures().size(); i++)
109 map<int, MaterialGroup* > texMatMap;
110 map<VecUChar, MaterialGroup*, Util::ColorVecCompare> colorMatMap;
116 map<int, MaterialGroup*>::iterator texIt;
117 map<VecUChar, MaterialGroup*, Util::ColorVecCompare>::iterator colIt;
128 texIt = texMatMap.find(m.
m_texture->idx());
129 if(texIt == texMatMap.end())
146 if(colIt == colorMatMap.end())
156 colIt->second->faceBuffer.push_back(i);
166 glEnableClientState(GL_VERTEX_ARRAY);
167 glEnableClientState(GL_NORMAL_ARRAY);
168 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
178 glVertexPointer( 3, GL_FLOAT, 0,
m_vertices.get() );
179 glNormalPointer( GL_FLOAT, 0,
m_normals.get() );
180 glTexCoordPointer(3, GL_FLOAT, 0,
m_texcoords.get());
188 unsigned int* buf =
new unsigned int [3 * g->
faceBuffer.size()];
191 glColor3f(1.0, 1.0, 1.0);
193 glDrawElements(GL_TRIANGLES, 3 * g->
faceBuffer.size(), GL_UNSIGNED_INT, buf);
199 glDisable(GL_TEXTURE_2D);
200 glBegin(GL_TRIANGLES);
205 for(
size_t i = 0; i < g->
faceBuffer.size(); i++)
225 glEnable(GL_TEXTURE_2D);
vector< size_t > faceBuffer
A material that stores information about color and texture of a cluster.
vector< MaterialGroup * > m_colorMaterials
std::shared_ptr< MeshBuffer > MeshBufferPtr
boost::shared_array< GlTexture *> textureArr
A dynamic bounding box class.
void setColorMaterial(float r, float g, float b)
BaseVector< unsigned char > VecUChar
OutMapT< typename InMapT::HandleType, std::result_of_t< MapF(typename InMapT::ValueType)> > map(const InMapT &mapIn, MapF func)
Calls func for each value of the given map and save the result in the output map. ...
vector< Material > & m_materials
indexArray m_faceMaterials
TexturedMesh(MeshBufferPtr mesh)
void compileTexureDisplayList()
void generateMaterialGroups()
vector< MaterialGroup * > m_textureMaterials
BoundingBox< Vec > * m_boundingBox
boost::optional< Rgb8Color > m_color
Optional color.
void getBufferArray(unsigned int *, MaterialGroup *g)
boost::optional< TextureHandle > m_texture
Optional texture handle.
void compileWireframeList()