Initial commit

This commit is contained in:
2020-07-29 12:30:34 +03:00
commit e96a30c275
108 changed files with 7929 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#version 120
varying vec3 varyingColorMultiplier;
varying vec2 varyingTextureCoords;
varying vec3 varyingNormals;
uniform sampler2D textureSlot;
uniform vec2 textureStart;
uniform vec2 textureSize;
void applyTexture() {
gl_FragColor = texture2D(
textureSlot,
vec2(
varyingTextureCoords[0] * textureSize[0] + textureStart[0],
varyingTextureCoords[1] * textureSize[1] + textureStart[1]
)
);
}
void multiply(inout vec4 vector, float scalar) {
vector.x *= scalar;
vector.y *= scalar;
vector.z *= scalar;
vector.w *= scalar;
}
void linearMultiply(inout vec4 vector, vec4 scalars) {
vector.x *= scalars.x;
vector.y *= scalars.y;
vector.z *= scalars.z;
vector.w *= scalars.w;
}
void applyColorMultiplier() {
linearMultiply(gl_FragColor, vec4(varyingColorMultiplier, 1.0));
}
void applyShading() {
vec3 light = normalize(vec3(0.5, 1.0, 0.2));
vec3 normal = varyingNormals;
float angleCos = dot(normal, light);
float lightness = (angleCos + 1.5) / 2;
linearMultiply(gl_FragColor, vec4(lightness.xxx, 1.0));
}
void applyAlpha() {
if (gl_FragColor.w < 0.01) {
discard;
}
}

View File

@@ -0,0 +1,27 @@
#version 120
attribute vec3 inputPositions;
attribute vec3 inputColorMultiplier;
varying vec3 varyingColorMultiplier;
attribute vec2 inputTextureCoords;
varying vec2 varyingTextureCoords;
attribute vec3 inputNormals;
varying vec3 varyingNormals;
uniform mat4 worldTransform;
uniform mat4 finalTransform;
vec4 applyFinalTransform(vec4 vector) {
return finalTransform * vector;
}
void transferToFragment() {
varyingColorMultiplier = inputColorMultiplier;
varyingTextureCoords = inputTextureCoords;
mat3 worldRotation = mat3(worldTransform);
varyingNormals = normalize(worldRotation * inputNormals);
}

View File

@@ -0,0 +1,8 @@
#version 120
void main(void) {
applyTexture();
applyColorMultiplier();
applyShading();
applyAlpha();
}

View File

@@ -0,0 +1,6 @@
#version 120
void main(void) {
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
transferToFragment();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB