void Line3DOverlay::render(RenderArgs* args) { if (!_visible) { return; // do nothing if we're not visible } float alpha = getAlpha(); xColor color = getColor(); const float MAX_COLOR = 255.0f; glm::vec4 colorv4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha); auto batch = args->_batch; if (batch) { batch->setModelTransform(_transform); auto geometryCache = DependencyManager::get<GeometryCache>(); geometryCache->bindSimpleProgram(*batch, false, false, true, true); if (getIsDashedLine()) { // TODO: add support for color to renderDashedLine() geometryCache->renderDashedLine(*batch, _start, _end, colorv4, _geometryCacheID); } else { geometryCache->renderLine(*batch, _start, _end, colorv4, _geometryCacheID); } } }
void Line3DOverlay::render(RenderArgs* args) { if (!_visible) { return; // do nothing if we're not visible } float alpha = getAlpha(); xColor color = getColor(); const float MAX_COLOR = 255.0f; glm::vec4 colorv4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha); auto batch = args->_batch; if (batch) { batch->setModelTransform(_transform); if (getIsDashedLine()) { // TODO: add support for color to renderDashedLine() DependencyManager::get<GeometryCache>()->renderDashedLine(*batch, _start, _end, colorv4, _geometryCacheID); } else { DependencyManager::get<GeometryCache>()->renderLine(*batch, _start, _end, colorv4, _geometryCacheID); } } else { float glowLevel = getGlowLevel(); Glower* glower = NULL; if (glowLevel > 0.0f) { glower = new Glower(glowLevel); } glPushMatrix(); glDisable(GL_LIGHTING); glLineWidth(_lineWidth); glm::vec3 position = getPosition(); glm::quat rotation = getRotation(); glTranslatef(position.x, position.y, position.z); glm::vec3 axis = glm::axis(rotation); glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); if (getIsDashedLine()) { // TODO: add support for color to renderDashedLine() DependencyManager::get<GeometryCache>()->renderDashedLine(_start, _end, colorv4, _geometryCacheID); } else { DependencyManager::get<GeometryCache>()->renderLine(_start, _end, colorv4, _geometryCacheID); } glEnable(GL_LIGHTING); glPopMatrix(); if (glower) { delete glower; } } }