Ver código fonte

Move some render specific flags from Camera to RenderSettings

BearishSun 8 anos atrás
pai
commit
0e00b1241f
27 arquivos alterados com 163 adições e 198 exclusões
  1. 0 6
      Source/BansheeCore/Include/BsCCamera.h
  2. 25 59
      Source/BansheeCore/Include/BsCamera.h
  3. 1 3
      Source/BansheeCore/Include/BsCameraRTTI.h
  4. 23 0
      Source/BansheeCore/Include/BsRenderSettings.h
  5. 4 0
      Source/BansheeCore/Include/BsRenderSettingsRTTI.h
  6. 1 1
      Source/BansheeCore/Source/BsAnimationManager.cpp
  7. 1 14
      Source/BansheeCore/Source/BsCamera.cpp
  8. 13 0
      Source/BansheeCore/Source/BsRenderSettings.cpp
  9. 3 1
      Source/BansheeEditor/Source/BsEditorWindowBase.cpp
  10. 2 1
      Source/Examples/ExampleGettingStarted/Source/Main.cpp
  11. 0 10
      Source/MBansheeEditor/Inspectors/CameraInspector.cs
  12. 25 0
      Source/MBansheeEditor/Inspectors/RenderSettingsInspector.cs
  13. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs
  14. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneWindow.cs
  15. 0 22
      Source/MBansheeEngine/Interop/NativeCamera.cs
  16. 0 24
      Source/MBansheeEngine/Rendering/Camera.cs
  17. 25 0
      Source/MBansheeEngine/Rendering/RenderSettings.cs
  18. 0 4
      Source/RenderBeast/Include/BsRendererView.h
  19. 3 2
      Source/RenderBeast/Source/BsLightRendering.cpp
  20. 7 5
      Source/RenderBeast/Source/BsRenderBeast.cpp
  21. 1 1
      Source/RenderBeast/Source/BsRenderCompositor.cpp
  22. 0 4
      Source/RenderBeast/Source/BsRendererScene.cpp
  23. 7 7
      Source/RenderBeast/Source/BsRendererView.cpp
  24. 0 6
      Source/SBansheeEngine/Include/BsScriptCamera.h
  25. 4 0
      Source/SBansheeEngine/Include/BsScriptRenderSettings.h
  26. 0 26
      Source/SBansheeEngine/Source/BsScriptCamera.cpp
  27. 16 0
      Source/SBansheeEngine/Source/BsScriptRenderSettings.cpp

+ 0 - 6
Source/BansheeCore/Include/BsCCamera.h

@@ -148,12 +148,6 @@ namespace bs
 		/** @copydoc Camera::setRenderSettings() */
 		void setRenderSettings(const SPtr<RenderSettings>& settings) { mInternal->setRenderSettings(settings); }
 
-		/** @copydoc Camera::getFlags */
-		CameraFlags getFlags() const { return mInternal->getFlags(); }
-
-		/** @copydoc Camera::setFlag */
-		void setFlag(const CameraFlag& flag, bool enable) { mInternal->setFlag(flag, enable); }
-
 		/** @copydoc Camera::worldToScreenPoint */
 		Vector2I worldToScreenPoint(const Vector3& worldPoint) const { updateView(); return mInternal->worldToScreenPoint(worldPoint); }
 

+ 25 - 59
Source/BansheeCore/Include/BsCamera.h

@@ -29,33 +29,6 @@ namespace bs
 		RenderSettings = 1<<2
 	};
 
-	/**	Flags that describe a camera. */
-	enum class CameraFlag
-	{
-		/** 
-		 * This flag is a signal to the renderer that his camera will only render overlays and doesn't require depth   
-		 * buffer or multi-sampled render targets. Such cameras will not render any scene objects. This can improve
-		 * performance and memory usage. 
-		 */
-		Overlay = 1 << 0,
-		/** 
-		 * High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger
-		 * range of values. The stored light is then converted into visible color range using exposure and a tone mapping 
-		 * operator.
-		 */
-		HDR = 1 << 1,
-		/** 
-		 * Specify that no lighting should be applied to scene objects and everything should be rendered using their
-		 * albedo texture.
-		 */
-		NoLighting = 1 << 2,
-		/** Specify that no shadows should be applied to scene objects. Only relevant if lighting is turned on. */
-		NoShadows = 1 << 3
-	};
-
-	typedef Flags<CameraFlag> CameraFlags;
-	BS_FLAGS_OPERATORS(CameraFlag);
-
 	/** @} */
 	/** @addtogroup Implementation
 	 *  @{
@@ -68,48 +41,48 @@ namespace bs
 	 * This class contains funcionality common to both core and non-core versions of the camera.
 	 */
 	class BS_CORE_EXPORT CameraBase
-    {
-    public:
+	{
+	public:
 		virtual ~CameraBase() { }
 
 		/**
 		 * Sets the camera horizontal field of view. This determines how wide the camera viewing angle is along the
 		 * horizontal axis. Vertical FOV is calculated from the horizontal FOV and the aspect ratio.
 		 */
-        virtual void setHorzFOV(const Radian& fovy);
+		virtual void setHorzFOV(const Radian& fovy);
 
 		/**	Retrieves the camera horizontal field of view. */
-        virtual const Radian& getHorzFOV() const;
+		virtual const Radian& getHorzFOV() const;
 
 		/**
 		 * Sets the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane will
 		 * not be rendered. Decreasing this value decreases depth buffer precision.
 		 */
-        virtual void setNearClipDistance(float nearDist);
+		virtual void setNearClipDistance(float nearDist);
 
 		/**
 		 * Retrieves the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane
 		 * will not be rendered. Decreasing this value decreases depth buffer precision.
 		 */
-        virtual float getNearClipDistance() const;
+		virtual float getNearClipDistance() const;
 
 		/**
 		 * Sets the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane will
 		 * not be rendered. Increasing this value decreases depth buffer precision.
 		 */
-        virtual void setFarClipDistance(float farDist);
+		virtual void setFarClipDistance(float farDist);
 
 		/**
 		 * Retrieves the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane
 		 * will not be rendered. Increasing this value decreases depth buffer precision.
 		 */
-        virtual float getFarClipDistance() const;
+		virtual float getFarClipDistance() const;
 
 		/**	Sets the current viewport aspect ratio (width / height). */
-        virtual void setAspectRatio(float ratio);
+		virtual void setAspectRatio(float ratio);
 
 		/**	Returns current viewport aspect ratio (width / height). */
-        virtual float getAspectRatio() const;
+		virtual float getAspectRatio() const;
 
 		/**	Sets camera world space position. */
 		virtual void setPosition(const Vector3& position);
@@ -164,14 +137,14 @@ namespace bs
 		 * You should use this matrix when sending the matrix to the render system to make sure everything works 
 		 * consistently when other render systems are used.
 		 */
-        virtual const Matrix4& getProjectionMatrixRS() const;
+		virtual const Matrix4& getProjectionMatrixRS() const;
 
 		/** 
 		 * Returns the inverse of the render-system specific projection matrix.
 		 *
 		 * @see		getProjectionMatrixRS
 		 */
-        virtual const Matrix4& getProjectionMatrixRSInv() const;
+		virtual const Matrix4& getProjectionMatrixRSInv() const;
 
 		/** 
 		 * Returns the standard projection matrix that determines how are 3D points projected to two dimensions. Returned
@@ -180,18 +153,18 @@ namespace bs
 		 * @note	
 		 * Different render systems will expect different projection matrix layouts, in which case use 
 		 * getProjectionMatrixRS().
-         */
-        virtual const Matrix4& getProjectionMatrix() const;
+		 */
+		virtual const Matrix4& getProjectionMatrix() const;
 
 		/** 
 		 * Returns the inverse of the projection matrix.
 		 *
 		 * @see		getProjectionMatrix
 		 */
-        virtual const Matrix4& getProjectionMatrixInv() const;
+		virtual const Matrix4& getProjectionMatrixInv() const;
 
 		/** Gets the camera view matrix. Used for positioning/orienting the camera. */
-        virtual const Matrix4& getViewMatrix() const;
+		virtual const Matrix4& getViewMatrix() const;
 
 		/** 
 		 * Returns the inverse of the view matrix.
@@ -203,7 +176,7 @@ namespace bs
 		/** 
 		 * Sets whether the camera should use the custom view matrix. When this is enabled camera will no longer calculate
 		 * its view matrix based on position/orientation and caller will be resonsible to keep the view matrix up to date.
-         */
+		 */
 		virtual void setCustomViewMatrix(bool enable, const Matrix4& viewMatrix = Matrix4::IDENTITY);
 
 		/** Returns true if a custom view matrix is used. */
@@ -213,32 +186,32 @@ namespace bs
 		 * Sets whether the camera should use the custom projection matrix. When this is enabled camera will no longer
 		 * calculate its projection matrix based on field of view, aspect and other parameters and caller will be resonsible
 		 * to keep the projection matrix up to date.
-         */
+		 */
 		virtual void setCustomProjectionMatrix(bool enable, const Matrix4& projectionMatrix = Matrix4::IDENTITY);
 
 		/** Returns true if a custom projection matrix is used. */
 		virtual bool isCustomProjectionMatrixEnabled() const { return mCustomProjMatrix; }
 
 		/** Returns a convex volume representing the visible area of the camera, in local space. */
-        virtual const ConvexVolume& getFrustum() const;
+		virtual const ConvexVolume& getFrustum() const;
 
 		/** Returns a convex volume representing the visible area of the camera, in world space. */
-        virtual ConvexVolume getWorldFrustum() const;
+		virtual ConvexVolume getWorldFrustum() const;
 
 		/**	Returns the bounding of the frustum. */
-        const AABox& getBoundingBox() const;
+		const AABox& getBoundingBox() const;
 
 		/**
 		 * Sets the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a 
 		 * 2D plane.
 		 */
-        virtual void setProjectionType(ProjectionType pt);
+		virtual void setProjectionType(ProjectionType pt);
 
 		/**
 		 * Returns the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a
 		 * 2D plane.
 		 */
-        virtual ProjectionType getProjectionType() const;
+		virtual ProjectionType getProjectionType() const;
 
 		/**
 		 * Sets the orthographic window height, for use with orthographic rendering only. 
@@ -318,12 +291,6 @@ namespace bs
 		 */
 		void setRenderSettings(const SPtr<RenderSettings>& settings) { mRenderSettings = settings; _markCoreDirty(CameraDirtyFlag::RenderSettings); }
 
-		/**	Retrieves flags that define the camera. */
-		CameraFlags getFlags() const { return mCameraFlags; }
-
-		/**	Enables or disables flags that define the camera's behaviour. */
-		void setFlag(const CameraFlag& flag, bool enable);
-
 		/**
 		 * Converts a point in world space to screen coordinates (in pixels corresponding to the render target attached to
 		 * the camera).
@@ -459,9 +426,8 @@ namespace bs
 		 */
 		virtual void _markCoreDirty(CameraDirtyFlag flag = CameraDirtyFlag::Everything) { }
 
-    protected:
+	protected:
 		UINT64 mLayers; /**< Bitfield that can be used for filtering what objects the camera sees. */
-		CameraFlags mCameraFlags; /**< Flags that further determine type of camera. */
 
 		Vector3 mPosition; /**< World space position. */
 		Quaternion mRotation; /**< World space rotation. */
@@ -575,7 +541,7 @@ namespace bs
 		friend class CameraRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		RTTITypeBase* getRTTI() const override;
-     };
+	};
 
 	namespace ct
 	{

+ 1 - 3
Source/BansheeCore/Include/BsCameraRTTI.h

@@ -38,7 +38,7 @@ namespace bs
 			BS_RTTI_MEMBER_PLAIN(mRight, 19)
 			BS_RTTI_MEMBER_PLAIN(mTop, 20)
 			BS_RTTI_MEMBER_PLAIN(mBottom, 21)
-			BS_RTTI_MEMBER_PLAIN(mCameraFlags, 22)
+			//BS_RTTI_MEMBER_PLAIN(mCameraFlags, 22)
 			BS_RTTI_MEMBER_PLAIN(mMSAA, 23)
 			/** BS_RTTI_MEMBER_PLAIN(mPPSettings, 24) */
 			BS_RTTI_MEMBER_REFLPTR(mRenderSettings, 25)
@@ -75,8 +75,6 @@ namespace bs
 		}
 	};
 
-	BS_ALLOW_MEMCPY_SERIALIZATION(CameraFlags);
-
 	/** @} */
 	/** @endcond */
 }

+ 23 - 0
Source/BansheeCore/Include/BsRenderSettings.h

@@ -431,6 +431,29 @@ namespace bs
 		 */
 		float gamma;
 
+		/** 
+		 * High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger
+		 * range of values. The stored light is then converted into visible color range using exposure and a tone mapping 
+		 * operator.
+		 */
+		bool enableHDR;
+
+		/** 
+		 * Determines if scene objects will be lit by lights. If disabled everything will be rendered using their albedo
+		 * texture with no lighting applied.
+		 */
+		bool enableLighting;
+
+		/** Determines if shadows cast by lights should be rendered. Only relevant if lighting is turned on. */
+		bool enableShadows;
+
+		/** 
+		 * Signals the renderer to only render overlays (like GUI), and not scene objects. Such rendering doesn't require
+		 * depth buffer or multi-sampled render targets and will not render any scene objects. This can improve performance
+		 * and memory usage for overlay-only views. 
+		 */
+		bool overlayOnly;
+
 		/** @name Internal
 		 *  @{
 		 */

+ 4 - 0
Source/BansheeCore/Include/BsRenderSettingsRTTI.h

@@ -265,6 +265,10 @@ namespace bs
 			BS_RTTI_MEMBER_PLAIN(enableFXAA, 9)
 			BS_RTTI_MEMBER_REFL(ambientOcclusion, 10)
 			BS_RTTI_MEMBER_REFL(screenSpaceReflections, 11)
+			BS_RTTI_MEMBER_PLAIN(enableHDR, 12)
+			BS_RTTI_MEMBER_PLAIN(enableLighting, 13)
+			BS_RTTI_MEMBER_PLAIN(enableShadows, 14)
+			BS_RTTI_MEMBER_PLAIN(overlayOnly, 15)
 		BS_END_RTTI_MEMBERS
 			
 	public:

+ 1 - 1
Source/BansheeCore/Source/BsAnimationManager.cpp

@@ -88,7 +88,7 @@ namespace bs
 		auto& allCameras = gSceneManager().getAllCameras();
 		for(auto& entry : allCameras)
 		{
-			bool isOverlayCamera = entry.second.camera->getFlags().isSet(CameraFlag::Overlay);
+			bool isOverlayCamera = entry.second.camera->getRenderSettings()->overlayOnly;
 			if (isOverlayCamera)
 				continue;
 

+ 1 - 14
Source/BansheeCore/Source/BsCamera.cpp

@@ -19,7 +19,7 @@ namespace bs
 	const float CameraBase::INFINITE_FAR_PLANE_ADJUST = 0.00001f;
 
 	CameraBase::CameraBase()
-		: mLayers(0xFFFFFFFFFFFFFFFF), mCameraFlags(CameraFlag::HDR), mPosition(BsZero), mRotation(BsIdentity)
+		: mLayers(0xFFFFFFFFFFFFFFFF), mPosition(BsZero), mRotation(BsIdentity)
 		, mIsActive(true), mProjType(PT_PERSPECTIVE), mHorzFOV(Degree(90.0f)), mFarDist(1000.0f), mNearDist(0.05f)
 		, mAspect(1.33333333333333f), mOrthoHeight(5), mPriority(0), mCustomViewMatrix(false), mCustomProjMatrix(false)
 		, mMSAA(1), mFrustumExtentsManuallySet(false), mProjMatrixRS(BsZero), mProjMatrix(BsZero), mViewMatrix(BsZero)
@@ -461,16 +461,6 @@ namespace bs
 		outbottom = mBottom;
 	}
 
-	void CameraBase::setFlag(const CameraFlag& flag, bool enable)
-	{
-		if (enable)
-			mCameraFlags.set(flag);
-		else
-			mCameraFlags.unset(flag);
-			
-		_markCoreDirty();
-	}
-
 	void CameraBase::setPosition(const Vector3& position)
 	{
 		mPosition = position;
@@ -758,7 +748,6 @@ namespace bs
 			size += rttiGetElemSize(mCustomViewMatrix);
 			size += rttiGetElemSize(mCustomProjMatrix);
 			size += rttiGetElemSize(mFrustumExtentsManuallySet);
-			size += rttiGetElemSize(mCameraFlags);
 			size += rttiGetElemSize(mIsActive);
 			size += rttiGetElemSize(mMSAA);
 			size += sizeof(UINT32);
@@ -790,7 +779,6 @@ namespace bs
 			dataPtr = rttiWriteElem(mCustomViewMatrix, dataPtr);
 			dataPtr = rttiWriteElem(mCustomProjMatrix, dataPtr);
 			dataPtr = rttiWriteElem(mFrustumExtentsManuallySet, dataPtr);
-			dataPtr = rttiWriteElem(mCameraFlags, dataPtr);
 			dataPtr = rttiWriteElem(mIsActive, dataPtr);
 			dataPtr = rttiWriteElem(mMSAA, dataPtr);
 
@@ -882,7 +870,6 @@ namespace bs
 			dataPtr = rttiReadElem(mCustomViewMatrix, dataPtr);
 			dataPtr = rttiReadElem(mCustomProjMatrix, dataPtr);
 			dataPtr = rttiReadElem(mFrustumExtentsManuallySet, dataPtr);
-			dataPtr = rttiReadElem(mCameraFlags, dataPtr);
 			dataPtr = rttiReadElem(mIsActive, dataPtr);
 			dataPtr = rttiReadElem(mMSAA, dataPtr);
 

+ 13 - 0
Source/BansheeCore/Source/BsRenderSettings.cpp

@@ -110,6 +110,7 @@ namespace bs
 
 	RenderSettings::RenderSettings()
 		: enableAutoExposure(true), enableTonemapping(true), enableFXAA(false), exposureScale(0.0f), gamma(2.2f)
+		, enableHDR(true), enableLighting(true), enableShadows(true), overlayOnly(false)
 	{ }
 
 	RTTITypeBase* RenderSettings::getRTTIStatic()
@@ -130,6 +131,10 @@ namespace bs
 		bufferSize += rttiGetElemSize(exposureScale);
 		bufferSize += rttiGetElemSize(gamma);
 		bufferSize += rttiGetElemSize(enableFXAA);
+		bufferSize += rttiGetElemSize(enableHDR);
+		bufferSize += rttiGetElemSize(enableLighting);
+		bufferSize += rttiGetElemSize(enableShadows);
+		bufferSize += rttiGetElemSize(overlayOnly);
 
 		bufferSize += rttiGetElemSize(autoExposure.histogramLog2Min);
 		bufferSize += rttiGetElemSize(autoExposure.histogramLog2Max);
@@ -196,6 +201,10 @@ namespace bs
 		writeDst = rttiWriteElem(exposureScale, writeDst);
 		writeDst = rttiWriteElem(gamma, writeDst);
 		writeDst = rttiWriteElem(enableFXAA, writeDst);
+		writeDst = rttiWriteElem(enableHDR, writeDst);
+		writeDst = rttiWriteElem(enableLighting, writeDst);
+		writeDst = rttiWriteElem(enableShadows, writeDst);
+		writeDst = rttiWriteElem(overlayOnly, writeDst);
 
 		writeDst = rttiWriteElem(autoExposure.histogramLog2Min, writeDst);
 		writeDst = rttiWriteElem(autoExposure.histogramLog2Max, writeDst);
@@ -254,6 +263,10 @@ namespace bs
 		readSource = rttiReadElem(exposureScale, readSource);
 		readSource = rttiReadElem(gamma, readSource);
 		readSource = rttiReadElem(enableFXAA, readSource);
+		readSource = rttiReadElem(enableHDR, readSource);
+		readSource = rttiReadElem(enableLighting, readSource);
+		readSource = rttiReadElem(enableShadows, readSource);
+		readSource = rttiReadElem(overlayOnly, readSource);
 
 		readSource = rttiReadElem(autoExposure.histogramLog2Min, readSource);
 		readSource = rttiReadElem(autoExposure.histogramLog2Max, readSource);

+ 3 - 1
Source/BansheeEditor/Source/BsEditorWindowBase.cpp

@@ -88,7 +88,9 @@ namespace bs
 		mCamera->setNearClipDistance(5);
 		mCamera->setAspectRatio(1.0f);
 		mCamera->setLayers(0);
-		mCamera->setFlag(CameraFlag::Overlay, true);
+
+		SPtr<RenderSettings> settings = mCamera->getRenderSettings();
+		settings->overlayOnly = true;
 
 		mGUI = mSceneObject->addComponent<CGUIWidget>(mCamera);
 		mGUI->setDepth(128);

+ 2 - 1
Source/Examples/ExampleGettingStarted/Source/Main.cpp

@@ -390,7 +390,8 @@ namespace bs
 		HCamera guiCamera = guiSO->addComponent<CCamera>(window);
 
 		// Notify the renderer that the camera will only be used for overlays (e.g. GUI) so it can optimize its usage
-		guiCamera->setFlag(CameraFlag::Overlay, true);
+		SPtr<RenderSettings> settings = guiCamera->getRenderSettings();
+		settings->overlayOnly = true;
 
 		// Set up GUI camera properties. 
 		// We don't care about aspect ratio for GUI camera.

+ 0 - 10
Source/MBansheeEditor/Inspectors/CameraInspector.cs

@@ -31,7 +31,6 @@ namespace BansheeEditor
         private GUIColorField clearColorField = new GUIColorField(new LocEdString("Clear color"));
         private GUIIntField priorityField = new GUIIntField(new LocEdString("Render priority"));
         private GUIListBoxField layersField = new GUIListBoxField(Layers.Names, true, new LocEdString("Layers"));
-        private GUIToggleField hdrField = new GUIToggleField(new LocEdString("HDR"));
         private GUIToggleField mainField = new GUIToggleField(new LocEdString("Main"));
 
         private GUIToggle renderSettingsFoldout = new GUIToggle(new LocEdString("Render settings"), EditorStyles.Foldout);
@@ -76,7 +75,6 @@ namespace BansheeEditor
             clearColorField.Value = camera.ClearColor;
             priorityField.Value = camera.Priority;
             mainField.Value = camera.Main;
-            hdrField.Value = camera.HDR;
             renderSettingsGUI.Settings = camera.RenderSettings;
 
             if (layersValue != camera.Layers)
@@ -223,13 +221,6 @@ namespace BansheeEditor
                     ConfirmModify();
                 };
 
-                hdrField.OnChanged += x =>
-                {
-                    camera.HDR = x;
-                    MarkAsModified();
-                    ConfirmModify();
-                };
-
                 Layout.AddElement(projectionTypeField);
                 Layout.AddElement(fieldOfView);
                 Layout.AddElement(orthoHeight);
@@ -255,7 +246,6 @@ namespace BansheeEditor
                 Layout.AddElement(priorityField);
                 Layout.AddElement(layersField);
                 Layout.AddElement(mainField);
-                Layout.AddElement(hdrField);
 
                 renderSettingsFoldout.OnToggled += x =>
                 {

+ 25 - 0
Source/MBansheeEditor/Inspectors/RenderSettingsInspector.cs

@@ -358,6 +358,11 @@ namespace BansheeEditor
         private RenderSettings settings;
         private SerializableProperties properties;
 
+        private GUIToggleField enableHDRField = new GUIToggleField(new LocEdString("Enable HDR"));
+        private GUIToggleField enableLightingField = new GUIToggleField(new LocEdString("Enable lighting"));
+        private GUIToggleField enableShadowsField = new GUIToggleField(new LocEdString("Enable shadows"));
+        private GUIToggleField overlayOnlyField = new GUIToggleField(new LocEdString("Overlay only"));
+
         private GUIToggleField enableAutoExposureField = new GUIToggleField(new LocEdString("Enable auto exposure"));
         private GUIToggle autoExposureFoldout = new GUIToggle(new LocEdString("Auto exposure"), EditorStyles.Foldout);
         private AutoExposureSettingsGUI autoExposureGUI;
@@ -399,6 +404,10 @@ namespace BansheeEditor
                 colorGradingGUI.Settings = value.ColorGrading;
                 gammaField.Value = value.Gamma;
                 exposureScaleField.Value = value.ExposureScale;
+                enableHDRField.Value = value.EnableHDR;
+                enableLightingField.Value = value.EnableLighting;
+                enableShadowsField.Value = value.EnableShadows;
+                overlayOnlyField.Value = value.OverlayOnly;
             }
         }
 
@@ -414,6 +423,22 @@ namespace BansheeEditor
             this.settings = settings;
             this.properties = properties;
 
+            // Enable HDR
+            enableHDRField.OnChanged += x => { this.settings.EnableHDR = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(enableHDRField);
+
+            // Enable lighting
+            enableLightingField.OnChanged += x => { this.settings.EnableLighting = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(enableLightingField);
+
+            // Enable shadows
+            enableShadowsField.OnChanged += x => { this.settings.EnableShadows = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(enableShadowsField);
+
+            // Overlay only
+            overlayOnlyField.OnChanged += x => { this.settings.OverlayOnly = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(overlayOnlyField);
+
             // Auto exposure
             enableAutoExposureField.OnChanged += x => { this.settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); };
             layout.AddElement(enableAutoExposureField);

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs

@@ -59,7 +59,7 @@ namespace BansheeEditor
             camera.Layers = SceneAxesHandle.LAYER;
             camera.AspectRatio = 1.0f;
             camera.OrthoHeight = 2.0f;
-            camera.HDR = false;
+            camera.RenderSettings.EnableHDR = false;
 
             renderTextureGUI = new GUIRenderTexture(renderTexture, true);
 

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/SceneWindow.cs

@@ -826,7 +826,7 @@ namespace BansheeEditor
                     profilerCamera.ClearFlags = ClearFlags.None;
                     profilerCamera.Priority = 1;
                     profilerCamera.Layers = 0;
-                    profilerCamera.HDR = false;
+                    profilerCamera.RenderSettings.EnableHDR = false;
 
                     activeProfilerOverlay = profilerSO.AddComponent<ProfilerOverlay>();
                 }

+ 0 - 22
Source/MBansheeEngine/Interop/NativeCamera.cs

@@ -125,18 +125,6 @@ namespace BansheeEngine
             set { Internal_SetPriority(mCachedPtr, value); }
         }
 
-        internal bool HDR
-        {
-            get { return Internal_GetHDR(mCachedPtr); }
-            set { Internal_SetHDR(mCachedPtr, value); }
-        }
-
-        internal bool noLighting
-        {
-            get { return Internal_GetNoLighting(mCachedPtr); }
-            set { Internal_SetNoLighting(mCachedPtr, value); }
-        }
-
         internal RenderSettings RenderSettings
         {
             get { return Internal_GetRenderSettings(mCachedPtr); }
@@ -429,16 +417,6 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetPriority(IntPtr instance, int value);
 
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetHDR(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetHDR(IntPtr instance, bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetNoLighting(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetNoLighting(IntPtr instance, bool value);
-
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern RenderSettings Internal_GetRenderSettings(IntPtr instance);
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 0 - 24
Source/MBansheeEngine/Rendering/Camera.cs

@@ -155,28 +155,6 @@ namespace BansheeEngine
             set { native.priority = value; serializableData.priority = value; }
         }
 
-        /// <summary>
-        /// Determines should high dynamic range be enabled. High dynamic range allows light intensity to be more correctly
-        /// recorded when rendering by allowing for a larger range of values. The stored light is then converted into
-        /// visible color range using exposure and a tone mapping operator. Use <see cref="RenderSettings"/> to customize
-        /// those operations.
-        /// </summary>
-        public bool HDR
-        {
-            get { return native.HDR; }
-            set { native.HDR = value; serializableData.HDR = value; }
-        }
-
-        /// <summary>
-        /// If enabled no lighting will be applied to scene objects and everything should be rendered using their
-        /// albedo texture.
-        /// </summary>
-        public bool NoLighting
-        {
-            get { return native.noLighting; }
-            set { native.noLighting = value; serializableData.noLighting = value; }
-        }
-
         /// <summary>
         /// Allows you to customize various post process operations that will be executed on the image produced by this 
         /// camera.
@@ -436,7 +414,6 @@ namespace BansheeEngine
             native.priority = serializableData.priority;
             native.layers = serializableData.layers;
             native.main = serializableData.main;
-            native.noLighting = serializableData.noLighting;
 
             // TODO - Make RenderTexture a resource so I can save/restore it?
         }
@@ -475,7 +452,6 @@ namespace BansheeEngine
             public ClearFlags clearFlags = ClearFlags.Color | ClearFlags.Depth | ClearFlags.Stencil;
             public int priority;
             public bool HDR = true;
-            public bool noLighting;
             public RenderSettings renderSettings;
             public ulong layers = 0xFFFFFFFFFFFFFFFF;
             public bool main;

+ 25 - 0
Source/MBansheeEngine/Rendering/RenderSettings.cs

@@ -234,6 +234,31 @@ namespace BansheeEngine
         /// </summary>
         public float Gamma;
 
+        /// <summary>
+        /// High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger
+        /// range of values. The stored light is then converted into visible color range using exposure and a tone mapping 
+        /// operator.
+        /// </summary>
+        public bool EnableHDR;
+
+        /// <summary>
+        /// Determines if scene objects will be lit by lights. If disabled everything will be rendered using their albedo
+        /// texture with no lighting applied.
+        /// </summary>
+        public bool EnableLighting;
+
+        /// <summary>
+        /// Determines if shadows cast by lights should be rendered. Only relevant if lighting is turned on.
+        /// </summary>
+        public bool EnableShadows;
+
+        /// <summary>
+        /// Signals the renderer to only render overlays (like GUI), and not scene objects. Such rendering doesn't require
+        /// depth buffer or multi-sampled render targets and will not render any scene objects. This can improve performance
+        /// and memory usage for overlay-only views. 
+        /// </summary>
+        public bool OverlayOnly;
+
         /// <summary>
         /// Creates a new instance of render settings with the optimal default values.
         /// </summary>

+ 0 - 4
Source/RenderBeast/Include/BsRendererView.h

@@ -91,10 +91,6 @@ namespace bs { namespace ct
 		float farPlane;
 		ProjectionType projType;
 
-		bool isOverlay : 1;
-		bool isHDR : 1;
-		bool noLighting : 1;
-		bool noShadows : 1;
 		bool triggerCallbacks : 1;
 		bool runPostProcessing : 1;
 		bool renderingReflections : 1;

+ 3 - 2
Source/RenderBeast/Source/BsLightRendering.cpp

@@ -283,6 +283,7 @@ namespace bs { namespace ct
 		const GBufferInput& gbuffer, const SPtr<Texture>& lightAccumTex, const SPtr<GpuBuffer>& lightAccumBuffer)
 	{
 		const RendererViewProperties& viewProps = view.getProperties();
+		const RenderSettings& settings = view.getRenderSettings();
 
 		mLightBufferParam.set(lightData.getLightBuffer());
 
@@ -294,7 +295,7 @@ namespace bs { namespace ct
 		framebufferSize[1] = height;
 		gTiledLightingParamDef.gFramebufferSize.set(mParamBuffer, framebufferSize);
 
-		if (viewProps.noLighting)
+		if (!settings.enableLighting)
 		{
 			Vector4I lightCounts;
 			lightCounts[0] = 0;
@@ -327,7 +328,7 @@ namespace bs { namespace ct
 			lightStrides[0] = lightCounts[0];
 			lightStrides[1] = lightStrides[0] + lightCounts[1];
 
-			if(viewProps.noShadows)
+			if(!settings.enableShadows)
 				gTiledLightingParamDef.gLightCounts.set(mParamBuffer, lightCounts);
 			else
 				gTiledLightingParamDef.gLightCounts.set(mParamBuffer, unshadowedLightCounts);

+ 7 - 5
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -344,8 +344,9 @@ namespace bs { namespace ct
 		for (UINT32 i = 0; i < numViews; i++)
 		{
 			RendererView* view = viewGroup.getView(i);
+			const RenderSettings& settings = view->getRenderSettings();
 
-			if (view->getProperties().isOverlay)
+			if (settings.overlayOnly)
 				renderOverlay(*view);
 			else
 				renderView(viewGroup, *view, frameInfo);
@@ -657,10 +658,6 @@ namespace bs { namespace ct
 		viewDesc.target.targetHeight = texProps.getHeight();
 		viewDesc.target.numSamples = 1;
 
-		viewDesc.isOverlay = false;
-		viewDesc.isHDR = hdr;
-		viewDesc.noLighting = false;
-		viewDesc.noShadows = true; // Note: If I ever change this I need to make sure that shadow map rendering is aware of this view (currently it is only aware of main camera views)
 		viewDesc.triggerCallbacks = false;
 		viewDesc.runPostProcessing = false;
 		viewDesc.renderingReflections = true;
@@ -677,6 +674,10 @@ namespace bs { namespace ct
 		viewDesc.stateReduction = mCoreOptions->stateReductionMode;
 		viewDesc.sceneCamera = nullptr;
 
+		SPtr<RenderSettings> settings = bs_shared_ptr_new<RenderSettings>();
+		settings->enableHDR = hdr;
+		settings->enableShadows = false; // Note: If I ever change this I need to make sure that shadow map rendering is aware of this view (currently it is only aware of main camera views)
+
 		Matrix4 viewOffsetMat = Matrix4::translation(-position);
 
 		RendererView views[6];
@@ -741,6 +742,7 @@ namespace bs { namespace ct
 			viewDesc.target.target = RenderTexture::create(cubeFaceRTDesc);
 
 			views[i].setView(viewDesc);
+			views[i].setRenderSettings(settings);
 			views[i].updatePerViewBuffer();
 		}
 

+ 1 - 1
Source/RenderBeast/Source/BsRenderCompositor.cpp

@@ -1016,7 +1016,7 @@ namespace bs { namespace ct
 		RCNodePostProcess* postProcessNode = static_cast<RCNodePostProcess*>(inputs.inputNodes[2]);
 		SPtr<Texture> sceneColor = sceneColorNode->sceneColorTex->texture;
 
-		bool hdr = viewProps.isHDR;
+		bool hdr = settings.enableHDR;
 		bool msaa = viewProps.numSamples > 1;
 
 		if(hdr && settings.enableAutoExposure)

+ 0 - 4
Source/RenderBeast/Source/BsRendererScene.cpp

@@ -564,10 +564,6 @@ namespace bs {	namespace ct
 
 		viewDesc.target.numSamples = camera->getMSAACount();
 
-		viewDesc.isOverlay = camera->getFlags().isSet(CameraFlag::Overlay);
-		viewDesc.isHDR = camera->getFlags().isSet(CameraFlag::HDR);
-		viewDesc.noLighting = camera->getFlags().isSet(CameraFlag::NoLighting);
-		viewDesc.noShadows = camera->getFlags().isSet(CameraFlag::NoShadows);
 		viewDesc.triggerCallbacks = true;
 		viewDesc.runPostProcessing = true;
 		viewDesc.renderingReflections = false;

+ 7 - 7
Source/RenderBeast/Source/BsRendererView.cpp

@@ -162,7 +162,7 @@ namespace bs { namespace ct
 		mVisibility.renderables.clear();
 		mVisibility.renderables.resize(renderables.size(), false);
 
-		if (mProperties.isOverlay)
+		if (mRenderSettings->overlayOnly)
 			return;
 
 		calculateVisibility(cullInfos, mVisibility.renderables);
@@ -231,7 +231,7 @@ namespace bs { namespace ct
 			perViewVisibility = &mVisibility.spotLights;
 		}
 
-		if (mProperties.isOverlay)
+		if (mRenderSettings->overlayOnly)
 			return;
 
 		calculateVisibility(bounds, *perViewVisibility);
@@ -456,7 +456,7 @@ namespace bs { namespace ct
 
 		gPerCameraParamDef.gClipToUVScaleOffset.set(mParamBuffer, clipToUVScaleOffset);
 
-		if (mProperties.noLighting)
+		if (!mRenderSettings->enableLighting)
 			gPerCameraParamDef.gAmbientFactor.set(mParamBuffer, 100.0f);
 		else
 			gPerCameraParamDef.gAmbientFactor.set(mParamBuffer, 0.0f);
@@ -465,7 +465,7 @@ namespace bs { namespace ct
 	void RendererView::updateLightGrid(const VisibleLightData& visibleLightData, 
 		const VisibleReflProbeData& visibleReflProbeData)
 	{
-		mLightGrid.updateGrid(*this, visibleLightData, visibleReflProbeData, mProperties.noLighting);
+		mLightGrid.updateGrid(*this, visibleLightData, visibleReflProbeData, !mRenderSettings->enableLighting);
 	}
 
 	RendererViewGroup::RendererViewGroup()
@@ -494,7 +494,7 @@ namespace bs { namespace ct
 		bool allViewsOverlay = false;
 		for (UINT32 i = 0; i < numViews; i++)
 		{
-			if (!mViews[i]->getProperties().isOverlay)
+			if (!mViews[i]->getRenderSettings().overlayOnly)
 			{
 				allViewsOverlay = false;
 				break;
@@ -522,7 +522,7 @@ namespace bs { namespace ct
 
 		for (UINT32 i = 0; i < numViews; i++)
 		{
-			if (mViews[i]->getProperties().isOverlay)
+			if (mViews[i]->getRenderSettings().overlayOnly)
 				continue;
 
 			mViews[i]->determineVisible(sceneInfo.radialLights, sceneInfo.radialLightWorldBounds, LightType::Radial,
@@ -559,7 +559,7 @@ namespace bs { namespace ct
 
 		for (UINT32 i = 0; i < numViews; i++)
 		{
-			if (mViews[i]->getProperties().isOverlay)
+			if (mViews[i]->getRenderSettings().overlayOnly)
 				continue;
 
 			mViews[i]->updateLightGrid(mVisibleLightData, mVisibleReflProbeData);

+ 0 - 6
Source/SBansheeEngine/Include/BsScriptCamera.h

@@ -87,12 +87,6 @@ namespace bs
 		static int internal_GetPriority(ScriptCamera* instance);
 		static void internal_SetPriority(ScriptCamera* instance, int value);
 
-		static bool internal_GetHDR(ScriptCamera* instance);
-		static void internal_SetHDR(ScriptCamera* instance, bool value);
-
-		static bool internal_GetNoLighting(ScriptCamera* instance);
-		static void internal_SetNoLighting(ScriptCamera* instance, bool value);
-
 		static MonoObject* internal_GetRenderSettings(ScriptCamera* instance);
 		static void internal_SetRenderSettings(ScriptCamera* instance, MonoObject* value);
 

+ 4 - 0
Source/SBansheeEngine/Include/BsScriptRenderSettings.h

@@ -146,6 +146,10 @@ namespace bs
 		static MonoField* sColorGrading;
 		static MonoField* sExposureScale;
 		static MonoField* sGamma;
+		static MonoField* sEnableHDR;
+		static MonoField* sEnableLighting;
+		static MonoField* sEnableShadows;
+		static MonoField* sOverlayOnly;
 	};
 
 	/** @} */

+ 0 - 26
Source/SBansheeEngine/Source/BsScriptCamera.cpp

@@ -73,12 +73,6 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_GetPriority", &ScriptCamera::internal_GetPriority);
 		metaData.scriptClass->addInternalCall("Internal_SetPriority", &ScriptCamera::internal_SetPriority);
 
-		metaData.scriptClass->addInternalCall("Internal_GetHDR", &ScriptCamera::internal_GetHDR);
-		metaData.scriptClass->addInternalCall("Internal_SetHDR", &ScriptCamera::internal_SetHDR);
-
-		metaData.scriptClass->addInternalCall("Internal_GetNoLighting", &ScriptCamera::internal_GetNoLighting);
-		metaData.scriptClass->addInternalCall("Internal_SetNoLighting", &ScriptCamera::internal_SetNoLighting);
-
 		metaData.scriptClass->addInternalCall("Internal_GetRenderSettings", &ScriptCamera::internal_GetRenderSettings);
 		metaData.scriptClass->addInternalCall("Internal_SetRenderSettings", &ScriptCamera::internal_SetRenderSettings);
 
@@ -294,26 +288,6 @@ namespace bs
 		instance->mCamera->setPriority(value);
 	}
 
-	bool ScriptCamera::internal_GetHDR(ScriptCamera* instance)
-	{
-		return instance->mCamera->getFlags().isSet(CameraFlag::HDR);
-	}
-
-	void ScriptCamera::internal_SetHDR(ScriptCamera* instance, bool value)
-	{
-		instance->mCamera->setFlag(CameraFlag::HDR, value);
-	}
-
-	bool ScriptCamera::internal_GetNoLighting(ScriptCamera* instance)
-	{
-		return instance->mCamera->getFlags().isSet(CameraFlag::NoLighting);
-	}
-
-	void ScriptCamera::internal_SetNoLighting(ScriptCamera* instance, bool value)
-	{
-		instance->mCamera->setFlag(CameraFlag::NoLighting, value);
-	}
-
 	MonoObject* ScriptCamera::internal_GetRenderSettings(ScriptCamera* instance)
 	{
 		SPtr<RenderSettings> settings = instance->mCamera->getRenderSettings();

+ 16 - 0
Source/SBansheeEngine/Source/BsScriptRenderSettings.cpp

@@ -202,6 +202,10 @@ namespace bs
 	MonoField* ScriptRenderSettings::sColorGrading = nullptr;
 	MonoField* ScriptRenderSettings::sExposureScale = nullptr;
 	MonoField* ScriptRenderSettings::sGamma = nullptr;
+	MonoField* ScriptRenderSettings::sEnableHDR = nullptr;
+	MonoField* ScriptRenderSettings::sEnableLighting = nullptr;
+	MonoField* ScriptRenderSettings::sEnableShadows = nullptr;
+	MonoField* ScriptRenderSettings::sOverlayOnly = nullptr;
 
 	ScriptRenderSettings::ScriptRenderSettings(MonoObject* instance)
 		:ScriptObject(instance)
@@ -219,6 +223,10 @@ namespace bs
 		sColorGrading = metaData.scriptClass->getField("ColorGrading");
 		sExposureScale = metaData.scriptClass->getField("ExposureScale");
 		sGamma = metaData.scriptClass->getField("Gamma");
+		sEnableHDR = metaData.scriptClass->getField("EnableHDR");
+		sEnableLighting = metaData.scriptClass->getField("EnableLighting");
+		sEnableShadows = metaData.scriptClass->getField("EnableShadows");
+		sOverlayOnly = metaData.scriptClass->getField("OverlayOnly");
 	}
 
 	SPtr<RenderSettings> ScriptRenderSettings::toNative(MonoObject* object)
@@ -229,6 +237,10 @@ namespace bs
 		sEnableTonemapping->get(object, &output->enableTonemapping);
 		sExposureScale->get(object, &output->exposureScale);
 		sGamma->get(object, &output->gamma);
+		sEnableHDR->get(object, &output->enableHDR);
+		sEnableLighting->get(object, &output->enableLighting);
+		sEnableShadows->get(object, &output->enableShadows);
+		sOverlayOnly->get(object, &output->overlayOnly);
 
 		MonoObject* autoExposureMono;
 		sAutoExposure->get(object, &autoExposureMono);
@@ -257,6 +269,10 @@ namespace bs
 		sEnableTonemapping->set(object, &value->enableTonemapping);
 		sExposureScale->set(object, &value->exposureScale);
 		sGamma->set(object, &value->gamma);
+		sEnableHDR->set(object, &value->enableHDR);
+		sEnableLighting->set(object, &value->enableLighting);
+		sEnableShadows->set(object, &value->enableShadows);
+		sOverlayOnly->set(object, &value->overlayOnly);
 
 		MonoObject* autoExposureMono = ScriptAutoExposureSettings::toManaged(value->autoExposure);
 		sAutoExposure->set(object, autoExposureMono);