Browse Source

Post processing:
- Refactored PostProcessSettings in a plain struct
- Added PostProcessSettings and HDR to Camera (both native and managed)
- Finished PostProcessSettings inspector
- Changing post process settings will now trigger tonemapping LUT rebuild, instead of rebuilding it every frame

Documentation improvements:
- Added descriptions for managed doc groups
- Limited width of the contents in HTML documentation
- Removed characters confusing Doxygen
- Added index/manuals page for managed documentation
- Hidden Interop objects

BearishSun 9 years ago
parent
commit
eb5d33c976
59 changed files with 735 additions and 499 deletions
  1. 0 1
      Build/VS2015/BansheeEngine.vcxproj
  2. 0 3
      Build/VS2015/BansheeEngine.vcxproj.filters
  3. 2 1
      Documentation/Doxygen/Managed.doxyconfig
  4. 5 0
      Documentation/Doxygen/doxystyle.css
  5. 0 2
      Documentation/Doxygen/layout.xml
  6. 0 1
      Documentation/Manuals/Managed/index.md
  7. 126 0
      Documentation/Manuals/Managed/manuals.md
  8. 4 1
      Source/BansheeCore/Include/BsCoreRenderer.h
  9. 3 3
      Source/BansheeCore/Include/BsVertexDataDesc.h
  10. 3 2
      Source/BansheeCore/Include/BsVertexDeclaration.h
  11. 1 1
      Source/BansheeEditor/Source/BsEditorWindowBase.cpp
  12. 17 2
      Source/BansheeEngine/Include/BsCCamera.h
  13. 40 11
      Source/BansheeEngine/Include/BsCamera.h
  14. 12 2
      Source/BansheeEngine/Include/BsCameraRTTI.h
  15. 24 31
      Source/BansheeEngine/Include/BsPostProcessSettings.h
  16. 0 65
      Source/BansheeEngine/Include/BsPostProcessSettingsRTTI.h
  17. 1 2
      Source/BansheeEngine/Include/BsPrerequisites.h
  18. 22 7
      Source/BansheeEngine/Source/BsCamera.cpp
  19. 0 16
      Source/BansheeEngine/Source/BsPostProcessSettings.cpp
  20. 1 1
      Source/BansheeUtility/Include/BsMatrix4.h
  21. 1 1
      Source/BansheeUtility/Include/BsPrerequisitesUtil.h
  22. 1 1
      Source/ExampleProject/Source/Main.cpp
  23. 17 14
      Source/MBansheeEditor/General/Program.cs
  24. 32 0
      Source/MBansheeEditor/Inspectors/CameraInspector.cs
  25. 187 5
      Source/MBansheeEditor/Inspectors/PostProcessSettingsInspector.cs
  26. 2 0
      Source/MBansheeEditor/Tests/UnitTestTypes.cs
  27. 3 2
      Source/MBansheeEditor/Tests/UnitTests.cs
  28. 2 1
      Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs
  29. 1 0
      Source/MBansheeEditor/Windows/Scene/SceneWindow.cs
  30. 27 0
      Source/MBansheeEngine/Interop/NativeCamera.cs
  31. 2 0
      Source/MBansheeEngine/Interop/NativeGUIWidget.cs
  32. 13 10
      Source/MBansheeEngine/Interop/Program.cs
  33. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeBoxCollider.cs
  34. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeCapsuleCollider.cs
  35. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeCharacterController.cs
  36. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeCollider.cs
  37. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeD6Joint.cs
  38. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeDistanceJoint.cs
  39. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeFixedJoint.cs
  40. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeHingeJoint.cs
  41. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeJoint.cs
  42. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeMeshCollider.cs
  43. 2 0
      Source/MBansheeEngine/Physics/Interop/NativePlaneCollider.cs
  44. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeRigidbody.cs
  45. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeSliderJoint.cs
  46. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeSphereCollider.cs
  47. 2 0
      Source/MBansheeEngine/Physics/Interop/NativeSphericalJoint.cs
  48. 29 0
      Source/MBansheeEngine/Rendering/Camera.cs
  49. 40 132
      Source/MBansheeEngine/Rendering/PostProcessSettings.cs
  50. 8 7
      Source/MBansheeEngine/Utility/PixelData.cs
  51. 2 1
      Source/RenderBeast/Include/BsPostProcessing.h
  52. 5 5
      Source/RenderBeast/Include/BsRenderBeast.h
  53. 0 13
      Source/RenderBeast/Include/BsRenderBeastOptions.h
  54. 13 8
      Source/RenderBeast/Source/BsPostProcessing.cpp
  55. 20 12
      Source/RenderBeast/Source/BsRenderBeast.cpp
  56. 7 0
      Source/SBansheeEngine/Include/BsScriptCamera.h
  57. 1 27
      Source/SBansheeEngine/Include/BsScriptPostProcessSettings.h
  58. 26 0
      Source/SBansheeEngine/Source/BsScriptCamera.cpp
  59. 5 108
      Source/SBansheeEngine/Source/BsScriptPostProcessSettings.cpp

+ 0 - 1
Build/VS2015/BansheeEngine.vcxproj

@@ -320,7 +320,6 @@
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPlainTextImporter.h" />
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPlainTextRTTI.h" />
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPostProcessSettings.h" />
-    <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPostProcessSettingsRTTI.h" />
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsRenderableElement.h" />
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsRenderable.h" />
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsRenderableRTTI.h" />

+ 0 - 3
Build/VS2015/BansheeEngine.vcxproj.filters

@@ -413,9 +413,6 @@
     <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPostProcessSettings.h">
       <Filter>Header Files\Renderer</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\Source\BansheeEngine\Include\BsPostProcessSettingsRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\Source\BansheeEngine\Source\BsGUIElement.cpp">

+ 2 - 1
Documentation/Doxygen/Managed.doxyconfig

@@ -776,7 +776,8 @@ WARN_LOGFILE           =
 # Note: If this tag is empty the current directory is searched.
 
 INPUT                  = ../../Source/MBansheeEngine \
-                         ../../Source/MBansheeEditor
+                         ../../Source/MBansheeEditor \
+                         ../Manuals/Managed
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

+ 5 - 0
Documentation/Doxygen/doxystyle.css

@@ -24,6 +24,11 @@ h3 {
 	border-bottom: 1px dashed #CD8512;
 }
 
+div.contents {
+	margin: auto;
+	width: 960px;
+}
+
 .textblock {
 	padding-bottom: 25px;
 }

+ 0 - 2
Documentation/Doxygen/layout.xml

@@ -10,8 +10,6 @@
     <tab type="classlist" visible="true"
                             title="Class list"
                             intro="A complete list of all classes."/>
-    <tab type="pages" visible="yes" title="Manual" intro=""/>
-
 
     <!-- We don't use what's below -->
     <tab type="namespaces" visible="no" title="">

+ 0 - 1
Documentation/Manuals/Managed/index.md

@@ -1,6 +1,5 @@
 Banshee Engine Documentation (Managed)						{#mainpage}
 ===============
-
 [TOC]
 
 Welcome to the documentation for the managed (C#) API of the Banshee Engine.

+ 126 - 0
Documentation/Manuals/Managed/manuals.md

@@ -0,0 +1,126 @@
+Manuals									{#manuals}
+===============
+[TOC]
+
+**Manuals for the C# API are a work in progress while the API is still in flux. They will be available in version 1.0!**
+
+ - Getting started
+  - Creating a project
+  - Importing resources
+  - Adding objects to scene
+  - Adding components
+  - Custom scripts
+  - Playing the game
+  - Building the game
+ - Windows
+  - Overview
+  - Project
+  - Library
+  - Inspector
+  - Scene
+  - Hierarchy
+  - Game
+  - Log
+ - Resources
+  - Importing resources
+  - Import options
+ - Level creation
+  - Scene object
+  - Scene tools
+  - Components
+  - Prefab
+  - Saving scene
+ - Graphics
+  - Camera
+  - Light
+  - Renderable
+  - Shader
+  - Material
+  - Mesh
+  - Texture
+ - Physics
+  - Colliders
+  - Triggers
+  - Rigidbody
+  - Character controller
+  - Physics mesh
+  - Physics material
+  - Joints
+ - GUI
+  - Font
+  - GUISkin
+  - GUIWidget
+  - Localization
+ - Building/publishing your game
+ - Editor settings
+ - Scripting
+  - ScriptCode
+  - Custom components
+  - Log window
+  - Inspector
+  - Playing in editor
+  - Scene loading
+  - Prefabs
+  - Graphics
+   - Camera
+   - Render targets
+   - Renderable
+   - Light
+   - Texture
+    - PixelUtility
+   - Mesh
+   - Material
+   - Shader
+  - Input
+   - Raw input
+   - Virtual input
+   - Input configuration
+  - GUI
+   - Global GUI
+   - GUI widgets
+   - GUI panel
+   - GUI layout
+   - GUI elements
+   - GUI skin
+   - Localization (StringTable)
+   - Font
+  - Physics
+   - Colliders
+   - Triggers
+   - Rigidbody
+   - Character controller
+   - Physics mesh
+   - Physics material
+   - Joints
+   - Scene queries
+   - Global options
+  - Resources
+   - General
+   - Creating custom resources
+  - Shaders
+   - Simple shader example
+   - BSLFX syntax
+  - Utility
+   - Time
+   - Logging
+   - Math
+   - Cursor
+  - Editor
+   - Creating custom editor windows
+   - Creating custom inspectors
+   - Creating custom gizmos
+   - Creating custom handles
+   - Editor GUI elements
+   - ProjectLibrary
+   - Attributes
+   - Undo/Redo
+   - Selection
+   - Editor input
+   - Drag and drop
+   - Serialization
+    - General
+    - Serialized properties
+   - Helper windows
+    - Dialog box
+    - Progress bar
+    - Color picker

+ 4 - 1
Source/BansheeCore/Include/BsCoreRenderer.h

@@ -77,9 +77,12 @@ namespace BansheeEngine
 		/**
 		 * Called whenever a camera's position or rotation is updated.
 		 *
+		 * @param[in]	camera		Camera that was updated.
+		 * @param[in]	updateFlag	Optional flag that allows the camera to signal to the renderer exactly what was updated.
+		 *
 		 * @note	Core thread.
 		 */
-		virtual void notifyCameraUpdated(const CameraCore* camera, const Vector3& position, const Quaternion& rotation) { }
+		virtual void notifyCameraUpdated(const CameraCore* camera, UINT32 updateFlag) { }
 
 		/**
 		 * Called whenever a camera is destroyed.

+ 3 - 3
Source/BansheeCore/Include/BsVertexDataDesc.h

@@ -33,9 +33,9 @@ namespace BansheeEngine
 		 * @param[in]	instanceStepRate	Determines at what rate does vertex element data advance. Zero means each vertex
 		 *									will advance the data pointer and receive new data (standard behaviour). Values
 		 *									larger than one are relevant for instanced rendering and determine how often do
-		 *									instances advance the vertex element (e.g. a value of 1 means each instance will
-		 *									retrieve a new value for this vertex element, a value of 2 means each second
-		 *									instance will, etc.).
+		 *									instances advance the vertex element (for example a value of 1 means each
+		 *									instance will retrieve a new value for this vertex element, a value of 2 means
+		 *									each second instance will, etc.).
 		 */
 		void addVertElem(VertexElementType type, VertexElementSemantic semantic, UINT32 semanticIdx = 0, 
 			UINT32 streamIdx = 0, UINT32 instanceStepRate = 0);

+ 3 - 2
Source/BansheeCore/Include/BsVertexDeclaration.h

@@ -84,8 +84,9 @@ namespace BansheeEngine
 		/** 
 		 * Returns at what rate do the vertex elements advance during instanced rendering. Provide zero for default 
 		 * behaviour where each vertex receives the next value from the vertex buffer. Provide a value larger than zero
-		 * to ensure vertex data is advanced with every instance, instead of every vertex (e.g. a value of 1 means each
-		 * instance will retrieve a new value from the vertex buffer, a value of 2 means each second instance will, etc.).
+		 * to ensure vertex data is advanced with every instance, instead of every vertex (for example a value of 1 means
+		 * each instance will retrieve a new value from the vertex buffer, a value of 2 means each second instance will, 
+		 * etc.).
 		 */
 		UINT32 getInstanceStepRate() const { return mInstanceStepRate; }
 

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

@@ -88,7 +88,7 @@ namespace BansheeEngine
 		mCamera->setNearClipDistance(5);
 		mCamera->setAspectRatio(1.0f);
 		mCamera->setLayers(0);
-		mCamera->setFlags(CameraFlags::Overlay);
+		mCamera->setFlag(CameraFlag::Overlay, true);
 
 		mGUI = mSceneObject->addComponent<CGUIWidget>(mCamera);
 		mGUI->setDepth(128);

+ 17 - 2
Source/BansheeEngine/Include/BsCCamera.h

@@ -136,11 +136,26 @@ namespace BansheeEngine
 		/** @copydoc Camera::setLayers */
 		void setLayers(UINT64 layers) { mInternal->setLayers(layers); }
 
+		/** Returns number of samples if the camera uses multiple samples per pixel. */
+		UINT32 getMSAACount() const { return mInternal->getMSAACount(); }
+
+		/**
+		* Enables or disables multi-sampled anti-aliasing. Set to zero or one to disable, or to the required number of
+		* samples to enable.
+		*/
+		void setMSAACount(UINT32 count) { mInternal->setMSAACount(count); }
+
+		/** Returns settings that are used for controling post-process operations like tonemapping. */
+		const PostProcessSettings& getPostProcessSettings() const { return mInternal->getPostProcessSettings(); }
+
+		/** Sets settings that are used for controling post-process operations like tonemapping. */
+		void setPostProcessSettings(const PostProcessSettings& settings) { mInternal->setPostProcessSettings(settings); }
+
 		/** @copydoc Camera::getFlags */
 		CameraFlags getFlags() const { return mInternal->getFlags(); }
 
-		/** @copydoc Camera::setFlags */
-		void setFlags(const CameraFlags& flags) { mInternal->setFlags(flags); }
+		/** @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); }

+ 40 - 11
Source/BansheeEngine/Include/BsCamera.h

@@ -13,6 +13,7 @@
 #include "BsRay.h"
 #include "BsCoreObject.h"
 #include "BsConvexVolume.h"
+#include "BsPostProcessSettings.h"
 
 namespace BansheeEngine 
 {
@@ -23,8 +24,9 @@ namespace BansheeEngine
 	/**	Signals which portion of a Camera is dirty. */
 	enum class CameraDirtyFlag
 	{
-		Transform = 0x01,
-		Everything = 0x02
+		Transform = 1<<0,
+		Everything = 1<<1,
+		PostProcess = 1<<2
 	};
 
 	/**	Projection type to use by the camera. */
@@ -46,15 +48,24 @@ namespace BansheeEngine
     };
 
 	/**	Flags that describe a camera. */
-	enum class CameraFlags
+	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. This can improve performance and memory usage. 
 		 */
-		Overlay = 1
+		Overlay = 1,
+		/** 
+		 * 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 = 2
 	};
 
+	typedef Flags<CameraFlag> CameraFlags;
+	BS_FLAGS_OPERATORS(CameraFlag);
+
 	/** @} */
 	/** @addtogroup Implementation
 	 *  @{
@@ -297,11 +308,26 @@ namespace BansheeEngine
 		/**	Sets layer bitfield that is used when determining which object should the camera render. */
 		void setLayers(UINT64 layers) { mLayers = layers; _markCoreDirty(); }
 
+		/** Returns number of samples if the camera uses multiple samples per pixel. */
+		UINT32 getMSAACount() const { return mMSAA; }
+
+		/** 
+		 * Enables or disables multi-sampled anti-aliasing. Set to zero or one to disable, or to the required number of
+		 * samples to enable.
+		 */
+		void setMSAACount(UINT32 count) { mMSAA = count; _markCoreDirty(); }
+
+		/** Returns settings that are used for controling post-process operations like tonemapping. */
+		const PostProcessSettings& getPostProcessSettings() const { return mPPSettings; }
+
+		/** Sets settings that are used for controling post-process operations like tonemapping. */
+		void setPostProcessSettings(const PostProcessSettings& settings) { mPPSettings = settings; _markCoreDirty(CameraDirtyFlag::PostProcess); }
+
 		/**	Retrieves flags that define the camera. */
-		CameraFlags getFlags() const { return (CameraFlags)mCameraFlags; }
+		CameraFlags getFlags() const { return mCameraFlags; }
 
-		/**	Sets flags that define the camera's behaviour. */
-		void setFlags(const CameraFlags& flags) { mCameraFlags = (UINT32)flags; _markCoreDirty(); }
+		/**	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
@@ -431,7 +457,7 @@ namespace BansheeEngine
 
     protected:
 		UINT64 mLayers; /**< Bitfield that can be used for filtering what objects the camera sees. */
-		UINT32 mCameraFlags; /**< Flags that further determine type of camera. */
+		CameraFlags mCameraFlags; /**< Flags that further determine type of camera. */
 
 		Vector3 mPosition; /**< World space position. */
 		Quaternion mRotation; /**< World space rotation. */
@@ -447,6 +473,9 @@ namespace BansheeEngine
 
 		bool mCustomViewMatrix; /**< Is custom view matrix set. */
 		bool mCustomProjMatrix; /**< Is custom projection matrix set. */
+		UINT8 mMSAA; /**< Number of samples to render the scene with. */
+
+		PostProcessSettings mPPSettings; /**< Settings used to control post-process operations. */
 
 		bool mFrustumExtentsManuallySet; /**< Are frustum extents manually set. */
 
@@ -458,9 +487,9 @@ namespace BansheeEngine
 		mutable Matrix4 mViewMatrixInv;
 
 		mutable ConvexVolume mFrustum; /**< Main clipping planes describing cameras visible area. */
-		mutable bool mRecalcFrustum; /**< Should frustum be recalculated. */
-		mutable bool mRecalcFrustumPlanes; /**< Should frustum planes be recalculated. */
-		mutable bool mRecalcView; /**< Should view matrix be recalculated. */
+		mutable bool mRecalcFrustum : 1; /**< Should frustum be recalculated. */
+		mutable bool mRecalcFrustumPlanes : 1; /**< Should frustum planes be recalculated. */
+		mutable bool mRecalcView : 1; /**< Should view matrix be recalculated. */
 		mutable float mLeft, mRight, mTop, mBottom; /**< Frustum extents. */
 		mutable AABox mBoundingBox; /**< Frustum bounding box. */
      };

+ 12 - 2
Source/BansheeEngine/Include/BsCameraRTTI.h

@@ -22,8 +22,14 @@ namespace BansheeEngine
 		UINT64& getLayers(Camera* obj) { return obj->mLayers; }
 		void setLayers(Camera* obj, UINT64& val) { obj->mLayers = val; }
 
-		UINT32& getFlags(Camera* obj) { return obj->mCameraFlags; }
-		void setFlags(Camera* obj, UINT32& val) { obj->mCameraFlags = val; }
+		UINT8& getMSAACount(Camera* obj) { return obj->mMSAA; }
+		void setMSAACount(Camera* obj, UINT8& msaaCount) { obj->mMSAA = msaaCount; }
+
+		PostProcessSettings& getPostProcessSettings(Camera* obj) { return obj->mPPSettings; }
+		void setPostProcessSettings(Camera* obj, PostProcessSettings& settings) { obj->mPPSettings = settings; }
+
+		CameraFlags& getFlags(Camera* obj) { return obj->mCameraFlags; }
+		void setFlags(Camera* obj, CameraFlags& val) { obj->mCameraFlags = val; }
 
 		Vector3& getPosition(Camera* obj) { return obj->mPosition; }
 		void setPosition(Camera* obj, Vector3& val) { obj->mPosition = val; }
@@ -107,6 +113,8 @@ namespace BansheeEngine
 			addPlainField("mTop", 20, &CameraRTTI::getTop, &CameraRTTI::setTop);
 			addPlainField("mBottom", 21, &CameraRTTI::getBottom, &CameraRTTI::setBottom);
 			addPlainField("mFlags", 22, &CameraRTTI::getFlags, &CameraRTTI::setFlags);
+			addPlainField("mMSAA", 23, &CameraRTTI::getMSAACount, &CameraRTTI::setMSAACount);
+			addPlainField("mPPSettings", 24, &CameraRTTI::getPostProcessSettings, &CameraRTTI::setPostProcessSettings);
 		}
 
 		void onDeserializationEnded(IReflectable* obj) override
@@ -134,6 +142,8 @@ namespace BansheeEngine
 		}
 	};
 
+	BS_ALLOW_MEMCPY_SERIALIZATION(CameraFlags);
+
 	/** @} */
 	/** @endcond */
 }

+ 24 - 31
Source/BansheeEngine/Include/BsPostProcessSettings.h

@@ -3,7 +3,6 @@
 #pragma once
 
 #include "BsPrerequisites.h"
-#include "BsIReflectable.h"
 #include "BsVector3.h"
 
 namespace BansheeEngine
@@ -13,7 +12,7 @@ namespace BansheeEngine
 	 */
 
 	/** Settings that control automatic exposure (eye adaptation) post-process. */
-	struct AutoExposureSettings
+	struct BS_EXPORT AutoExposureSettings
 	{
 		AutoExposureSettings();
 
@@ -35,8 +34,8 @@ namespace BansheeEngine
 		 * Percentage below which to ignore values in the eye adaptation histogram. The histogram is used for calculating
 		 * the average brightness of the scene. Total luminance in the histogram will be summed up and multiplied by this
 		 * value to calculate minimal luminance. Luminance values below the minimal luminance will be ignored and not used
-		 * in scene brightness calculations. This allows you to remove outliers on the lower end of the histogram (e.g. a
-		 * few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
+		 * in scene brightness calculations. This allows you to remove outliers on the lower end of the histogram (for
+		 * example a few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
 		 */
 		float histogramPctLow;
 
@@ -44,22 +43,22 @@ namespace BansheeEngine
 		 * Percentage above which to ignore values in the eye adaptation histogram. The histogram is used for calculating
 		 * the average brightness of the scene. Total luminance in the histogram will be summed up and multiplied by this
 		 * value to calculate maximum luminance. Luminance values above the maximum luminance will be ignored and not used
-		 * in scene brightness calculations. This allows you to remove outliers on the high end of the histogram (e.g. a few
-		 * very bright pixels). In range [0.0f, 1.0f].
+		 * in scene brightness calculations. This allows you to remove outliers on the high end of the histogram (for 
+		 * example a few very bright pixels). In range [0.0f, 1.0f].
 		 */
 		float histogramPctHigh;
 
 		/**
 		 * Clamps the minimum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
-		 * is never too high (e.g. when in a very dark room you probably do not want the exposure to be so high that
+		 * is never too high (for example when in a very dark room you probably do not want the exposure to be so high that
 		 * everything is still visible). In range [0.0f, 10.0f].
 		 */
 		float minEyeAdaptation;
 
 		/**
 		 * Clamps the maximum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
-		 * is never too low (e.g. when looking at a very bright light source you probably don't want the exposure to be so
-		 * low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
+		 * is never too low (for example when looking at a very bright light source you probably don't want the exposure to
+		 * be so low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
 		 */
 		float maxEyeAdaptation;
 
@@ -77,7 +76,7 @@ namespace BansheeEngine
 	};
 
 	/** Settings that control tonemap post-process. */
-	struct TonemappingSettings
+	struct BS_EXPORT TonemappingSettings
 	{
 		TonemappingSettings();
 
@@ -116,7 +115,7 @@ namespace BansheeEngine
 	};
 
 	/** Settings that control white balance post-process. */
-	struct WhiteBalanceSettings
+	struct BS_EXPORT WhiteBalanceSettings
 	{
 		WhiteBalanceSettings();
 
@@ -130,7 +129,7 @@ namespace BansheeEngine
 		/**
 		 * Additional tint to be applied during white balancing. Can be used to further tweak the white balancing effect by
 		 * modifying the tint of the light. The tint is chosen on the Planckian locus isothermal, depending on the light
-		 * temperature specified by ::temperature.
+		 * temperature specified by #temperature.
 		 *
 		 * In range [-1.0f, 1.0f].
 		 */
@@ -138,7 +137,7 @@ namespace BansheeEngine
 	};
 
 	/** Settings that control color grading post-process. */
-	struct ColorGradingSettings
+	struct BS_EXPORT ColorGradingSettings
 	{
 		ColorGradingSettings();
 
@@ -168,15 +167,15 @@ namespace BansheeEngine
 	};
 
 	/** Settings that control the post-process operations. */
-	struct BS_EXPORT PostProcessSettings : IReflectable
+	struct BS_EXPORT PostProcessSettings
 	{
 		PostProcessSettings();
 
 		/**
 		 * Determines should automatic exposure be applied to the HDR image. When turned on the average scene brightness
 		 * will be calculated and used to automatically expose the image to the optimal range. Use the parameters provided
-		 * by ::autoExposure to customize the automatic exposure effect. You may also use ::exposureScale to
-		 * manually adjust the automatic exposure. When automatic exposure is turned off you can use ::exposureScale to
+		 * by autoExposure to customize the automatic exposure effect. You may also use exposureScale to
+		 * manually adjust the automatic exposure. When automatic exposure is turned off you can use exposureScale to
 		 * manually set the exposure.
 		 */
 		bool enableAutoExposure;
@@ -193,7 +192,7 @@ namespace BansheeEngine
 		 * a filmic curve to the image, simulating the effect of film cameras. Filmic curve improves image quality by
 		 * tapering off lows and highs, preventing under- and over-exposure. This is useful if an image contains both
 		 * very dark and very bright areas, in which case the global exposure parameter would leave some areas either over-
-		 * or under-exposed. Use ::tonemapping to customize how tonemapping performed.
+		 * or under-exposed. Use #tonemapping to customize how tonemapping performed.
 		 *
 		 * If this is disabled, then color grading and white balancing will not be enabled either. Only relevant for HDR
 		 * images.
@@ -218,8 +217,8 @@ namespace BansheeEngine
 		ColorGradingSettings colorGrading;
 
 		/**
-		 * Log2 value to scale the eye adaptation by (e.g. 2^0 = 1). Smaller values yield darker image, while larger yield
-		 * brighter image. Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
+		 * Log2 value to scale the eye adaptation by (for example 2^0 = 1). Smaller values yield darker image, while larger
+		 * yield brighter image. Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
 		 * enabled). In range [-8, 8].
 		 */
 		float exposureScale;
@@ -230,19 +229,13 @@ namespace BansheeEngine
 		 * that curve. If tonemapping is turned off this is the exact value of the gamma curve that will be applied.
 		 */
 		float gamma;
-
-		/** Creates a new post process settings object. */
-		static SPtr<PostProcessSettings> create();
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class PostProcessSettingsRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
 	};
 
 	/** @} */
+
+	BS_ALLOW_MEMCPY_SERIALIZATION(AutoExposureSettings);
+	BS_ALLOW_MEMCPY_SERIALIZATION(WhiteBalanceSettings);
+	BS_ALLOW_MEMCPY_SERIALIZATION(ColorGradingSettings);
+	BS_ALLOW_MEMCPY_SERIALIZATION(TonemappingSettings);
+	BS_ALLOW_MEMCPY_SERIALIZATION(PostProcessSettings);
 }

+ 0 - 65
Source/BansheeEngine/Include/BsPostProcessSettingsRTTI.h

@@ -1,65 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsPostProcessSettings.h"
-
-namespace BansheeEngine
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT PostProcessSettingsRTTI : public RTTIType <PostProcessSettings, IReflectable, PostProcessSettingsRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(enableAutoExposure);
-		BS_PLAIN_MEMBER(autoExposure);
-		BS_PLAIN_MEMBER(enableTonemapping);
-		BS_PLAIN_MEMBER(tonemapping);
-		BS_PLAIN_MEMBER(whiteBalance);
-		BS_PLAIN_MEMBER(colorGrading);
-		BS_PLAIN_MEMBER(exposureScale);
-		BS_PLAIN_MEMBER(gamma);
-
-	public:
-		PostProcessSettingsRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(enableAutoExposure, 0);
-			BS_ADD_PLAIN_FIELD(autoExposure, 1);
-			BS_ADD_PLAIN_FIELD(enableTonemapping, 2);
-			BS_ADD_PLAIN_FIELD(tonemapping, 3);
-			BS_ADD_PLAIN_FIELD(whiteBalance, 4);
-			BS_ADD_PLAIN_FIELD(colorGrading, 5);
-			BS_ADD_PLAIN_FIELD(exposureScale, 6);
-			BS_ADD_PLAIN_FIELD(gamma, 7);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "PostProcessSettings";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_PostProcessSettings;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return PostProcessSettings::create();
-		}
-	};
-
-	BS_ALLOW_MEMCPY_SERIALIZATION(AutoExposureSettings);
-	BS_ALLOW_MEMCPY_SERIALIZATION(WhiteBalanceSettings);
-	BS_ALLOW_MEMCPY_SERIALIZATION(ColorGradingSettings);
-	BS_ALLOW_MEMCPY_SERIALIZATION(TonemappingSettings);
-
-	/** @} */
-	/** @endcond */
-}

+ 1 - 2
Source/BansheeEngine/Include/BsPrerequisites.h

@@ -220,7 +220,6 @@ namespace BansheeEngine
 		TID_Light = 30011,
 		TID_CLight = 30012,
 		TID_GameSettings = 30013,
-		TID_ResourceMapping = 30014,
-		TID_PostProcessSettings = 30015
+		TID_ResourceMapping = 30014
 	};
 }

+ 22 - 7
Source/BansheeEngine/Source/BsCamera.cpp

@@ -10,7 +10,6 @@
 #include "BsException.h"
 #include "BsRenderAPI.h"
 #include "BsSceneObject.h"
-#include "BsDebug.h"
 #include "BsRendererManager.h"
 #include "BsCoreRenderer.h"
 #include "BsFrameAlloc.h"
@@ -20,10 +19,10 @@ namespace BansheeEngine
 	const float CameraBase::INFINITE_FAR_PLANE_ADJUST = 0.00001f;
 
 	CameraBase::CameraBase()
-		: mLayers(0xFFFFFFFFFFFFFFFF), mCameraFlags(0), 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), mFrustumExtentsManuallySet(false), mRecalcFrustum(true)
-		, mRecalcFrustumPlanes(true), mRecalcView(true)
+		: mLayers(0xFFFFFFFFFFFFFFFF), mCameraFlags(CameraFlag::HDR), 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)
+		, mRecalcFrustum(true), mRecalcFrustumPlanes(true), mRecalcView(true)
 	{
 		mViewMatrix = Matrix4::ZERO;
 		mProjMatrixRS = Matrix4::ZERO;
@@ -502,6 +501,16 @@ namespace BansheeEngine
 		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;
@@ -718,9 +727,9 @@ namespace BansheeEngine
 		mRecalcFrustumPlanes = true;
 		mRecalcView = true;
 
-		if (dirtyFlag == CameraDirtyFlag::Transform)
+		if (dirtyFlag == CameraDirtyFlag::Transform || dirtyFlag == CameraDirtyFlag::PostProcess)
 		{
-			RendererManager::instance().getActive()->notifyCameraUpdated(this, mPosition, mRotation);
+			RendererManager::instance().getActive()->notifyCameraUpdated(this, (UINT32)dirtyFlag);
 		}
 		else 
 		{
@@ -737,6 +746,8 @@ namespace BansheeEngine
 			dataPtr = rttiReadElem(mFrustumExtentsManuallySet, dataPtr);
 			dataPtr = rttiReadElem(mCameraFlags, dataPtr);
 			dataPtr = rttiReadElem(mIsActive, dataPtr);
+			dataPtr = rttiReadElem(mMSAA, dataPtr);
+			dataPtr = rttiReadElem(mPPSettings, dataPtr);
 
 			RendererManager::instance().getActive()->notifyCameraRemoved(this);
 
@@ -816,6 +827,8 @@ namespace BansheeEngine
 			size += rttiGetElemSize(mFrustumExtentsManuallySet);
 			size += rttiGetElemSize(mCameraFlags);
 			size += rttiGetElemSize(mIsActive);
+			size += rttiGetElemSize(mMSAA);
+			size += rttiGetElemSize(mPPSettings);
 		}
 
 		UINT8* buffer = allocator->alloc(size);
@@ -840,6 +853,8 @@ namespace BansheeEngine
 			dataPtr = rttiWriteElem(mFrustumExtentsManuallySet, dataPtr);
 			dataPtr = rttiWriteElem(mCameraFlags, dataPtr);
 			dataPtr = rttiWriteElem(mIsActive, dataPtr);
+			dataPtr = rttiWriteElem(mMSAA, dataPtr);
+			dataPtr = rttiWriteElem(mPPSettings, dataPtr);
 		}
 
 		return CoreSyncData(buffer, size);

+ 0 - 16
Source/BansheeEngine/Source/BsPostProcessSettings.cpp

@@ -1,7 +1,6 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsPostProcessSettings.h"
-#include "BsPostProcessSettingsRTTI.h"
 
 namespace BansheeEngine
 {
@@ -27,19 +26,4 @@ namespace BansheeEngine
 	PostProcessSettings::PostProcessSettings()
 		: enableAutoExposure(true), enableTonemapping(true), exposureScale(0.0f), gamma(2.2f)
 	{ }
-
-	SPtr<PostProcessSettings> PostProcessSettings::create()
-	{
-		return bs_shared_ptr_new<PostProcessSettings>();
-	}
-
-	RTTITypeBase* PostProcessSettings::getRTTIStatic()
-	{
-		return PostProcessSettingsRTTI::instance();
-	}
-
-	RTTITypeBase* PostProcessSettings::getRTTI() const
-	{
-		return PostProcessSettings::getRTTIStatic();
-	}
 }

+ 1 - 1
Source/BansheeUtility/Include/BsMatrix4.h

@@ -292,7 +292,7 @@ namespace BansheeEngine
         /**
 		 * Check whether or not the matrix is affine matrix.
 		 *
-		 * @note	An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), i.e. no projective coefficients.
+		 * @note	An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), meaning no projective coefficients.
          */
         bool isAffine() const
         {

+ 1 - 1
Source/BansheeUtility/Include/BsPrerequisitesUtil.h

@@ -103,7 +103,7 @@
  */
 
 /** @defgroup Serialization-Internal Serialization
-*  Serialization and deserialization of native objects.
+ *  Serialization and deserialization of native objects.
  */
 
 /** @defgroup String-Internal String

+ 1 - 1
Source/ExampleProject/Source/Main.cpp

@@ -295,7 +295,7 @@ namespace BansheeEngine
 		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->setFlags(CameraFlags::Overlay);
+		guiCamera->setFlag(CameraFlag::Overlay, true);
 
 		// Set up GUI camera properties. 
 		// We don't care about aspect ratio for GUI camera.

+ 17 - 14
Source/MBansheeEditor/General/Program.cs

@@ -6,73 +6,76 @@ using BansheeEngine;
 namespace BansheeEditor
 {
     /** @addtogroup BansheeEditor
+     *  Scripting API available in editor only, mainly used for extending the editor in various ways.
      *  @{
      */
 
     /** @defgroup GUI-Editor GUI 
-     *
+     *  Editor specific GUI elements.
      */
 
     /** @defgroup Input-Editor Input 
-     *
+     *  %Input handling for editor only (not affected by game pauses).
      */
 
     /** @defgroup General General 
-     *
+     *  Various functionality that doesn't fit into any other category.
      */
 
     /** @defgroup Inspectors Inspectors 
-     *
+     *  Implementations of inspectors for various engine types.
      */
 
     /** @defgroup Script Script 
-     *
+     *  Script code management and compilation.
      */
 
     /** @defgroup Tests Tests 
-     *
+     *  Editor only unit tests
      */
 
     /** @defgroup Utility-Editor Utility 
-     *
+     *  Various utility functionality.
      */
 
     /** @defgroup Window Window 
-     *
+     *  Interface and tools for creating custom editor windows.
      */
 
     /** @defgroup Windows Windows 
+     *  Implementations of various editor windows (for example Scene, Game, Library).
      *  @{
      */
 
     /** @defgroup Build Build 
-     *
+     *  Build editor window and build manager.
      */
 
     /** @defgroup Inspector Inspector 
-     *
+     *  Interface and utilities needed for implementing custom inspectors.
      */
 
     /** @defgroup Library Library 
-     *
+     *  Managment of resources in the project (loading, saving, creating, querying, etc.).
      */
 
     /** @defgroup Scene-Editor Scene 
+     *  Scene editor window and related functionality.
      *  @{
      */
 
     /** @defgroup Gizmos Gizmos 
-     *
+     *  Interface for creating custom gizmos.
      */
 
     /** @defgroup Handles Handles 
-     *
+     *  Interface for creating custom handles (2D/3D tools).
      */
 
     /** @} */
 
     /** @defgroup Settings Settings 
-     *
+     *  Editor and project settings, and related window.
      */
 
     /** @} */

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

@@ -31,8 +31,13 @@ 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 postProcessFoldout = new GUIToggle(new LocEdString("Post processing"), EditorStyles.Foldout);
+        private PostProcessSettingsGUI postProcessGUI;
+        private GUILayout postProcessLayout;
+
         private ulong layersValue = 0;
         private InspectableState modifyState;
 
@@ -71,6 +76,8 @@ namespace BansheeEditor
             clearColorField.Value = camera.ClearColor;
             priorityField.Value = camera.Priority;
             mainField.Value = camera.Main;
+            hdrField.Value = camera.HDR;
+            postProcessGUI.Settings = camera.PostProcess;
 
             if (layersValue != camera.Layers)
             {
@@ -216,6 +223,13 @@ namespace BansheeEditor
                     ConfirmModify();
                 };
 
+                hdrField.OnChanged += x =>
+                {
+                    camera.HDR = x;
+                    MarkAsModified();
+                    ConfirmModify();
+                };
+
                 Layout.AddElement(projectionTypeField);
                 Layout.AddElement(fieldOfView);
                 Layout.AddElement(orthoHeight);
@@ -241,6 +255,24 @@ namespace BansheeEditor
                 Layout.AddElement(priorityField);
                 Layout.AddElement(layersField);
                 Layout.AddElement(mainField);
+                Layout.AddElement(hdrField);
+
+                postProcessFoldout.OnToggled += x =>
+                {
+                    Persistent.SetBool("postProcess_Expanded", x);
+                    postProcessLayout.Active = x;
+                };
+                Layout.AddElement(postProcessFoldout);
+
+                postProcessLayout = Layout.AddLayoutX();
+                {
+                    postProcessLayout.AddSpace(10);
+
+                    GUILayoutY contentsLayout = postProcessLayout.AddLayoutY();
+                    postProcessGUI = new PostProcessSettingsGUI(camera.PostProcess, contentsLayout, Persistent);
+                    postProcessGUI.OnChanged += x => { camera.PostProcess = x; MarkAsModified(); };
+                    postProcessGUI.OnConfirmed += ConfirmModify;
+                }
 
                 ToggleTypeSpecificFields(camera.ProjectionType);
             }

+ 187 - 5
Source/MBansheeEditor/Inspectors/PostProcessSettingsInspector.cs

@@ -141,7 +141,7 @@ namespace BansheeEditor
         }
 
         /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the auto exposure settings object.
+        /// Constructs a new set of GUI elements for inspecting the tone mapping settings object.
         /// </summary>
         /// <param name="settings">Initial values to assign to the GUI elements.</param>
         /// <param name="layout">Layout to append the GUI elements to.</param>
@@ -208,7 +208,7 @@ namespace BansheeEditor
     /// <summary>
     /// Draws GUI elements for inspecting an <see cref="ColorGradingSettings"/> object.
     /// </summary>
-    internal class ColorGradingSettingssGUI
+    internal class ColorGradingSettingsGUI
     {
         private ColorGradingSettings settings;
 
@@ -238,11 +238,11 @@ namespace BansheeEditor
         }
 
         /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the auto exposure settings object.
+        /// Constructs a new set of GUI elements for inspecting the color grading settings object.
         /// </summary>
         /// <param name="settings">Initial values to assign to the GUI elements.</param>
         /// <param name="layout">Layout to append the GUI elements to.</param>
-        public ColorGradingSettingssGUI(ColorGradingSettings settings, GUILayout layout)
+        public ColorGradingSettingsGUI(ColorGradingSettings settings, GUILayout layout)
         {
             this.settings = settings;
 
@@ -316,7 +316,7 @@ namespace BansheeEditor
         }
 
         /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the auto exposure settings object.
+        /// Constructs a new set of GUI elements for inspecting the white balance settings object.
         /// </summary>
         /// <param name="settings">Initial values to assign to the GUI elements.</param>
         /// <param name="layout">Layout to append the GUI elements to.</param>
@@ -350,5 +350,187 @@ namespace BansheeEditor
         }
     }
 
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="PostProcessSettings"/> object.
+    /// </summary>
+    internal class PostProcessSettingsGUI
+    {
+        private PostProcessSettings settings;
+        private SerializableProperties properties;
+
+        private GUIToggleField enableAutoExposureField = new GUIToggleField(new LocEdString("Enable auto exposure"));
+        private GUIToggle autoExposureFoldout = new GUIToggle(new LocEdString("Auto exposure"), EditorStyles.Foldout);
+        private AutoExposureSettingsGUI autoExposureGUI;
+
+        private GUIToggleField enableToneMappingField = new GUIToggleField(new LocEdString("Enable tone mapping"));
+        private GUIToggle toneMappingFoldout = new GUIToggle(new LocEdString("Tone mapping"), EditorStyles.Foldout);
+        private TonemappingSettingsGUI toneMappingGUI;
+        private GUIToggle whiteBalanceFoldout = new GUIToggle(new LocEdString("White balance"), EditorStyles.Foldout);
+        private WhiteBalanceSettingsGUI whiteBalanceGUI;
+        private GUIToggle colorGradingFoldout = new GUIToggle(new LocEdString("Color grading"), EditorStyles.Foldout);
+        private ColorGradingSettingsGUI colorGradingGUI;
+
+        private GUISliderField gammaField = new GUISliderField(1.0f, 3.0f, new LocEdString("Gamma"));
+        private GUISliderField exposureScaleField = new GUISliderField(-8.0f, 8.0f, new LocEdString("Exposure scale"));
+
+        private GUILayout autoExposureLayout;
+        private GUILayout toneMappingLayout;
+        private GUILayout whiteBalanceLayout;
+        private GUILayout colorGradingLayout;
+
+        public Action<PostProcessSettings> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current value of the settings object.
+        /// </summary>
+        public PostProcessSettings Settings
+        {
+            get { return settings; }
+            set
+            {
+                settings = value;
+
+                enableAutoExposureField.Value = value.EnableAutoExposure;
+                autoExposureGUI.Settings = value.AutoExposure;
+                enableToneMappingField.Value = value.EnableTonemapping;
+                toneMappingGUI.Settings = value.Tonemapping;
+                whiteBalanceGUI.Settings = value.WhiteBalance;
+                colorGradingGUI.Settings = value.ColorGrading;
+                gammaField.Value = value.Gamma;
+                exposureScaleField.Value = value.ExposureScale;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the post process settings object.
+        /// </summary>
+        /// <param name="settings">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public PostProcessSettingsGUI(PostProcessSettings settings, GUILayout layout, SerializableProperties properties)
+        {
+            this.settings = settings;
+            this.properties = properties;
+
+            // Auto exposure
+            enableAutoExposureField.OnChanged += x => { settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(enableAutoExposureField);
+
+            autoExposureFoldout.OnToggled += x =>
+            {
+                properties.SetBool("autoExposure_Expanded", x);
+                ToggleFoldoutFields();
+            };
+            layout.AddElement(autoExposureFoldout);
+
+            autoExposureLayout = layout.AddLayoutX();
+            {
+                autoExposureLayout.AddSpace(10);
+
+                GUILayoutY contentsLayout = autoExposureLayout.AddLayoutY();
+                autoExposureGUI = new AutoExposureSettingsGUI(settings.AutoExposure, contentsLayout);
+                autoExposureGUI.OnChanged += x => { this.settings.AutoExposure = x; MarkAsModified(); };
+                autoExposureGUI.OnConfirmed += ConfirmModify;
+            }
+
+            // Tonemapping
+            enableToneMappingField.OnChanged += x => { settings.EnableTonemapping = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(enableToneMappingField);
+
+            //// Tonemapping settings
+            toneMappingFoldout.OnToggled += x =>
+            {
+                properties.SetBool("toneMapping_Expanded", x);
+                ToggleFoldoutFields();
+            };
+            layout.AddElement(toneMappingFoldout);
+
+            toneMappingLayout = layout.AddLayoutX();
+            {
+                toneMappingLayout.AddSpace(10);
+
+                GUILayoutY contentsLayout = toneMappingLayout.AddLayoutY();
+                toneMappingGUI = new TonemappingSettingsGUI(settings.Tonemapping, contentsLayout);
+                toneMappingGUI.OnChanged += x => { this.settings.Tonemapping = x; MarkAsModified(); };
+                toneMappingGUI.OnConfirmed += ConfirmModify;
+            }
+
+            //// White balance settings
+            whiteBalanceFoldout.OnToggled += x =>
+            {
+                properties.SetBool("whiteBalance_Expanded", x);
+                ToggleFoldoutFields();
+            };
+            layout.AddElement(whiteBalanceFoldout);
+
+            whiteBalanceLayout = layout.AddLayoutX();
+            {
+                whiteBalanceLayout.AddSpace(10);
+
+                GUILayoutY contentsLayout = whiteBalanceLayout.AddLayoutY();
+                whiteBalanceGUI = new WhiteBalanceSettingsGUI(settings.WhiteBalance, contentsLayout);
+                whiteBalanceGUI.OnChanged += x => { this.settings.WhiteBalance = x; MarkAsModified(); };
+                whiteBalanceGUI.OnConfirmed += ConfirmModify;
+            }
+
+            //// Color grading settings
+            colorGradingFoldout.OnToggled += x =>
+            {
+                properties.SetBool("colorGrading_Expanded", x);
+                ToggleFoldoutFields();
+            };
+            layout.AddElement(colorGradingFoldout);
+
+            colorGradingLayout = layout.AddLayoutX();
+            {
+                colorGradingLayout.AddSpace(10);
+
+                GUILayoutY contentsLayout = colorGradingLayout.AddLayoutY();
+                colorGradingGUI = new ColorGradingSettingsGUI(settings.ColorGrading, contentsLayout);
+                colorGradingGUI.OnChanged += x => { this.settings.ColorGrading = x; MarkAsModified(); };
+                colorGradingGUI.OnConfirmed += ConfirmModify;
+            }
+
+            // Gamma
+            gammaField.OnChanged += x => { settings.Gamma = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(gammaField);
+
+            // Exposure scale
+            exposureScaleField.OnChanged += x => { settings.ExposureScale = x; MarkAsModified(); ConfirmModify(); };
+            layout.AddElement(exposureScaleField);
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(settings);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        /// <summary>
+        /// Hides or shows settings property GUI elements depending on set values.
+        /// </summary>
+        private void ToggleFoldoutFields()
+        {
+            autoExposureLayout.Active = properties.GetBool("autoExposure_Expanded");
+            toneMappingLayout.Active = properties.GetBool("toneMapping_Expanded");
+            whiteBalanceLayout.Active = properties.GetBool("whiteBalance_Expanded");
+            colorGradingLayout.Active = properties.GetBool("colorGrading_Expanded");
+        }
+    }
+
     /** @} */
 }

+ 2 - 0
Source/MBansheeEditor/Tests/UnitTestTypes.cs

@@ -54,7 +54,9 @@ namespace BansheeEditor
         public int someValue2;
         public string anotherValue2;
 
+#pragma warning disable 649
         public UT1_SerzCls child;
+#pragma warning restore 649
     }
 
     /// <summary>

+ 3 - 2
Source/MBansheeEditor/Tests/UnitTests.cs

@@ -272,8 +272,7 @@ namespace BansheeEditor
             };
 
             // Disabled because it's a slow test, enable only when relevant (or when a build machine is set up)
-            return;
-
+            /*
             string oldScene = Scene.ActiveSceneUUID;
             Scene.Clear();
 
@@ -775,6 +774,8 @@ namespace BansheeEditor
                 ProjectLibrary.Delete("unitTest4Scene_1.prefab");
                 ProjectLibrary.Delete("unitTest4Scene_2.prefab");
             }
+
+            */
         }
 
         /// <summary>

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

@@ -47,7 +47,7 @@ namespace BansheeEditor
             camera = cameraSO.AddComponent<Camera>();
             camera.Target = renderTexture;
             camera.ViewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
-
+            
             cameraSO.Position = new Vector3(0, 0, 5);
             cameraSO.LookAt(new Vector3(0, 0, 0));
 
@@ -59,6 +59,7 @@ namespace BansheeEditor
             camera.Layers = SceneAxesHandle.LAYER;
             camera.AspectRatio = 1.0f;
             camera.OrthoHeight = 2.0f;
+            camera.HDR = false;
 
             renderTextureGUI = new GUIRenderTexture(renderTexture, true);
 

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

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

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

@@ -125,6 +125,23 @@ namespace BansheeEngine
             set { Internal_SetPriority(mCachedPtr, value); }
         }
 
+        internal bool HDR
+        {
+            get { return Internal_GetHDR(mCachedPtr); }
+            set { Internal_SetHDR(mCachedPtr, value); }
+        }
+
+        internal PostProcessSettings PostProcess
+        {
+            get
+            {
+                PostProcessSettings value;
+                Internal_GetPostProcessSettings(mCachedPtr, out value);
+                return value;
+            }
+            set { Internal_SetPostProcessSettings(mCachedPtr, ref value); }
+        }
+
         internal ulong layers
         {
             get { return Internal_GetLayers(mCachedPtr); }
@@ -411,6 +428,16 @@ 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 void Internal_GetPostProcessSettings(IntPtr instance, out PostProcessSettings value);
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetPostProcessSettings(IntPtr instance, ref PostProcessSettings value);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern ulong Internal_GetLayers(IntPtr instance);
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 2 - 0
Source/MBansheeEngine/Interop/NativeGUIWidget.cs

@@ -13,7 +13,9 @@ namespace BansheeEngine
     /// </summary>
     internal class NativeGUIWidget : ScriptObject
     {
+#pragma warning disable 649
         private GUIPanel panel; // Populated by runtime
+#pragma warning restore 649
 
         /// <summary>
         /// Skin used for rendering all the GUI elements belonging to this widget.

+ 13 - 10
Source/MBansheeEngine/Interop/Program.cs

@@ -7,47 +7,50 @@ using System.Runtime.CompilerServices;
 namespace BansheeEngine
 {
     /** @addtogroup BansheeEngine
+     *  Primary scripting API.
      *  @{
      */
 
     /** @defgroup GUI-Engine GUI 
-     *
+     *  Graphical user interface, including elements, styles and localization.
      */
 
     /** @defgroup Input Input 
-     *
+     *  %Input (mouse, keyboard, gamepad, etc.).
      */
 
     /** @defgroup Math Math 
-     *
+     *  Variety of general purpose math functionality.
      */
 
     /** @defgroup Physics Physics 
-     *
+     *  %Physics system: colliders, triggers, rigidbodies, joints, scene queries, etc.
      */
 
+    /** @cond INTEROP */
     /** @defgroup Interop Interop 
-     *
+     *  Glue types that are used for C++/C# interop.
      */
+    /** @endcond */
 
     /** @defgroup Rendering Rendering 
-     *
+     *  Materials, shaders, textures, meshes and components relating to rendering.
      */
 
     /** @defgroup Resources Resources 
-     *
+     *  Resource types and resource management functionality.
      */
 
     /** @defgroup Scene Scene 
-     *
+     *  Scene objects and components.
      */
 
     /** @defgroup Serialization Serialization 
-     *
+     *  Serialization and deserialization of native objects.
      */
 
     /** @defgroup Utility Utility 
-     *
+     *  Various utility functionality.
      */
 
     /** @} */

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeBoxCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -37,4 +38,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeCapsuleCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -49,4 +50,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeCharacterController.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -190,4 +191,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -203,4 +204,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeD6Joint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -140,4 +141,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeDistanceJoint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -104,4 +105,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeFixedJoint.cs

@@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -24,4 +25,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeHingeJoint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -86,4 +87,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeJoint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -108,4 +109,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeMeshCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -44,4 +45,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativePlaneCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -25,4 +26,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeRigidbody.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -372,4 +373,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeSliderJoint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -69,4 +70,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeSphereCollider.cs

@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -37,4 +38,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

+ 2 - 0
Source/MBansheeEngine/Physics/Interop/NativeSphericalJoint.cs

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
+    /** @cond INTEROP */
     /** @addtogroup Interop
      *  @{
      */
@@ -53,4 +54,5 @@ namespace BansheeEngine
     }
 
     /** @} */
+    /** @endcond */
 }

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

@@ -155,6 +155,28 @@ 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="PostProcess"/> to customize
+        /// those operations.
+        /// </summary>
+        public bool HDR
+        {
+            get { return native.HDR; }
+            set { native.HDR = value; serializableData.HDR = value; }
+        }
+
+        /// <summary>
+        /// Allows you to customize various post process operations that will be executed on the image produced by this 
+        /// camera.
+        /// </summary>
+        public PostProcessSettings PostProcess
+        {
+            get { return native.PostProcess; }
+            set { native.PostProcess = value;  serializableData.postProcessSettings = value; }
+        }
+
         /// <summary>
         /// Sets layer bitfield that is used when determining which object should the camera render. Renderable objects
         /// have their own layer flags that can be set depending on which camera you want to render them in.
@@ -424,6 +446,11 @@ namespace BansheeEngine
         [SerializeObject]
         internal class SerializableData
         {
+            internal SerializableData()
+            {
+                postProcessSettings = PostProcessSettings.CreateDefault();
+            }
+
             public float aspectRatio = 1.333f;
             public float nearClipPlane = 1.0f;
             public float farClipPlane = 1000.0f;
@@ -436,6 +463,8 @@ namespace BansheeEngine
             public ushort clearStencil;
             public ClearFlags clearFlags = ClearFlags.Color | ClearFlags.Depth | ClearFlags.Stencil;
             public int priority;
+            public bool HDR = true;
+            public PostProcessSettings postProcessSettings;
             public ulong layers = 0xFFFFFFFFFFFFFFFF;
             public bool main;
         }

+ 40 - 132
Source/MBansheeEngine/Rendering/PostProcessSettings.cs

@@ -2,13 +2,15 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 using System;
 using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
 
 namespace BansheeEngine
 {
     /// <summary>
     /// Settings that control automatic exposure (eye adaptation) post-process.
     /// </summary>
-    struct AutoExposureSettings // Note: Must match C++ struct AutoExposureSettings
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
+    public struct AutoExposureSettings // Note: Must match C++ struct AutoExposureSettings
     {
         /// <summary>
         /// Determines minimum luminance value in the eye adaptation histogram. The histogram is used for calculating the
@@ -28,8 +30,8 @@ namespace BansheeEngine
         /// Percentage below which to ignore values in the eye adaptation histogram. The histogram is used for calculating
         /// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
         /// value to calculate minimal luminance. Luminance values below the minimal luminance will be ignored and not used
-        /// in scene brightness calculations.This allows you to remove outliers on the lower end of the histogram (e.g. a
-        /// few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
+        /// in scene brightness calculations.This allows you to remove outliers on the lower end of the histogram (for
+        /// example a few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
         /// </summary>
         public float HistogramPctLow;
 
@@ -37,22 +39,22 @@ namespace BansheeEngine
         /// Percentage above which to ignore values in the eye adaptation histogram. The histogram is used for calculating
         /// the average brightness of the scene.Total luminance in the histogram will be summed up and multiplied by this
         /// value to calculate maximum luminance. Luminance values above the maximum luminance will be ignored and not used
-        /// in scene brightness calculations.This allows you to remove outliers on the high end of the histogram (e.g. a few
-        /// very bright pixels). In range [0.0f, 1.0f].
+        /// in scene brightness calculations.This allows you to remove outliers on the high end of the histogram (for 
+        /// example a few very bright pixels). In range [0.0f, 1.0f].
         /// </summary>
         public float HistogramPctHigh;
 
         /// <summary>
         /// Clamps the minimum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
-        /// is never too high (e.g. when in a very dark room you probably do not want the exposure to be so high that
+        /// is never too high (for example when in a very dark room you probably do not want the exposure to be so high that
         /// everything is still visible). In range [0.0f, 10.0f].
         /// </summary>
         public float MinEyeAdaptation;
 
         /// <summary>
         /// Clamps the maximum eye adaptation scale to this value. This allows you to limit eye adaptation so that exposure
-        /// is never too low (e.g. when looking at a very bright light source you probably don't want the exposure to be so
-        /// low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
+        /// is never too low (for example when looking at a very bright light source you probably don't want the exposure to
+        /// be so low that the rest of the scene is all white (overexposed). In range [0.0f, 10.0f].
         /// </summary>
         public float MaxEyeAdaptation;
 
@@ -72,7 +74,8 @@ namespace BansheeEngine
     /// <summary>
     /// Settings that control tonemap post-process.
     /// </summary>
-    struct TonemappingSettings // Note: Must match C++ struct TonemappingSettings
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
+    public struct TonemappingSettings // Note: Must match C++ struct TonemappingSettings
     {
         /// <summary>
         /// Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright
@@ -117,7 +120,8 @@ namespace BansheeEngine
     /// <summary>
     /// Settings that control white balance post-process.
     /// </summary>
-    struct WhiteBalanceSettings // Note: Must match C++ struct WhiteBalanceSettings
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
+    public struct WhiteBalanceSettings // Note: Must match C++ struct WhiteBalanceSettings
     {
         /// <summary>
         /// Temperature used for white balancing, in Kelvins.
@@ -139,7 +143,8 @@ namespace BansheeEngine
     /// <summary>
     /// Settings that control color grading post-process.
     /// </summary>
-    struct ColorGradingSettings // Note: Must match C++ struct ColorGradingSettings
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
+    public struct ColorGradingSettings // Note: Must match C++ struct ColorGradingSettings
     {
         /// <summary>
         /// Saturation to be applied during color grading. Larger values increase vibrancy of the image. 
@@ -169,13 +174,9 @@ namespace BansheeEngine
     /// <summary>
     /// Settings that control the post-process operations.
     /// </summary>
-    class PostProcessSettings : ScriptObject
+    [StructLayout(LayoutKind.Sequential), SerializeObject]
+    public struct PostProcessSettings
     {
-        public PostProcessSettings()
-        {
-            Internal_CreateInstance(this);
-        }
-
         /// <summary>
         /// Determines should automatic exposure be applied to the HDR image. When turned on the average scene brightness
         /// will be calculated and used to automatically expose the image to the optimal range. Use the parameters provided
@@ -183,162 +184,69 @@ namespace BansheeEngine
         /// <see cref="ExposureScale"/> to manually adjust the automatic exposure. When automatic exposure is turned off you
         /// can use <see cref="ExposureScale"/> to manually set the exposure.
         /// </summary>
-        public bool EnableAutoExposure
-        {
-            get { return Internal_GetEnableAutoExposure(mCachedPtr); }
-            set { Internal_SetEnableAutoExposure(mCachedPtr, value); }
-        }
+        public bool EnableAutoExposure;
 
         /// <summary>
         /// Parameters used for customizing automatic scene exposure. <see cref="EnableAutoExposure"/>
         /// </summary>
-        public AutoExposureSettings AutoExposure
-        {
-            get
-            {
-                AutoExposureSettings output;
-                Internal_GetAutoExposureSettings(mCachedPtr, out output);
-
-                return output;
-            }
-
-            set { Internal_SetAutoExposureSettings(mCachedPtr, ref value); }
-        }
+        public AutoExposureSettings AutoExposure;
 
         /// <summary>
         /// Determines should the image be tonemapped. Tonemapping converts an HDR image into LDR image by applying
         /// a filmic curve to the image, simulating the effect of film cameras.Filmic curve improves image quality by
         /// tapering off lows and highs, preventing under- and over-exposure.This is useful if an image contains both
         /// very dark and very bright areas, in which case the global exposure parameter would leave some areas either over-
-        /// or under-exposed.Use ::tonemapping to customize how tonemapping performed.
+        /// or under-exposed. Use <see cref="Tonemapping"/> to customize how tonemapping performed.
         /// 
         /// If this is disabled, then color grading and white balancing will not be enabled either.Only relevant for HDR
         /// images.
         /// </summary>
-        public bool EnableTonemapping
-        {
-            get { return Internal_GetEnableTonemapping(mCachedPtr); }
-            set { Internal_SetEnableTonemapping(mCachedPtr, value); }
-        }
+        public bool EnableTonemapping;
 
         /// <summary>
         /// Parameters used for customizing tonemapping. <see cref="EnableTonemapping"/>
         /// </summary>
-        public TonemappingSettings Tonemapping
-        {
-            get
-            {
-                TonemappingSettings output;
-                Internal_GetTonemappingSettings(mCachedPtr, out output);
-
-                return output;
-            }
-            set { Internal_SetTonemappingSettings(mCachedPtr, ref value); }
-        }
+        public TonemappingSettings Tonemapping;
 
         /// <summary>
         /// Parameters used for customizing white balancing. White balancing converts a scene illuminated by a light of the
         /// specified temperature into a scene illuminated by a standard D65 illuminant (average midday light) in order to
         /// simulate the effects of chromatic adaptation of the human visual system.
         /// </summary>
-        public WhiteBalanceSettings WhiteBalance
-        {
-            get
-            {
-                WhiteBalanceSettings output;
-                Internal_GetWhiteBalanceSettings(mCachedPtr, out output);
-
-                return output;
-            }
-            set { Internal_SetWhiteBalanceSettings(mCachedPtr, ref value); }
-        }
+        public WhiteBalanceSettings WhiteBalance;
 
         /// <summary>
         /// Parameters used for customizing color grading.
         /// </summary>
-        public ColorGradingSettings ColorGrading
-        {
-            get
-            {
-                ColorGradingSettings output;
-                Internal_GetColorGradingSettings(mCachedPtr, out output);
-
-                return output;
-            }
-            set { Internal_SetColorGradingSettings(mCachedPtr, ref value); }
-        }
+        public ColorGradingSettings ColorGrading;
 
         /// <summary>
-        /// Log2 value to scale the eye adaptation by (e.g. 2^0 = 1). Smaller values yield darker image, while larger yield
-        /// brighter image.Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
+        /// Log2 value to scale the eye adaptation by (for example 2^0 = 1). Smaller values yield darker image, while larger
+        /// yield brighter image.Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
         /// enabled). In range [-8, 8].
         /// </summary>
-        public float ExposureScale
-        {
-            get { return Internal_GetExposureScale(mCachedPtr); }
-            set { Internal_SetExposureScale(mCachedPtr, value); }
-        }
+        public float ExposureScale;
 
         /// <summary>
         /// Gamma value to adjust the image for. Larger values result in a brighter image. When tonemapping is turned
         /// on the best gamma curve for the output device is chosen automatically and this value can by used to merely tweak
         /// that curve. If tonemapping is turned off this is the exact value of the gamma curve that will be applied.
         /// </summary>
-        public float Gamma
-        {
-            get { return Internal_GetGamma(mCachedPtr); }
-            set { Internal_SetGamma(mCachedPtr, value); }
-        }
+        public float Gamma;
 
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(PostProcessSettings managedInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetEnableAutoExposure(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetEnableAutoExposure(IntPtr thisPtr, bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetAutoExposureSettings(IntPtr thisPtr, out AutoExposureSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetAutoExposureSettings(IntPtr thisPtr, ref AutoExposureSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetEnableTonemapping(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetEnableTonemapping(IntPtr thisPtr, bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetTonemappingSettings(IntPtr thisPtr, out TonemappingSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTonemappingSettings(IntPtr thisPtr, ref TonemappingSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetWhiteBalanceSettings(IntPtr thisPtr, out WhiteBalanceSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetWhiteBalanceSettings(IntPtr thisPtr, ref WhiteBalanceSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetColorGradingSettings(IntPtr thisPtr, out ColorGradingSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetColorGradingSettings(IntPtr thisPtr, ref ColorGradingSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetExposureScale(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetExposureScale(IntPtr thisPtr, float value);
+        /// <summary>
+        /// Creates a new instance of post process settings with the optimal default values.
+        /// </summary>
+        /// <returns>New instance of post process settings.</returns>
+        public static PostProcessSettings CreateDefault()
+        {
+            PostProcessSettings output;
+            Internal_CreateDefault(out output);
 
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetGamma(IntPtr thisPtr);
+            return output;
+        }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetGamma(IntPtr thisPtr, float value);
+        private static extern void Internal_CreateDefault(out PostProcessSettings value);
     }
 }

+ 8 - 7
Source/MBansheeEngine/Utility/PixelData.cs

@@ -65,20 +65,21 @@ namespace BansheeEngine
         /// </summary>
         BC7 = 20,
         /// <summary>
-        /// 16-bit pixel format, 16 bits (float) for red.
+        /// 16-bit 1-channel s10e5 floating point pixel format, 16 bits (float) for red.
         /// </summary>
         Float16_R = 21,
         /// <summary>
-        /// 32-bit, 2-channel s10e5 floating point pixel format, 16-bit red, 16-bit green.
+        /// 32-bit, 2-channel s10e5 floating point pixel format, 16-bits (float) for red, 16-bits (float) for green.
         /// </summary>
         Float16_RG = 22,
         /// <summary>
-        /// 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue.
+        /// 48-bit, 3-channel s10e5 floating point pixel format,, 16 bits (float) for red, 16 bits (float) for green, 
+        /// 16 bits (float) for blue.
         /// </summary>
         Float16_RGB = 23,
         /// <summary>
-        /// 64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits 
-        /// (float) for alpha.
+        /// 64-bit, 4-channel s10e5 floating point pixel format, 16 bits (float) for red, 16 bits (float) for green, 
+        /// 16 bits (float) for blue, 16 bits (float) for alpha.
         /// </summary>
         Float16_RGBA = 24,
         /// <summary>
@@ -86,7 +87,7 @@ namespace BansheeEngine
         /// </summary>
         Float32_R = 25,
         /// <summary>
-        /// 64-bit, 2-channel floating point pixel format, 32-bit red, 32-bit green.
+        /// 64-bit, pixel format, 32-bits (float) for red, 32-bits (float) for green.
         /// </summary>
         Float32_RG = 26,
         /// <summary>
@@ -103,7 +104,7 @@ namespace BansheeEngine
         /// </summary>
         D32_S8X24 = 29,
         /// <summary>
-        /// Depth stencil fomrat, 24bit depth + 8bit stencil.
+        /// Depth stencil format, 24bit depth + 8bit stencil.
         /// </summary>
         D24S8 = 30,
         /// <summary>

+ 2 - 1
Source/RenderBeast/Include/BsPostProcessing.h

@@ -18,6 +18,7 @@ namespace BansheeEngine
 	struct PostProcessInfo
 	{
 		PostProcessSettings settings;
+		bool settingDirty = true;
 
 		SPtr<PooledRenderTexture> downsampledSceneTex;
 		SPtr<PooledRenderTexture> histogramTex;
@@ -227,7 +228,7 @@ namespace BansheeEngine
 	{
 	public:
 		/** Renders post-processing effects for the provided render target. */
-		void postProcess(const SPtr<RenderTextureCore>& sceneColor, const SPtr<ViewportCore>& outputViewport,
+		void postProcess(const SPtr<RenderTextureCore>& sceneColor, const CameraCore* camera,
 			PostProcessInfo& ppInfo, float frameDelta);
 		
 	private:

+ 5 - 5
Source/RenderBeast/Include/BsRenderBeast.h

@@ -114,10 +114,10 @@ namespace BansheeEngine
 		~RenderBeast() { }
 
 		/** @copydoc Renderer::getName */
-		virtual const StringID& getName() const override;
+		const StringID& getName() const override;
 
 		/** @copydoc Renderer::renderAll */
-		virtual void renderAll() override;
+		void renderAll() override;
 
 		/**	Sets options used for controlling the rendering. */
 		void setOptions(const SPtr<CoreRendererOptions>& options) override;
@@ -126,17 +126,17 @@ namespace BansheeEngine
 		SPtr<CoreRendererOptions> getOptions() const override;
 
 		/** @copydoc Renderer::initialize */
-		virtual void initialize() override;
+		void initialize() override;
 
 		/** @copydoc Renderer::destroy */
-		virtual void destroy() override;
+		void destroy() override;
 
 	private:
 		/** @copydoc Renderer::notifyCameraAdded */
 		void notifyCameraAdded(const CameraCore* camera) override;
 
 		/** @copydoc Renderer::notifyCameraUpdated */
-		void notifyCameraUpdated(const CameraCore* camera, const Vector3& position, const Quaternion& rotation) override;
+		void notifyCameraUpdated(const CameraCore* camera, UINT32 updateFlag) override;
 
 		/** @copydocRenderer::notifyCameraRemoved */
 		void notifyCameraRemoved(const CameraCore* camera) override;

+ 0 - 13
Source/RenderBeast/Include/BsRenderBeastOptions.h

@@ -34,19 +34,6 @@ namespace BansheeEngine
 		 */
 		UINT32 anisotropyMax = 16;
 
-		/**
-		 * Number of samples per pixel. More samples means less aliasing but this may seriously increase fillrate and memory
-		 * consumption on the GPU.
-		 */
-		UINT32 msaa = 1;
-
-		/**
-		 * 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 colors using a tone mapping operator depending
-		 * on average scene brightness.
-		 */
-		bool hdr = true;
-
 		/**
 		 * Controls if and how a render queue groups renderable objects by material in order to reduce number of state
 		 * changes. Sorting by material can reduce CPU usage but could increase overdraw.

+ 13 - 8
Source/RenderBeast/Source/BsPostProcessing.cpp

@@ -5,6 +5,7 @@
 #include "BsRenderTexturePool.h"
 #include "BsRendererUtility.h"
 #include "BsTextureManager.h"
+#include "BsCamera.h"
 
 namespace BansheeEngine
 {
@@ -389,10 +390,13 @@ namespace BansheeEngine
 	template class TonemappingMat<true, false>;
 	template class TonemappingMat<false, false>;
 
-	void PostProcessing::postProcess(const SPtr<RenderTextureCore>& sceneColor, const SPtr<ViewportCore>& outputViewport, 
+	void PostProcessing::postProcess(const SPtr<RenderTextureCore>& sceneColor, const CameraCore* camera, 
 		PostProcessInfo& ppInfo, float frameDelta)
 	{
-		if(ppInfo.settings.enableAutoExposure)
+		SPtr<ViewportCore> outputViewport = camera->getViewport();
+		bool hdr = camera->getFlags().isSet(CameraFlag::HDR);
+
+		if(hdr && ppInfo.settings.enableAutoExposure)
 		{
 			mDownsample.execute(sceneColor, ppInfo);
 			mEyeAdaptHistogram.execute(ppInfo);
@@ -405,26 +409,27 @@ namespace BansheeEngine
 			mEyeAdaptHistogramReduce.release(ppInfo);
 		}
 
-		if (ppInfo.settings.enableTonemapping)
+		if (hdr && ppInfo.settings.enableTonemapping)
 		{
-			// TODO - No need to generate LUT every frame, instead perhaps check for changes and only modify when needed?
-			mCreateLUT.execute(ppInfo);
+			if (ppInfo.settingDirty) // Rebuild LUT if PP settings changed
+				mCreateLUT.execute(ppInfo);
 
 			if (ppInfo.settings.enableAutoExposure)
 				mTonemapping_AE.execute(sceneColor, outputViewport, ppInfo);
 			else
 				mTonemapping.execute(sceneColor, outputViewport, ppInfo);
-
-			mCreateLUT.release(ppInfo);
 		}
 		else
 		{
-			if (ppInfo.settings.enableAutoExposure)
+			if (hdr && ppInfo.settings.enableAutoExposure)
 				mTonemapping_AE_GO.execute(sceneColor, outputViewport, ppInfo);
 			else
 				mTonemapping_GO.execute(sceneColor, outputViewport, ppInfo);
 		}
 
+		if (ppInfo.settingDirty)
+			ppInfo.settingDirty = false;
+
 		// TODO - External code depends on the main RT being bound when this exits, make this clearer
 	}
 }

+ 20 - 12
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -340,6 +340,8 @@ namespace BansheeEngine
 			transparentStateReduction = StateReduction::Distance; // Transparent object MUST be sorted by distance
 
 		camData.transparentQueue = bs_shared_ptr_new<RenderQueue>(transparentStateReduction);
+		camData.postProcessInfo.settings = camera->getPostProcessSettings();
+		camData.postProcessInfo.settingDirty = true;
 
 		// Register in render target list
 		auto findIter = std::find_if(mRenderTargets.begin(), mRenderTargets.end(), 
@@ -372,9 +374,14 @@ namespace BansheeEngine
 		}
 	}
 
-	void RenderBeast::notifyCameraUpdated(const CameraCore* camera, const Vector3& position, const Quaternion& rotation)
+	void RenderBeast::notifyCameraUpdated(const CameraCore* camera, UINT32 updateFlag)
 	{
-		/* Do nothing, we poll position/rotation every frame anyway. */
+		CameraDirtyFlag dirtyFlag = (CameraDirtyFlag)updateFlag;
+		if(dirtyFlag == CameraDirtyFlag::PostProcess)
+		{
+			CameraData& camData = mCameraData[camera];
+			camData.postProcessInfo.settingDirty = true;
+		}
 	}
 
 	void RenderBeast::notifyCameraRemoved(const CameraCore* camera)
@@ -482,7 +489,7 @@ namespace BansheeEngine
 			UINT32 numCameras = (UINT32)cameras.size();
 			for (UINT32 i = 0; i < numCameras; i++)
 			{
-				bool isOverlayCamera = ((UINT32)cameras[i]->getFlags() & (UINT32)CameraFlags::Overlay) != 0;
+				bool isOverlayCamera = cameras[i]->getFlags().isSet(CameraFlag::Overlay);
 				if (!isOverlayCamera)
 					render(renderTargetData, i, delta);
 				else
@@ -506,17 +513,20 @@ namespace BansheeEngine
 		SPtr<ViewportCore> viewport = camera->getViewport();
 		CameraShaderData cameraShaderData = getCameraShaderData(*camera);
 
-		assert(((UINT32)camera->getFlags() & (UINT32)CameraFlags::Overlay) == 0);
+		assert(!camera->getFlags().isSet(CameraFlag::Overlay));
 
 		mStaticHandler->updatePerCameraBuffers(cameraShaderData);
 
+		bool useHDR = camera->getFlags().isSet(CameraFlag::HDR);
+		UINT32 msaaCount = camera->getMSAACount();
+
 		// Render scene objects to g-buffer
 		bool createGBuffer = camData.target == nullptr ||
-			camData.target->getHDR() != mCoreOptions->hdr ||
-			camData.target->getNumSamples() != mCoreOptions->msaa;
+			camData.target->getHDR() != useHDR ||
+			camData.target->getNumSamples() != msaaCount;
 
 		if (createGBuffer)
-			camData.target = RenderTargets::create(viewport, mCoreOptions->hdr, mCoreOptions->msaa);
+			camData.target = RenderTargets::create(viewport, useHDR, msaaCount);
 
 		camData.target->allocate();
 		camData.target->bindGBuffer();
@@ -703,7 +713,7 @@ namespace BansheeEngine
 
 		// TODO - If GBuffer has multiple samples, I should resolve them before post-processing
 		PostProcessing::instance().postProcess(camData.target->getSceneColorRT(), 
-			viewport, camData.postProcessInfo, delta);
+			camera, camData.postProcessInfo, delta);
 
 		// Render overlay post-scene callbacks
 		if (iterCameraCallbacks != mRenderCallbacks.end())
@@ -729,9 +739,7 @@ namespace BansheeEngine
 		gProfilerCPU().beginSample("RenderOverlay");
 
 		const CameraCore* camera = rtData.cameras[camIdx];
-		CameraData& camData = mCameraData[camera];
-
-		assert(((UINT32)camera->getFlags() & (UINT32)CameraFlags::Overlay) != 0);
+		assert(camera->getFlags().isSet(CameraFlag::Overlay));
 
 		SPtr<ViewportCore> viewport = camera->getViewport();
 		CameraShaderData cameraShaderData = getCameraShaderData(*camera);
@@ -783,7 +791,7 @@ namespace BansheeEngine
 	
 	void RenderBeast::determineVisible(const CameraCore& camera)
 	{
-		bool isOverlayCamera = ((UINT32)camera.getFlags() & (UINT32)CameraFlags::Overlay) != 0;
+		bool isOverlayCamera = camera.getFlags().isSet(CameraFlag::Overlay);
 		if (isOverlayCamera)
 			return;
 

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

@@ -12,6 +12,7 @@
 #include "BsMatrix4.h"
 #include "BsRect2.h"
 #include "BsColor.h"
+#include "BsPostProcessSettings.h"
 
 namespace BansheeEngine
 {
@@ -86,6 +87,12 @@ namespace BansheeEngine
 		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 void internal_GetPostProcessSettings(ScriptCamera* instance, PostProcessSettings* value);
+		static void internal_SetPostProcessSettings(ScriptCamera* instance, PostProcessSettings* value);
+
 		static UINT64 internal_GetLayers(ScriptCamera* instance);
 		static void internal_SetLayers(ScriptCamera* instance, UINT64 value);
 

+ 1 - 27
Source/SBansheeEngine/Include/BsScriptPostProcessSettings.h

@@ -21,36 +21,10 @@ namespace BansheeEngine
 	private:
 		ScriptPostProcessSettings(MonoObject* instance);
 
-		SPtr<PostProcessSettings> mSettings;
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_createInstance(MonoObject* managedInstance);
-
-		static bool internal_GetEnableAutoExposure(ScriptPostProcessSettings* thisPtr);
-		static void internal_SetEnableAutoExposure(ScriptPostProcessSettings* thisPtr, bool value);
-
-		static void internal_GetAutoExposureSettings(ScriptPostProcessSettings* thisPtr, AutoExposureSettings* value);
-		static void internal_SetAutoExposureSettings(ScriptPostProcessSettings* thisPtr, AutoExposureSettings* value);
-
-		static bool internal_GetEnableTonemapping(ScriptPostProcessSettings* thisPtr);
-		static void internal_SetEnableTonemapping(ScriptPostProcessSettings* thisPtr, bool value);
-
-		static void internal_GetTonemappingSettings(ScriptPostProcessSettings* thisPtr, TonemappingSettings* value);
-		static void internal_SetTonemappingSettings(ScriptPostProcessSettings* thisPtr, TonemappingSettings* value);
-
-		static void internal_GetWhiteBalanceSettings(ScriptPostProcessSettings* thisPtr, WhiteBalanceSettings* value);
-		static void internal_SetWhiteBalanceSettings(ScriptPostProcessSettings* thisPtr, WhiteBalanceSettings* value);
-
-		static void internal_GetColorGradingSettings(ScriptPostProcessSettings* thisPtr, ColorGradingSettings* value);
-		static void internal_SetColorGradingSettings(ScriptPostProcessSettings* thisPtr, ColorGradingSettings* value);
-
-		static float internal_GetExposureScale(ScriptPostProcessSettings* thisPtr);
-		static void internal_SetExposureScale(ScriptPostProcessSettings* thisPtr, float value);
-
-		static float internal_GetGamma(ScriptPostProcessSettings* thisPtr);
-		static void internal_SetGamma(ScriptPostProcessSettings* thisPtr, float value);
+		static void internal_CreateDefault(PostProcessSettings* output);
 	};
 
 	/** @} */

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

@@ -71,6 +71,12 @@ namespace BansheeEngine
 		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_GetPostProcessSettings", &ScriptCamera::internal_GetPostProcessSettings);
+		metaData.scriptClass->addInternalCall("Internal_SetPostProcessSettings", &ScriptCamera::internal_SetPostProcessSettings);
+
 		metaData.scriptClass->addInternalCall("Internal_GetLayers", &ScriptCamera::internal_GetLayers);
 		metaData.scriptClass->addInternalCall("Internal_SetLayers", &ScriptCamera::internal_SetLayers);
 
@@ -283,6 +289,26 @@ namespace BansheeEngine
 		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);
+	}
+
+	void ScriptCamera::internal_GetPostProcessSettings(ScriptCamera* instance, PostProcessSettings* value)
+	{
+		*value = instance->mCamera->getPostProcessSettings();
+	}
+
+	void ScriptCamera::internal_SetPostProcessSettings(ScriptCamera* instance, PostProcessSettings* value)
+	{
+		instance->mCamera->setPostProcessSettings(*value);
+	}
+
 	UINT64 ScriptCamera::internal_GetLayers(ScriptCamera* instance)
 	{
 		return instance->mCamera->getLayers();

+ 5 - 108
Source/SBansheeEngine/Source/BsScriptPostProcessSettings.cpp

@@ -10,36 +10,12 @@
 namespace BansheeEngine
 {
 	ScriptPostProcessSettings::ScriptPostProcessSettings(MonoObject* instance)
-		:ScriptObject(instance), mSettings(bs_shared_ptr_new<PostProcessSettings>())
+		:ScriptObject(instance)
 	{ }
 
 	void ScriptPostProcessSettings::initRuntimeData()
 	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptPostProcessSettings::internal_createInstance);
-
-		metaData.scriptClass->addInternalCall("Internal_GetEnableAutoExposure", &ScriptPostProcessSettings::internal_GetEnableAutoExposure);
-		metaData.scriptClass->addInternalCall("Internal_SetEnableAutoExposure", &ScriptPostProcessSettings::internal_SetEnableAutoExposure);
-
-		metaData.scriptClass->addInternalCall("Internal_GetAutoExposureSettings", &ScriptPostProcessSettings::internal_GetAutoExposureSettings);
-		metaData.scriptClass->addInternalCall("Internal_SetAutoExposureSettings", &ScriptPostProcessSettings::internal_SetAutoExposureSettings);
-
-		metaData.scriptClass->addInternalCall("Internal_GetEnableTonemapping", &ScriptPostProcessSettings::internal_GetEnableTonemapping);
-		metaData.scriptClass->addInternalCall("Internal_SetEnableTonemapping", &ScriptPostProcessSettings::internal_SetEnableTonemapping);
-
-		metaData.scriptClass->addInternalCall("Internal_GetTonemappingSettings", &ScriptPostProcessSettings::internal_GetTonemappingSettings);
-		metaData.scriptClass->addInternalCall("Internal_SetTonemappingSettings", &ScriptPostProcessSettings::internal_SetTonemappingSettings);
-
-		metaData.scriptClass->addInternalCall("Internal_GetWhiteBalanceSettings", &ScriptPostProcessSettings::internal_GetWhiteBalanceSettings);
-		metaData.scriptClass->addInternalCall("Internal_SetWhiteBalanceSettings", &ScriptPostProcessSettings::internal_SetWhiteBalanceSettings);
-
-		metaData.scriptClass->addInternalCall("Internal_GetColorGradingSettings", &ScriptPostProcessSettings::internal_GetColorGradingSettings);
-		metaData.scriptClass->addInternalCall("Internal_SetColorGradingSettings", &ScriptPostProcessSettings::internal_SetColorGradingSettings);
-
-		metaData.scriptClass->addInternalCall("Internal_GetExposureScale", &ScriptPostProcessSettings::internal_GetExposureScale);
-		metaData.scriptClass->addInternalCall("Internal_SetExposureScale", &ScriptPostProcessSettings::internal_SetExposureScale);
-
-		metaData.scriptClass->addInternalCall("Internal_GetGamma", &ScriptPostProcessSettings::internal_GetGamma);
-		metaData.scriptClass->addInternalCall("Internal_SetGamma", &ScriptPostProcessSettings::internal_SetGamma);
+		metaData.scriptClass->addInternalCall("Internal_CreateDefault", &ScriptPostProcessSettings::internal_CreateDefault);
 
 		// Validation
 #if BS_DEBUG_MODE
@@ -50,6 +26,7 @@ namespace BansheeEngine
 		MonoClass* whieBalanceSettingsClass = engineAssembly->getClass("BansheeEngine", "WhiteBalanceSettings");
 		MonoClass* colorGradingSettingsClass = engineAssembly->getClass("BansheeEngine", "ColorGradingSettings");
 
+		assert(metaData.scriptClass->getInstanceSize() == sizeof(PostProcessSettings));
 		assert(autoExposureSettingsClass->getInstanceSize() == sizeof(AutoExposureSettings));
 		assert(tonemappingSettingsClass->getInstanceSize() == sizeof(TonemappingSettings));
 		assert(whieBalanceSettingsClass->getInstanceSize() == sizeof(WhiteBalanceSettings));
@@ -57,88 +34,8 @@ namespace BansheeEngine
 #endif
 	}
 
-	void ScriptPostProcessSettings::internal_createInstance(MonoObject* managedInstance)
-	{
-		new (bs_alloc<ScriptPostProcessSettings>()) ScriptPostProcessSettings(managedInstance);
-	}
-
-	bool ScriptPostProcessSettings::internal_GetEnableAutoExposure(ScriptPostProcessSettings* thisPtr)
-	{
-		return thisPtr->mSettings->enableAutoExposure;
-	}
-
-	void ScriptPostProcessSettings::internal_SetEnableAutoExposure(ScriptPostProcessSettings* thisPtr, bool value)
-	{
-		thisPtr->mSettings->enableAutoExposure = value;
-	}
-
-	void ScriptPostProcessSettings::internal_GetAutoExposureSettings(ScriptPostProcessSettings* thisPtr, AutoExposureSettings* value)
-	{
-		*value = thisPtr->mSettings->autoExposure;
-	}
-
-	void ScriptPostProcessSettings::internal_SetAutoExposureSettings(ScriptPostProcessSettings* thisPtr, AutoExposureSettings* value)
-	{
-		thisPtr->mSettings->autoExposure = *value;
-	}
-
-	bool ScriptPostProcessSettings::internal_GetEnableTonemapping(ScriptPostProcessSettings* thisPtr)
-	{
-		return thisPtr->mSettings->enableTonemapping;
-	}
-
-	void ScriptPostProcessSettings::internal_SetEnableTonemapping(ScriptPostProcessSettings* thisPtr, bool value)
-	{
-		thisPtr->mSettings->enableTonemapping = value;
-	}
-
-	void ScriptPostProcessSettings::internal_GetTonemappingSettings(ScriptPostProcessSettings* thisPtr, TonemappingSettings* value)
-	{
-		*value = thisPtr->mSettings->tonemapping;
-	}
-
-	void ScriptPostProcessSettings::internal_SetTonemappingSettings(ScriptPostProcessSettings* thisPtr, TonemappingSettings* value)
-	{
-		thisPtr->mSettings->tonemapping = *value;
-	}
-
-	void ScriptPostProcessSettings::internal_GetWhiteBalanceSettings(ScriptPostProcessSettings* thisPtr, WhiteBalanceSettings* value)
-	{
-		*value = thisPtr->mSettings->whiteBalance;
-	}
-
-	void ScriptPostProcessSettings::internal_SetWhiteBalanceSettings(ScriptPostProcessSettings* thisPtr, WhiteBalanceSettings* value)
-	{
-		thisPtr->mSettings->whiteBalance = *value;
-	}
-
-	void ScriptPostProcessSettings::internal_GetColorGradingSettings(ScriptPostProcessSettings* thisPtr, ColorGradingSettings* value)
-	{
-		*value = thisPtr->mSettings->colorGrading;
-	}
-
-	void ScriptPostProcessSettings::internal_SetColorGradingSettings(ScriptPostProcessSettings* thisPtr, ColorGradingSettings* value)
-	{
-		thisPtr->mSettings->colorGrading = *value;
-	}
-
-	float ScriptPostProcessSettings::internal_GetExposureScale(ScriptPostProcessSettings* thisPtr)
-	{
-		return thisPtr->mSettings->exposureScale;
-	}
-
-	void ScriptPostProcessSettings::internal_SetExposureScale(ScriptPostProcessSettings* thisPtr, float value)
-	{
-		thisPtr->mSettings->exposureScale = value;
-	}
-
-	float ScriptPostProcessSettings::internal_GetGamma(ScriptPostProcessSettings* thisPtr)
-	{
-		return thisPtr->mSettings->gamma;
-	}
-
-	void ScriptPostProcessSettings::internal_SetGamma(ScriptPostProcessSettings* thisPtr, float value)
+	void ScriptPostProcessSettings::internal_CreateDefault(PostProcessSettings* output)
 	{
-		thisPtr->mSettings->gamma = value;
+		*output = PostProcessSettings();
 	}
 }