diff --git a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp index 2b9ece957..25fb460bf 100644 --- a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp +++ b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp @@ -152,8 +152,13 @@ void BoxEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream) void BoxEnvironmentProbe::updateProbeParams() { + if (!mProbeInfo) + return; + mProbeShapeType = ProbeRenderInst::Box; mProbeInfo->mAtten = mAtten; + + Parent::updateProbeParams(); } void BoxEnvironmentProbe::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat) diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index b2f7d5900..6fccb3d05 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -143,10 +143,7 @@ ReflectionProbe::~ReflectionProbe() if (mEditorShapeInst) SAFE_DELETE(mEditorShapeInst); - if (mProbeInfo) - SAFE_DELETE(mProbeInfo); - - if (mReflectionModeType != StaticCubemap && mStaticCubemap) + if (mReflectionModeType == StaticCubemap && mStaticCubemap) mStaticCubemap->deleteObject(); } @@ -209,7 +206,7 @@ bool ReflectionProbe::_setEnabled(void *object, const char *index, const char *d ReflectionProbe* probe = reinterpret_cast< ReflectionProbe* >(object); probe->mEnabled = dAtob(data); - probe->setMaskBits(-1); + probe->setMaskBits(EnabledMask); return true; } @@ -219,6 +216,7 @@ bool ReflectionProbe::_doBake(void *object, const char *index, const char *data) ReflectionProbe* probe = reinterpret_cast< ReflectionProbe* >(object); probe->bake(); + probe->setMaskBits(StaticDataMask); return false; } @@ -240,6 +238,7 @@ bool ReflectionProbe::_setRadius(void *object, const char *index, const char *da return false; probe->mObjScale = Point3F(probe->mRadius, probe->mRadius, probe->mRadius); + probe->setMaskBits(StaticDataMask); return true; } @@ -259,6 +258,8 @@ bool ReflectionProbe::_setReflectionMode(void *object, const char *index, const probe->mCubemapName = ""; } + probe->setMaskBits(StaticDataMask); + return true; } @@ -307,6 +308,7 @@ void ReflectionProbe::onRemove() if (isClientObject()) { PROBEMGR->unregisterProbe(mProbeInfo->mProbeIdx); + mProbeInfo = nullptr; } // Remove this object from the scene @@ -342,15 +344,17 @@ void ReflectionProbe::setTransform(const MatrixF & mat) { // Let SceneObject handle all of the matrix manipulation if (!mEditPosOffset) + { Parent::setTransform(mat); + setMaskBits(TransformMask); + } else + { mProbeRefOffset = mat.getPosition(); + setMaskBits(StaticDataMask); + } mDirty = true; - - // Dirty our network mask so that the new transform gets - // transmitted to the client object - setMaskBits(TransformMask); } const MatrixF& ReflectionProbe::getTransform() const @@ -369,15 +373,17 @@ const MatrixF& ReflectionProbe::getTransform() const void ReflectionProbe::setScale(const VectorF &scale) { if (!mEditPosOffset) + { Parent::setScale(scale); + setMaskBits(TransformMask); + } else + { mProbeRefScale = scale; + setMaskBits(StaticDataMask); + } mDirty = true; - - // Dirty our network mask so that the new transform gets - // transmitted to the client object - setMaskBits(TransformMask); } const VectorF& ReflectionProbe::getScale() const @@ -495,6 +501,8 @@ void ReflectionProbe::updateProbeParams() if (!mProbeInfo) return; + mProbeInfo->mIsEnabled = mEnabled; + mProbeInfo->mProbeShapeType = mProbeShapeType; if (mProbeShapeType == ProbeRenderInst::Sphere) @@ -553,6 +561,8 @@ void ReflectionProbe::updateProbeParams() { if (mReflectionModeType == StaticCubemap) processStaticCubemap(); + else if (mReflectionModeType == BakedCubemap) + processBakedCubemap(); else processDynamicCubemap(); } @@ -562,61 +572,16 @@ void ReflectionProbe::updateProbeParams() void ReflectionProbe::processDynamicCubemap() { - if (!mProbeInfo) + //if (!mProbeInfo) return; mEnabled = false; - if (mReflectionModeType != DynamicCubemap) + if (mReflectionModeType == DynamicCubemap && !mDynamicCubemap.isNull()) { - mProbeInfo->mCubeReflector.unregisterReflector(); + mProbeInfo->mPrefilterCubemap = mDynamicCubemap; - if ((mReflectionModeType == BakedCubemap) && !mProbeUniqueID.isEmpty()) - { - String irrPath = getIrradianceMapPath(); - if (Platform::isFile(irrPath)) - { - mIrridianceMap->setCubemapFile(FileName(irrPath)); - //mIrridianceMap->updateFaces(); - } - - if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) - { - Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str()); - return; - } - - String prefilPath = getPrefilterMapPath(); - if (Platform::isFile(prefilPath)) - { - mPrefilterMap->setCubemapFile(FileName(prefilPath)); - //mPrefilterMap->updateFaces(); - } - - if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) - { - Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str()); - return; - } - - //mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; - //mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; - - mEnabled = true; - } - } - else - { - if (mReflectionModeType == DynamicCubemap && !mDynamicCubemap.isNull()) - { - mProbeInfo->mPrefilterCubemap = mDynamicCubemap; - - mProbeInfo->mCubeReflector.registerReflector(this, reflectorDesc); //need to decide how we wanna do the reflectorDesc. static name or a field - } - else - { - mEnabled = false; - } + //mCubeReflector.registerReflector(this, reflectorDesc); //need to decide how we wanna do the reflectorDesc. static name or a field } if (mEnabled) @@ -629,12 +594,61 @@ void ReflectionProbe::processDynamicCubemap() // PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); } +void ReflectionProbe::processBakedCubemap() +{ + if (!mProbeInfo) + return; + + mProbeInfo->mIsEnabled = false; + + if ((mReflectionModeType != BakedCubemap) || mProbeUniqueID.isEmpty()) + return; + + String irrPath = getIrradianceMapPath(); + if (Platform::isFile(irrPath)) + { + mIrridianceMap->setCubemapFile(FileName(irrPath)); + mIrridianceMap->updateFaces(); + } + + if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str()); + return; + } + + String prefilPath = getPrefilterMapPath(); + if (Platform::isFile(prefilPath)) + { + mPrefilterMap->setCubemapFile(FileName(prefilPath)); + mPrefilterMap->updateFaces(); + } + + if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str()); + return; + } + + mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; + mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; + + if (mEnabled && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized()) + { + mProbeInfo->mIsEnabled = true; + + //Update the probe manager with our new texture! + if (!mProbeInfo->mIsSkylight) + PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); + } +} + void ReflectionProbe::processStaticCubemap() { if (!mProbeInfo) return; - mEnabled = false; + mProbeInfo->mIsEnabled = false; String path = Con::getVariable("$pref::ReflectionProbes::CurrentLevelPath", "levels/"); @@ -709,17 +723,16 @@ void ReflectionProbe::processStaticCubemap() { mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; - mEnabled = true; } - if (mEnabled) + if (mEnabled && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized()) + { mProbeInfo->mIsEnabled = true; - else - mProbeInfo->mIsEnabled = false; - //Update the probe manager with our new texture! - if (!mProbeInfo->mIsSkylight && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized()) - PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); + //Update the probe manager with our new texture! + if (!mProbeInfo->mIsSkylight) + PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); + } } bool ReflectionProbe::createClientResources() @@ -791,7 +804,7 @@ String ReflectionProbe::getIrradianceMapPath() void ReflectionProbe::bake() { - if (mReflectionModeType == DynamicCubemap) + if (mReflectionModeType != BakedCubemap) return; PROBEMGR->bakeProbe(this); diff --git a/Engine/source/T3D/lighting/reflectionProbe.h b/Engine/source/T3D/lighting/reflectionProbe.h index eaf2e0d42..61d0b58db 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.h +++ b/Engine/source/T3D/lighting/reflectionProbe.h @@ -118,6 +118,9 @@ protected: U32 cubeDescId; ReflectorDesc *reflectorDesc; + //Utilized in dynamic reflections + //CubeReflector mCubeReflector; + ///Prevents us from saving out the cubemaps(for now) but allows us the full HDR range on the in-memory cubemap captures bool mUseHDRCaptures; @@ -221,6 +224,7 @@ public: bool createClientResources(); void processDynamicCubemap(); + void processBakedCubemap(); void processStaticCubemap(); // This is the function that allows this object to submit itself for rendering diff --git a/Engine/source/T3D/lighting/skylight.cpp b/Engine/source/T3D/lighting/skylight.cpp index 45b44c903..b4683c25d 100644 --- a/Engine/source/T3D/lighting/skylight.cpp +++ b/Engine/source/T3D/lighting/skylight.cpp @@ -143,6 +143,9 @@ void Skylight::unpackUpdate(NetConnection *conn, BitStream *stream) void Skylight::updateProbeParams() { + if (!mProbeInfo) + return; + mProbeShapeType = ProbeRenderInst::Skylight; Parent::updateProbeParams(); } diff --git a/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp b/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp index 487f7c698..7334a2060 100644 --- a/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp +++ b/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp @@ -139,6 +139,9 @@ void SphereEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream void SphereEnvironmentProbe::updateProbeParams() { + if (!mProbeInfo) + return; + mProbeShapeType = ProbeRenderInst::Sphere; Parent::updateProbeParams(); } diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index aa2e53592..878253e93 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -415,6 +415,8 @@ void RenderProbeMgr::_setupStaticParameters() mEffectiveProbeCount = 0; mMipCount = 0; + mHasSkylight = false; + if (probePositionsData.size() != MAXPROBECOUNT) { probePositionsData.setSize(MAXPROBECOUNT); diff --git a/Engine/source/renderInstance/renderProbeMgr.h b/Engine/source/renderInstance/renderProbeMgr.h index 4ec9584ff..560410188 100644 --- a/Engine/source/renderInstance/renderProbeMgr.h +++ b/Engine/source/renderInstance/renderProbeMgr.h @@ -77,9 +77,6 @@ struct ProbeRenderInst GFXCubemapHandle mPrefilterCubemap; GFXCubemapHandle mIrradianceCubemap; - //Utilized in dynamic reflections - CubeReflector mCubeReflector; - /// The priority of this light used for /// light and shadow scoring. F32 mPriority; diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 0c5e8e80b..050bbb71f 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,126 +1,123 @@ + + 0 + 1 + screenCenter + 6 + WorldEditorInspectorPlugin + 40 + 50 + AssetWork_Debug.exe + + 8 + 1 + 0 + 255 + 20 + + + ../../../Documentation/Torque 3D - Script Manual.chm + http://www.garagegames.com/products/torque-3d/documentation/user + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/forums + + + 1 + 1 + 1 + 1 + 1 + + + 255 255 255 100 + 0 + 51 51 51 100 + 102 102 102 100 + 1 + + + 2 + 0 + 0 + 1 + 1 + 0 + 100 + + + 48 48 48 255 + 215 215 215 255 + 180 180 180 255 + 255 255 255 255 + 50 50 50 255 + + + 0 0 255 255 + 0 255 0 255 + 255 0 0 255 + 255 255 0 255 + 100 100 100 255 + 255 255 255 255 + 255 255 0 255 + + + tools/worldEditor/images/SelectHandle + tools/worldEditor/images/LockedHandle + tools/worldEditor/images/DefaultHandle + + + + 1024 768 + tools/gui + + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 8 + 2 + 1 + 0 + + + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/documentation/user + + + 1 + 1 + + + Categorized + + + 0 + + - 0.8 0 1 100 15 0 0.8 + 0.8 0 - 255 255 255 20 500 0 - 0 + 255 255 255 20 10 10 10 + 0 - - 40 - 50 - 6 - 0 - 1 - screenCenter - WorldEditorInspectorPlugin - AssetWork_Debug.exe - - 102 102 102 100 - 255 255 255 100 - 51 51 51 100 - 1 - 0 - - - 255 0 0 255 - 255 255 255 255 - 0 0 255 255 - 0 255 0 255 - 255 255 0 255 - 100 100 100 255 - 255 255 0 255 - - - 1 - 1 - 1 - 1 - 1 - - - 100 - 0 - 0 - 1 - 2 - 1 - 0 - - - 8 - 20 - 255 - 0 - 1 - - - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Torque 3D - Script Manual.chm - http://www.garagegames.com/products/torque-3d/forums - - - tools/worldEditor/images/LockedHandle - tools/worldEditor/images/SelectHandle - tools/worldEditor/images/DefaultHandle - - - 50 50 50 255 - 48 48 48 255 - 180 180 180 255 - 215 215 215 255 - 255 255 255 255 - - - - tools/gui - 1024 768 - - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Official Documentation.html - ../../../Documentation/Torque 3D - Script Manual.chm - - - 2 - 1 - 0 - 8 - 1 - 1 - 1 - 1 - - - Categorized - - - 0 - 0 - 0 - - - 1 - 1 - - - 0 - - - - AIPlayer - data/FPSGameplay/levels @@ -132,4 +129,7 @@ Grid_512_Orange + + AIPlayer +