Skip to content

Commit 871a430

Browse files
committed
Fix ordering with color map Closes #626 Closes #460
Created new rendering list for Transparent objects with colormap and fixed the CULLing for the other colormap objects.
1 parent 0676576 commit 871a430

File tree

7 files changed

+504
-8
lines changed

7 files changed

+504
-8
lines changed

src/Interface/Modules/Render/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ SET(Interface_Modules_Render_HEADERS
5353
ES/systems/RenderBasicSys.h
5454
ES/systems/RenderBasicSysTrans.h
5555
ES/systems/RenderColorMapSys.h
56+
ES/systems/RenderColorMapSysTrans.h
5657
)
5758

5859
SET(Interface_Modules_Render_SOURCES
@@ -72,6 +73,7 @@ SET(Interface_Modules_Render_SOURCES
7273
ES/systems/RenderBasicSys.cc
7374
ES/systems/RenderBasicSysTrans.cc
7475
ES/systems/RenderColorMapSys.cc
76+
ES/systems/RenderColorMapSysTrans.cc
7577
)
7678

7779
QT4_WRAP_UI(Interface_Modules_Render_FORMS_HEADERS ${Interface_Modules_Render_FORMS})

src/Interface/Modules/Render/ES/CoreBootstrap.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "systems/RenderBasicSys.h"
3030
#include "systems/RenderBasicSysTrans.h"
3131
#include "systems/RenderColorMapSys.h"
32+
#include "systems/RenderColorMapSysTrans.h"
3233
#include "CoreBootstrap.h"
3334
#include "AssetBootstrap.h"
3435
#include "Core.h"
@@ -114,6 +115,7 @@ class CoreBootstrap : public es::EmptySystem
114115
core.addUserSystem(getSystemName_RenderBasicGeom());
115116
core.addUserSystem(getSystemName_RenderBasicTransGeom());
116117
core.addUserSystem(getSystemName_RenderColorMap());
118+
core.addUserSystem(getSystemName_RenderColorMapTrans());
117119

118120
// --== General ==--
119121

src/Interface/Modules/Render/ES/Registration.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "systems/RenderBasicSys.h"
4141
#include "systems/RenderBasicSysTrans.h"
4242
#include "systems/RenderColorMapSys.h"
43+
#include "systems/RenderColorMapSysTrans.h"
4344

4445
namespace SCIRun {
4546
namespace Render {
@@ -52,6 +53,7 @@ void rendererRegisterAll(CPM_ES_ACORN_NS::Acorn& core)
5253
registerSystem_RenderBasicGeom(core);
5354
registerSystem_RenderBasicTransGeom(core);
5455
registerSystem_RenderColorMap(core);
56+
registerSystem_RenderColorMapTrans(core);
5557

5658
// Register components
5759
core.registerComponent<StaticSRInterface>();

src/Interface/Modules/Render/ES/systems/RenderBasicSysTrans.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class RenderBasicSysTrans :
9696
{
9797
return this->mDepth < di.mDepth;
9898
}
99-
10099
};
101100

102101
void groupExecute(

src/Interface/Modules/Render/ES/systems/RenderColorMapSys.cc

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ class RenderColorMapSys :
9898
return;
9999
}
100100

101+
if (srstate.front().state.get(RenderState::USE_TRANSPARENCY))
102+
{
103+
return;
104+
}
105+
101106
// Setup *everything*. We don't want to enter multiple conditional
102107
// statements if we can avoid it. So we assume everything has not been
103108
// setup (including uniforms) if the simple geom hasn't been setup.
@@ -186,11 +191,13 @@ class RenderColorMapSys :
186191

187192
geom.front().attribs.bind();
188193

189-
if (srstate.front().state.get(RenderState::USE_TRANSPARENCY))
190-
{
191-
GL(glDepthMask(GL_FALSE));
192-
GL(glDisable(GL_CULL_FACE));
193-
}
194+
bool depthMask = glIsEnabled(GL_DEPTH_WRITEMASK);
195+
bool cullFace = glIsEnabled(GL_CULL_FACE);
196+
bool blend = glIsEnabled(GL_BLEND);
197+
198+
GL(glDepthMask(GL_TRUE));
199+
GL(glDisable(GL_CULL_FACE));
200+
GL(glDisable(GL_BLEND));
194201

195202
if (rlist.size() > 0)
196203
{
@@ -304,11 +311,18 @@ class RenderColorMapSys :
304311
}
305312
}
306313

307-
if (srstate.front().state.get(RenderState::USE_TRANSPARENCY))
314+
if (!depthMask)
315+
{
316+
GL(glDepthMask(GL_FALSE));
317+
}
318+
if (cullFace)
308319
{
309-
GL(glDepthMask(GL_TRUE));
310320
GL(glEnable(GL_CULL_FACE));
311321
}
322+
if (blend)
323+
{
324+
GL(glEnable(GL_BLEND));
325+
}
312326

313327
geom.front().attribs.unbind();
314328

0 commit comments

Comments
 (0)