You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
|
4 years ago
|
/******************************************************************************
|
||
|
|
* 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 OglGraphics;
|
||
|
4 years ago
|
friend class glText;
|
||
|
4 years ago
|
private:
|
||
|
|
const char* DefaultShapeVertex = "#version 330 core\n\
|
||
|
|
layout(location = 0) in vec4 vertex;\
|
||
|
|
\
|
||
|
|
uniform mat4 model;\
|
||
|
|
uniform mat4 projection;\
|
||
|
|
\
|
||
|
|
void main()\
|
||
|
|
{\
|
||
|
|
gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\
|
||
|
|
}";
|
||
|
|
|
||
|
|
const char* DefaultShapeFragment = "#version 330 core\n\
|
||
|
|
in vec2 TexCoords;\
|
||
|
|
out vec4 color;\
|
||
|
|
\
|
||
|
|
uniform vec4 shapeColor;\
|
||
|
|
\
|
||
|
|
void main()\
|
||
|
|
{\
|
||
|
|
color = shapeColor;\
|
||
|
|
}";
|
||
|
|
|
||
|
|
const char* DefaultSpriteVertex = "#version 330 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 330 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_
|