Browse Source

Added default shaders for BansheeRenderer
Minor refactors

Marko Pintera 11 years ago
parent
commit
eb114847f2
28 changed files with 249 additions and 482 deletions
  1. 1 1
      BansheeD3D9RenderSystem/Include/BsD3D9RenderSystem.h
  2. 0 9
      BansheeEditor/Include/BsEditorApplication.h
  3. 1 20
      BansheeEditor/Source/BsEditorApplication.cpp
  4. 17 2
      BansheeEngine/Include/BsApplication.h
  5. 5 0
      BansheeEngine/Include/BsPrerequisites.h
  6. 37 4
      BansheeEngine/Source/BsApplication.cpp
  7. 1 1
      BansheeEngine/Source/BsGLBuiltinMaterialFactory.cpp
  8. 3 33
      BansheeGLRenderSystem/Include/BsGLFrameBufferObject.h
  9. 6 6
      BansheeGLRenderSystem/Include/BsGLGpuBuffer.h
  10. 2 32
      BansheeGLRenderSystem/Include/BsGLPixelBuffer.h
  11. 5 34
      BansheeGLRenderSystem/Include/BsGLPixelFormat.h
  12. 1 1
      BansheeGLRenderSystem/Include/BsGLRenderSystem.h
  13. 4 35
      BansheeGLRenderSystem/Include/BsGLRenderTexture.h
  14. 4 35
      BansheeGLRenderSystem/Include/BsGLTexture.h
  15. 3 32
      BansheeGLRenderSystem/Include/BsGLTextureManager.h
  16. 8 8
      BansheeGLRenderSystem/Include/BsGLVertexBuffer.h
  17. 3 31
      BansheeGLRenderSystem/Source/BsGLFrameBufferObject.cpp
  18. 0 27
      BansheeGLRenderSystem/Source/BsGLHardwareBufferManager.cpp
  19. 0 27
      BansheeGLRenderSystem/Source/BsGLPixelBuffer.cpp
  20. 9 40
      BansheeGLRenderSystem/Source/BsGLPixelFormat.cpp
  21. 1 1
      BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp
  22. 0 27
      BansheeGLRenderSystem/Source/BsGLRenderTexture.cpp
  23. 2 40
      BansheeGLRenderSystem/Source/BsGLTexture.cpp
  24. 0 28
      BansheeGLRenderSystem/Source/BsGLTextureManager.cpp
  25. 2 0
      BansheeRenderer/Include/BsBansheeLitTexRenderableHandler.h
  26. 131 1
      BansheeRenderer/Source/BsBansheeLitTexRenderableHandler.cpp
  27. 3 3
      ExampleProject/Main/Main.cpp
  28. 0 4
      Renderer.txt

