Skip to content

Commit

Permalink
Update lightmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack253-png committed Aug 24, 2024
1 parent 88ad836 commit 252ef94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class CustomTextureStateShard: RenderStateShard.EmptyTextureStateShard(Runnable
})
val renderType = RenderType.create(
"live2d_deferred",
DefaultVertexFormat.POSITION_TEX,
DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP,
VertexFormat.Mode.QUADS,
0x200,
false,
false,
CompositeState.builder().setShaderState(RenderStateShard.POSITION_TEX_SHADER)
CompositeState.builder().setShaderState(RenderStateShard.POSITION_COLOR_TEX_LIGHTMAP_SHADER)
.setTextureState(CustomTextureStateShard())
.setLayeringState(RenderStateShard.VIEW_OFFSET_Z_LAYERING)
.setTransparencyState(RenderStateShard.TRANSLUCENT_TRANSPARENCY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,22 @@ class Live2DEntityRenderer(context: EntityRendererProvider.Context) : EntityRend
poseStack.pushPose()
poseStack.mulPose(Axis.YN.rotationDegrees(entityYaw))
val matrix = poseStack.last().pose()
buff.addVertex(matrix, -1f, 0f, 0f).setUv(0f, 0f)
buff.addVertex(matrix, 0.920f, 0f, 0f).setUv(1f, 0f)
buff.addVertex(matrix, 0.920f, 1.080f, 0f).setUv(1f, 1f)
buff.addVertex(matrix, -1f, 1.080f, 0f).setUv(0f, 1f)
buff.addVertex(matrix, -1f, 0f, 0f)
.setColor(1f, 1f, 1f, 1f)
.setUv(0f, 0f)
.setLight(packedLight)
buff.addVertex(matrix, 0.920f, 0f, 0f)
.setColor(1f, 1f, 1f, 1f)
.setUv(1f, 0f)
.setLight(packedLight)
buff.addVertex(matrix, 0.920f, 1.080f, 0f)
.setColor(1f, 1f, 1f, 1f)
.setUv(1f, 1f)
.setLight(packedLight)
buff.addVertex(matrix, -1f, 1.080f, 0f)
.setColor(1f, 1f, 1f, 1f)
.setUv(0f, 1f)
.setLight(packedLight)
poseStack.popPose()
}
}
Expand Down

0 comments on commit 252ef94

Please sign in to comment.