finished drawing managed planes (i think)
git-svn-id: svn://anubis/anaglym/trunk@128 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
ce1da5f7a8
commit
0d15c1a054
28
Engine.cc
28
Engine.cc
@ -772,13 +772,31 @@ void Engine::Object::render()
|
||||
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) */
|
||||
|
||||
const int num_sections = 10;
|
||||
const float section_size = 10.0f;
|
||||
float x_o = (*m_args)[0];
|
||||
float y_o = (*m_args)[1];
|
||||
float z_o = (*m_args)[2];
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
glNormal3f(a, b, c);
|
||||
glNormal3fv(rotated_plane_direction);
|
||||
for (int x = 0; x < num_sections; x++)
|
||||
{
|
||||
for (int y = 0; y <= num_sections; y++)
|
||||
{
|
||||
float half_span = num_sections * section_size / 2.0;
|
||||
float x_c = x * section_size - half_span;
|
||||
float y_c = y * section_size - half_span;
|
||||
glVertex3f(x_o + rotated_x[0] * x_c + rotated_y[0] * y_c,
|
||||
y_o + rotated_x[1] * x_c + rotated_y[1] * y_c,
|
||||
z_o + rotated_x[2] * x_c + rotated_y[2] * y_c);
|
||||
x_c += section_size;
|
||||
glVertex3f(x_o + rotated_x[0] * x_c + rotated_y[0] * y_c,
|
||||
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();
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user