gzdoom-gles/src/gl/dynlights/gl_lightbuffer.h
Christoph Oelckers 00d7707aef - allow reallocation of light buffer if more lights are needed.
- added a light preprocessing pass to the renderer so that a non-persistent buffer can be used with minimal mapping/unmapping. This only gets used if necessary because it adds some overhead to the renderer.
2014-08-19 14:18:21 +02:00

39 lines
869 B
C++

#ifndef __GL_LIGHTBUFFER_H
#define __GL_LIGHTBUFFER_H
#include "tarray.h"
struct FDynLightData;
class FLightBuffer
{
TArray<int> mIndices;
unsigned int mBufferId;
float * mBufferPointer;
unsigned int mBufferType;
unsigned int mIndex;
unsigned int mUploadIndex;
unsigned int mLastMappedIndex;
unsigned int mBlockAlign;
unsigned int mBlockSize;
unsigned int mBufferSize;
unsigned int mByteSize;
public:
FLightBuffer();
~FLightBuffer();
void Clear();
int UploadLights(FDynLightData &data);
void Begin();
void Finish();
int BindUBO(unsigned int index);
unsigned int GetBlockSize() const { return mBlockSize; }
unsigned int GetBufferType() const { return mBufferType; }
unsigned int GetIndexPtr() const { return mIndices.Size(); }
void StoreIndex(int index) { mIndices.Push(index); }
int GetIndex(int i) const { return mIndices[i]; }
};
#endif