+ 1 - 1
BansheeD3D9RenderSystem/Include/BsD3D9RenderSystem.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 	{
 	{
 	public:
 	public:
 		// constructor
 		// constructor
-		D3D9RenderSystem( HINSTANCE hInstance );
+		D3D9RenderSystem(HINSTANCE hInstance);
 		// destructor
 		// destructor
 		~D3D9RenderSystem();
 		~D3D9RenderSystem();
 
 

+ 0 - 9
BansheeEditor/Include/BsEditorApplication.h

@@ -6,13 +6,6 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	enum class RenderSystemPlugin
-	{
-		DX11,
-		DX9,
-		OpenGL
-	};
-
 	class BS_ED_EXPORT EditorApplication : public Application
 	class BS_ED_EXPORT EditorApplication : public Application
 	{
 	{
 	public:
 	public:
@@ -24,8 +17,6 @@ namespace BansheeEngine
 		bool isProjectLoaded() const;
 		bool isProjectLoaded() const;
 		const Path& getActiveProjectPath() const;
 		const Path& getActiveProjectPath() const;
 	private:
 	private:
-		static const String& getLibraryNameForRenderSystem(RenderSystemPlugin plugin);
-
 		virtual void onStartUp();
 		virtual void onStartUp();
 		virtual void update();
 		virtual void update();
 
 

+ 1 - 20
BansheeEditor/Source/BsEditorApplication.cpp

@@ -51,7 +51,7 @@ namespace BansheeEngine
 	}
 	}
 
 
 	EditorApplication::EditorApplication(RenderSystemPlugin renderSystemPlugin)
 	EditorApplication::EditorApplication(RenderSystemPlugin renderSystemPlugin)
-		:Application(createRenderWindowDesc(), getLibraryNameForRenderSystem(renderSystemPlugin), "BansheeRenderer"), 
+		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
 		mActiveRSPlugin(renderSystemPlugin)
 		mActiveRSPlugin(renderSystemPlugin)
 	{
 	{
 		EditorGUI::startUp();
 		EditorGUI::startUp();
@@ -386,25 +386,6 @@ namespace BansheeEngine
 		return dummyProjectPath;
 		return dummyProjectPath;
 	}
 	}
 
 
-	const String& EditorApplication::getLibraryNameForRenderSystem(RenderSystemPlugin plugin)
-	{
-		static String DX11Name = "BansheeD3D11RenderSystem";
-		static String DX9Name = "BansheeD3D9RenderSystem";
-		static String OpenGLName = "BansheeGLRenderSystem";
-
-		switch(plugin)
-		{
-		case RenderSystemPlugin::DX11:
-			return DX11Name;
-		case RenderSystemPlugin::DX9:
-			return DX9Name;
-		case RenderSystemPlugin::OpenGL:
-			return OpenGLName;
-		}
-
-		return StringUtil::BLANK;
-	}
-
 	EditorWidgetLayoutPtr EditorApplication::loadWidgetLayout()
 	EditorWidgetLayoutPtr EditorApplication::loadWidgetLayout()
 	{
 	{
 		Path layoutPath = getActiveProjectPath();
 		Path layoutPath = getActiveProjectPath();

+ 17 - 2
BansheeEngine/Include/BsApplication.h

@@ -6,13 +6,25 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	enum class RenderSystemPlugin
+	{
+		DX11,
+		DX9,
+		OpenGL
+	};
+
+	enum class RendererPlugin
+	{
+		Default
+	};
+
 	class BS_EXPORT Application : public CoreApplication
 	class BS_EXPORT Application : public CoreApplication
 	{
 	{
 	public:
 	public:
-		Application(RENDER_WINDOW_DESC& primaryWindowDesc, const String& renderSystem, const String& renderer);
+		Application(RENDER_WINDOW_DESC& primaryWindowDesc, RenderSystemPlugin renderSystem, RendererPlugin renderer);
 		virtual ~Application();
 		virtual ~Application();
 
 
-		static void startUp(RENDER_WINDOW_DESC& primaryWindowDesc, const String& renderSystem, const String& renderer);
+		static void startUp(RENDER_WINDOW_DESC& primaryWindowDesc, RenderSystemPlugin renderSystem, RendererPlugin renderer);
 
 
 		const ViewportPtr& getPrimaryViewport() const;
 		const ViewportPtr& getPrimaryViewport() const;
 	protected:
 	protected:
@@ -21,6 +33,9 @@ namespace BansheeEngine
 		virtual void update();
 		virtual void update();
 
 
 	private:
 	private:
+		static const String& getLibNameForRenderSystem(RenderSystemPlugin plugin);
+		static const String& getLibNameForRenderer(RendererPlugin plugin);
+
 		DynLib* mMonoPlugin;
 		DynLib* mMonoPlugin;
 		DynLib* mSBansheeEnginePlugin;
 		DynLib* mSBansheeEnginePlugin;
 	};
 	};

+ 5 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -23,6 +23,11 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	static const String RenderSystemDX9 = "D3D9RenderSystem";
+	static const String RenderSystemDX11 = "D3D11RenderSystem";
+	static const String RenderSystemOpenGL = "GLRenderSystem";
+	static const String RendererDefault = "BansheeRenderer";
+
 	class VirtualButton;
 	class VirtualButton;
 	class VirtualInput;
 	class VirtualInput;
 	class InputConfiguration;
 	class InputConfiguration;

+ 37 - 4
BansheeEngine/Source/BsApplication.cpp

@@ -32,8 +32,9 @@ namespace BansheeEngine
 		return desc;
 		return desc;
 	}
 	}
 
 
-	Application::Application(RENDER_WINDOW_DESC& primaryWindowDesc, const String& renderSystem, const String& renderer)
-		:CoreApplication(createStartUpDesc(primaryWindowDesc, renderSystem, renderer)), mMonoPlugin(nullptr), mSBansheeEnginePlugin(nullptr)
+	Application::Application(RENDER_WINDOW_DESC& primaryWindowDesc, RenderSystemPlugin renderSystem, RendererPlugin renderer)
+		:CoreApplication(createStartUpDesc(primaryWindowDesc, getLibNameForRenderSystem(renderSystem), getLibNameForRenderer(renderer))),
+		mMonoPlugin(nullptr), mSBansheeEnginePlugin(nullptr)
 	{
 	{
 		VirtualInput::startUp();
 		VirtualInput::startUp();
 		ScriptManager::startUp();
 		ScriptManager::startUp();
@@ -45,7 +46,7 @@ namespace BansheeEngine
 		BuiltinMaterialManager::instance().addFactory(bs_new<D3D9BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(bs_new<D3D9BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(bs_new<D3D11BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(bs_new<D3D11BuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(bs_new<GLBuiltinMaterialFactory>());
 		BuiltinMaterialManager::instance().addFactory(bs_new<GLBuiltinMaterialFactory>());
-		BuiltinMaterialManager::instance().setActive(renderSystem);
+		BuiltinMaterialManager::instance().setActive(getLibNameForRenderSystem(renderSystem));
 
 
 		DrawHelper2D::startUp();
 		DrawHelper2D::startUp();
 		DrawHelper3D::startUp();
 		DrawHelper3D::startUp();
@@ -87,7 +88,7 @@ namespace BansheeEngine
 		Cursor::instance().setCursor(CursorType::Arrow);
 		Cursor::instance().setCursor(CursorType::Arrow);
 	}
 	}
 
 
-	void Application::startUp(RENDER_WINDOW_DESC& primaryWindowDesc, const String& renderSystem, const String& renderer)
+	void Application::startUp(RENDER_WINDOW_DESC& primaryWindowDesc, RenderSystemPlugin renderSystem, RendererPlugin renderer)
 	{
 	{
 		CoreApplication::startUp<Application>(primaryWindowDesc, renderSystem, renderer);
 		CoreApplication::startUp<Application>(primaryWindowDesc, renderSystem, renderer);
 	}
 	}
@@ -106,6 +107,38 @@ namespace BansheeEngine
 		return nullptr;
 		return nullptr;
 	}
 	}
 
 
+	const String& Application::getLibNameForRenderSystem(RenderSystemPlugin plugin)
+	{
+		static String DX11Name = "BansheeD3D11RenderSystem";
+		static String DX9Name = "BansheeD3D9RenderSystem";
+		static String OpenGLName = "BansheeGLRenderSystem";
+
+		switch (plugin)
+		{
+		case RenderSystemPlugin::DX11:
+			return DX11Name;
+		case RenderSystemPlugin::DX9:
+			return DX9Name;
+		case RenderSystemPlugin::OpenGL:
+			return OpenGLName;
+		}
+
+		return StringUtil::BLANK;
+	}
+
+	const String& Application::getLibNameForRenderer(RendererPlugin plugin)
+	{
+		static String DefaultName = "BansheeRenderer";
+
+		switch (plugin)
+		{
+		case RendererPlugin::Default:
+			return DefaultName;
+		}
+	
+		return StringUtil::BLANK;
+	}
+
 	Application& gApplication()
 	Application& gApplication()
 	{
 	{
 		return static_cast<Application&>(Application::instance());
 		return static_cast<Application&>(Application::instance());

+ 1 - 1
BansheeEngine/Source/BsGLBuiltinMaterialFactory.cpp

@@ -499,7 +499,7 @@ void GLBuiltinMaterialFactory::initDummyShader()
 															\
 															\
 						void main()							\
 						void main()							\
 						{									\
 						{									\
-							fragColor = vec4(0.5f, 0.5f, 0.5f, 0.5f; \
+							fragColor = vec4(0.5f, 0.5f, 0.5f, 0.5f); \
 						}";
 						}";
 
 
 		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
 		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);

+ 3 - 33
BansheeGLRenderSystem/Include/BsGLFrameBufferObject.h

@@ -1,32 +1,4 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __OgreGLFBO_H__
-#define __OgreGLFBO_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsGLContext.h"
 #include "BsGLContext.h"
@@ -102,8 +74,6 @@ namespace BansheeEngine
             - Not all bound surfaces have the same size
             - Not all bound surfaces have the same size
             - Not all bound surfaces have the same internal format
             - Not all bound surfaces have the same internal format
         */
         */
-        void initialise();
+        void initialize();
     };
     };
-}
-
-#endif
+}

+ 6 - 6
BansheeGLRenderSystem/Include/BsGLGpuBuffer.h

@@ -21,19 +21,19 @@ namespace BansheeEngine
 		virtual void unlock();
 		virtual void unlock();
 
 
 		/**
 		/**
-		* @copydoc GenericBuffer::readData
-		*/
+		 * @copydoc GenericBuffer::readData
+		 */
         virtual void readData(UINT32 offset, UINT32 length, void* pDest);
         virtual void readData(UINT32 offset, UINT32 length, void* pDest);
 
 
 		/**
 		/**
-		* @copydoc GenericBuffer::writeData
-		*/
+		 * @copydoc GenericBuffer::writeData
+		 */
         virtual void writeData(UINT32 offset, UINT32 length, const void* pSource,
         virtual void writeData(UINT32 offset, UINT32 length, const void* pSource,
 				BufferWriteType writeFlags = BufferWriteType::Normal);
 				BufferWriteType writeFlags = BufferWriteType::Normal);
 
 
 		/**
 		/**
-		* @copydoc GenericBuffer::copyData
-		*/
+		 * @copydoc GenericBuffer::copyData
+		 */
 		void copyData(GpuBuffer& srcBuffer, UINT32 srcOffset, 
 		void copyData(GpuBuffer& srcBuffer, UINT32 srcOffset, 
 			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false);
 			UINT32 dstOffset, UINT32 length, bool discardWholeBuffer = false);
 
 

+ 2 - 32
BansheeGLRenderSystem/Include/BsGLPixelBuffer.h

@@ -1,32 +1,4 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __GLPIXELBUFFER_H__
-#define __GLPIXELBUFFER_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsPixelBuffer.h"
 #include "BsPixelBuffer.h"
@@ -120,6 +92,4 @@ namespace BansheeEngine
         // In case this is a render buffer
         // In case this is a render buffer
         GLuint mRenderbufferID;
         GLuint mRenderbufferID;
     };
     };
-};
-
-#endif
+};

+ 5 - 34
BansheeGLRenderSystem/Include/BsGLPixelFormat.h

@@ -1,37 +1,10 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __GLPIXELFORMAT_H__
-#define __GLPIXELFORMAT_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsPixelUtil.h"
 #include "BsPixelUtil.h"
-namespace BansheeEngine {
-    
+
+namespace BansheeEngine 
+{
 	/**
 	/**
 	* Class to do pixel format mapping between GL and OGRE
 	* Class to do pixel format mapping between GL and OGRE
 	*/
 	*/
@@ -94,6 +67,4 @@ namespace BansheeEngine {
         */
         */
         static UINT32 optionalPO2(UINT32 value);
         static UINT32 optionalPO2(UINT32 value);
 	};
 	};
-};
-
-#endif
+};

+ 1 - 1
BansheeGLRenderSystem/Include/BsGLRenderSystem.h

@@ -20,7 +20,7 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @copydoc RenderSystem::getName()
 		 * @copydoc RenderSystem::getName()
 		 */
 		 */
-        const String& getName(void) const;
+        const String& getName() const;
 
 
 		/**
 		/**
 		 * @copydoc RenderSystem::getShadingLanguageName()
 		 * @copydoc RenderSystem::getShadingLanguageName()

+ 4 - 35
BansheeGLRenderSystem/Include/BsGLRenderTexture.h

@@ -1,41 +1,12 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#ifndef __GLRENDERTEXTURE_H__
-#define __GLRENDERTEXTURE_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsGLTexture.h"
 #include "BsGLTexture.h"
 #include "BsGLFrameBufferObject.h"
 #include "BsGLFrameBufferObject.h"
 #include "BsModule.h"
 #include "BsModule.h"
 
 
-/// Extra GL constants
-#define GL_DEPTH24_STENCIL8_EXT                           0x88F0
+// Extra GL constants
+#define GL_DEPTH24_STENCIL8_EXT 0x88F0
 
 
 namespace BansheeEngine 
 namespace BansheeEngine 
 {  
 {  
@@ -125,6 +96,4 @@ namespace BansheeEngine
         GLuint _tryFormat(GLenum depthFormat, GLenum stencilFormat);
         GLuint _tryFormat(GLenum depthFormat, GLenum stencilFormat);
         bool _tryPackedFormat(GLenum packedFormat);
         bool _tryPackedFormat(GLenum packedFormat);
     };
     };
-}
-
-#endif // __GLTEXTURE_H__
+}

+ 4 - 35
BansheeGLRenderSystem/Include/BsGLTexture.h

@@ -1,33 +1,4 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#ifndef __GLTEXTURE_H__
-#define __GLTEXTURE_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsRenderTexture.h"
 #include "BsRenderTexture.h"
@@ -35,8 +6,8 @@ THE SOFTWARE.
 #include "BsGLSupport.h"
 #include "BsGLSupport.h"
 #include "BsPixelBuffer.h"
 #include "BsPixelBuffer.h"
 
 
-namespace BansheeEngine {
-
+namespace BansheeEngine 
+{
     class BS_RSGL_EXPORT GLTexture : public Texture
     class BS_RSGL_EXPORT GLTexture : public Texture
     {
     {
     public:
     public:
@@ -120,6 +91,4 @@ namespace BansheeEngine {
     };
     };
 
 
 	typedef std::shared_ptr<GLTexture> GLTexturePtr;
 	typedef std::shared_ptr<GLTexture> GLTexturePtr;
-}
-
-#endif // __GLTEXTURE_H__
+}

+ 3 - 32
BansheeGLRenderSystem/Include/BsGLTextureManager.h

@@ -1,40 +1,12 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#ifndef __GLTextureManager_H__
-#define __GLTextureManager_H__
+#pragma once
 
 
 #include "BsGLPrerequisites.h"
 #include "BsGLPrerequisites.h"
 #include "BsGLTexture.h"
 #include "BsGLTexture.h"
 #include "BsGLSupport.h"
 #include "BsGLSupport.h"
 #include "BsTextureManager.h"
 #include "BsTextureManager.h"
 
 
-namespace BansheeEngine {
+namespace BansheeEngine 
+{
     /** GL-specific implementation of a TextureManager */
     /** GL-specific implementation of a TextureManager */
     class BS_RSGL_EXPORT GLTextureManager : public TextureManager
     class BS_RSGL_EXPORT GLTextureManager : public TextureManager
     {
     {
@@ -53,4 +25,3 @@ namespace BansheeEngine {
         GLSupport& mGLSupport;
         GLSupport& mGLSupport;
     };
     };
 }
 }
