72 init( model->m_mesh );
107 m_colors = mesh->getVertexColors(w_color);
110 assert(w_color == 3);
113 m_faces = mesh->getFaceIndices();
166 for(
size_t i = 0; i < 3 * o.
m_numFaces; ++i )
178 float ambient_color[] = {r, g, b};
179 float diffuse_color[] = {0.45f * r, 0.5f * g, 0.55f * b};
181 float specular_color[] = {0.1f, 0.15f, 0.1f};
182 float shine[] = {0.1f};
184 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient_color);
185 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse_color);
186 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular_color);
187 glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, shine);
212 glDisable(GL_LIGHTING);
213 glDisable(GL_TEXTURE_2D);
214 glColor3f(0.0, 0.0, 0.0);
218 size_t index = 3 * i;
220 int b = 3 *
m_faces[index + 1];
221 int c = 3 *
m_faces[index + 2];
222 glBegin(GL_TRIANGLES);
229 glEnable(GL_LIGHTING);
230 glEnable(GL_TEXTURE_2D);
244 glEnableClientState(GL_VERTEX_ARRAY);
245 glEnableClientState(GL_NORMAL_ARRAY);
246 glEnableClientState(GL_COLOR_ARRAY);
251 glEnable(GL_LIGHTING);
252 glEnable(GL_COLOR_MATERIAL);
257 glVertexPointer( 3, GL_FLOAT, 0,
m_vertices.get() );
259 glColorPointer( 3, GL_UNSIGNED_BYTE, 0,
m_colors.get() );
262 glDrawElements(GL_TRIANGLES, (GLsizei)3 *
m_numFaces, GL_UNSIGNED_INT,
m_faces.get());
291 glDisable(GL_LIGHTING);
292 glColor3f(1.0, 1.0, 0.0);
293 glRasterPos3f(v.
x, v.
y, v.
z);
294 for(
int i = 0; i <
Name().size(); i++)
298 glEnable(GL_LIGHTING);
316 size_t a, b, c, buffer_pos;
331 b =
m_faces[buffer_pos + 1] * 3;
332 c =
m_faces[buffer_pos + 2] * 3;
virtual void setName(string name)
unsigned char * m_blackColors
std::shared_ptr< MeshBuffer > MeshBufferPtr
boost::shared_array< unsigned int > uintArr
size_t getNumberOfFaces()
BaseVector< CoordT > cross(const BaseVector &other) const
Calculates the cross product between this and the given vector. Returns a new BaseVector instance...
void interpolateNormals()
boost::shared_array< unsigned char > ucharArr
A dynamic bounding box class.
void setColorMaterial(float r, float g, float b)
boost::shared_array< unsigned int > indexArray
size_t getNumberOfVertices()
boost::shared_array< float > floatArr
void init(MeshBufferPtr mesh)
void compileColoredMeshList()
std::shared_ptr< Model > ModelPtr
BoundingBox< Vec > * m_boundingBox
virtual void savePLY(string filename)
void compileWireframeList()