/******************************************************************************
*	File		-	DefaultShaders.h
*	Author		-	Joey Pollack
*	Date		-	2018/01/12 (y/m/d)
*	Mod Date	-	2018/01/12 (y/m/d)
*	Description	-	String definitions with default shader source code.
*
******************************************************************************/

#ifndef DEFAULT_SHADERS_H_
#define DEFAULT_SHADERS_H_

namespace lunarium
{
	struct
	{
		friend class Renderer2D;
		friend class glText;
	private:
		const char* DefaultShapeVertex = "#version 450 core\n\
			layout(location = 0) in vec3 pos;\
			layout(location = 1) in vec2 tex_coords;\
			layout(location = 2) in vec4 color;\
			layout(location = 3) in int tex_slot;\
	\
			struct VertexOutput\
			{\
				vec4 Color;\
				vec2 TexCoord;\
			};\
			out int TexSlot;\
			layout (location = 0) out VertexOutput Output;\
			\
			uniform mat4 model;\
			uniform mat4 projview;\
				\
			void main()\
			{\
				Output.Color = color;\
				TexSlot = tex_slot;\
				Output.TexCoord = tex_coords;\
				gl_Position = projview * model * vec4(pos.xy, 0.0, 1.0);\
			}";

		const char* DefaultShapeFragment = "#version 450 core\n\
			struct VertexOutput\
			{\
				vec4 Color;\
				vec2 TexCoord;\
			};\
\
			flat in int TexSlot;\
			\
			layout (location = 0) in VertexOutput Input;\
			out vec4 color;\
	\
	\
			layout (binding = 0) uniform sampler2D u_Textures[32];\
			void main()\
			{\
				color = Input.Color;\
			}";
				//color = texture(u_Textures[TexSlot], Input.TexCoord) * Input.Color;\

		const char* DefaultSpriteVertex = "#version 450 core\n\
			layout(location = 0) in vec4 vertex;\
	\
			out vec2 TexCoords;\
	\
			uniform vec4 uvManip;\
			uniform mat4 model;\
			uniform mat4 projection;\
				\
			void main()\
			{\
				TexCoords = vec2(vertex.z * uvManip.x + uvManip.y, vertex.w * uvManip.z - uvManip.w);\
				gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);\
			}";

		const char* DefaultSpriteFragment = "#version 450 core\n\
			in vec2 TexCoords;\
			out vec4 color;\
	\
			uniform sampler2D image;\
			uniform vec4 spriteColor;\
	\
			void main()\
			{\
				color = vec4(spriteColor) * texture(image, TexCoords);\
			}";



	} OGLDefaultShaders;
}

#endif	// DEFAULT_SHADERS_H_