From 752741307ea1d0fd3f24ae0750344c050b4a4457 Mon Sep 17 00:00:00 2001 From: vlj Date: Mon, 8 Sep 2014 19:14:21 +0200 Subject: [PATCH] Fix transparent in basic glsl pipeline --- src/graphics/stkscenemanager.cpp | 72 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/src/graphics/stkscenemanager.cpp b/src/graphics/stkscenemanager.cpp index 08c63dbbf..78de3a324 100644 --- a/src/graphics/stkscenemanager.cpp +++ b/src/graphics/stkscenemanager.cpp @@ -183,9 +183,45 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector *Immed ImmediateDraw->push_back(Node); return; } + + + // Transparent + GLMesh *mesh; + if (World::getWorld() && World::getWorld()->isFogEnabled()) + { + const Track * const track = World::getWorld()->getTrack(); + + // Todo : put everything in a ubo + const float fogmax = track->getFogMax(); + const float startH = track->getFogStartHeight(); + const float endH = track->getFogEndHeight(); + const float start = track->getFogStart(); + const float end = track->getFogEnd(); + const video::SColor tmpcol = track->getFogColor(); + + video::SColorf col(tmpcol.getRed() / 255.0f, + tmpcol.getGreen() / 255.0f, + tmpcol.getBlue() / 255.0f); + + for_in(mesh, node->TransparentMesh[TM_DEFAULT]) + pushVector(ListBlendTransparentFog::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, + fogmax, startH, endH, start, end, col); + for_in(mesh, node->TransparentMesh[TM_ADDITIVE]) + pushVector(ListAdditiveTransparentFog::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, + fogmax, startH, endH, start, end, col); + } + else + { + for_in(mesh, node->TransparentMesh[TM_DEFAULT]) + pushVector(ListBlendTransparent::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix); + for_in(mesh, node->TransparentMesh[TM_ADDITIVE]) + pushVector(ListAdditiveTransparent::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix); + } + for_in(mesh, node->TransparentMesh[TM_DISPLACEMENT]) + pushVector(ListDisplacement::getInstance(), mesh, Node->getAbsoluteTransformation()); + for (unsigned Mat = 0; Mat < MAT_COUNT; ++Mat) { - GLMesh *mesh; if (irr_driver->hasARB_draw_indirect()) { for_in(mesh, node->MeshSolidMaterial[Mat]) @@ -349,40 +385,6 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector *Immed } } } - // Transparent - GLMesh *mesh; - if (World::getWorld() && World::getWorld()->isFogEnabled()) - { - const Track * const track = World::getWorld()->getTrack(); - - // Todo : put everything in a ubo - const float fogmax = track->getFogMax(); - const float startH = track->getFogStartHeight(); - const float endH = track->getFogEndHeight(); - const float start = track->getFogStart(); - const float end = track->getFogEnd(); - const video::SColor tmpcol = track->getFogColor(); - - video::SColorf col(tmpcol.getRed() / 255.0f, - tmpcol.getGreen() / 255.0f, - tmpcol.getBlue() / 255.0f); - - for_in(mesh, node->TransparentMesh[TM_DEFAULT]) - pushVector(ListBlendTransparentFog::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, - fogmax, startH, endH, start, end, col); - for_in(mesh, node->TransparentMesh[TM_ADDITIVE]) - pushVector(ListAdditiveTransparentFog::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix, - fogmax, startH, endH, start, end, col); - } - else - { - for_in(mesh, node->TransparentMesh[TM_DEFAULT]) - pushVector(ListBlendTransparent::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix); - for_in(mesh, node->TransparentMesh[TM_ADDITIVE]) - pushVector(ListAdditiveTransparent::getInstance(), mesh, Node->getAbsoluteTransformation(), mesh->TextureMatrix); - } - for_in(mesh, node->TransparentMesh[TM_DISPLACEMENT]) - pushVector(ListDisplacement::getInstance(), mesh, Node->getAbsoluteTransformation()); } static void