@@ -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{
6664public:
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.
0 commit comments