Added GUI render and support for faces without textures
- Added FlatRenderProgram to render 2D graphics - Can be used as-is - Supports rectangular coordinate-aligned nested masks - Added AssembledFlatLayer to cache 2D graphics - Use RenderTarget for add elements during reassembly - ShapeRenderProgram now allows null textures (defaults to white BG) - Sprite now deduces size based on primitive's content size - unless given size explicitly - ShapeRenderHelper.*WorldTransform methods renamed to .*Transform
This commit is contained in:
13
src/main/resources/assets/shaders/Flat.fragment.glsl
Normal file
13
src/main/resources/assets/shaders/Flat.fragment.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 120
|
||||
|
||||
uniform ivec2 maskStart;
|
||||
uniform ivec2 maskEnd;
|
||||
|
||||
void applyMask() {
|
||||
if (
|
||||
gl_FragCoord.x < maskStart.x || gl_FragCoord.x >= maskEnd.x ||
|
||||
gl_FragCoord.y < maskStart.y || gl_FragCoord.y >= maskEnd.y
|
||||
) {
|
||||
discard;
|
||||
}
|
||||
}
|
5
src/main/resources/assets/shaders/Flat.vertex.glsl
Normal file
5
src/main/resources/assets/shaders/Flat.vertex.glsl
Normal file
@@ -0,0 +1,5 @@
|
||||
#version 120
|
||||
|
||||
void flatTransferToFragment() {
|
||||
shapeTransferToFragment();
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
#version 120
|
||||
|
||||
void main(void) {
|
||||
applyTexture();
|
||||
applyColorMultiplier();
|
||||
applyAlpha();
|
||||
applyMask();
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
#version 120
|
||||
|
||||
void main(void) {
|
||||
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
|
||||
flatTransferToFragment();
|
||||
}
|
@@ -7,14 +7,20 @@ uniform sampler2D textureSlot;
|
||||
uniform vec2 textureStart;
|
||||
uniform vec2 textureSize;
|
||||
|
||||
uniform bool useTexture;
|
||||
|
||||
void applyTexture() {
|
||||
gl_FragColor = texture2D(
|
||||
textureSlot,
|
||||
vec2(
|
||||
varyingTextureCoords[0] * textureSize[0] + textureStart[0],
|
||||
varyingTextureCoords[1] * textureSize[1] + textureStart[1]
|
||||
)
|
||||
);
|
||||
if (!useTexture) {
|
||||
gl_FragColor = vec4(1, 1, 1, 1);
|
||||
} else {
|
||||
gl_FragColor = texture2D(
|
||||
textureSlot,
|
||||
vec2(
|
||||
varyingTextureCoords[0] * textureSize[0] + textureStart[0],
|
||||
varyingTextureCoords[1] * textureSize[1] + textureStart[1]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void multiply(inout vec4 vector, float scalar) {
|
||||
|
BIN
src/main/resources/assets/textures/windcorp.png
Normal file
BIN
src/main/resources/assets/textures/windcorp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Reference in New Issue
Block a user