Re-written flat render pipeline to support transforms
FlatRender now supports arbitrary transforms GLSL 1.40 is now used in shaders
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
uniform ivec2 maskStart;
|
||||
uniform ivec2 maskEnd;
|
||||
uniform int maskCount;
|
||||
|
||||
uniform vec2 masks[3 * 2 * 16];
|
||||
|
||||
bool isInMaskPrimitive(int primitive) {
|
||||
vec2 origin = masks[3 * primitive + 0];
|
||||
vec2 width = masks[3 * primitive + 1];
|
||||
vec2 height = masks[3 * primitive + 2];
|
||||
|
||||
vec2 current = gl_FragCoord.xy - origin;
|
||||
|
||||
mat2 matrix = mat2(width, height);
|
||||
vec2 relative = inverse(matrix) * current;
|
||||
|
||||
return relative.x >= 0 && relative.y >= 0 && relative.x + relative.y <= 1;
|
||||
}
|
||||
|
||||
void applyMask() {
|
||||
if (
|
||||
gl_FragCoord.x < maskStart.x || gl_FragCoord.x >= maskEnd.x ||
|
||||
gl_FragCoord.y < maskStart.y || gl_FragCoord.y >= maskEnd.y
|
||||
) {
|
||||
discard;
|
||||
for (int i = 0; i < maskCount; ++i) {
|
||||
if (!(isInMaskPrimitive(2 * i + 0) || isInMaskPrimitive(2 * i + 1))) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
void flatTransferToFragment() {
|
||||
shapeTransferToFragment();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
void main(void) {
|
||||
applyTexture();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
void main(void) {
|
||||
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
varying vec3 varyingColorMultiplier;
|
||||
varying vec2 varyingTextureCoords;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
attribute vec3 inputPositions;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
varying vec3 varyingNormals;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
attribute vec3 inputNormals;
|
||||
varying vec3 varyingNormals;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
void main(void) {
|
||||
applyTexture();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 120
|
||||
#version 140
|
||||
|
||||
void main(void) {
|
||||
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
|
||||
|
BIN
src/main/resources/assets/textures/compass_icon.png
Normal file
BIN
src/main/resources/assets/textures/compass_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/resources/assets/textures/compass_icon_arrow.png
Normal file
BIN
src/main/resources/assets/textures/compass_icon_arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 236 B |
Reference in New Issue
Block a user