mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
tracks wether or not a cubemap has been fully intitialised (as well as defautls for other shared entries). skips out including an uninitialized cuebmap in probe array (inthoery. in practice, need to root arround a bit more)
This commit is contained in:
parent
5b7e2edb66
commit
26a89882c7
|
|
@ -31,7 +31,6 @@ GFXD3D11Cubemap::GFXD3D11Cubemap() : mTexture(NULL), mSRView(NULL), mDSView(NULL
|
|||
mDynamic = false;
|
||||
mAutoGenMips = false;
|
||||
mFaceFormat = GFXFormatR8G8B8A8;
|
||||
|
||||
for (U32 i = 0; i < CubeFaces; i++)
|
||||
{
|
||||
for(U32 j=0; j < MaxMipMaps; j++)
|
||||
|
|
@ -142,7 +141,7 @@ void GFXD3D11Cubemap::initStatic(GFXTexHandle *faces)
|
|||
mSRView->GetDesc(&viewDesc);
|
||||
mMipMapLevels = viewDesc.TextureCube.MipLevels;
|
||||
}
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GFXD3D11Cubemap::initStatic(DDSFile *dds)
|
||||
|
|
@ -209,6 +208,7 @@ void GFXD3D11Cubemap::initStatic(DDSFile *dds)
|
|||
{
|
||||
AssertFatal(false, "GFXD3D11Cubemap::initStatic(DDSFile *dds) - CreateTexture2D call failure");
|
||||
}
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
|
||||
|
|
@ -331,7 +331,7 @@ void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLeve
|
|||
}
|
||||
|
||||
SAFE_RELEASE(depthTex);
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@
|
|||
#include "gfx/gfxTextureManager.h"
|
||||
|
||||
|
||||
GFXCubemap::GFXCubemap()
|
||||
{
|
||||
mPath = "";
|
||||
mMipMapLevels = 0;
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
GFXCubemap::~GFXCubemap()
|
||||
{
|
||||
// If we're not dynamic and we were loaded from a
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ protected:
|
|||
|
||||
|
||||
U32 mMipMapLevels;
|
||||
bool mInitialized;
|
||||
public:
|
||||
|
||||
/// Create a static cubemap from a list of 6 face textures.
|
||||
|
|
@ -61,7 +62,7 @@ public:
|
|||
virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8, U32 mipLevels = 0 ) = 0;
|
||||
|
||||
void initNormalize(U32 size);
|
||||
|
||||
GFXCubemap();
|
||||
virtual ~GFXCubemap();
|
||||
|
||||
/// Returns the size of the faces.
|
||||
|
|
@ -82,6 +83,7 @@ public:
|
|||
|
||||
/// Get Z up face index of the cubemap. DDS files will be stored Y up
|
||||
static U32 zUpFaceIndex(const U32 index);
|
||||
bool isInitialised() { return mInitialized; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ void GFXGLCubemap::initStatic(GFXTexHandle* faces)
|
|||
glGenTextures(1, &mCubemap);
|
||||
fillCubeTextures(faces);
|
||||
}
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GFXGLCubemap::initStatic( DDSFile *dds )
|
||||
|
|
@ -179,6 +180,7 @@ void GFXGLCubemap::initStatic( DDSFile *dds )
|
|||
GFXGLTextureFormat[mFaceFormat], GFXGLTextureType[mFaceFormat], dds->mSurfaces[i]->mMips[mip]);
|
||||
}
|
||||
}
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GFXGLCubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
|
||||
|
|
@ -220,6 +222,7 @@ void GFXGLCubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
|
|||
|
||||
if( !isCompressed )
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void GFXGLCubemap::zombify()
|
||||
|
|
|
|||
|
|
@ -353,6 +353,9 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
if (curEntry->mCubemap.isNull() || curEntry->mIrradianceCubemap.isNull())
|
||||
continue;
|
||||
|
||||
if (!curEntry->mCubemap->isInitialised())
|
||||
continue;
|
||||
|
||||
//Setup
|
||||
const Point3F &probePos = curEntry->getPosition();
|
||||
probePositions[i] = probePos + curEntry->mProbePosOffset;
|
||||
|
|
|
|||
Loading…
Reference in a new issue