-#endif

+ 8 - 8
BansheeGLRenderSystem/Include/BsGLVertexBuffer.h

@@ -45,23 +45,23 @@ namespace BansheeEngine
 		GLVertexBuffer(UINT32 vertexSize, UINT32 numVertices, GpuBufferUsage usage); 
 		GLVertexBuffer(UINT32 vertexSize, UINT32 numVertices, GpuBufferUsage usage); 
 
 
 		/**
 		/**
-		* @copydoc VertexBuffer::initialize_internal()
-		*/
+		 * @copydoc VertexBuffer::initialize_internal()
+		 */
 		void initialize_internal();
 		void initialize_internal();
 
 
 		/**
 		/**
-		* @copydoc VertexBuffer::destroy_internal()
-		*/
+		 * @copydoc VertexBuffer::destroy_internal()
+		 */
 		void destroy_internal();
 		void destroy_internal();
 
 
 		/**
 		/**
-		* @copydoc	HardwareBuffer::lockImpl()
-		*/
+		 * @copydoc	HardwareBuffer::lockImpl()
+		 */
 		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
 		void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
 
 
 		/**
 		/**
-		* @copydoc	HardwareBuffer::unlockImpl()
-		*/
+		 * @copydoc	HardwareBuffer::unlockImpl()
+		 */
 		void unlockImpl();
 		void unlockImpl();
 
 
 	private:
 	private:

