Skip to content

Commit 1f1fc3a

Browse files
authored
v2.1.0 (#89)
1 parent 62725fa commit 1f1fc3a

File tree

396 files changed

+719
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

396 files changed

+719
-605
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#version 150
2+
3+
uniform sampler2D Sampler0;
4+
5+
uniform vec4 ColorModulator;
6+
7+
in vec2 texCoord0;
8+
9+
out vec4 fragColor;
10+
11+
void main() {
12+
vec4 color = texture(Sampler0, texCoord0);
13+
if (color.a == 0.0) {
14+
discard;
15+
}
16+
fragColor = color * ColorModulator;
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"vertex": "minecraft:core/position_tex",
3+
"fragment": "minecraft:core/position_tex",
4+
"samplers": [
5+
{ "name": "Sampler0" }
6+
],
7+
"uniforms": [
8+
{ "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 ] },
9+
{ "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 ] },
10+
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
11+
]
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#version 150
2+
3+
in vec3 Position;
4+
in vec2 UV0;
5+
6+
uniform mat4 ModelViewMat;
7+
uniform mat4 ProjMat;
8+
9+
out vec2 texCoord0;
10+
11+
void main() {
12+
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
13+
14+
texCoord0 = UV0;
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#version 150
2+
3+
uniform sampler2D Sampler0;
4+
5+
uniform vec4 ColorModulator;
6+
7+
in vec2 texCoord0;
8+
in vec4 vertexColor;
9+
10+
out vec4 fragColor;
11+
12+
void main() {
13+
vec4 color = texture(Sampler0, texCoord0)* vertexColor;
14+
if (color.a < 0.01) discard;
15+
fragColor = color * ColorModulator;
16+
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"vertex": "minecraft:core/position_tex_color",
3+
"fragment": "minecraft:core/position_tex_color",
4+
"samplers": [
5+
{ "name": "Sampler0" }
6+
],
7+
"uniforms": [
8+
{ "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 ] },
9+
{ "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 ] },
10+
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
11+
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [1920, 1080 ] }
12+
]
13+
}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#version 150
2+
3+
4+
#moj_import <minecraft:interfaces.glsl>
5+
6+
in vec3 Position;
7+
in vec2 UV0;
8+
in vec4 Color;
9+
10+
uniform sampler2D Sampler0;
11+
12+
uniform mat4 ModelViewMat;
13+
uniform mat4 ProjMat;
14+
uniform vec2 ScreenSize;
15+
16+
out vec2 texCoord0;
17+
out vec4 vertexColor;
18+
19+
vec2[] corners = vec2[](vec2(0, 0), vec2(0, 1), vec2(1, 1), vec2(1, 0));
20+
21+
int offset = 0;
22+
bool hotbar = false;
23+
float margin = 1;
24+
25+
26+
void main() {
27+
texCoord0 = UV0;
28+
vec3 pos = Position;
29+
vec4 color = texture(Sampler0, vec2(0));
30+
vec4 drawnColor;
31+
float uiScale = ScreenSize.x * ProjMat[0][0] * 0.5;
32+
33+
if(gl_VertexID % 4 == 0){
34+
drawnColor = texture(Sampler0, texCoord0);
35+
}else if(gl_VertexID % 4 == 1){
36+
drawnColor = texture(Sampler0, vec2(texCoord0.x,texCoord0.y-0.001));
37+
}else if(gl_VertexID % 4 == 2){
38+
drawnColor = texture(Sampler0, texCoord0- 0.001);
39+
}else{
40+
drawnColor = texture(Sampler0, vec2(texCoord0.x-0.001,texCoord0.y));
41+
42+
43+
}
44+
45+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
46+
47+
48+
49+
if (ivec4(round(color*255)) == ivec4(1,1,1,2) || ivec4(round(color*255)) == ivec4(1,2,1,2)) {
50+
51+
vec2 corner = corners[gl_VertexID % 4];
52+
texCoord0.x = corner.x/2;
53+
texCoord0.y = corner.y/2;
54+
55+
56+
pos.x = (corner.x-0.5) * 512/2;
57+
pos.y = (corner.y-0.5) * 512/2;
58+
59+
if ((gl_VertexID % 4 == 0 || gl_VertexID % 4 == 1) && vertex_compare(Position.x,ScreenSize.x,uiScale,-176,77,margin)) pos.x += 77;
60+
else if((gl_VertexID % 4 == 2 || gl_VertexID % 4 == 3) && vertex_compare(Position.x,ScreenSize.x,uiScale,-176,253,margin)) pos.x += 77;
61+
62+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
63+
gl_Position.xy += vec2(1,-1);
64+
}
65+
66+
if (ivec4(round(color*255)) == ivec4(1,1,1,3)) {// ========= BREWING STAND
67+
68+
vec2 corner = corners[gl_VertexID % 4];
69+
texCoord0.x = corner.x*0.6875;
70+
texCoord0.y = corner.y*0.6875;
71+
72+
73+
pos.x = (corner.x-0.5) * 352 -40;
74+
pos.y = (corner.y-0.5) * 352 +48;
75+
76+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
77+
gl_Position.xy += vec2(1,-1);
78+
}
79+
if (ivec4(round(color*255)) == ivec4(1,1,1,4)) {// ========= CHESTS
80+
81+
if(((gl_VertexID % 4 == 0 || gl_VertexID % 4 == 3)&& Position.y == round((ScreenSize.y/uiScale-222)/2) )||((gl_VertexID % 4 == 1 || gl_VertexID % 4 == 2)&& Position.y == round((ScreenSize.y/uiScale-222)/2 +125))){
82+
pos.xy = vec2(0,0);
83+
}else{
84+
85+
vec2 corner = corners[gl_VertexID % 4];
86+
texCoord0.x = corner.x/2;
87+
texCoord0.y = corner.y/2;
88+
89+
pos.x = (corner.x-0.5) * 512/2;
90+
pos.y = (corner.y-0.5) * 512/2;
91+
92+
if ((gl_VertexID % 4 == 0 || gl_VertexID % 4 == 3) && Position.y == round(ScreenSize.y/uiScale/2)+14) {
93+
94+
texCoord0.y += 0.5;
95+
pos.y += 27;
96+
97+
}
98+
if ((gl_VertexID % 4 == 1 || gl_VertexID % 4 == 2) && Position.y == round(ScreenSize.y/uiScale/2)+110){
99+
100+
texCoord0.y += 0.5;
101+
pos.y += 27;
102+
}
103+
104+
105+
}
106+
107+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
108+
gl_Position.xy += vec2(1,-1);
109+
}
110+
111+
if (ivec4(round(color*255)) == ivec4(1,1,1,5)) {// ========= VILLAGER
112+
113+
vec2 corner = corners[gl_VertexID % 4];
114+
texCoord0.x = corner.x*0.6875;
115+
texCoord0.y = corner.y*0.6875;
116+
117+
118+
pos.x = (corner.x-0.5) * 352 +1;
119+
pos.y = (corner.y-0.5) * 352 +48;
120+
121+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
122+
gl_Position.xy += vec2(1,-1);
123+
}
124+
125+
// ========= VILLAGER EXPERIENCE
126+
if (
127+
((gl_VertexID % 4 == 0 || gl_VertexID % 4 == 3) && pos.y == (round(ScreenSize.y/uiScale/2)-67) ) ||
128+
((gl_VertexID % 4 == 1 || gl_VertexID % 4 == 2) && pos.y == (round(ScreenSize.y/uiScale/2)-67)+5)
129+
) {
130+
131+
if (pos.x >= round((ScreenSize.x/uiScale/2-2))-1 && pos.x <= round((ScreenSize.x/uiScale/2-2)) +102 && round(drawnColor.w*255) == 254)
132+
{
133+
pos.y -= 30;
134+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
135+
}
136+
}
137+
138+
/*if(pos.z == 310){// ======================= HOTBAR
139+
140+
if(( gl_VertexID % 4 == 0 || gl_VertexID % 4 == 1 ) && pos.x == (ScreenSize.x/uiScale-182)/2 ) hotbar = true;
141+
if(( gl_VertexID % 4 == 2 || gl_VertexID % 4 == 3 ) && pos.x == (ScreenSize.x/uiScale-182)/2 + 182) hotbar = true;
142+
143+
}
144+
145+
if( pos.z == 310 && hotbar){
146+
147+
vec2 corner = corners[gl_VertexID % 4];
148+
149+
pos.x -= ScreenSize.x/4/uiScale;
150+
pos.y -= ScreenSize.y/2/uiScale;
151+
152+
gl_Position = ProjMat * ModelViewMat * vec4(pos.x*2,pos.y*2,pos.z, 1.0);
153+
154+
}*/
155+
156+
157+
158+
/*if((gl_VertexID % 4 == 0 && pos.y == 87 && pos.x == 284) //===================== VIllager frown
159+
160+
|| (gl_VertexID % 4 == 1 && pos.y == 108 && pos.x == 284)
161+
|| (gl_VertexID % 4 == 2 && pos.y == 108 && pos.x == 312)
162+
|| (gl_VertexID % 4 == 3 && pos.y == 87 && pos.x == 312) ){
163+
164+
pos.y -= 30;
165+
pos.x -= 8;
166+
gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
167+
}*/
168+
169+
vertexColor = Color;
170+
171+
}
172+

0 commit comments

Comments
 (0)