Skip to content

Commit

Permalink
Merge pull request #15 from TimLee9024/1.19-Fabric-2.0
Browse files Browse the repository at this point in the history
Update to 2.0.1.1
  • Loading branch information
Protoxy22 authored Nov 26, 2022
2 parents e392744 + 5cfeee3 commit a9db4d4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ org.gradle.jvmargs=-Xmx4G
loader_version=0.14.10

# Mod Properties
mod_version = 1.19.2-Fabric-2.0.1.0
mod_version = 1.19.2-Fabric-2.0.1.1
maven_group = com.modularmods.mcgltf.example
archives_base_name = MCglTF-Example

# Dependencies
fabric_version=0.66.0+1.19.2
fabric_version=0.67.1+1.19.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
RenderType renderType = RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS);
vertexConsumers.getBuffer(renderType); //Put renderType into MultiBufferSource to ensure command submit to IrisRenderingHook will be run in Iris batched entity rendering.
Matrix4f modelViewMatrix = matrices.last().pose().copy();
Matrix3f normalMatrix = matrices.last().normal().copy();

if(MCglTF.getInstance().isShaderModActive()) {
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("BLOCK_ENTITIES", renderType, () -> {
Expand All @@ -52,18 +53,25 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
case NORTH:
break;
case SOUTH:
modelViewMatrix.multiply(new Quaternion(0.0F, 1.0F, 0.0F, 0.0F));
Quaternion rotation = new Quaternion(0.0F, 1.0F, 0.0F, 0.0F);
modelViewMatrix.multiply(rotation);
normalMatrix.mul(rotation);
break;
case WEST:
modelViewMatrix.multiply(new Quaternion(0.0F, 0.7071068F, 0.0F, 0.7071068F));
rotation = new Quaternion(0.0F, 0.7071068F, 0.0F, 0.7071068F);
modelViewMatrix.multiply(rotation);
normalMatrix.mul(rotation);
break;
case EAST:
modelViewMatrix.multiply(new Quaternion(0.0F, -0.7071068F, 0.0F, 0.7071068F));
rotation = new Quaternion(0.0F, -0.7071068F, 0.0F, 0.7071068F);
modelViewMatrix.multiply(rotation);
normalMatrix.mul(rotation);
break;
}
}

RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;

boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND); //Since the renderType is entity solid, we need to turn on blending manually.
Expand All @@ -81,7 +89,6 @@ public void render(ExampleBlockEntity blockEntity, float tickDelta, PoseStack ma
});
}
else {
Matrix3f normalMatrix = matrices.last().normal().copy();
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
Level level = blockEntity.getLevel();
if(level != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void render(ExampleEntity entity, float yRotDelta, float tickDelta, PoseS
RenderType renderType = RenderType.entitySolid(TextureAtlas.LOCATION_BLOCKS);
vertexConsumers.getBuffer(renderType); //Put renderType into MultiBufferSource to ensure command submit to IrisRenderingHook will be run in Iris batched entity rendering.
Matrix4f modelViewMatrix = matrices.last().pose().copy();
Matrix3f normalMatrix = matrices.last().normal().copy();

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

modelViewMatrix.multiply(new Quaternion(0.0F, Mth.rotLerp(tickDelta, entity.yBodyRotO, entity.yBodyRot), 0.0F, true));
Quaternion rotation = new Quaternion(0.0F, Mth.rotLerp(tickDelta, entity.yBodyRotO, entity.yBodyRot), 0.0F, true);
modelViewMatrix.multiply(rotation);
normalMatrix.mul(rotation);
RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;

boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND); //Since the renderType is entity solid, we need to turn on blending manually.
Expand All @@ -63,7 +67,6 @@ public void render(ExampleEntity entity, float yRotDelta, float tickDelta, PoseS
});
}
else {
Matrix3f normalMatrix = matrices.last().normal().copy();
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
float time = (entity.level.getGameTime() + tickDelta) / 20;
for(List<InterpolatedChannel> animation : animations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
case FIRST_PERSON_LEFT_HAND:
case FIRST_PERSON_RIGHT_HAND:
Matrix4f modelViewMatrix = matrices.last().pose().copy();
Matrix3f normalMatrix = matrices.last().normal().copy();
if(MCglTF.getInstance().isShaderModActive()) {
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("HAND_SOLID", renderType, () -> {
for(List<InterpolatedChannel> animation : animations) {
Expand All @@ -79,6 +80,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
}

RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;

boolean currentBlend = GL11.glGetBoolean(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_BLEND);
Expand All @@ -96,7 +98,6 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
});
}
else {
Matrix3f normalMatrix = matrices.last().normal().copy();
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("NONE", renderType, () -> {
for(List<InterpolatedChannel> animation : animations) {
animation.parallelStream().forEach((channel) -> {
Expand Down Expand Up @@ -126,6 +127,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
break;
default:
modelViewMatrix = matrices.last().pose().copy();
normalMatrix = matrices.last().normal().copy();
if(MCglTF.getInstance().isShaderModActive()) {
IrisRenderingHook.submitCommandForIrisRenderingByPhaseName("ENTITIES", renderType, () -> {
for(List<InterpolatedChannel> animation : animations) {
Expand All @@ -136,6 +138,7 @@ public void render(ItemStack stack, TransformType mode, PoseStack matrices, Mult
}

RenderedGltfModel.CURRENT_POSE = modelViewMatrix;
RenderedGltfModel.CURRENT_NORMAL = normalMatrix;

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

0 comments on commit a9db4d4

Please sign in to comment.