diff --git a/Engine.cc b/Engine.cc index fa97ba0..f35a02f 100644 --- a/Engine.cc +++ b/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;