Преглед на файлове

Added some missing rasterizer states to OpenGL

Marko Pintera преди 11 години
родител
ревизия
77ca7f9a74
променени са 3 файла, в които са добавени 47 реда и са изтрити 13 реда
  1. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  2. 15 0
      BansheeGLRenderSystem/Include/BsGLRenderSystem.h
  3. 31 12
      BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -11,7 +11,7 @@ int CALLBACK WinMain(
 	_In_  int nCmdShow
 	_In_  int nCmdShow
 	)
 	)
 {
 {
-	EditorApplication::startUp(RenderSystemPlugin::DX9);
+	EditorApplication::startUp(RenderSystemPlugin::OpenGL);
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::shutDown();
 	EditorApplication::shutDown();
 
 

+ 15 - 0
BansheeGLRenderSystem/Include/BsGLRenderSystem.h

@@ -408,6 +408,21 @@ namespace BansheeEngine
 		 */
 		 */
 		void setScissorTestEnable(bool enable);
 		void setScissorTestEnable(bool enable);
 
 
+		/**
+		 * @brief	Enables or disables multisample antialiasing.
+		 */
+		void setMultisamplingEnable(bool enable);
+
+		/**
+		 * @brief	Enables or disables depth clipping (i.e. near/fear plane clipping).
+		 */
+		void setDepthClipEnable(bool enable);
+
+		/**
+		 * @brief	Enables or disables antialiased line rendering.
+		 */
+		void setAntialiasedLineEnable(bool enable);
+
 		/************************************************************************/
 		/************************************************************************/
 		/* 						Depth stencil state                      		*/
 		/* 						Depth stencil state                      		*/
 		/************************************************************************/
 		/************************************************************************/

+ 31 - 12
BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp

@@ -492,6 +492,12 @@ namespace BansheeEngine
 
 
 		setScissorTestEnable(rasterizerState->getScissorEnable());
 		setScissorTestEnable(rasterizerState->getScissorEnable());
 
 
+		setMultisamplingEnable(rasterizerState->getMultisampleEnable());
+
+		setDepthClipEnable(rasterizerState->getDepthClipEnable());
+
+		setAntialiasedLineEnable(rasterizerState->getAntialiasedLineEnable());
+
 		BS_INC_RENDER_STAT(NumRasterizerStateChanges);
 		BS_INC_RENDER_STAT(NumRasterizerStateChanges);
 	}
 	}
 
 
@@ -1035,6 +1041,31 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
+	void GLRenderSystem::setMultisamplingEnable(bool enable)
+	{
+		if (enable)
+			glEnable(GL_MULTISAMPLE);
+		else
+			glDisable(GL_MULTISAMPLE);
+	}
+
+	void GLRenderSystem::setDepthClipEnable(bool enable)
+	{
+		if (enable)
+			glEnable(GL_DEPTH_CLAMP);
+		else
+			glDisable(GL_DEPTH_CLAMP);
+	}
+
+	void GLRenderSystem::setAntialiasedLineEnable(bool enable)
+	{
+		if (enable)
+			glEnable(GL_LINE_SMOOTH);
+		else
+			glDisable(GL_LINE_SMOOTH);
+	}
+
+
 	void GLRenderSystem::setCullingMode(CullingMode mode)
 	void GLRenderSystem::setCullingMode(CullingMode mode)
 	{
 	{
 		mCullingMode = mode;
 		mCullingMode = mode;
@@ -1705,18 +1736,6 @@ namespace BansheeEngine
 			BS_EXCEPT(InternalErrorException, "Number of combined uniform block buffers less than the number of individual per-stage buffers!?");
 			BS_EXCEPT(InternalErrorException, "Number of combined uniform block buffers less than the number of individual per-stage buffers!?");
 
 
 		TextureManager::startUp<GLTextureManager>(std::ref(*mGLSupport));
 		TextureManager::startUp<GLTextureManager>(std::ref(*mGLSupport));
-
-		// Check for multisample support
-		// Enable the extension if it was enabled by the GLSupport
-		if (mGLSupport->checkExtension("GL_ARB_multisample"))
-		{
-			int multisampleActive = false;
-			glGetIntegerv(GL_SAMPLE_BUFFERS_ARB, (GLint*)&multisampleActive);
-			if (multisampleActive)
-			{
-				glEnable(GL_MULTISAMPLE_ARB);
-			}
-		}
 	}
 	}
 
 
 	void GLRenderSystem::switchContext(GLContext *context)
 	void GLRenderSystem::switchContext(GLContext *context)