- Add lightmaps to the main shader (currently only OpenGL)
- Create a version of CreateIndexedSectorVertices that works with lightmap sectors
This commit is contained in:
parent
39481f0d07
commit
2f8cff90b6
12 changed files with 166 additions and 11 deletions
|
|
@ -364,6 +364,29 @@ void OpenGLFrameBuffer::BlurScene(float amount)
|
|||
GLRenderer->BlurScene(amount);
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::InitLightmap(FLevelLocals *Level)
|
||||
{
|
||||
if (Level->LMTextureData.Size() > 0)
|
||||
{
|
||||
GLint activeTex = 0;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTex);
|
||||
glActiveTexture(GL_TEXTURE0 + 17);
|
||||
|
||||
if (GLRenderer->mLightMapID == 0)
|
||||
glGenTextures(1, (GLuint*)&GLRenderer->mLightMapID);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, GLRenderer->mLightMapID);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB16F, Level->LMTextureSize, Level->LMTextureSize, Level->LMTextureCount, 0, GL_RGB, GL_HALF_FLOAT, &Level->LMTextureData[0]);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
|
||||
|
||||
glActiveTexture(activeTex);
|
||||
|
||||
Level->LMTextureData.Reset(); // We no longer need this, release the memory
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::SetViewportRects(IntRect *bounds)
|
||||
{
|
||||
Super::SetViewportRects(bounds);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue