working on drawing planes
git-svn-id: svn://anubis/anaglym/trunk@127 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
c79ff10b43
commit
ce1da5f7a8
23
Engine.cc
23
Engine.cc
@ -759,7 +759,28 @@ void Engine::Object::render()
|
||||
case OdeWorld::SPHERE:
|
||||
gluSphere(quad, (*m_args)[0], 16, 8);
|
||||
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;
|
||||
case OdeWorld::CYLINDER:
|
||||
glPushMatrix();
|
||||
|
Loading…
x
Reference in New Issue
Block a user