mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Cleanup and fixes
This commit is contained in:
parent
f55e7f7a22
commit
3c8d07a03e
10 changed files with 159 additions and 188 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#include "gfxTextureArray.h"
|
||||
|
||||
|
||||
|
||||
#include "gfxDevice.h"
|
||||
#include "gfxTextureManager.h"
|
||||
#include "bitmap/imageUtils.h"
|
||||
#include "console/console.h"
|
||||
|
||||
void GFXTextureArray::set(U32 width, U32 height, U32 size, GFXFormat format, U32 mipLevels)
|
||||
|
|
@ -12,7 +12,8 @@ void GFXTextureArray::set(U32 width, U32 height, U32 size, GFXFormat format, U32
|
|||
mHeight = height;
|
||||
mArraySize = size;
|
||||
mFormat = format;
|
||||
mMipLevels = mipLevels;
|
||||
mIsCompressed = ImageUtil::isCompressedFormat(mFormat);
|
||||
mMipLevels = getMax(mipLevels, static_cast<U32>(1));
|
||||
|
||||
mTextures.setSize(size);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
virtual const String describeSelf() const;
|
||||
|
||||
GFXFormat mFormat;
|
||||
bool mIsCompressed;
|
||||
U32 mWidth;
|
||||
U32 mHeight;
|
||||
U32 mArraySize;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ GFXGLTextureArray::GFXGLTextureArray()
|
|||
|
||||
void GFXGLTextureArray::init()
|
||||
{
|
||||
glGenTextures(1, &mTextureArray);
|
||||
PRESERVE_2D_TEXTURE_ARRAY();
|
||||
glGenTextures(1, &mTextureArray);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, mTextureArray);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, mMin(mMipLevels - 1, 1));
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
|
@ -20,7 +20,7 @@ void GFXGLTextureArray::init()
|
|||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexStorage3D(GL_TEXTURE_2D_ARRAY, mMipLevels, GL_RGBA8, mWidth, mHeight, mArraySize);
|
||||
glTexStorage3D(GL_TEXTURE_2D_ARRAY, mMipLevels, GFXGLTextureInternalFormat[mFormat], mWidth, mHeight, mArraySize);
|
||||
}
|
||||
|
||||
void GFXGLTextureArray::_setTexture(const GFXTexHandle& texture, U32 slot)
|
||||
|
|
@ -73,9 +73,10 @@ void GFXGLTextureArray::bind(U32 textureUnit) const
|
|||
{
|
||||
glActiveTexture(GL_TEXTURE0 + textureUnit);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, mTextureArray);
|
||||
|
||||
dynamic_cast<GFXGLDevice*>(getOwningDevice())->getOpenglCache()->setCacheBindedTex(textureUnit, GL_TEXTURE_2D_ARRAY, mTextureArray);
|
||||
|
||||
GFXGLStateBlockRef sb = static_cast<GFXGLDevice*>(GFX)->getCurrentStateBlock();
|
||||
GFXGLStateBlockRef sb = dynamic_cast<GFXGLDevice*>(GFX)->getCurrentStateBlock();
|
||||
AssertFatal(sb, "GFXGLTextureArray::bind - No active stateblock!");
|
||||
if (!sb)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ protected:
|
|||
|
||||
private:
|
||||
GLuint mTextureArray;
|
||||
|
||||
bool mIsCompressed;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue