Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 11 files). Show all
Unified · Split
| @@ -228,7 +228,7 @@ MetavoxelSystem::RenderVisitor::RenderVisitor() : · 227 unmodified lines | |||
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | bool MetavoxelSystem::RenderVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { | 230 | bool MetavoxelSystem::RenderVisitor::visit(Spanner* spanner, const glm::vec3& clipMinimum, float clipSize) { |
| 231 | spanner->getRenderer()->render(1.0f, clipMinimum, clipSize); | 231 | spanner->getRenderer()->render(1.0f, SpannerRenderer::DEFAULT_MODE, clipMinimum, clipSize); |
| 232 | return true; | 232 | return true; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| @@ -345,9 +345,9 @@ static void enableClipPlane(GLenum plane, float x, float y, float z, float w) { · 110 unmodified lines | |||
| 345 | glEnable(plane); | 345 | glEnable(plane); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | void ClippedRenderer::render(float alpha, const glm::vec3& clipMinimum, float clipSize) { | 348 | void ClippedRenderer::render(float alpha, Mode mode, const glm::vec3& clipMinimum, float clipSize) { |
| 349 | if (clipSize == 0.0f) { | 349 | if (clipSize == 0.0f) { |
| 350 | renderUnclipped(alpha); | 350 | renderUnclipped(alpha, mode); |
| 351 | return; | 351 | return; |
| 352 | } | 352 | } |
| 353 | enableClipPlane(GL_CLIP_PLANE0, -1.0f, 0.0f, 0.0f, clipMinimum.x + clipSize); | 353 | enableClipPlane(GL_CLIP_PLANE0, -1.0f, 0.0f, 0.0f, clipMinimum.x + clipSize); |
| @@ -357,7 +357,7 @@ void ClippedRenderer::render(float alpha, const glm::vec3& clipMinimum, float cl · 3 unmodified lines | |||
| 357 | enableClipPlane(GL_CLIP_PLANE4, 0.0f, 0.0f, -1.0f, clipMinimum.z + clipSize); | 357 | enableClipPlane(GL_CLIP_PLANE4, 0.0f, 0.0f, -1.0f, clipMinimum.z + clipSize); |
| 358 | enableClipPlane(GL_CLIP_PLANE5, 0.0f, 0.0f, 1.0f, -clipMinimum.z); | 358 | enableClipPlane(GL_CLIP_PLANE5, 0.0f, 0.0f, 1.0f, -clipMinimum.z); |
| 359 | 359 | ||
| 360 | renderUnclipped(alpha); | 360 | renderUnclipped(alpha, mode); |
| 361 | 361 | ||
| 362 | glDisable(GL_CLIP_PLANE0); | 362 | glDisable(GL_CLIP_PLANE0); |
| 363 | glDisable(GL_CLIP_PLANE1); | 363 | glDisable(GL_CLIP_PLANE1); |
| @@ -370,9 +370,9 @@ void ClippedRenderer::render(float alpha, const glm::vec3& clipMinimum, float cl · 6 unmodified lines | |||
| 370 | SphereRenderer::SphereRenderer() { | 370 | SphereRenderer::SphereRenderer() { |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | void SphereRenderer::render(float alpha, const glm::vec3& clipMinimum, float clipSize) { | 373 | void SphereRenderer::render(float alpha, Mode mode, const glm::vec3& clipMinimum, float clipSize) { |
| 374 | if (clipSize == 0.0f) { | 374 | if (clipSize == 0.0f) { |
| 375 | renderUnclipped(alpha); | 375 | renderUnclipped(alpha, mode); |
| 376 | return; | 376 | return; |
| 377 | } | 377 | } |
| 378 | // slight performance optimization: don't render if clip bounds are entirely within sphere | 378 | // slight performance optimization: don't render if clip bounds are entirely within sphere |
| @@ -381,13 +381,13 @@ void SphereRenderer::render(float alpha, const glm::vec3& clipMinimum, float cli · 2 unmodified lines | |||
| 381 | for (int i = 0; i < Box::VERTEX_COUNT; i++) { | 381 | for (int i = 0; i < Box::VERTEX_COUNT; i++) { |
| 382 | const float CLIP_PROPORTION = 0.95f; | 382 | const float CLIP_PROPORTION = 0.95f; |
| 383 | if (glm::distance(sphere->getTranslation(), clipBox.getVertex(i)) >= sphere->getScale() * CLIP_PROPORTION) { | 383 | if (glm::distance(sphere->getTranslation(), clipBox.getVertex(i)) >= sphere->getScale() * CLIP_PROPORTION) { |
| 384 | ClippedRenderer::render(alpha, clipMinimum, clipSize); | 384 | ClippedRenderer::render(alpha, mode, clipMinimum, clipSize); |
| 385 | return; | 385 | return; |
| 386 | } | 386 | } |
| 387 | } | 387 | } |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | void SphereRenderer::renderUnclipped(float alpha) { | 390 | void SphereRenderer::renderUnclipped(float alpha, Mode mode) { |
| 391 | Sphere* sphere = static_cast<Sphere*>(parent()); | 391 | Sphere* sphere = static_cast<Sphere*>(parent()); |
| 392 | const QColor& color = sphere->getColor(); | 392 | const QColor& color = sphere->getColor(); |
| 393 | glColor4f(color.redF(), color.greenF(), color.blueF(), color.alphaF() * alpha); | 393 | glColor4f(color.redF(), color.greenF(), color.blueF(), color.alphaF() * alpha); |
| @@ -435,7 +435,7 @@ void StaticModelRenderer::simulate(float deltaTime) { · 41 unmodified lines | |||
| 435 | _model->simulate(deltaTime); | 435 | _model->simulate(deltaTime); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | void StaticModelRenderer::renderUnclipped(float alpha) { | 438 | void StaticModelRenderer::renderUnclipped(float alpha, Mode mode) { |
| 439 | _model->render(alpha); | 439 | _model->render(alpha); |
| 440 | } | 440 | } |
| 441 | 441 | ||