Skip to content

Commit 2f7a7fc

Browse files
committed
Removing old transparency framework.
1 parent 102ab0d commit 2f7a7fc

File tree

3 files changed

+5
-228
lines changed

3 files changed

+5
-228
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ namespace SCIRun {
423423
assetName = "Assests/arrow.geom";
424424
}
425425

426+
//reorderIBO(pass);
426427
addVBOToEntity(entityID, assetName);
427428
addIBOToEntity(entityID, assetName);
428429
}
@@ -510,8 +511,6 @@ namespace SCIRun {
510511

511512
// Add a pass to our local object.
512513
elem.mPasses.emplace_back(pass.passName, pass.renderType);
513-
mCore.addComponent(entityID, pass);
514-
515514
}
516515

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

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

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ class RenderBasicSysTrans :
5656
ren::MatUniform,
5757
ren::Shader,
5858
ren::GLState,
59-
Core::Datatypes::GeometryObject::SpireSubPass,
6059
StaticWorldLight,
6160
gen::StaticCamera,
6261
ren::StaticGLState,
63-
ren::StaticVBOMan,
64-
ren::StaticIBOMan>
62+
ren::StaticVBOMan>
6563
{
6664
public:
6765

@@ -77,27 +75,6 @@ class RenderBasicSysTrans :
7775
ren::MatUniform>(type);
7876
}
7977

80-
class DepthIndex {
81-
public:
82-
size_t mIndex;
83-
double mDepth;
84-
85-
DepthIndex() :
86-
mIndex(0),
87-
mDepth(0.0)
88-
{}
89-
90-
DepthIndex(size_t index, double depth) :
91-
mIndex(index),
92-
mDepth(depth)
93-
{}
94-
95-
bool operator<(const DepthIndex& di) const
96-
{
97-
return this->mDepth < di.mDepth;
98-
}
99-
};
100-
10178
void groupExecute(
10279
es::ESCoreBase&, uint64_t /* entityID */,
10380
const es::ComponentGroup<RenderBasicGeom>& geom,
@@ -113,12 +90,10 @@ class RenderBasicSysTrans :
11390
const es::ComponentGroup<ren::MatUniform>& matUniforms,
11491
const es::ComponentGroup<ren::Shader>& shader,
11592
const es::ComponentGroup<ren::GLState>& state,
116-
const es::ComponentGroup<Core::Datatypes::GeometryObject::SpireSubPass>& pass,
11793
const es::ComponentGroup<StaticWorldLight>& worldLight,
11894
const es::ComponentGroup<gen::StaticCamera>& camera,
11995
const es::ComponentGroup<ren::StaticGLState>& defaultGLState,
120-
const es::ComponentGroup<ren::StaticVBOMan>& vboMan,
121-
const es::ComponentGroup<ren::StaticIBOMan>& iboMan) override
96+
const es::ComponentGroup<ren::StaticVBOMan>& vboMan) override
12297
{
12398
/// \todo This needs to be moved to pre-execute.
12499
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
@@ -130,91 +105,7 @@ class RenderBasicSysTrans :
130105
{
131106
return;
132107
}
133-
/*
134-
char* vbo_buffer = reinterpret_cast<char*>(pass.front().vbo.data->getBuffer());
135-
uint32_t* ibo_buffer = reinterpret_cast<uint32_t*>(pass.front().ibo.data->getBuffer());
136-
size_t num_triangles = pass.front().ibo.data->getBufferSize() / (sizeof(uint32_t) * 3);
137-
138-
size_t stride_vbo = 0;
139-
for (auto a : pass.front().vbo.attributes)
140-
stride_vbo += a.sizeInBytes;
141-
142-
std::vector<DepthIndex> rel_depth(num_triangles);
143-
Core::Geometry::Vector dir(camera.front().data.worldToView[0][2], camera.front().data.worldToView[1][2], camera.front().data.worldToView[2][2]);
144108

145-
for(size_t j = 0; j < num_triangles; j++)
146-
{
147-
float* vertex1 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j * 3]));
148-
Core::Geometry::Point node1(vertex1[0], vertex1[1], vertex1[2]);
149-
150-
float* vertex2 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j * 3 + 1]));
151-
Core::Geometry::Point node2(vertex2[0], vertex2[1], vertex2[2]);
152-
153-
float* vertex3 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j * 3 + 2]));
154-
Core::Geometry::Point node3(vertex3[0], vertex3[1], vertex3[2]);
155-
156-
rel_depth[j].mDepth = Core::Geometry::Dot(dir, node1) + Core::Geometry::Dot(dir, node2) + Core::Geometry::Dot(dir, node3);
157-
rel_depth[j].mIndex = j;
158-
}
159-
160-
std::sort(rel_depth.begin(), rel_depth.end());
161-
162-
// setup index buffers
163-
GLenum primType = GL_UNSIGNED_SHORT;
164-
switch (pass.front().ibo.indexSize)
165-
{
166-
case 1: // 8-bit
167-
primType = GL_UNSIGNED_BYTE;
168-
break;
169-
170-
case 2: // 16-bit
171-
primType = GL_UNSIGNED_SHORT;
172-
break;
173-
174-
case 4: // 32-bit
175-
primType = GL_UNSIGNED_INT;
176-
break;
177-
178-
default:
179-
primType = GL_UNSIGNED_INT;
180-
throw std::invalid_argument("Unable to determine index buffer depth.");
181-
break;
182-
}
183-
184-
GLenum primitive = GL_TRIANGLES;
185-
switch (pass.front().ibo.prim)
186-
{
187-
case Core::Datatypes::GeometryObject::SpireIBO::POINTS:
188-
primitive = GL_POINTS;
189-
break;
190-
191-
case Core::Datatypes::GeometryObject::SpireIBO::LINES:
192-
primitive = GL_LINES;
193-
break;
194-
195-
case Core::Datatypes::GeometryObject::SpireIBO::TRIANGLES:
196-
default:
197-
primitive = GL_TRIANGLES;
198-
break;
199-
}
200-
201-
int numPrimitives = pass.front().ibo.data->getBufferSize() / pass.front().ibo.indexSize;
202-
203-
std::vector<char> sorted_buffer(pass.front().ibo.data->getBufferSize());
204-
char* ibuffer = reinterpret_cast<char*>(pass.front().ibo.data->getBuffer());
205-
char* sbuffer = reinterpret_cast<char*>(&sorted_buffer[0]);
206-
size_t tri_size = pass.front().ibo.data->getBufferSize() / num_triangles;
207-
208-
for (size_t j = 0; j < num_triangles; j++)
209-
{
210-
memcpy(sbuffer + j * tri_size, ibuffer + rel_depth[j].mIndex * tri_size, tri_size);
211-
}
212-
213-
std::string transIBOName = pass.front().ibo.name + "trans";
214-
215-
GLuint iboID = iboMan.front().instance->addInMemoryIBO(sbuffer, pass.front().ibo.data->getBufferSize(), primitive, primType,
216-
numPrimitives, transIBOName);
217-
*/
218109
// Setup *everything*. We don't want to enter multiple conditional
219110
// statements if we can avoid it. So we assume everything has not been
220111
// setup (including uniforms) if the simple geom hasn't been setup.

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

Lines changed: 2 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ class RenderColorMapSysTrans :
5353
ren::MatUniform,
5454
ren::Shader,
5555
ren::GLState,
56-
Core::Datatypes::GeometryObject::SpireSubPass,
5756
StaticWorldLight,
5857
gen::StaticCamera,
5958
ren::StaticGLState,
60-
ren::StaticVBOMan,
61-
ren::StaticIBOMan>
59+
ren::StaticVBOMan>
6260
{
6361
public:
6462

@@ -73,27 +71,6 @@ class RenderColorMapSysTrans :
7371
ren::VecUniform,
7472
ren::MatUniform>(type);
7573
}
76-
77-
class DepthIndex {
78-
public:
79-
size_t mIndex;
80-
double mDepth;
81-
82-
DepthIndex() :
83-
mIndex(0),
84-
mDepth(0.0)
85-
{}
86-
87-
DepthIndex(size_t index, double depth) :
88-
mIndex(index),
89-
mDepth(depth)
90-
{}
91-
92-
bool operator<(const DepthIndex& di) const
93-
{
94-
return this->mDepth < di.mDepth;
95-
}
96-
};
9774

9875
void groupExecute(
9976
es::ESCoreBase&, uint64_t /* entityID */,
@@ -111,12 +88,10 @@ class RenderColorMapSysTrans :
11188
const es::ComponentGroup<ren::MatUniform>& matUniforms,
11289
const es::ComponentGroup<ren::Shader>& shader,
11390
const es::ComponentGroup<ren::GLState>& state,
114-
const es::ComponentGroup<Core::Datatypes::GeometryObject::SpireSubPass>& pass,
11591
const es::ComponentGroup<StaticWorldLight>& worldLight,
11692
const es::ComponentGroup<gen::StaticCamera>& camera,
11793
const es::ComponentGroup<ren::StaticGLState>& defaultGLState,
118-
const es::ComponentGroup<ren::StaticVBOMan>& vboMan,
119-
const es::ComponentGroup<ren::StaticIBOMan>& iboMan) override
94+
const es::ComponentGroup<ren::StaticVBOMan>& vboMan) override
12095
{
12196
/// \todo This needs to be moved to pre-execute.
12297
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
@@ -129,94 +104,6 @@ class RenderColorMapSysTrans :
129104
return;
130105
}
131106

