Implement Singlepass Terrain Render

This commit is contained in:
Lukas Aldershaab 2021-01-01 21:05:21 +01:00
parent 49a8c0ad36
commit 87dd7ffc4a
35 changed files with 1658 additions and 951 deletions

View file

@ -22,6 +22,8 @@
#include "platform/platform.h"
#include "gfx/gl/gfxGLDevice.h"
#include "gfxGLTextureArray.h"
#include "platform/platformGL.h"
#include "gfx/gfxCubemap.h"
@ -457,6 +459,13 @@ GFXCubemapArray *GFXGLDevice::createCubemapArray()
return cubeArray;
}
GFXTextureArray* GFXGLDevice::createTextureArray()
{
GFXGLTextureArray* textureArray = new GFXGLTextureArray();
textureArray->registerResourceWithDevice(this);
return textureArray;
}
void GFXGLDevice::endSceneInternal()
{
// nothing to do for opengl
@ -766,6 +775,22 @@ void GFXGLDevice::setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArr
}
}
void GFXGLDevice::setTextureArrayInternal(U32 textureUnit, const GFXGLTextureArray* texture)
{
if (texture)
{
mActiveTextureType[textureUnit] = GL_TEXTURE_2D_ARRAY;
texture->bind(textureUnit);
}
else if (mActiveTextureType[textureUnit] != GL_ZERO)
{
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(mActiveTextureType[textureUnit], 0);
getOpenglCache()->setCacheBindedTex(textureUnit, mActiveTextureType[textureUnit], 0);
mActiveTextureType[textureUnit] = GL_ZERO;
}
}
void GFXGLDevice::setMatrix( GFXMatrixType mtype, const MatrixF &mat )
{
// ONLY NEEDED ON FFP