-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1aa0c83
commit 8ea4309
Showing
11 changed files
with
213 additions
and
109 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
src/main/resources/assets/darkkore/shaders/core/darkkore_chroma.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
#version 150 | ||
|
||
in vec4 vertexColor; | ||
|
||
out vec4 fragColor; | ||
uniform float GameTime; | ||
|
||
void main() { | ||
vec4 color = vertexColor; | ||
if (color.a == 0.0) { | ||
discard; | ||
} | ||
fragColor = color; | ||
} | ||
47 changes: 0 additions & 47 deletions
47
src/main/resources/assets/darkkore/shaders/core/darkkore_chroma.vsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +0,0 @@ | ||
#version 150 | ||
|
||
in vec3 Position; | ||
in vec4 Color; | ||
in vec2 UV0; | ||
in ivec2 UV2; | ||
|
||
uniform mat4 ModelViewMat; | ||
uniform mat4 ProjMat; | ||
uniform float GameTime; | ||
uniform vec4 ColorModulator; | ||
|
||
out vec4 vertexColor; | ||
|
||
void main() { | ||
vec4 vertex = vec4(Position, 1.0); | ||
|
||
gl_Position = ProjMat * ModelViewMat * vertex; | ||
float dist = gl_Position.x + gl_Position.y; | ||
float size = 50 * (1 - ColorModulator[0]); | ||
float speed = 5000 * ColorModulator[1]; | ||
float saturation = ColorModulator[2]; | ||
|
||
if (size <= 0) { | ||
// Solid color | ||
dist = 0; | ||
} | ||
|
||
dist = dist * size; | ||
|
||
vec4 colorInbetween = ( | ||
(.6 + .6 * cos((dist + GameTime * speed) + vec4(0, 23, 21, 0))) | ||
); | ||
|
||
if (saturation < 1) { | ||
float gray = colorInbetween[0] * 0.299 + colorInbetween[1] * 0.587 + colorInbetween[2] * 0.114; | ||
if (saturation > 0) { | ||
colorInbetween[0] = (gray * (1 - saturation)) + (colorInbetween[0] * saturation); | ||
colorInbetween[1] = (gray * (1 - saturation)) + (colorInbetween[1] * saturation); | ||
colorInbetween[2] = (gray * (1 - saturation)) + (colorInbetween[2] * saturation); | ||
} else { | ||
colorInbetween = vec4(gray, gray, gray, 1); | ||
} | ||
} | ||
colorInbetween[3] = ColorModulator[3]; | ||
vertexColor = colorInbetween; | ||
} | ||
26 changes: 0 additions & 26 deletions
26
src/main/resources/assets/darkkore/shaders/core/darkkore_circle.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +0,0 @@ | ||
#version 150 | ||
|
||
in vec4 vertexColor; | ||
in vec2 texCoord0; | ||
in float innerRad; | ||
|
||
out vec4 fragColor; | ||
|
||
void main() { | ||
vec4 color = vertexColor; | ||
float x = (texCoord0.x - .5) * 2; | ||
float y = (texCoord0.y - .5) * 2; | ||
float calc = x * x + y * y; | ||
|
||
if (calc > 1 || calc < innerRad) { | ||
discard; | ||
} | ||
|
||
float d = length(vec2(x, y)); | ||
float wd = d * .02; // <=> float wd = fwidth(d); | ||
float circle = smoothstep(1 + wd, 1 - wd, d); | ||
if (circle > .99 && innerRad > 0 && d - innerRad < .3) { | ||
circle = smoothstep(1 - .3, 1, d / innerRad); | ||
} | ||
fragColor = vec4(vertexColor.rgb, vertexColor.a * circle); | ||
} | ||
21 changes: 0 additions & 21 deletions
21
src/main/resources/assets/darkkore/shaders/core/darkkore_circle.vsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +0,0 @@ | ||
#version 150 | ||
|
||
in vec3 Position; | ||
in vec4 UV0; | ||
in vec4 Color; | ||
|
||
uniform mat4 ModelViewMat; | ||
uniform mat4 ProjMat; | ||
uniform vec4 ColorModulator; | ||
|
||
out vec4 vertexColor; | ||
out vec2 texCoord0; | ||
out float innerRad; | ||
|
||
void main() { | ||
vec4 vertex = vec4(Position, 1.0); | ||
gl_Position = ProjMat * ModelViewMat * vertex; | ||
innerRad = ColorModulator[0]; | ||
vertexColor = UV0; | ||
texCoord0 = Color.xy; | ||
} | ||
14 changes: 14 additions & 0 deletions
14
src/main/resources/assets/minecraft/shaders/core/darkkore_chroma.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#version 150 | ||
|
||
in vec4 vertexColor; | ||
|
||
out vec4 fragColor; | ||
uniform float GameTime; | ||
|
||
void main() { | ||
vec4 color = vertexColor; | ||
if (color.a == 0.0) { | ||
discard; | ||
} | ||
fragColor = color; | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/resources/assets/minecraft/shaders/core/darkkore_chroma.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"blend": { | ||
"func": "add", | ||
"srcrgb": "srcalpha", | ||
"dstrgb": "1-srcalpha" | ||
}, | ||
"vertex": "darkkore_chroma", | ||
"fragment": "darkkore_chroma", | ||
"attributes": [ | ||
"Position", | ||
"Color", | ||
"UV0", | ||
"UV2" | ||
], | ||
"samplers": [ | ||
], | ||
"uniforms": [ | ||
{ | ||
"name": "ModelViewMat", | ||
"type": "matrix4x4", | ||
"count": 16, | ||
"values": [ | ||
1.0, 0.0, 0.0, 0.0, | ||
0.0, 1.0, 0.0, 0.0, | ||
0.0, 0.0, 1.0, 0.0, | ||
0.0, 0.0, 0.0, 1.0 | ||
] | ||
}, | ||
{ | ||
"name": "ProjMat", | ||
"type": "matrix4x4", | ||
"count": 16, | ||
"values": [ | ||
1.0, 0.0, 0.0, 0.0, | ||
0.0, 1.0, 0.0, 0.0, | ||
0.0, 0.0, 1.0, 0.0, | ||
0.0, 0.0, 0.0, 1.0 | ||
] | ||
}, | ||
{ | ||
"name": "ColorModulator", | ||
"type": "float", | ||
"count": 4, | ||
"values": [ | ||
1.0, 1.0, 1.0, 1.0 | ||
] | ||
}, | ||
{ | ||
"name": "GameTime", | ||
"type": "float", | ||
"count": 1, | ||
"values": [ | ||
0 | ||
] | ||
} | ||
] | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/resources/assets/minecraft/shaders/core/darkkore_chroma.vsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#version 150 | ||
|
||
in vec3 Position; | ||
in vec4 Color; | ||
in vec2 UV0; | ||
in ivec2 UV2; | ||
|
||
uniform mat4 ModelViewMat; | ||
uniform mat4 ProjMat; | ||
uniform float GameTime; | ||
uniform vec4 ColorModulator; | ||
|
||
out vec4 vertexColor; | ||
|
||
void main() { | ||
vec4 vertex = vec4(Position, 1.0); | ||
|
||
gl_Position = ProjMat * ModelViewMat * vertex; | ||
float dist = gl_Position.x + gl_Position.y; | ||
float size = 50 * (1 - ColorModulator[0]); | ||
float speed = 5000 * ColorModulator[1]; | ||
float saturation = ColorModulator[2]; | ||
|
||
if (size <= 0) { | ||
// Solid color | ||
dist = 0; | ||
} | ||
|
||
dist = dist * size; | ||
|
||
vec4 colorInbetween = ( | ||
(.6 + .6 * cos((dist + GameTime * speed) + vec4(0, 23, 21, 0))) | ||
); | ||
|
||
if (saturation < 1) { | ||
float gray = colorInbetween[0] * 0.299 + colorInbetween[1] * 0.587 + colorInbetween[2] * 0.114; | ||
if (saturation > 0) { | ||
colorInbetween[0] = (gray * (1 - saturation)) + (colorInbetween[0] * saturation); | ||
colorInbetween[1] = (gray * (1 - saturation)) + (colorInbetween[1] * saturation); | ||
colorInbetween[2] = (gray * (1 - saturation)) + (colorInbetween[2] * saturation); | ||
} else { | ||
colorInbetween = vec4(gray, gray, gray, 1); | ||
} | ||
} | ||
colorInbetween[3] = ColorModulator[3]; | ||
vertexColor = colorInbetween; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/resources/assets/minecraft/shaders/core/darkkore_circle.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#version 150 | ||
|
||
in vec4 vertexColor; | ||
in vec2 texCoord0; | ||
in float innerRad; | ||
|
||
out vec4 fragColor; | ||
|
||
void main() { | ||
vec4 color = vertexColor; | ||
float x = (texCoord0.x - .5) * 2; | ||
float y = (texCoord0.y - .5) * 2; | ||
float calc = x * x + y * y; | ||
|
||
if (calc > 1 || calc < innerRad) { | ||
discard; | ||
} | ||
|
||
float d = length(vec2(x, y)); | ||
float wd = d * .02; // <=> float wd = fwidth(d); | ||
float circle = smoothstep(1 + wd, 1 - wd, d); | ||
if (circle > .99 && innerRad > 0 && d - innerRad < .3) { | ||
circle = smoothstep(1 - .3, 1, d / innerRad); | ||
} | ||
fragColor = vec4(vertexColor.rgb, vertexColor.a * circle); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/resources/assets/minecraft/shaders/core/darkkore_circle.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"blend": { | ||
"func": "add", | ||
"srcrgb": "srcalpha", | ||
"dstrgb": "1-srcalpha" | ||
}, | ||
"vertex": "darkkore_circle", | ||
"fragment": "darkkore_circle", | ||
"attributes": [ | ||
"Position", | ||
"UV0", | ||
"Color" | ||
], | ||
"samplers": [ | ||
], | ||
"uniforms": [ | ||
{ | ||
"name": "ModelViewMat", | ||
"type": "matrix4x4", | ||
"count": 16, | ||
"values": [ | ||
1.0, 0.0, 0.0, 0.0, | ||
0.0, 1.0, 0.0, 0.0, | ||
0.0, 0.0, 1.0, 0.0, | ||
0.0, 0.0, 0.0, 1.0 | ||
] | ||
}, | ||
{ | ||
"name": "ProjMat", | ||
"type": "matrix4x4", | ||
"count": 16, | ||
"values": [ | ||
1.0, 0.0, 0.0, 0.0, | ||
0.0, 1.0, 0.0, 0.0, | ||
0.0, 0.0, 1.0, 0.0, | ||
0.0, 0.0, 0.0, 1.0 | ||
] | ||
}, | ||
{ | ||
"name": "ColorModulator", | ||
"type": "float", | ||
"count": 4, | ||
"values": [ | ||
1.0, 1.0, 1.0, 1.0 | ||
] | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/resources/assets/minecraft/shaders/core/darkkore_circle.vsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version 150 | ||
|
||
in vec3 Position; | ||
in vec4 UV0; | ||
in vec4 Color; | ||
|
||
uniform mat4 ModelViewMat; | ||
uniform mat4 ProjMat; | ||
uniform vec4 ColorModulator; | ||
|
||
out vec4 vertexColor; | ||
out vec2 texCoord0; | ||
out float innerRad; | ||
|
||
void main() { | ||
vec4 vertex = vec4(Position, 1.0); | ||
gl_Position = ProjMat * ModelViewMat * vertex; | ||
innerRad = ColorModulator[0]; | ||
vertexColor = UV0; | ||
texCoord0 = Color.xy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters