Forráskód Böngészése

Merge pull request #1213 from Azaezel/alpha41/ProbesInPreviewers

fix guishapeedpreview not displaying IBL
Brian Roberts 1 éve
szülő
commit
5afbfec3b1

+ 5 - 0
Engine/source/T3D/guiMaterialPreview.cpp

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

+ 9 - 0
Engine/source/T3D/guiObjectView.cpp

@@ -31,6 +31,8 @@
 #include "math/mathTypes.h"
 #include "gfx/gfxTransformSaver.h"
 #include "console/engineAPI.h"
+#include "renderInstance/renderProbeMgr.h"
+#include "T3D/lighting/skylight.h"
 
 IMPLEMENT_CONOBJECT( GuiObjectView );
 
@@ -541,6 +543,12 @@ void GuiObjectView::renderWorld( const RectI& updateRect )
 
    // 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( mRunThread )
@@ -567,6 +575,7 @@ void GuiObjectView::renderWorld( const RectI& updateRect )
 
    renderPass->renderPass( &state );
 
+   gClientSceneGraph->setFogData(savedFogData);         // restore fog setting
    // Make sure to remove our fake sun.
    LIGHTMGR->unregisterAllLights();
 }

+ 1 - 0
Engine/source/T3D/lighting/reflectionProbe.h

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

+ 4 - 0
Engine/source/T3D/lighting/skylight.cpp

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

+ 1 - 0
Engine/source/T3D/lighting/skylight.h

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

+ 4 - 0
Engine/source/gui/editor/guiShapeEdPreview.cpp

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

+ 3 - 5
Templates/BaseGame/game/tools/settings.xml

@@ -41,7 +41,7 @@
             <Setting
                 name="doubleClickAction">Edit Asset</Setting>
             <Setting
-                name="LastPosExt">0 976 2200 360</Setting>
+                name="LastPosExt">0 634 1560 360</Setting>
             <Setting
                 name="previewTileSize">1</Setting>
             <Setting
@@ -245,7 +245,7 @@
         <Setting
             name="AdvancedWndVisible">1</Setting>
         <Setting
-            name="backgroundColor">0 0 0 100</Setting>
+            name="backgroundColor">128 128 128 100</Setting>
         <Setting
             name="gridDimension">40 40</Setting>
         <Setting
@@ -367,12 +367,10 @@
             name="dropType">screenCenter</Setting>
         <Setting
             name="EditorLayoutMode">Modern</Setting>
-        <Setting
-            name="forceLoadDAE">0</Setting>
         <Setting
             name="forceSidebarToSide">1</Setting>
         <Setting
-            name="orthoFOV">4.60158014</Setting>
+            name="orthoFOV">1.21430779</Setting>
         <Setting
             name="orthoShowGrid">1</Setting>
         <Setting

+ 1 - 1
Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdPreviewWindow.ed.gui

@@ -41,7 +41,7 @@ $guiContent = new GuiControl() {
          canSave = "1";
          Visible = "1";
          hovertime = "1000";
-         color = "0 0 0 .39";
+         color = "0.5 0.5 0.5 .39";
       };
       new GuiShapeEdPreview(ShapeEdShapeView) {
          canSaveDynamicFields = "0";

+ 1 - 1
Templates/BaseGame/game/tools/shapeEditor/main.tscript

@@ -354,7 +354,7 @@ function ShapeEditorPlugin::initSettings( %this )
    EditorSettings.beginGroup( "ShapeEditor", true );
 
    // Display options
-   EditorSettings.setDefaultValue( "BackgroundColor",    "0 0 0 100" );
+   EditorSettings.setDefaultValue( "BackgroundColor",    "128 128 128 100" );
    EditorSettings.setDefaultValue( "HighlightMaterial", 1 );
    EditorSettings.setDefaultValue( "ShowNodes", 1 );
    EditorSettings.setDefaultValue( "ShowBounds", 0 );