Initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
in vec4 Color;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color;
|
||||
}
|
||||
11
engines/wintermute/base/gfx/opengl/shaders/wme_fade.vertex
Normal file
11
engines/wintermute/base/gfx/opengl/shaders/wme_fade.vertex
Normal file
@@ -0,0 +1,11 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform highp mat4 projMatrix;
|
||||
uniform vec4 color;
|
||||
|
||||
out vec4 Color;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * vec4(position, 1.0);
|
||||
Color = color;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
uniform vec4 shadowColor;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = shadowColor;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform highp mat4 modelMatrix;
|
||||
uniform highp mat4 viewMatrix;
|
||||
uniform highp mat4 projMatrix;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
in vec4 Color;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
in vec3 position;
|
||||
in vec4 color;
|
||||
|
||||
uniform highp mat4 viewMatrix;
|
||||
uniform highp mat4 projMatrix;
|
||||
|
||||
out vec4 Color;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * viewMatrix * vec4(position, 1.0);
|
||||
Color = color;
|
||||
}
|
||||
14
engines/wintermute/base/gfx/opengl/shaders/wme_line.fragment
Normal file
14
engines/wintermute/base/gfx/opengl/shaders/wme_line.fragment
Normal file
@@ -0,0 +1,14 @@
|
||||
in vec4 Color;
|
||||
|
||||
uniform float alphaRef;
|
||||
uniform UBOOL alphaTest;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color;
|
||||
|
||||
if (UBOOL_TEST(alphaTest) && outColor.a < alphaRef) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
11
engines/wintermute/base/gfx/opengl/shaders/wme_line.vertex
Normal file
11
engines/wintermute/base/gfx/opengl/shaders/wme_line.vertex
Normal file
@@ -0,0 +1,11 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform highp mat4 projMatrix;
|
||||
uniform vec4 color;
|
||||
|
||||
out vec4 Color;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * vec4(position, 1.0);
|
||||
Color = color;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float alphaRef;
|
||||
uniform UBOOL alphaTest;
|
||||
uniform UBOOL useTexture;
|
||||
uniform UBOOL enableFog;
|
||||
uniform vec4 fogColor;
|
||||
|
||||
varying float fogFactor;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color;
|
||||
|
||||
if (useTexture) {
|
||||
outColor = texture(tex, Texcoord) * outColor;
|
||||
}
|
||||
|
||||
if (enableFog) {
|
||||
outColor.rgb = mix(fogColor.rgb, outColor.rgb, fogFactor);
|
||||
}
|
||||
|
||||
if (UBOOL_TEST(alphaTest) && outColor.a < alphaRef) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
78
engines/wintermute/base/gfx/opengl/shaders/wme_modelx.vertex
Normal file
78
engines/wintermute/base/gfx/opengl/shaders/wme_modelx.vertex
Normal file
@@ -0,0 +1,78 @@
|
||||
in vec3 position;
|
||||
in vec2 texcoord;
|
||||
in vec3 normal;
|
||||
|
||||
uniform highp mat4 modelMatrix;
|
||||
uniform highp mat4 viewMatrix;
|
||||
uniform highp mat4 projMatrix;
|
||||
uniform highp mat4 normalMatrix;
|
||||
|
||||
uniform vec4 ambientLight;
|
||||
uniform vec4 diffuse;
|
||||
uniform vec4 ambient;
|
||||
|
||||
uniform float fogStart;
|
||||
uniform float fogEnd;
|
||||
varying float fogFactor;
|
||||
|
||||
struct Light {
|
||||
vec4 _position;
|
||||
vec4 _direction;
|
||||
vec4 _color;
|
||||
float enabled;
|
||||
};
|
||||
|
||||
const int maxLights = 8;
|
||||
uniform Light lights[maxLights];
|
||||
|
||||
out vec2 Texcoord;
|
||||
out vec4 Color;
|
||||
out vec3 Normal;
|
||||
|
||||
void main() {
|
||||
vec4 viewCoords = viewMatrix * modelMatrix * vec4(position, 1.0);
|
||||
gl_Position = projMatrix * viewCoords;
|
||||
|
||||
Texcoord = texcoord;
|
||||
Color = diffuse;
|
||||
|
||||
vec3 light = vec3(0.0, 0.0, 0.0);
|
||||
vec3 normalEye = normalize((normalMatrix * vec4(normal, 0.0)).xyz);
|
||||
|
||||
float fogCoord = abs(viewCoords.z);
|
||||
fogFactor = clamp((fogEnd - fogCoord) / (fogEnd - fogStart), 0.0, 1.0);
|
||||
|
||||
for (int i = 0; i < maxLights; ++i) {
|
||||
if (lights[i].enabled < 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float intensity = 1.0;
|
||||
vec4 lightPosition = viewMatrix * lights[i]._position;
|
||||
vec3 vertexToLight = lightPosition.xyz - viewCoords.xyz;
|
||||
|
||||
if (lights[i]._direction.w < 0.0) { // Spotlight
|
||||
vec4 lightDirection = viewMatrix * vec4(lights[i]._direction.xyz, 0.0);
|
||||
// See DirectX spotlight documentation
|
||||
float cosAngle = -dot(normalize(vertexToLight), normalize(lightDirection.xyz)); // rho
|
||||
float cosPenumbra = 0.968912; // cos(1 / 4)
|
||||
float cosUmbra = 0.877582; // cos(1 / 2)
|
||||
|
||||
if (cosAngle <= cosPenumbra) {
|
||||
if (cosAngle < cosUmbra || cosPenumbra == cosUmbra) {
|
||||
intensity = 0.0;
|
||||
} else {
|
||||
intensity *= (cosAngle - cosUmbra) / (cosPenumbra - cosUmbra);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
intensity *= max(0.0, dot(normalEye, normalize(vertexToLight)));
|
||||
light += lights[i]._color.rgb * intensity;
|
||||
}
|
||||
|
||||
Color.rgb *= light;
|
||||
Color.rgb += ambient.rgb * ambientLight.rgb;
|
||||
|
||||
Color.rgb = clamp(Color.rgb, 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
varying vec2 texPos;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform UBOOL sepiaMode;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texPos);
|
||||
if (sepiaMode) {
|
||||
float r = color.r;
|
||||
float g = color.g;
|
||||
float b = color.b;
|
||||
outColor.r = dot(vec3(r, g, b), vec3(0.393, 0.769, 0.189));
|
||||
outColor.g = dot(vec3(r, g, b), vec3(0.349, 0.686, 0.168));
|
||||
outColor.b = dot(vec3(r, g, b), vec3(0.272, 0.534, 0.131));
|
||||
} else {
|
||||
float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114));
|
||||
outColor = vec4(vec3(gray), 1.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
in vec2 position;
|
||||
in vec2 texcoord;
|
||||
|
||||
varying vec2 texPos;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(position, 0.0, 1.0);
|
||||
texPos = texcoord;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
in vec4 Color;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform highp mat4 projMatrix;
|
||||
uniform vec4 color;
|
||||
|
||||
out vec4 Color;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * vec4(position, 1.0);
|
||||
Color = color;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
void main() {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform highp mat4 modelMatrix;
|
||||
uniform highp mat4 viewMatrix;
|
||||
uniform highp mat4 projMatrix;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
in vec2 Texcoord;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float alphaRef;
|
||||
uniform UBOOL alphaTest;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = texture(tex, Texcoord);
|
||||
|
||||
if (UBOOL_TEST(alphaTest) && outColor.a < alphaRef) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
in vec3 position;
|
||||
in vec3 normal;
|
||||
in vec2 texcoord;
|
||||
|
||||
out vec2 Texcoord;
|
||||
|
||||
uniform highp mat4 modelMatrix;
|
||||
uniform highp mat4 viewMatrix;
|
||||
uniform highp mat4 projMatrix;
|
||||
|
||||
void main() {
|
||||
gl_Position = projMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
|
||||
Texcoord = texcoord;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float alphaRef;
|
||||
uniform UBOOL alphaTest;
|
||||
|
||||
OUTPUT
|
||||
|
||||
void main() {
|
||||
outColor = Color * texture(tex, Texcoord);
|
||||
|
||||
if (UBOOL_TEST(alphaTest) && outColor.a < alphaRef) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
16
engines/wintermute/base/gfx/opengl/shaders/wme_sprite.vertex
Normal file
16
engines/wintermute/base/gfx/opengl/shaders/wme_sprite.vertex
Normal file
@@ -0,0 +1,16 @@
|
||||
in vec3 position;
|
||||
in vec2 texcoord;
|
||||
in vec4 color;
|
||||
|
||||
uniform highp mat4 projMatrix;
|
||||
uniform highp mat3 transform;
|
||||
|
||||
out vec2 Texcoord;
|
||||
out vec4 Color;
|
||||
|
||||
void main() {
|
||||
vec3 transformed_position = transform * vec3(position);
|
||||
gl_Position = projMatrix * vec4(transformed_position.x, transformed_position.y, transformed_position.z, 1.0);
|
||||
Texcoord = texcoord;
|
||||
Color = color;
|
||||
}
|
||||
Reference in New Issue
Block a user