+ 3 - 31
BansheeGLRenderSystem/Source/BsGLFrameBufferObject.cpp

@@ -1,31 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
 #include "BsGLFrameBufferObject.h"
 #include "BsGLFrameBufferObject.h"
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelBuffer.h"
 #include "BsGLPixelBuffer.h"
@@ -71,7 +43,7 @@ namespace BansheeEngine
 
 
 		// Re-initialise
 		// Re-initialise
 		if(mColor[0].buffer)
 		if(mColor[0].buffer)
-			initialise();
+			initialize();
     }
     }
 
 
     void GLFrameBufferObject::unbindSurface(UINT32 attachment)
     void GLFrameBufferObject::unbindSurface(UINT32 attachment)
@@ -82,7 +54,7 @@ namespace BansheeEngine
 		// Re-initialise if buffer 0 still bound
 		// Re-initialise if buffer 0 still bound
 		if(mColor[0].buffer)
 		if(mColor[0].buffer)
 		{
 		{
-			initialise();
+			initialize();
 		}
 		}
     }
     }
 
 
@@ -96,7 +68,7 @@ namespace BansheeEngine
 		mDepthStencilBuffer = nullptr;
 		mDepthStencilBuffer = nullptr;
 	}
 	}
 
 
-    void GLFrameBufferObject::initialise()
+    void GLFrameBufferObject::initialize()
     {
     {
         /// First buffer must be bound
         /// First buffer must be bound
         if(!mColor[0].buffer)
         if(!mColor[0].buffer)

+ 0 - 27
BansheeGLRenderSystem/Source/BsGLHardwareBufferManager.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "BsGLHardwareBufferManager.h"
 #include "BsGLHardwareBufferManager.h"
 #include "BsGLVertexBuffer.h"
 #include "BsGLVertexBuffer.h"
 #include "BsGLIndexBuffer.h"
 #include "BsGLIndexBuffer.h"

+ 0 - 27
BansheeGLRenderSystem/Source/BsGLPixelBuffer.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "BsGLPixelBuffer.h"
 #include "BsGLPixelBuffer.h"
 #include "BsGLTexture.h"
 #include "BsGLTexture.h"
 #include "BsGLSupport.h"
 #include "BsGLSupport.h"

+ 9 - 40
BansheeGLRenderSystem/Source/BsGLPixelFormat.cpp

@@ -1,38 +1,10 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelFormat.h"
 #include "BsRenderSystem.h"
 #include "BsRenderSystem.h"
 #include "BsBitwise.h"
 #include "BsBitwise.h"
 #include "BsDebug.h"
 #include "BsDebug.h"
 
 
-namespace BansheeEngine  {
-	//-----------------------------------------------------------------------------
+namespace BansheeEngine  
+{
     GLenum GLPixelUtil::getGLOriginFormat(PixelFormat mFormat)
     GLenum GLPixelUtil::getGLOriginFormat(PixelFormat mFormat)
     {
     {
         switch(mFormat)
         switch(mFormat)
@@ -81,10 +53,10 @@ namespace BansheeEngine  {
                 return 0;
                 return 0;
         }
         }
     }
     }
-	//----------------------------------------------------------------------------- 
-    GLenum GLPixelUtil::getGLOriginDataType(PixelFormat mFormat)
+
+    GLenum GLPixelUtil::getGLOriginDataType(PixelFormat format)
     {
     {
-        switch(mFormat)
+        switch(format)
         {
         {
 			case PF_R8:
 			case PF_R8:
             case PF_R8G8B8:
             case PF_R8G8B8:
@@ -236,8 +208,7 @@ namespace BansheeEngine  {
 
 
 		BS_EXCEPT(InvalidParametersException, "Invalid depth stencil format");
 		BS_EXCEPT(InvalidParametersException, "Invalid depth stencil format");
 	}
 	}
-	
-	//----------------------------------------------------------------------------- 	
+		
 	PixelFormat GLPixelUtil::getClosestEngineFormat(GLenum fmt)
 	PixelFormat GLPixelUtil::getClosestEngineFormat(GLenum fmt)
 	{
 	{
 		switch(fmt) 
 		switch(fmt) 
@@ -291,7 +262,7 @@ namespace BansheeEngine  {
 			return PF_R8G8B8A8;
 			return PF_R8G8B8A8;
 		};
 		};
 	}
 	}
-	//----------------------------------------------------------------------------- 	
+
 	PixelFormat GLPixelUtil::getClosestValidFormat(PixelFormat fmt)
 	PixelFormat GLPixelUtil::getClosestValidFormat(PixelFormat fmt)
 	{
 	{
 		switch(fmt) 
 		switch(fmt) 
@@ -342,7 +313,7 @@ namespace BansheeEngine  {
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		}
 		}
 	}
 	}
-    //-----------------------------------------------------------------------------    
+
     UINT32 GLPixelUtil::optionalPO2(UINT32 value)
     UINT32 GLPixelUtil::optionalPO2(UINT32 value)
     {
     {
         const RenderSystemCapabilities *caps = BansheeEngine::RenderSystem::instancePtr()->getCapabilities();
         const RenderSystemCapabilities *caps = BansheeEngine::RenderSystem::instancePtr()->getCapabilities();
@@ -350,7 +321,5 @@ namespace BansheeEngine  {
             return value;
             return value;
         else
         else
             return Bitwise::firstPO2From((UINT32)value);
             return Bitwise::firstPO2From((UINT32)value);
-    }   
-
-	
+    }
 };
 };

+ 1 - 1
BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp

@@ -26,7 +26,7 @@
 
 
 namespace BansheeEngine 
 namespace BansheeEngine 
 {
 {
-	String MODULE_NAME = "CamelotGLRenderSystem.dll";
+	String MODULE_NAME = "BansheeGLRenderSystem.dll";
 
 
 	void openGlErrorCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam);
 	void openGlErrorCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam);
 
 

+ 0 - 27
BansheeGLRenderSystem/Source/BsGLRenderTexture.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "BsGLRenderTexture.h"
 #include "BsGLRenderTexture.h"
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelBuffer.h"
 #include "BsGLPixelBuffer.h"

+ 2 - 40
BansheeGLRenderSystem/Source/BsGLTexture.cpp

@@ -1,31 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
 #include "BsGLTexture.h"
 #include "BsGLTexture.h"
 #include "BsGLSupport.h"
 #include "BsGLSupport.h"
 #include "BsGLPixelFormat.h"
 #include "BsGLPixelFormat.h"
@@ -38,24 +10,14 @@ THE SOFTWARE.
 
 
 #include "BsGLRenderTexture.h"
 #include "BsGLRenderTexture.h"
 
 
-#if BS_PLATFORM == BS_PLATFORM_WIN32
-#  define WIN32_LEAN_AND_MEAN
-#  if !defined(NOMINMAX) && defined(_MSC_VER)
-#	define NOMINMAX // required to stop windows.h messing up std::min
-#  endif
-#  include <windows.h>
-#  include <wingdi.h>
-#endif
-
-namespace BansheeEngine {
-
+namespace BansheeEngine 
+{
     GLTexture::GLTexture(GLSupport& support) 
     GLTexture::GLTexture(GLSupport& support) 
         : Texture(),
         : Texture(),
         mTextureID(0), mGLSupport(support)
         mTextureID(0), mGLSupport(support)
     {
     {
     }
     }
 
 
-
     GLTexture::~GLTexture()
     GLTexture::~GLTexture()
     {
     {
     }
     }

+ 0 - 28
BansheeGLRenderSystem/Source/BsGLTextureManager.cpp

@@ -1,31 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
 #include "BsGLTextureManager.h"
 #include "BsGLTextureManager.h"
 #include "BsRenderSystem.h"
 #include "BsRenderSystem.h"
 #include "BsGLRenderTexture.h"
 #include "BsGLRenderTexture.h"

+ 2 - 0
BansheeRenderer/Include/BsBansheeLitTexRenderableHandler.h

@@ -32,6 +32,8 @@ namespace BansheeEngine
 		void updatePerObjectBuffers(RenderableElement* element, const Matrix4& wvpMatrix);
 		void updatePerObjectBuffers(RenderableElement* element, const Matrix4& wvpMatrix);
 
 
 	protected:
 	protected:
+		ShaderPtr createDefaultShader();
+
 		ShaderPtr defaultShader;
 		ShaderPtr defaultShader;
 
 
 		GpuParamBlockDesc staticParamBlockDesc;
 		GpuParamBlockDesc staticParamBlockDesc;

+ 131 - 1
BansheeRenderer/Source/BsBansheeLitTexRenderableHandler.cpp

@@ -8,12 +8,13 @@
 #include "BsGpuParamBlockBuffer.h"
 #include "BsGpuParamBlockBuffer.h"
 #include "BsTechnique.h"
 #include "BsTechnique.h"
 #include "BsPass.h"
 #include "BsPass.h"
+#include "BsRenderSystem.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
 	LitTexRenderableHandler::LitTexRenderableHandler()
 	LitTexRenderableHandler::LitTexRenderableHandler()
 	{
 	{
-		defaultShader = nullptr; // TODO - Get proper shader
+		defaultShader = createDefaultShader();
 
 
 		TechniquePtr defaultTechnique = defaultShader->getBestTechnique();
 		TechniquePtr defaultTechnique = defaultShader->getBestTechnique();
 		PassPtr defaultPass = defaultTechnique->getPass(0);
 		PassPtr defaultPass = defaultTechnique->getPass(0);
@@ -255,4 +256,133 @@ namespace BansheeEngine
 				paramBlock->uploadToBuffer(rendererData->perObjectParamBuffer);
 				paramBlock->uploadToBuffer(rendererData->perObjectParamBuffer);
 		}
 		}
 	}
 	}
+
+	ShaderPtr LitTexRenderableHandler::createDefaultShader()
+	{
+		String rsName = RenderSystem::instance().getName();
+
+		HGpuProgram vsProgram;
+		HGpuProgram psProgram;
+
+		if (rsName == RenderSystemDX11)
+		{
+			String vsCode = R"(
+			cbuffer PerFrame
+			{
+				float time;
+			}
+				
+			cbuffer PerObject
+			{
+				float4x4 matWorldViewProj;
+			}
+
+			void vs_main(in float3 inPos : POSITION,
+					     out float4 oPosition : SV_Position)
+			{
+				 oPosition = mul(matWorldViewProj, float4(inPos.xyz + float3(sin(time), 0, 0), 1));
+			})";
+
+			String psCode = R"(
+			cbuffer Static
+			{
+				float4 lightDir;
+			}
+			
+			float4 ps_main() : SV_Target
+			{
+				return dot(lightDir, float4(0.5f, 0.5f, 0.5f, 0.5f));
+			})";	
+
+			vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
+			psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
+		}
+		else if (rsName == RenderSystemDX9)
+		{
+			String vsCode = R"(
+			BS_PARAM_BLOCK PerFrame { time }
+			BS_PARAM_BLOCK PerObject { matWorldViewProj }
+
+			float time;
+			float4x4 matWorldViewProj;
+
+			void vs_main(in float3 inPos : POSITION,
+						out float4 oPosition : POSITION)
+			{
+				oPosition = mul(matWorldViewProj, float4(inPos.xyz + float3(sin(time), 0, 0), 1));
+			})";
+
+			String psCode = R"(
+			BS_PARAM_BLOCK Static { lightDir }
+
+			float4 lightDir;
+
+			float4 ps_main() : COLOR0
+			{
+				return dot(lightDir, float4(0.5f, 0.5f, 0.5f, 0.5f));
+			})";
+
+			vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
+			psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
+		}
+		else if (rsName == RenderSystemOpenGL)
+		{
+			String vsCode = R"(
+			#version 400\n
+
+			uniform PerFrame
+			{
+				float time;
+			}
+
+			uniform PerObject
+			{
+				mat4 matWorldViewProj;
+			}
+
+			in vec3 bs_position;
+
+			void main()
+			{
+				gl_Position = matWorldViewProj * vec4(bs_position.xyz + vec3(sin(time), 0, 0), 1);
+			})";
+
+			String psCode = R"(
+			#version 400\n
+
+			uniform Static
+			{
+				vec4 lightDir;
+			}
+
+			out vec4 fragColor;
+
+			void main()
+			{
+				fragColor = dot(lightDir, vec4(0.5f, 0.5f, 0.5f, 0.5f));
+			})";
+
+			vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
+			psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
+		}
+
+		vsProgram.synchronize();
+		psProgram.synchronize();
+
+		ShaderPtr defaultShader = Shader::create("LitTexDefault");
+		defaultShader->setParamBlockAttribs("Static", true, GPBU_DYNAMIC, RBS_Static);
+		defaultShader->setParamBlockAttribs("PerFrame", true, GPBU_DYNAMIC, RBS_PerFrame);
+		defaultShader->setParamBlockAttribs("PerObject", true, GPBU_DYNAMIC, RBS_PerObject);
+
+		defaultShader->addParameter("lightDir", "lightDir", GPDT_FLOAT4, RPS_LightDir);
+		defaultShader->addParameter("time", "time", GPDT_FLOAT1, RPS_Time);
+		defaultShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4, RPS_WorldViewProjTfrm);
+
+		TechniquePtr newTechnique = defaultShader->addTechnique(rsName, RendererDefault);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		return defaultShader;
+	}
 }
 }

