mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Deleting a probe in the editor now automatically does a cleanup of it's baked cubemap files
Also added it to do the prefilter/irrad processing on any StaticCubemap selected.
This commit is contained in:
parent
1fc38d496f
commit
835513b861
4 changed files with 28 additions and 8 deletions
|
|
@ -301,7 +301,7 @@ void ReflectionProbe::onRemove()
|
||||||
Parent::onRemove();
|
Parent::onRemove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReflectionProbe::deleteObject()
|
void ReflectionProbe::handleDeleteAction()
|
||||||
{
|
{
|
||||||
//we're deleting it?
|
//we're deleting it?
|
||||||
//Then we need to clear out the processed cubemaps(if we have them)
|
//Then we need to clear out the processed cubemaps(if we have them)
|
||||||
|
|
@ -318,7 +318,7 @@ void ReflectionProbe::deleteObject()
|
||||||
Platform::fileDelete(irrPath);
|
Platform::fileDelete(irrPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent::deleteObject();
|
Parent::handleDeleteAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReflectionProbe::setTransform(const MatrixF & mat)
|
void ReflectionProbe::setTransform(const MatrixF & mat)
|
||||||
|
|
@ -440,6 +440,8 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
|
||||||
isMaterialDirty = true;
|
isMaterialDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateProbeParams();
|
||||||
|
|
||||||
if (stream->readFlag()) // CubemapMask
|
if (stream->readFlag()) // CubemapMask
|
||||||
{
|
{
|
||||||
mUseCubemap = stream->readFlag();
|
mUseCubemap = stream->readFlag();
|
||||||
|
|
@ -455,8 +457,6 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
|
||||||
isMaterialDirty = true;
|
isMaterialDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProbeParams();
|
|
||||||
|
|
||||||
if (isMaterialDirty)
|
if (isMaterialDirty)
|
||||||
{
|
{
|
||||||
updateMaterial();
|
updateMaterial();
|
||||||
|
|
@ -530,6 +530,9 @@ void ReflectionProbe::updateProbeParams()
|
||||||
|
|
||||||
void ReflectionProbe::processStaticCubemap()
|
void ReflectionProbe::processStaticCubemap()
|
||||||
{
|
{
|
||||||
|
if (mReflectionModeType != StaticCubemap)
|
||||||
|
return;
|
||||||
|
|
||||||
createClientResources();
|
createClientResources();
|
||||||
|
|
||||||
Sim::findObject(mCubemapName, mStaticCubemap);
|
Sim::findObject(mCubemapName, mStaticCubemap);
|
||||||
|
|
@ -549,15 +552,26 @@ void ReflectionProbe::processStaticCubemap()
|
||||||
String prefilPath = getPrefilterMapPath();
|
String prefilPath = getPrefilterMapPath();
|
||||||
String irrPath = getIrradianceMapPath();
|
String irrPath = getIrradianceMapPath();
|
||||||
|
|
||||||
|
if (mUseHDRCaptures)
|
||||||
|
{
|
||||||
|
mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
|
||||||
|
mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
|
||||||
|
mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
|
||||||
|
}
|
||||||
|
|
||||||
//if (!Platform::isFile(irrPath) || !Platform::isFile(prefilPath))
|
//if (!Platform::isFile(irrPath) || !Platform::isFile(prefilPath))
|
||||||
{
|
{
|
||||||
GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false);
|
GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false);
|
||||||
|
|
||||||
/*IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap);
|
IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap);
|
||||||
IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap);
|
IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap);
|
||||||
|
|
||||||
IBLUtilities::SaveCubeMap(getIrradianceMapPath(), mIrridianceMap->mCubemap);
|
IBLUtilities::SaveCubeMap(getIrradianceMapPath(), mIrridianceMap->mCubemap);
|
||||||
IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap);*/
|
IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap);
|
||||||
}
|
}
|
||||||
|
|
||||||
mProbeInfo->mCubemap = &mPrefilterMap->mCubemap;
|
mProbeInfo->mCubemap = &mPrefilterMap->mCubemap;
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ public:
|
||||||
bool onAdd();
|
bool onAdd();
|
||||||
void onRemove();
|
void onRemove();
|
||||||
|
|
||||||
virtual void deleteObject();
|
virtual void handleDeleteAction();
|
||||||
|
|
||||||
// Override this so that we can dirty the network flag when it is called
|
// Override this so that we can dirty the network flag when it is called
|
||||||
void setTransform(const MatrixF &mat);
|
void setTransform(const MatrixF &mat);
|
||||||
|
|
|
||||||
|
|
@ -744,11 +744,14 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
||||||
void unregisterObject();
|
void unregisterObject();
|
||||||
|
|
||||||
/// Unregister, mark as deleted, and free the object.
|
/// Unregister, mark as deleted, and free the object.
|
||||||
virtual void deleteObject();
|
void deleteObject();
|
||||||
|
|
||||||
/// Performs a safe delayed delete of the object using a sim event.
|
/// Performs a safe delayed delete of the object using a sim event.
|
||||||
void safeDeleteObject();
|
void safeDeleteObject();
|
||||||
|
|
||||||
|
/// Special-case deletion behaviors, largely intended for cleanup in particular cases where it wouldn't happen automatically(like cleanup of associated files)
|
||||||
|
virtual void handleDeleteAction() {}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Accessors
|
/// @name Accessors
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,9 @@ void MEDeleteUndoAction::deleteObject( SimObject *object )
|
||||||
if ( group )
|
if ( group )
|
||||||
state.groupId = group->getId();
|
state.groupId = group->getId();
|
||||||
|
|
||||||
|
//Do any special handling of delete actions the object may do
|
||||||
|
object->handleDeleteAction();
|
||||||
|
|
||||||
// Now delete the object.
|
// Now delete the object.
|
||||||
object->deleteObject();
|
object->deleteObject();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue