Browse Source

Merge remote-tracking branch 'dragonCASTjosh/master'

Lasse Öörni 9 years ago
parent
commit
de24325bcc

+ 1 - 1
bin/Data/LuaScripts/42_PBRMaterials.lua

@@ -128,8 +128,8 @@ function SetupViewport()
 
     -- Add post-processing effects appropriate with the example scene
     local effectRenderPath = viewport:GetRenderPath():Clone()
-    effectRenderPath:Append(cache:GetResource("XMLFile", "PostProcess/BloomHDR.xml"))
     effectRenderPath:Append(cache:GetResource("XMLFile", "PostProcess/FXAA2.xml"))
+    effectRenderPath:Append(cache:GetResource("XMLFile", "PostProcess/GammaCorrection.xml"))
 
     viewport.renderPath = effectRenderPath;
 end

+ 3 - 3
bin/Data/Scenes/PBRExample.xml

@@ -7,8 +7,8 @@
 	<attribute name="Elapsed Time" value="36.5594" />
 	<attribute name="Next Replicated Node ID" value="232" />
 	<attribute name="Next Replicated Component ID" value="251" />
-	<attribute name="Next Local Node ID" value="16777266" />
-	<attribute name="Next Local Component ID" value="16777793" />
+	<attribute name="Next Local Node ID" value="16777267" />
+	<attribute name="Next Local Component ID" value="16777805" />
 	<attribute name="Variables" />
 	<attribute name="Variable Names" value="" />
 	<component type="Octree" id="1" />
@@ -669,7 +669,7 @@
 		<component type="Zone" id="11">
 			<attribute name="Bounding Box Min" value="-1000 -1000 -1000" />
 			<attribute name="Bounding Box Max" value="1000 1000 1000" />
-			<attribute name="Ambient Color" value="0 0 0 5" />
+			<attribute name="Ambient Color" value="0 0 0 1" />
 			<attribute name="Zone Texture" value="TextureCube;Textures/Skybox2.xml" />
 		</component>
 	</node>

+ 0 - 1
bin/Data/Scripts/42_PBRMaterials.as

@@ -156,7 +156,6 @@ void SetupViewport()
 
     // Add post-processing effects appropriate with the example scene
     RenderPath@ effectRenderPath = viewport.renderPath.Clone();
-    effectRenderPath.Append(cache.GetResource("XMLFile", "PostProcess/BloomHDR.xml"));
     effectRenderPath.Append(cache.GetResource("XMLFile", "PostProcess/FXAA2.xml"));
     effectRenderPath.Append(cache.GetResource("XMLFile", "PostProcess/GammaCorrection.xml"));
 

+ 2 - 0
bin/Data/Scripts/Editor.as

@@ -250,6 +250,7 @@ void LoadConfig()
         if (renderingElem.HasAttribute("dynamicinstancing")) renderer.dynamicInstancing = renderingElem.GetBool("dynamicinstancing");
         if (renderingElem.HasAttribute("framelimiter")) engine.maxFps = renderingElem.GetBool("framelimiter") ? 200 : 0;
         if (renderingElem.HasAttribute("gammacorrection")) gammaCorrection = renderingElem.GetBool("gammacorrection");
+        if (renderingElem.HasAttribute("HDR")) HDR = renderingElem.GetBool("HDR"); 
     }
 
     if (!uiElem.isNull)
@@ -384,6 +385,7 @@ void SaveConfig()
 
     renderingElem.SetBool("framelimiter", engine.maxFps > 0);
     renderingElem.SetBool("gammacorrection", gammaCorrection);
+    renderingElem.SetBool("HDR", HDR);
 
     uiElem.SetFloat("minopacity", uiMinOpacity);
     uiElem.SetFloat("maxopacity", uiMaxOpacity);

+ 10 - 0
bin/Data/Scripts/Editor/EditorSettings.as

@@ -114,6 +114,9 @@ void UpdateEditorSettingsDialog()
     CheckBox@ gammaCorrectionToggle = settingsDialog.GetChild("GammaCorrectionToggle", true);
     gammaCorrectionToggle.checked = gammaCorrection;
 
+    CheckBox@ HDRToggle = settingsDialog.GetChild("HDRToggle", true);
+    HDRToggle.checked = HDR;
+
     LineEdit@ cubemapPath = settingsDialog.GetChild("CubeMapGenPath", true);
     cubemapPath.text = cubeMapGen_Path;
     LineEdit@ cubemapName = settingsDialog.GetChild("CubeMapGenKey", true);
@@ -169,6 +172,7 @@ void UpdateEditorSettingsDialog()
         SubscribeToEvent(dynamicInstancingToggle, "Toggled", "EditDynamicInstancing");
         SubscribeToEvent(frameLimiterToggle, "Toggled", "EditFrameLimiter");
         SubscribeToEvent(gammaCorrectionToggle, "Toggled", "EditGammaCorrection");
+        SubscribeToEvent(HDRToggle, "Toggled", "EditHDR");
         SubscribeToEvent(settingsDialog.GetChild("CloseButton", true), "Released", "HideEditorSettingsDialog");
         
         SubscribeToEvent(cubemapPath, "TextChanged",  "EditCubemapPath");
@@ -430,6 +434,12 @@ void EditGammaCorrection(StringHash eventType, VariantMap& eventData)
     SetGammaCorrection(edit.checked);
 }
 
+void EditHDR(StringHash eventType, VariantMap& eventData)
+{
+    CheckBox@ edit = eventData["Element"].GetPtr();
+    SetHDR(edit.checked);
+}
+
 void EditCubemapPath(StringHash eventType, VariantMap& eventData)
 {
     LineEdit@ edit = eventData["Element"].GetPtr();

+ 10 - 0
bin/Data/Scripts/Editor/EditorView.as

@@ -18,6 +18,7 @@ IntRect viewportUIClipBorder = IntRect(27, 60, 0, 0); // used to clip viewport b
 RenderPath@ renderPath; // Renderpath to use on all views
 String renderPathName;
 bool gammaCorrection = false;
+bool HDR = false;
 bool mouseWheelCameraPosition = false;
 bool contextMenuActionWaitFrame = false;
 bool cameraFlyMode = true;
@@ -466,6 +467,8 @@ void SetRenderPath(const String&in newRenderPathName)
     renderPath.Append(cache.GetResource("XMLFile", "PostProcess/GammaCorrection.xml"));
     renderPath.SetEnabled("GammaCorrection", gammaCorrection);
 
+    renderer.hdrRendering = HDR;
+
     for (uint i = 0; i < renderer.numViewports; ++i)
         renderer.viewports[i].renderPath = renderPath;
 
@@ -483,6 +486,13 @@ void SetGammaCorrection(bool enable)
         renderPath.SetEnabled("GammaCorrection", gammaCorrection);
 }
 
+void SetHDR(bool enable)
+{
+    HDR = enable;
+    if (renderPath !is null)
+        renderer.hdrRendering = HDR;
+}
+
 void CreateCamera()
 {
     // Set the initial viewport rect

+ 9 - 0
bin/Data/UI/EditorSettingsDialog.xml

@@ -344,6 +344,15 @@
                         <attribute name="Text" value="Gamma correction" />
                     </element>
                 </element>
+                <element style="ListRow">
+                    <attribute name="Layout Spacing" value="8" />
+                    <element type="CheckBox">
+                        <attribute name="Name" value="HDRToggle" />
+                    </element>
+                    <element type="Text">
+                        <attribute name="Text" value="Enable HDR" />
+                    </element>
+                </element>
                 <element style="ListRow">
                     <attribute name="Layout Spacing" value="8" />
                     <element type="Text">