Skip to content

Commit bcdd521

Browse files
committed
Transparency Render Options Merged
1 parent a48402d commit bcdd521

File tree

8 files changed

+356
-723
lines changed

8 files changed

+356
-723
lines changed

src/Core/Algorithms/Visualization/RenderFieldState.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ class RenderState
100100
RING_GLYPH
101101
};
102102

103+
enum TransparencySortType
104+
{
105+
CONTINUOUS_SORT,
106+
UPDATE_SORT,
107+
LISTS_SORT
108+
};
109+
103110
RenderState()
104111
{
105112
for (int i = 0; i < MAX_ACTION_FLAGS; ++i)
@@ -123,6 +130,7 @@ class RenderState
123130

124131
// Render state flags.
125132
bool mFlags[MAX_ACTION_FLAGS];
133+
TransparencySortType mSortType = CONTINUOUS_SORT;
126134

127135
Core::Datatypes::ColorRGB defaultColor;
128136
};

src/Core/Datatypes/Geometry.h

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Copyright (c) 2012 Scientific Computing and Imaging Institute,
77
University of Utah.
88
9-
9+
1010
Permission is hereby granted, free of charge, to any person obtaining a
1111
copy of this software and associated documentation files (the "Software"),
1212
to deal in the Software without restriction, including without limitation
@@ -28,7 +28,7 @@
2828
/// @todo Documentation Core/Datatypes/Geometry.h
2929

3030
#ifndef CORE_DATATYPES_GEOMETRY_H
31-
#define CORE_DATATYPES_GEOMETRY_H
31+
#define CORE_DATATYPES_GEOMETRY_H
3232