+ 3 - 3
ExampleProject/Main/Main.cpp

@@ -53,7 +53,7 @@ namespace BansheeEngine
 
 
 		if (fullscreen)
 		if (fullscreen)
 		{
 		{
-			gCoreAccessor().setWindowed(window);
+			gCoreAccessor().setWindowed(window, resolutionWidth, resolutionHeight);
 		}
 		}
 		else
 		else
 		{
 		{
@@ -105,7 +105,7 @@ namespace BansheeEngine
 		exampleShader->addParameter("samp", "samp", GPOT_SAMPLER2D);
 		exampleShader->addParameter("samp", "samp", GPOT_SAMPLER2D);
 		exampleShader->addParameter("tex", "tex", GPOT_TEXTURE2D);
 		exampleShader->addParameter("tex", "tex", GPOT_TEXTURE2D);
 
 
-		TechniquePtr technique = exampleShader->addTechnique("D3D11RenderSystem", "BansheeRenderer"); // TODO - This render system and forward renderer names should at least match the above names used for initialization
+		TechniquePtr technique = exampleShader->addTechnique(RenderSystemDX11, RendererDefault); // TODO - This render system and forward renderer names should at least match the above names used for initialization
 		PassPtr pass = technique->addPass();
 		PassPtr pass = technique->addPass();
 		pass->setVertexProgram(exampleVertexGPUProg);
 		pass->setVertexProgram(exampleVertexGPUProg);
 		pass->setFragmentProgram(exampleFragmentGPUProg);
 		pass->setFragmentProgram(exampleFragmentGPUProg);
@@ -193,7 +193,7 @@ int CALLBACK WinMain(
 	renderWindowDesc.title = "Banshee Example App";
 	renderWindowDesc.title = "Banshee Example App";
 	renderWindowDesc.fullscreen = false;
 	renderWindowDesc.fullscreen = false;
 
 
-	Application::startUp(renderWindowDesc, "BansheeD3D11RenderSystem", "BansheeRenderer"); // TODO - Use enums instead of names. BansheeApp is a high level system that doesn't need to be as customizable.
+	Application::startUp(renderWindowDesc, RenderSystemPlugin::DX11, RendererPlugin::Default);
 	setUpExample();
 	setUpExample();
 	
 	
 	Application::instance().runMainLoop();
 	Application::instance().runMainLoop();

+ 0 - 4
Renderer.txt

@@ -1,7 +1,3 @@
-Param matching missing:
- - Add default DX9/DX11/OpenGL shaders
-
------------------------------------------------------------
 NON TRIVIAL BUT SIMPLE
 NON TRIVIAL BUT SIMPLE
 
 
 Actually add frustum culling
 Actually add frustum culling