fixed up managed plane rendering a bit

git-svn-id: svn://anubis/anaglym/trunk@129 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-27 23:38:23 +00:00
parent 0d15c1a054
commit e5f616b841

View File

@ -699,16 +699,16 @@ void Engine::Object::render()
if (m_args->size() >= 3) valid = true;
break;
case OdeWorld::SPHERE:
if (m_args->size() == 4) valid = true;
if (m_args->size() >= 1) valid = true;
break;
case OdeWorld::PLANE:
if (m_args->size() == 6) valid = true;
if (m_args->size() >= 6) valid = true;
break;
case OdeWorld::CYLINDER:
if (m_args->size() == 8) valid = true;
if (m_args->size() >= 2) valid = true;
break;
case OdeWorld::CCYLINDER:
if (m_args->size() == 8) valid = true;
if (m_args->size() >= 2) valid = true;
break;
}
if (!valid)
@ -719,23 +719,22 @@ void Engine::Object::render()
glNewList(m_display_list, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, m_color);
GLUquadric * quad = gluNewQuadric();
/* TODO: finish */
switch (m_geom_type)
{
case OdeWorld::CUBE: {
struct { float norm[3]; float verts[4][3]; } sides[] = {
{ {1, 0, 0}, /* right */
{ {1, -1, -1}, {1, 1, -1}, {1, 1, 1}, {1, -1, 1} } },
{{1, -1, -1}, {1, 1, -1}, {1, 1, 1}, {1, -1, 1}} },
{ {-1, 0, 0}, /* left */
{ {-1, 1, -1}, {-1, -1, -1}, {-1, -1, 1}, {-1, 1, 1} } },
{{-1, 1, -1}, {-1, -1, -1}, {-1, -1, 1}, {-1, 1, 1}} },
{ {0, 1, 0}, /* back */
{ {1, 1, -1}, {-1, 1, -1}, {-1, 1, 1}, {1, 1, 1} } },
{{1, 1, -1}, {-1, 1, -1}, {-1, 1, 1}, {1, 1, 1}} },
{ {0, -1, 0}, /* front */
{ {-1, -1, -1}, {1, -1, -1}, {1, -1, 1}, {-1, -1, 1} } },
{{-1, -1, -1}, {1, -1, -1}, {1, -1, 1}, {-1, -1, 1}} },
{ {0, 0, 1}, /* top */
{ {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1} } },
{{-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}} },
{ {0, 0, -1}, /* bottom */
{ {1, -1, -1}, {-1, -1, -1}, {-1, 1, -1}, {1, 1, -1} } }
{{1, -1, -1}, {-1, -1, -1}, {-1, 1, -1}, {1, 1, -1}} }
};
glBegin(GL_QUADS);
float width = (*m_args)[0];
@ -779,10 +778,10 @@ void Engine::Object::render()
float x_o = (*m_args)[0];
float y_o = (*m_args)[1];
float z_o = (*m_args)[2];
glBegin(GL_QUAD_STRIP);
glNormal3fv(rotated_plane_direction);
for (int x = 0; x < num_sections; x++)
{
glBegin(GL_QUAD_STRIP);
for (int y = 0; y <= num_sections; y++)
{
float half_span = num_sections * section_size / 2.0;
@ -796,8 +795,8 @@ void Engine::Object::render()
y_o + rotated_x[1] * x_c + rotated_y[1] * y_c,
z_o + rotated_x[2] * x_c + rotated_y[2] * y_c);
}
glEnd();
}
glEnd();
}
break;
case OdeWorld::CYLINDER: