Commit cacc492 1 parent 5989a04 commit cacc492 Copy full SHA for cacc492
File tree 4 files changed +11
-4
lines changed
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 3
3
uniform mat4 m_proj;
4
4
uniform mat4 m_camera;
5
5
uniform mat4 m_model;
6
+ uniform mat4 m_texture;
6
7
7
8
in vec3 in_position;
8
9
in vec2 in_texcoord_0;
@@ -11,5 +12,7 @@ out vec2 uv;
11
12
12
13
void main() {
13
14
gl_Position = m_proj * m_camera * m_model * vec4 (in_position, 1 );
14
- uv = in_texcoord_0;
15
+
16
+ vec4 rotCoord = m_texture * vec4 (in_texcoord_0, 0.0 , 1.0 );
17
+ uv = rotCoord.st;
15
18
}
Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ def render_block(
214
214
215
215
# render each face of the element
216
216
for direction , face in element .faces .items ():
217
+ rotation = Matrix44 .from_y_rotation (math .radians (face .rotation ), "f4" )
218
+ self .uniform ("m_texture" ).write (rotation )
219
+
217
220
self .uniform ("light" ).value = get_face_light (direction )
218
221
self .uniform ("texture0" ).value = texture_locs [face .texture .lstrip ("#" )]
219
222
@@ -410,15 +413,15 @@ def get_face_light(direction: FaceName):
410
413
case "up" :
411
414
return LIGHT_UP
412
415
case "down" :
413
- return LIGHT_UP / 2
416
+ return LIGHT_UP / 4
414
417
case "south" :
415
418
return LIGHT_LEFT
416
419
case "north" :
417
- return LIGHT_LEFT / 2
420
+ return LIGHT_LEFT / 4
418
421
case "east" :
419
422
return LIGHT_RIGHT
420
423
case "west" :
421
- return LIGHT_RIGHT / 2
424
+ return LIGHT_RIGHT / 4
422
425
423
426
424
427
def get_default_uv (element : ModelElement , direction : FaceName ):
Original file line number Diff line number Diff line change 6
6
from hexdoc .minecraft .models import load_model
7
7
from hexdoc .minecraft .models .item import ItemModel
8
8
9
+ # MODEL_ID = "minecraft:block/oak_stairs"
9
10
MODEL_ID = "minecraft:block/lectern"
10
11
11
12
You can’t perform that action at this time.
0 commit comments