Initial commit
This commit is contained in:
9
engines/freescape/shaders/freescape_bitmap.fragment
Normal file
9
engines/freescape/shaders/freescape_bitmap.fragment
Normal file
@@ -0,0 +1,9 @@
|
||||
in vec2 Texcoord;
|
||||
|
||||
OUTPUT
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
void main() {
|
||||
outColor = texture(tex, Texcoord);
|
||||
}
|
||||
21
engines/freescape/shaders/freescape_bitmap.vertex
Normal file
21
engines/freescape/shaders/freescape_bitmap.vertex
Normal file
@@ -0,0 +1,21 @@
|
||||
in vec2 position;
|
||||
in vec2 texcoord;
|
||||
|
||||
uniform UBOOL flipY;
|
||||
|
||||
out vec2 Texcoord;
|
||||
|
||||
void main() {
|
||||
Texcoord = texcoord;
|
||||
|
||||
vec2 pos = position;
|
||||
// Coordinates are [0.0;1.0], transform to [-1.0; 1.0]
|
||||
pos.x = pos.x * 2.0 - 1.0;
|
||||
pos.y = -1.0 * (pos.y * 2.0 - 1.0);
|
||||
|
||||
if (UBOOL_TEST(flipY)) {
|
||||
pos.y *= -1.0;
|
||||
}
|
||||
|
||||
gl_Position = vec4(pos, 0.0, 1.0);
|
||||
}
|
||||
10
engines/freescape/shaders/freescape_cubemap.fragment
Normal file
10
engines/freescape/shaders/freescape_cubemap.fragment
Normal file
@@ -0,0 +1,10 @@
|
||||
in vec2 TexCoord;
|
||||
|
||||
OUTPUT
|
||||
|
||||
uniform sampler2D skyTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = texture(skyTexture, TexCoord);
|
||||
}
|
||||
11
engines/freescape/shaders/freescape_cubemap.vertex
Normal file
11
engines/freescape/shaders/freescape_cubemap.vertex
Normal file
@@ -0,0 +1,11 @@
|
||||
in vec3 position;
|
||||
in vec2 texcoord;
|
||||
|
||||
uniform mat4 mvpMatrix;
|
||||
out vec2 TexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
TexCoord = texcoord;
|
||||
gl_Position = mvpMatrix * vec4(position, 1.0);
|
||||
}
|
||||
42
engines/freescape/shaders/freescape_triangle.fragment
Normal file
42
engines/freescape/shaders/freescape_triangle.fragment
Normal file
@@ -0,0 +1,42 @@
|
||||
OUTPUT
|
||||
|
||||
uniform UBOOL useStipple;
|
||||
uniform int stipple[128];
|
||||
|
||||
varying vec4 var_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (UBOOL_TEST(useStipple)) {
|
||||
// Calculate the 32x32 pattern coordinates
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
|
||||
// Calculate the byte position and bit position within that byte
|
||||
int x = int(mod(float(coord.x), 32.));
|
||||
int y = int(mod(float(coord.y), 32.));
|
||||
|
||||
// Each row in the 32x32 pattern is represented by 4 bytes (4 * 8 bits = 32 bits)
|
||||
int byteIndex = y * 4 + (x / 8);
|
||||
int bitIndex = int(mod(float(x), 8.));
|
||||
|
||||
// Get the stipple pattern byte
|
||||
int patternByte = 0;
|
||||
for (int i = 0; i < 128; i++) {
|
||||
if (i == byteIndex) {
|
||||
patternByte = stipple[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (i >= 7 - bitIndex)
|
||||
break;
|
||||
patternByte = patternByte / 2;
|
||||
}
|
||||
|
||||
if (int(mod(float(patternByte), 2.)) == 0)
|
||||
discard;
|
||||
}
|
||||
|
||||
outColor = var_color;
|
||||
}
|
||||
12
engines/freescape/shaders/freescape_triangle.vertex
Normal file
12
engines/freescape/shaders/freescape_triangle.vertex
Normal file
@@ -0,0 +1,12 @@
|
||||
in vec3 position;
|
||||
|
||||
uniform mat4 mvpMatrix;
|
||||
uniform vec3 color;
|
||||
|
||||
varying vec4 var_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
var_color = vec4(color, 1.0);
|
||||
gl_Position = mvpMatrix * vec4(position, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user