mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-01-31 18:50:33 +00:00
- removed obsolete gl_lightbuffer code.
This never worked properly and by now far better options are available to solve the problem of dynamic light data uploads.
This commit is contained in:
parent
9c5cec0056
commit
54297acde4
8 changed files with 0 additions and 315 deletions
|
@ -1086,7 +1086,6 @@ add_executable( zdoom WIN32
|
||||||
gl/dynlights/gl_dynlight.cpp
|
gl/dynlights/gl_dynlight.cpp
|
||||||
gl/dynlights/gl_glow.cpp
|
gl/dynlights/gl_glow.cpp
|
||||||
gl/dynlights/gl_dynlight1.cpp
|
gl/dynlights/gl_dynlight1.cpp
|
||||||
gl/dynlights/gl_lightbuffer.cpp
|
|
||||||
gl/shaders/gl_shader.cpp
|
gl/shaders/gl_shader.cpp
|
||||||
gl/shaders/gl_texshader.cpp
|
gl/shaders/gl_texshader.cpp
|
||||||
gl/system/gl_interface.cpp
|
gl/system/gl_interface.cpp
|
||||||
|
|
|
@ -1,243 +0,0 @@
|
||||||
/*
|
|
||||||
** gl_dynlight1.cpp
|
|
||||||
** dynamic light buffer for shader rendering
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 2009 Christoph Oelckers
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
** 4. When not used as part of GZDoom or a GZDoom derivative, this code will be
|
|
||||||
** covered by the terms of the GNU Lesser General Public License as published
|
|
||||||
** by the Free Software Foundation; either version 2.1 of the License, or (at
|
|
||||||
** your option) any later version.
|
|
||||||
** 5. Full disclosure of the entire project's source code, except for third
|
|
||||||
** party libraries is mandatory. (NOTE: This clause is non-negotiable!)
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0 // unused for now. Code doesn't work
|
|
||||||
|
|
||||||
#include "gl/system/gl_system.h"
|
|
||||||
#include "c_dispatch.h"
|
|
||||||
#include "p_local.h"
|
|
||||||
#include "vectors.h"
|
|
||||||
#include "g_level.h"
|
|
||||||
|
|
||||||
#include "gl/system/gl_cvars.h"
|
|
||||||
#include "gl/renderer/gl_renderer.h"
|
|
||||||
#include "gl/renderer/gl_lightdata.h"
|
|
||||||
#include "gl/data/gl_data.h"
|
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
|
||||||
#include "gl/scene/gl_portal.h"
|
|
||||||
#include "gl/shaders/gl_shader.h"
|
|
||||||
#include "gl/textures/gl_material.h"
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
FLightBuffer::FLightBuffer()
|
|
||||||
{
|
|
||||||
glGenBuffers(1, &mIDbuf_RGB);
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
|
||||||
|
|
||||||
glGenBuffers(1, &mIDbuf_Position);
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
|
||||||
|
|
||||||
glGenTextures(1, &mIDtex_RGB);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB);
|
|
||||||
gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, mIDbuf_RGB);
|
|
||||||
|
|
||||||
glGenTextures(1, &mIDtex_Position);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_Position);
|
|
||||||
gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA32F, mIDbuf_Position);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
FLightBuffer::~FLightBuffer()
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
|
||||||
glDeleteBuffers(1, &mIDbuf_RGB);
|
|
||||||
glDeleteBuffers(1, &mIDbuf_Position);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
|
||||||
glDeleteTextures(1, &mIDtex_RGB);
|
|
||||||
glDeleteTextures(1, &mIDtex_Position);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FLightBuffer::BindTextures(int texunit1, int texunit2)
|
|
||||||
{
|
|
||||||
glActiveTexture(texunit1);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_RGB);
|
|
||||||
glActiveTexture(texunit2);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDtex_Position);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// This collects all currently actove
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FLightBuffer::CollectLightSources()
|
|
||||||
{
|
|
||||||
if (gl_dynlight_shader && gl_lights && GLRenderer->mLightCount && gl_fixedcolormap == CM_DEFAULT)
|
|
||||||
{
|
|
||||||
TArray<FLightRGB> pLights(100);
|
|
||||||
TArray<FLightPosition> pPos(100);
|
|
||||||
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
|
|
||||||
|
|
||||||
ADynamicLight *light;
|
|
||||||
|
|
||||||
while ((light = it.Next()) != NULL)
|
|
||||||
{
|
|
||||||
if (!(light->flags2 & MF2_DORMANT))
|
|
||||||
{
|
|
||||||
FLightRGB rgb;
|
|
||||||
FLightPosition pos;
|
|
||||||
|
|
||||||
rgb.R = light->GetRed();
|
|
||||||
rgb.G = light->GetGreen();
|
|
||||||
rgb.B = light->GetBlue();
|
|
||||||
rgb.Type = (light->flags4 & MF4_SUBTRACTIVE)? 128 : (light->flags4 & MF4_ADDITIVE || foggy)? 255:0;
|
|
||||||
pos.X = FIXED2FLOAT(light->x);
|
|
||||||
pos.Y = FIXED2FLOAT(light->y);
|
|
||||||
pos.Z = FIXED2FLOAT(light->z);
|
|
||||||
pos.Distance = (light->GetRadius() * gl_lights_size);
|
|
||||||
light->bufferindex = pPos.Size();
|
|
||||||
pLights.Push(rgb);
|
|
||||||
pPos.Push(pos);
|
|
||||||
}
|
|
||||||
else light->bufferindex = -1;
|
|
||||||
}
|
|
||||||
GLRenderer->mLightCount = pPos.Size();
|
|
||||||
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_RGB);
|
|
||||||
glBufferData(GL_TEXTURE_BUFFER, pLights.Size() * sizeof (FLightRGB), &pLights[0], GL_STREAM_DRAW);
|
|
||||||
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDbuf_Position);
|
|
||||||
glBufferData(GL_TEXTURE_BUFFER, pPos.Size() * sizeof (FLightPosition), &pPos[0], GL_STREAM_DRAW);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
FLightIndexBuffer::FLightIndexBuffer()
|
|
||||||
{
|
|
||||||
glGenBuffers(1, &mIDBuffer);
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
|
||||||
|
|
||||||
glGenTextures(1, &mIDTexture);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDTexture);
|
|
||||||
gl.TexBufferARB(GL_TEXTURE_BUFFER, GL_R16UI, mIDBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
FLightIndexBuffer::~FLightIndexBuffer()
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
|
||||||
glDeleteBuffers(1, &mIDBuffer);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
|
||||||
glDeleteTextures(1, &mIDTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FLightIndexBuffer::AddLight(ADynamicLight *light)
|
|
||||||
{
|
|
||||||
if (light->bufferindex >= 0)
|
|
||||||
{
|
|
||||||
mBuffer.Push(light->bufferindex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FLightIndexBuffer::SendBuffer()
|
|
||||||
{
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, mIDBuffer);
|
|
||||||
glBufferData(GL_TEXTURE_BUFFER, mBuffer.Size() * sizeof (short), &mBuffer[0], GL_STREAM_DRAW);
|
|
||||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FLightIndexBuffer::BindTexture(int texunit1)
|
|
||||||
{
|
|
||||||
glActiveTexture(texunit1);
|
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, mIDTexture);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,66 +0,0 @@
|
||||||
#ifndef __GL_LIGHTBUFFER_H
|
|
||||||
#define __GL_LIGHTBUFFER_H
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
class ADynamicLight;
|
|
||||||
|
|
||||||
const int MAX_DYNLIGHTS = 40000; // should hopefully be enough
|
|
||||||
|
|
||||||
struct FLightRGB
|
|
||||||
{
|
|
||||||
unsigned char R,G,B,Type; // Type is 0 for normal, 1 for additive and 2 for subtractive
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FLightPosition
|
|
||||||
{
|
|
||||||
float X,Z,Y,Distance;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FLightBuffer
|
|
||||||
{
|
|
||||||
unsigned int mIDbuf_RGB;
|
|
||||||
unsigned int mIDbuf_Position;
|
|
||||||
|
|
||||||
unsigned int mIDtex_RGB;
|
|
||||||
unsigned int mIDtex_Position;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FLightBuffer();
|
|
||||||
~FLightBuffer();
|
|
||||||
//void MapBuffer();
|
|
||||||
//void UnmapBuffer();
|
|
||||||
void BindTextures(int uniloc1, int uniloc2);
|
|
||||||
//void AddLight(ADynamicLight *light, bool foggy);
|
|
||||||
void CollectLightSources();
|
|
||||||
};
|
|
||||||
|
|
||||||
class FLightIndexBuffer
|
|
||||||
{
|
|
||||||
unsigned int mIDBuffer;
|
|
||||||
unsigned int mIDTexture;
|
|
||||||
|
|
||||||
TArray<unsigned short> mBuffer;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
FLightIndexBuffer();
|
|
||||||
~FLightIndexBuffer();
|
|
||||||
void AddLight(ADynamicLight *light);
|
|
||||||
void SendBuffer();
|
|
||||||
void BindTexture(int loc1);
|
|
||||||
|
|
||||||
void ClearBuffer()
|
|
||||||
{
|
|
||||||
mBuffer.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetLightIndex()
|
|
||||||
{
|
|
||||||
return mBuffer.Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -59,7 +59,6 @@
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
#include "gl/renderer/gl_renderstate.h"
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
#include "gl/shaders/gl_shader.h"
|
#include "gl/shaders/gl_shader.h"
|
||||||
#include "gl/textures/gl_texture.h"
|
#include "gl/textures/gl_texture.h"
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
#include "gl/scene/gl_portal.h"
|
#include "gl/scene/gl_portal.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.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"
|
||||||
#include "gl/textures/gl_material.h"
|
#include "gl/textures/gl_material.h"
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
#include "gl/dynlights/gl_dynlight.h"
|
||||||
#include "gl/dynlights/gl_glow.h"
|
#include "gl/dynlights/gl_glow.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
#include "gl/shaders/gl_shader.h"
|
#include "gl/shaders/gl_shader.h"
|
||||||
#include "gl/textures/gl_material.h"
|
#include "gl/textures/gl_material.h"
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
#include "gl/dynlights/gl_dynlight.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
|
||||||
#include "gl/models/gl_models.h"
|
#include "gl/models/gl_models.h"
|
||||||
#include "gl/scene/gl_clipper.h"
|
#include "gl/scene/gl_clipper.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
#include "gl/dynlights/gl_dynlight.h"
|
#include "gl/dynlights/gl_dynlight.h"
|
||||||
#include "gl/dynlights/gl_glow.h"
|
#include "gl/dynlights/gl_glow.h"
|
||||||
#include "gl/dynlights/gl_lightbuffer.h"
|
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
#include "gl/scene/gl_portal.h"
|
#include "gl/scene/gl_portal.h"
|
||||||
#include "gl/textures/gl_material.h"
|
#include "gl/textures/gl_material.h"
|
||||||
|
|
Loading…
Reference in a new issue