132-
/*
133-
char* vbo_buffer = reinterpret_cast<char*>(pass.front().vbo.data->getBuffer());
134-
uint32_t* ibo_buffer = reinterpret_cast<uint32_t*>(pass.front().ibo.data->getBuffer());
135-
size_t num_triangles = pass.front().ibo.data->getBufferSize() / (sizeof(uint32_t) * 3);
136-
137-
size_t stride_vbo = 0;
138-
for (auto a : pass.front().vbo.attributes)
139-
stride_vbo += a.sizeInBytes;
140-
141-
std::vector<DepthIndex> rel_depth(num_triangles);
142-
Core::Geometry::Vector dir(camera.front().data.worldToView[0][2], camera.front().data.worldToView[1][2], camera.front().data.worldToView[2][2]);
143-
144-
for (size_t j = 0; j < num_triangles; j++)
145-
{
146-
float* vertex1 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j*3]));
147-
Core::Geometry::Point node1(vertex1[0], vertex1[1], vertex1[2]);
148-
149-
float* vertex2 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j*3+1]));
150-
Core::Geometry::Point node2(vertex2[0], vertex2[1], vertex2[2]);
151-
152-
float* vertex3 = reinterpret_cast<float*>(vbo_buffer + stride_vbo * (ibo_buffer[j*3+2]));
153-
Core::Geometry::Point node3(vertex3[0], vertex3[1], vertex3[2]);
154-
155-
rel_depth[j].mDepth = Core::Geometry::Dot(dir, node1) + Core::Geometry::Dot(dir, node2) + Core::Geometry::Dot(dir, node3);
156-
rel_depth[j].mIndex = j;
157-
}
158-
159-
std::sort(rel_depth.begin(), rel_depth.end());
160-
161-
// setup index buffers
162-
163-
GLenum primType = GL_UNSIGNED_SHORT;
164-
switch (pass.front().ibo.indexSize)
165-
{
166-
case 1: // 8-bit
167-
primType = GL_UNSIGNED_BYTE;
168-
break;
169-
170-
case 2: // 16-bit
171-
primType = GL_UNSIGNED_SHORT;
172-
break;
173-
174-
case 4: // 32-bit
175-
primType = GL_UNSIGNED_INT;
176-
break;
177-
178-
default:
179-
primType = GL_UNSIGNED_INT;
180-
throw std::invalid_argument("Unable to determine index buffer depth.");
181-
break;
182-
}
183-
184-
GLenum primitive = GL_TRIANGLES;
185-
switch (pass.front().ibo.prim)
186-
{
187-
case Core::Datatypes::GeometryObject::SpireIBO::POINTS:
188-
primitive = GL_POINTS;
189-
break;
190-
191-
case Core::Datatypes::GeometryObject::SpireIBO::LINES:
192-
primitive = GL_LINES;
193-
break;
194-
195-
case Core::Datatypes::GeometryObject::SpireIBO::TRIANGLES:
196-
default:
197-
primitive = GL_TRIANGLES;
198-
break;
199-
}
200-
201-
int numPrimitives = pass.front().ibo.data->getBufferSize() / pass.front().ibo.indexSize;
202-
203-
std::vector<char> sorted_buffer(pass.front().ibo.data->getBufferSize());
204-
char* ibuffer = reinterpret_cast<char*>(pass.front().ibo.data->getBuffer());
205-
char* sbuffer = reinterpret_cast<char*>(&sorted_buffer[0]);
206-
size_t tri_size = pass.front().ibo.data->getBufferSize() / num_triangles;
207-
208-
for (size_t j = 0; j < num_triangles; j++)
209-
{
210-
memcpy(sbuffer + j * tri_size, ibuffer + rel_depth[j].mIndex * tri_size, tri_size);
211-
}
212-
213-
//int numPrimitives = pass.front().ibo.data->getBufferSize() / pass.front().ibo.indexSize;
214-
215-
std::string transIBOName = pass.front().ibo.name + "trans";
216-
217-
GLuint iboID = iboMan.front().instance->addInMemoryIBO(sbuffer, pass.front().ibo.data->getBufferSize(), primitive, primType,
218-
numPrimitives, transIBOName);
219-
*/
220107
// Setup *everything*. We don't want to enter multiple conditional
221108
// statements if we can avoid it. So we assume everything has not been
222109
// setup (including uniforms) if the simple geom hasn't been setup.

0 commit comments

Comments
 (0)