mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-19 18:50:52 +00:00
- removed the quad drawer class
This isn't needed anymore.
This commit is contained in:
parent
74ba142eae
commit
9253118bdc
6 changed files with 2 additions and 150 deletions
|
@ -1046,7 +1046,6 @@ set (PCH_SOURCES
|
||||||
gl/dynlights/gl_lightbuffer.cpp
|
gl/dynlights/gl_lightbuffer.cpp
|
||||||
gl/dynlights/gl_shadowmap.cpp
|
gl/dynlights/gl_shadowmap.cpp
|
||||||
gl/models/gl_models.cpp
|
gl/models/gl_models.cpp
|
||||||
gl/renderer/gl_quaddrawer.cpp
|
|
||||||
gl/renderer/gl_renderer.cpp
|
gl/renderer/gl_renderer.cpp
|
||||||
gl/renderer/gl_renderstate.cpp
|
gl/renderer/gl_renderstate.cpp
|
||||||
gl/renderer/gl_renderbuffers.cpp
|
gl/renderer/gl_renderbuffers.cpp
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright(C) 2016 Christoph Oelckers
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
||||||
//
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "gl_load/gl_system.h"
|
|
||||||
#include "gl/shaders/gl_shader.h"
|
|
||||||
#include "gl/renderer/gl_renderer.h"
|
|
||||||
#include "gl/renderer/gl_quaddrawer.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
** For handling of dynamically created quads when no persistently mapped
|
|
||||||
** buffer or client array is available (i.e. GL 3.x core profiles)
|
|
||||||
**
|
|
||||||
** In this situation the 4 vertices of a quad primitive are being passed
|
|
||||||
** as a matrix uniform because that is a lot faster than any kind of
|
|
||||||
** temporary buffer change.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FFlatVertex FQuadDrawer::buffer[4];
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FQuadDrawer::DoRender(int type)
|
|
||||||
{
|
|
||||||
// When this gets called, the render state must already be applied so we can just
|
|
||||||
// send our vertices to the current shader.
|
|
||||||
float matV[16], matT[16];
|
|
||||||
|
|
||||||
for(int i=0;i<4;i++)
|
|
||||||
{
|
|
||||||
matV[i*4+0] = buffer[i].x;
|
|
||||||
matV[i*4+1] = buffer[i].z;
|
|
||||||
matV[i*4+2] = buffer[i].y;
|
|
||||||
matV[i*4+3] = 1;
|
|
||||||
matT[i*4+0] = buffer[i].u;
|
|
||||||
matT[i*4+1] = buffer[i].v;
|
|
||||||
matT[i*4+2] = matT[i*4+3] = 0;
|
|
||||||
}
|
|
||||||
FShader *shader = GLRenderer->mShaderManager->GetActiveShader();
|
|
||||||
glUniformMatrix4fv(shader->vertexmatrix_index, 1, false, matV);
|
|
||||||
glUniformMatrix4fv(shader->texcoordmatrix_index, 1, false, matT);
|
|
||||||
glUniform1i(shader->quadmode_index, 1);
|
|
||||||
GLRenderer->mVBO->RenderArray(type, FFlatVertexBuffer::QUAD_INDEX, 4);
|
|
||||||
glUniform1i(shader->quadmode_index, 0);
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
#ifndef __QDRAWER_H
|
|
||||||
#define __QDRAWER_H
|
|
||||||
|
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
|
||||||
|
|
||||||
class FQuadDrawer
|
|
||||||
{
|
|
||||||
FFlatVertex *p;
|
|
||||||
int ndx;
|
|
||||||
static FFlatVertex buffer[4];
|
|
||||||
|
|
||||||
void DoRender(int type);
|
|
||||||
public:
|
|
||||||
|
|
||||||
FQuadDrawer()
|
|
||||||
{
|
|
||||||
if (gl.buffermethod == BM_DEFERRED)
|
|
||||||
{
|
|
||||||
p = buffer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p = GLRenderer->mVBO->Alloc(4, &ndx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FFlatVertex *Pointer()
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
void Set(int ndx, float x, float y, float z, float s, float t)
|
|
||||||
{
|
|
||||||
p[ndx].Set(x, y, z, s, t);
|
|
||||||
}
|
|
||||||
void Render(int type)
|
|
||||||
{
|
|
||||||
if (gl.buffermethod == BM_DEFERRED)
|
|
||||||
{
|
|
||||||
DoRender(type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GLRenderer->mVBO->RenderArray(type, ndx, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -107,13 +107,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
// Blinn glossiness and specular level
|
// Blinn glossiness and specular level
|
||||||
i_data += "uniform vec2 uSpecularMaterial;\n";
|
i_data += "uniform vec2 uSpecularMaterial;\n";
|
||||||
|
|
||||||
// quad drawer stuff
|
|
||||||
i_data += "#ifdef USE_QUAD_DRAWER\n";
|
|
||||||
i_data += "uniform mat4 uQuadVertices;\n";
|
|
||||||
i_data += "uniform mat4 uQuadTexCoords;\n";
|
|
||||||
i_data += "uniform int uQuadMode;\n";
|
|
||||||
i_data += "#endif\n";
|
|
||||||
|
|
||||||
// matrices
|
// matrices
|
||||||
i_data += "uniform mat4 ModelMatrix;\n";
|
i_data += "uniform mat4 ModelMatrix;\n";
|
||||||
i_data += "uniform mat4 NormalModelMatrix;\n";
|
i_data += "uniform mat4 NormalModelMatrix;\n";
|
||||||
|
@ -191,11 +184,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
vp_comb = "#version 430 core\n#define SHADER_STORAGE_LIGHTS\n";
|
vp_comb = "#version 430 core\n#define SHADER_STORAGE_LIGHTS\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl.buffermethod == BM_DEFERRED)
|
|
||||||
{
|
|
||||||
vp_comb << "#define USE_QUAD_DRAWER\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
if (!!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||||
{
|
{
|
||||||
vp_comb << "#define SUPPORTS_SHADOWMAPS\n";
|
vp_comb << "#define SUPPORTS_SHADOWMAPS\n";
|
||||||
|
@ -355,10 +343,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
fakevb_index = glGetUniformLocation(hShader, "fakeVB");
|
fakevb_index = glGetUniformLocation(hShader, "fakeVB");
|
||||||
modelmatrix_index = glGetUniformLocation(hShader, "ModelMatrix");
|
modelmatrix_index = glGetUniformLocation(hShader, "ModelMatrix");
|
||||||
texturematrix_index = glGetUniformLocation(hShader, "TextureMatrix");
|
texturematrix_index = glGetUniformLocation(hShader, "TextureMatrix");
|
||||||
vertexmatrix_index = glGetUniformLocation(hShader, "uQuadVertices");
|
|
||||||
texcoordmatrix_index = glGetUniformLocation(hShader, "uQuadTexCoords");
|
|
||||||
normalmodelmatrix_index = glGetUniformLocation(hShader, "NormalModelMatrix");
|
normalmodelmatrix_index = glGetUniformLocation(hShader, "NormalModelMatrix");
|
||||||
quadmode_index = glGetUniformLocation(hShader, "uQuadMode");
|
|
||||||
|
|
||||||
if (lightbuffertype == GL_UNIFORM_BUFFER)
|
if (lightbuffertype == GL_UNIFORM_BUFFER)
|
||||||
{
|
{
|
||||||
|
@ -369,7 +354,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
if (tempindex != -1) glUniformBlockBinding(hShader, tempindex, VIEWPOINT_BINDINGPOINT);
|
if (tempindex != -1) glUniformBlockBinding(hShader, tempindex, VIEWPOINT_BINDINGPOINT);
|
||||||
|
|
||||||
glUseProgram(hShader);
|
glUseProgram(hShader);
|
||||||
if (quadmode_index > 0) glUniform1i(quadmode_index, 0);
|
|
||||||
|
|
||||||
// set up other texture units (if needed by the shader)
|
// set up other texture units (if needed by the shader)
|
||||||
for (int i = 2; i<16; i++)
|
for (int i = 2; i<16; i++)
|
||||||
|
|
|
@ -269,9 +269,6 @@ class FShader
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int vertexmatrix_index;
|
|
||||||
int texcoordmatrix_index;
|
|
||||||
int quadmode_index;
|
|
||||||
int fakevb_index;
|
int fakevb_index;
|
||||||
private:
|
private:
|
||||||
int currentglowstate = 0;
|
int currentglowstate = 0;
|
||||||
|
|
|
@ -20,21 +20,8 @@ void main()
|
||||||
vec2 parmTexCoord;
|
vec2 parmTexCoord;
|
||||||
vec4 parmPosition;
|
vec4 parmPosition;
|
||||||
|
|
||||||
#ifndef USE_QUAD_DRAWER
|
parmTexCoord = aTexCoord;
|
||||||
parmTexCoord = aTexCoord;
|
parmPosition = aPosition;
|
||||||
parmPosition = aPosition;
|
|
||||||
#else
|
|
||||||
if (uQuadMode == 0)
|
|
||||||
{
|
|
||||||
parmTexCoord = aTexCoord;
|
|
||||||
parmPosition = aPosition;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parmPosition = uQuadVertices[int(aPosition.x)];
|
|
||||||
parmTexCoord = uQuadTexCoords[int(aPosition.x)].st;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIMPLE
|
#ifndef SIMPLE
|
||||||
vec4 worldcoord = ModelMatrix * mix(parmPosition, aVertex2, uInterpolationFactor);
|
vec4 worldcoord = ModelMatrix * mix(parmPosition, aVertex2, uInterpolationFactor);
|
||||||
|
|
Loading…
Reference in a new issue