mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-16 05:03:47 +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
b2963442e6
commit
a4770c19b5
4 changed files with 28 additions and 8 deletions
|
|
@ -301,7 +301,7 @@ void ReflectionProbe::onRemove()
|
|||
Parent::onRemove();
|
||||
}
|
||||
|
||||
void ReflectionProbe::deleteObject()
|
||||
void ReflectionProbe::handleDeleteAction()
|
||||
{
|
||||
//we're deleting it?
|
||||
//Then we need to clear out the processed cubemaps(if we have them)
|
||||
|
|
@ -318,7 +318,7 @@ void ReflectionProbe::deleteObject()
|
|||
Platform::fileDelete(irrPath);
|
||||
}
|
||||
|
||||
Parent::deleteObject();
|
||||
Parent::handleDeleteAction();
|
||||
}
|
||||
|
||||
void ReflectionProbe::setTransform(const MatrixF & mat)
|
||||
|
|
@ -440,6 +440,8 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
|
|||
isMaterialDirty = true;
|
||||
}
|
||||
|
||||
updateProbeParams();
|
||||
|
||||
if (stream->readFlag()) // CubemapMask
|
||||
{
|
||||
mUseCubemap = stream->readFlag();
|
||||
|
|
@ -455,8 +457,6 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
|
|||
isMaterialDirty = true;
|
||||
}
|
||||
|
||||
updateProbeParams();
|
||||
|
||||
if (isMaterialDirty)
|
||||
{
|
||||
updateMaterial();
|
||||
|
|
@ -530,6 +530,9 @@ void ReflectionProbe::updateProbeParams()
|
|||
|
||||
void ReflectionProbe::processStaticCubemap()
|
||||
{
|
||||
if (mReflectionModeType != StaticCubemap)
|
||||
return;
|
||||
|
||||
createClientResources();
|
||||
|
||||
Sim::findObject(mCubemapName, mStaticCubemap);
|
||||
|
|
@ -549,15 +552,26 @@ void ReflectionProbe::processStaticCubemap()
|
|||
String prefilPath = getPrefilterMapPath();
|
||||
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))
|
||||
{
|
||||
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::SaveCubeMap(getIrradianceMapPath(), mIrridianceMap->mCubemap);
|
||||
IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap);*/
|
||||
IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap);
|
||||
}
|
||||
|
||||
mProbeInfo->mCubemap = &mPrefilterMap->mCubemap;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public:
|
|||
bool onAdd();
|
||||
void onRemove();
|
||||
|
||||
virtual void deleteObject();
|
||||
virtual void handleDeleteAction();
|
||||
|
||||
// Override this so that we can dirty the network flag when it is called
|
||||
void setTransform(const MatrixF &mat);
|
||||
|
|
|
|||
|
|
@ -744,11 +744,14 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
void unregisterObject();
|
||||
|
||||
/// 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.
|
||||
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
|
||||
|
|
|
|||
|
|
@ -155,6 +155,9 @@ void MEDeleteUndoAction::deleteObject( SimObject *object )
|
|||
if ( group )
|
||||
state.groupId = group->getId();
|
||||
|
||||
//Do any special handling of delete actions the object may do
|
||||
object->handleDeleteAction();
|
||||
|
||||
// Now delete the object.
|
||||
object->deleteObject();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue