Преглед изворни кода

WIP: Script bindings
- Ported RenderTarget, RenderSettings, Camera, Light to automatic script binding generator (SBGen)

BearishSun пре 8 година
родитељ
комит
90f5f648bf
86 измењених фајлова са 934 додато и 4133 уклоњено
  1. 2 2
      Source/BansheeCore/Components/BsCCamera.cpp
  2. 64 22
      Source/BansheeCore/Components/BsCCamera.h
  3. 45 24
      Source/BansheeCore/Components/BsCLight.h
  4. 5 5
      Source/BansheeCore/Image/BsTexture.h
  5. 9 31
      Source/BansheeCore/RTTI/BsViewportRTTI.h
  6. 1 1
      Source/BansheeCore/RenderAPI/BsRenderTarget.h
  7. 1 1
      Source/BansheeCore/RenderAPI/BsRenderTexture.h
  8. 40 50
      Source/BansheeCore/RenderAPI/BsViewport.cpp
  9. 79 88
      Source/BansheeCore/RenderAPI/BsViewport.h
  10. 2 2
      Source/BansheeCore/Renderer/BsCamera.cpp
  11. 127 123
      Source/BansheeCore/Renderer/BsCamera.h
  12. 27 30
      Source/BansheeCore/Renderer/BsLight.h
  13. 72 8
      Source/BansheeCore/Renderer/BsRenderSettings.h
  14. 6 4
      Source/BansheeCore/Utility/BsCommonTypes.h
  15. 2 2
      Source/BansheeEditor/EditorWindow/BsDockManager.cpp
  16. 2 2
      Source/BansheeEditor/EditorWindow/BsDropDownWindow.cpp
  17. 6 5
      Source/BansheeEditor/GUI/BsGUIFloatField.cpp
  18. 6 5
      Source/BansheeEditor/GUI/BsGUIIntField.cpp
  19. 2 2
      Source/BansheeEditor/GUI/BsGUIWindowFrameWidget.cpp
  20. 1 1
      Source/BansheeEditor/Handles/BsHandleDrawManager.cpp
  21. 4 4
      Source/BansheeEditor/SceneView/BsGizmoManager.cpp
  22. 2 2
      Source/BansheeEditor/SceneView/BsScenePicking.cpp
  23. 2 2
      Source/BansheeEngine/GUI/BsGUIDropDownMenu.cpp
  24. 2 2
      Source/BansheeEngine/GUI/BsGUIManager.cpp
  25. 1 1
      Source/BansheeEngine/GUI/BsGUITooltip.cpp
  26. 1 1
      Source/BansheeEngine/GUI/BsGUIViewport.cpp
  27. 4 3
      Source/BansheeEngine/GUI/BsGUIWidget.cpp
  28. 4 4
      Source/BansheeEngine/GUI/BsProfilerOverlay.cpp
  29. 1 1
      Source/CMakeLists.txt
  30. 1 1
      Source/Examples/ExampleGettingStarted/Main.cpp
  31. 20 20
      Source/MBansheeEditor/Inspectors/CameraInspector.cs
  32. 2 2
      Source/MBansheeEditor/Inspectors/LightInspector.cs
  33. 1 1
      Source/MBansheeEditor/Windows/GameWindow.cs
  34. 1 1
      Source/MBansheeEditor/Windows/Scene/Gizmos/LightGizmos.cs
  35. 5 5
      Source/MBansheeEditor/Windows/Scene/SceneAxesGUI.cs
  36. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneGizmos.cs
  37. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneGrid.cs
  38. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneHandles.cs
  39. 1 1
      Source/MBansheeEditor/Windows/Scene/SceneSelection.cs
  40. 39 39
      Source/MBansheeEditor/Windows/Scene/SceneWindow.cs
  41. 6 6
      Source/MBansheeEngine/GUI/GUIRenderTexture.cs
  42. 0 501
      Source/MBansheeEngine/Interop/NativeCamera.cs
  43. 2 2
      Source/MBansheeEngine/Interop/NativeGUIWidget.cs
  44. 0 162
      Source/MBansheeEngine/Interop/NativeLight.cs
  45. 1 1
      Source/MBansheeEngine/Interop/ProfilerOverlayInternal.cs
  46. 0 8
      Source/MBansheeEngine/MBansheeEngine.csproj
  47. 0 462
      Source/MBansheeEngine/Rendering/Camera.cs
  48. 0 189
      Source/MBansheeEngine/Rendering/Light.cs
  49. 0 274
      Source/MBansheeEngine/Rendering/RenderSettings.cs
  50. 0 108
      Source/MBansheeEngine/Rendering/RenderTarget.cs
  51. 0 20
      Source/MBansheeEngine/Rendering/RenderTexture.cs
  52. 0 125
      Source/MBansheeEngine/Rendering/RenderTexture2D.cs
  53. 6 5
      Source/RenderBeast/BsRenderBeast.cpp
  54. 7 10
      Source/RenderBeast/BsRendererScene.cpp
  55. 3 2
      Source/SBansheeEditor/Wrappers/BsScriptEditorApplication.cpp
  56. 5 3
      Source/SBansheeEditor/Wrappers/BsScriptSceneGizmos.cpp
  57. 3 1
      Source/SBansheeEditor/Wrappers/BsScriptSceneGizmos.h
  58. 5 3
      Source/SBansheeEditor/Wrappers/BsScriptSceneGrid.cpp
  59. 3 1
      Source/SBansheeEditor/Wrappers/BsScriptSceneGrid.h
  60. 5 3
      Source/SBansheeEditor/Wrappers/BsScriptSceneHandles.cpp
  61. 3 1
      Source/SBansheeEditor/Wrappers/BsScriptSceneHandles.h
  62. 6 4
      Source/SBansheeEditor/Wrappers/BsScriptSceneSelection.cpp
  63. 3 1
      Source/SBansheeEditor/Wrappers/BsScriptSceneSelection.h
  64. 1 2
      Source/SBansheeEngine/BsScriptEnginePrerequisites.h
  65. 2 12
      Source/SBansheeEngine/CMakeSources.cmake
  66. 135 0
      Source/SBansheeEngine/Extensions/BsRenderTargetEx.cpp
  67. 113 0
      Source/SBansheeEngine/Extensions/BsRenderTargetEx.h
  68. 5 5
      Source/SBansheeEngine/Extensions/BsTextureEx.h
  69. 0 507
      Source/SBansheeEngine/Wrappers/BsScriptCamera.cpp
  70. 0 139
      Source/SBansheeEngine/Wrappers/BsScriptCamera.h
  71. 0 188
      Source/SBansheeEngine/Wrappers/BsScriptLight.cpp
  72. 0 78
      Source/SBansheeEngine/Wrappers/BsScriptLight.h
  73. 5 4
      Source/SBansheeEngine/Wrappers/BsScriptProfilerOverlayInternal.cpp
  74. 3 1
      Source/SBansheeEngine/Wrappers/BsScriptProfilerOverlayInternal.h
  75. 0 296
      Source/SBansheeEngine/Wrappers/BsScriptRenderSettings.cpp
  76. 0 156
      Source/SBansheeEngine/Wrappers/BsScriptRenderSettings.h
  77. 0 64
      Source/SBansheeEngine/Wrappers/BsScriptRenderTarget.cpp
  78. 0 52
      Source/SBansheeEngine/Wrappers/BsScriptRenderTarget.h
  79. 0 21
      Source/SBansheeEngine/Wrappers/BsScriptRenderTexture.cpp
  80. 0 25
      Source/SBansheeEngine/Wrappers/BsScriptRenderTexture.h
  81. 0 132
      Source/SBansheeEngine/Wrappers/BsScriptRenderTexture2D.cpp
  82. 0 44
      Source/SBansheeEngine/Wrappers/BsScriptRenderTexture2D.h
  83. 6 5
      Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIRenderTexture.cpp
  84. 2 2
      Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIRenderTexture.h
  85. 7 5
      Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIWidget.cpp
  86. 4 2
      Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIWidget.h

+ 2 - 2
Source/BansheeCore/Components/BsCCamera.cpp

@@ -16,11 +16,11 @@ namespace bs
 
 	CCamera::CCamera(const HSceneObject& parent, SPtr<RenderTarget> target, float left, float top, float width, float height)
 		: Component(parent), mTarget(target), mLeft(left), mTop(top), mWidth(width), mHeight(height)
-    {
+	{
 		if(mTarget == nullptr)
 			mTarget = CoreApplication::instance().getPrimaryWindow();
 
-		Component::setFlag(ComponentFlag::AlwaysRun, true);
+		setFlag(ComponentFlag::AlwaysRun, true);
 		setName("Camera");
 	}
 

+ 64 - 22
Source/BansheeCore/Components/BsCCamera.h

@@ -17,39 +17,48 @@ namespace bs
 	 * 			
 	 * Wraps a Camera as a Component.
 	 */
-    class BS_CORE_EXPORT CCamera : public Component
-    {
-    public:
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering,n:Camera) CCamera : public Component
+	{
+	public:
 		CCamera(const HSceneObject& parent, SPtr<RenderTarget> target = nullptr,
 			float left = 0.0f, float top = 0.0f, float width = 1.0f, float height = 1.0f);
 
-        virtual ~CCamera();
+		virtual ~CCamera();
 
 		/** @copydoc Camera::getViewport */
+		BS_SCRIPT_EXPORT(n:Viewport,pr:getter)
 		SPtr<Viewport> getViewport() const { return mInternal->getViewport(); }
 
 		/** @copydoc Camera::setHorzFOV */
+		BS_SCRIPT_EXPORT(n:FieldOfView,pr:setter)
 		virtual void setHorzFOV(const Radian& fovy) { mInternal->setHorzFOV(fovy); }
 
 		/** @copydoc Camera::getHorzFOV */
+		BS_SCRIPT_EXPORT(n:FieldOfView,pr:getter)
 		virtual const Radian& getHorzFOV() const { return mInternal->getHorzFOV(); }
 
 		/** @copydoc Camera::setNearClipDistance */
+		BS_SCRIPT_EXPORT(n:NearClipPlane,pr:setter)
 		virtual void setNearClipDistance(float nearDist) { mInternal->setNearClipDistance(nearDist); }
 
 		/** @copydoc Camera::getNearClipDistance */
+		BS_SCRIPT_EXPORT(n:NearClipPlane,pr:getter)
 		virtual float getNearClipDistance() const { return mInternal->getNearClipDistance(); }
 
 		/** @copydoc Camera::setFarClipDistance */
+		BS_SCRIPT_EXPORT(n:FarClipPlane,pr:setter)
 		virtual void setFarClipDistance(float farDist) { mInternal->setFarClipDistance(farDist); }
 
 		/** @copydoc Camera::getFarClipDistance */
+		BS_SCRIPT_EXPORT(n:FarClipPlane,pr:getter)
 		virtual float getFarClipDistance() const { return mInternal->getFarClipDistance(); }
 
 		/** @copydoc Camera::setAspectRatio */
+		BS_SCRIPT_EXPORT(n:AspectRatio,pr:setter)
 		virtual void setAspectRatio(float ratio) { mInternal->setAspectRatio(ratio); }
 
 		/** @copydoc Camera::getAspectRatio */
+		BS_SCRIPT_EXPORT(n:AspectRatio,pr:getter)
 		virtual float getAspectRatio() const { return mInternal->getAspectRatio(); }
 
 		/** @copydoc Camera::setFrustumExtents */
@@ -68,12 +77,14 @@ namespace bs
 		}
 
 		/** @copydoc Camera::getProjectionMatrixRS */
+		BS_SCRIPT_EXPORT(n:ProjMatrix,pr:getter)
 		virtual const Matrix4& getProjectionMatrixRS() const { return mInternal->getProjectionMatrixRS(); }
 
 		/** @copydoc Camera::getProjectionMatrix */
 		virtual const Matrix4& getProjectionMatrix() const { return mInternal->getProjectionMatrix(); }
 
 		/** @copydoc Camera::getViewMatrix */
+		BS_SCRIPT_EXPORT(n:ViewMatrix,pr:getter)
 		virtual const Matrix4& getViewMatrix() const { updateView(); return mInternal->getViewMatrix(); }
 
 		/** @copydoc Camera::setCustomViewMatrix */
@@ -98,107 +109,138 @@ namespace bs
 		virtual const ConvexVolume& getFrustum() const { return mInternal->getFrustum(); }
 
 		/** @copydoc Camera::getWorldFrustum */
-        virtual ConvexVolume getWorldFrustum() const;
+		virtual ConvexVolume getWorldFrustum() const;
 
 		/** @copydoc Camera::getBoundingBox */
 		const AABox& getBoundingBox() const { return mInternal->getBoundingBox(); }
 
 		/** @copydoc Camera::setProjectionType */
+		BS_SCRIPT_EXPORT(n:ProjectionType,pr:setter)
 		virtual void setProjectionType(ProjectionType pt) { mInternal->setProjectionType(pt); }
 
 		/** @copydoc Camera::getProjectionType */
+		BS_SCRIPT_EXPORT(n:ProjectionType,pr:getter)
 		virtual ProjectionType getProjectionType() const { return mInternal->getProjectionType(); }
 
 		/** @copydoc Camera::setOrthoWindow */
 		virtual void setOrthoWindow(float w, float h) { mInternal->setOrthoWindow(w, h); }
 
 		/** @copydoc Camera::setOrthoWindowHeight */
+		BS_SCRIPT_EXPORT(n:OrthoHeight,pr:setter)
 		virtual void setOrthoWindowHeight(float h) { mInternal->setOrthoWindowHeight(h); }
 
-		/** @copydoc Camera::setOrthoWindowWidth */
-		virtual void setOrthoWindowWidth(float w) { mInternal->setOrthoWindowWidth(w); }
-
 		/** @copydoc Camera::getOrthoWindowHeight */
+		BS_SCRIPT_EXPORT(n:OrthoHeight,pr:getter)
 		virtual float getOrthoWindowHeight() const { return mInternal->getOrthoWindowHeight(); }
 
+		/** @copydoc Camera::setOrthoWindowWidth */
+		BS_SCRIPT_EXPORT(n:OrthoWidth,pr:setter)
+		virtual void setOrthoWindowWidth(float w) { mInternal->setOrthoWindowWidth(w); }
+
 		/** @copydoc Camera::getOrthoWindowWidth */
+		BS_SCRIPT_EXPORT(n:OrthoWidth,pr:getter)
 		virtual float getOrthoWindowWidth() const { return mInternal->getOrthoWindowWidth(); }
 
-		/** @copydoc Camera::getPriority */
-		INT32 getPriority() const { return mInternal->getPriority(); }
-
 		/** @copydoc Camera::setPriority */
+		BS_SCRIPT_EXPORT(n:Priority,pr:setter)
 		void setPriority(INT32 priority) { mInternal->setPriority(priority); }
 
-		/** @copydoc Camera::getLayers */
-		UINT64 getLayers() const { return mInternal->getLayers(); }
+		/** @copydoc Camera::getPriority */
+		BS_SCRIPT_EXPORT(n:Priority,pr:getter)
+		INT32 getPriority() const { return mInternal->getPriority(); }
 
 		/** @copydoc Camera::setLayers */
+		BS_SCRIPT_EXPORT(n:Layers,pr:setter)
 		void setLayers(UINT64 layers) { mInternal->setLayers(layers); }
 
-		/** @copydoc Camera::getMSAACount */
-		UINT32 getMSAACount() const { return mInternal->getMSAACount(); }
+		/** @copydoc Camera::getLayers */
+		BS_SCRIPT_EXPORT(n:Layers,pr:getter)
+		UINT64 getLayers() const { return mInternal->getLayers(); }
 
 		/** @copydoc Camera::setMSAACount */
+		BS_SCRIPT_EXPORT(n:SampleCount,pr:setter)
 		void setMSAACount(UINT32 count) { mInternal->setMSAACount(count); }
 
-		/** @copydoc Camera::getRenderSettings() */
-		const SPtr<RenderSettings>& getRenderSettings() const { return mInternal->getRenderSettings(); }
+		/** @copydoc Camera::getMSAACount */
+		BS_SCRIPT_EXPORT(n:SampleCount,pr:getter)
+		UINT32 getMSAACount() const { return mInternal->getMSAACount(); }
 
 		/** @copydoc Camera::setRenderSettings() */
+		BS_SCRIPT_EXPORT(n:RenderSettings,pr:setter)
 		void setRenderSettings(const SPtr<RenderSettings>& settings) { mInternal->setRenderSettings(settings); }
 
+		/** @copydoc Camera::getRenderSettings() */
+		BS_SCRIPT_EXPORT(n:RenderSettings,pr:getter)
+		const SPtr<RenderSettings>& getRenderSettings() const { return mInternal->getRenderSettings(); }
+
 		/** @copydoc Camera::worldToScreenPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2I worldToScreenPoint(const Vector3& worldPoint) const { updateView(); return mInternal->worldToScreenPoint(worldPoint); }
 
 		/** @copydoc Camera::worldToNdcPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2 worldToNdcPoint(const Vector3& worldPoint) const { updateView(); return mInternal->worldToNdcPoint(worldPoint); }
 
 		/** @copydoc Camera::worldToViewPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 worldToViewPoint(const Vector3& worldPoint) const { updateView(); return mInternal->worldToViewPoint(worldPoint); }
 
 		/** @copydoc Camera::screenToWorldPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 screenToWorldPoint(const Vector2I& screenPoint, float depth = 0.5f) const { updateView(); return mInternal->screenToWorldPoint(screenPoint, depth); }
 
 		/** @copydoc Camera::screenToViewPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 screenToViewPoint(const Vector2I& screenPoint, float depth = 0.5f) const { return mInternal->screenToViewPoint(screenPoint, depth); }
 
 		/** @copydoc Camera::screenToNdcPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2 screenToNdcPoint(const Vector2I& screenPoint) const { return mInternal->screenToNdcPoint(screenPoint); }
 
 		/** @copydoc Camera::viewToWorldPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 viewToWorldPoint(const Vector3& viewPoint) const { updateView(); return mInternal->viewToWorldPoint(viewPoint); }
 
 		/** @copydoc Camera::viewToScreenPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2I viewToScreenPoint(const Vector3& viewPoint) const { return mInternal->viewToScreenPoint(viewPoint); }
 
 		/** @copydoc Camera::viewToNdcPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2 viewToNdcPoint(const Vector3& viewPoint) const { return mInternal->viewToNdcPoint(viewPoint); }
 
 		/** @copydoc Camera::ndcToWorldPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 ndcToWorldPoint(const Vector2& ndcPoint, float depth = 0.5f) const { updateView(); return mInternal->ndcToWorldPoint(ndcPoint, depth); }
 
 		/** @copydoc Camera::ndcToViewPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 ndcToViewPoint(const Vector2& ndcPoint, float depth = 0.5f) const { return mInternal->ndcToViewPoint(ndcPoint, depth); }
 
 		/** @copydoc Camera::ndcToScreenPoint */
+		BS_SCRIPT_EXPORT()
 		Vector2I ndcToScreenPoint(const Vector2& ndcPoint) const { return mInternal->ndcToScreenPoint(ndcPoint); }
 
 		/** @copydoc Camera::screenPointToRay */
+		BS_SCRIPT_EXPORT()
 		Ray screenPointToRay(const Vector2I& screenPoint) const { updateView(); return mInternal->screenPointToRay(screenPoint); }
 
 		/** @copydoc Camera::projectPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 projectPoint(const Vector3& point) const { return mInternal->projectPoint(point); }
 
 		/** @copydoc Camera::unprojectPoint */
+		BS_SCRIPT_EXPORT()
 		Vector3 unprojectPoint(const Vector3& point) const { return mInternal->unprojectPoint(point); }
 
-		/** @copydoc Camera::isMain */	
-		bool isMain() const { return mInternal->isMain(); }
-
 		/** @copydoc Camera::setMain */	
+		BS_SCRIPT_EXPORT(n:Main,pr:setter)
 		void setMain(bool main);
 
+		/** @copydoc Camera::isMain */
+		BS_SCRIPT_EXPORT(n:Main,pr:getter)
+		bool isMain() const { return mInternal->isMain(); }
+
 		/** @name Internal 
 		 *  @{
 		 */
@@ -208,7 +250,7 @@ namespace bs
 
 		/** @} */
 
-    protected:
+	protected:
 		/** Checks if the world transform of the camera changed, and if needed updates the view matrix. */
 		void updateView() const;
 
@@ -247,7 +289,7 @@ namespace bs
 
 	protected:
 		CCamera();// Serialization only
-     };
+	 };
 
 	 /** @} */
 }

+ 45 - 24
Source/BansheeCore/Components/BsCLight.h

@@ -15,9 +15,9 @@ namespace bs
 	/**
 	 * @copydoc	Light
 	 *
-	 * Wraps Light as a Component.
+	 * @note	Wraps Light as a Component.
 	 */
-	class BS_CORE_EXPORT CLight : public Component
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering,n:Light) CLight : public Component
 	{
 	public:
 		CLight(const HSceneObject& parent, LightType type = LightType::Radial, Color color = Color::White, 
@@ -26,67 +26,88 @@ namespace bs
 
 		virtual ~CLight();
 
-		/** @copydoc Light::getType */
-		LightType getType() const { return mInternal->getType(); }
-
 		/** @copydoc Light::setType */
+		BS_SCRIPT_EXPORT(n:Type,pr:setter)
 		void setType(LightType type) { mInternal->setType(type); }
 
-		/** @copydoc Light::getCastsShadow */
-		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
+		/** @copydoc Light::getType */
+		BS_SCRIPT_EXPORT(n:Type,pr:getter)
+		LightType getType() const { return mInternal->getType(); }
 
 		/** @copydoc Light::setCastsShadow */
+		BS_SCRIPT_EXPORT(n:CastsShadow,pr:setter)
 		void setCastsShadow(bool castsShadow) { mInternal->setCastsShadow(castsShadow); }
 
+		/** @copydoc Light::getCastsShadow */
+		BS_SCRIPT_EXPORT(n:CastsShadow,pr:getter)
+		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
+
 		/** @copydoc Light::setShadowBias */
+		BS_SCRIPT_EXPORT(n:ShadowBias,pr:setter)
 		void setShadowBias(float bias) { mInternal->setShadowBias(bias); }
 
 		/** @copydoc Light::setShadowBias() */
+		BS_SCRIPT_EXPORT(n:ShadowBias,pr:getter)
 		float getShadowBias() const { return mInternal->getShadowBias(); }
 
-		/** @copydoc Light::getColor */
-		Color getColor() const { return mInternal->getColor(); }
-
 		/** @copydoc Light::setColor */
+		BS_SCRIPT_EXPORT(n:Color,pr:setter)
 		void setColor(const Color& color) { mInternal->setColor(color); }
 
-		/** @copydoc Light::getAttenuationRadius */
-		float getAttenuationRadius() const { return mInternal->getAttenuationRadius(); }
+		/** @copydoc Light::getColor */
+		BS_SCRIPT_EXPORT(n:Color,pr:getter)
+		Color getColor() const { return mInternal->getColor(); }
 
 		/** @copydoc Light::setAttenuationRadius */
+		BS_SCRIPT_EXPORT(n:AttenuationRadius,pr:setter)
 		void setAttenuationRadius(float radius) { mInternal->setAttenuationRadius(radius); }
 
-		/** @copydoc Light::getSourceRadius */
-		float getSourceRadius() const { return mInternal->getSourceRadius(); }
+		/** @copydoc Light::getAttenuationRadius */
+		BS_SCRIPT_EXPORT(n:AttenuationRadius,pr:getter)
+		float getAttenuationRadius() const { return mInternal->getAttenuationRadius(); }
 
 		/** @copydoc Light::setSourceRadius */
+		BS_SCRIPT_EXPORT(n:SourceRadius,pr:setter)
 		void setSourceRadius(float radius) { mInternal->setSourceRadius(radius); }
 
-		/** @copydoc Light::getIntensity */
-		float getIntensity() const { return mInternal->getIntensity(); }
+		/** @copydoc Light::getSourceRadius */
+		BS_SCRIPT_EXPORT(n:SourceRadius,pr:getter)
+		float getSourceRadius() const { return mInternal->getSourceRadius(); }
 
 		/** @copydoc Light::setIntensity */
+		BS_SCRIPT_EXPORT(n:Intensity,pr:setter)
 		void setIntensity(float intensity) { mInternal->setIntensity(intensity); }
 
-		/** @copydoc Light::getSpotAngle */
-		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
+		/** @copydoc Light::getIntensity */
+		BS_SCRIPT_EXPORT(n:Intensity,pr:getter)
+		float getIntensity() const { return mInternal->getIntensity(); }
 
 		/** @copydoc Light::setSpotAngle */
+		BS_SCRIPT_EXPORT(n:SpotAngle,pr:setter)
 		void setSpotAngle(const Degree& spotAngle) { mInternal->setSpotAngle(spotAngle); }
 
-		/** @copydoc Light::getSpotFalloffAngle */
-		Degree getSpotFalloffAngle() const { return mInternal->getSpotFalloffAngle(); }
+		/** @copydoc Light::getSpotAngle */
+		BS_SCRIPT_EXPORT(n:SpotAngle,pr:getter)
+		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
 
 		/** @copydoc Light::setSpotFalloffAngle */
+		BS_SCRIPT_EXPORT(n:SpotAngleFalloff,pr:setter)
 		void setSpotFalloffAngle(const Degree& spotAngle) { mInternal->setSpotFalloffAngle(spotAngle); }
 
-		/** @copydoc Light::getUseAutoAttenuation  */
-		bool getUseAutoAttenuation() const { return mInternal->getUseAutoAttenuation(); }
+		/** @copydoc Light::getSpotFalloffAngle */
+		BS_SCRIPT_EXPORT(n:SpotAngleFalloff,pr:getter)
+		Degree getSpotFalloffAngle() const { return mInternal->getSpotFalloffAngle(); }
 
-		/**  @copydoc Light::setUseAutoAttenuation  */
+		/**  @copydoc Light::setUseAutoAttenuation */
+		BS_SCRIPT_EXPORT(n:UseAutoAttenuation,pr:setter)
 		void setUseAutoAttenuation(bool enabled) { mInternal->setUseAutoAttenuation(enabled); }
 
-		/** @copydoc Light::getBounds  */
+		/** @copydoc Light::getUseAutoAttenuation */
+		BS_SCRIPT_EXPORT(n:UseAutoAttenuation,pr:getter)
+		bool getUseAutoAttenuation() const { return mInternal->getUseAutoAttenuation(); }
+
+		/** @copydoc Light::getBounds */
+		BS_SCRIPT_EXPORT(n:Bounds,pr:getter)
 		Sphere getBounds() const;
 
 		/** @name Internal 

+ 5 - 5
Source/BansheeCore/Image/BsTexture.h

@@ -164,9 +164,9 @@ namespace bs
 	 *
 	 * @note	Sim thread.
 	 */
-    class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) Texture : public Resource
-    {
-    public:
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) Texture : public Resource
+	{
+	public:
 		/**
 		 * Updates the texture with new data. Provided data buffer will be locked until the operation completes.
 		 *
@@ -263,7 +263,7 @@ namespace bs
 
 		/** @} */
 
-    protected:
+	protected:
 		friend class TextureManager;
 
 		Texture(const TEXTURE_DESC& desc);
@@ -302,7 +302,7 @@ namespace bs
 		friend class TextureRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		RTTITypeBase* getRTTI() const override;
-    };
+	};
 
 	/** @} */
 

+ 9 - 31
Source/BansheeCore/RTTI/BsViewportRTTI.h

@@ -16,39 +16,17 @@ namespace bs
 	class BS_CORE_EXPORT ViewportRTTI : public RTTIType<Viewport, IReflectable, ViewportRTTI>
 	{
 	private:
-		Rect2& getNormArea(Viewport* obj) { return obj->mNormArea; }
-		void setNormArea(Viewport* obj, Rect2& val) { obj->mNormArea = val; }
-
-		bool& getRequireColorClear(Viewport* obj) { return obj->mRequiresColorClear; }
-		void setRequireColorClear(Viewport* obj, bool& val) { obj->mRequiresColorClear = val; }
-
-		bool& getRequireDepthClear(Viewport* obj) { return obj->mRequiresDepthClear; }
-		void setRequireDepthClear(Viewport* obj, bool& val) { obj->mRequiresDepthClear = val; }
-
-		bool& getRequireStencilClear(Viewport* obj) { return obj->mRequiresStencilClear; }
-		void setRequireStencilClear(Viewport* obj, bool& val) { obj->mRequiresStencilClear = val; }
-
-		Color& getClearColor(Viewport* obj) { return obj->mClearColor; }
-		void setClearColor(Viewport* obj, Color& val) { obj->mClearColor = val; }
-
-		float& getDepthClearValue(Viewport* obj) { return obj->mDepthClearValue; }
-		void setDepthClearValue(Viewport* obj, float& val) { obj->mDepthClearValue = val; }
-
-		UINT16& getStencilClearValue(Viewport* obj) { return obj->mStencilClearValue; }
-		void setStencilClearValue(Viewport* obj, UINT16& val) { obj->mStencilClearValue = val; }
-
-		// TODO - Not saving a render target reference. Need to re-think the design on how to reference those. Likely as a handle to resource.
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mNormArea, 0)
+			BS_RTTI_MEMBER_PLAIN(mClearColorValue, 1)
+			BS_RTTI_MEMBER_PLAIN(mClearDepthValue, 2)
+			BS_RTTI_MEMBER_PLAIN(mClearStencilValue, 3)
+			BS_RTTI_MEMBER_PLAIN(mClearFlags, 4)
+		BS_END_RTTI_MEMBERS
 	public:
 		ViewportRTTI()
-		{
-			addPlainField("mNormArea", 0, &ViewportRTTI::getNormArea, &ViewportRTTI::setNormArea);
-			addPlainField("mRequiresColorClear", 1, &ViewportRTTI::getRequireColorClear, &ViewportRTTI::setRequireColorClear);
-			addPlainField("mRequiresDepthClear", 2, &ViewportRTTI::getRequireDepthClear, &ViewportRTTI::setRequireDepthClear);
-			addPlainField("mRequiresStencilClear", 3, &ViewportRTTI::getRequireStencilClear, &ViewportRTTI::setRequireStencilClear);
-			addPlainField("mClearColor", 4, &ViewportRTTI::getClearColor, &ViewportRTTI::setClearColor);
-			addPlainField("mDepthClearValue", 5, &ViewportRTTI::getDepthClearValue, &ViewportRTTI::setDepthClearValue);
-			addPlainField("mStencilClearValue", 6, &ViewportRTTI::getStencilClearValue, &ViewportRTTI::setStencilClearValue);
-		}
+			:mInitMembers(this)
+		{ }
 
 		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{

+ 1 - 1
Source/BansheeCore/RenderAPI/BsRenderTarget.h

@@ -121,7 +121,7 @@ namespace bs
 	 * @note	
 	 * Sim thread unless noted otherwise. Retrieve core implementation from getCore() for core thread only functionality.
 	 */
-	class BS_CORE_EXPORT RenderTarget : public CoreObject
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) RenderTarget : public CoreObject
 	{
 	public:
 		RenderTarget();

+ 1 - 1
Source/BansheeCore/RenderAPI/BsRenderTexture.h

@@ -43,7 +43,7 @@ namespace bs
 	 *
 	 * @note	Sim thread only. Retrieve core implementation from getCore() for core thread only functionality.
 	 */
-	class BS_CORE_EXPORT RenderTexture : public RenderTarget
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) RenderTexture : public RenderTarget
 	{
 	public:
 		virtual ~RenderTexture() { }

+ 40 - 50
Source/BansheeCore/RenderAPI/BsViewport.cpp

@@ -13,23 +13,20 @@ namespace bs
 	const Color ViewportBase::DEFAULT_CLEAR_COLOR = Color(0.0f, 0.3685f, 0.7969f);
 
 	ViewportBase::ViewportBase(float x, float y, float width, float height)
-		: mNormArea(x, y, width, height), mRequiresColorClear(true), mRequiresDepthClear(true)
-		, mRequiresStencilClear(false), mClearColor(DEFAULT_CLEAR_COLOR), mDepthClearValue(1.0f), mStencilClearValue(0)
-    {
+		: mNormArea(x, y, width, height), mClearFlags(ClearFlagBits::Color | ClearFlagBits::Depth)
+		, mClearColorValue(DEFAULT_CLEAR_COLOR), mClearDepthValue(1.0f), mClearStencilValue(0)
+	{
 
-    }
+	}
 
-	void ViewportBase::setArea(float x, float y, float width, float height)
-    {
-        mNormArea.x = x;
-        mNormArea.y = y;
-        mNormArea.width = width;
-        mNormArea.height = height;
+	void ViewportBase::setArea(const Rect2& area)
+	{
+		mNormArea = area;
 
 		_markCoreDirty();
-    }
+	}
 
-	Rect2I ViewportBase::getArea() const
+	Rect2I ViewportBase::getPixelArea() const
 	{
 		float width = (float)getTargetWidth();
 		float height = (float)getTargetHeight();
@@ -43,42 +40,41 @@ namespace bs
 		return area;
 	}
 
-	void ViewportBase::setRequiresClear(bool colorClear, bool depthClear, bool stencilClear)
+	void ViewportBase::setClearFlags(ClearFlags flags)
 	{
-		mRequiresColorClear = colorClear;
-		mRequiresDepthClear = depthClear;
-		mRequiresStencilClear = stencilClear;
+		mClearFlags = flags;
 
 		_markCoreDirty();
 	}
 
 	void ViewportBase::setClearValues(const Color& clearColor, float clearDepth, UINT16 clearStencil)
 	{
-		mClearColor = clearColor;
-		mDepthClearValue = clearDepth;
-		mStencilClearValue = clearStencil;
+		mClearColorValue = clearColor;
+		mClearDepthValue = clearDepth;
+		mClearStencilValue = clearStencil;
 
 		_markCoreDirty();
 	}
 
-	INT32 ViewportBase::getX() const
-	{ 
-		return (INT32)(mNormArea.x * getTargetWidth());
-	}
+	void ViewportBase::setClearColorValue(const Color& color)
+	{
+		mClearColorValue = color;
 
-	INT32 ViewportBase::getY() const
-	{ 
-		return (INT32)(mNormArea.y * getTargetHeight());
+		_markCoreDirty();
 	}
 
-	INT32 ViewportBase::getWidth() const
-	{ 
-		return (INT32)(mNormArea.width * getTargetWidth());
+	void ViewportBase::setClearDepthValue(float depth)
+	{
+		mClearDepthValue = depth;
+
+		_markCoreDirty();
 	}
 
-	INT32 ViewportBase::getHeight() const
-	{ 
-		return (INT32)(mNormArea.height * getTargetHeight());
+	void ViewportBase::setClearStencilValue(UINT16 value)
+	{
+		mClearStencilValue = value;
+
+		_markCoreDirty();
 	}
 
 	Viewport::Viewport()
@@ -144,24 +140,20 @@ namespace bs
 	{
 		UINT32 size = 0;
 		size += rttiGetElemSize(mNormArea);
-		size += rttiGetElemSize(mRequiresColorClear);
-		size += rttiGetElemSize(mRequiresDepthClear);
-		size += rttiGetElemSize(mRequiresStencilClear);
-		size += rttiGetElemSize(mClearColor);
-		size += rttiGetElemSize(mDepthClearValue);
-		size += rttiGetElemSize(mStencilClearValue);
+		size += rttiGetElemSize(mClearFlags);
+		size += rttiGetElemSize(mClearColorValue);
+		size += rttiGetElemSize(mClearDepthValue);
+		size += rttiGetElemSize(mClearStencilValue);
 		size += sizeof(SPtr<ct::RenderTarget>);
 
 		UINT8* buffer = allocator->alloc(size);
 
 		char* dataPtr = (char*)buffer;
 		dataPtr = rttiWriteElem(mNormArea, dataPtr);
-		dataPtr = rttiWriteElem(mRequiresColorClear, dataPtr);
-		dataPtr = rttiWriteElem(mRequiresDepthClear, dataPtr);
-		dataPtr = rttiWriteElem(mRequiresStencilClear, dataPtr);
-		dataPtr = rttiWriteElem(mClearColor, dataPtr);
-		dataPtr = rttiWriteElem(mDepthClearValue, dataPtr);
-		dataPtr = rttiWriteElem(mStencilClearValue, dataPtr);
+		dataPtr = rttiWriteElem(mClearFlags, dataPtr);
+		dataPtr = rttiWriteElem(mClearColorValue, dataPtr);
+		dataPtr = rttiWriteElem(mClearDepthValue, dataPtr);
+		dataPtr = rttiWriteElem(mClearStencilValue, dataPtr);
 
 		SPtr<ct::RenderTarget>* rtPtr = new (dataPtr) SPtr<ct::RenderTarget>();
 		if (mTarget != nullptr)
@@ -246,12 +238,10 @@ namespace bs
 	{
 		char* dataPtr = (char*)data.getBuffer();
 		dataPtr = rttiReadElem(mNormArea, dataPtr);
-		dataPtr = rttiReadElem(mRequiresColorClear, dataPtr);
-		dataPtr = rttiReadElem(mRequiresDepthClear, dataPtr);
-		dataPtr = rttiReadElem(mRequiresStencilClear, dataPtr);
-		dataPtr = rttiReadElem(mClearColor, dataPtr);
-		dataPtr = rttiReadElem(mDepthClearValue, dataPtr);
-		dataPtr = rttiReadElem(mStencilClearValue, dataPtr);
+		dataPtr = rttiReadElem(mClearFlags, dataPtr);
+		dataPtr = rttiReadElem(mClearColorValue, dataPtr);
+		dataPtr = rttiReadElem(mClearDepthValue, dataPtr);
+		dataPtr = rttiReadElem(mClearStencilValue, dataPtr);
 
 		SPtr<RenderTarget>* rtPtr = (SPtr<RenderTarget>*)dataPtr;
 		mTarget = *rtPtr;

+ 79 - 88
Source/BansheeCore/RenderAPI/BsViewport.h

@@ -16,84 +16,75 @@ namespace bs
 	 *  @{
 	 */
 
+	/** Flags that determine which portion of the viewport to clear. */
+	enum BS_SCRIPT_EXPORT(n:ClearFlags) class ClearFlagBits
+	{
+		None,
+		Color = 1 << 0,
+		Depth = 1 << 1,
+		Stencil = 1 << 2
+	};
+
+	typedef Flags<ClearFlagBits> ClearFlags;
+	BS_FLAGS_OPERATORS(ClearFlagBits)
+
 	/**
-	 * Viewport provides you with a way to render to only a part of a RenderTarget. It also allows you to set up 
-	 * color/depth/stencil clear values for that specific region.
+	 * Viewport determines to which RenderTarget should rendering be performed. It allows you to render to a sub-region of the
+	 * target by specifying the area rectangle, and allows you to set up color/depth/stencil clear values for that specific region.
 	 */
 	class BS_CORE_EXPORT ViewportBase
-    {
-    public:       
+	{
+	public:
 		virtual ~ViewportBase() { }
 
-        /**	Gets the normalized x coordinate of the viewport, in [0, 1] range. */
-        float getNormalizedX() const { return mNormArea.x; }
-
-        /**	Gets the normalized y coordinate of the viewport, in [0, 1] range. */
-        float getNormalizedY() const { return mNormArea.y; }
-
-        /**	Gets the normalized width of the viewport, in [0, 1] range. */
-        float getNormalizedWidth() const { return mNormArea.width; }
-
-		/**	Gets the normalized height of the viewport, in [0, 1] range.  */
-        float getNormalizedHeight() const { return mNormArea.height; }
+		/** Determines the area that the viewport covers. Coordinates are in normalized [0, 1] range. */
+		BS_SCRIPT_EXPORT(n:Area,pr:setter)
+		void setArea(const Rect2& area);
 
-        /**	Gets the actual x coordinate of the viewport in pixels, in [0, RenderTargetWidth] range. */
-		INT32 getX() const;
+		/** @copydoc setArea() */
+		BS_SCRIPT_EXPORT(n:Area,pr:getter)
+		Rect2 getArea() const { return mNormArea; }
 
-        /**	Gets the actual y coordinate of the viewport in pixels, in [0, RenderTargetHeight] range. */
-		INT32 getY() const;
+		/**	Returns the area of the render target covered by the viewport, in pixels. */
+		BS_SCRIPT_EXPORT(n:PixelArea,pr:getter)
+		Rect2I getPixelArea() const;
 
-		/**	Gets the actual width coordinate of the viewport in pixels, in [0, RenderTargetWidth] range. */
-		INT32 getWidth() const;
+		/** Determines which portions of the render target should be cleared before rendering to this viewport is performed. */
+		BS_SCRIPT_EXPORT(n:ClearFlags,pr:setter)
+		void setClearFlags(ClearFlags flags);
 
-		/**	Gets the actual height coordinate of the viewport in pixels, in [0, RenderTargetHeight] range. */
-		INT32 getHeight() const;
-               
-        /**
-         * Changes the area that the viewport covers.
-         *
-         * @note	Viewport coordinates are normalized in [0, 1] range.
-         */
-        void setArea(float x, float y, float width, float height);
-
-		/**	Returns actual area of the viewport, in pixels. */
-		Rect2I getArea() const;
-
-		/**
-		 * Returns the normalized area of the viewport.
-		 *
-		 * @note	Viewport coordinates are normalized in [0, 1] range.
-		 */
-		Rect2 getNormArea() const { return mNormArea; }
-
-		/**
-		 * Activates or deactivates clears for color, depth or stencil buffers. Buffers will be cleared before rendering 
-		 * to this viewport is performed.
-		 */
-		void setRequiresClear(bool colorClear, bool depthClear, bool stencilClear);
+		/** @copydoc setClearFlags() */
+		BS_SCRIPT_EXPORT(n:ClearFlags,pr:getter)
+		ClearFlags getClearFlags() const { return mClearFlags; }
 
 		/**	Sets values to clear color, depth and stencil buffers to. */
 		void setClearValues(const Color& clearColor, float clearDepth = 0.0f, UINT16 clearStencil = 0);
 
-		/** Returns the color to clear the viewport color buffers to. */
-		const Color& getClearColor() const { return mClearColor; }
+		/** Determines the color to clear the viewport to before rendering, if color clear is enabled. */
+		BS_SCRIPT_EXPORT(n:ClearColor,pr:setter)
+		void setClearColorValue(const Color& color);
 
-		/**	Returns the value to clear the viewport depth buffers to. */
-		float getClearDepthValue() const { return mDepthClearValue; }
+		/** @copydoc setClearColorValue() */
+		BS_SCRIPT_EXPORT(n:ClearColor,pr:getter)
+		const Color& getClearColorValue() const { return mClearColorValue; }
 
-		/**	Returns the value to clear the viewport stencil buffer to. */
-		UINT16 getClearStencilValue() const { return mStencilClearValue; }
+		/** Determines the value to clear the depth buffer to before rendering, if depth clear is enabled. */
+		BS_SCRIPT_EXPORT(n:ClearDepth,pr:setter)
+		void setClearDepthValue(float depth);
 
-		/**	Returns true if viewport requires color clear before rendering. */
-		bool getRequiresColorClear() const { return mRequiresColorClear; }
+		/** @copydoc setClearDepthValue() */
+		BS_SCRIPT_EXPORT(n:ClearDepth,pr:getter)
+		float getClearDepthValue() const { return mClearDepthValue; }
 
-		/**	Returns true if viewport requires depth clear before rendering. */
-		bool getRequiresDepthClear() const { return mRequiresDepthClear; }
+		/** Determines the value to clear the stencil buffer to before rendering, if stencil clear is enabled. */
+		BS_SCRIPT_EXPORT(n:ClearStencil,pr:setter)
+		void setClearStencilValue(UINT16 value);
 
-		/**	Returns true if viewport requires stencil clear before rendering. */
-		bool getRequiresStencilClear() const { return mRequiresStencilClear; }
+		/** @copydoc setClearStencilValue() */
+		BS_SCRIPT_EXPORT(n:ClearStencil,pr:getter)
+		UINT16 getClearStencilValue() const { return mClearStencilValue; }
 
-    protected:
+	protected:
 		ViewportBase(float x = 0.0f, float y = 0.0f, float width = 1.0f, float height = 1.0f);
 
 		/** 
@@ -110,16 +101,13 @@ namespace bs
 
 		Rect2 mNormArea;
 
-		bool mRequiresColorClear;
-		bool mRequiresDepthClear;
-		bool mRequiresStencilClear;
-
-		Color mClearColor;
-		float mDepthClearValue;
-		UINT16 mStencilClearValue;
+		ClearFlags mClearFlags;
+		Color mClearColorValue;
+		float mClearDepthValue;
+		UINT16 mClearStencilValue;
 
 		static const Color DEFAULT_CLEAR_COLOR;
-    };
+	};
 
 	/** @} */
 
@@ -128,28 +116,31 @@ namespace bs
 	 */
 
 	/** @copydoc ViewportBase */
-	class BS_CORE_EXPORT Viewport : public IReflectable, public CoreObject, public ViewportBase
-    {
-    public:       
-        /**	Returns the render target the viewport is associated with. */
-        SPtr<RenderTarget> getTarget() const { return mTarget; }
-
-		/**	Sets the render target the viewport will be associated with. */
+	class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) Viewport : public IReflectable, public CoreObject, public ViewportBase
+	{
+	public:
+		/**	Determines the render target the viewport is associated with. */
+		BS_SCRIPT_EXPORT(n:Target,pr:setter)
 		void setTarget(const SPtr<RenderTarget>& target);
 
+		/** @copydoc setTarget() */
+		BS_SCRIPT_EXPORT(n:Target,pr:getter)
+		SPtr<RenderTarget> getTarget() const { return mTarget; }
+
 		/**	Retrieves a core implementation of a viewport usable only from the core thread. */
 		SPtr<ct::Viewport> getCore() const;
 
-	    /**
-         * Creates a new viewport.
-         *
-         * @note	Viewport coordinates are normalized in [0, 1] range.
-         */	
+		/**
+		 * Creates a new viewport.
+		 *
+		 * @note	Viewport coordinates are normalized in [0, 1] range.
+		 */
+		BS_SCRIPT_EXPORT(ec:Viewport)
 		static SPtr<Viewport> create(const SPtr<RenderTarget>& target, float x = 0.0f, float y = 0.0f, 
 			float width = 1.0f, float height = 1.0f);
 
-    protected:
-        Viewport(const SPtr<RenderTarget>& target, float x = 0.0f, float y = 0.0f, float width = 1.0f, float height = 1.0f);
+	protected:
+		Viewport(const SPtr<RenderTarget>& target, float x = 0.0f, float y = 0.0f, float width = 1.0f, float height = 1.0f);
 
 		/** @copydoc ViewportBase::_markCoreDirty */
 		void _markCoreDirty() override;
@@ -169,7 +160,7 @@ namespace bs
 		/** @copydoc CoreObject::createCore */
 		SPtr<ct::CoreObject> createCore() const override;
 
-        SPtr<RenderTarget> mTarget;
+		SPtr<RenderTarget> mTarget;
 
 		/************************************************************************/
 		/* 								RTTI		                     		*/
@@ -182,7 +173,7 @@ namespace bs
 		friend class ViewportRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		RTTITypeBase* getRTTI() const override;
-    };
+	};
 
 	/** @} */
 
@@ -194,9 +185,9 @@ namespace bs
 
 	/** @copydoc ViewportBase */
 	class BS_CORE_EXPORT Viewport : public CoreObject, public ViewportBase
-    {
-    public:       
-        /**	Returns the render target the viewport is associated with. */
+	{
+	public:
+		/**	Returns the render target the viewport is associated with. */
 		SPtr<RenderTarget> getTarget() const { return mTarget; }
 
 		/**	Sets the render target the viewport will be associated with. */
@@ -206,7 +197,7 @@ namespace bs
 		static SPtr<Viewport> create(const SPtr<RenderTarget>& target, float x = 0.0f, float y = 0.0f, 
 			float width = 1.0f, float height = 1.0f);
 
-    protected:
+	protected:
 		friend class bs::Viewport;
 
 		Viewport(const SPtr<RenderTarget>& target, float x = 0.0f, float y = 0.0f, float width = 1.0f, float height = 1.0f);
@@ -221,7 +212,7 @@ namespace bs
 		void syncToCore(const CoreSyncData& data) override;
 
 		SPtr<RenderTarget> mTarget;
-    };
+	};
 
 	/** @} */
 		}

+ 2 - 2
Source/BansheeCore/Renderer/BsCamera.cpp

@@ -722,7 +722,7 @@ namespace bs
 
 	Rect2I Camera::getViewportRect() const
 	{
-		return mViewport->getArea();
+		return mViewport->getPixelArea();
 	}
 
 	CoreSyncData Camera::syncToCore(FrameAlloc* allocator)
@@ -841,7 +841,7 @@ namespace bs
 
 	Rect2I Camera::getViewportRect() const
 	{
-		return mViewport->getArea();
+		return mViewport->getPixelArea();
 	}
 
 	void Camera::syncToCore(const CoreSyncData& data)

+ 127 - 123
Source/BansheeCore/Renderer/BsCamera.h

@@ -38,7 +38,7 @@ namespace bs
 	 * Camera determines how is world geometry projected onto a 2D surface. You may position and orient it in space, set
 	 * options like aspect ratio and field or view and it outputs view and projection matrices required for rendering.
 	 *
-	 * This class contains funcionality common to both core and non-core versions of the camera.
+	 * @note	This class contains funcionality common to both core and non-core versions of the camera.
 	 */
 	class BS_CORE_EXPORT CameraBase
 	{
@@ -46,42 +46,36 @@ namespace bs
 		virtual ~CameraBase() { }
 
 		/**
-		 * Sets the camera horizontal field of view. This determines how wide the camera viewing angle is along the
+		 * Determines the camera horizontal field of view. This determines how wide the camera viewing angle is along the
 		 * horizontal axis. Vertical FOV is calculated from the horizontal FOV and the aspect ratio.
 		 */
 		virtual void setHorzFOV(const Radian& fovy);
 
-		/**	Retrieves the camera horizontal field of view. */
+		/** @copydoc setHorzFOV() */
 		virtual const Radian& getHorzFOV() const;
 
 		/**
-		 * Sets the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane will
+		 * Determines the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane will
 		 * not be rendered. Decreasing this value decreases depth buffer precision.
 		 */
 		virtual void setNearClipDistance(float nearDist);
 
-		/**
-		 * Retrieves the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane
-		 * will not be rendered. Decreasing this value decreases depth buffer precision.
-		 */
+		/** @copydoc setNearClipDistance() */
 		virtual float getNearClipDistance() const;
 
 		/**
-		 * Sets the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane will
+		 * Determines the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane will
 		 * not be rendered. Increasing this value decreases depth buffer precision.
 		 */
 		virtual void setFarClipDistance(float farDist);
 
-		/**
-		 * Retrieves the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane
-		 * will not be rendered. Increasing this value decreases depth buffer precision.
-		 */
+		/** @copydoc setFarClipDistance() */
 		virtual float getFarClipDistance() const;
 
-		/**	Sets the current viewport aspect ratio (width / height). */
+		/**	Determines the current viewport aspect ratio (width / height). */
 		virtual void setAspectRatio(float ratio);
 
-		/**	Returns current viewport aspect ratio (width / height). */
+		/** @copydoc setAspectRatio() */
 		virtual float getAspectRatio() const;
 
 		/**	Sets camera world space position. */
@@ -139,38 +133,23 @@ namespace bs
 		 */
 		virtual const Matrix4& getProjectionMatrixRS() const;
 
-		/** 
-		 * Returns the inverse of the render-system specific projection matrix.
-		 *
-		 * @see		getProjectionMatrixRS
-		 */
+		/** Returns the inverse of the render-system specific projection matrix. See getProjectionMatrixRS(). */
 		virtual const Matrix4& getProjectionMatrixRSInv() const;
 
 		/** 
 		 * Returns the standard projection matrix that determines how are 3D points projected to two dimensions. Returned
-		 * matrix is standard following right-hand rules and depth range of [-1, 1]. 
-		 *
-		 * @note	
-		 * Different render systems will expect different projection matrix layouts, in which case use 
-		 * getProjectionMatrixRS().
+		 * matrix is standard following right-hand rules and depth range of [-1, 1]. In case you need a render-system specific
+		 * projection matrix call getProjectionMatrixRS().
 		 */
 		virtual const Matrix4& getProjectionMatrix() const;
 
-		/** 
-		 * Returns the inverse of the projection matrix.
-		 *
-		 * @see		getProjectionMatrix
-		 */
+		/** Returns the inverse of the projection matrix. See getProjectionMatrix(). */
 		virtual const Matrix4& getProjectionMatrixInv() const;
 
 		/** Gets the camera view matrix. Used for positioning/orienting the camera. */
 		virtual const Matrix4& getViewMatrix() const;
 
-		/** 
-		 * Returns the inverse of the view matrix.
-		 *
-		 * @see		getViewMatrix
-		 */
+		/** Returns the inverse of the view matrix. See getViewMatrix(). */
 		virtual const Matrix4& getViewMatrixInv() const;
 
 		/** 
@@ -202,15 +181,12 @@ namespace bs
 		const AABox& getBoundingBox() const;
 
 		/**
-		 * Sets the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a 
+		 * Determines the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a 
 		 * 2D plane.
 		 */
 		virtual void setProjectionType(ProjectionType pt);
 
-		/**
-		 * Returns the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a
-		 * 2D plane.
-		 */
+		/** @copydoc setProjectionType() */
 		virtual ProjectionType getProjectionType() const;
 
 		/**
@@ -226,64 +202,46 @@ namespace bs
 		virtual void setOrthoWindow(float w, float h);
 
 		/**
-		 * Sets the orthographic window height, for use with orthographic rendering only. 
-		 *
-		 * @param[in]	h	Height of the window in world units.
-		 *
-		 * @note	The width of the window will be calculated from the aspect ratio. 
+		 * Determines the orthographic window height, for use with orthographic rendering only. The width of the window
+		 * will be calculated from the aspect ratio. Value is specified in world units.
 		 */
 		virtual void setOrthoWindowHeight(float h);
 
-		/**
-		 * Sets the orthographic window width, for use with orthographic rendering only. 
-		 *
-		 * @param[in]	w	Width of the window in world units.
-		 *
-		 * @note	The height of the window will be calculated from the aspect ratio. 
-		 */
-		virtual void setOrthoWindowWidth(float w);
-
-		/** Gets the orthographic window width in world units, for use with orthographic rendering only. */
+		/** @copydoc setOrthoWindowHeight() */
 		virtual float getOrthoWindowHeight() const;
 
 		/**
-		 * Gets the orthographic window width in world units, for use with orthographic rendering only. 
-		 *
-		 * @note	This is calculated from the orthographic height and the aspect ratio.
+		 * Determines the orthographic window width, for use with orthographic rendering only. The height of the window
+		 * will be calculated from the aspect ratio. Value is specified in world units.
 		 */
-		virtual float getOrthoWindowWidth() const;
+		virtual void setOrthoWindowWidth(float w);
 
-		/**
-		 * Gets a priority that determines in which orders the cameras are rendered. This only applies to cameras rendering
-		 * to the same render target. 
-		 */
-		INT32 getPriority() const { return mPriority; }
+		/** @copydoc setOrthoWindowWidth() */
+		virtual float getOrthoWindowWidth() const;
 
 		/**
-		 * Sets a priority that determines in which orders the cameras are rendered. This only applies to cameras rendering
-		 * to the same render target. 
-		 *
-		 * @param[in]	priority	The priority. Higher value means the camera will be rendered sooner.
+		 * Determines a priority that determines in which orders the cameras are rendered. This only applies to cameras rendering
+		 * to the same render target. Higher value means the camera will be rendered sooner. 
 		 */
 		void setPriority(INT32 priority) { mPriority = priority; _markCoreDirty(); }
 
-		/**	Retrieves layer bitfield that is used when determining which object should the camera render. */
-		UINT64 getLayers() const { return mLayers; }
+		/** @copydoc setPriority() */
+		INT32 getPriority() const { return mPriority; }
 
-		/**	Sets layer bitfield that is used when determining which object should the camera render. */
+		/**	Determines 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; }
+		/** @copydoc setLayers() */
+		UINT64 getLayers() const { return mLayers; }
 
 		/** 
-		 * Enables or disables multi-sampled anti-aliasing. Set to zero or one to disable, or to the required number of
-		 * samples to enable.
+		 * Determines number of samples to use when rendering to this camera. Values larger than 1 will enable MSAA
+		 * rendering.
 		 */
 		void setMSAACount(UINT32 count) { mMSAA = count; _markCoreDirty(); }
 
-		/** @copydoc setRenderSettings() */
-		const SPtr<RenderSettings>& getRenderSettings() const { return mRenderSettings; }
+		/** @copydoc setMSAACount() */
+		UINT32 getMSAACount() const { return mMSAA; }
 
 		/** 
 		 * Settings that control rendering for this view. They determine how will the renderer process this view, which
@@ -291,25 +249,40 @@ namespace bs
 		 */
 		void setRenderSettings(const SPtr<RenderSettings>& settings) { mRenderSettings = settings; _markCoreDirty(CameraDirtyFlag::RenderSettings); }
 
+		/** @copydoc setRenderSettings() */
+		const SPtr<RenderSettings>& getRenderSettings() const { return mRenderSettings; }
+
 		/**
-		 * Converts a point in world space to screen coordinates (in pixels corresponding to the render target attached to
-		 * the camera).
+		 * Converts a point in world space to screen coordinates.
+		 * 
+		 * @param[in]	worldPoint		3D point in world space.
+		 * @return						2D point on the render target attached to the camera's viewport, in pixels.
 		 */
 		Vector2I worldToScreenPoint(const Vector3& worldPoint) const;
 
-		/**	Converts a point in world space to normalized device coordinates (in [-1, 1] range). */
+		/**	
+		 * Converts a point in world space to normalized device coordinates. 
+		 *
+		 * @param[in]	worldPoint		3D point in world space.
+		 * @return						2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.
+		 */
 		Vector2 worldToNdcPoint(const Vector3& worldPoint) const;
 
-		/** Converts a point in world space to point relative to camera's coordinate system (view space). */
+		/** 
+		 * Converts a point in world space to view space coordinates. 
+		 * 
+		 * @param[in]	worldPoint		3D point in world space.
+		 * @return						3D point relative to the camera's coordinate system.
+		 */
 		Vector3 worldToViewPoint(const Vector3& worldPoint) const;
 
 		/**
-		 * Converts a point in screen space (pixels corresponding to render target attached to the camera) to a point in
-		 * world space.
+		 * Converts a point in screen space to a point in world space.
 		 *
-		 * @param[in]	screenPoint	Point to transform.
+		 * @param[in]	screenPoint	2D point on the render target attached to the camera's viewport, in pixels.
 		 * @param[in]	depth		Depth to place the world point at, in world coordinates. The depth is applied to the 
 		 *							vector going from camera origin to the point on the near plane.
+		 * @return					3D point in world space.
 		 */
 		Vector3 screenToWorldPoint(const Vector2I& screenPoint, float depth = 0.5f) const;
 
@@ -319,78 +292,112 @@ namespace bs
 		*
 		* @param[in]	screenPoint	Point to transform.
 		* @param[in]	deviceDepth	Depth to place the world point at, in normalized device coordinates.
+		* @return					3D point in world space.
 		*/
 		Vector3 screenToWorldPointDeviceDepth(const Vector2I& screenPoint, float deviceDepth = 0.5f) const;
 
 		/**
-		 * Converts a point in screen space (pixels corresponding to render target attached to the camera) to a point
-		 * relative to camera's coordinate system (view space).
+		 * Converts a point in screen space to a point in view space.
 		 *
-		 * @param[in]	screenPoint	Point to transform.
-		 * @param[in]	depth		Depth to place the world point at. The depth is applied to the vector going from camera
-		 *							origin to the point on the near plane.
+		 * @param[in]	screenPoint	2D point on the render target attached to the camera's viewport, in pixels.
+		 * @param[in]	depth		Depth to place the world point at, in device depth. The depth is applied to the 
+		 *							vector going from camera origin to the point on the near plane.
+		 * @return					3D point relative to the camera's coordinate system.
 		 */
 		Vector3 screenToViewPoint(const Vector2I& screenPoint, float depth = 0.5f) const;
 
 		/**
-		 * Converts a point in screen space (pixels corresponding to render target attached to the camera) to normalized 
-		 * device coordinates (in [-1, 1] range).
+		 * Converts a point in screen space to normalized device coordinates.
+		 *
+		 * @param[in]	screenPoint		2D point on the render target attached to the camera's viewport, in pixels.
+		 * @return						2D point in normalized device coordinates ([-1, 1] range), relative to 
+		 *								the camera's viewport.
 		 */
 		Vector2 screenToNdcPoint(const Vector2I& screenPoint) const;
 
-		/** Converts a point relative to camera's coordinate system (view space) into a point in world space. */
+		/** 
+		 * Converts a point in view space to world space.
+		 *
+		 * @param[in]	viewPoint		3D point relative to the camera's coordinate system.
+		 * @return						3D point in world space.
+		 */
 		Vector3 viewToWorldPoint(const Vector3& viewPoint) const;
 
-		/**
-		 * Converts a point relative to camera's coordinate system (view space) into a point in screen space (pixels 
-		 * corresponding to render target attached to the camera).
+		/** 
+		 * Converts a point in view space to screen space.
+		 *
+		 * @param[in]	viewPoint		3D point relative to the camera's coordinate system.
+		 * @return						2D point on the render target attached to the camera's viewport, in pixels.
 		 */
 		Vector2I viewToScreenPoint(const Vector3& viewPoint) const;
 
-		/**
-		 * Converts a point relative to camera's coordinate system (view space) into normalized device coordinates 
-		 * (in [-1, 1] range).
+		/** 
+		 * Converts a point in view space to normalized device coordinates.
+		 *
+		 * @param[in]	viewPoint		3D point relative to the camera's coordinate system.
+		 * @return						2D point in normalized device coordinates ([-1, 1] range), relative to 
+		 *								the camera's viewport.
 		 */
 		Vector2 viewToNdcPoint(const Vector3& viewPoint) const;
 
 		/**
-		 * Converts a point in normalized device coordinates ([-1, 1] range) to a point in world space.
+		 * Converts a point in normalized device coordinates to world space.
 		 *
-		 * @param[in]	ndcPoint	Point to transform.
-		 * @param[in]	depth		Depth to place the world point at. The depth is applied to the vector going from camera
-		 *							origin to the point on the near plane.
+		 * @param[in]	ndcPoint	2D point in normalized device coordinates ([-1, 1] range), relative to 
+		 *							the camera's viewport.
+		 * @param[in]	depth		Depth to place the world point at. The depth is applied to the
+		 *							vector going from camera origin to the point on the near plane.
+		 * @return					3D point in world space.
 		 */
 		Vector3 ndcToWorldPoint(const Vector2& ndcPoint, float depth = 0.5f) const;
 
 		/**
-		 * Converts a point in normalized device coordinates ([-1, 1] range) to a point relative to camera's coordinate system
-		 * (view space).
+		 * Converts a point in normalized device coordinates to view space.
 		 *
-		 * @param[in]	ndcPoint	Point to transform.
-		 * @param[in]	depth		Depth to place the world point at. The depth is applied to the vector going from camera
-		 *							origin to the point on the near plane.
+		 * @param[in]	ndcPoint	2D point in normalized device coordinates ([-1, 1] range), relative to 
+		 *							the camera's viewport.
+		 * @param[in]	depth		Depth to place the world point at. The depth is applied to the
+		 *							vector going from camera origin to the point on the near plane.
+		 * @return					3D point relative to the camera's coordinate system.
 		 */
 		Vector3 ndcToViewPoint(const Vector2& ndcPoint, float depth = 0.5f) const;
 
 		/**
-		 * Converts a point in normalized device coordinates ([-1, 1] range) to a point in screen space (pixels corresponding
-		 * to render target attached to the camera).
+		 * Converts a point in normalized device coordinates to screen space.
+		 *
+		 * @param[in]	ndcPoint	2D point in normalized device coordinates ([-1, 1] range), relative to 
+		 *							the camera's viewport.
+		 * @return					2D point on the render target attached to the camera's viewport, in pixels.
 		 */
 		Vector2I ndcToScreenPoint(const Vector2& ndcPoint) const;
 
 		/**
-		 * Converts a point in screen space (pixels corresponding to render target attached to the camera) to a ray in world
-		 * space originating at the selected point on the camera near plane.
+		 * Converts a point in screen space to a ray in world space.
+		 *
+		 * @param[in]	screenPoint		2D point on the render target attached to the camera's viewport, in pixels.
+		 * @return						Ray in world space, originating at the selected point on the camera near plane.
 		 */
 		Ray screenPointToRay(const Vector2I& screenPoint) const;
 
-		/**	Projects a point from view to normalized device space. */
+		/**	
+		 * Projects a point in view space to normalized device coordinates. Similar to viewToNdcPoint() but preserves
+		 * the depth component.
+		 *
+		 * @param[in]	point			3D point relative to the camera's coordinate system.
+		 * @return						3D point in normalized device coordinates ([-1, 1] range), relative to the 
+		 *								camera's viewport. Z value range depends on active render API.
+		 */
 		Vector3 projectPoint(const Vector3& point) const;
 
-		/**	Un-projects a point in normalized device space to view space. */
+		/**	Un-projects a point in normalized device space to view space.
+		 *
+		 * @param[in]	point			3D point in normalized device coordinates ([-1, 1] range), relative to the 
+		 *								camera's viewport. Z value range depends on active render API.
+		 * @return						3D point relative to the camera's coordinate system.
+		 */
 		Vector3 unprojectPoint(const Vector3& point) const;
 
-        static const float INFINITE_FAR_PLANE_ADJUST; /**< Small constant used to reduce far plane projection to avoid inaccuracies. */
+		static const float INFINITE_FAR_PLANE_ADJUST; /**< Small constant used to reduce far plane projection to avoid inaccuracies. */
 
 	protected:
 		CameraBase();
@@ -462,7 +469,7 @@ namespace bs
 		mutable bool mRecalcView : 1; /**< Should view matrix be recalculated. */
 		mutable float mLeft, mRight, mTop, mBottom; /**< Frustum extents. */
 		mutable AABox mBoundingBox; /**< Frustum bounding box. */
-     };
+	 };
 
 	/** @} */
 
@@ -472,8 +479,8 @@ namespace bs
 
 	/** @copydoc CameraBase */
 	class BS_CORE_EXPORT Camera : public IReflectable, public CoreObject, public CameraBase
-    {
-    public:
+	{
+	public:
 		/**	Returns the viewport used by the camera. */	
 		SPtr<Viewport> getViewport() const { return mViewport; }
 
@@ -481,14 +488,11 @@ namespace bs
 		 * Determines whether this is the main application camera. Main camera controls the final render surface that is
 		 * displayed to the user.
 		 */	
-		bool isMain() const { return mMain; }
-
-		/**
-		 * Marks or unmarks this camera as the main application camera. Main camera controls the final render surface that
-		 * is displayed to the user.
-		 */	
 		void setMain(bool main) { mMain = main; }
 
+		/** @copydoc setMain() */
+		bool isMain() const { return mMain; }
+
 		/** Retrieves an implementation of a camera handler usable only from the core thread. */
 		SPtr<ct::Camera> getCore() const;
 

+ 27 - 30
Source/BansheeCore/Renderer/BsLight.h

@@ -17,13 +17,13 @@ namespace bs
 	 */
 
 	/** Light type that determines how is light information parsed by the renderer and other systems. */
-	enum class LightType
+	enum BS_SCRIPT_EXPORT(m:Rendering) class LightType
 	{
 		Directional, 
 		Radial, 
 		Spot,
 
-		Count // Keep at end
+		Count			BS_SCRIPT_EXPORT(ex:true) // Keep at end
 	};
 
 	/**	Signals which portion of a light is dirty. */
@@ -64,18 +64,18 @@ namespace bs
 		void setRotation(const Quaternion& rotation) 
 			{ mRotation = rotation; _markCoreDirty(LightDirtyFlag::Transform); updateBounds(); }
 
-		/**	Returns the type of the light. */
+		/**	Determines the type of the light. */
 		LightType getType() const { return mType; }
 
-		/**	Changes the type of the light. */
+		/** @copydoc getType() */
 		void setType(LightType type) { mType = type; _markCoreDirty(); updateBounds(); }
 
-		/**	Checks does this light cast shadows when rendered. */
-		bool getCastsShadow() const { return mCastsShadows; }
-
-		/**	Sets whether this light will cast shadows when rendered. */
+		/**	Determines does this light cast shadows when rendered. */
 		void setCastsShadow(bool castsShadow) { mCastsShadows = castsShadow; _markCoreDirty(); }
 
+		/** @copydoc setCastsShadow */
+		bool getCastsShadow() const { return mCastsShadows; }
+
 		/** 
 		 * Shadow bias determines shadow accuracy. Low bias values mean that shadows start closer near their caster surface
 		 * but will result in more shadowing artifacts (shadow acne). Larger values reduce shadow acne but caster may appear
@@ -88,14 +88,11 @@ namespace bs
 		/** @copydoc setShadowBias() */
 		float getShadowBias() const { return mShadowBias; }
 
-		/**	Returns the color emitted from the light. */
-		Color getColor() const { return mColor; }
-
-		/**	Sets the color emitted from the light. */
+		/** Determines the color emitted by the light. */
 		void setColor(const Color& color) { mColor = color; _markCoreDirty(); }
 
-		/**	@see setAttenuationRadius */
-		float getAttenuationRadius() const { return mAttRadius; }
+		/** @copydoc setColor() */
+		Color getColor() const { return mColor; }
 
 		/**
 		 * Range at which the light contribution fades out to zero. Use setUseAutoAttenuation to provide a radius
@@ -104,8 +101,8 @@ namespace bs
 		 */
 		void setAttenuationRadius(float radius);
 
-		/**	@see setSourceRadius */
-		float getSourceRadius() const { return mSourceRadius; }
+		/**	@copydoc setAttenuationRadius */
+		float getAttenuationRadius() const { return mAttRadius; }
 
 		/**
 		 * Radius of the light source. If non-zero then this light represents an area light, otherwise it is a punctual
@@ -120,8 +117,8 @@ namespace bs
 		 */
 		void setSourceRadius(float radius);
 
-		/** @see setUseAutoAttenuation */
-		bool getUseAutoAttenuation() const { return mAutoAttenuation; }
+		/**	@copydoc setSourceRadius */
+		float getSourceRadius() const { return mSourceRadius; }
 
 		/** 
 		 * If enabled the attenuation radius will automatically be controlled in order to provide reasonable light radius, 
@@ -129,8 +126,8 @@ namespace bs
 		 */
 		void setUseAutoAttenuation(bool enabled);
 
-		/** @see setIntensity */
-		float getIntensity() const { return mIntensity; }
+		/** @copydoc setUseAutoAttenuation */
+		bool getUseAutoAttenuation() const { return mAutoAttenuation; }
 
 		/**
 		 * Determines the power of the light source. This will be luminous flux for radial & spot lights, 
@@ -139,25 +136,25 @@ namespace bs
 		 */
 		void setIntensity(float intensity);
 
-		/**	Gets the total angle covered by a spot light. */
-		Degree getSpotAngle() const { return mSpotAngle; }
+		/** @copydoc setIntensity */
+		float getIntensity() const { return mIntensity; }
 
-		/**	Sets the total angle covered by a spot light. */
+		/**	Determines the total angle covered by a spot light. */
 		void setSpotAngle(const Degree& spotAngle) { mSpotAngle = spotAngle; _markCoreDirty(); updateBounds(); }
 
-		/**
-		 * Gets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
-		 * starts quadratically falling off as the angle approaches the total spot angle.
-		 */
-		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
+		/** @copydoc setSpotAngle */
+		Degree getSpotAngle() const { return mSpotAngle; }
 
 		/**
-		 * Sets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
+		 * Determines the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
 		 * starts quadratically falling off as the angle approaches the total spot angle.
 		 */
 		void setSpotFalloffAngle(const Degree& spotFallofAngle) 
 		{ mSpotFalloffAngle = spotFallofAngle; _markCoreDirty(); updateBounds(); }
 
+		/** @copydoc setSpotFalloffAngle */
+		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
+
 		/**	Returns world space bounds that completely encompass the light's area of influence. */
 		Sphere getBounds() const { return mBounds; }
 
@@ -227,7 +224,7 @@ namespace bs
 
 	namespace ct { class Light; }
 
-	/** Illuminates a portion of the scene covered by a light. */
+	/** Illuminates a portion of the scene covered by the light. */
 	class BS_CORE_EXPORT Light : public IReflectable, public CoreObject, public LightBase
 	{
 	public:

+ 72 - 8
Source/BansheeCore/Renderer/BsRenderSettings.h

@@ -13,8 +13,9 @@ namespace bs
 	 */
 
 	/** Settings that control automatic exposure (eye adaptation) post-process. */
-	struct BS_CORE_EXPORT AutoExposureSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) AutoExposureSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		AutoExposureSettings();
 
 		/**
@@ -22,6 +23,7 @@ namespace bs
 		 * average brightness of the scene. Any luminance value below this value will not be included in the histogram and
 		 * ignored in scene brightness calculations. In log2 units (-8 = 1/256). In the range [-16, 0].
 		 */
+		BS_SCRIPT_EXPORT()
 		float histogramLog2Min;
 
 		/**
@@ -29,6 +31,7 @@ namespace bs
 		 * average brightness of the scene. Any luminance value above this value will not be included in the histogram and
 		 * ignored in scene brightness calculations. In log2 units (4 = 16). In the range [0, 16].
 		 */
+		BS_SCRIPT_EXPORT()
 		float histogramLog2Max;
 
 		/**
@@ -38,6 +41,7 @@ namespace bs
 		 * 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].
 		 */
+		BS_SCRIPT_EXPORT()
 		float histogramPctLow;
 
 		/**
@@ -47,6 +51,7 @@ namespace bs
 		 * 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].
 		 */
+		BS_SCRIPT_EXPORT()
 		float histogramPctHigh;
 
 		/**
@@ -54,6 +59,7 @@ namespace bs
 		 * 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].
 		 */
+		BS_SCRIPT_EXPORT()
 		float minEyeAdaptation;
 
 		/**
@@ -61,18 +67,21 @@ namespace bs
 		 * 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].
 		 */
+		BS_SCRIPT_EXPORT()
 		float maxEyeAdaptation;
 
 		/**
 		 * Determines how quickly does the eye adaptation adjust to larger values. This affects how quickly does the
 		 * automatic exposure changes when the scene brightness increases. In range [0.01f, 20.0f]. 
 		 */
+		BS_SCRIPT_EXPORT()
 		float eyeAdaptationSpeedUp;
 
 		/**
 		 * Determines how quickly does the eye adaptation adjust to smaller values. This affects how quickly does the
 		 * automatic exposure changes when the scene brightness decreases. In range [0.01f, 20.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		float eyeAdaptationSpeedDown;
 
 		/************************************************************************/
@@ -85,41 +94,49 @@ namespace bs
 	};
 
 	/** Settings that control tonemap post-process. */
-	struct BS_CORE_EXPORT TonemappingSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) TonemappingSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		TonemappingSettings();
 
 		/**
 		 * Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright
 		 * areas of the image and allows you to reduce over-exposure.
 		 */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveShoulderStrength;
 
 		/**
 		 * Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of
 		 * the image.
 		 */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveLinearStrength;
 
 		/**
 		 * Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of
 		 * the image and allows you to control how quickly does the curve climb.
 		 */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveLinearAngle;
 
 		/**
 		 * Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Mostly affects dark areas
 		 * of the image and allows you to reduce under-exposure.
 		 */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveToeStrength;
 
 		/** Controls the toe (lower non-linear) section of the filmic curve. used for tonemapping. Affects low-range. */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveToeNumerator;
 
 		/** Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Affects low-range. */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveToeDenominator;
 
 		/** Controls the white point of the filmic curve used for tonemapping. Affects the entire curve. */
+		BS_SCRIPT_EXPORT()
 		float filmicCurveLinearWhitePoint;
 
 		/************************************************************************/
@@ -132,8 +149,9 @@ namespace bs
 	};
 
 	/** Settings that control white balance post-process. */
-	struct BS_CORE_EXPORT WhiteBalanceSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) WhiteBalanceSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		WhiteBalanceSettings();
 
 		/**
@@ -141,6 +159,7 @@ namespace bs
 		 *
 		 * Moves along the Planckian locus. In range [1500.0f, 15000.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		float temperature;
 
 		/**
@@ -150,6 +169,7 @@ namespace bs
 		 *
 		 * In range [-1.0f, 1.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		float tint;
 
 		/************************************************************************/
@@ -162,7 +182,7 @@ namespace bs
 	};
 
 	/** Settings that control color grading post-process. */
-	struct BS_CORE_EXPORT ColorGradingSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT() ColorGradingSettings : public IReflectable
 	{
 		ColorGradingSettings();
 
@@ -170,24 +190,28 @@ namespace bs
 		 * Saturation to be applied during color grading. Larger values increase vibrancy of the image.
 		 * In range [0.0f, 2.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		Vector3 saturation;
 
 		/**
 		 * Contrast to be applied during color grading. Larger values increase difference between light and dark areas of
 		 * the image. In range [0.0f, 2.0f]. 
 		 */
+		BS_SCRIPT_EXPORT()
 		Vector3 contrast;
 
 		/**
 		 * Gain to be applied during color grading. Simply increases all color values by an equal scale.
 		 * In range [0.0f, 2.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		Vector3 gain;
 
 		/**
 		 * Gain to be applied during color grading. Simply offsets all color values by an equal amount.
 		 * In range [-1.0f, 1.0f].
 		 */
+		BS_SCRIPT_EXPORT()
 		Vector3 offset;
 
 		/************************************************************************/
@@ -200,11 +224,13 @@ namespace bs
 	};
 
 	/** Settings that control screen space ambient occlusion. */
-	struct BS_CORE_EXPORT AmbientOcclusionSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) AmbientOcclusionSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		AmbientOcclusionSettings();
 
 		/** Enables or disabled the screen space ambient occlusion effect. */
+		BS_SCRIPT_EXPORT()
 		bool enabled;
 
 		/** 
@@ -213,6 +239,7 @@ namespace bs
 		 * quality or noise because of low sampling precision. Usually best to keep at around a meter, valid range
 		 * is roughly [0.05, 5.0].
 		 */
+		BS_SCRIPT_EXPORT()
 		float radius;
 
 		/**
@@ -220,24 +247,28 @@ namespace bs
 		 * details to be lost in areas where occlusion isn't high. Value is in millimeters. Usually best to keep at a few
 		 * dozen millimeters, valid range is roughly [0, 200].
 		 */
+		BS_SCRIPT_EXPORT()
 		float bias;
 
 		/**
 		 * Distance (in view space, in meters) after which AO starts fading out. The fade process will happen over the
 		 * range as specified by @p fadeRange.
 		 */
+		BS_SCRIPT_EXPORT()
 		float fadeDistance;
 
 		/**
 		 * Range (in view space, in meters) in which AO fades out from 100% to 0%. AO starts fading out after the distance
 		 * specified in @p fadeDistance.
 		 */
+		BS_SCRIPT_EXPORT()
 		float fadeRange;
 
 		/**
 		 * Linearly scales the intensity of the AO effect. Values less than 1 make the AO effect less pronounced, and vice
 		 * versa. Valid range is roughly [0.2, 2].
 		 */
+		BS_SCRIPT_EXPORT()
 		float intensity;
 
 		/**
@@ -245,12 +276,14 @@ namespace bs
 		 * control and will cause the darkening to ramp up exponentially. Valid range is roughly [1, 4], where 1 means no
 		 * extra darkening will occur.
 		 */
+		BS_SCRIPT_EXPORT()
 		float power;
 
 		/**
 		 * Quality level of generated ambient occlusion. In range [0, 4]. Higher levels yield higher quality AO at the cost
 		 * of performance.
 		 */
+		BS_SCRIPT_EXPORT()
 		UINT32 quality;
 
 		/************************************************************************/
@@ -263,46 +296,54 @@ namespace bs
 	};
 
 	/** Settings that control the depth-of-field effect. */
-	struct BS_CORE_EXPORT DepthOfFieldSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT() DepthOfFieldSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		DepthOfFieldSettings();
 
 		/** Enables or disables the depth of field effect. */
+		BS_SCRIPT_EXPORT()
 		bool enabled;
 
 		/** 
 		 * Distance from the camera at which the focal plane is located in. Objects at this distance will be fully in focus.
 		 */
+		BS_SCRIPT_EXPORT()
 		float focalDistance;
 		
 		/** 
 		 * Range within which the objects remain fully in focus. This range is applied relative to the focal distance. 
 		 * Only relevant if Gaussian depth of field is used as other methods don't use a constant in-focus range.
 		 */
+		BS_SCRIPT_EXPORT()
 		float focalRange;
 
 		/**
 		 * Determines the size of the range within which objects transition from focused to fully unfocused, at the near 
 		 * plane. Only relevant for Gaussian depth of field.
 		 */
+		BS_SCRIPT_EXPORT()
 		float nearTransitionRange;
 
 		/**
 		 * Determines the size of the range within which objects transition from focused to fully unfocused, at the far 
 		 * plane. Only relevant for Gaussian depth of field.
 		 */
+		BS_SCRIPT_EXPORT()
 		float farTransitionRange;
 
 		/** 
 		 * Determines the amount of blur to apply to fully unfocused objects that are closer to camera than the in-focus
 		 * zone. Set to zero to disable near-field blur. Only relevant for Gaussian depth of field.
 		 */
+		BS_SCRIPT_EXPORT()
 		float nearBlurAmount;
 
 		/** 
 		 * Determines the amount of blur to apply to fully unfocused objects that are farther away from camera than the
 		 * in-focus zone. Set to zero to disable far-field blur. Only relevant for Gaussian depth of field.
 		 */
+		BS_SCRIPT_EXPORT()
 		float farBlurAmount;
 
 		/************************************************************************/
@@ -322,11 +363,13 @@ namespace bs
 	 * for rougher (more glossy rather than mirror-like) surfaces. Those surfaces require a higher number of samples to
 	 * achieve the glossy look, so we instead fall back to refl. probes which are pre-filtered and can be quickly sampled.
 	 */
-	struct BS_CORE_EXPORT ScreenSpaceReflectionsSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) ScreenSpaceReflectionsSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		ScreenSpaceReflectionsSettings();
 
 		/** Enables or disables the SSR effect. */
+		BS_SCRIPT_EXPORT()
 		bool enabled;
 
 		/** 
@@ -334,15 +377,18 @@ namespace bs
 		 * better precision. This results in higher quality, as well as a higher performance requirement. Valid range is
 		 * [0, 4], default is 2.
 		 */
+		BS_SCRIPT_EXPORT()
 		UINT32 quality;
 
 		/** Intensity of the screen space reflections. Valid range is [0, 1]. Default is 1 (100%). */
+		BS_SCRIPT_EXPORT()
 		float intensity;
 
 		/** 
 		 * Roughness at which screen space reflections start fading out and become replaced with refl. probes. Valid range
 		 * is [0, 1]. Default is 0.8.
 		 */
+		BS_SCRIPT_EXPORT()
 		float maxRoughness;
 
 		/************************************************************************/
@@ -355,8 +401,9 @@ namespace bs
 	};
 	
 	/** Settings that control rendering for a specific camera (view). */
-	struct BS_CORE_EXPORT RenderSettings : public IReflectable
+	struct BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Rendering) RenderSettings : public IReflectable
 	{
+		BS_SCRIPT_EXPORT()
 		RenderSettings();
 		virtual ~RenderSettings() { }
 
@@ -367,6 +414,7 @@ namespace bs
 		 * manually adjust the automatic exposure. When automatic exposure is turned off you can use exposureScale to
 		 * manually set the exposure.
 		 */
+		BS_SCRIPT_EXPORT()
 		bool enableAutoExposure;
 
 		/**
@@ -374,6 +422,7 @@ namespace bs
 		 *
 		 * @see	enableAutoExposure
 		 */
+		BS_SCRIPT_EXPORT()
 		AutoExposureSettings autoExposure;
 
 		/**
@@ -386,6 +435,7 @@ namespace bs
 		 * If this is disabled, then color grading and white balancing will not be enabled either. Only relevant for HDR
 		 * images.
 		 */
+		BS_SCRIPT_EXPORT()
 		bool enableTonemapping;
 
 		/**
@@ -393,6 +443,7 @@ namespace bs
 		 *
 		 * @see	enableTonemapping
 		 */
+		BS_SCRIPT_EXPORT()
 		TonemappingSettings tonemapping;
 
 		/**
@@ -400,21 +451,27 @@ namespace bs
 		 * 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.
 		 */
+		BS_SCRIPT_EXPORT()
 		WhiteBalanceSettings whiteBalance;
 
 		/** Parameters used for customizing color grading. */
+		BS_SCRIPT_EXPORT()
 		ColorGradingSettings colorGrading;
 
 		/** Parameters used for customizing the depth of field effect. */
+		BS_SCRIPT_EXPORT()
 		DepthOfFieldSettings depthOfField;
 
 		/** Parameters used for customizing screen space ambient occlusion. */
+		BS_SCRIPT_EXPORT()
 		AmbientOcclusionSettings ambientOcclusion;
 
 		/** Parameters used for customizing screen space reflections. */
+		BS_SCRIPT_EXPORT()
 		ScreenSpaceReflectionsSettings screenSpaceReflections;
 
 		/** Enables the fast approximate anti-aliasing effect. */
+		BS_SCRIPT_EXPORT()
 		bool enableFXAA;
 
 		/**
@@ -422,6 +479,7 @@ namespace bs
 		 * yield brighter image. Allows you to customize exposure manually, applied on top of eye adaptation exposure (if
 		 * enabled). In range [-8, 8].
 		 */
+		BS_SCRIPT_EXPORT()
 		float exposureScale;
 
 		/**
@@ -429,6 +487,7 @@ namespace bs
 		 * 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.
 		 */
+		BS_SCRIPT_EXPORT()
 		float gamma;
 
 		/** 
@@ -436,18 +495,22 @@ namespace bs
 		 * range of values. The stored light is then converted into visible color range using exposure and a tone mapping 
 		 * operator.
 		 */
+		BS_SCRIPT_EXPORT()
 		bool enableHDR;
 
 		/** 
 		 * Determines if scene objects will be lit by lights. If disabled everything will be rendered using their albedo
 		 * texture with no lighting applied.
 		 */
+		BS_SCRIPT_EXPORT()
 		bool enableLighting;
 
 		/** Determines if shadows cast by lights should be rendered. Only relevant if lighting is turned on. */
+		BS_SCRIPT_EXPORT()
 		bool enableShadows;
 
 		/** Determines if indirect lighting (e.g. from light probes or the sky) is rendered. */
+		BS_SCRIPT_EXPORT()
 		bool enableIndirectLighting;
 
 		/** 
@@ -455,6 +518,7 @@ namespace bs
 		 * depth buffer or multi-sampled render targets and will not render any scene objects. This can improve performance
 		 * and memory usage for overlay-only views. 
 		 */
+		BS_SCRIPT_EXPORT()
 		bool overlayOnly;
 
 		/** @name Internal

+ 6 - 4
Source/BansheeCore/Utility/BsCommonTypes.h

@@ -354,10 +354,12 @@ namespace bs
 	};
 
 	/**	Projection type to use by the camera. */
-	enum ProjectionType
-	{
-		PT_ORTHOGRAPHIC, /**< Projection type where object size remains constant and parallel lines remain parallel. */
-		PT_PERSPECTIVE /**< Projection type that emulates human vision. Objects farther away appear smaller. */
+	enum BS_SCRIPT_EXPORT() ProjectionType
+	{ 
+		/** Projection type where object size remains constant and parallel lines remain parallel. */
+		PT_ORTHOGRAPHIC		BS_SCRIPT_EXPORT(n:Orthographic),
+		/** Projection type that emulates human vision. Objects farther away appear smaller. */
+		PT_PERSPECTIVE		BS_SCRIPT_EXPORT(n:Perspective)
 	};
 
 	/**	Contains data about a type used for GPU data parameters. */

+ 2 - 2
Source/BansheeEditor/EditorWindow/BsDockManager.cpp

@@ -1153,8 +1153,8 @@ namespace bs
 
 		SPtr<Viewport> viewport = mCamera->getViewport();
 
-		float invViewportWidth = 1.0f / (viewport->getWidth() * 0.5f);
-		float invViewportHeight = 1.0f / (viewport->getHeight() * 0.5f);
+		float invViewportWidth = 1.0f / (viewport->getPixelArea().width * 0.5f);
+		float invViewportHeight = 1.0f / (viewport->getPixelArea().height * 0.5f);
 
 		mMaterial->setFloat("invViewportWidth", invViewportWidth);
 		mMaterial->setFloat("invViewportHeight", invViewportHeight);

+ 2 - 2
Source/BansheeEditor/EditorWindow/BsDropDownWindow.cpp

@@ -40,7 +40,7 @@ namespace bs
 		SPtr<Viewport> viewport = camera->getViewport();
 		GUIPanel* captureHitBoxPanel = mGUI->getPanel()->addNewElement<GUIPanel>(std::numeric_limits<INT16>::max());
 		GUIDropDownHitBox* captureHitBox = GUIDropDownHitBox::create(true, false);
-		captureHitBox->setBounds(Rect2I(0, 0, viewport->getWidth(), viewport->getHeight()));
+		captureHitBox->setBounds(Rect2I(0, 0, viewport->getPixelArea().width, viewport->getPixelArea().height));
 		captureHitBoxPanel->addElement(captureHitBox);
 
 		setSize(width, height);
@@ -91,7 +91,7 @@ namespace bs
 
 	void DropDownWindow::setSize(UINT32 width, UINT32 height)
 	{
-		Rect2I availableBounds(0, 0, mGUI->getTarget()->getWidth(), mGUI->getTarget()->getHeight());
+		Rect2I availableBounds(0, 0, mGUI->getTarget()->getPixelArea().width, mGUI->getTarget()->getPixelArea().height);
 		DropDownAreaPlacement dropDownPlacement = DropDownAreaPlacement::aroundPosition(mPosition);
 
 		DropDownAreaPlacement::HorzDir horzDir;

+ 6 - 5
Source/BansheeEditor/GUI/BsGUIFloatField.cpp

@@ -91,19 +91,20 @@ namespace bs
 					INT32 xDiff = event.getPosition().x - mLastDragPos;
 
 					INT32 jumpAmount = 0;
+					Rect2I viewArea = _getParentWidget()->getTarget()->getPixelArea();
 					if (event.getPosition().x < 0)
 					{
 						Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-						cursorScreenPos.x += _getParentWidget()->getTarget()->getWidth();
-						jumpAmount = _getParentWidget()->getTarget()->getWidth();
+						cursorScreenPos.x += viewArea.width;
+						jumpAmount = viewArea.width;
 
 						Cursor::instance().setScreenPosition(cursorScreenPos);
 					}
-					else if (event.getPosition().x >= _getParentWidget()->getTarget()->getWidth())
+					else if (event.getPosition().x >= (INT32)viewArea.width)
 					{
 						Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-						cursorScreenPos.x -= _getParentWidget()->getTarget()->getWidth();
-						jumpAmount = -_getParentWidget()->getTarget()->getWidth();
+						cursorScreenPos.x -= viewArea.width;
+						jumpAmount = -(INT32)viewArea.width;
 
 						Cursor::instance().setScreenPosition(cursorScreenPos);
 					}

+ 6 - 5
Source/BansheeEditor/GUI/BsGUIIntField.cpp

@@ -92,19 +92,20 @@ namespace bs
 					INT32 xDiff = event.getPosition().x - mLastDragPos;
 
 					INT32 jumpAmount = 0;
+					Rect2I viewArea = _getParentWidget()->getTarget()->getPixelArea();
 					if (event.getPosition().x < 0)
 					{
 						Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-						cursorScreenPos.x += _getParentWidget()->getTarget()->getWidth();
-						jumpAmount = _getParentWidget()->getTarget()->getWidth();
+						cursorScreenPos.x += viewArea.width;
+						jumpAmount = viewArea.width;
 
 						Cursor::instance().setScreenPosition(cursorScreenPos);
 					}
-					else if (event.getPosition().x >= _getParentWidget()->getTarget()->getWidth())
+					else if (event.getPosition().x >= (INT32)viewArea.width)
 					{
 						Vector2I cursorScreenPos = Cursor::instance().getScreenPosition();
-						cursorScreenPos.x -= _getParentWidget()->getTarget()->getWidth();
-						jumpAmount = -_getParentWidget()->getTarget()->getWidth();
+						cursorScreenPos.x -= viewArea.width;
+						jumpAmount = -(INT32)viewArea.width;
 
 						Cursor::instance().setScreenPosition(cursorScreenPos);
 					}

+ 2 - 2
Source/BansheeEditor/GUI/BsGUIWindowFrameWidget.cpp

@@ -58,8 +58,8 @@ namespace bs
 		INT32 x = 0;
 		INT32 y = 0;
 
-		UINT32 width = getTarget()->getWidth();
-		UINT32 height = getTarget()->getHeight();
+		UINT32 width = getTarget()->getPixelArea().width;
+		UINT32 height = getTarget()->getPixelArea().height;
 
 		Vector<NonClientResizeArea> nonClientAreas(8);
 

+ 1 - 1
Source/BansheeEditor/Handles/BsHandleDrawManager.cpp

@@ -321,7 +321,7 @@ namespace bs
 			float width = (float)renderTarget->getProperties().width;
 			float height = (float)renderTarget->getProperties().height;
 
-			Rect2 normArea = camera.getViewport()->getNormArea();
+			Rect2 normArea = camera.getViewport()->getArea();
 
 			Rect2I screenArea;
 			screenArea.x = (int)(normArea.x * width);

+ 4 - 4
Source/BansheeEditor/SceneView/BsGizmoManager.cpp

@@ -778,11 +778,11 @@ namespace bs
 
 		float cameraScale = 1.0f;
 		if (camera->getProjectionType() == PT_ORTHOGRAPHIC)
-			cameraScale = camera->getViewport()->getHeight() / camera->getOrthoWindowHeight();
+			cameraScale = camera->getViewport()->getPixelArea().height / camera->getOrthoWindowHeight();
 		else
 		{
 			Radian vertFOV(Math::tan(camera->getHorzFOV() * 0.5f));
-			cameraScale = (camera->getViewport()->getHeight() * 0.5f) / vertFOV.valueRadians();
+			cameraScale = (camera->getViewport()->getPixelArea().height * 0.5f) / vertFOV.valueRadians();
 		}
 
 		iconRenderData = bs_shared_ptr_new<IconRenderDataVec>();
@@ -905,7 +905,7 @@ namespace bs
 
 		if (!fixedScale)
 		{
-			float iconToScreenRatio = iconHeight / (float)camera->getViewport()->getHeight();
+			float iconToScreenRatio = iconHeight / (float)camera->getViewport()->getPixelArea().height;
 
 			if (iconToScreenRatio > 0.3f)
 			{
@@ -1047,7 +1047,7 @@ namespace bs
 		if (renderTarget == nullptr)
 			return;
 
-		Rect2I screenArea = camera->getViewport()->getArea();
+		Rect2I screenArea = camera->getViewport()->getPixelArea();
 		Matrix4 viewMatrix = camera->getViewMatrix();
 		Matrix4 projMatrix = camera->getProjectionMatrixRS();
 		Matrix4 viewProjMat = projMatrix * viewMatrix;

+ 2 - 2
Source/BansheeEditor/SceneView/BsScenePicking.cpp

@@ -166,12 +166,12 @@ namespace bs
 
 		SPtr<ct::RenderTarget> target = cam->getViewport()->getTarget()->getCore();
 		gCoreThread().queueCommand(std::bind(&ct::ScenePicking::corePickingBegin, mCore, target,
-			cam->getViewport()->getNormArea(), std::cref(pickData), position, area));
+			cam->getViewport()->getArea(), std::cref(pickData), position, area));
 
 		GizmoManager::instance().renderForPicking(cam, [&](UINT32 inputIdx) { return encodeIndex(firstGizmoIdx + inputIdx); });
 
 		AsyncOp op = gCoreThread().queueReturnCommand(std::bind(&ct::ScenePicking::corePickingEnd, mCore, target,
-			cam->getViewport()->getNormArea(), position, area, data != nullptr, _1));
+			cam->getViewport()->getArea(), position, area, data != nullptr, _1));
 		gCoreThread().submit(true);
 
 		assert(op.hasCompleted());

+ 2 - 2
Source/BansheeEngine/GUI/BsGUIDropDownMenu.cpp

@@ -103,7 +103,7 @@ namespace bs
 
 		SPtr<Viewport> viewport = desc.camera->getViewport();
 
-		Rect2I targetBounds(0, 0, viewport->getWidth(), viewport->getHeight());
+		Rect2I targetBounds(0, 0, viewport->getPixelArea().width, viewport->getPixelArea().height);
 		Vector<Rect2I> captureBounds;
 		targetBounds.cut(desc.additionalBounds, captureBounds);
 
@@ -118,7 +118,7 @@ namespace bs
 
 		mAdditionalCaptureBounds = desc.additionalBounds;
 
-		Rect2I availableBounds(viewport->getX(), viewport->getY(), viewport->getWidth(), viewport->getHeight());
+		Rect2I availableBounds = viewport->getPixelArea();
 		mRootMenu = bs_new<DropDownSubMenu>(this, nullptr, desc.placement, availableBounds, desc.dropDownData, type, 0);
 	}
 

+ 2 - 2
Source/BansheeEngine/GUI/BsGUIManager.cpp

@@ -1755,8 +1755,8 @@ namespace bs
 	{
 		Vector<GUIManager::GUICoreRenderData>& renderData = mPerCameraData[&camera];
 
-		float invViewportWidth = 1.0f / (camera.getViewport()->getWidth() * 0.5f);
-		float invViewportHeight = 1.0f / (camera.getViewport()->getHeight() * 0.5f);
+		float invViewportWidth = 1.0f / (camera.getViewport()->getPixelArea().width * 0.5f);
+		float invViewportHeight = 1.0f / (camera.getViewport()->getPixelArea().height * 0.5f);
 		float viewflipYFlip = bs::RenderAPI::getAPIInfo().isFlagSet(RenderAPIFeatureFlag::NDCYAxisDown) ? -1.0f : 1.0f;
 
 		for (auto& entry : renderData)

+ 1 - 1
Source/BansheeEngine/GUI/BsGUITooltip.cpp

@@ -34,7 +34,7 @@ namespace bs
 		SPtr<Camera> camera = overlaidWidget.getCamera();
 		SPtr<Viewport> viewport = camera->getViewport();
 
-		Rect2I availableBounds(viewport->getX(), viewport->getY(), viewport->getWidth(), viewport->getHeight());
+		Rect2I availableBounds = viewport->getPixelArea();
 		
 		const GUISkin& skin = getSkin();
 		const GUIElementStyle* multiLineLabelStyle = skin.getStyle(BuiltinResources::MultiLineLabelStyle);

+ 1 - 1
Source/BansheeEngine/GUI/BsGUIViewport.cpp

@@ -94,7 +94,7 @@ namespace bs
 		float width = mLayoutData.area.width / (float)rtProps.width;
 		float height = mLayoutData.area.height / (float)rtProps.height;
 
-		viewport->setArea(x, y, width, height);
+		viewport->setArea(Rect2(x, y, width, height));
 	}
 
 	void GUIViewport::_changeParentWidget(GUIWidget* widget)

+ 4 - 3
Source/BansheeEngine/GUI/BsGUIWidget.cpp

@@ -361,7 +361,7 @@ namespace bs
 			return false;
 
 		// Technically GUI widget bounds can be larger than the viewport, so make sure we clip to viewport first
-		if(!target->getArea().contains(position))
+		if(!target->getPixelArea().contains(position))
 			return false;
 
 		Vector3 vecPos((float)position.x, (float)position.y, 0.0f);
@@ -401,8 +401,9 @@ namespace bs
 		if (target == nullptr)
 			return;
 
-		UINT32 width = target->getWidth();
-		UINT32 height = target->getHeight();
+		Rect2I area = target->getPixelArea();
+		UINT32 width = area.width;
+		UINT32 height = area.height;
 
 		GUILayoutData layoutData;
 		layoutData.area.width = width;

+ 4 - 4
Source/BansheeEngine/GUI/BsProfilerOverlay.cpp

@@ -590,8 +590,8 @@ namespace bs
 		static const INT32 PADDING = 10;
 		static const float LABELS_CONTENT_RATIO = 0.3f;
 
-		UINT32 width = (UINT32)std::max(0, (INT32)mTarget->getWidth() - PADDING * 2);
-		UINT32 height = (UINT32)std::max(0, (INT32)(mTarget->getHeight() - PADDING * 3)/2);
+		UINT32 width = (UINT32)std::max(0, (INT32)mTarget->getPixelArea().width - PADDING * 2);
+		UINT32 height = (UINT32)std::max(0, (INT32)(mTarget->getPixelArea().height - PADDING * 3)/2);
 
 		UINT32 labelsWidth = Math::ceilToInt(width * LABELS_CONTENT_RATIO);
 		UINT32 contentWidth = width - labelsWidth;
@@ -618,8 +618,8 @@ namespace bs
 		static const INT32 PADDING = 10;
 		static const float SAMPLES_FRAME_RATIO = 0.5f;
 
-		UINT32 width = (UINT32)std::max(0, (INT32)mTarget->getWidth() - PADDING * 2);
-		UINT32 height = (UINT32)std::max(0, (INT32)(mTarget->getHeight() - PADDING * 3));
+		UINT32 width = (UINT32)std::max(0, (INT32)mTarget->getPixelArea().width - PADDING * 2);
+		UINT32 height = (UINT32)std::max(0, (INT32)(mTarget->getPixelArea().height - PADDING * 3));
 
 		UINT32 frameHeight = Math::ceilToInt(height * SAMPLES_FRAME_RATIO);
 		UINT32 samplesHeight = height - frameHeight;

+ 1 - 1
Source/CMakeLists.txt

@@ -5,7 +5,7 @@ project (Banshee)
 set (BS_VERSION_MAJOR 0)
 set (BS_VERSION_MINOR 4)
 
-set (BS_PREBUILT_DEPENDENCIES_VERSION 11)
+set (BS_PREBUILT_DEPENDENCIES_VERSION 12)
 set (BS_SRC_DEPENDENCIES_VERSION 15)
 set (BS_BUILTIN_ASSETS_VERSION 1)
 

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

@@ -399,7 +399,7 @@ namespace bs
 		guiCamera->setLayers(0);
 
 		// Don't clear this camera as that would clear anything the main camera has rendered.
-		guiCamera->getViewport()->setRequiresClear(false, false, false);
+		guiCamera->getViewport()->setClearFlags(ClearFlagBits::None);
 
 		// Add a GUIWidget, the top-level GUI component, parent to all GUI elements. GUI widgets
 		// require you to specify a viewport that they will output rendered GUI elements to.

+ 20 - 20
Source/MBansheeEditor/Inspectors/CameraInspector.cs

@@ -65,14 +65,14 @@ namespace BansheeEditor
             aspectField.Value = camera.AspectRatio;
             nearPlaneField.Value = camera.NearClipPlane;
             farPlaneField.Value = camera.FarClipPlane;
-            viewportXField.Value = camera.ViewportRect.x;
-            viewportYField.Value = camera.ViewportRect.y;
-            viewportWidthField.Value = camera.ViewportRect.width;
-            viewportHeightField.Value = camera.ViewportRect.height;
-            clearFlagsFields.Value = (ulong)camera.ClearFlags;
-            clearStencilField.Value = camera.ClearStencil;
-            clearDepthField.Value = camera.ClearDepth;
-            clearColorField.Value = camera.ClearColor;
+            viewportXField.Value = camera.Viewport.Area.x;
+            viewportYField.Value = camera.Viewport.Area.y;
+            viewportWidthField.Value = camera.Viewport.Area.width;
+            viewportHeightField.Value = camera.Viewport.Area.height;
+            clearFlagsFields.Value = (ulong)camera.Viewport.ClearFlags;
+            clearStencilField.Value = camera.Viewport.ClearStencil;
+            clearDepthField.Value = camera.Viewport.ClearDepth;
+            clearColorField.Value = camera.Viewport.ClearColor;
             priorityField.Value = camera.Priority;
             mainField.Value = camera.Main;
             renderSettingsGUI.Settings = camera.RenderSettings;
@@ -132,9 +132,9 @@ namespace BansheeEditor
 
                 viewportXField.OnChanged += x =>
                 {
-                    Rect2 rect = camera.ViewportRect; 
+                    Rect2 rect = camera.Viewport.Area; 
                     rect.x = x; 
-                    camera.ViewportRect = rect;
+                    camera.Viewport.Area = rect;
 
                     MarkAsModified();
                 };
@@ -143,9 +143,9 @@ namespace BansheeEditor
 
                 viewportYField.OnChanged += x =>
                 {
-                    Rect2 rect = camera.ViewportRect; 
+                    Rect2 rect = camera.Viewport.Area; 
                     rect.y = x; 
-                    camera.ViewportRect = rect;
+                    camera.Viewport.Area = rect;
 
                     MarkAsModified();
                 };
@@ -154,9 +154,9 @@ namespace BansheeEditor
 
                 viewportWidthField.OnChanged += x =>
                 {
-                    Rect2 rect = camera.ViewportRect; 
+                    Rect2 rect = camera.Viewport.Area; 
                     rect.width = x; 
-                    camera.ViewportRect = rect;
+                    camera.Viewport.Area = rect;
 
                     MarkAsModified();
                 };
@@ -165,9 +165,9 @@ namespace BansheeEditor
 
                 viewportHeightField.OnChanged += x =>
                 {
-                    Rect2 rect = camera.ViewportRect; 
+                    Rect2 rect = camera.Viewport.Area; 
                     rect.height = x; 
-                    camera.ViewportRect = rect;
+                    camera.Viewport.Area = rect;
 
                     MarkAsModified();
                 };
@@ -176,22 +176,22 @@ namespace BansheeEditor
 
                 clearFlagsFields.OnSelectionChanged += x =>
                 {
-                    camera.ClearFlags = (ClearFlags) x;
+                    camera.Viewport.ClearFlags = (ClearFlags) x;
                     MarkAsModified();
                     ConfirmModify();
                 };
 
-                clearStencilField.OnChanged += x => { camera.ClearStencil = (ushort) x; };
+                clearStencilField.OnChanged += x => { camera.Viewport.ClearStencil = (ushort) x; };
                 clearStencilField.OnConfirmed += ConfirmModify;
                 clearStencilField.OnFocusLost += ConfirmModify;
 
-                clearDepthField.OnChanged += x => { camera.ClearDepth = x; };
+                clearDepthField.OnChanged += x => { camera.Viewport.ClearDepth = x; };
                 clearDepthField.OnConfirmed += ConfirmModify;
                 clearDepthField.OnFocusLost += ConfirmModify;
 
                 clearColorField.OnChanged += x =>
                 {
-                    camera.ClearColor = x;
+                    camera.Viewport.ClearColor = x;
                     MarkAsModified();
                     ConfirmModify();
                 };

+ 2 - 2
Source/MBansheeEditor/Inspectors/LightInspector.cs

@@ -63,7 +63,7 @@ namespace BansheeEditor
                 spotAngleField.OnChanged += x => { light.SpotAngle = (Degree)x; MarkAsModified(); };
                 spotAngleField.OnFocusLost += ConfirmModify;
 
-                spotFalloffAngleField.OnChanged += x => { light.SpotFalloffAngle = (Degree)x; MarkAsModified(); };
+                spotFalloffAngleField.OnChanged += x => { light.SpotAngleFalloff = (Degree)x; MarkAsModified(); };
                 spotFalloffAngleField.OnFocusLost += ConfirmModify;
 
                 castShadowField.OnChanged += x =>
@@ -112,7 +112,7 @@ namespace BansheeEditor
             attRadiusField.Value = light.AttenuationRadius;
             sourceRadiusField.Value = light.SourceRadius;
             spotAngleField.Value = light.SpotAngle.Degrees;
-            spotFalloffAngleField.Value = light.SpotFalloffAngle.Degrees;
+            spotFalloffAngleField.Value = light.SpotAngleFalloff.Degrees;
             autoAttenuationField.Value = light.UseAutoAttenuation;
             castShadowField.Value = light.CastsShadow;
 

+ 1 - 1
Source/MBansheeEditor/Windows/GameWindow.cs

@@ -181,7 +181,7 @@ namespace BansheeEditor
                 }
             }
 
-            RenderTexture2D renderTexture = new RenderTexture2D(PixelFormat.RGBA8, rtWidth, rtHeight) { Priority = 1};
+            RenderTexture renderTexture = new RenderTexture(PixelFormat.RGBA8, rtWidth, rtHeight) { Priority = 1};
 
             EditorApplication.MainRenderTarget = renderTexture;
             renderTextureGUI.RenderTexture = renderTexture;

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/Gizmos/LightGizmos.cs

@@ -70,7 +70,7 @@ namespace BansheeEditor
                     Gizmos.DrawLine(position, position + forward * light.AttenuationRadius + right * discRadius);
                     Gizmos.DrawLine(position, position + forward * light.AttenuationRadius - right * discRadius);
 
-                    float falloffDiscRadius = light.AttenuationRadius * MathEx.Tan(light.SpotFalloffAngle * 0.5f);
+                    float falloffDiscRadius = light.AttenuationRadius * MathEx.Tan(light.SpotAngleFalloff * 0.5f);
 
                     Gizmos.DrawWireDisc(position + forward * light.AttenuationRadius, forward, discRadius);
                     Gizmos.DrawWireDisc(position + forward * light.AttenuationRadius, forward, falloffDiscRadius);

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

@@ -13,7 +13,7 @@ namespace BansheeEditor
     /// </summary>
     internal class SceneAxesGUI
     {
-        private RenderTexture2D renderTexture;
+        private RenderTexture renderTexture;
         private Camera camera;
         private SceneHandles sceneHandles;
 
@@ -40,13 +40,13 @@ namespace BansheeEditor
         /// <param name="projType">Projection type to display on the GUI.</param>
         public SceneAxesGUI(SceneWindow window, GUIPanel panel, int width, int height, ProjectionType projType)
         {
-            renderTexture = new RenderTexture2D(PixelFormat.RGBA8, width, height);
+            renderTexture = new RenderTexture(PixelFormat.RGBA8, width, height);
             renderTexture.Priority = 1;
 
             SceneObject cameraSO = new SceneObject("SceneAxesCamera", true);
             camera = cameraSO.AddComponent<Camera>();
-            camera.Target = renderTexture;
-            camera.ViewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
+            camera.Viewport.Target = renderTexture;
+            camera.Viewport.Area = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
             
             cameraSO.Position = new Vector3(0, 0, 5);
             cameraSO.LookAt(new Vector3(0, 0, 0));
@@ -54,7 +54,7 @@ namespace BansheeEditor
             camera.Priority = 2;
             camera.NearClipPlane = 0.05f;
             camera.FarClipPlane = 1000.0f;
-            camera.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
+            camera.Viewport.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
             camera.ProjectionType = ProjectionType.Orthographic;
             camera.Layers = SceneAxesHandle.LAYER;
             camera.AspectRatio = 1.0f;

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

@@ -21,7 +21,7 @@ namespace BansheeEditor
         /// <param name="sceneCamera">Camera into which the gizmos will be rendered.</param>
         internal SceneGizmos(Camera sceneCamera)
         {
-            Internal_Create(this, sceneCamera.Native.GetCachedPtr());
+            Internal_Create(this, sceneCamera.GetCachedPtr());
         }
 
         /// <summary>

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

@@ -36,7 +36,7 @@ namespace BansheeEditor
         /// <param name="sceneCamera">Camera into which the grid will be rendered.</param>
         internal SceneGrid(Camera sceneCamera)
         {
-            Internal_Create(this, sceneCamera.Native.GetCachedPtr());
+            Internal_Create(this, sceneCamera.GetCachedPtr());
         }
 
         /// <summary>

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

@@ -22,7 +22,7 @@ namespace BansheeEditor
         /// <param name="sceneCamera">Camera through which the scene handles are displayed.</param>
         internal SceneHandles(EditorWindow parent, Camera sceneCamera)
         {
-            Internal_Create(this, parent.GetCachedPtr(), sceneCamera.Native.GetCachedPtr());
+            Internal_Create(this, parent.GetCachedPtr(), sceneCamera.GetCachedPtr());
         }
 
         /// <summary>

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

@@ -39,7 +39,7 @@ namespace BansheeEditor
         /// <param name="sceneCamera">Camera into which to render the selection overlay, and perform picking from.</param>
         internal SceneSelection(Camera sceneCamera)
         {
-            Internal_Create(this, sceneCamera.Native.GetCachedPtr());
+            Internal_Create(this, sceneCamera.GetCachedPtr());
         }
 
         /// <summary>

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

@@ -33,7 +33,7 @@ namespace BansheeEditor
 
         private Camera camera;
         private SceneCamera cameraController;
-        private RenderTexture2D renderTexture;
+        private RenderTexture renderTexture;
         private GUILayoutY mainLayout;
         private GUIPanel rtPanel;
         private GUIButton focusCatcher;
@@ -590,7 +590,7 @@ namespace BansheeEditor
                         }
                         else
                         {
-                            Ray worldRay = camera.ViewportToWorldRay(scenePos);
+                            Ray worldRay = camera.ScreenPointToRay(scenePos);
                             draggedSO.Position = worldRay * DefaultPlacementDepth - draggedSOOffset;
                         }
                     }
@@ -822,8 +822,8 @@ namespace BansheeEditor
                 {
                     SceneObject profilerSO = new SceneObject("EditorProfilerOverlay");
                     profilerCamera = profilerSO.AddComponent<Camera>();
-                    profilerCamera.Target = renderTexture;
-                    profilerCamera.ClearFlags = ClearFlags.None;
+                    profilerCamera.Viewport.Target = renderTexture;
+                    profilerCamera.Viewport.ClearFlags = ClearFlags.None;
                     profilerCamera.Priority = 1;
                     profilerCamera.Layers = 0;
                     profilerCamera.RenderSettings.EnableHDR = false;
@@ -849,7 +849,7 @@ namespace BansheeEditor
         /// <param name="width">Width of the scene render target, in pixels.</param>
         /// <param name="height">Height of the scene render target, in pixels.</param>
         private void UpdateRenderTexture(int width, int height)
-	    {
+        {
             width = MathEx.Max(20, width);
             height = MathEx.Max(20, height);
 
@@ -857,15 +857,15 @@ namespace BansheeEditor
             Texture colorTex = Texture.Create2D((uint)width, (uint)height, PixelFormat.RGBA8, TextureUsage.Render | TextureUsage.CPUReadable);
             Texture depthTex = Texture.Create2D((uint)width, (uint)height, PixelFormat.D32_S8X24, TextureUsage.DepthStencil | TextureUsage.CPUReadable);
 
-            renderTexture = new RenderTexture2D(colorTex, depthTex);
+            renderTexture = new RenderTexture(colorTex, depthTex);
             renderTexture.Priority = 1;
 
-		    if (camera == null)
-		    {
+            if (camera == null)
+            {
                 SceneObject sceneCameraSO = new SceneObject("SceneCamera", true);
                 camera = sceneCameraSO.AddComponent<Camera>();
-                camera.Target = renderTexture;
-                camera.ViewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
+                camera.Viewport.Target = renderTexture;
+                camera.Viewport.Area = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
 
                 sceneCameraSO.Position = new Vector3(0, 0.5f, 1);
                 sceneCameraSO.LookAt(new Vector3(0, 0.5f, 0));
@@ -873,7 +873,7 @@ namespace BansheeEditor
                 camera.Priority = 2;
                 camera.NearClipPlane = 0.05f;
                 camera.FarClipPlane = 2500.0f;
-                camera.ClearColor = ClearColor;
+                camera.Viewport.ClearColor = ClearColor;
                 camera.Layers = UInt64.MaxValue & ~SceneAxesHandle.LAYER; // Don't draw scene axes in this camera
 
                 cameraController = sceneCameraSO.AddComponent<SceneCamera>();
@@ -881,16 +881,16 @@ namespace BansheeEditor
                 renderTextureGUI = new GUIRenderTexture(renderTexture);
                 rtPanel.AddElement(renderTextureGUI);
 
-		        sceneGrid = new SceneGrid(camera);
-		        sceneSelection = new SceneSelection(camera);
-		        sceneGizmos = new SceneGizmos(camera);
-		        sceneHandles = new SceneHandles(this, camera);
-		    }
-		    else
-		    {
-		        camera.Target = renderTexture;
-		        renderTextureGUI.RenderTexture = renderTexture;
-		    }
+                sceneGrid = new SceneGrid(camera);
+                sceneSelection = new SceneSelection(camera);
+                sceneGizmos = new SceneGizmos(camera);
+                sceneHandles = new SceneHandles(this, camera);
+            }
+            else
+            {
+                camera.Viewport.Target = renderTexture;
+                renderTextureGUI.RenderTexture = renderTexture;
+            }
 
             Rect2I rtBounds = new Rect2I(0, 0, width, height);
             renderTextureGUI.Bounds = rtBounds;
@@ -904,8 +904,8 @@ namespace BansheeEditor
             camera.AspectRatio = width / (float)height;
 
             if (profilerCamera != null)
-                profilerCamera.Target = renderTexture;
-	    }
+                profilerCamera.Viewport.Target = renderTexture;
+        }
 
         /// <summary>
         /// Parses an array of scene objects and removes elements that are children of elements that are also in the array.
@@ -913,11 +913,11 @@ namespace BansheeEditor
         /// <param name="objects">Array containing duplicate objects as input, and array without duplicate objects as
         ///                       output.</param>
         private void CleanDuplicates(ref SceneObject[] objects)
-	    {
-		    List<SceneObject> cleanList = new List<SceneObject>();
-		    for (int i = 0; i < objects.Length; i++)
-		    {
-			    bool foundParent = false;
+        {
+            List<SceneObject> cleanList = new List<SceneObject>();
+            for (int i = 0; i < objects.Length; i++)
+            {
+                bool foundParent = false;
                 for (int j = 0; j < objects.Length; j++)
                 {
                     SceneObject elem = objects[i];
@@ -927,19 +927,19 @@ namespace BansheeEditor
 
                     bool isChildOf = elem == objects[j];
 
-				    if (i != j && isChildOf)
-				    {
-					    foundParent = true;
-					    break;
-				    }
-			    }
+                    if (i != j && isChildOf)
+                    {
+                        foundParent = true;
+                        break;
+                    }
+                }
 
-			    if (!foundParent)
-				    cleanList.Add(objects[i]);
-		    }
+                if (!foundParent)
+                    cleanList.Add(objects[i]);
+            }
 
-		    objects = cleanList.ToArray();
-	    }
+            objects = cleanList.ToArray();
+        }
 
         /// <summary>
         /// Starts a drag operation that displays a selection outline allowing the user to select multiple entries at once.

+ 6 - 6
Source/MBansheeEngine/GUI/GUIRenderTexture.cs

@@ -15,12 +15,12 @@ namespace BansheeEngine
     /// </summary>
     public sealed class GUIRenderTexture : GUIElement
     {
-        private RenderTexture2D renderTexture;
+        private RenderTexture renderTexture;
 
         /// <summary>
         /// Render texture that is displayed on the GUI element.
         /// </summary>
-        public RenderTexture2D RenderTexture
+        public RenderTexture RenderTexture
         {
             get
             {
@@ -48,7 +48,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
         ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, bool transparent, string style, params GUIOption[] options)
+        public GUIRenderTexture(RenderTexture texture, bool transparent, string style, params GUIOption[] options)
         {
             IntPtr texturePtr = IntPtr.Zero;
             if (texture != null)
@@ -64,7 +64,7 @@ namespace BansheeEngine
         /// <param name="transparent">Determines should the texture be rendered with transparency active.</param>
         /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
         ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, bool transparent, params GUIOption[] options)
+        public GUIRenderTexture(RenderTexture texture, bool transparent, params GUIOption[] options)
         {
             IntPtr texturePtr = IntPtr.Zero;
             if (texture != null)
@@ -82,7 +82,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
         ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, string style, params GUIOption[] options)
+        public GUIRenderTexture(RenderTexture texture, string style, params GUIOption[] options)
         {
             IntPtr texturePtr = IntPtr.Zero;
             if (texture != null)
@@ -97,7 +97,7 @@ namespace BansheeEngine
         /// <param name="texture">Render texture to display in the element.</param>
         /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
         ///                       override any similar options set by style.</param>
-        public GUIRenderTexture(RenderTexture2D texture, params GUIOption[] options)
+        public GUIRenderTexture(RenderTexture texture, params GUIOption[] options)
         {
             IntPtr texturePtr = IntPtr.Zero;
             if (texture != null)

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

@@ -1,501 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @cond INTEROP */
-
-    /// <summary>
-    /// Projection type to use by the camera.
-    /// </summary>
-    public enum ProjectionType // Note: Must match C++ enum ProjectionType
-    {
-        /// <summary>
-        /// Projection type where object size remains constant and parallel lines remain parallel.
-        /// </summary>
-        Orthographic, 
-
-        /// <summary>
-        /// Projection type that emulates human vision. Objects farther away appear smaller.
-        /// </summary>
-        Perspective
-    }
-
-    /// <summary>
-    /// Flags that specify which portions, if any, of the viewport are to be cleared before rendering.
-    /// </summary>
-    [Flags]
-    public enum ClearFlags // Don't reorder, used by native code
-    {
-        None = 0, Color = 0x01, Depth = 0x02, Stencil = 0x04
-    }
-
-    /// <summary>
-    /// Wrapper around the native Camera class.
-    /// <see cref="Camera"/>
-    /// </summary>
-    internal class NativeCamera : ScriptObject
-    {
-        internal float aspectRatio
-        {
-            get { return Internal_GetAspect(mCachedPtr); }
-            set { Internal_SetAspect(mCachedPtr, value); }
-        }
-
-        internal float nearClipPlane
-        {
-            get { return Internal_GetNearClip(mCachedPtr); }
-            set { Internal_SetNearClip(mCachedPtr, value); }
-        }
-
-        internal float farClipPlane
-        {
-            get { return Internal_GetFarClip(mCachedPtr); }
-            set { Internal_SetFarClip(mCachedPtr, value); }
-        }
-
-        internal Degree fieldOfView
-        {
-            get { Degree value; Internal_GetFieldOfView(mCachedPtr, out value); return value; }
-            set { Internal_SetFieldOfView(mCachedPtr, ref value); }
-        }
-
-        internal Rect2 viewportRect
-        {
-            get
-            {
-                Rect2 value;
-                Internal_GetViewportRect(mCachedPtr, out value);
-                return value;
-            }
-            set { Internal_SetViewportRect(mCachedPtr, ref value); }
-        }
-
-        internal ProjectionType projectionType
-        {
-            get { return Internal_GetProjectionType(mCachedPtr); }
-            set { Internal_SetProjectionType(mCachedPtr, value); }
-        }
-
-        internal float orthoHeight
-        {
-            get { return Internal_GetOrthographicHeight(mCachedPtr); }
-            set { Internal_SetOrthographicHeight(mCachedPtr, value); }
-        }
-
-        internal float orthoWidth
-        {
-            get { return Internal_GetOrthographicWidth(mCachedPtr); }
-        }
-
-        internal Color clearColor
-        {
-            get
-            {
-                Color value;
-                Internal_GetClearColor(mCachedPtr, out value);
-                return value;
-            }
-            set { Internal_SetClearColor(mCachedPtr, ref value); }
-        }
-
-        internal float clearDepth
-        {
-            get { return Internal_GetDepthClearValue(mCachedPtr); }
-            set { Internal_SetDepthClearValue(mCachedPtr, value); }
-        }
-
-        internal ushort clearStencil
-        {
-            get { return Internal_GetStencilClearValue(mCachedPtr); }
-            set { Internal_SetStencilClearValue(mCachedPtr, value); }
-        }
-
-        internal ClearFlags clearFlags
-        {
-            get { return Internal_GetClearFlags(mCachedPtr); }
-            set { Internal_SetClearFlags(mCachedPtr, value); }
-        }
-
-        internal int priority
-        {
-            get { return Internal_GetPriority(mCachedPtr); }
-            set { Internal_SetPriority(mCachedPtr, value); }
-        }
-
-        internal RenderSettings RenderSettings
-        {
-            get { return Internal_GetRenderSettings(mCachedPtr); }
-            set { Internal_SetRenderSettings(mCachedPtr, value); }
-        }
-
-        internal ulong layers
-        {
-            get { return Internal_GetLayers(mCachedPtr); }
-            set { Internal_SetLayers(mCachedPtr, value); }
-        }
-
-        internal Matrix4 projMatrix
-        {
-            get
-            {
-                Matrix4 value;
-                Internal_GetProjMatrix(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        internal Matrix4 projMatrixInv
-        {
-            get
-            {
-                Matrix4 value;
-                Internal_GetProjMatrixInv(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        internal Matrix4 viewMatrix
-        {
-            get
-            {
-                Matrix4 value;
-                Internal_GetViewMatrix(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        internal Matrix4 viewMatrixInv
-        {
-            get
-            {
-                Matrix4 value;
-                Internal_GetViewMatrixInv(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        internal int widthPixels
-        {
-            get { return Internal_GetWidthPixels(mCachedPtr); }
-        }
-
-        internal int heightPixels
-        {
-            get { return Internal_GetHeightPixels(mCachedPtr); }
-        }
-
-        internal RenderTarget target
-        {
-            get
-            {
-                return _target;
-            }
-            set
-            {
-                _target = value;
-
-                IntPtr targetPtr = IntPtr.Zero;
-                if (_target != null)
-                    targetPtr = _target.mCachedPtr;
-
-                Internal_SetRenderTarget(mCachedPtr, targetPtr);
-            }
-        }
-
-        internal bool main
-        {
-            get { return Internal_GetMain(mCachedPtr); }
-            set { Internal_SetMain(mCachedPtr, value); }
-        }
-
-        internal Vector2I WorldToViewport(Vector3 value)
-        {
-            Vector2I output;
-            Internal_WorldToViewport(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector2 WorldToNDC(Vector3 value)
-        {
-            Vector2 output;
-            Internal_WorldToNDC(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 WorldToView(Vector3 value)
-        {
-            Vector3 output;
-            Internal_WorldToView(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector2I ScreenToViewport(Vector2I value)
-        {
-            Vector2I output;
-            Internal_ScreenToViewport(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 ViewportToWorld(Vector2I value, float depth)
-        {
-            Vector3 output;
-            Internal_ViewportToWorld(mCachedPtr, ref value, depth, out output);
-            return output;
-        }
-
-        internal Vector3 ViewportToView(Vector2I value, float depth)
-        {
-            Vector3 output;
-            Internal_ViewportToView(mCachedPtr, ref value, depth, out output);
-            return output;
-        }
-
-        internal Vector2 ViewportToNDC(Vector2I value)
-        {
-            Vector2 output;
-            Internal_ViewportToNDC(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 ViewToWorld(Vector3 value)
-        {
-            Vector3 output;
-            Internal_ViewToWorld(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector2I ViewToViewport(Vector3 value)
-        {
-            Vector2I output;
-            Internal_ViewToViewport(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector2 ViewToNDC(Vector3 value)
-        {
-            Vector2 output;
-            Internal_ViewToNDC(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 NDCToWorld(Vector2 value, float depth)
-        {
-            Vector3 output;
-            Internal_NDCToWorld(mCachedPtr, ref value, depth, out output);
-            return output;
-        }
-
-        internal Vector3 NDCToView(Vector2 value, float depth)
-        {
-            Vector3 output;
-            Internal_NDCToView(mCachedPtr, ref value, depth, out output);
-            return output;
-        }
-
-        internal Vector2I NDCToViewport(Vector2 value)
-        {
-            Vector2I output;
-            Internal_NDCToViewport(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Ray ViewportToWorldRay(Vector2I value)
-        {
-            Ray output;
-            Internal_ViewportToWorldRay(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Ray ScreenToWorldRay(Vector2I value)
-        {
-            Ray output;
-            Internal_ScreenToWorldRay(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 ProjectPoint(Vector3 value)
-        {
-            Vector3 output;
-            Internal_ProjectPoint(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        internal Vector3 UnprojectPoint(Vector3 value)
-        {
-            Vector3 output;
-            Internal_UnprojectPoint(mCachedPtr, ref value, out output);
-            return output;
-        }
-
-        private RenderTarget _target;
-
-        public NativeCamera(SceneObject sceneObject)
-        {
-            IntPtr sceneObjPtr = IntPtr.Zero;
-            if (sceneObject != null)
-                sceneObjPtr = sceneObject.GetCachedPtr();
-
-            Internal_Create(this, sceneObjPtr);
-        }
-
-        internal void UpdateView(SceneObject sceneObject)
-        {
-            Internal_UpdateView(mCachedPtr, sceneObject.mCachedPtr);
-        }
-
-        internal void OnDestroy()
-        {
-            Internal_OnDestroy(mCachedPtr);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Create(NativeCamera instance, IntPtr parentSO);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetAspect(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetAspect(IntPtr instance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetNearClip(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetNearClip(IntPtr instance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetFarClip(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetFarClip(IntPtr instance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetFieldOfView(IntPtr instance, out Degree value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetFieldOfView(IntPtr instance, ref Degree value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetViewportRect(IntPtr instance, out Rect2 value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetViewportRect(IntPtr instance, ref Rect2 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern ProjectionType Internal_GetProjectionType(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetProjectionType(IntPtr instance, ProjectionType value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetOrthographicHeight(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetOrthographicHeight(IntPtr instance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetOrthographicWidth(IntPtr instance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetClearColor(IntPtr instance, out Color value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetClearColor(IntPtr instance, ref Color value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetDepthClearValue(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetDepthClearValue(IntPtr instance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern ushort Internal_GetStencilClearValue(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetStencilClearValue(IntPtr instance, UInt16 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern ClearFlags Internal_GetClearFlags(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetClearFlags(IntPtr instance, ClearFlags value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetPriority(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPriority(IntPtr instance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern RenderSettings Internal_GetRenderSettings(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRenderSettings(IntPtr instance, RenderSettings value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern ulong Internal_GetLayers(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetLayers(IntPtr instance, UInt64 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetProjMatrix(IntPtr instance, out Matrix4 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetProjMatrixInv(IntPtr instance, out Matrix4 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetViewMatrix(IntPtr instance, out Matrix4 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetViewMatrixInv(IntPtr instance, out Matrix4 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetWidthPixels(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetHeightPixels(IntPtr instance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WorldToViewport(IntPtr instance, ref Vector3 value, out Vector2I output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WorldToNDC(IntPtr instance, ref Vector3 value, out Vector2 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WorldToView(IntPtr instance, ref Vector3 value, out Vector3 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ScreenToViewport(IntPtr instance, ref Vector2I value, out Vector2I output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewportToWorld(IntPtr instance, ref Vector2I value, float depth, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewportToView(IntPtr instance, ref Vector2I value, float depth, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewportToNDC(IntPtr instance, ref Vector2I value, out Vector2 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewToWorld(IntPtr instance, ref Vector3 value, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewToViewport(IntPtr instance, ref Vector3 value, out Vector2I output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewToNDC(IntPtr instance, ref Vector3 value, out Vector2 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_NDCToWorld(IntPtr instance, ref Vector2 value, float depth, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_NDCToView(IntPtr instance, ref Vector2 value, float depth, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_NDCToViewport(IntPtr instance, ref Vector2 value, out Vector2I output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ViewportToWorldRay(IntPtr instance, ref Vector2I value, out Ray output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ScreenToWorldRay(IntPtr instance, ref Vector2I value, out Ray output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ProjectPoint(IntPtr instance, ref Vector3 value, out Vector3 output);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_UnprojectPoint(IntPtr instance, ref Vector3 value, out Vector3 output);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRenderTarget(IntPtr instance, IntPtr rt);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetMain(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetMain(IntPtr instance, bool main);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_UpdateView(IntPtr instance, IntPtr parentSO);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_OnDestroy(IntPtr thisPtr);
-    }
-
-    /** @endcond */
-}

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

@@ -42,7 +42,7 @@ namespace BansheeEngine
             {
                 IntPtr cameraPtr = IntPtr.Zero;
                 if (value != null)
-                    cameraPtr = value.Native.GetCachedPtr();
+                    cameraPtr = value.GetCachedPtr();
 
                 Internal_SetCamera(mCachedPtr, cameraPtr);
             }
@@ -93,7 +93,7 @@ namespace BansheeEngine
         {
             IntPtr cameraPtr = IntPtr.Zero;
             if (camera != null)
-                cameraPtr = camera.Native.GetCachedPtr();
+                cameraPtr = camera.GetCachedPtr();
 
             Internal_UpdateMainCamera(mCachedPtr, cameraPtr);
         }

+ 0 - 162
Source/MBansheeEngine/Interop/NativeLight.cs

@@ -1,162 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @cond INTEROP */
-
-    /// <summary>
-    /// Light type that determines how is light information parsed by the renderer and other systems.
-    /// </summary>
-    public enum LightType // Note: Must match C++ enum LightType
-    {
-        Directional, Radial, Spot
-    }
-
-    /// <summary>
-    /// Wrapper around the native Light class.
-    /// <see cref="Light"/>
-    /// </summary>
-    internal class NativeLight : ScriptObject
-    {
-        internal LightType Type
-        {
-            get { return Internal_GetType(mCachedPtr); }
-            set { Internal_SetType(mCachedPtr, value); }
-        }
-
-        internal Color Color
-        {
-            get
-            {
-                Color color;
-                Internal_GetColor(mCachedPtr, out color);
-                return color;
-            }
-            set { Internal_SetColor(mCachedPtr, value); }
-        }
-
-        internal float AttenuationRadius
-        {
-            get { return Internal_GetAttenuationRadius(mCachedPtr); }
-            set { Internal_SetAttenuationRadius(mCachedPtr, value); }
-        }
-
-        internal float SourceRadius
-        {
-            get { return Internal_GetSourceRadius(mCachedPtr); }
-            set { Internal_SetSourceRadius(mCachedPtr, value); }
-        }
-
-        internal float Intensity
-        {
-            get { return Internal_GetIntensity(mCachedPtr); }
-            set { Internal_SetIntensity(mCachedPtr, value); }
-        }
-
-        internal Degree SpotAngle
-        {
-            get { return (Degree)Internal_GetSpotAngle(mCachedPtr); }
-            set { Internal_SetSpotAngle(mCachedPtr, value.Degrees); }
-        }
-
-        internal Degree SpotFalloffAngle
-        {
-            get { return (Degree)Internal_GetSpotFalloffAngle(mCachedPtr); }
-            set { Internal_SetSpotFalloffAngle(mCachedPtr, value.Degrees); }
-        }
-
-        internal bool CastsShadow
-        {
-            get { return Internal_GetCastsShadow(mCachedPtr); }
-            set { Internal_SetCastsShadow(mCachedPtr, value); }
-        }
-
-        internal bool UseAutoAttenuation
-        {
-            get { return Internal_GetUseAutoAttenuation(mCachedPtr); }
-            set { Internal_SetUseAutoAttenuation(mCachedPtr, value); }
-        }
-
-        internal Sphere Bounds
-        {
-            get
-            {
-                Sphere bounds;
-                Internal_GetBounds(mCachedPtr, out bounds);
-                return bounds;
-            }
-        }
-
-        internal NativeLight(SceneObject sceneObject)
-        {
-            IntPtr sceneObjPtr = IntPtr.Zero;
-            if (sceneObject != null)
-                sceneObjPtr = sceneObject.GetCachedPtr();
-
-            Internal_Create(this, sceneObjPtr);
-        }
-
-        internal void UpdateTransform(SceneObject parentSO)
-        {
-            if (parentSO != null)
-                Internal_UpdateTransform(mCachedPtr, parentSO.GetCachedPtr());
-        }
-
-        internal void OnDestroy()
-        {
-            Internal_OnDestroy(mCachedPtr);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Create(NativeLight instance, IntPtr parentSO);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern LightType Internal_GetType(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetType(IntPtr instance, LightType value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetAttenuationRadius(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetAttenuationRadius(IntPtr instance, float value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetSourceRadius(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetSourceRadius(IntPtr instance, float value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetIntensity(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetIntensity(IntPtr instance, float value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetColor(IntPtr instance, out Color color);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetColor(IntPtr instance, Color value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetCastsShadow(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetCastsShadow(IntPtr instance, bool value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_GetUseAutoAttenuation(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetUseAutoAttenuation(IntPtr instance, bool value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetSpotAngle(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetSpotAngle(IntPtr instance, float value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetSpotFalloffAngle(IntPtr instance);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetSpotFalloffAngle(IntPtr instance, float value);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetBounds(IntPtr instance, out Sphere bounds);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_UpdateTransform(IntPtr instance, IntPtr parentSO);
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_OnDestroy(IntPtr thisPtr);
-    }
-
-    /** @endcond */
-}

+ 1 - 1
Source/MBansheeEngine/Interop/ProfilerOverlayInternal.cs

@@ -17,7 +17,7 @@ namespace BansheeEngine
         {
             IntPtr ptr = IntPtr.Zero;
             if (camera != null)
-                ptr = camera.Native.GetCachedPtr();
+                ptr = camera.GetCachedPtr();
 
             Internal_CreateInstance(this, ptr);
         }

+ 0 - 8
Source/MBansheeEngine/MBansheeEngine.csproj

@@ -48,20 +48,17 @@
     <Compile Include="GUI\GUICanvas.cs" />
     <Compile Include="GUI\GUIScrollBar.cs" />
     <Compile Include="Rendering\Material.cs" />
-    <Compile Include="Rendering\RenderSettings.cs" />
     <Compile Include="Serialization\ShowInInspector.cs" />
     <Compile Include="Serialization\Step.cs" />
     <Compile Include="Utility\AsyncOp.cs" />
     <Compile Include="Math\Bounds.cs" />
     <Compile Include="Utility\Builtin.cs" />
-    <Compile Include="Rendering\Camera.cs" />
     <Compile Include="GUI\GUI.cs" />
     <Compile Include="GUI\GUIListView.cs" />
     <Compile Include="GUI\GUIWidget.cs" />
     <Compile Include="Utility\Layers.cs" />
     <Compile Include="Math\Capsule.cs" />
     <Compile Include="Math\LineSegment.cs" />
-    <Compile Include="Interop\NativeCamera.cs" />
     <Compile Include="GUI\ContextMenu.cs" />
     <Compile Include="Utility\Cursor.cs" />
     <Compile Include="Utility\Debug.cs" />
@@ -98,9 +95,7 @@
     <Compile Include="Serialization\HideInInspector.cs" />
     <Compile Include="Input\Input.cs" />
     <Compile Include="Input\InputConfiguration.cs" />
-    <Compile Include="Rendering\Light.cs" />
     <Compile Include="Interop\NativeGUIWidget.cs" />
-    <Compile Include="Interop\NativeLight.cs" />
     <Compile Include="GUI\LocString.cs" />
     <Compile Include="Resources\ManagedResource.cs" />
     <Compile Include="Math\AABox.cs" />
@@ -126,9 +121,6 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Math\Quaternion.cs" />
     <Compile Include="Serialization\Range.cs" />
-    <Compile Include="Rendering\RenderTarget.cs" />
-    <Compile Include="Rendering\RenderTexture.cs" />
-    <Compile Include="Rendering\RenderTexture2D.cs" />
     <Compile Include="Resources\Resource.cs" />
     <Compile Include="Resources\ResourceRef.cs" />
     <Compile Include="Resources\Resources.cs" />

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

@@ -1,462 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Rendering
-     *  @{
-     */
-
-    /// <summary>
-    /// Camera component that determines how is world geometry projected onto a 2D surface. You may position and orient it 
-    /// in space, set options like aspect ratio and field or view and it outputs view and projection matrices required for 
-    /// rendering.
-    /// </summary>
-    [RunInEditor]
-    public sealed class Camera : ManagedComponent
-    {
-        private NativeCamera native;
-
-        [SerializeField]
-        internal SerializableData serializableData = new SerializableData();
-
-        /// <summary>
-        /// Returns the non-component version of Camera that is wrapped by this component. 
-        /// </summary>
-        internal NativeCamera Native
-        {
-            get { return native; }
-        }
-
-        /// <summary>
-        /// Ratio between viewport width and height (width / height).
-        /// </summary>
-        public float AspectRatio
-        {
-            get { return native.aspectRatio; }
-            set { native.aspectRatio = value; serializableData.aspectRatio = value; }
-        }
-
-        /// <summary>
-        /// Distance from the frustum origin to the near clipping plane. Anything closer than the near clipping plane will 
-        /// not be rendered. Decreasing this value decreases depth buffer precision.
-        /// </summary>
-        public float NearClipPlane
-        {
-            get { return native.nearClipPlane; }
-            set { native.nearClipPlane = value; serializableData.nearClipPlane = value; }
-        }
-
-        /// <summary>
-        /// Distance from the frustum origin to the far clipping plane. Anything farther than the far clipping plane will 
-        /// not be rendered. Increasing this value decreases depth buffer precision.
-        /// </summary>
-        public float FarClipPlane
-        {
-            get { return native.farClipPlane; }
-            set { native.farClipPlane = value; serializableData.farClipPlane = value; }
-        }
-
-        /// <summary>
-        /// Horizontal field of view. This determines how wide the camera viewing angle is along the horizontal axis. 
-        /// Vertical FOV is calculated from the horizontal FOV and the aspect ratio.
-        /// </summary>
-        public Degree FieldOfView
-        {
-            get { return native.fieldOfView; }
-            set { native.fieldOfView = value; serializableData.fieldOfView = value; }
-        }
-
-        /// <summary>
-        /// Returns the area of the render target that the camera renders to, in normalized coordinates. 
-        /// </summary>
-        public Rect2 ViewportRect
-        {
-            get { return native.viewportRect; }
-            set { native.viewportRect = value; serializableData.viewportRect = value; }
-        }
-
-        /// <summary>
-        /// Projection type that controls how is 3D geometry projected onto a 2D plane.
-        /// </summary>
-        public ProjectionType ProjectionType
-        {
-            get { return native.projectionType; }
-            set { native.projectionType = value; serializableData.projectionType = value; }
-        }
-
-        /// <summary>
-        /// Ortographic height that controls the size of the displayed objects. This value is only relevant when projection
-        /// type is set to orthographic. Setting this value will automatically recalculate ortographic width depending on
-        /// the aspect ratio.
-        /// </summary>
-        public float OrthoHeight
-        {
-            get { return native.orthoHeight; }
-            set { native.orthoHeight = value; serializableData.orthoHeight = value; }
-        }
-
-        /// <summary>
-        /// Returns the ortographic width that controls the size of the displayed object. To change this value modify
-        /// <see cref="OrthoHeight"/> or <see cref="AspectRatio"/>.
-        /// </summary>
-        public float OrthoWidth
-        {
-            get { return native.orthoWidth; }
-        }
-
-        /// <summary>
-        /// Color that will be used for clearing the camera's viewport before rendering. Only relevant if color clear is
-        /// enabled.
-        /// </summary>
-        public Color ClearColor
-        {
-            get { return native.clearColor; }
-            set { native.clearColor = value; serializableData.clearColor = value; }
-        }
-
-        /// <summary>
-        /// Value that will be used for clearing the camera's depth buffer before rendering. Only relevant if depth clear
-        /// is enabled.
-        /// </summary>
-        public float ClearDepth
-        {
-            get { return native.clearDepth; }
-            set { native.clearDepth = value; serializableData.clearDepth = value; }
-        }
-
-        /// <summary>
-        /// Value that will be used for clearing the camera's stencil buffer before rendering. Only relevant if stencil
-        /// clear is enabled.
-        /// </summary>
-        public UInt16 ClearStencil
-        {
-            get { return native.clearStencil; }
-            set { native.clearStencil = value; serializableData.clearStencil = value; }
-        }
-
-        /// <summary>
-        /// Flags that control which portions of the camera viewport, if any, are cleared before rendering.
-        /// </summary>
-        public ClearFlags ClearFlags
-        {
-            get { return native.clearFlags; }
-            set { native.clearFlags = value; serializableData.clearFlags = value; }
-        }
-
-        /// <summary>
-        /// Determines in which orders are the cameras rendered. This only applies to cameras rendering to the same render 
-        /// target. Higher value means the camera will be processed sooner.
-        /// </summary>
-        public int Priority
-        {
-            get { return native.priority; }
-            set { native.priority = value; serializableData.priority = value; }
-        }
-
-        /// <summary>
-        /// Allows you to customize various post process operations that will be executed on the image produced by this 
-        /// camera.
-        /// </summary>
-        public RenderSettings RenderSettings
-        {
-            get { return native.RenderSettings; }
-            set { native.RenderSettings = value;  serializableData.renderSettings = 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.
-        /// </summary>
-        public UInt64 Layers
-        {
-            get { return native.layers; }
-            set { native.layers = value; serializableData.layers = value; }
-        }
-
-        /// <summary>
-        /// Returns the standard projection matrix that determines how are 3D points projected to two dimensions. The layout
-        /// of this matrix depends on currently used render system.
-        /// </summary>
-        public Matrix4 ProjMatrix
-        {
-            get { return native.projMatrix; }
-        }
-
-        /// <summary>
-        /// Returns the inverse of the standard projection matrix that determines how are 3D points projected to two 
-        /// dimensions. The layout of this matrix depends on currently used render system.
-        /// </summary>
-        public Matrix4 ProjMatrixInverse
-        {
-            get { return native.projMatrixInv; }
-        }
-
-        /// <summary>
-        /// Returns the view matrix that controls camera position and orientation.
-        /// </summary>
-        public Matrix4 ViewMatrix
-        {
-            get { return native.viewMatrix; }
-        }
-
-        /// <summary>
-        /// Returns the inverse of the view matrix that controls camera position and orientation.
-        /// </summary>
-        public Matrix4 ViewMatrixInverse
-        {
-            get { return native.viewMatrixInv; }
-        }
-
-        /// <summary>
-        /// Returns the width of the camera's viewport, in pixels. Only valid if render target is currently set.
-        /// </summary>
-        public int WidthPixels
-        {
-            get { return native.widthPixels; }
-        }
-
-        /// <summary>
-        /// Returns the height of the camera's viewport, in pixels. Only valid if render target is currently set.
-        /// </summary>
-        public int HeightPixels
-        {
-            get { return native.heightPixels; }
-        }
-
-        /// <summary>
-        /// Returns the render target that the camera will output all rendered pixels to.
-        /// </summary>
-        public RenderTarget Target
-        {
-            get { return native.target; }
-            set { native.target = value; }
-        }
-
-        /// <summary>
-        /// Determines if this is the main application camera. Main camera controls the final render surface that is 
-        /// displayed to the user.
-        /// </summary>
-        public bool Main
-        {
-            get { return native.main; }
-            set { native.main = value; serializableData.main = value; }
-        }
-
-        /// <summary>
-        /// Converts a point in world space to coordinates relative to the camera's viewport.
-        /// </summary>
-        /// <param name="value">3D point in world space.</param>
-        /// <returns>2D point on the render target attached to the camera, in pixels.</returns>
-        public Vector2I WorldToViewport(Vector3 value) { return native.WorldToViewport(value); }
-
-        /// <summary>
-        /// Converts a point in world space to normalized device coordinates.
-        /// </summary>
-        /// <param name="value">3D point in world space.</param>
-        /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
-        public Vector2 WorldToNDC(Vector3 value) { return native.WorldToNDC(value); }
-
-        /// <summary>
-        /// Converts a point in world space to view space coordinates.
-        /// </summary>
-        /// <param name="value">3D point in world space.</param>
-        /// <returns>3D point relative to the camera's coordinate system.</returns>
-        public Vector3 WorldToView(Vector3 value) { return native.WorldToView(value); }
-
-        /// <summary>
-        /// Converts a point in screen coordinates to viewport coordinates.
-        /// </summary>
-        /// <param name="value">2D point on the screen, in pixels.</param>
-        /// <returns>2D point on the render target attached to the camera, in pixels.</returns>
-        public Vector2I ScreenToViewport(Vector2I value) { return native.ScreenToViewport(value); }
-
-        /// <summary>
-        /// Converts a point in viewport coordinates to a point in world space.
-        /// </summary>
-        /// <param name="value">2D point on the render target attached to the camera, in pixels.</param>
-        /// <param name="depth">Depth at which place the world point at. The depth is applied to the vector going from 
-        ///                     camera origin to the point on the near plane.</param>
-        /// <returns>3D point in world space.</returns>
-        public Vector3 ViewportToWorld(Vector2I value, float depth = 0.5f) { return native.ViewportToWorld(value, depth); }
-
-        /// <summary>
-        /// Converts a point in viewport coordinates to a point in view space.
-        /// </summary>
-        /// <param name="value">2D point on the render target attached to the camera, in pixels.</param>
-        /// <param name="depth">Depth at which place the view point at. The depth is applied to the vector going from 
-        ///                     camera origin to the point on the near plane.</param>
-        /// <returns>3D point in view space.</returns>
-        public Vector3 ViewportToView(Vector2I value, float depth = 0.5f) { return native.ViewportToView(value, depth); }
-
-        /// <summary>
-        /// Converts a point in viewport coordinates to a point in normalized device coordinates.
-        /// </summary>
-        /// <param name="value">2D point on the render target attached to the camera, in pixels.</param>
-        /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
-        public Vector2 ViewportToNDC(Vector2I value) { return native.ViewportToNDC(value); }
-
-        /// <summary>
-        /// Converts a point relative to camera's coordinate system (view space) into a point in world space.
-        /// </summary>
-        /// <param name="value">3D point in view space.</param>
-        /// <returns>3D point in world space.</returns>
-        public Vector3 ViewToWorld(Vector3 value) { return native.ViewToWorld(value); }
-
-        /// <summary>
-        /// Converts a point relative to camera's coordinate system (view space) to screen coordinates.
-        /// </summary>
-        /// <param name="value">3D point in view space.</param>
-        /// <returns>2D point on the render target attached to the camera, in pixels.</returns>
-        public Vector2I ViewToViewport(Vector3 value) { return native.ViewToViewport(value); }
-
-        /// <summary>
-        /// Converts a point relative to camera's coordinate system (view space) to normalized device coordinates.
-        /// </summary>
-        /// <param name="value">3D point in view space.</param>
-        /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
-        public Vector2 ViewToNDC(Vector3 value) { return native.ViewToNDC(value); }
-
-        /// <summary>
-        /// Converts a point relative to camera's viewport in normalized device coordinates ([-1, 1] range) into a point in 
-        /// world space.
-        /// </summary>
-        /// <param name="value">2D point in normalized device coordinates.</param>
-        /// <param name="depth">Depth at which place the world point at. The depth is applied to the vector going from
-        ///                     camera origin to the point on the near plane.</param>
-        /// <returns>3D point in world space.</returns>
-        public Vector3 NDCToWorld(Vector2 value, float depth = 0.5f) { return native.NDCToWorld(value, depth); }
-
-        /// <summary>
-        /// Converts a point relative to camera's viewport in normalized device coordinates ([-1, 1] range) into a point in 
-        /// view space.
-        /// </summary>
-        /// <param name="value">2D point in normalized device coordinates.</param>
-        /// <param name="depth">Depth at which place the world point at. The depth is applied to the vector going from
-        ///                     camera origin to the point on the near plane.</param>
-        /// <returns>3D point in view space.</returns>
-        public Vector3 NDCToView(Vector2 value, float depth = 0.5f) { return native.NDCToView(value, depth); }
-
-        /// <summary>
-        /// Converts a point relative to camera's viewport in normalized device coordinates ([-1, 1] range) to viewport
-        /// coordinates in pixels.
-        /// </summary>
-        /// <param name="value">2D point in normalized device coordinates.</param>
-        /// <returns>2D point on the render target attached to the camera, in pixels.</returns>
-        public Vector2I NDCToViewport(Vector2 value) { return native.NDCToViewport(value); }
-
-        /// <summary>
-        /// Converts a point in viewport coordinates to a ray in world space.
-        /// </summary>
-        /// <param name="value">2D point on the render target attached to the camera, in pixels.</param>
-        /// <returns>A ray in world space with it's origin the selected point at the near frustum plane, pointing in the 
-        ///          direction going from camera's origin towards a point on the near frustum plane.</returns>
-        public Ray ViewportToWorldRay(Vector2I value) { return native.ViewportToWorldRay(value); }
-
-        /// <summary>
-        /// Converts a point in screen coordinates to a ray in world space.
-        /// </summary>
-        /// <param name="value">2D point on the screen, in pixels.</param>
-        /// <returns>A ray in world space with it's origin the selected point at the near frustum plane, pointing in the 
-        ///          direction going from camera's origin towards a point on the near frustum plane.</returns>
-        public Ray ScreenToWorldRay(Vector2I value) { return native.ScreenToWorldRay(value); }
-
-        /// <summary>
-        /// Projects a point in view space to a point in normalized device coordinates. Similar to <see cref="ViewToNDC"/> 
-        /// but preserves the depth component.
-        /// </summary>
-        /// <param name="value">3D point in view space.</param>
-        /// <returns>3D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport. Z value
-        ///          range depends on active render API.</returns>
-        public Vector3 ProjectPoint(Vector3 value) { return native.ProjectPoint(value); }
-
-        /// <summary>
-        /// Un-rpojects a point in normalized device coordinates to a point in view space.
-        /// </summary>
-        /// <param name="value">3D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport. 
-        ///                     Z value range depends on active render API.</param>
-        /// <returns>3D point in view space.</returns>
-        public Vector3 UnprojectPoint(Vector3 value) { return native.UnprojectPoint(value); }
-
-        /// <summary>
-        /// Returns the width of the camera's frustum at the specified distance from the camera.
-        /// </summary>
-        /// <param name="distance">Distance along the axis the camera is looking at, in world units.</param>
-        /// <returns>Frustum width, in world units. To find frustum height divide this by camera's aspect ratio. </returns>
-        public float GetFrustumWidth(float distance)
-        {
-            if (ProjectionType == ProjectionType.Perspective)
-                return distance * 2.0f * MathEx.Tan(FieldOfView * 0.5f);
-            else
-                return distance * 0.5f;
-        }
-
-        private void OnReset()
-        {
-            if (native != null)
-                native.OnDestroy();
-
-            native = new NativeCamera(SceneObject);
-
-            // Restore saved values after reset
-            native.aspectRatio = serializableData.aspectRatio;
-            native.nearClipPlane = serializableData.nearClipPlane;
-            native.farClipPlane = serializableData.farClipPlane;
-            native.fieldOfView = serializableData.fieldOfView;
-            native.viewportRect = serializableData.viewportRect;
-            native.projectionType = serializableData.projectionType;
-            native.orthoHeight = serializableData.orthoHeight;
-            native.clearColor = serializableData.clearColor;
-            native.clearDepth = serializableData.clearDepth;
-            native.clearStencil = serializableData.clearStencil;
-            native.clearFlags = serializableData.clearFlags;
-            native.priority = serializableData.priority;
-            native.layers = serializableData.layers;
-            native.main = serializableData.main;
-
-            // TODO - Make RenderTexture a resource so I can save/restore it?
-        }
-
-        private void OnUpdate()
-        {
-            native.UpdateView(SceneObject);
-        }
-
-        private void OnDestroy()
-        {
-            native.OnDestroy();
-        }
-
-        /// <summary>
-        /// Holds all data the camera component needs to persist through serialization.
-        /// </summary>
-        [SerializeObject]
-        internal class SerializableData
-        {
-            internal SerializableData()
-            {
-                renderSettings = RenderSettings.CreateDefault();
-            }
-
-            public float aspectRatio = 1.333f;
-            public float nearClipPlane = 1.0f;
-            public float farClipPlane = 1000.0f;
-            public Degree fieldOfView = new Degree(90);
-            public Rect2 viewportRect = new Rect2(0, 0, 1, 1);
-            public ProjectionType projectionType = ProjectionType.Perspective;
-            public float orthoHeight = 5.0f;
-            public Color clearColor = new Color(83.0f / 255.0f, 83.0f / 255.0f, 83.0f / 255.0f);
-            public float clearDepth = 1.0f;
-            public ushort clearStencil;
-            public ClearFlags clearFlags = ClearFlags.Color | ClearFlags.Depth | ClearFlags.Stencil;
-            public int priority;
-            public bool HDR = true;
-            public RenderSettings renderSettings;
-            public ulong layers = 0xFFFFFFFFFFFFFFFF;
-            public bool main;
-        }
-    }
-
-    /** @} */
-}

+ 0 - 189
Source/MBansheeEngine/Rendering/Light.cs

@@ -1,189 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-namespace BansheeEngine
-{
-    /** @addtogroup Rendering
-     *  @{
-     */
-
-    /// <summary>
-    /// Component that illuminates a portion of the scene covered by the light.
-    /// </summary>
-    [RunInEditor]
-    public sealed class Light : ManagedComponent
-    {
-        private NativeLight _nativeLight;
-
-        [SerializeField]
-        private SerializableData serializableData = new SerializableData();
-
-        /// <summary>
-        /// Returns the non-component version of Light that is wrapped by this component. 
-        /// </summary>
-        internal NativeLight Native
-        {
-            get { return _nativeLight; }
-        }
-
-        /// <summary>
-        /// Light type that determines how are elements near it illuminated.
-        /// </summary>
-        public LightType Type
-        {
-            get { return _nativeLight.Type; }
-            set { _nativeLight.Type = value; serializableData.type = value; }
-        }
-
-        /// <summary>
-        /// Color emitted from the light.
-        /// </summary>
-        public Color Color
-        {
-            get { return _nativeLight.Color; }
-            set { _nativeLight.Color = value; serializableData.color = value; }
-        }
-
-        /// <summary>
-        /// Range at which the light contribution fades out to zero. Use <see cref="UseAutoAttenuation"/> to provide
-        /// a radius automatically dependant on light intensity. The radius will cut-off light contribution and therefore
-        /// manually set very small radius can end up being very physically incorrect.
-        /// </summary>
-        public float AttenuationRadius
-        {
-            get { return _nativeLight.AttenuationRadius; }
-            set { _nativeLight.AttenuationRadius = value; serializableData.attenuationRadius = value; }
-        }
-
-        /// <summary>
-        /// Radius of the light source. If non-zero then this light represents an area light, otherwise it is a punctual
-        /// light. Area lights have different attenuation then punctual lights, and their appearance in specular reflections
-        /// is realistic. Shape of the area light depends on light type:
-        ///  - For directional light the shape is a disc projected on the hemisphere on the horizon. This parameter
-        ///    represents angular radius (in degrees) of the disk and should be very small (think of how much space the Sun
-        ///    takes on the sky - roughly 0.5 degrees).
-        ///  - For radial light the shape is a sphere and the radius is the radius of the sphere.
-        ///  - For spot lights the shape is a disc oriented in the direction of the spot light and the radius is the radius
-        ///    of the disc.
-        /// </summary>
-        public float SourceRadius
-        {
-            get { return _nativeLight.SourceRadius; }
-            set { _nativeLight.SourceRadius = value; serializableData.sourceRadius = value; }
-        }
-
-        /// <summary>
-        /// Determines the power of the light source.This will be luminous flux for radial & spot lights, luminance for
-        /// directional lights with no area, and illuminance for directional lights with area(non-zero source radius).
-        /// </summary>
-        public float Intensity
-        {
-            get { return _nativeLight.Intensity; }
-            set { _nativeLight.Intensity = value; serializableData.intensity = value; }
-        }
-
-        /// <summary>
-        /// Total angle covered by a spot light. Ignored by other light types.
-        /// </summary>
-        public Degree SpotAngle
-        {
-            get { return _nativeLight.SpotAngle; }
-            set { _nativeLight.SpotAngle = value; serializableData.spotAngle = value; }
-        }
-
-        /// <summary>
-        /// Falloff angle covered by a spot light. Falloff angle determines at what point does light intensity starts 
-        /// linearly falling off as the angle approaches the total spot angle. Ignored by other light types.
-        /// </summary>
-        public Degree SpotFalloffAngle
-        {
-            get { return _nativeLight.SpotFalloffAngle; }
-            set { _nativeLight.SpotFalloffAngle = value; serializableData.spotFalloffAngle = value; }
-        }
-
-        /// <summary>
-        /// If enabled the <see cref="AttenuationRadius"/> property will automatically be controlled in order to provide
-        /// reasonable light radius, depending on its intensity.
-        /// </summary>
-        public bool UseAutoAttenuation
-        {
-            get { return _nativeLight.UseAutoAttenuation; }
-            set { _nativeLight.UseAutoAttenuation = value; serializableData.useAutoAttenuation = value; }
-        }
-
-        /// <summary>
-        /// Determines does this light cast a shadow when rendered.
-        /// </summary>
-        public bool CastsShadow
-        {
-            get { return _nativeLight.CastsShadow; }
-            set { _nativeLight.CastsShadow = value; serializableData.castShadows = value; }
-        }
-
-        /// <summary>
-        /// Returns world space bounds that completely encompass the light's area of influence.
-        /// </summary>
-        public Sphere Bounds
-        {
-            get { Native.UpdateTransform(SceneObject); return Native.Bounds; }
-        }
-
-        private void OnReset()
-        {
-            if (_nativeLight != null)
-                _nativeLight.OnDestroy();
-
-            _nativeLight = new NativeLight(SceneObject);
-
-            // Restore saved values after reset
-            _nativeLight.Color = serializableData.color;
-            _nativeLight.SpotAngle = serializableData.spotAngle;
-            _nativeLight.SpotFalloffAngle = serializableData.spotFalloffAngle;
-            _nativeLight.AttenuationRadius = serializableData.attenuationRadius;
-            _nativeLight.SourceRadius = serializableData.sourceRadius;
-            _nativeLight.Intensity = serializableData.intensity;
-            _nativeLight.Type = serializableData.type;
-            _nativeLight.CastsShadow = serializableData.castShadows;
-            _nativeLight.UseAutoAttenuation = serializableData.useAutoAttenuation;
-        }
-
-        private void OnUpdate()
-        {
-            _nativeLight.UpdateTransform(SceneObject);
-        }
-
-        private void OnDestroy()
-        {
-            _nativeLight.OnDestroy();
-        }
-
-        /// <inheritdoc/>
-        protected internal override bool CalculateBounds(out AABox box, out Sphere sphere)
-        {
-            sphere = Bounds;
-
-            Vector3 extents = new Vector3(sphere.Radius, sphere.Radius, sphere.Radius);
-            box = new AABox(sphere.Center - extents, sphere.Center + extents);
-
-            return true;
-        }
-
-        /// <summary>
-        /// Holds all data the light component needs to persist through serialization.
-        /// </summary>
-        [SerializeObject]
-        private class SerializableData
-        {
-            public Color color = Color.White;
-            public Degree spotAngle = new Degree(45);
-            public Degree spotFalloffAngle = new Degree(40);
-            public float attenuationRadius = 10.0f;
-            public float sourceRadius = 0.0f;
-            public float intensity = 5.0f;
-            public LightType type = LightType.Radial;
-            public bool castShadows = false;
-            public bool useAutoAttenuation = true;
-        }
-    }
-
-    /** @} */
-}

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

@@ -1,274 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** 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>
-    [SerializeObject]
-    public class AutoExposureSettings
-    {
-        /// <summary>
-        /// Determines minimum luminance value in the eye adaptation histogram. The histogram is used for calculating the
-        /// average brightness of the scene.Any luminance value below this value will not be included in the histogram and
-        /// ignored in scene brightness calculations. In log2 units (-8 = 1/256). In the range [-16, 0].
-        /// </summary>
-        public float HistogramLog2Min;
-
-        /// <summary>
-        /// Determines maximum luminance value in the eye adaptation histogram. The histogram is used for calculating the
-        /// average brightness of the scene.Any luminance value above this value will not be included in the histogram and
-        /// ignored in scene brightness calculations. In log2 units (4 = 16). In the range [0, 16].
-        /// </summary>
-        public float HistogramLog2Max;
-
-        /// <summary>
-        /// 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 (for
-        /// example a few very dark pixels in an otherwise bright image). In range [0.0f, 1.0f].
-        /// </summary>
-        public float HistogramPctLow;
-
-        /// <summary>
-        /// 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 (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 (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 (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;
-
-        /// <summary>
-        /// Determines how quickly does the eye adaptation adjust to larger values. This affects how quickly does the
-        /// automatic exposure changes when the scene brightness increases. In range [0.01f, 20.0f].
-        /// </summary>
-        public float EyeAdaptationSpeedUp;
-
-        /// <summary>
-        /// Determines how quickly does the eye adaptation adjust to smaller values. This affects how quickly does the
-        /// automatic exposure changes when the scene brightness decreases. In range [0.01f, 20.0f].
-        /// </summary>
-        public float EyeAdaptationSpeedDown;
-    };
-
-    /// <summary>
-    /// Settings that control tonemap post-process.
-    /// </summary>
-    [SerializeObject]
-    public class TonemappingSettings
-    {
-        /// <summary>
-        /// Controls the shoulder (upper non-linear) section of the filmic curve used for tonemapping. Mostly affects bright
-        /// areas of the image and allows you to reduce over-exposure.
-        /// </summary>
-        public float FilmicCurveShoulderStrength;
-
-        /// <summary>
-        /// Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of
-        /// the image.
-        /// </summary>
-        public float FilmicCurveLinearStrength;
-
-        /// <summary>
-        /// Controls the linear (middle) section of the filmic curve used for tonemapping. Mostly affects mid-range areas of
-        /// the image and allows you to control how quickly does the curve climb.
-        /// </summary>
-        public float FilmicCurveLinearAngle;
-
-        /// <summary>
-        /// Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Mostly affects dark areas
-        /// of the image and allows you to reduce under-exposure.
-        /// </summary>
-        public float FilmicCurveToeStrength;
-
-        /// <summary>
-        /// Controls the toe (lower non-linear) section of the filmic curve. used for tonemapping. Affects low-range.
-        /// </summary>
-        public float FilmicCurveToeNumerator;
-
-        /// <summary>
-        /// Controls the toe (lower non-linear) section of the filmic curve used for tonemapping. Affects low-range.
-        /// </summary>
-        public float FilmicCurveToeDenominator;
-
-        /// <summary>
-        /// Controls the white point of the filmic curve used for tonemapping. Affects the entire curve.
-        /// </summary>
-        public float FilmicCurveLinearWhitePoint;
-    };
-
-    /// <summary>
-    /// Settings that control white balance post-process.
-    /// </summary>
-    [SerializeObject]
-    public class WhiteBalanceSettings
-    {
-        /// <summary>
-        /// Temperature used for white balancing, in Kelvins.
-        /// 
-        /// Moves along the Planckian locus. In range [1500.0f, 15000.0f].
-        /// </summary>
-        public float Temperature;
-
-        /// <summary>
-        /// 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 <see cref="Temperature"/>.
-        /// 
-        /// In range [-1.0f, 1.0f].
-        /// </summary>
-        public float Tint;
-    };
-
-    /// <summary>
-    /// Settings that control color grading post-process.
-    /// </summary>
-    [SerializeObject]
-    public class ColorGradingSettings
-    {
-        /// <summary>
-        /// Saturation to be applied during color grading. Larger values increase vibrancy of the image. 
-        /// In range [0.0f, 2.0f].
-        /// </summary>
-        public Vector3 Saturation;
-
-        /// <summary>
-        /// Contrast to be applied during color grading. Larger values increase difference between light and dark areas of
-        /// the image. In range [0.0f, 2.0f]. 
-        /// </summary>
-        public Vector3 Contrast;
-
-        /// <summary>
-        /// Gain to be applied during color grading. Simply increases all color values by an equal scale. 
-        /// In range [0.0f, 2.0f].
-        /// </summary>
-        public Vector3 Gain;
-
-        /// <summary>
-        /// Gain to be applied during color grading. Simply offsets all color values by an equal amount.
-        /// In range [-1.0f, 1.0f].
-        /// </summary>
-        public Vector3 Offset;
-    };
-
-    /// <summary>
-    /// Settings that control rendering operations for a single camera.
-    /// </summary>
-    [SerializeObject]
-    public class RenderSettings
-    {
-        /// <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
-        /// by <see cref="AutoExposure"/> to customize the automatic exposure effect.You may also use 
-        /// <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;
-
-        /// <summary>
-        /// Parameters used for customizing automatic scene exposure. <see cref="EnableAutoExposure"/>
-        /// </summary>
-        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 <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;
-
-        /// <summary>
-        /// Parameters used for customizing tonemapping. <see cref="EnableTonemapping"/>
-        /// </summary>
-        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;
-
-        /// <summary>
-        /// Parameters used for customizing color grading.
-        /// </summary>
-        public ColorGradingSettings ColorGrading;
-
-        /// <summary>
-        /// 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;
-
-        /// <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;
-
-        /// <summary>
-        /// High dynamic range allows light intensity to be more correctly recorded when rendering by allowing for a larger
-        /// range of values. The stored light is then converted into visible color range using exposure and a tone mapping 
-        /// operator.
-        /// </summary>
-        public bool EnableHDR;
-
-        /// <summary>
-        /// Determines if scene objects will be lit by lights. If disabled everything will be rendered using their albedo
-        /// texture with no lighting applied.
-        /// </summary>
-        public bool EnableLighting;
-
-        /// <summary>
-        /// Determines if shadows cast by lights should be rendered. Only relevant if lighting is turned on.
-        /// </summary>
-        public bool EnableShadows;
-
-        /// <summary>
-        /// Signals the renderer to only render overlays (like GUI), and not scene objects. Such rendering doesn't require
-        /// depth buffer or multi-sampled render targets and will not render any scene objects. This can improve performance
-        /// and memory usage for overlay-only views. 
-        /// </summary>
-        public bool OverlayOnly;
-
-        /// <summary>
-        /// Creates a new instance of render settings with the optimal default values.
-        /// </summary>
-        /// <returns>New instance of render settings.</returns>
-        public static RenderSettings CreateDefault()
-        {
-            return Internal_CreateDefault();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern RenderSettings Internal_CreateDefault();
-    }
-}

+ 0 - 108
Source/MBansheeEngine/Rendering/RenderTarget.cs

@@ -1,108 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Rendering
-     *  @{
-     */
-
-    /// <summary>
-    /// Render target is a frame buffer or a texture that the render system renders the scene to.
-    /// </summary>
-    public class RenderTarget : ScriptObject
-    {
-        /// <summary>
-        /// Returns the width of the render target, in pixels.
-        /// </summary>
-        public int Width
-        {
-            get
-            {
-                int value;
-                Internal_GetWidth(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Returns the height of the render target, in pixels.
-        /// </summary>
-        public int Height
-        {
-            get
-            {
-                int value;
-                Internal_GetHeight(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Returns true if pixels written to the render target will be gamma corrected.
-        /// </summary>
-        public bool GammaCorrection
-        {
-            get
-            {
-                bool value;
-                Internal_GetGammaCorrection(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Gets the number of samples used for multisampling (0 or 1 if multisampling is not used).
-        /// </summary>
-        public int SampleCount
-        {
-            get
-            {
-                int value;
-                Internal_GetSampleCount(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Controls in what order is the render target rendered to compared to other render targets. Targets with higher 
-        /// priority will be rendered before ones with lower priority.
-        /// </summary>
-        public int Priority
-        {
-            get
-            {
-                int value;
-                Internal_GetPriority(mCachedPtr, out value);
-                return value;
-            }
-
-            set
-            {
-                Internal_SetPriority(mCachedPtr, value);
-            }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetWidth(IntPtr thisPtr, out int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetHeight(IntPtr thisPtr, out int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetGammaCorrection(IntPtr thisPtr, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetSampleCount(IntPtr thisPtr, out int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetPriority(IntPtr thisPtr, out int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPriority(IntPtr thisPtr, int value);
-    }
-
-    /** @} */
-}

+ 0 - 20
Source/MBansheeEngine/Rendering/RenderTexture.cs

@@ -1,20 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-
-namespace BansheeEngine
-{
-    /** @addtogroup Rendering
-     *  @{
-     */
-
-    /// <summary>
-    /// Base class for all render textures of specific dimensions. Render textures allow the rendering to be performed
-    /// into a texture as opposed to a frame buffer.
-    /// </summary>
-    public class RenderTexture : RenderTarget
-    {
-
-    }
-
-    /** @} */
-}

+ 0 - 125
Source/MBansheeEngine/Rendering/RenderTexture2D.cs

@@ -1,125 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    /** @addtogroup Rendering
-     *  @{
-     */
-
-    /// <summary>
-    /// A two dimensional render texture. Allows rendering to be performed into a 2D texture which can then be read, as
-    /// opposed to rendering directly into the frame buffer.
-    /// </summary>
-    public class RenderTexture2D : RenderTexture
-    {
-        /// <summary>
-        /// Creates a new 2D render texture.
-        /// </summary>
-        /// <param name="format">Pixel format of the texture. Format must be a valid uncompressed color format.</param>
-        /// <param name="width">Width of the texture in pixels.</param>
-        /// <param name="height">Height of the texture in pixels.</param>
-        /// <param name="numSamples">Number of samples contained per pixel.</param>
-        /// <param name="gammaCorrection">Determines should the pixels written on the texture be gamma corrected.</param>
-        /// <param name="createDepth">Should the render texture also contain a depth/stencil buffer.</param>
-        /// <param name="depthStencilFormat">Format of the depth/stencil buffer, if <paramref name="createDepth"/> is
-        ///                                  enabled. Format must be a valid depth/stencil format.</param>
-        public RenderTexture2D(PixelFormat format, int width, int height, int numSamples = 1, 
-            bool gammaCorrection = false, bool createDepth = false, PixelFormat depthStencilFormat = PixelFormat.D32)
-        {
-            Internal_CreateDetailed(this, format, width, height, numSamples, gammaCorrection, createDepth, depthStencilFormat);
-        }
-
-        /// <summary>
-        /// Creates a new 2D render texture using existing textures as render destinations.
-        /// </summary>
-        /// <param name="colorSurface">Color texture to render color data to.</param>
-        /// <param name="depthStencilSurface">Optional depth/stencil texture to render depth/stencil data to.</param>
-        public RenderTexture2D(Texture colorSurface, Texture depthStencilSurface = null)
-        {
-            IntPtr[] colorSurfaceInstances = new IntPtr[1];
-            colorSurfaceInstances[0] = colorSurface.GetCachedPtr();
-
-            IntPtr depthStencilInstance = IntPtr.Zero;
-            if (depthStencilSurface != null)
-                depthStencilInstance = depthStencilSurface.GetCachedPtr();
-
-            Internal_Create(this, colorSurfaceInstances, depthStencilInstance);
-        }
-
-        /// <summary>
-        /// Creates a new 2D render texture using one or multiple color textures and a depth/stencil texture.
-        /// </summary>
-        /// <param name="colorSurfaces">Color texture(s) to render color data to. </param>
-        /// <param name="depthStencilSurface">>Optional depth/stencil texture to render depth/stencil data to.</param>
-        public RenderTexture2D(Texture[] colorSurfaces, Texture depthStencilSurface = null)
-        {
-            IntPtr[] colorSurfaceInstances = new IntPtr[colorSurfaces.Length];
-
-            for(int i = 0; i < colorSurfaces.Length; i++)
-                colorSurfaceInstances[i] = colorSurfaces[i] != null ? colorSurfaces[i].GetCachedPtr() : IntPtr.Zero;
-
-            IntPtr depthStencilInstance = IntPtr.Zero;
-            if (depthStencilSurface != null)
-                depthStencilInstance = depthStencilSurface.GetCachedPtr();
-
-            Internal_Create(this, colorSurfaceInstances, depthStencilInstance);
-        }
-
-        /// <summary>
-        /// Returns the primary color surface that contains rendered color data.
-        /// </summary>
-        public Texture colorSurface
-        {
-            get
-            {
-                Texture[] surfaces;
-                Internal_GetColorSurfaces(mCachedPtr, out surfaces);
-                return surfaces[0];
-            }
-        }
-
-        /// <summary>
-        /// Returns all of the color surfaces.
-        /// </summary>
-        public Texture[] colorSurfaces
-        {
-            get
-            {
-                Texture[] surfaces;
-                Internal_GetColorSurfaces(mCachedPtr, out surfaces);
-                return surfaces;
-            }
-        }
-
-        /// <summary>
-        /// Returns the depth/stencil surface that contains rendered depth and stencil data.
-        /// </summary>
-        public Texture depthStencilSurface
-        {
-            get
-            {
-                Texture surface;
-                Internal_GetDepthStencilSurface(mCachedPtr, out surface);
-                return surface;
-            }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateDetailed(RenderTexture2D instance, PixelFormat format, 
-            int width, int height, int numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Create(RenderTexture2D instance, IntPtr[] colorSurfaces, IntPtr depthStencilSurface);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetColorSurfaces(IntPtr thisPtr, out Texture[] surfaces);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetDepthStencilSurface(IntPtr thisPtr, out Texture surface);
-    }
-
-    /** @} */
-}

+ 6 - 5
Source/RenderBeast/BsRenderBeast.cpp

@@ -420,26 +420,27 @@ namespace bs { namespace ct
 		SPtr<RenderTarget> target = viewProps.target;
 		SPtr<Viewport> viewport = camera->getViewport();
 
+		ClearFlags clearFlags = viewport->getClearFlags();
 		UINT32 clearBuffers = 0;
-		if (viewport->getRequiresColorClear())
+		if (clearFlags.isSet(ClearFlagBits::Color))
 			clearBuffers |= FBT_COLOR;
 
-		if (viewport->getRequiresDepthClear())
+		if (clearFlags.isSet(ClearFlagBits::Depth))
 			clearBuffers |= FBT_DEPTH;
 
-		if (viewport->getRequiresStencilClear())
+		if (clearFlags.isSet(ClearFlagBits::Stencil))
 			clearBuffers |= FBT_STENCIL;
 
 		if (clearBuffers != 0)
 		{
 			RenderAPI::instance().setRenderTarget(target);
-			RenderAPI::instance().clearViewport(clearBuffers, viewport->getClearColor(),
+			RenderAPI::instance().clearViewport(clearBuffers, viewport->getClearColorValue(),
 				viewport->getClearDepthValue(), viewport->getClearStencilValue());
 		}
 		else
 			RenderAPI::instance().setRenderTarget(target, 0, RT_COLOR0);
 
-		RenderAPI::instance().setViewport(viewport->getNormArea());
+		RenderAPI::instance().setViewport(viewport->getArea());
 
 		// Trigger overlay callbacks
 		auto iterRenderCallback = mCallbacks.begin();

+ 7 - 10
Source/RenderBeast/BsRendererScene.cpp

@@ -512,29 +512,26 @@ namespace bs {	namespace ct
 	RENDERER_VIEW_DESC RendererScene::createViewDesc(Camera* camera) const
 	{
 		SPtr<Viewport> viewport = camera->getViewport();
+		ClearFlags clearFlags = viewport->getClearFlags();
 		RENDERER_VIEW_DESC viewDesc;
 
 		viewDesc.target.clearFlags = 0;
-		if (viewport->getRequiresColorClear())
+		if (clearFlags.isSet(ClearFlagBits::Color))
 			viewDesc.target.clearFlags |= FBT_COLOR;
 
-		if (viewport->getRequiresDepthClear())
+		if (clearFlags.isSet(ClearFlagBits::Depth))
 			viewDesc.target.clearFlags |= FBT_DEPTH;
 
-		if (viewport->getRequiresStencilClear())
+		if (clearFlags.isSet(ClearFlagBits::Stencil))
 			viewDesc.target.clearFlags |= FBT_STENCIL;
 
-		viewDesc.target.clearColor = viewport->getClearColor();
+		viewDesc.target.clearColor = viewport->getClearColorValue();
 		viewDesc.target.clearDepthValue = viewport->getClearDepthValue();
 		viewDesc.target.clearStencilValue = viewport->getClearStencilValue();
 
 		viewDesc.target.target = viewport->getTarget();
-		viewDesc.target.nrmViewRect = viewport->getNormArea();
-		viewDesc.target.viewRect = Rect2I(
-			viewport->getX(),
-			viewport->getY(),
-			(UINT32)viewport->getWidth(),
-			(UINT32)viewport->getHeight());
+		viewDesc.target.nrmViewRect = viewport->getArea();
+		viewDesc.target.viewRect = viewport->getPixelArea();
 
 		if (viewDesc.target.target != nullptr)
 		{

+ 3 - 2
Source/SBansheeEditor/Wrappers/BsScriptEditorApplication.cpp

@@ -18,12 +18,13 @@
 #include "Script/BsScriptManager.h"
 #include "GUI/BsGUIMenuBar.h"
 #include "BsPlayInEditorManager.h"
-#include "Wrappers/BsScriptRenderTarget.h"
 #include "Platform/BsPlatform.h"
 #include "BsScriptResourceManager.h"
 #include "FileSystem/BsFileSystem.h"
 #include "Wrappers/BsScriptPrefab.h"
 
+#include "BsScriptRenderTexture.generated.h"
+
 namespace bs
 {
 	bool ScriptEditorApplication::mRequestProjectLoad = false;
@@ -342,7 +343,7 @@ namespace bs
 		if (renderTarget == nullptr)
 			SceneManager::instance().setMainRenderTarget(nullptr);
 		else
-			SceneManager::instance().setMainRenderTarget(renderTarget->getNativeValue());
+			SceneManager::instance().setMainRenderTarget(renderTarget->getInternal());
 	}
 
 	bool ScriptEditorApplication::internal_HasFocus()

+ 5 - 3
Source/SBansheeEditor/Wrappers/BsScriptSceneGizmos.cpp

@@ -1,8 +1,10 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "Wrappers/BsScriptSceneGizmos.h"
-#include "Wrappers/BsScriptCamera.h"
 #include "Scene/BsGizmoManager.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -24,9 +26,9 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_Draw", (void*)&ScriptSceneGizmos::internal_Draw);
 	}
 
-	void ScriptSceneGizmos::internal_Create(MonoObject* managedInstance, ScriptCamera* camera)
+	void ScriptSceneGizmos::internal_Create(MonoObject* managedInstance, ScriptCCamera* camera)
 	{
-		new (bs_alloc<ScriptSceneGizmos>()) ScriptSceneGizmos(managedInstance, camera->getInternal());
+		new (bs_alloc<ScriptSceneGizmos>()) ScriptSceneGizmos(managedInstance, camera->getHandle()->_getCamera());
 	}
 
 	void ScriptSceneGizmos::internal_Draw(ScriptSceneGizmos* thisPtr)

+ 3 - 1
Source/SBansheeEditor/Wrappers/BsScriptSceneGizmos.h

@@ -7,6 +7,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEditor
 	 *  @{
 	 */
@@ -26,7 +28,7 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptCamera* camera);
+		static void internal_Create(MonoObject* managedInstance, ScriptCCamera* camera);
 		static void internal_Draw(ScriptSceneGizmos* thisPtr);
 	};
 

+ 5 - 3
Source/SBansheeEditor/Wrappers/BsScriptSceneGrid.cpp

@@ -1,9 +1,11 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "Wrappers/BsScriptSceneGrid.h"
-#include "Wrappers/BsScriptCamera.h"
 #include "BsEditorApplication.h"
 #include "Scene/BsSceneGrid.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -26,9 +28,9 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_SetMode", (void*)&ScriptSceneGrid::internal_SetMode);
 	}
 
-	void ScriptSceneGrid::internal_Create(MonoObject* managedInstance, ScriptCamera* camera)
+	void ScriptSceneGrid::internal_Create(MonoObject* managedInstance, ScriptCCamera* camera)
 	{
-		new (bs_alloc<ScriptSceneGrid>()) ScriptSceneGrid(managedInstance, camera->getInternal());
+		new (bs_alloc<ScriptSceneGrid>()) ScriptSceneGrid(managedInstance, camera->getHandle()->_getCamera());
 	}
 
 	void ScriptSceneGrid::internal_Draw(ScriptSceneGrid* thisPtr)

+ 3 - 1
Source/SBansheeEditor/Wrappers/BsScriptSceneGrid.h

@@ -7,6 +7,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEditor
 	 *  @{
 	 */
@@ -26,7 +28,7 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptCamera* camera);
+		static void internal_Create(MonoObject* managedInstance, ScriptCCamera* camera);
 		static void internal_Draw(ScriptSceneGrid* thisPtr);
 		static void internal_SetMode(ScriptSceneGrid* thisPtr, UINT32 mode);
 	};

+ 5 - 3
Source/SBansheeEditor/Wrappers/BsScriptSceneHandles.cpp

@@ -1,7 +1,6 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "Wrappers/BsScriptSceneHandles.h"
-#include "Wrappers/BsScriptCamera.h"
 #include "Wrappers/BsScriptEditorWindow.h"
 #include "Platform/BsCursor.h"
 #include "RenderAPI/BsRenderWindow.h"
@@ -9,6 +8,9 @@
 #include "EditorWindow/BsEditorWindow.h"
 #include "Handles/BsHandleManager.h"
 #include "BsEditorApplication.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -67,14 +69,14 @@ namespace bs
 		return offset;
 	}
 
-	void ScriptSceneHandles::internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera)
+	void ScriptSceneHandles::internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCCamera* camera)
 	{
 		EditorWidgetBase* widget = nullptr;
 
 		if (parentWindow != nullptr && !parentWindow->isDestroyed())
 			widget = parentWindow->getEditorWidget();
 
-		new (bs_alloc<ScriptSceneHandles>()) ScriptSceneHandles(managedInstance, widget, camera->getInternal());
+		new (bs_alloc<ScriptSceneHandles>()) ScriptSceneHandles(managedInstance, widget, camera->getHandle()->_getCamera());
 	}
 
 	void ScriptSceneHandles::internal_Draw(ScriptSceneHandles* thisPtr)

+ 3 - 1
Source/SBansheeEditor/Wrappers/BsScriptSceneHandles.h

@@ -8,6 +8,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEditor
 	 *  @{
 	 */
@@ -38,7 +40,7 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera);
+		static void internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCCamera* camera);
 		static void internal_Draw(ScriptSceneHandles* thisPtr);
 		static void internal_BeginInput();
 		static void internal_EndInput();

+ 6 - 4
Source/SBansheeEditor/Wrappers/BsScriptSceneSelection.cpp

@@ -1,14 +1,16 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "Wrappers/BsScriptSceneSelection.h"
-#include "Wrappers/BsScriptCamera.h"
 #include "Scene/BsSelectionRenderer.h"
 #include "Wrappers/BsScriptSceneObject.h"
 #include "BsScriptGameObjectManager.h"
 #include "Scene/BsScenePicking.h"
 #include "Scene/BsSelection.h"
 #include "BsMonoPrerequisites.h"
-#include <BsMonoArray.h>
+#include "BsMonoArray.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -32,9 +34,9 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_Snap", (void*)&ScriptSceneSelection::internal_Snap);
 	}
 
-	void ScriptSceneSelection::internal_Create(MonoObject* managedInstance, ScriptCamera* camera)
+	void ScriptSceneSelection::internal_Create(MonoObject* managedInstance, ScriptCCamera* camera)
 	{
-		new (bs_alloc<ScriptSceneSelection>()) ScriptSceneSelection(managedInstance, camera->getInternal());
+		new (bs_alloc<ScriptSceneSelection>()) ScriptSceneSelection(managedInstance, camera->getHandle()->_getCamera());
 	}
 
 	void ScriptSceneSelection::internal_Draw(ScriptSceneSelection* thisPtr)

+ 3 - 1
Source/SBansheeEditor/Wrappers/BsScriptSceneSelection.h

@@ -8,6 +8,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEditor
 	 *  @{
 	 */
@@ -28,7 +30,7 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptCamera* camera);
+		static void internal_Create(MonoObject* managedInstance, ScriptCCamera* camera);
 		static void internal_Draw(ScriptSceneSelection* thisPtr);
 		static void internal_PickObject(ScriptSceneSelection* thisPtr, Vector2I* inputPos, bool additive, MonoArray* ignoreRenderables);
 		static void internal_PickObjects(ScriptSceneSelection* thisPtr, Vector2I* inputPos, Vector2I* area, bool additive, MonoArray* ignoreRenderables);

+ 1 - 2
Source/SBansheeEngine/BsScriptEnginePrerequisites.h

@@ -84,8 +84,7 @@ namespace bs
 	class ScriptManagedComponent;
 	class ScriptManagedResource;
 	class ScriptRenderTarget;
-	class ScriptRenderTexture2D;
-	class ScriptCamera;
+	class ScriptRenderTexture;
 	class ManagedComponent;
 	class ManagedSerializableFieldData;
 	class ManagedSerializableFieldKey;

+ 2 - 12
Source/SBansheeEngine/CMakeSources.cmake

@@ -55,7 +55,6 @@ set(BS_SBANSHEEENGINE_INC_SERIALIZATION_RTTI
 
 set(BS_SBANSHEEENGINE_INC_WRAPPERS
 	"Wrappers/BsScriptBuiltin.h"
-	"Wrappers/BsScriptCamera.h"
 	"Wrappers/BsScriptColor.h"
 	"Wrappers/BsScriptComponent.h"
 	"Wrappers/BsScriptContextMenu.h"
@@ -68,16 +67,12 @@ set(BS_SBANSHEEENGINE_INC_WRAPPERS
 	"Wrappers/BsScriptHString.h"
 	"Wrappers/BsScriptInput.h"
 	"Wrappers/BsScriptInputConfiguration.h"
-	"Wrappers/BsScriptLight.h"
 	"Wrappers/BsScriptLogEntry.h"
 	"Wrappers/BsScriptManagedResource.h"
 	"Wrappers/BsScriptPixelUtility.h"
 	"Wrappers/BsScriptPlainText.h"
 	"Wrappers/BsScriptPrefab.h"
 	"Wrappers/BsScriptProfilerOverlayInternal.h"
-	"Wrappers/BsScriptRenderTarget.h"
-	"Wrappers/BsScriptRenderTexture.h"
-	"Wrappers/BsScriptRenderTexture2D.h"
 	"Wrappers/BsScriptResource.h"
 	"Wrappers/BsScriptVirtualInput.h"
 	"Wrappers/BsScriptVirtualButton.h"
@@ -99,7 +94,6 @@ set(BS_SBANSHEEENGINE_INC_WRAPPERS
 	"Wrappers/BsScriptScene.h"
 	"Wrappers/BsScriptResources.h"
 	"Wrappers/BsScriptResourceRef.h"
-	"Wrappers/BsScriptRenderSettings.h"
 	"Wrappers/BsScriptManagedComponent.h"
 	"Wrappers/BsScriptQuaternion.h"
 )
@@ -147,7 +141,6 @@ set(BS_SBANSHEEENGINE_SRC_SERIALIZATION
 
 set(BS_SBANSHEEENGINE_SRC_WRAPPERS
 	"Wrappers/BsScriptBuiltin.cpp"
-	"Wrappers/BsScriptCamera.cpp"
 	"Wrappers/BsScriptColor.cpp"
 	"Wrappers/BsScriptComponent.cpp"
 	"Wrappers/BsScriptContextMenu.cpp"
@@ -160,7 +153,6 @@ set(BS_SBANSHEEENGINE_SRC_WRAPPERS
 	"Wrappers/BsScriptHString.cpp"
 	"Wrappers/BsScriptInput.cpp"
 	"Wrappers/BsScriptInputConfiguration.cpp"
-	"Wrappers/BsScriptLight.cpp"
 	"Wrappers/BsScriptLogEntry.cpp"
 	"Wrappers/BsScriptManagedResource.cpp"
 	"Wrappers/BsScriptPixelUtility.cpp"
@@ -188,10 +180,6 @@ set(BS_SBANSHEEENGINE_SRC_WRAPPERS
 	"Wrappers/BsScriptResources.cpp"
 	"Wrappers/BsScriptResourceRef.cpp"
 	"Wrappers/BsScriptResource.cpp"
-	"Wrappers/BsScriptRenderTexture2D.cpp"
-	"Wrappers/BsScriptRenderTexture.cpp"
-	"Wrappers/BsScriptRenderTarget.cpp"
-	"Wrappers/BsScriptRenderSettings.cpp"
 	"Wrappers/BsScriptManagedComponent.cpp"
 	"Wrappers/BsScriptQuaternion.cpp"
 )
@@ -243,6 +231,7 @@ set(BS_SBANSHEEENGINE_INC_EXTENSIONS
 	"Extensions/BsAnimationEx.h"
 	"Extensions/BsShaderEx.h"
 	"Extensions/BsMaterialEx.h"
+	"Extensions/BsRenderTargetEx.h"
 )
 
 set(BS_SBANSHEEENGINE_SRC_EXTENSIONS
@@ -256,6 +245,7 @@ set(BS_SBANSHEEENGINE_SRC_EXTENSIONS
 	"Extensions/BsAnimationEx.cpp"
 	"Extensions/BsShaderEx.cpp"
 	"Extensions/BsMaterialEx.cpp"
+	"Extensions/BsRenderTargetEx.cpp"
 )
 
 source_group("Header Files" FILES ${BS_SBANSHEEENGINE_INC_NOFILTER})

+ 135 - 0
Source/SBansheeEngine/Extensions/BsRenderTargetEx.cpp

@@ -0,0 +1,135 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsRenderTargetEx.h"
+#include "BsScriptShaderParameter.generated.h"
+
+namespace bs
+{
+	UINT32 RenderTargetEx::getWidth(const SPtr<RenderTarget>& thisPtr)
+	{
+		return thisPtr->getProperties().width;
+	}
+
+	UINT32 RenderTargetEx::getHeight(const SPtr<RenderTarget>& thisPtr)
+	{
+		return thisPtr->getProperties().height;
+	}
+
+	bool RenderTargetEx::getGammaCorrection(const SPtr<RenderTarget>& thisPtr)
+	{
+		return thisPtr->getProperties().hwGamma;
+	}
+
+	INT32 RenderTargetEx::getPriority(const SPtr<RenderTarget>& thisPtr)
+	{
+		return thisPtr->getProperties().priority;
+	}
+
+	void RenderTargetEx::setPriority(const SPtr<RenderTarget>& thisPtr, INT32 priority)
+	{
+		thisPtr->setPriority(priority);
+	}
+
+	UINT32 RenderTargetEx::getSampleCount(const SPtr<RenderTarget>& thisPtr)
+	{
+		return thisPtr->getProperties().multisampleCount;
+	}
+
+	SPtr<RenderTexture> RenderTextureEx::create(PixelFormat format, int width, int height, int numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat)
+	{
+		TEXTURE_DESC texDesc;
+		texDesc.type = TEX_TYPE_2D;
+		texDesc.width = width;
+		texDesc.height = height;
+		texDesc.format = format;
+		texDesc.hwGamma = gammaCorrection;
+		texDesc.numSamples = numSamples;
+
+		return RenderTexture::create(texDesc, createDepth, depthStencilFormat);
+	}
+
+	SPtr<RenderTexture> RenderTextureEx::create(const HTexture& colorSurface)
+	{
+		return create(Vector<HTexture>{ colorSurface }, HTexture());
+	}
+
+	SPtr<RenderTexture> RenderTextureEx::create(const HTexture& colorSurface, const HTexture& depthStencilSurface)
+	{
+		return create(Vector<HTexture>{ colorSurface }, depthStencilSurface);
+	}
+
+	SPtr<RenderTexture> RenderTextureEx::create(const Vector<HTexture>& colorSurface)
+	{
+		return create(Vector<HTexture>{ colorSurface }, HTexture());
+	}
+		
+	SPtr<RenderTexture> RenderTextureEx::create(const Vector<HTexture>& colorSurfaces, const HTexture& depthStencilSurface)
+	{
+		RENDER_SURFACE_DESC depthStencilSurfaceDesc;
+		if (depthStencilSurface != nullptr)
+		{
+			depthStencilSurfaceDesc.face = 0;
+			depthStencilSurfaceDesc.mipLevel = 0;
+			depthStencilSurfaceDesc.numFaces = 1;
+
+			if (!depthStencilSurface.isLoaded())
+			{
+				LOGERR("Render texture must be created using a fully loaded texture.");
+			}
+			else
+				depthStencilSurfaceDesc.texture = depthStencilSurface;
+		}
+
+		UINT32 numSurfaces = std::min((UINT32)colorSurfaces.size(), (UINT32)BS_MAX_MULTIPLE_RENDER_TARGETS);
+
+		RENDER_TEXTURE_DESC desc;
+		for (UINT32 i = 0; i < numSurfaces; i++)
+		{
+			RENDER_SURFACE_DESC surfaceDesc;
+			surfaceDesc.face = 0;
+			surfaceDesc.mipLevel = 0;
+			surfaceDesc.numFaces = 1;
+
+			if (!colorSurfaces[i].isLoaded())
+			{
+				LOGERR("Render texture must be created using a fully loaded texture.");
+			}
+			else
+				surfaceDesc.texture = colorSurfaces[i];
+
+			desc.colorSurfaces[i] = surfaceDesc;
+		}
+
+		desc.depthStencilSurface = depthStencilSurfaceDesc;
+
+		return RenderTexture::create(desc);
+	}
+
+	Vector<HTexture> RenderTextureEx::getColorSurfaces(const SPtr<RenderTexture>& thisPtr)
+	{
+		UINT32 numColorSurfaces = BS_MAX_MULTIPLE_RENDER_TARGETS;
+
+		Vector<HTexture> output;
+		output.reserve(numColorSurfaces);
+
+		for (UINT32 i = 0; i < numColorSurfaces; i++)
+		{
+			HTexture colorTex = thisPtr->getColorTexture(i);
+
+			if (colorTex != nullptr)
+				output.push_back(colorTex);
+		}
+
+		return output;
+	}
+
+	HTexture RenderTextureEx::getColorSurface(const SPtr<RenderTexture>& thisPtr)
+	{
+		return thisPtr->getColorTexture(0);
+	}
+
+	HTexture RenderTextureEx::getDepthStencilSurface(const SPtr<RenderTexture>& thisPtr)
+	{
+		return thisPtr->getDepthStencilTexture();
+	}
+}

+ 113 - 0
Source/SBansheeEngine/Extensions/BsRenderTargetEx.h

@@ -0,0 +1,113 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "RenderAPI/BsRenderTexture.h"
+
+namespace bs
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+	/** @cond SCRIPT_EXTENSIONS */
+
+	 /** Extension class for RenderTarget, for adding additional functionality for the script interface. */
+	class BS_SCRIPT_EXPORT(e:RenderTarget) RenderTargetEx
+	{
+	public:
+		/** @copydoc RenderTargetProperties::width */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:Width,pr:getter)
+		static UINT32 getWidth(const SPtr<RenderTarget>& thisPtr);
+
+		/** @copydoc RenderTargetProperties::height */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:Height,pr:getter)
+		static UINT32 getHeight(const SPtr<RenderTarget>& thisPtr);
+
+		/** @copydoc RenderTargetProperties::hwGamma */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:GammaCorrection,pr:getter)
+		static bool getGammaCorrection(const SPtr<RenderTarget>& thisPtr);
+
+		/** @copydoc RenderTargetProperties::priority */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:Priority,pr:getter)
+		static INT32 getPriority(const SPtr<RenderTarget>& thisPtr);
+
+		/** @copydoc RenderTargetProperties::priority */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:Priority,pr:setter)
+		static void setPriority(const SPtr<RenderTarget>& thisPtr, INT32 priority);
+
+		/** @copydoc RenderTargetProperties::multisampleCount */
+		BS_SCRIPT_EXPORT(e:RenderTarget,n:SampleCount,pr:getter)
+		static UINT32 getSampleCount(const SPtr<RenderTarget>& thisPtr);
+	};
+
+	/** Extension class for RenderTexture, for adding additional functionality for the script interface. */
+	class BS_SCRIPT_EXPORT(e:RenderTexture) RenderTextureEx
+	{
+	public:
+		/**
+		 * Creates a new 2D render texture.
+		 *
+		 * @param[in]	format				Pixel format of the texture. Format must be a valid uncompressed color format.
+		 * @param[in]	width				Width of the texture in pixels.
+		 * @param[in]	height				Height of the texture in pixels.
+		 * @param[in]	numSamples			Number of samples contained per pixel.
+		 * @param[in]	gammaCorrection		Determines should the pixels written on the texture be gamma corrected.
+		 * @param[in]	createDepth			Should the render texture also contain a depth/stencil buffer.
+		 * @param[in]	depthStencilFormat	Format of the depth/stencil buffer, if @p createDepth is enabled. Format must
+		 *									be a valid depth/stencil format.
+		 */
+		BS_SCRIPT_EXPORT(ec:RenderTexture)
+		static SPtr<RenderTexture> create(PixelFormat format, int width, int height, int numSamples = 1, bool gammaCorrection = false,
+			bool createDepth = false, PixelFormat depthStencilFormat = PF_D32);
+
+		/**
+		 * Creates a new 2D render texture using an existing color texture, and no depth-stencil texture.
+		 *
+		 * @param[in]	colorSurface			Color texture to render color data to.
+		 */
+		BS_SCRIPT_EXPORT(ec:RenderTexture)
+		static SPtr<RenderTexture> create(const HTexture& colorSurface);
+
+		/**
+		 * Creates a new 2D render texture using existing textures as render destinations.
+		 *
+		 * @param[in]	colorSurface			Color texture to render color data to.
+		 * @param[in]	depthStencilSurface		Optional depth/stencil texture to render depth/stencil data to.
+		 */
+		BS_SCRIPT_EXPORT(ec:RenderTexture)
+		static SPtr<RenderTexture> create(const HTexture& colorSurface, const HTexture& depthStencilSurface);
+
+		/**
+		 * Creates a new 2D render texture using one or multiple color textures and no depth-stencil texture.
+		 *
+		 * @param[in]	colorSurface			Color texture(s) to render color data to.
+		 */
+		BS_SCRIPT_EXPORT(ec:RenderTexture)
+		static SPtr<RenderTexture> create(const Vector<HTexture>& colorSurface);
+
+		/**
+		 * Creates a new 2D render texture using one or multiple color textures and a depth/stencil texture.
+		 *
+		 * @param[in]	colorSurface			Color texture(s) to render color data to.
+		 * @param[in]	depthStencilSurface		Optional depth/stencil texture to render depth/stencil data to.
+		 */
+		BS_SCRIPT_EXPORT(ec:RenderTexture)
+		static SPtr<RenderTexture> create(const Vector<HTexture>& colorSurface, const HTexture& depthStencilSurface);
+
+		/** Returns the primary color surface that contains rendered color data. */
+		BS_SCRIPT_EXPORT(e:RenderTexture,n:ColorSurface,pr:getter)
+		static HTexture getColorSurface(const SPtr<RenderTexture>& thisPtr);
+
+		/** Returns all the color surfaces. */
+		BS_SCRIPT_EXPORT(e:RenderTexture,n:ColorSurfaces,pr:getter)
+		static Vector<HTexture> getColorSurfaces(const SPtr<RenderTexture>& thisPtr);
+
+		/** Returns the depth/stencil surface that contains rendered depth and stencil data. */
+		BS_SCRIPT_EXPORT(e:RenderTexture,n:DepthStencilSurface,pr:getter)
+		static HTexture getDepthStencilSurface(const SPtr<RenderTexture>& thisPtr);
+	};
+
+	/** @endcond */
+	/** @} */
+}

+ 5 - 5
Source/SBansheeEngine/Extensions/BsTextureEx.h

@@ -65,11 +65,11 @@ namespace bs
 		 * texture has to be created with TextureUsage.CPUCached. If the texture was updated from the GPU the
 		 * pixels retrieved from this method will not reflect that, and you should use GetGPUPixels instead.
 		 * 
-         * @param mipLevel	Mip level to retrieve pixels for. Top level (0) is the highest quality.
-         * @param face		Face to read the pixels from. Cubemap textures have six faces whose face indices are as
-         *					specified in the CubeFace enum. Array textures can have an arbitrary number of faces (if it's a
-         *					cubemap array it has to be a multiple of 6).
-         * @return			A set of pixels for the specified mip level.
+		 * @param mipLevel	Mip level to retrieve pixels for. Top level (0) is the highest quality.
+		 * @param face		Face to read the pixels from. Cubemap textures have six faces whose face indices are as
+		 *					specified in the CubeFace enum. Array textures can have an arbitrary number of faces (if it's a
+		 *					cubemap array it has to be a multiple of 6).
+		 * @return			A set of pixels for the specified mip level.
 		 */
 		BS_SCRIPT_EXPORT(e:Texture,n:GetPixels)
 		static SPtr<PixelData> getPixels(const HTexture& thisPtr, UINT32 face = 0, UINT32 mipLevel = 0);

+ 0 - 507
Source/SBansheeEngine/Wrappers/BsScriptCamera.cpp

@@ -1,507 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptCamera.h"
-#include "BsScriptMeta.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-#include "Renderer/BsCamera.h"
-#include "Wrappers/BsScriptSceneObject.h"
-#include "Scene/BsSceneObject.h"
-#include "Wrappers/BsScriptRenderTarget.h"
-#include "Scene/BsSceneManager.h"
-#include "RenderAPI/BsViewport.h"
-#include "RenderAPI/BsRenderTarget.h"
-#include "RenderAPI/BsRenderWindow.h"
-#include "RenderAPI/BsRenderTexture.h"
-#include "GUI/BsGUIManager.h"
-#include "Renderer/BsRenderSettings.h"
-#include "Wrappers/BsScriptRenderSettings.h"
-
-namespace bs
-{
-	ScriptCamera::ScriptCamera(MonoObject* managedInstance, const HSceneObject& parentSO)
-		:ScriptObject(managedInstance), mCamera(nullptr), mLastUpdateHash(0)
-	{ 
-		mCamera = Camera::create(nullptr);
-		gSceneManager()._registerCamera(mCamera, parentSO);
-	}
-
-	ScriptCamera::~ScriptCamera()
-	{
-
-	}
-
-	void ScriptCamera::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_Create", (void*)&ScriptCamera::internal_Create);
-
-		metaData.scriptClass->addInternalCall("Internal_GetAspect", (void*)&ScriptCamera::internal_GetAspect);
-		metaData.scriptClass->addInternalCall("Internal_SetAspect", (void*)&ScriptCamera::internal_SetAspect);
-		metaData.scriptClass->addInternalCall("Internal_GetNearClip", (void*)&ScriptCamera::internal_GetNearClip);
-		metaData.scriptClass->addInternalCall("Internal_SetNearClip", (void*)&ScriptCamera::internal_SetNearClip);
-
-		metaData.scriptClass->addInternalCall("Internal_GetFarClip", (void*)&ScriptCamera::internal_GetFarClip);
-		metaData.scriptClass->addInternalCall("Internal_SetFarClip", (void*)&ScriptCamera::internal_SetFarClip);
-
-		metaData.scriptClass->addInternalCall("Internal_GetFieldOfView", (void*)&ScriptCamera::internal_GetFieldOfView);
-		metaData.scriptClass->addInternalCall("Internal_SetFieldOfView", (void*)&ScriptCamera::internal_SetFieldOfView);
-
-		metaData.scriptClass->addInternalCall("Internal_GetViewportRect", (void*)&ScriptCamera::internal_GetViewportRect);
-		metaData.scriptClass->addInternalCall("Internal_SetViewportRect", (void*)&ScriptCamera::internal_SetViewportRect);
-
-		metaData.scriptClass->addInternalCall("Internal_GetProjectionType", (void*)&ScriptCamera::internal_GetProjectionType);
-		metaData.scriptClass->addInternalCall("Internal_SetProjectionType", (void*)&ScriptCamera::internal_SetProjectionType);
-
-		metaData.scriptClass->addInternalCall("Internal_GetOrthographicHeight", (void*)&ScriptCamera::internal_GetOrthographicHeight);
-		metaData.scriptClass->addInternalCall("Internal_SetOrthographicHeight", (void*)&ScriptCamera::internal_SetOrthographicHeight);
-
-		metaData.scriptClass->addInternalCall("Internal_GetOrthographicWidth", (void*)&ScriptCamera::internal_GetOrthographicWidth);
-
-		metaData.scriptClass->addInternalCall("Internal_GetClearColor", (void*)&ScriptCamera::internal_GetClearColor);
-		metaData.scriptClass->addInternalCall("Internal_SetClearColor", (void*)&ScriptCamera::internal_SetClearColor);
-
-		metaData.scriptClass->addInternalCall("Internal_GetDepthClearValue", (void*)&ScriptCamera::internal_GetDepthClearValue);
-		metaData.scriptClass->addInternalCall("Internal_SetDepthClearValue", (void*)&ScriptCamera::internal_SetDepthClearValue);
-
-		metaData.scriptClass->addInternalCall("Internal_GetStencilClearValue", (void*)&ScriptCamera::internal_GetStencilClearValue);
-		metaData.scriptClass->addInternalCall("Internal_SetStencilClearValue", (void*)&ScriptCamera::internal_SetStencilClearValue);
-
-		metaData.scriptClass->addInternalCall("Internal_GetClearFlags", (void*)&ScriptCamera::internal_GetClearFlags);
-		metaData.scriptClass->addInternalCall("Internal_SetClearFlags", (void*)&ScriptCamera::internal_SetClearFlags);
-
-		metaData.scriptClass->addInternalCall("Internal_GetPriority", (void*)&ScriptCamera::internal_GetPriority);
-		metaData.scriptClass->addInternalCall("Internal_SetPriority", (void*)&ScriptCamera::internal_SetPriority);
-
-		metaData.scriptClass->addInternalCall("Internal_GetRenderSettings", (void*)&ScriptCamera::internal_GetRenderSettings);
-		metaData.scriptClass->addInternalCall("Internal_SetRenderSettings", (void*)&ScriptCamera::internal_SetRenderSettings);
-
-		metaData.scriptClass->addInternalCall("Internal_GetLayers", (void*)&ScriptCamera::internal_GetLayers);
-		metaData.scriptClass->addInternalCall("Internal_SetLayers", (void*)&ScriptCamera::internal_SetLayers);
-
-		metaData.scriptClass->addInternalCall("Internal_GetProjMatrix", (void*)&ScriptCamera::internal_GetProjMatrix);
-		metaData.scriptClass->addInternalCall("Internal_GetProjMatrixInv", (void*)&ScriptCamera::internal_GetProjMatrixInv);
-
-		metaData.scriptClass->addInternalCall("Internal_GetViewMatrix", (void*)&ScriptCamera::internal_GetViewMatrix);
-		metaData.scriptClass->addInternalCall("Internal_GetViewMatrixInv", (void*)&ScriptCamera::internal_GetViewMatrixInv);
-
-		metaData.scriptClass->addInternalCall("Internal_GetWidthPixels", (void*)&ScriptCamera::internal_GetWidthPixels);
-		metaData.scriptClass->addInternalCall("Internal_GetHeightPixels", (void*)&ScriptCamera::internal_GetHeightPixels);
-
-		metaData.scriptClass->addInternalCall("Internal_WorldToViewport", (void*)&ScriptCamera::internal_WorldToViewport);
-		metaData.scriptClass->addInternalCall("Internal_WorldToNDC", (void*)&ScriptCamera::internal_WorldToNDC);
-		metaData.scriptClass->addInternalCall("Internal_WorldToView", (void*)&ScriptCamera::internal_WorldToView);
-
-		metaData.scriptClass->addInternalCall("Internal_ScreenToViewport", (void*)&ScriptCamera::internal_ScreenToViewport);
-
-		metaData.scriptClass->addInternalCall("Internal_ViewportToWorld", (void*)&ScriptCamera::internal_ViewportToWorld);
-		metaData.scriptClass->addInternalCall("Internal_ViewportToView", (void*)&ScriptCamera::internal_ViewportToView);
-		metaData.scriptClass->addInternalCall("Internal_ViewportToNDC", (void*)&ScriptCamera::internal_ViewportToNDC);
-
-		metaData.scriptClass->addInternalCall("Internal_ViewToWorld", (void*)&ScriptCamera::internal_ViewToWorld);
-		metaData.scriptClass->addInternalCall("Internal_ViewToViewport", (void*)&ScriptCamera::internal_ViewToViewport);
-		metaData.scriptClass->addInternalCall("Internal_ViewToNDC", (void*)&ScriptCamera::internal_ViewToNDC);
-
-		metaData.scriptClass->addInternalCall("Internal_NDCToWorld", (void*)&ScriptCamera::internal_NDCToWorld);
-		metaData.scriptClass->addInternalCall("Internal_NDCToView", (void*)&ScriptCamera::internal_NDCToView);
-		metaData.scriptClass->addInternalCall("Internal_NDCToViewport", (void*)&ScriptCamera::internal_NDCToViewport);
-
-		metaData.scriptClass->addInternalCall("Internal_ViewportToWorldRay", (void*)&ScriptCamera::internal_ViewportToWorldRay);
-		metaData.scriptClass->addInternalCall("Internal_ScreenToWorldRay", (void*)&ScriptCamera::internal_ScreenToWorldRay);
-
-		metaData.scriptClass->addInternalCall("Internal_ProjectPoint", (void*)&ScriptCamera::internal_ProjectPoint);
-		metaData.scriptClass->addInternalCall("Internal_UnprojectPoint", (void*)&ScriptCamera::internal_UnprojectPoint);
-
-		metaData.scriptClass->addInternalCall("Internal_SetRenderTarget", (void*)&ScriptCamera::internal_SetRenderTarget);
-
-		metaData.scriptClass->addInternalCall("Internal_GetMain", (void*)&ScriptCamera::internal_GetMain);
-		metaData.scriptClass->addInternalCall("Internal_SetMain", (void*)&ScriptCamera::internal_SetMain);
-
-		metaData.scriptClass->addInternalCall("Internal_UpdateView", (void*)&ScriptCamera::internal_UpdateView);
-		metaData.scriptClass->addInternalCall("Internal_OnDestroy", (void*)&ScriptCamera::internal_OnDestroy);
-	}
-
-	void ScriptCamera::updateView(const HSceneObject& parent)
-	{
-		if (parent.isDestroyed())
-			return;
-
-		UINT32 curHash = parent->getTransformHash();
-		if (curHash != mLastUpdateHash)
-		{
-			mCamera->setPosition(parent->getWorldPosition());
-			mCamera->setRotation(parent->getWorldRotation());
-
-			mLastUpdateHash = curHash;
-		}
-
-		if (parent->getActive() != mCamera->getIsActive())
-		{
-			mCamera->setIsActive(parent->getActive());
-		}
-	}
-
-	void ScriptCamera::internal_Create(MonoObject* managedInstance, ScriptSceneObject* parentSO)
-	{
-		HSceneObject so;
-		if (parentSO != nullptr)
-			so = parentSO->getNativeHandle();
-
-		new (bs_alloc<ScriptCamera>()) ScriptCamera(managedInstance, so);
-	}
-
-	float ScriptCamera::internal_GetAspect(ScriptCamera* instance)
-	{
-		return instance->mCamera->getAspectRatio();
-	}
-
-	void ScriptCamera::internal_SetAspect(ScriptCamera* instance, float value)
-	{
-		instance->mCamera->setAspectRatio(value);
-	}
-
-	float ScriptCamera::internal_GetNearClip(ScriptCamera* instance)
-	{
-		return instance->mCamera->getNearClipDistance();
-	}
-
-	void ScriptCamera::internal_SetNearClip(ScriptCamera* instance, float value)
-	{
-		instance->mCamera->setNearClipDistance(value);
-	}
-
-	float ScriptCamera::internal_GetFarClip(ScriptCamera* instance)
-	{
-		return instance->mCamera->getFarClipDistance();
-	}
-
-	void ScriptCamera::internal_SetFarClip(ScriptCamera* instance, float value)
-	{
-		instance->mCamera->setFarClipDistance(value);
-	}
-
-	void ScriptCamera::internal_GetFieldOfView(ScriptCamera* instance, Degree* value)
-	{
-		*value = instance->mCamera->getHorzFOV();
-	}
-
-	void ScriptCamera::internal_SetFieldOfView(ScriptCamera* instance, Degree* value)
-	{
-		instance->mCamera->setHorzFOV(*value);
-	}
-
-	void ScriptCamera::internal_GetViewportRect(ScriptCamera* instance, Rect2* value)
-	{
-		*value = instance->mCamera->getViewport()->getNormArea();
-	}
-
-	void ScriptCamera::internal_SetViewportRect(ScriptCamera* instance, Rect2* value)
-	{
-		instance->mCamera->getViewport()->setArea(value->x, value->y, value->width, value->height);
-	}
-
-	UINT32 ScriptCamera::internal_GetProjectionType(ScriptCamera* instance)
-	{
-		return instance->mCamera->getProjectionType();
-	}
-
-	void ScriptCamera::internal_SetProjectionType(ScriptCamera* instance, UINT32 value)
-	{
-		instance->mCamera->setProjectionType((ProjectionType)value);
-	}
-
-	float ScriptCamera::internal_GetOrthographicHeight(ScriptCamera* instance)
-	{
-		return instance->mCamera->getOrthoWindowHeight();
-	}
-
-	void ScriptCamera::internal_SetOrthographicHeight(ScriptCamera* instance, float value)
-	{
-		instance->mCamera->setOrthoWindowHeight(value);
-	}
-
-	float ScriptCamera::internal_GetOrthographicWidth(ScriptCamera* instance)
-	{
-		return instance->mCamera->getOrthoWindowWidth();
-	}
-
-	void ScriptCamera::internal_GetClearColor(ScriptCamera* instance, Color* value)
-	{
-		*value = instance->mCamera->getViewport()->getClearColor();
-	}
-
-	void ScriptCamera::internal_SetClearColor(ScriptCamera* instance, Color* value)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-		vp->setClearValues(*value, vp->getClearDepthValue(), vp->getClearStencilValue());
-	}
-
-	float ScriptCamera::internal_GetDepthClearValue(ScriptCamera* instance)
-	{
-		return instance->mCamera->getViewport()->getClearDepthValue();
-	}
-
-	void ScriptCamera::internal_SetDepthClearValue(ScriptCamera* instance, float value)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-		vp->setClearValues(vp->getClearColor(), value, vp->getClearStencilValue());
-	}
-
-	UINT16 ScriptCamera::internal_GetStencilClearValue(ScriptCamera* instance)
-	{
-		return instance->mCamera->getViewport()->getClearStencilValue();
-	}
-
-	void ScriptCamera::internal_SetStencilClearValue(ScriptCamera* instance, UINT16 value)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-		vp->setClearValues(vp->getClearColor(), vp->getClearDepthValue(), value);
-	}
-
-	UINT32 ScriptCamera::internal_GetClearFlags(ScriptCamera* instance)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-		UINT32 clearFlags = 0;
-
-		clearFlags |= vp->getRequiresColorClear() ? 0x01 : 0;
-		clearFlags |= vp->getRequiresDepthClear() ? 0x02 : 0;
-		clearFlags |= vp->getRequiresStencilClear() ? 0x04 : 0;
-
-		return clearFlags;
-	}
-
-	void ScriptCamera::internal_SetClearFlags(ScriptCamera* instance, UINT32 value)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-
-		vp->setRequiresClear((value & 0x01) != 0,
-			(value & 0x02) != 0, (value & 0x04) != 0);
-	}
-
-	int ScriptCamera::internal_GetPriority(ScriptCamera* instance)
-	{
-		return instance->mCamera->getPriority();
-	}
-
-	void ScriptCamera::internal_SetPriority(ScriptCamera* instance, int value)
-	{
-		instance->mCamera->setPriority(value);
-	}
-
-	MonoObject* ScriptCamera::internal_GetRenderSettings(ScriptCamera* instance)
-	{
-		SPtr<RenderSettings> settings = instance->mCamera->getRenderSettings();
-		if (settings == nullptr)
-			settings = bs_shared_ptr_new<RenderSettings>();
-
-		return ScriptRenderSettings::toManaged(settings);
-	}
-
-	void ScriptCamera::internal_SetRenderSettings(ScriptCamera* instance, MonoObject* value)
-	{
-		instance->mCamera->setRenderSettings(ScriptRenderSettings::toNative(value));
-	}
-
-	UINT64 ScriptCamera::internal_GetLayers(ScriptCamera* instance)
-	{
-		return instance->mCamera->getLayers();
-	}
-
-	void ScriptCamera::internal_SetLayers(ScriptCamera* instance, UINT64 value)
-	{
-		instance->mCamera->setLayers(value);
-	}
-
-	void ScriptCamera::internal_GetProjMatrix(ScriptCamera* instance, Matrix4* output)
-	{
-		*output = instance->mCamera->getProjectionMatrixRS();
-	}
-
-	void ScriptCamera::internal_GetProjMatrixInv(ScriptCamera* instance, Matrix4* output)
-	{
-		*output = instance->mCamera->getProjectionMatrixRSInv();
-	}
-
-	void ScriptCamera::internal_GetViewMatrix(ScriptCamera* instance, Matrix4* output)
-	{
-		*output = instance->mCamera->getViewMatrix();
-	}
-
-	void ScriptCamera::internal_GetViewMatrixInv(ScriptCamera* instance, Matrix4* output)
-	{
-		*output = instance->mCamera->getViewMatrixInv();
-	}
-
-	int ScriptCamera::internal_GetWidthPixels(ScriptCamera* instance)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-
-		return vp->getWidth();
-	}
-
-	int ScriptCamera::internal_GetHeightPixels(ScriptCamera* instance)
-	{
-		SPtr<Viewport> vp = instance->mCamera->getViewport();
-
-		return vp->getHeight();
-	}
-
-	void ScriptCamera::internal_WorldToViewport(ScriptCamera* instance, Vector3* value, Vector2I* output)
-	{
-		*output = instance->mCamera->worldToScreenPoint(*value);
-	}
-
-	void ScriptCamera::internal_WorldToNDC(ScriptCamera* instance, Vector3* value, Vector2* output)
-	{
-		*output = instance->mCamera->worldToNdcPoint(*value);
-	}
-
-	void ScriptCamera::internal_WorldToView(ScriptCamera* instance, Vector3* value, Vector3* output)
-	{
-		*output = instance->mCamera->worldToViewPoint(*value);
-	}
-
-	void ScriptCamera::internal_ScreenToViewport(ScriptCamera* instance, Vector2I* value, Vector2I* output)
-	{
-		SceneCameraData mainCamera = gSceneManager().getMainCamera();
-		if (mainCamera.camera == nullptr)
-			return;
-
-		// The main camera could be rendering to a standalone window, or be a part of the editor GUI. Find out which
-		// and transform the pointer position appropriately.
-		SPtr<RenderTarget> target = mainCamera.camera->getViewport()->getTarget();
-		if (target == nullptr)
-			return;
-
-		if (target->getProperties().isWindow)
-		{
-			SPtr<RenderWindow> window = std::static_pointer_cast<RenderWindow>(target);
-			*output = window->screenToWindowPos(*value);
-		}
-		else
-		{
-			SPtr<RenderTexture> texture = std::static_pointer_cast<RenderTexture>(target);
-
-			SPtr<RenderWindow> window = GUIManager::instance().getBridgeWindow(texture);
-			if (window == nullptr)
-				return;
-
-			*output = window->screenToWindowPos(*value);
-			*output = GUIManager::instance().windowToBridgedCoords(target, *output);
-		}
-	}
-
-	void ScriptCamera::internal_ViewportToWorld(ScriptCamera* instance, Vector2I* value, float depth, Vector3* output)
-	{
-		*output = instance->mCamera->screenToWorldPoint(*value, depth);
-	}
-
-	void ScriptCamera::internal_ViewportToView(ScriptCamera* instance, Vector2I* value, float depth, Vector3* output)
-	{
-		*output = instance->mCamera->screenToViewPoint(*value, depth);
-	}
-
-	void ScriptCamera::internal_ViewportToNDC(ScriptCamera* instance, Vector2I* value, Vector2* output)
-	{
-		*output = instance->mCamera->screenToNdcPoint(*value);
-	}
-
-	void ScriptCamera::internal_ViewToWorld(ScriptCamera* instance, Vector3* value, Vector3* output)
-	{
-		*output = instance->mCamera->viewToWorldPoint(*value);
-	}
-
-	void ScriptCamera::internal_ViewToViewport(ScriptCamera* instance, Vector3* value, Vector2I* output)
-	{
-		*output = instance->mCamera->viewToScreenPoint(*value);
-	}
-
-	void ScriptCamera::internal_ViewToNDC(ScriptCamera* instance, Vector3* value, Vector2* output)
-	{
-		*output = instance->mCamera->viewToNdcPoint(*value);
-	}
-
-	void ScriptCamera::internal_NDCToWorld(ScriptCamera* instance, Vector2* value, float depth, Vector3* output)
-	{
-		*output = instance->mCamera->ndcToWorldPoint(*value, depth);
-	}
-
-	void ScriptCamera::internal_NDCToView(ScriptCamera* instance, Vector2* value, float depth, Vector3* output)
-	{
-		*output = instance->mCamera->ndcToViewPoint(*value, depth);
-	}
-
-	void ScriptCamera::internal_NDCToViewport(ScriptCamera* instance, Vector2* value, Vector2I* output)
-	{
-		*output = instance->mCamera->ndcToScreenPoint(*value);
-	}
-
-	void ScriptCamera::internal_ScreenToWorldRay(ScriptCamera* instance, Vector2I* value, Ray* output)
-	{
-		Vector2I viewportPos;
-		internal_ScreenToViewport(instance, value, &viewportPos);
-		internal_ViewportToWorldRay(instance, &viewportPos, output);
-	}
-
-	void ScriptCamera::internal_ViewportToWorldRay(ScriptCamera* instance, Vector2I* value, Ray* output)
-	{
-		*output = instance->mCamera->screenPointToRay(*value);
-	}
-
-	void ScriptCamera::internal_ProjectPoint(ScriptCamera* instance, Vector3* value, Vector3* output)
-	{
-		*output = instance->mCamera->projectPoint(*value);
-	}
-
-	void ScriptCamera::internal_UnprojectPoint(ScriptCamera* instance, Vector3* value, Vector3* output)
-	{
-		*output = instance->mCamera->unprojectPoint(*value);
-	}
-
-	void ScriptCamera::internal_SetRenderTarget(ScriptCamera* instance, ScriptRenderTarget* target)
-	{
-		if (target == nullptr)
-			instance->mCamera->getViewport()->setTarget(nullptr);
-		else
-			instance->mCamera->getViewport()->setTarget(target->getNativeValue());
-	}
-
-	bool ScriptCamera::internal_GetMain(ScriptCamera* instance)
-	{
-		return instance->mCamera->isMain();
-	}
-
-	void ScriptCamera::internal_SetMain(ScriptCamera* instance, bool main)
-	{
-		instance->mCamera->setMain(main);
-		gSceneManager()._notifyMainCameraStateChanged(instance->mCamera);
-	}
-
-	void ScriptCamera::internal_UpdateView(ScriptCamera* instance, ScriptSceneObject* parent)
-	{
-		HSceneObject parentSO = parent->getNativeSceneObject();
-
-		instance->updateView(parentSO);
-	}
-
-	void ScriptCamera::internal_OnDestroy(ScriptCamera* instance)
-	{
-		instance->destroy();
-	}
-
-	void ScriptCamera::destroy()
-	{
-		if (mCamera->isDestroyed())
-			return;
-
-		gSceneManager()._unregisterCamera(mCamera);
-		mCamera->destroy();
-	}
-
-	void ScriptCamera::_onManagedInstanceDeleted()
-	{
-		destroy();
-
-		ScriptObject::_onManagedInstanceDeleted();
-	}
-}

+ 0 - 139
Source/SBansheeEngine/Wrappers/BsScriptCamera.h

@@ -1,139 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "Math/BsVector2.h"
-#include "Math/BsVector3.h"
-#include "Math/BsVector2I.h"
-#include "Math/BsRay.h"
-#include "Math/BsDegree.h"
-#include "Math/BsMatrix4.h"
-#include "Math/BsRect2.h"
-#include "Image/BsColor.h"
-#include "Renderer/BsRenderSettings.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for Camera. */
-	class BS_SCR_BE_EXPORT ScriptCamera : public ScriptObject<ScriptCamera>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCamera")
-
-		/**	Returns the wrapped native Camera object. */
-		SPtr<Camera> getInternal() const { return mCamera; }
-
-	private:
-		ScriptCamera(MonoObject* managedInstance, const HSceneObject& parentSO);
-		~ScriptCamera();
-
-		/**	Updates the internal camera handler from the transform of the provided scene object. */
-		void updateView(const HSceneObject& parent);
-
-		/**	Destroys the internal camera handler object. */
-		void destroy();
-
-		/** @copydoc ScriptObject::_onManagedInstanceDeleted */
-		void _onManagedInstanceDeleted() override;
-
-		SPtr<Camera> mCamera;
-		UINT32 mLastUpdateHash;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptSceneObject* parentSO);
-
-		static float internal_GetAspect(ScriptCamera* instance);
-		static void internal_SetAspect(ScriptCamera* instance, float value);
-		static float internal_GetNearClip(ScriptCamera* instance);
-		static void internal_SetNearClip(ScriptCamera* instance, float value);
-
-		static float internal_GetFarClip(ScriptCamera* instance);
-		static void internal_SetFarClip(ScriptCamera* instance, float value);
-
-		static void internal_GetFieldOfView(ScriptCamera* instance, Degree* value);
-		static void internal_SetFieldOfView(ScriptCamera* instance, Degree* value);
-
-		static void internal_GetViewportRect(ScriptCamera* instance, Rect2* value);
-		static void internal_SetViewportRect(ScriptCamera* instance, Rect2* value);
-
-		static UINT32 internal_GetProjectionType(ScriptCamera* instance);
-		static void internal_SetProjectionType(ScriptCamera* instance, UINT32 value);
-
-		static float internal_GetOrthographicHeight(ScriptCamera* instance);
-		static void internal_SetOrthographicHeight(ScriptCamera* instance, float value);
-
-		static float internal_GetOrthographicWidth(ScriptCamera* instance);
-
-		static void internal_GetClearColor(ScriptCamera* instance, Color* value);
-		static void internal_SetClearColor(ScriptCamera* instance, Color* value);
-
-		static float internal_GetDepthClearValue(ScriptCamera* instance);
-		static void internal_SetDepthClearValue(ScriptCamera* instance, float value);
-
-		static UINT16 internal_GetStencilClearValue(ScriptCamera* instance);
-		static void internal_SetStencilClearValue(ScriptCamera* instance, UINT16 value);
-
-		static UINT32 internal_GetClearFlags(ScriptCamera* instance);
-		static void internal_SetClearFlags(ScriptCamera* instance, UINT32 value);
-
-		static int internal_GetPriority(ScriptCamera* instance);
-		static void internal_SetPriority(ScriptCamera* instance, int value);
-
-		static MonoObject* internal_GetRenderSettings(ScriptCamera* instance);
-		static void internal_SetRenderSettings(ScriptCamera* instance, MonoObject* value);
-
-		static UINT64 internal_GetLayers(ScriptCamera* instance);
-		static void internal_SetLayers(ScriptCamera* instance, UINT64 value);
-
-		static void internal_GetProjMatrix(ScriptCamera* instance, Matrix4* value);
-		static void internal_GetProjMatrixInv(ScriptCamera* instance, Matrix4* value);
-
-		static void internal_GetViewMatrix(ScriptCamera* instance, Matrix4* value);
-		static void internal_GetViewMatrixInv(ScriptCamera* instance, Matrix4* value);
-
-		static int internal_GetWidthPixels(ScriptCamera* instance);
-		static int internal_GetHeightPixels(ScriptCamera* instance);
-
-		static void internal_WorldToViewport(ScriptCamera* instance, Vector3* value, Vector2I* output);
-		static void internal_WorldToNDC(ScriptCamera* instance, Vector3* value, Vector2* output);
-		static void internal_WorldToView(ScriptCamera* instance, Vector3* value, Vector3* output);
-
-		static void internal_ScreenToViewport(ScriptCamera* instance, Vector2I* value, Vector2I* output);
-
-		static void internal_ViewportToWorld(ScriptCamera* instance, Vector2I* value, float depth, Vector3* output);
-		static void internal_ViewportToView(ScriptCamera* instance, Vector2I* value, float depth, Vector3* output);
-		static void internal_ViewportToNDC(ScriptCamera* instance, Vector2I* value, Vector2* output);
-
-		static void internal_ViewToWorld(ScriptCamera* instance, Vector3* value, Vector3* output);
-		static void internal_ViewToViewport(ScriptCamera* instance, Vector3* value, Vector2I* output);
-		static void internal_ViewToNDC(ScriptCamera* instance, Vector3* value, Vector2* output);
-
-		static void internal_NDCToWorld(ScriptCamera* instance, Vector2* value, float depth, Vector3* output);
-		static void internal_NDCToView(ScriptCamera* instance, Vector2* value, float depth, Vector3* output);
-		static void internal_NDCToViewport(ScriptCamera* instance, Vector2* value, Vector2I* output);
-
-		static void internal_ViewportToWorldRay(ScriptCamera* instance, Vector2I* value, Ray* output);
-		static void internal_ScreenToWorldRay(ScriptCamera* instance, Vector2I* value, Ray* output);
-		
-		static void internal_ProjectPoint(ScriptCamera* instance, Vector3* value, Vector3* output);
-		static void internal_UnprojectPoint(ScriptCamera* instance, Vector3* value, Vector3* output);
-
-		static void internal_SetRenderTarget(ScriptCamera* instance, ScriptRenderTarget* target);
-
-		static bool internal_GetMain(ScriptCamera* instance);
-		static void internal_SetMain(ScriptCamera* instance, bool main);
-
-		static void internal_UpdateView(ScriptCamera* instance, ScriptSceneObject* parent);
-		static void internal_OnDestroy(ScriptCamera* instance);
-	};
-
-	/** @} */
-}

+ 0 - 188
Source/SBansheeEngine/Wrappers/BsScriptLight.cpp

@@ -1,188 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptLight.h"
-#include "Wrappers/BsScriptSceneObject.h"
-#include "Scene/BsSceneObject.h"
-#include "Scene/BsSceneManager.h"
-
-namespace bs
-{
-	ScriptLight::ScriptLight(MonoObject* managedInstance, const HSceneObject& parentSO)
-		:ScriptObject(managedInstance), mLight(nullptr), mLastUpdateHash(0)
-	{
-		mLight = Light::create();
-		gSceneManager()._registerLight(mLight, parentSO);
-	}
-
-	ScriptLight::~ScriptLight()
-	{ }
-
-	void ScriptLight::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_Create", (void*)&ScriptLight::internal_create);
-
-		metaData.scriptClass->addInternalCall("Internal_GetType", (void*)&ScriptLight::internal_getType);
-		metaData.scriptClass->addInternalCall("Internal_SetType", (void*)&ScriptLight::internal_setType);
-		metaData.scriptClass->addInternalCall("Internal_GetCastsShadow", (void*)&ScriptLight::internal_getCastsShadow);
-		metaData.scriptClass->addInternalCall("Internal_SetCastsShadow", (void*)&ScriptLight::internal_setCastsShadow);
-		metaData.scriptClass->addInternalCall("Internal_GetUseAutoAttenuation", 
-			(void*)&ScriptLight::internal_getUseAutoAttenuation);
-		metaData.scriptClass->addInternalCall("Internal_SetUseAutoAttenuation", 
-			(void*)&ScriptLight::internal_setUseAutoAttenuation);
-		metaData.scriptClass->addInternalCall("Internal_GetColor", (void*)&ScriptLight::internal_getColor);
-		metaData.scriptClass->addInternalCall("Internal_SetColor", (void*)&ScriptLight::internal_setColor);
-		metaData.scriptClass->addInternalCall("Internal_GetAttenuationRadius", (void*)&ScriptLight::internal_getAttenuationRadius);
-		metaData.scriptClass->addInternalCall("Internal_SetAttenuationRadius", (void*)&ScriptLight::internal_setAttenuationRadius);
-		metaData.scriptClass->addInternalCall("Internal_GetSourceRadius", (void*)&ScriptLight::internal_getSourceRadius);
-		metaData.scriptClass->addInternalCall("Internal_SetSourceRadius", (void*)&ScriptLight::internal_setSourceRadius);
-		metaData.scriptClass->addInternalCall("Internal_GetIntensity", (void*)&ScriptLight::internal_getIntensity);
-		metaData.scriptClass->addInternalCall("Internal_SetIntensity", (void*)&ScriptLight::internal_setIntensity);
-		metaData.scriptClass->addInternalCall("Internal_GetSpotAngle", (void*)&ScriptLight::internal_getSpotAngle);
-		metaData.scriptClass->addInternalCall("Internal_SetSpotAngle", (void*)&ScriptLight::internal_setSpotAngle);
-		metaData.scriptClass->addInternalCall("Internal_GetSpotFalloffAngle", (void*)&ScriptLight::internal_getSpotFalloffAngle);
-		metaData.scriptClass->addInternalCall("Internal_SetSpotFalloffAngle", (void*)&ScriptLight::internal_setSpotFalloffAngle);
-		metaData.scriptClass->addInternalCall("Internal_GetBounds", (void*)&ScriptLight::internal_getBounds);
-		metaData.scriptClass->addInternalCall("Internal_UpdateTransform", (void*)&ScriptLight::internal_updateTransform);
-		metaData.scriptClass->addInternalCall("Internal_OnDestroy", (void*)&ScriptLight::internal_onDestroy);
-	}
-
-	void ScriptLight::internal_create(MonoObject* managedInstance, ScriptSceneObject* parentSO)
-	{
-		HSceneObject so;
-		if (parentSO != nullptr)
-			so = parentSO->getNativeHandle();
-
-		new (bs_alloc<ScriptLight>()) ScriptLight(managedInstance, so);
-	}
-
-	LightType ScriptLight::internal_getType(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getType();
-	}
-
-	void ScriptLight::internal_setType(ScriptLight* thisPtr, LightType type)
-	{
-		thisPtr->getInternal()->setType(type);
-	}
-
-	bool ScriptLight::internal_getCastsShadow(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getCastsShadow();
-	}
-
-	void ScriptLight::internal_setCastsShadow(ScriptLight* thisPtr, bool castsShadow)
-	{
-		thisPtr->getInternal()->setCastsShadow(castsShadow);
-	}
-
-	bool ScriptLight::internal_getUseAutoAttenuation(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getUseAutoAttenuation();
-	}
-
-	void ScriptLight::internal_setUseAutoAttenuation(ScriptLight* thisPtr, bool value)
-	{
-		thisPtr->getInternal()->setUseAutoAttenuation(value);
-	}
-
-	void ScriptLight::internal_getColor(ScriptLight* thisPtr, Color* color)
-	{
-		*color = thisPtr->getInternal()->getColor();
-	}
-
-	void ScriptLight::internal_setColor(ScriptLight* thisPtr, Color color)
-	{
-		thisPtr->getInternal()->setColor(color);
-	}
-
-	float ScriptLight::internal_getAttenuationRadius(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getAttenuationRadius();
-	}
-
-	void ScriptLight::internal_setAttenuationRadius(ScriptLight* thisPtr, float radius)
-	{
-		thisPtr->getInternal()->setAttenuationRadius(radius);
-	}
-
-	float ScriptLight::internal_getSourceRadius(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getSourceRadius();
-	}
-
-	void ScriptLight::internal_setSourceRadius(ScriptLight* thisPtr, float radius)
-	{
-		thisPtr->getInternal()->setSourceRadius(radius);
-	}
-
-	float ScriptLight::internal_getIntensity(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getIntensity();
-	}
-
-	void ScriptLight::internal_setIntensity(ScriptLight* thisPtr, float intensity)
-	{
-		thisPtr->getInternal()->setIntensity(intensity);
-	}
-
-	float ScriptLight::internal_getSpotAngle(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getSpotAngle().valueDegrees();
-	}
-
-	void ScriptLight::internal_setSpotAngle(ScriptLight* thisPtr, float spotAngle)
-	{
-		thisPtr->getInternal()->setSpotAngle(Degree(spotAngle));
-	}
-
-	float ScriptLight::internal_getSpotFalloffAngle(ScriptLight* thisPtr)
-	{
-		return thisPtr->getInternal()->getSpotFalloffAngle().valueDegrees();
-	}
-
-	void ScriptLight::internal_setSpotFalloffAngle(ScriptLight* thisPtr, float spotFalloffAngle)
-	{
-		thisPtr->getInternal()->setSpotFalloffAngle(Degree(spotFalloffAngle));
-	}
-
-	void ScriptLight::internal_getBounds(ScriptLight* thisPtr, Sphere* bounds)
-	{
-		*bounds = thisPtr->getInternal()->getBounds();
-	}
-
-	void ScriptLight::internal_updateTransform(ScriptLight* thisPtr, ScriptSceneObject* parent)
-	{
-		HSceneObject parentSO = parent->getNativeSceneObject();
-
-		if (!parentSO.isDestroyed())
-		{
-			thisPtr->getInternal()->_updateTransform(parentSO);
-
-			if (parentSO->getActive() != thisPtr->getInternal()->getIsActive())
-			{
-				thisPtr->getInternal()->setIsActive(parentSO->getActive());
-			}
-		}
-	}
-
-	void ScriptLight::internal_onDestroy(ScriptLight* instance)
-	{
-		instance->destroy();
-	}
-
-	void ScriptLight::destroy()
-	{
-		if (mLight->isDestroyed())
-			return;
-
-		gSceneManager()._unregisterLight(mLight);
-		mLight->destroy();
-	}
-
-	void ScriptLight::_onManagedInstanceDeleted()
-	{
-		destroy();
-
-		ScriptObject::_onManagedInstanceDeleted();
-	}
-}

+ 0 - 78
Source/SBansheeEngine/Wrappers/BsScriptLight.h

@@ -1,78 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "Math/BsDegree.h"
-#include "Image/BsColor.h"
-#include "Renderer/BsLight.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for Light. */
-	class BS_SCR_BE_EXPORT ScriptLight : public ScriptObject <ScriptLight>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeLight")
-
-		/**	Gets the wrapped native LightInternal object. */
-		SPtr<Light> getInternal() const { return mLight; }
-
-	private:
-		ScriptLight(MonoObject* managedInstance, const HSceneObject& parentSO);
-		~ScriptLight();
-
-		/**	Destroys the internal light handler object. */
-		void destroy();
-
-		/** @copydoc ScriptObject::_onManagedInstanceDeleted */
-		void _onManagedInstanceDeleted() override;
-
-		SPtr<Light> mLight;
-		UINT32 mLastUpdateHash;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_create(MonoObject* managedInstance, ScriptSceneObject* parentSO);
-
-		static LightType internal_getType(ScriptLight* thisPtr);
-		static void internal_setType(ScriptLight* thisPtr, LightType type);
-
-		static bool internal_getCastsShadow(ScriptLight* thisPtr);
-		static void internal_setCastsShadow(ScriptLight* thisPtr, bool castsShadow);
-
-		static bool internal_getUseAutoAttenuation(ScriptLight* thisPtr);
-		static void internal_setUseAutoAttenuation(ScriptLight* thisPtr, bool value);
-
-		static void internal_getColor(ScriptLight* thisPtr, Color* color);
-		static void internal_setColor(ScriptLight* thisPtr, Color color);
-
-		static float internal_getAttenuationRadius(ScriptLight* thisPtr);
-		static void internal_setAttenuationRadius(ScriptLight* thisPtr, float radius);
-
-		static float internal_getSourceRadius(ScriptLight* thisPtr);
-		static void internal_setSourceRadius(ScriptLight* thisPtr, float radius);
-
-		static float internal_getIntensity(ScriptLight* thisPtr);
-		static void internal_setIntensity(ScriptLight* thisPtr, float intensity);
-
-		static float internal_getSpotAngle(ScriptLight* thisPtr);
-		static void internal_setSpotAngle(ScriptLight* thisPtr, float spotAngle);
-
-		static float internal_getSpotFalloffAngle(ScriptLight* thisPtr);
-		static void internal_setSpotFalloffAngle(ScriptLight* thisPtr, float spotFalloffAngle);
-
-		static void internal_getBounds(ScriptLight* thisPtr, Sphere* bounds);
-
-		static void internal_updateTransform(ScriptLight* thisPtr, ScriptSceneObject* parent);
-		static void internal_onDestroy(ScriptLight* instance);
-	};
-
-	/** @} */
-}

+ 5 - 4
Source/SBansheeEngine/Wrappers/BsScriptProfilerOverlayInternal.cpp

@@ -7,8 +7,9 @@
 #include "BsMonoManager.h"
 #include "BsMonoUtil.h"
 #include "BsApplication.h"
-#include "Renderer/BsCamera.h"
-#include "Wrappers/BsScriptCamera.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -33,11 +34,11 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", (void*)&ScriptProfilerOverlayInternal::internal_DestroyInstance);
 	}
 
-	void ScriptProfilerOverlayInternal::internal_CreateInstance(MonoObject* instance, ScriptCamera* camera)
+	void ScriptProfilerOverlayInternal::internal_CreateInstance(MonoObject* instance, ScriptCCamera* camera)
 	{
 		SPtr<Camera> nativeCamera;
 		if (camera != nullptr)
-			nativeCamera = camera->getInternal();
+			nativeCamera = camera->getHandle()->_getCamera();
 
 		new (bs_alloc<ScriptProfilerOverlayInternal>()) ScriptProfilerOverlayInternal(instance, nativeCamera);
 	}

+ 3 - 1
Source/SBansheeEngine/Wrappers/BsScriptProfilerOverlayInternal.h

@@ -8,6 +8,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEngine
 	 *  @{
 	 */
@@ -30,7 +32,7 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptCamera* camera);
+		static void internal_CreateInstance(MonoObject* instance, ScriptCCamera* camera);
 		static void internal_SetType(ScriptProfilerOverlayInternal* thisPtr, ProfilerOverlayType type);
 		static void internal_Update(ScriptProfilerOverlayInternal* thisPtr);
 		static void internal_DestroyInstance(ScriptProfilerOverlayInternal* thisPtr);

+ 0 - 296
Source/SBansheeEngine/Wrappers/BsScriptRenderSettings.cpp

@@ -1,296 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptRenderSettings.h"
-#include "BsMonoManager.h"
-#include "BsMonoAssembly.h"
-#include "BsMonoClass.h"
-#include "BsMonoUtil.h"
-#include "CoreThread/BsCoreThread.h"
-#include "Renderer/BsRenderSettings.h"
-
-namespace bs
-{
-	MonoField* ScriptAutoExposureSettings::sHistogramLog2Min = nullptr;
-	MonoField* ScriptAutoExposureSettings::sHistogramLog2Max = nullptr;
-	MonoField* ScriptAutoExposureSettings::sHistogramPctLow = nullptr;
-	MonoField* ScriptAutoExposureSettings::sHistogramPctHigh = nullptr;
-	MonoField* ScriptAutoExposureSettings::sMinEyeAdaptation = nullptr;
-	MonoField* ScriptAutoExposureSettings::sMaxEyeAdaptation = nullptr;
-	MonoField* ScriptAutoExposureSettings::sEyeAdaptationSpeedUp = nullptr;
-	MonoField* ScriptAutoExposureSettings::sEyeAdaptationSpeedDown = nullptr;
-
-	ScriptAutoExposureSettings::ScriptAutoExposureSettings(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptAutoExposureSettings::initRuntimeData()
-	{
-		sHistogramLog2Min = metaData.scriptClass->getField("HistogramLog2Min");
-		sHistogramLog2Max = metaData.scriptClass->getField("HistogramLog2Max");
-		sHistogramPctLow = metaData.scriptClass->getField("HistogramPctLow");
-		sHistogramPctHigh = metaData.scriptClass->getField("HistogramPctHigh");
-		sMinEyeAdaptation = metaData.scriptClass->getField("MinEyeAdaptation");
-		sMaxEyeAdaptation = metaData.scriptClass->getField("MaxEyeAdaptation");
-		sEyeAdaptationSpeedUp = metaData.scriptClass->getField("EyeAdaptationSpeedUp");
-		sEyeAdaptationSpeedDown = metaData.scriptClass->getField("EyeAdaptationSpeedDown");
-	}
-
-	SPtr<AutoExposureSettings> ScriptAutoExposureSettings::toNative(MonoObject* object)
-	{
-		SPtr<AutoExposureSettings> output = bs_shared_ptr_new<AutoExposureSettings>();
-
-		sHistogramLog2Min->get(object, &output->histogramLog2Min);
-		sHistogramLog2Max->get(object, &output->histogramLog2Max);
-		sHistogramPctLow->get(object, &output->histogramPctLow);
-		sHistogramPctHigh->get(object, &output->histogramPctHigh);
-		sMinEyeAdaptation->get(object, &output->minEyeAdaptation);
-		sMaxEyeAdaptation->get(object, &output->maxEyeAdaptation);
-		sEyeAdaptationSpeedUp->get(object, &output->eyeAdaptationSpeedUp);
-		sEyeAdaptationSpeedDown->get(object, &output->eyeAdaptationSpeedDown);
-
-		return output;
-	}
-
-	MonoObject* ScriptAutoExposureSettings::toManaged(AutoExposureSettings& value)
-	{
-		MonoObject* object = metaData.scriptClass->createInstance();
-
-		sHistogramLog2Min->set(object, &value.histogramLog2Min);
-		sHistogramLog2Max->set(object, &value.histogramLog2Max);
-		sHistogramPctLow->set(object, &value.histogramPctLow);
-		sHistogramPctHigh->set(object, &value.histogramPctHigh);
-		sMinEyeAdaptation->set(object, &value.minEyeAdaptation);
-		sMaxEyeAdaptation->set(object, &value.maxEyeAdaptation);
-		sEyeAdaptationSpeedUp->set(object, &value.eyeAdaptationSpeedUp);
-		sEyeAdaptationSpeedDown->set(object, &value.eyeAdaptationSpeedDown);
-
-		return object;
-	}
-
-	MonoField* ScriptTonemappingSettings::sFilmicCurveShoulderStrength = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveLinearStrength = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveLinearAngle = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveToeStrength = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveToeNumerator = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveToeDenominator = nullptr;
-	MonoField* ScriptTonemappingSettings::sFilmicCurveLinearWhitePoint = nullptr;
-
-	ScriptTonemappingSettings::ScriptTonemappingSettings(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptTonemappingSettings::initRuntimeData()
-	{
-		sFilmicCurveShoulderStrength = metaData.scriptClass->getField("FilmicCurveShoulderStrength");
-		sFilmicCurveLinearStrength = metaData.scriptClass->getField("FilmicCurveLinearStrength");
-		sFilmicCurveLinearAngle = metaData.scriptClass->getField("FilmicCurveLinearAngle");
-		sFilmicCurveToeStrength = metaData.scriptClass->getField("FilmicCurveToeStrength");
-		sFilmicCurveToeNumerator = metaData.scriptClass->getField("FilmicCurveToeNumerator");
-		sFilmicCurveToeDenominator = metaData.scriptClass->getField("FilmicCurveToeDenominator");
-		sFilmicCurveLinearWhitePoint = metaData.scriptClass->getField("FilmicCurveLinearWhitePoint");
-	}
-
-	SPtr<TonemappingSettings> ScriptTonemappingSettings::toNative(MonoObject* object)
-	{
-		SPtr<TonemappingSettings> output = bs_shared_ptr_new<TonemappingSettings>();
-
-		sFilmicCurveShoulderStrength->get(object, &output->filmicCurveShoulderStrength);
-		sFilmicCurveLinearStrength->get(object, &output->filmicCurveLinearStrength);
-		sFilmicCurveLinearAngle->get(object, &output->filmicCurveLinearAngle);
-		sFilmicCurveToeStrength->get(object, &output->filmicCurveToeStrength);
-		sFilmicCurveToeNumerator->get(object, &output->filmicCurveToeNumerator);
-		sFilmicCurveToeDenominator->get(object, &output->filmicCurveToeDenominator);
-		sFilmicCurveLinearWhitePoint->get(object, &output->filmicCurveLinearWhitePoint);
-
-		return output;
-	}
-
-	MonoObject* ScriptTonemappingSettings::toManaged(TonemappingSettings& value)
-	{
-		MonoObject* object = metaData.scriptClass->createInstance();
-
-		sFilmicCurveShoulderStrength->set(object, &value.filmicCurveShoulderStrength);
-		sFilmicCurveLinearStrength->set(object, &value.filmicCurveLinearStrength);
-		sFilmicCurveLinearAngle->set(object, &value.filmicCurveLinearAngle);
-		sFilmicCurveToeStrength->set(object, &value.filmicCurveToeStrength);
-		sFilmicCurveToeNumerator->set(object, &value.filmicCurveToeNumerator);
-		sFilmicCurveToeDenominator->set(object, &value.filmicCurveToeDenominator);
-		sFilmicCurveLinearWhitePoint->set(object, &value.filmicCurveLinearWhitePoint);
-
-		return object;
-	}
-
-	MonoField* ScriptWhiteBalanceSettings::sTemperature = nullptr;
-	MonoField* ScriptWhiteBalanceSettings::sTint = nullptr;
-
-	ScriptWhiteBalanceSettings::ScriptWhiteBalanceSettings(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptWhiteBalanceSettings::initRuntimeData()
-	{
-		sTemperature = metaData.scriptClass->getField("Temperature");
-		sTint = metaData.scriptClass->getField("Tint");
-	}
-
-	SPtr<WhiteBalanceSettings> ScriptWhiteBalanceSettings::toNative(MonoObject* object)
-	{
-		SPtr<WhiteBalanceSettings> output = bs_shared_ptr_new<WhiteBalanceSettings>();
-
-		sTemperature->get(object, &output->temperature);
-		sTint->get(object, &output->tint);
-
-		return output;
-	}
-
-	MonoObject* ScriptWhiteBalanceSettings::toManaged(WhiteBalanceSettings& value)
-	{
-		MonoObject* object = metaData.scriptClass->createInstance();
-
-		sTemperature->set(object, &value.temperature);
-		sTint->set(object, &value.tint);
-
-		return object;
-	}
-
-	MonoField* ScriptColorGradingSettings::sSaturation = nullptr;
-	MonoField* ScriptColorGradingSettings::sContrast = nullptr;
-	MonoField* ScriptColorGradingSettings::sGain = nullptr;
-	MonoField* ScriptColorGradingSettings::sOffset = nullptr;
-
-	ScriptColorGradingSettings::ScriptColorGradingSettings(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptColorGradingSettings::initRuntimeData()
-	{
-		sSaturation = metaData.scriptClass->getField("Saturation");
-		sContrast = metaData.scriptClass->getField("Contrast");
-		sGain = metaData.scriptClass->getField("Gain");
-		sOffset = metaData.scriptClass->getField("Offset");
-	}
-
-	SPtr<ColorGradingSettings> ScriptColorGradingSettings::toNative(MonoObject* object)
-	{
-		SPtr<ColorGradingSettings> output = bs_shared_ptr_new<ColorGradingSettings>();
-
-		sSaturation->get(object, &output->saturation);
-		sContrast->get(object, &output->contrast);
-		sGain->get(object, &output->gain);
-		sOffset->get(object, &output->offset);
-
-		return output;
-	}
-
-	MonoObject* ScriptColorGradingSettings::toManaged(ColorGradingSettings& value)
-	{
-		MonoObject* object = metaData.scriptClass->createInstance();
-
-		sSaturation->set(object, &value.saturation);
-		sContrast->set(object, &value.contrast);
-		sGain->set(object, &value.gain);
-		sOffset->set(object, &value.offset);
-
-		return object;
-	}
-
-	MonoField* ScriptRenderSettings::sEnableAutoExposure = nullptr;
-	MonoField* ScriptRenderSettings::sAutoExposure = nullptr;
-	MonoField* ScriptRenderSettings::sEnableTonemapping = nullptr;
-	MonoField* ScriptRenderSettings::sTonemapping = nullptr;
-	MonoField* ScriptRenderSettings::sWhiteBalance = nullptr;
-	MonoField* ScriptRenderSettings::sColorGrading = nullptr;
-	MonoField* ScriptRenderSettings::sExposureScale = nullptr;
-	MonoField* ScriptRenderSettings::sGamma = nullptr;
-	MonoField* ScriptRenderSettings::sEnableHDR = nullptr;
-	MonoField* ScriptRenderSettings::sEnableLighting = nullptr;
-	MonoField* ScriptRenderSettings::sEnableShadows = nullptr;
-	MonoField* ScriptRenderSettings::sOverlayOnly = nullptr;
-
-	ScriptRenderSettings::ScriptRenderSettings(MonoObject* instance)
-		:ScriptObject(instance)
-	{ }
-
-	void ScriptRenderSettings::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateDefault", (void*)&ScriptRenderSettings::internal_CreateDefault);
-
-		sEnableAutoExposure = metaData.scriptClass->getField("EnableAutoExposure");
-		sAutoExposure = metaData.scriptClass->getField("AutoExposure");
-		sEnableTonemapping = metaData.scriptClass->getField("EnableTonemapping");
-		sTonemapping = metaData.scriptClass->getField("Tonemapping");
-		sWhiteBalance = metaData.scriptClass->getField("WhiteBalance");
-		sColorGrading = metaData.scriptClass->getField("ColorGrading");
-		sExposureScale = metaData.scriptClass->getField("ExposureScale");
-		sGamma = metaData.scriptClass->getField("Gamma");
-		sEnableHDR = metaData.scriptClass->getField("EnableHDR");
-		sEnableLighting = metaData.scriptClass->getField("EnableLighting");
-		sEnableShadows = metaData.scriptClass->getField("EnableShadows");
-		sOverlayOnly = metaData.scriptClass->getField("OverlayOnly");
-	}
-
-	SPtr<RenderSettings> ScriptRenderSettings::toNative(MonoObject* object)
-	{
-		SPtr<RenderSettings> output = bs_shared_ptr_new<RenderSettings>();
-
-		sEnableAutoExposure->get(object, &output->enableAutoExposure);
-		sEnableTonemapping->get(object, &output->enableTonemapping);
-		sExposureScale->get(object, &output->exposureScale);
-		sGamma->get(object, &output->gamma);
-		sEnableHDR->get(object, &output->enableHDR);
-		sEnableLighting->get(object, &output->enableLighting);
-		sEnableShadows->get(object, &output->enableShadows);
-		sOverlayOnly->get(object, &output->overlayOnly);
-
-		MonoObject* autoExposureMono;
-		sAutoExposure->get(object, &autoExposureMono);
-		output->autoExposure = *ScriptAutoExposureSettings::toNative(autoExposureMono);
-
-		MonoObject* tonemappingMono;
-		sTonemapping->get(object, &tonemappingMono);
-		output->tonemapping = *ScriptTonemappingSettings::toNative(tonemappingMono);
-
-		MonoObject* whiteBalanceMono;
-		sWhiteBalance->get(object, &whiteBalanceMono);
-		output->whiteBalance = *ScriptWhiteBalanceSettings::toNative(whiteBalanceMono);
-
-		MonoObject* colorGradingMono;
-		sColorGrading->get(object, &colorGradingMono);
-		output->colorGrading = *ScriptColorGradingSettings::toNative(colorGradingMono);
-
-		return output;
-	}
-
-	MonoObject* ScriptRenderSettings::toManaged(const SPtr<RenderSettings>& value)
-	{
-		MonoObject* object = metaData.scriptClass->createInstance();
-
-		sEnableAutoExposure->set(object, &value->enableAutoExposure);
-		sEnableTonemapping->set(object, &value->enableTonemapping);
-		sExposureScale->set(object, &value->exposureScale);
-		sGamma->set(object, &value->gamma);
-		sEnableHDR->set(object, &value->enableHDR);
-		sEnableLighting->set(object, &value->enableLighting);
-		sEnableShadows->set(object, &value->enableShadows);
-		sOverlayOnly->set(object, &value->overlayOnly);
-
-		MonoObject* autoExposureMono = ScriptAutoExposureSettings::toManaged(value->autoExposure);
-		sAutoExposure->set(object, autoExposureMono);
-
-		MonoObject* tonemappingMono = ScriptTonemappingSettings::toManaged(value->tonemapping);
-		sTonemapping->set(object, tonemappingMono);
-
-		MonoObject* whiteBalanceMono = ScriptWhiteBalanceSettings::toManaged(value->whiteBalance);
-		sWhiteBalance->set(object, whiteBalanceMono);
-
-		MonoObject* colorGradingMono = ScriptColorGradingSettings::toManaged(value->colorGrading);
-		sColorGrading->set(object, colorGradingMono);
-
-		return object;
-	}
-
-	MonoObject* ScriptRenderSettings::internal_CreateDefault()
-	{
-		return toManaged(bs_shared_ptr_new<RenderSettings>());
-	}
-}

+ 0 - 156
Source/SBansheeEngine/Wrappers/BsScriptRenderSettings.h

@@ -1,156 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace bs
-{
-	struct RenderSettings;
-	struct AutoExposureSettings;
-	struct TonemappingSettings;
-	struct WhiteBalanceSettings;
-	struct ColorGradingSettings;
-
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for AutoExposureSettings. */
-	class BS_SCR_BE_EXPORT ScriptAutoExposureSettings : public ScriptObject<ScriptAutoExposureSettings>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "AutoExposureSettings")
-
-		/** Converts managed object its native counterpart. */
-		static SPtr<AutoExposureSettings> toNative(MonoObject* object);
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(AutoExposureSettings& value);
-
-	private:
-		ScriptAutoExposureSettings(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoField* sHistogramLog2Min;
-		static MonoField* sHistogramLog2Max;
-		static MonoField* sHistogramPctLow;
-		static MonoField* sHistogramPctHigh;
-		static MonoField* sMinEyeAdaptation;
-		static MonoField* sMaxEyeAdaptation;
-		static MonoField* sEyeAdaptationSpeedUp;
-		static MonoField* sEyeAdaptationSpeedDown;
-	};
-
-	/**	Interop class between C++ & CLR for TonemappingSettings. */
-	class BS_SCR_BE_EXPORT ScriptTonemappingSettings : public ScriptObject<ScriptTonemappingSettings>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "TonemappingSettings")
-
-		/** Converts managed object its native counterpart. */
-		static SPtr<TonemappingSettings> toNative(MonoObject* object);
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(TonemappingSettings& value);
-
-	private:
-		ScriptTonemappingSettings(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoField* sFilmicCurveShoulderStrength;
-		static MonoField* sFilmicCurveLinearStrength;
-		static MonoField* sFilmicCurveLinearAngle;
-		static MonoField* sFilmicCurveToeStrength;
-		static MonoField* sFilmicCurveToeNumerator;
-		static MonoField* sFilmicCurveToeDenominator;
-		static MonoField* sFilmicCurveLinearWhitePoint;
-	};
-
-	/**	Interop class between C++ & CLR for WhiteBalanceSettings. */
-	class BS_SCR_BE_EXPORT ScriptWhiteBalanceSettings : public ScriptObject<ScriptWhiteBalanceSettings>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "WhiteBalanceSettings")
-
-		/** Converts managed object its native counterpart. */
-		static SPtr<WhiteBalanceSettings> toNative(MonoObject* object);
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(WhiteBalanceSettings& value);
-
-	private:
-		ScriptWhiteBalanceSettings(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoField* sTemperature;
-		static MonoField* sTint;
-	};
-
-	/**	Interop class between C++ & CLR for ColorGradingSettings. */
-	class BS_SCR_BE_EXPORT ScriptColorGradingSettings : public ScriptObject<ScriptColorGradingSettings>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ColorGradingSettings")
-
-		/** Converts managed object its native counterpart. */
-		static SPtr<ColorGradingSettings> toNative(MonoObject* object);
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(ColorGradingSettings& value);
-
-	private:
-		ScriptColorGradingSettings(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoField* sSaturation;
-		static MonoField* sContrast;
-		static MonoField* sGain;
-		static MonoField* sOffset;
-	};
-
-	/**	Interop class between C++ & CLR for RenderSettings. */
-	class BS_SCR_BE_EXPORT ScriptRenderSettings : public ScriptObject<ScriptRenderSettings>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "RenderSettings")
-
-		/** Converts managed object its native counterpart. */
-		static SPtr<RenderSettings> toNative(MonoObject* object);
-
-		/** Converts native object to its managed counterpart. */
-		static MonoObject* toManaged(const SPtr<RenderSettings>& value);
-
-	private:
-		ScriptRenderSettings(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static MonoObject* internal_CreateDefault();
-
-		static MonoField* sEnableAutoExposure;;
-		static MonoField* sAutoExposure;
-		static MonoField* sEnableTonemapping;
-		static MonoField* sTonemapping;
-		static MonoField* sWhiteBalance;
-		static MonoField* sColorGrading;
-		static MonoField* sExposureScale;
-		static MonoField* sGamma;
-		static MonoField* sEnableHDR;
-		static MonoField* sEnableLighting;
-		static MonoField* sEnableShadows;
-		static MonoField* sOverlayOnly;
-	};
-
-	/** @} */
-}

+ 0 - 64
Source/SBansheeEngine/Wrappers/BsScriptRenderTarget.cpp

@@ -1,64 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptRenderTarget.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "RenderAPI/BsRenderTarget.h"
-#include "CoreThread/BsCoreThread.h"
-
-namespace bs
-{
-	ScriptRenderTarget::ScriptRenderTarget(MonoObject* instance)
-		:ScriptObject(instance)
-	{
-
-	}
-
-	void ScriptRenderTarget::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_GetWidth", (void*)&ScriptRenderTarget::internal_getWidth);
-		metaData.scriptClass->addInternalCall("Internal_GetHeight", (void*)&ScriptRenderTarget::internal_getHeight);
-		metaData.scriptClass->addInternalCall("Internal_GetGammaCorrection", (void*)&ScriptRenderTarget::internal_getGammaCorrection);
-		metaData.scriptClass->addInternalCall("Internal_GetSampleCount", (void*)&ScriptRenderTarget::internal_getSampleCount);
-		metaData.scriptClass->addInternalCall("Internal_GetPriority", (void*)&ScriptRenderTarget::internal_getPriority);
-		metaData.scriptClass->addInternalCall("Internal_SetPriority", (void*)&ScriptRenderTarget::internal_setPriority);
-	}
-
-	void ScriptRenderTarget::internal_getWidth(ScriptRenderTarget* thisPtr, int* value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		*value = rt->getProperties().width;
-	}
-
-	void ScriptRenderTarget::internal_getHeight(ScriptRenderTarget* thisPtr, int* value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		*value = rt->getProperties().height;
-	}
-
-	void ScriptRenderTarget::internal_getGammaCorrection(ScriptRenderTarget* thisPtr, bool* value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		*value = rt->getProperties().hwGamma;
-	}
-
-	void ScriptRenderTarget::internal_getSampleCount(ScriptRenderTarget* thisPtr, int* value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		*value = rt->getProperties().multisampleCount;
-	}
-
-	void ScriptRenderTarget::internal_getPriority(ScriptRenderTarget* thisPtr, int* value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		*value = rt->getProperties().priority;
-	}
-
-	void ScriptRenderTarget::internal_setPriority(ScriptRenderTarget* thisPtr, int value)
-	{
-		SPtr<RenderTarget> rt = thisPtr->getNativeValue();
-		rt->setPriority(value);
-	}
-}

+ 0 - 52
Source/SBansheeEngine/Wrappers/BsScriptRenderTarget.h

@@ -1,52 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Base interop class for any types deriving from RenderTarget. */
-	class BS_SCR_BE_EXPORT ScriptRenderTargetBase : public ScriptObjectBase
-	{
-	public:
-		/**	Returns the native render target this object wraps. */
-		virtual SPtr<RenderTarget> getNativeValue() const = 0;
-
-	protected:
-		friend class ScriptResourceManager;
-
-		ScriptRenderTargetBase(MonoObject* instance)
-			:ScriptObjectBase(instance)
-		{ }
-
-		virtual ~ScriptRenderTargetBase() {}
-	};
-
-	/**	Interop class between C++ & CLR for RenderTarget. */
-	class BS_SCR_BE_EXPORT ScriptRenderTarget : public ScriptObject<ScriptRenderTarget, ScriptRenderTargetBase>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "RenderTarget")
-
-	private:
-		ScriptRenderTarget(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_getWidth(ScriptRenderTarget* thisPtr, int* value);
-		static void internal_getHeight(ScriptRenderTarget* thisPtr, int* value);
-		static void internal_getGammaCorrection(ScriptRenderTarget* thisPtr, bool* value);
-		static void internal_getSampleCount(ScriptRenderTarget* thisPtr, int* value);
-		static void internal_getPriority(ScriptRenderTarget* thisPtr, int* value);
-		static void internal_setPriority(ScriptRenderTarget* thisPtr, int value);
-	};
-
-	/** @} */
-}

+ 0 - 21
Source/SBansheeEngine/Wrappers/BsScriptRenderTexture.cpp

@@ -1,21 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptRenderTexture.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-
-namespace bs
-{
-	ScriptRenderTexture::ScriptRenderTexture(MonoObject* instance)
-		:ScriptObject(instance)
-	{
-
-	}
-
-	void ScriptRenderTexture::initRuntimeData()
-	{
-
-	}
-}

+ 0 - 25
Source/SBansheeEngine/Wrappers/BsScriptRenderTexture.h

@@ -1,25 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "Wrappers/BsScriptRenderTarget.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for RenderTexture. */
-	class BS_SCR_BE_EXPORT ScriptRenderTexture : public ScriptObject <ScriptRenderTexture, ScriptRenderTargetBase>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "RenderTexture")
-
-	private:
-		ScriptRenderTexture(MonoObject* instance);
-	};
-
-	/** @} */
-}

+ 0 - 132
Source/SBansheeEngine/Wrappers/BsScriptRenderTexture2D.cpp

@@ -1,132 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "Wrappers/BsScriptRenderTexture2D.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "RenderAPI/BsRenderTexture.h"
-#include "BsMonoUtil.h"
-#include "BsScriptResourceManager.h"
-
-#include "BsScriptTexture.generated.h"
-
-namespace bs
-{
-	ScriptRenderTexture2D::ScriptRenderTexture2D(const SPtr<RenderTarget>& target, MonoObject* instance)
-		:ScriptObject(instance), mRenderTarget(target)
-	{
-
-	}
-
-	void ScriptRenderTexture2D::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateDetailed", (void*)&ScriptRenderTexture2D::internal_createDetailed);
-		metaData.scriptClass->addInternalCall("Internal_Create", (void*)&ScriptRenderTexture2D::internal_create);
-		metaData.scriptClass->addInternalCall("Internal_GetColorSurfaces", (void*)&ScriptRenderTexture2D::internal_getColorSurfaces);
-		metaData.scriptClass->addInternalCall("Internal_GetDepthStencilSurface", (void*)&ScriptRenderTexture2D::internal_getDepthStencilSurface);
-	}
-
-	SPtr<RenderTexture> ScriptRenderTexture2D::getRenderTexture() const
-	{
-		return std::static_pointer_cast<RenderTexture>(mRenderTarget);
-	}
-
-	void ScriptRenderTexture2D::internal_createDetailed(MonoObject* instance, PixelFormat format, UINT32 width, UINT32 height,
-		UINT32 numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat)
-	{
-		TEXTURE_DESC texDesc;
-		texDesc.type = TEX_TYPE_2D;
-		texDesc.width = width;
-		texDesc.height = height;
-		texDesc.format = format;
-		texDesc.hwGamma = gammaCorrection;
-		texDesc.numSamples = numSamples;
-
-		SPtr<RenderTexture> tex = RenderTexture::create(texDesc, createDepth, depthStencilFormat);
-		new (bs_alloc<ScriptRenderTexture2D>()) ScriptRenderTexture2D(tex, instance);
-	}
-
-	void ScriptRenderTexture2D::internal_create(MonoObject* instance, MonoArray* colorSurfaces, ScriptTexture* depthStencilSurface)
-	{
-		ScriptArray colorSurfacesList(colorSurfaces);
-
-		RENDER_SURFACE_DESC depthStencilSurfaceDesc;
-		if (depthStencilSurface != nullptr)
-		{
-			depthStencilSurfaceDesc.face = 0;
-			depthStencilSurfaceDesc.mipLevel = 0;
-			depthStencilSurfaceDesc.numFaces = 1;
-
-			HTexture textureHandle = depthStencilSurface->getHandle();
-			if (!textureHandle.isLoaded())
-			{
-				LOGERR("Render texture must be created using a fully loaded texture.");
-			}
-			else
-				depthStencilSurfaceDesc.texture = textureHandle;
-		}
-
-		UINT32 numSurfaces = std::min(colorSurfacesList.size(), (UINT32)BS_MAX_MULTIPLE_RENDER_TARGETS);
-
-		RENDER_TEXTURE_DESC desc;
-		for (UINT32 i = 0; i < numSurfaces; i++)
-		{
-			RENDER_SURFACE_DESC surfaceDesc;
-			surfaceDesc.face = 0;
-			surfaceDesc.mipLevel = 0;
-			surfaceDesc.numFaces = 1;
-
-			ScriptTexture* scriptSurface = colorSurfacesList.get<ScriptTexture*>(i);
-			if (scriptSurface != nullptr)
-			{
-				HTexture textureHandle = scriptSurface->getHandle();
-				if (!textureHandle.isLoaded())
-				{
-					LOGERR("Render texture must be created using a fully loaded texture.");
-				}
-				else
-					surfaceDesc.texture = textureHandle;
-			}
-
-			desc.colorSurfaces[i] = surfaceDesc;
-		}
-
-		desc.depthStencilSurface = depthStencilSurfaceDesc;
-
-		SPtr<RenderTarget> tex = RenderTexture::create(desc);
-		new (bs_alloc<ScriptRenderTexture2D>()) ScriptRenderTexture2D(tex, instance);
-	}
-
-	void ScriptRenderTexture2D::internal_getColorSurfaces(ScriptRenderTexture2D* thisPtr, MonoArray** value)
-	{
-		SPtr<RenderTexture> tex = thisPtr->getRenderTexture();
-
-		UINT32 numColorSurfaces = BS_MAX_MULTIPLE_RENDER_TARGETS;
-		ScriptArray outArray = ScriptArray::create<ScriptTexture>(numColorSurfaces);
-
-		for (UINT32 i = 0; i < numColorSurfaces; i++)
-		{
-			HTexture colorTex = tex->getColorTexture(i);
-
-			if (colorTex != nullptr)
-			{
-				ScriptResourceBase* scriptSurface = ScriptResourceManager::instance().getScriptResource(colorTex, true);
-				outArray.set<MonoObject*>(i, scriptSurface->getManagedInstance());
-			}
-			else
-				outArray.set<MonoObject*>(i, nullptr);
-		}
-
-		*value = outArray.getInternal();
-	}
-
-	void ScriptRenderTexture2D::internal_getDepthStencilSurface(ScriptRenderTexture2D* thisPtr, MonoObject** value)
-	{
-		SPtr<RenderTexture> tex = thisPtr->getRenderTexture();
-		HTexture depthTex = tex->getDepthStencilTexture();
-
-		ScriptResourceBase* scriptSurface = ScriptResourceManager::instance().getScriptResource(depthTex, true);
-		*value = scriptSurface->getManagedInstance();
-	}
-}

+ 0 - 44
Source/SBansheeEngine/Wrappers/BsScriptRenderTexture2D.h

@@ -1,44 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "Wrappers/BsScriptRenderTarget.h"
-#include "Image/BsPixelUtil.h"
-
-namespace bs
-{
-	/** @addtogroup ScriptInteropEngine
-	 *  @{
-	 */
-
-	/**	Interop class between C++ & CLR for a single or multi RenderTexture using a 2D texture. */
-	class BS_SCR_BE_EXPORT ScriptRenderTexture2D : public ScriptObject < ScriptRenderTexture2D, ScriptRenderTargetBase >
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "RenderTexture2D")
-
-		/** @copydoc ScriptRenderTargetBase::getNativeValue */
-		SPtr<RenderTarget> getNativeValue() const override { return mRenderTarget; }
-
-		/** Returns the internal wrapped render texture. */
-		SPtr<RenderTexture> getRenderTexture() const;
-
-	private:
-		ScriptRenderTexture2D(const SPtr<RenderTarget>& target, MonoObject* instance);
-
-		SPtr<RenderTarget> mRenderTarget;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createDetailed(MonoObject* instance, PixelFormat format, UINT32 width, UINT32 height,
-			UINT32 numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat);
-		static void internal_create(MonoObject* instance, MonoArray* colorSurfaces, ScriptTexture* depthStencilSurface);
-
-		static void internal_getColorSurfaces(ScriptRenderTexture2D* thisPtr, MonoArray** value);
-		static void internal_getDepthStencilSurface(ScriptRenderTexture2D* thisPtr, MonoObject** value);
-	};
-
-	/** @} */
-}

+ 6 - 5
Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIRenderTexture.cpp

@@ -14,7 +14,8 @@
 #include "Wrappers/GUI/BsScriptGUILayout.h"
 #include "Wrappers/BsScriptHString.h"
 #include "Wrappers/GUI/BsScriptGUIContent.h"
-#include "Wrappers/BsScriptRenderTexture2D.h"
+
+#include "BsScriptRenderTexture.generated.h"
 
 namespace bs
 {
@@ -32,7 +33,7 @@ namespace bs
 	}
 
 	void ScriptGUIRenderTexture::internal_createInstance(MonoObject* instance, 
-		ScriptRenderTexture2D* texture, bool transparent, MonoString* style, MonoArray* guiOptions)
+		ScriptRenderTexture* texture, bool transparent, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -43,18 +44,18 @@ namespace bs
 
 		SPtr<RenderTexture> renderTexture;
 		if (texture != nullptr)
-			renderTexture = texture->getRenderTexture();
+			renderTexture = texture->getInternal();
 
 		GUIRenderTexture* guiTexture = GUIRenderTexture::create(renderTexture, transparent, options, toString(MonoUtil::monoToWString(style)));
 
 		new (bs_alloc<ScriptGUIRenderTexture>()) ScriptGUIRenderTexture(instance, guiTexture);
 	}
 
-	void ScriptGUIRenderTexture::internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture)
+	void ScriptGUIRenderTexture::internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture* texture)
 	{
 		SPtr<RenderTexture> renderTexture;
 		if (texture != nullptr)
-			renderTexture = texture->getRenderTexture();
+			renderTexture = texture->getInternal();
 
 		GUIRenderTexture* guiTexture = (GUIRenderTexture*)nativeInstance->getGUIElement();
 		guiTexture->setRenderTexture(renderTexture);

+ 2 - 2
Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIRenderTexture.h

@@ -23,9 +23,9 @@ namespace bs
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture2D* texture, bool transparent,
+		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture* texture, bool transparent,
 			MonoString* style, MonoArray* guiOptions);
-		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture);
+		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture* texture);
 		static void internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color* color);
 	};
 

+ 7 - 5
Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIWidget.cpp

@@ -3,12 +3,14 @@
 #include "Wrappers/GUI/BsScriptGUIWidget.h"
 #include "Wrappers/BsScriptSceneObject.h"
 #include "Wrappers/GUI/BsScriptGUISkin.h"
-#include "Wrappers/BsScriptCamera.h"
 #include "Wrappers/GUI/BsScriptGUILayout.h"
 #include "GUI/BsGUIWidget.h"
 #include "Scene/BsSceneObject.h"
 #include "Scene/BsSceneManager.h"
 #include "Resources/BsBuiltinResources.h"
+#include "Components/BsCCamera.h"
+
+#include "BsScriptCCamera.generated.h"
 
 namespace bs
 {
@@ -65,7 +67,7 @@ namespace bs
 		}
 	}
 
-	void ScriptGUIWidget::internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCamera* camera)
+	void ScriptGUIWidget::internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCCamera* camera)
 	{
 		SPtr<GUIWidget> widget = instance->getInternal();
 
@@ -73,7 +75,7 @@ namespace bs
 		{
 			SPtr<Camera> nativeCamera;
 			if (camera != nullptr)
-				nativeCamera = camera->getInternal();
+				nativeCamera = camera->getHandle()->_getCamera();
 
 			widget->setCamera(nativeCamera);
 		}
@@ -93,11 +95,11 @@ namespace bs
 			widget->setSkin(guiSkin);
 	}
 
-	void ScriptGUIWidget::internal_SetCamera(ScriptGUIWidget* instance, ScriptCamera* camera)
+	void ScriptGUIWidget::internal_SetCamera(ScriptGUIWidget* instance, ScriptCCamera* camera)
 	{
 		SPtr<Camera> nativeCamera;
 		if (camera != nullptr)
-			nativeCamera = camera->getInternal();
+			nativeCamera = camera->getHandle()->_getCamera();
 
 		if(nativeCamera == nullptr)
 			nativeCamera = gSceneManager().getMainCamera().camera;

+ 4 - 2
Source/SBansheeEngine/Wrappers/GUI/BsScriptGUIWidget.h

@@ -7,6 +7,8 @@
 
 namespace bs
 {
+	class ScriptCCamera;
+
 	/** @addtogroup ScriptInteropEngine
 	 *  @{
 	 */
@@ -41,9 +43,9 @@ namespace bs
 		/************************************************************************/
 		static void internal_Create(MonoObject* instance);
 		static void internal_UpdateTransform(ScriptGUIWidget* instance, ScriptSceneObject* parentSO);
-		static void internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
+		static void internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCCamera* camera);
 		static void internal_SetSkin(ScriptGUIWidget* instance, ScriptGUISkin* skin);
-		static void internal_SetCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
+		static void internal_SetCamera(ScriptGUIWidget* instance, ScriptCCamera* camera);
 		static void internal_SetDepth(ScriptGUIWidget* instance, INT8 value);
 		static INT8 internal_GetDepth(ScriptGUIWidget* instance);
 		static void internal_Destroy(ScriptGUIWidget* instance);