3333
#include <cstdint>
3434
#include <list>
@@ -79,7 +79,7 @@ namespace Datatypes {
7979
DatatypeConstHandle get_underlying() const;
8080
virtual GeometryObject* clone() const { return new GeometryObject(*this); }
8181

82-
std::string objectName; ///< Name of this object. Should be unique
82+
std::string objectName; ///< Name of this object. Should be unique
8383
///< across all modules in the network.
8484

8585
// Could require rvalue references...
@@ -98,6 +98,7 @@ namespace Datatypes {
9898
bool normalize;
9999
};
100100

101+
SpireVBO(){}
101102
SpireVBO(const std::string& vboName, const std::vector<AttributeData> attribs,
102103
std::shared_ptr<CPM_VAR_BUFFER_NS::VarBuffer> vboData,
103104
int64_t numVBOElements, const Core::Geometry::BBox& bbox, bool placeOnGPU) :
@@ -126,6 +127,7 @@ namespace Datatypes {
126127
TRIANGLES,
127128
};
128129

130+
SpireIBO() {}
129131
SpireIBO(const std::string& iboName, PRIMITIVE primIn, size_t iboIndexSize,
130132
std::shared_ptr<CPM_VAR_BUFFER_NS::VarBuffer> iboData) :
131133
name(iboName),
@@ -146,7 +148,8 @@ namespace Datatypes {
146148
/// Defines a Spire object 'pass'.
147149
struct SpireSubPass
148150
{
149-
SpireSubPass(const std::string& name, const std::string& vboName,
151+
SpireSubPass() {}
152+
SpireSubPass(const std::string& name, const std::string& vboName,
150153
const std::string& iboName, const std::string& program,
151154
ColorScheme scheme, const RenderState& state,
152155
RenderType renType, const SpireVBO& vbo, const SpireIBO& ibo) :
@@ -158,10 +161,18 @@ namespace Datatypes {
158161
renderType(renType),
159162
vbo(vbo),
160163
ibo(ibo),
161-
mColorScheme(scheme),
162-
scalar(1.0)
164+
scalar(1.0),
165+
mColorScheme(scheme)
163166
{}
164167

168+
static const char* getName() { return "SpireSubPass"; }
169+
170+
bool serialize(CPM_ES_CEREAL_NS::ComponentSerialize& /* s */, uint64_t /* entityID */)
171+
{
172+
// No need to serialize.
173+
return true;
174+
}
175+
165176
std::string passName;
166177
std::string vboName;
167178
std::string iboName;
@@ -180,7 +191,7 @@ namespace Datatypes {
180191
UNIFORM_VEC4
181192
};
182193

183-
//Uniform(){}
194+
Uniform(){}
184195
Uniform(const std::string& nameIn, float d) :
185196
name(nameIn),
186197
type(UNIFORM_SCALAR),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void rendererRegisterAll(CPM_ES_ACORN_NS::Acorn& core)
6464
core.registerComponent<RenderColorMapGeom>();
6565
core.registerComponent<SRRenderState>();
6666
core.registerComponent<RenderList>();
67-
//core.registerComponent<SpireSubPass>();
67+
core.registerComponent<Core::Datatypes::GeometryObject::SpireSubPass>();
6868
}
6969

7070
} // namespace Render

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace SCIRun {
9393

9494
showOrientation_ = true;
9595
autoRotate_ = false;
96-
96+
mRenderSortType = RenderState::TransparencySortType::CONTINUOUS_SORT;
9797
// Construct ESCore. We will need to bootstrap the core. We should also
9898
// probably add utility static classes.
9999
setupCore();
@@ -609,6 +609,8 @@ namespace SCIRun {
609609

610610
// Add a pass to our local object.
611611
elem.mPasses.emplace_back(pass.passName, pass.renderType);
612+
pass.renderState.mSortType = mRenderSortType;
613+
mCore.addComponent(entityID, pass);
612614
}
613615

614616
// Recalculate scene bounding box. Should only be done when an object is added.

src/Interface/Modules/Render/ES/SRInterface.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -239,30 +239,31 @@ namespace SCIRun {
239239
// Apply uniform.
240240
void applyUniform(uint64_t entityID, const Core::Datatypes::GeometryObject::SpireSubPass::Uniform& uniform);
241241

242-
bool showOrientation_; ///< Whether the coordinate axes will render or not.
243-
bool autoRotate_; ///< Whether the scene will continue to rotate.
242+
bool showOrientation_; ///< Whether the coordinate axes will render or not.
243+
bool autoRotate_; ///< Whether the scene will continue to rotate.
244244

245-
MouseMode mMouseMode; ///< Current mouse mode.
245+
MouseMode mMouseMode; ///< Current mouse mode.
246246

247-
size_t mScreenWidth; ///< Screen width in pixels.
248-
size_t mScreenHeight; ///< Screen height in pixels.
247+
size_t mScreenWidth; ///< Screen width in pixels.
248+
size_t mScreenHeight; ///< Screen height in pixels.
249249

250-
GLuint mRainbowCMap; ///< Rainbow color map.
251-
GLuint mGrayscaleCMap; ///< Grayscale color map.
250+
GLuint mRainbowCMap; ///< Rainbow color map.
251+
GLuint mGrayscaleCMap; ///< Grayscale color map.
252252

253-
std::shared_ptr<Gui::GLContext> mContext; ///< Context to use for rendering.
254-
std::unique_ptr<SRCamera> mCamera; ///< Primary camera.
255-
std::vector<SRObject> mSRObjects; ///< All SCIRun objects.
256-
Core::Geometry::BBox mSceneBBox; ///< Scene's AABB. Recomputed per-frame.
253+
std::shared_ptr<Gui::GLContext> mContext; ///< Context to use for rendering.
254+
std::unique_ptr<SRCamera> mCamera; ///< Primary camera.
255+
std::vector<SRObject> mSRObjects; ///< All SCIRun objects.
256+
Core::Geometry::BBox mSceneBBox; ///< Scene's AABB. Recomputed per-frame.
257257

258-
ESCore mCore; ///< Entity system core.
258+
ESCore mCore; ///< Entity system core.
259259

260-
std::string mArrowVBOName; ///< VBO for one axis of the coordinate axes.
261-
std::string mArrowIBOName; ///< IBO for one axis of the coordinate axes.
262-
std::string mArrowObjectName; ///< Object name for profile arrow.
260+
std::string mArrowVBOName; ///< VBO for one axis of the coordinate axes.
261+
std::string mArrowIBOName; ///< IBO for one axis of the coordinate axes.
262+
std::string mArrowObjectName; ///< Object name for profile arrow.
263263

264-
ren::ShaderVBOAttribs<5> mArrowAttribs; ///< Pre-applied shader / VBO attributes.
265-
ren::CommonUniforms mArrowUniforms; ///< Common uniforms used in the arrow shader.
264+
ren::ShaderVBOAttribs<5> mArrowAttribs; ///< Pre-applied shader / VBO attributes.
265+
ren::CommonUniforms mArrowUniforms; ///< Common uniforms used in the arrow shader.
266+
RenderState::TransparencySortType mRenderSortType; ///< Which strategy will be used to render transparency
266267
};
267268

268269
} // namespace Render

0 commit comments

Comments
 (0)