From 88f21e249051abe80d7054f062e5da2efe1c6fa3 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 6 Sep 2014 23:35:00 +0200 Subject: [PATCH] Fix RSM --- src/graphics/render_geometry.cpp | 2 +- src/graphics/stkscenemanager.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/graphics/render_geometry.cpp b/src/graphics/render_geometry.cpp index 85bac8ed1..74c89078b 100644 --- a/src/graphics/render_geometry.cpp +++ b/src/graphics/render_geometry.cpp @@ -423,7 +423,7 @@ void IrrDriver::renderSolidSecondPass() TexUnit(2, true), TexUnit(3, true), TexUnit(4, true), - TexUnit(5, true) + TexUnit(0, true) ), ListMatSplatting::getInstance()->SolidPass, createVector(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex); renderMeshes2ndPass(TexUnits( TexUnit(0, true) diff --git a/src/graphics/stkscenemanager.cpp b/src/graphics/stkscenemanager.cpp index b42c2defe..b1b9c8679 100644 --- a/src/graphics/stkscenemanager.cpp +++ b/src/graphics/stkscenemanager.cpp @@ -197,7 +197,7 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector *Immed MeshForGlowPass[mesh->mb].emplace_back(mesh, node); - if (mesh->TextureMatrix.isIdentity()) + if (Mat != MAT_SPLATTING && mesh->TextureMatrix.isIdentity()) MeshForSolidPass[Mat][mesh->mb].emplace_back(mesh, Node); else { @@ -214,6 +214,9 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector *Immed case MAT_UNLIT: ListMatUnlit::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix, mesh->TextureMatrix); break; + case MAT_SPLATTING: + ListMatSplatting::getInstance()->SolidPass.emplace_back(mesh, ModelMatrix, InvModelMatrix); + break; } } } @@ -310,7 +313,16 @@ handleSTKCommon(scene::ISceneNode *Node, std::vector *Immed if (irr_driver->hasARB_draw_indirect()) { for_in(mesh, node->MeshSolidMaterial[Mat]) - MeshForRSMPass[Mat][mesh->mb].emplace_back(mesh, Node); + { + if (Mat != MAT_SPLATTING) + MeshForRSMPass[Mat][mesh->mb].emplace_back(mesh, Node); + else + { + core::matrix4 ModelMatrix = Node->getAbsoluteTransformation(), InvModelMatrix; + ModelMatrix.getInverse(InvModelMatrix); + ListMatSplatting::getInstance()->RSM.emplace_back(mesh, ModelMatrix, InvModelMatrix); + } + } } else {