working on drawing planes

git-svn-id: svn://anubis/anaglym/trunk@127 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-27 21:31:21 +00:00
parent c79ff10b43
commit ce1da5f7a8

View File

@ -759,7 +759,28 @@ void Engine::Object::render()
case OdeWorld::SPHERE: case OdeWorld::SPHERE:
gluSphere(quad, (*m_args)[0], 16, 8); gluSphere(quad, (*m_args)[0], 16, 8);
break; break;
case OdeWorld::PLANE: case OdeWorld::PLANE: {
dMatrix3 r;
dRFromEulerAngles(r, (*m_args)[3], (*m_args)[4], (*m_args)[5]);
dVector3 default_plane_direction = {0, 0, 1, 0};
dVector3 default_x = {1, 0, 0, 0};
dVector3 default_y = {0, 1, 0, 0};
dVector3 rotated_plane_direction;
dVector3 rotated_x;
dVector3 rotated_y;
dMultiply0(rotated_plane_direction, default_plane_direction, r, 1, 3, 3);
dMultiply0(rotated_x, default_x, r, 1, 3, 3);
dMultiply0(rotated_y, default_y, r, 1, 3, 3);
float a = rotated_plane_direction[0];
float b = rotated_plane_direction[1];
float c = rotated_plane_direction[2];
float d = (a * (*m_args)[0] + b * (*m_args)[1] + c * (*m_args)[2]);
/* plane equation: ax + by + cz = d, plane normal: (a, b, c) */
glBegin(GL_QUAD_STRIP);
glNormal3f(a, b, c);
glEnd();
}
break; break;
case OdeWorld::CYLINDER: case OdeWorld::CYLINDER:
glPushMatrix(); glPushMatrix();