mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
- add vertex buffer based rendering for decals.
This commit is contained in:
parent
cf45f2d718
commit
579eff5b96
2 changed files with 23 additions and 7 deletions
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include "gl/system/gl_cvars.h"
|
#include "gl/system/gl_cvars.h"
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/renderer/gl_lightdata.h"
|
#include "gl/renderer/gl_lightdata.h"
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
#include "gl/renderer/gl_renderstate.h"
|
||||||
|
@ -336,6 +337,8 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
||||||
else gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
|
else gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
|
||||||
|
|
||||||
gl_RenderState.Apply();
|
gl_RenderState.Apply();
|
||||||
|
if (!gl_usevbo)
|
||||||
|
{
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -343,6 +346,19 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
||||||
glVertex3f(dv[i].x, dv[i].z, dv[i].y);
|
glVertex3f(dv[i].x, dv[i].z, dv[i].y);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v);
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
unsigned int offset;
|
||||||
|
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, offset, count);
|
||||||
|
}
|
||||||
rendered_decals++;
|
rendered_decals++;
|
||||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||||
gl_RenderState.SetObjectColor(0xffffffff);
|
gl_RenderState.SetObjectColor(0xffffffff);
|
||||||
|
|
Loading…
Reference in a new issue