Skip to content

Commit a9db4d4

Browse files
authored
Merge pull request #15 from TimLee9024/1.19-Fabric-2.0
Update to 2.0.1.1
2 parents e392744 + 5cfeee3 commit a9db4d4

5 files changed

Lines changed: 23 additions & 11 deletions

File tree

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ org.gradle.jvmargs=-Xmx4G
77
loader_version=0.14.10
88

99
# Mod Properties
10-
mod_version = 1.19.2-Fabric-2.0.1.0
10+
mod_version = 1.19.2-Fabric-2.0.1.1
1111
maven_group = com.modularmods.mcgltf.example
1212
archives_base_name = MCglTF-Example
1313

1414
# Dependencies
15-
fabric_version=0.66.0+1.19.2
15+
fabric_version=0.67.1+1.19.2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/com/modularmods/mcgltf/example/ExampleBlockEntityRendererIris.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
2929
RenderType renderType = RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS);
3030
vertexConsumers.getBuffer(renderType); //Put renderType into MultiBufferSource to ensure command submit to IrisRenderingHook will be run in Iris batched entity rendering.
3131
Matrix4f modelViewMatrix = matrices.last().pose().copy();
32+
Matrix3f normalMatrix = matrices.last().normal().copy();
3233

3334
if(MCglTF.getInstance().isShaderModActive()) {
3435
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("BLOCK_ENTITIES", renderType, () -> {
@@ -52,18 +53,25 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
5253
case NORTH:
5354
break;
5455
case SOUTH:
55-
modelViewMatrix.multiply(new Quaternion(0.0F, 1.0F, 0.0F, 0.0F));
56+
Quaternion rotation = new Quaternion(0.0F, 1.0F, 0.0F, 0.0F);
57+
modelViewMatrix.multiply(rotation);
58+
normalMatrix.mul(rotation);
5659
break;
5760
case WEST:
58-
modelViewMatrix.multiply(new Quaternion(0.0F, 0.7071068F, 0.0F, 0.7071068F));
61+
rotation = new Quaternion(0.0F, 0.7071068F, 0.0F, 0.7071068F);
62+
modelViewMatrix.multiply(rotation);
63+
normalMatrix.mul(rotation);
5964
break;
6065
case EAST:
61-
modelViewMatrix.multiply(new Quaternion(0.0F, -0.7071068F, 0.0F, 0.7071068F));
66+
rotation = new Quaternion(0.0F, -0.7071068F, 0.0F, 0.7071068F);
67+
modelViewMatrix.multiply(rotation);
68+
normalMatrix.mul(rotation);
6269
break;
6370
}
6471
}
6572

6673
RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
74+
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;
6775

6876
boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
6977
GL11.glEnable(GL11.GL_BLEND); //Since the renderType is entity solid, we need to turn on blending manually.
@@ -81,7 +89,6 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
8189
});
8290
}
8391
else {
84-
Matrix3f normalMatrix = matrices.last().normal().copy();
8592
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
8693
Level level = blockEntity.getLevel();
8794
if(level != null) {

src/main/java/com/modularmods/mcgltf/example/ExampleEntityRendererIris.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public void render(ExampleEntity entity, float yRotDelta, float tickDelta, PoseS
3232
RenderType renderType = RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS);
3333
vertexConsumers.getBuffer(renderType); //Put renderType into MultiBufferSource to ensure command submit to IrisRenderingHook will be run in Iris batched entity rendering.
3434
Matrix4f modelViewMatrix = matrices.last().pose().copy();
35+
Matrix3f normalMatrix = matrices.last().normal().copy();
3536

3637
if(MCglTF.getInstance().isShaderModActive()) {
3738
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("ENTITIES", renderType, () -> {
@@ -44,8 +45,11 @@ public void render(ExampleEntity entity, float yRotDelta, float tickDelta, PoseS
4445
});
4546
}
4647

47-
modelViewMatrix.multiply(new Quaternion(0.0F, Mth.rotLerp(tickDelta, entity.yBodyRotO, entity.yBodyRot), 0.0F, true));
48+
Quaternion rotation = new Quaternion(0.0F, Mth.rotLerp(tickDelta, entity.yBodyRotO, entity.yBodyRot), 0.0F, true);
49+
modelViewMatrix.multiply(rotation);
50+
normalMatrix.mul(rotation);
4851
RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
52+
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;
4953

5054
boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
5155
GL11.glEnable(GL11.GL_BLEND); //Since the renderType is entity solid, we need to turn on blending manually.
@@ -63,7 +67,6 @@ public void render(ExampleEntity entity, float yRotDelta, float tickDelta, PoseS
6367
});
6468
}
6569
else {
66-
Matrix3f normalMatrix = matrices.last().normal().copy();
6770
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
6871
float time = (entity.level.getGameTime() + tickDelta) / 20;
6972
for(List<InterpolatedChannel> animation : animations) {

src/main/java/com/modularmods/mcgltf/example/ExampleItemRendererIris.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
6969
case FIRST_PERSON_LEFT_HAND:
7070
case FIRST_PERSON_RIGHT_HAND:
7171
Matrix4f modelViewMatrix = matrices.last().pose().copy();
72+
Matrix3f normalMatrix = matrices.last().normal().copy();
7273
if(MCglTF.getInstance().isShaderModActive()) {
7374
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("HAND_SOLID", renderType, () -> {
7475
for(List<InterpolatedChannel> animation : animations) {
@@ -79,6 +80,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
7980
}
8081

8182
RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
83+
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;
8284

8385
boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
8486
GL11.glEnable(GL11.GL_BLEND);
@@ -96,7 +98,6 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
9698
});
9799
}
98100
else {
99-
Matrix3f normalMatrix = matrices.last().normal().copy();
100101
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
101102
for(List<InterpolatedChannel> animation : animations) {
102103
animation.parallelStream().forEach((channel) -> {
@@ -126,6 +127,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
126127
break;
127128
default:
128129
modelViewMatrix = matrices.last().pose().copy();
130+
normalMatrix = matrices.last().normal().copy();
129131
if(MCglTF.getInstance().isShaderModActive()) {
130132
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("ENTITIES", renderType, () -> {
131133
for(List<InterpolatedChannel> animation : animations) {
@@ -136,6 +138,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
136138
}
137139

138140
RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
141+
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;
139142

140143
boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
141144
GL11.glEnable(GL11.GL_BLEND);
@@ -153,7 +156,6 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
153156
});
154157
}
155158
else {
156-
Matrix3f normalMatrix = matrices.last().normal().copy();
157159
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
158160
for(List<InterpolatedChannel> animation : animations) {
159161
animation.parallelStream().forEach((channel) -> {

0 commit comments

Comments
 (0)