fix guishapeedpreview not displaying IBL

note this *does* require a baked skylight in the main scene
todo: track down why a similar protocol does not operate for guimaterialpreview and guiobjectview
This commit is contained in:
AzaezelX 2024-02-10 13:36:55 -06:00
parent 25a3c3325f
commit de87d2f6ad
6 changed files with 24 additions and 0 deletions

View file

@ -33,6 +33,8 @@
#include "core/resourceManager.h" #include "core/resourceManager.h"
#include "scene/sceneManager.h" #include "scene/sceneManager.h"
#include "scene/sceneRenderState.h" #include "scene/sceneRenderState.h"
#include "renderInstance/renderProbeMgr.h"
#include "T3D/lighting/skylight.h"
// GuiMaterialPreview // GuiMaterialPreview
GuiMaterialPreview::GuiMaterialPreview() GuiMaterialPreview::GuiMaterialPreview()
@ -372,6 +374,9 @@ void GuiMaterialPreview::renderWorld(const RectI &updateRect)
FogData savedFogData = gClientSceneGraph->getFogData(); FogData savedFogData = gClientSceneGraph->getFogData();
gClientSceneGraph->setFogData( FogData() ); // no fog in preview window gClientSceneGraph->setFogData( FogData() ); // no fog in preview window
if (Skylight::smSkylightProbe.isValid())
PROBEMGR->submitProbe(Skylight::smSkylightProbe->getProbeInfo());
RenderPassManager* renderPass = gClientSceneGraph->getDefaultRenderPass(); RenderPassManager* renderPass = gClientSceneGraph->getDefaultRenderPass();
SceneRenderState state SceneRenderState state
( (

View file

@ -31,6 +31,8 @@
#include "math/mathTypes.h" #include "math/mathTypes.h"
#include "gfx/gfxTransformSaver.h" #include "gfx/gfxTransformSaver.h"
#include "console/engineAPI.h" #include "console/engineAPI.h"
#include "renderInstance/renderProbeMgr.h"
#include "T3D/lighting/skylight.h"
IMPLEMENT_CONOBJECT( GuiObjectView ); IMPLEMENT_CONOBJECT( GuiObjectView );
@ -541,6 +543,12 @@ void GuiObjectView::renderWorld( const RectI& updateRect )
// Render primary model. // Render primary model.
if (Skylight::smSkylightProbe.isValid())
PROBEMGR->submitProbe(Skylight::smSkylightProbe->getProbeInfo());
FogData savedFogData = gClientSceneGraph->getFogData();
gClientSceneGraph->setFogData(FogData()); // no fog in preview window
if(mModelInstance) if(mModelInstance)
{ {
if( mRunThread ) if( mRunThread )
@ -567,6 +575,7 @@ void GuiObjectView::renderWorld( const RectI& updateRect )
renderPass->renderPass( &state ); renderPass->renderPass( &state );
gClientSceneGraph->setFogData(savedFogData); // restore fog setting
// Make sure to remove our fake sun. // Make sure to remove our fake sun.
LIGHTMGR->unregisterAllLights(); LIGHTMGR->unregisterAllLights();
} }

View file

@ -378,6 +378,7 @@ public:
/// Invokes a cubemap bake action for this probe /// Invokes a cubemap bake action for this probe
/// </summary> /// </summary>
void bake(); void bake();
ProbeInfo* getProbeInfo() { return &mProbeInfo; }
}; };
typedef ReflectionProbe::ProbeInfo::ProbeShapeType ReflectProbeType; typedef ReflectionProbe::ProbeInfo::ProbeShapeType ReflectProbeType;

View file

@ -59,6 +59,8 @@ extern bool gEditingMission;
extern ColorI gCanvasClearColor; extern ColorI gCanvasClearColor;
bool Skylight::smRenderSkylights = true; bool Skylight::smRenderSkylights = true;
SimObjectPtr<Skylight> Skylight::smSkylightProbe = nullptr;
IMPLEMENT_CO_NETOBJECT_V1(Skylight); IMPLEMENT_CO_NETOBJECT_V1(Skylight);
ConsoleDocClass(Skylight, ConsoleDocClass(Skylight,
@ -117,6 +119,8 @@ bool Skylight::onAdd()
if (!Parent::onAdd()) if (!Parent::onAdd())
return false; return false;
if (isClientObject())
smSkylightProbe = this;
return true; return true;
} }

View file

@ -108,6 +108,7 @@ public:
void prepRenderImage(SceneRenderState *state); void prepRenderImage(SceneRenderState *state);
void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat);
static SimObjectPtr<Skylight> smSkylightProbe;
}; };
#endif // _Skylight_H_ #endif // _Skylight_H_

View file

@ -37,6 +37,8 @@
#include "T3D/assets/ShapeAsset.h" #include "T3D/assets/ShapeAsset.h"
#include "T3D/assets/ShapeAnimationAsset.h" #include "T3D/assets/ShapeAnimationAsset.h"
#include "renderInstance/renderProbeMgr.h"
#include "T3D/lighting/skylight.h"
#ifdef TORQUE_COLLADA #ifdef TORQUE_COLLADA
#include "collision/optimizedPolyList.h" #include "collision/optimizedPolyList.h"
@ -1409,6 +1411,8 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect)
FogData savedFogData = gClientSceneGraph->getFogData(); FogData savedFogData = gClientSceneGraph->getFogData();
gClientSceneGraph->setFogData( FogData() ); // no fog in preview window gClientSceneGraph->setFogData( FogData() ); // no fog in preview window
if (Skylight::smSkylightProbe.isValid())
PROBEMGR->submitProbe(Skylight::smSkylightProbe->getProbeInfo());
SceneRenderState state SceneRenderState state
( (
gClientSceneGraph, gClientSceneGraph,