Panagiotis Christopoulos Charitos 14 年 前
コミット
e03945e70b

+ 33 - 0
shaders/Ui.glsl

@@ -0,0 +1,33 @@
+#pragma anki vertShaderBegins
+
+in vec2 position;
+in vec2 texCoords;
+
+uniform mat2 tranformation; ///< Position transformation
+uniform mat2 textureTranformation; ///< Texture transformation
+
+out vec2 vTexCoords;
+
+
+void main(void)
+{
+	vTexCoords = textureTranformation * texCoords;
+	gl_Position = vec4(tranformation * position, 0.0, 1.0);
+}
+
+#pragma anki fragShaderBegins
+
+in vec2 vTexCoords;
+
+uniform sampler2D texture;
+uniform vec4 color;
+
+layout(location = 0) out vec4 fColor;
+
+
+void main()
+{
+	vec4 texCol = texture2D(texture, vTexCoords).rgba * color;
+
+	fColor = texCol;
+}

+ 0 - 24
shaders/txt.glsl

@@ -1,24 +0,0 @@
-#pragma anki vertShaderBegins
-
-varying vec2 texCoords;
-
-void main(void)
-{
-	texCoords = gl_MultiTexCoord0.xy;
-	gl_FrontColor = gl_Color;
-	gl_Position = ftransform();
-}
-
-#pragma anki fragShaderBegins
-
-uniform sampler2D fontMap;
-varying vec2 texCoords;
-
-void main()
-{
-	vec2 texCol = texture2D( fontMap, texCoords ).ra; // get only one value and the alpha
-
-	if( texCol.y == 0.0 ) discard;
-
-	gl_FragColor = vec4(texCol.x) * gl_Color;
-}

+ 1 - 0
src/Renderer/GlStateMachine.cpp

@@ -61,5 +61,6 @@ void GlStateMachine::sync()
 	while(*flagEnum != 0)
 	{
 		flags[*flagEnum] = glIsEnabled(*flagEnum);
+		++flagEnum;
 	}
 }

+ 5 - 0
src/Renderer/Hdr.cpp

@@ -84,6 +84,11 @@ void Hdr::init(const RendererInitializer& initializer)
 //======================================================================================================================
 void Hdr::run()
 {
+	/*if(r.getFramesNum() % 2 == 0)
+	{
+		return;
+	}*/
+
 	int w = renderingQuality * r.getWidth();
 	int h = renderingQuality * r.getHeight();
 	Renderer::setViewport(0, 0, w, h);

+ 1 - 1
src/Renderer/Is.cpp

@@ -305,7 +305,7 @@ void Is::run()
 	Renderer::setViewport(0, 0, r.getWidth(), r.getHeight());
 
 	// Copy
-	if(r.getFramesNum() % 2)
+	if(r.getFramesNum() % 2 == 0)
 	{
 		copyDepth();
 	}

+ 1 - 1
src/Renderer/Is.h

@@ -59,7 +59,7 @@ class Is: private RenderingPass
 		/// Init the copy stuff
 		void initCopy();
 
-		///
+		/// Copy the MS depth FAI to one of our own
 		void copyDepth();
 };
 

+ 5 - 0
src/Renderer/Ssao.cpp

@@ -94,6 +94,11 @@ void Ssao::init(const RendererInitializer& initializer)
 //======================================================================================================================
 void Ssao::run()
 {
+	if(!enabled)
+	{
+		return;
+	}
+
 	int width = renderingQuality * r.getWidth();
 	int height = renderingQuality * r.getHeight();
 	const Camera& cam = r.getCamera();

+ 25 - 1
src/Ui/Ui.h

@@ -2,6 +2,7 @@
 #define UI_H
 
 
+/*
 namespace M {
 	class Vec4;
 }
@@ -17,5 +18,28 @@ extern void printf(const char* format, ...);
 extern void print(const char* str);
 
 
-} // end namespace
+} // end namespace */
+
+#include "RsrcPtr.h"
+#include "Math.h"
+
+
+class Ui
+{
+	public:
+		Ui();
+
+		void setSize(float width, float height = -1.0);
+		void setPos(const Vec2& pos);
+		void setColor(const Vec4& col);
+		void printf(const char* format, ...);
+
+	private:
+		RsrcPtr<Texture> fontMap;
+		uint charsVertical;
+		uint charsHorizontal;
+		RsrcPtr<ShaderProg> sProg;
+};
+
+
 #endif