mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
- removed the Bind function from FFlatVertexBuffer.
This is not flexible enough. There was already one place where this was not supposed to go through the render state. The new interface allows more general use of the contained buffer objects.
This commit is contained in:
parent
fa498611f8
commit
48bc5550d7
10 changed files with 23 additions and 22 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "m_png.h"
|
||||
#include "r_utility.h"
|
||||
#include "d_player.h"
|
||||
#include "gl/system/gl_buffers.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "hwrenderer/utility/hw_cvars.h"
|
||||
#include "gl/system/gl_debug.h"
|
||||
|
@ -56,8 +57,8 @@ namespace OpenGLRenderer
|
|||
|
||||
void FGLRenderer::RenderScreenQuad()
|
||||
{
|
||||
screen->mVertexData->Bind(gl_RenderState);
|
||||
gl_RenderState.ApplyBuffers();
|
||||
auto buffer = static_cast<GLVertexBuffer *>(screen->mVertexData->GetBufferObjects().first);
|
||||
buffer->Bind(nullptr);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ void FGLRenderer::UpdateShadowMap()
|
|||
|
||||
sector_t *FGLRenderer::RenderView(player_t* player)
|
||||
{
|
||||
screen->mVertexData->Bind(gl_RenderState);
|
||||
gl_RenderState.SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
sector_t *retsec;
|
||||
|
||||
|
@ -344,7 +344,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i
|
|||
mBuffers = mSaveBuffers;
|
||||
|
||||
P_FindParticleSubsectors(); // make sure that all recently spawned particles have a valid subsector.
|
||||
screen->mVertexData->Bind(gl_RenderState);
|
||||
gl_RenderState.SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
|
|
@ -186,7 +186,7 @@ void GLVertexBuffer::Bind(int *offsets)
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
// This is what gets called from RenderState.Apply. It shouldn't be called anywhere else.
|
||||
// This is what gets called from RenderState.Apply. It shouldn't be called anywhere else if the render state is in use
|
||||
GLBuffer::Bind();
|
||||
for(auto &attrinf : mAttributeInfo)
|
||||
{
|
||||
|
|
|
@ -411,18 +411,6 @@ void FFlatVertexBuffer::Copy(int start, int count)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FFlatVertexBuffer::Bind(FRenderState &state)
|
||||
{
|
||||
state.SetVertexBuffer(mVertexBuffer, 0, 0);
|
||||
state.SetIndexBuffer(mIndexBuffer);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FFlatVertexBuffer::CreateVBO()
|
||||
{
|
||||
vbo_shadowdata.Resize(mNumReserved);
|
||||
|
|
|
@ -103,7 +103,11 @@ public:
|
|||
~FFlatVertexBuffer();
|
||||
|
||||
void OutputResized(int width, int height);
|
||||
void Bind(FRenderState &state);
|
||||
std::pair<IVertexBuffer *, IIndexBuffer *> GetBufferObjects() const
|
||||
{
|
||||
return std::make_pair(mVertexBuffer, mIndexBuffer);
|
||||
}
|
||||
|
||||
void CreateVBO();
|
||||
void Copy(int start, int count);
|
||||
|
||||
|
@ -147,6 +151,7 @@ protected:
|
|||
void CheckPlanes(sector_t *sector);
|
||||
public:
|
||||
void CheckUpdate(sector_t *sector);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -588,7 +588,7 @@ void HWDrawInfo::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil)
|
|||
state.SetLightIndex(-1);
|
||||
gp->DrawContents(new_di, state);
|
||||
new_di->EndDrawInfo();
|
||||
screen->mVertexData->Bind(state);
|
||||
state.SetVertexBuffer(screen->mVertexData);
|
||||
screen->mViewpoints->Bind(state, vpIndex);
|
||||
gp->RemoveStencil(this, state, usestencil);
|
||||
|
||||
|
|
|
@ -457,6 +457,13 @@ public:
|
|||
mIndexBuffer = ib;
|
||||
}
|
||||
|
||||
template <class T> void SetVertexBuffer(T *buffer)
|
||||
{
|
||||
auto ptrs = buffer->GetBufferObjects();
|
||||
SetVertexBuffer(ptrs.first, 0, 0);
|
||||
SetIndexBuffer(ptrs.second);
|
||||
}
|
||||
|
||||
void SetInterpolationFactor(float fac)
|
||||
{
|
||||
mInterpolationFactor = fac;
|
||||
|
|
|
@ -271,7 +271,7 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
{
|
||||
FGLModelRenderer renderer(di, state, dynlightindex);
|
||||
renderer.RenderModel(x, y, z, modelframe, actor, di->Viewpoint.TicFrac);
|
||||
screen->mVertexData->Bind(state);
|
||||
state.SetVertexBuffer(screen->mVertexData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
|||
|
||||
FGLModelRenderer renderer(this, state, huds->lightindex);
|
||||
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
|
||||
screen->mVertexData->Bind(state);
|
||||
state.SetVertexBuffer(screen->mVertexData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -212,7 +212,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
state.SetScissor(-1, -1, -1, -1);
|
||||
|
||||
state.SetRenderStyle(STYLE_Translucent);
|
||||
screen->mVertexData->Bind(state);
|
||||
state.SetVertexBuffer(screen->mVertexData);
|
||||
state.EnableTexture(true);
|
||||
state.EnableBrightmap(true);
|
||||
state.SetTextureMode(TM_NORMAL);
|
||||
|
|
Loading…
Reference in a new issue