Skip to content

Commit a9fe5aa

Browse files
authored
Merge branch 'master' into module-convert
2 parents 3341269 + a918451 commit a9fe5aa

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ namespace Render {
5050

5151
private:
5252

53-
int64_t mCoreSequence; ///< Sequence number (frame) since start.
53+
int64_t mCoreSequence; ///< Sequence number (frame) since start.
5454
spire::GLState mDefaultGLState; ///< Default OpenGL state.
55-
double mCurrentTime; ///< Current system time calculated from constant frame time.
55+
double mCurrentTime; ///< Current system time calculated from constant frame time.
5656

57-
float mFPS; ///< Actual FPS of system.
58-
float mLastRealTime; ///< Last realtime passed into the core.
57+
float mFPS; ///< Actual FPS of system.
58+
float mLastRealTime; ///< Last realtime passed into the core.
5959

60-
bool runGC;
60+
bool runGC;
6161

62-
float r_, g_, b_, a_;
62+
float r_, g_, b_, a_;
6363
};
6464

6565
} // namespace Render

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,22 @@ class RenderBasicSysTrans :
155155
}
156156
};
157157

158+
GLuint addIBO(void* iboData, size_t iboDataSize)
159+
{
160+
GLuint glid;
161+
162+
GL(glGenBuffers(1, &glid));
163+
GL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glid));
164+
GL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, static_cast<GLsizeiptr>(iboDataSize), iboData, GL_STATIC_DRAW));
165+
166+
return glid;
167+
}
168+
169+
void removeIBO(GLuint glid)
170+
{
171+
GL(glDeleteBuffers(1, &glid));
172+
}
173+
158174
GLuint sortObjects(const Core::Geometry::Vector& dir,
159175
const spire::ComponentGroup<ren::IBO>& ibo,
160176
const spire::ComponentGroup<SpireSubPass>& pass,
@@ -205,8 +221,7 @@ class RenderBasicSysTrans :
205221
}
206222

207223
std::string transIBOName = pass.front().ibo.name + "trans";
208-
result = iboMan.front().instance_->addInMemoryIBO(sbuffer, pass.front().ibo.data->getBufferSize(), ibo.front().primMode, ibo.front().primType,
209-
numPrimitives, transIBOName);
224+
result = addIBO(sbuffer, pass.front().ibo.data->getBufferSize());
210225
}
211226

212227
return result;
@@ -298,7 +313,7 @@ class RenderBasicSysTrans :
298313
{
299314
if (sortedObjects[index].mSortedID != 0)
300315
{
301-
iboMan.front().instance_->removeInMemoryIBO(sortedObjects[index].mSortedID);
316+
removeIBO(sortedObjects[index].mSortedID);
302317
}
303318
sortedObjects[index].prevDir = dir;
304319
sortedObjects[index].mSortedID = sortObjects(dir, ibo, pass, iboMan);
@@ -583,7 +598,7 @@ class RenderBasicSysTrans :
583598
{
584599
if (pass.front().renderState.mSortType == RenderState::TransparencySortType::CONTINUOUS_SORT)
585600
{
586-
iboMan.front().instance_->removeInMemoryIBO(iboID);
601+
removeIBO(iboID);
587602
}
588603
}
589604

0 commit comments

Comments
 (0)