mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Update GFXTextureManager and GBitmap
GBitmap Changes: Added all other formats to gbitmap that we support gbitmap now supports cubemaps added converters for all these other formats added stb_image_resize for extrudemips so we can extrude mipmaps for all other formats GFXTextureManager Can now directly make cubemaps and texture arrays based on the GFXTextureProfile API implementations for all functions that cubemaps and arrays needed
This commit is contained in:
parent
975fc924cc
commit
3aef90a6bc
66 changed files with 4235 additions and 2590 deletions
|
|
@ -86,6 +86,13 @@ ImplementEnumType(ReflectionModeEnum,
|
|||
//{ ReflectionProbe::DynamicCubemap, "Dynamic Cubemap", "Uses a cubemap baked from the probe's current position, updated at a set rate" },
|
||||
EndImplementEnumType;
|
||||
|
||||
void ReflectionProbe::ProbeInfo::clear()
|
||||
{
|
||||
mPrefilterCubemap.free();
|
||||
mIrradianceCubemap.free();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Object setup and teardown
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -146,11 +153,18 @@ ReflectionProbe::~ReflectionProbe()
|
|||
if (mReflectionModeType == StaticCubemap && mStaticCubemap)
|
||||
mStaticCubemap->deleteObject();
|
||||
|
||||
if (mIrridianceMap)
|
||||
mIrridianceMap->deleteObject();
|
||||
mProbeInfo.clear();
|
||||
|
||||
if (mIrridianceMap) {
|
||||
if (mIrridianceMap->isProperlyAdded() && !mIrridianceMap->isRemoved())
|
||||
mIrridianceMap->deleteObject();
|
||||
}
|
||||
|
||||
if (mPrefilterMap)
|
||||
mPrefilterMap->deleteObject();
|
||||
{
|
||||
if (mPrefilterMap->isProperlyAdded() && !mPrefilterMap->isRemoved())
|
||||
mPrefilterMap->deleteObject();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -603,7 +617,7 @@ void ReflectionProbe::processBakedCubemap()
|
|||
return;
|
||||
|
||||
String irrPath = getIrradianceMapPath();
|
||||
if (Platform::isFile(irrPath))
|
||||
if ((mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) && Platform::isFile(irrPath))
|
||||
{
|
||||
mIrridianceMap->setCubemapFile(FileName(irrPath));
|
||||
mIrridianceMap->updateFaces();
|
||||
|
|
@ -616,7 +630,7 @@ void ReflectionProbe::processBakedCubemap()
|
|||
}
|
||||
|
||||
String prefilPath = getPrefilterMapPath();
|
||||
if (Platform::isFile(prefilPath))
|
||||
if ((mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) && Platform::isFile(prefilPath))
|
||||
{
|
||||
mPrefilterMap->setCubemapFile(FileName(prefilPath));
|
||||
mPrefilterMap->updateFaces();
|
||||
|
|
@ -631,7 +645,7 @@ void ReflectionProbe::processBakedCubemap()
|
|||
mProbeInfo.mPrefilterCubemap = mPrefilterMap->mCubemap;
|
||||
mProbeInfo.mIrradianceCubemap = mIrridianceMap->mCubemap;
|
||||
|
||||
if (mEnabled && mProbeInfo.mPrefilterCubemap->isInitialized() && mProbeInfo.mIrradianceCubemap->isInitialized())
|
||||
if (mEnabled && !mProbeInfo.mPrefilterCubemap.isNull() && !mProbeInfo.mIrradianceCubemap.isNull())
|
||||
{
|
||||
//mProbeInfo.mIsEnabled = true;
|
||||
|
||||
|
|
@ -698,7 +712,7 @@ void ReflectionProbe::processStaticCubemap()
|
|||
return;
|
||||
}
|
||||
|
||||
if (mStaticCubemap->mCubemap == nullptr)
|
||||
if (mStaticCubemap->mCubemap.isNull())
|
||||
{
|
||||
mStaticCubemap->createMap();
|
||||
mStaticCubemap->updateFaces();
|
||||
|
|
@ -706,13 +720,13 @@ void ReflectionProbe::processStaticCubemap()
|
|||
|
||||
if (mUseHDRCaptures)
|
||||
{
|
||||
mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
|
||||
mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
|
||||
mIrridianceMap->mCubemap.set(mPrefilterSize, mPrefilterSize, GFXFormatR16G16B16A16F, &GFXCubemapRenderTargetProfile, "ReflectionProbe::mIrridianceMap_HDR");
|
||||
mPrefilterMap->mCubemap.set(mPrefilterSize, mPrefilterSize, GFXFormatR16G16B16A16F, &GFXCubemapRenderTargetProfile, "ReflectionProbe::mPrefilterMap_HDR");
|
||||
}
|
||||
else
|
||||
{
|
||||
mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
|
||||
mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
|
||||
mIrridianceMap->mCubemap.set(mPrefilterSize, mPrefilterSize, GFXFormatR8G8B8A8, &GFXCubemapRenderTargetProfile, "ReflectionProbe::mIrridianceMap");
|
||||
mPrefilterMap->mCubemap.set(mPrefilterSize, mPrefilterSize, GFXFormatR8G8B8A8, &GFXCubemapRenderTargetProfile, "ReflectionProbe::mPrefilterMap");
|
||||
}
|
||||
|
||||
GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false);
|
||||
|
|
@ -730,7 +744,7 @@ void ReflectionProbe::processStaticCubemap()
|
|||
mProbeInfo.mIrradianceCubemap = mIrridianceMap->mCubemap;
|
||||
}
|
||||
|
||||
if (mEnabled && mProbeInfo.mPrefilterCubemap->isInitialized() && mProbeInfo.mIrradianceCubemap->isInitialized())
|
||||
if (mEnabled && mProbeInfo.mPrefilterCubemap.isValid() && mProbeInfo.mIrradianceCubemap.isValid())
|
||||
{
|
||||
mProbeInfo.mIsEnabled = true;
|
||||
|
||||
|
|
@ -1009,7 +1023,7 @@ void ReflectionProbe::setPreviewMatParameters(SceneRenderState* renderState, Bas
|
|||
GFX->setTexture(0, deferredTexObject);
|
||||
|
||||
//Set the cubemap
|
||||
GFX->setCubeTexture(1, mPrefilterMap->mCubemap);
|
||||
GFX->setTexture(1, mPrefilterMap->mCubemap);
|
||||
|
||||
//Set the invViewMat
|
||||
MatrixSet &matrixSet = renderState->getRenderPass()->getMatrixSet();
|
||||
|
|
@ -1036,3 +1050,4 @@ DefineEngineMethod(ReflectionProbe, Bake, void, (), ,
|
|||
clientProbe->bake();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue