本文整理汇总了C++中math::Vector3d::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector3d::getData方法的具体用法?C++ Vector3d::getData怎么用?C++ Vector3d::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math::Vector3d
的用法示例。
在下文中一共展示了Vector3d::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawModel
void GfxOpenGL::drawModel(Model *m) {
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)_screenWidth/(GLfloat)_screenHeight,0.01f,10.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor4ub(255, 255, 255, 255);
gluLookAt( 0, 0, 1, 0, 0, 0, 0, 1, 0 );
glPushMatrix();
glTranslatef((_cameraX/(float)_screenWidth), -(_cameraY/(float)_screenHeight), (_cameraZ/(float)_screenHeight));
glRotatef(_rotY, 1, 0, 0);
glRotatef(_rotX, 0, 1, 0);
for (uint j = 0; j < m->_numPolygons; j++) {
Polygon *p = &m->_polygons[j];
glBegin(GL_POLYGON);
for (int i = 0; i < m->_polygons->_num; ++i) {
uint32 vert = p->_data[i];
if (vert > m->_numVerticies || vert == 0) {
break;
}
glColor4ub(_palette->_palette[p->_colour]._r, _palette->_palette[p->_colour]._g, _palette->_palette[p->_colour]._b, 255);
Vertex *v = &m->_verticies[vert];
if (v->_bone == 0) {
continue;
}
Math::Vector3d mv = v->getPos(m);
Normal *n = &m->_normals[vert];
glNormal3f(n->_x, n->_y, n->_z);
glVertex3fv(mv.getData());
}
glEnd();
}
for (uint j = 0; j < m->_numPoints; j++) {
Point *p = &m->_points[j];
glColor4ub(_palette->_palette[p->_colour]._r, _palette->_palette[p->_colour]._g, _palette->_palette[p->_colour]._b, 255);
Vertex *v1 = &m->_verticies[p->_v1];
Math::Vector3d vec1 = v1->getPos(m);
Vertex *v2 = &m->_verticies[p->_v2];
Math::Vector3d vec2 = v2->getPos(m);
glBegin(GL_LINES);
glVertex3fv(vec1.getData());
glVertex3fv(vec2.getData());
glEnd();
}
for (uint j = 0; j < m->_numSpheres; j++) {
Sphere *s = &m->_spheres[j];
Vertex *v = &m->_verticies[s->_vertex];
Math::Vector3d vec = v->getPos(m);
glColor4ub(_palette->_palette[s->_colour]._r, _palette->_palette[s->_colour]._g, _palette->_palette[s->_colour]._b, 255);
glPushMatrix();
glTranslatef(vec.x(), vec.y(), vec.z());
drawSphere(s->_size, 8, 8);
glPopMatrix();
}
glPopMatrix();
glDisable(GL_DEPTH_TEST);
}