void Grid::render(RenderingConfiguration &renderingConfiguration) { if ((getNodeDescriptor().getName().size() == 0) || (renderingConfiguration.getNodeRenderingConfiguration(getNodeDescriptor()).hasParameter(NodeRenderingConfiguration::ENABLED))) { glPushMatrix(); { glLineWidth(m_lineWidth); glColor3f(1, 1, 1); glBegin(GL_LINES); int32_t size = m_size; for (int32_t y = -size; y <= size; y++) { for (int32_t x = -size; x <= size; x++) { // X-axis. glVertex3f(0, static_cast<float>(y), 0); glVertex3f(static_cast<float>(x), static_cast<float>(y), 0); // Y-axis. glVertex3f(static_cast<float>(x), 0, 0); glVertex3f(static_cast<float>(x), static_cast<float>(y), 0); } } glEnd(); glLineWidth(1); } glPopMatrix(); } }
void XYZAxes::render(const RenderingConfiguration &renderingConfiguration) const { // Render if unnamed or not disabled. if ((getNodeDescriptor().getName().size() == 0) || (renderingConfiguration.getNodeRenderingConfiguration(getNodeDescriptor()).hasParameter(NodeRenderingConfiguration::ENABLED))) { glPushMatrix(); { glLineWidth(m_lineWidth); glColor3f(1, 1, 1); glBegin(GL_LINES); // X-axis. glVertex3f(0, 0, 0); glVertex3f(m_lineLength, 0, 0); // Arrow. glVertex3f(m_lineLength, 0, 0); glVertex3f((m_lineLength - 0.1f), 0.1f, 0); glVertex3f(m_lineLength, 0, 0); glVertex3f((m_lineLength - 0.1f), -0.1f, 0); // X-label. glVertex3f(-0.3f + (m_lineLength - 0.1f), -0.3f + 0.1f, 0); glVertex3f(-0.3f + (m_lineLength + 0.1f), -0.3f + -0.1f, 0); glVertex3f(-0.3f + (m_lineLength + 0.1f), -0.3f + 0.1f, 0); glVertex3f(-0.3f + (m_lineLength - 0.1f), -0.3f + -0.1f, 0); // Y-axis glVertex3f(0, 0, 0); glVertex3f(0, m_lineLength, 0); // Arrow. glVertex3f(0, m_lineLength, 0); glVertex3f(0.1f, (m_lineLength - 0.1f), 0); glVertex3f(0, m_lineLength, 0); glVertex3f(-0.1f, (m_lineLength - 0.1f), 0); // Y-label. glVertex3f(-0.3f + -0.1f, m_lineLength, 0); glVertex3f(-0.3f + 0, (m_lineLength - 0.1f), 0); glVertex3f(-0.3f + 0.1f, m_lineLength, 0); glVertex3f(-0.3f + 0, (m_lineLength - 0.1f), 0); glVertex3f(-0.3f + 0, (m_lineLength - 0.1f), 0); glVertex3f(-0.3f + 0, (m_lineLength - 0.2f), 0); // Z-axis glVertex3f(0, 0, 0); glVertex3f(0, 0, m_lineLength); // Arrow. glVertex3f(0, 0, m_lineLength); glVertex3f(0.1f, 0, (m_lineLength - 0.1f)); glVertex3f(0, 0, m_lineLength); glVertex3f(-0.1f, 0, (m_lineLength - 0.1f)); // Z-label. glVertex3f(-0.3f + -0.1f, 0, m_lineLength); glVertex3f(-0.3f + 0.1f, 0, m_lineLength); glVertex3f(-0.3f + 0.1f, 0, m_lineLength); glVertex3f(-0.3f + -0.1f, 0, (m_lineLength - 0.1f)); glVertex3f(-0.3f + -0.1f, 0, (m_lineLength - 0.1f)); glVertex3f(-0.3f + 0.1f, 0, (m_lineLength - 0.1f)); glEnd(); glLineWidth(1); } glPopMatrix(); } }