优化渲染
This commit is contained in:
parent
dcc749650e
commit
537559a7b0
4 changed files with 21 additions and 14 deletions
|
@ -178,7 +178,7 @@ public class AnimationHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void handleZoomCrossHair(MultiBufferSource currentBuffer, RenderType renderType, String boneName, PoseStack stack, GeoBone bone, MultiBufferSource buffer, int packedLightIn, double x, double y, double z, int r, int g, int b, int a, String name) {
|
||||
public static void handleZoomCrossHair(MultiBufferSource currentBuffer, RenderType renderType, String boneName, PoseStack stack, GeoBone bone, MultiBufferSource buffer, int packedLightIn, double x, double y, double z, int r, int g, int b, int a, String name, boolean hasBlackPart) {
|
||||
if (boneName.equals("cross") && ClientEventHandler.zoomPos > 0.8) {
|
||||
stack.pushPose();
|
||||
stack.translate(x, y, -z);
|
||||
|
@ -189,7 +189,17 @@ public class AnimationHelper {
|
|||
RenderUtil.translateAwayFromPivotPoint(stack, bone);
|
||||
PoseStack.Pose pose = stack.last();
|
||||
Matrix4f $$7 = pose.pose();
|
||||
VertexConsumer $$9 = buffer.getBuffer(RenderType.entityTranslucentEmissive(Mod.loc("textures/crosshair/" + name + ".png")));
|
||||
|
||||
ResourceLocation tex = Mod.loc("textures/crosshair/" + name + ".png");
|
||||
// 准星里如果有黑色部分则使用此渲染
|
||||
if (hasBlackPart) {
|
||||
VertexConsumer blackPart = buffer.getBuffer(RenderType.entityTranslucent(tex));
|
||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, 0, 0, 1, r, g, b, a);
|
||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 1.0F, 0, 1, 1, r, g, b, a);
|
||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 1.0F, 1, 1, 0, r, g, b, a);
|
||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, 1, 0, 0, r, g, b, a);
|
||||
}
|
||||
VertexConsumer $$9 = buffer.getBuffer(ModRenderTypes.MUZZLE_FLASH_TYPE.apply(tex));
|
||||
vertexRGB($$9, $$7, pose, packedLightIn, 0.0F, 0, 0, 1, r, g, b, a);
|
||||
vertexRGB($$9, $$7, pose, packedLightIn, 1.0F, 0, 1, 1, r, g, b, a);
|
||||
vertexRGB($$9, $$7, pose, packedLightIn, 1.0F, 1, 1, 0, r, g, b, a);
|
||||
|
|
|
@ -93,9 +93,9 @@ public class AK12ItemRenderer extends GeoItemRenderer<AK12Item> {
|
|||
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||
|
||||
switch (scopeType) {
|
||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 28, 0, 255, 0, 255, "okp_7");
|
||||
case 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, 18, 255, 0, 0, 255, "dot");
|
||||
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, Math.max(30 - 4 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo");
|
||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 28, 0, 255, 0, 255, "okp_7", false);
|
||||
case 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, 18, 255, 0, 0, 255, "dot", false);
|
||||
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, Math.max(30 - 4 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo", true);
|
||||
}
|
||||
|
||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, -0.012, 0.02, 1.25229375, 0.3);
|
||||
|
|
|
@ -101,9 +101,9 @@ public class AK47ItemRenderer extends GeoItemRenderer<AK47Item> {
|
|||
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||
|
||||
switch (scopeType) {
|
||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 20, 255, 0, 0, 255, "kobra");
|
||||
case 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.04, 0.28, 18, 0, 0, 0, 255, "pso_1");
|
||||
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.28, Math.max(30 - 4 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo");
|
||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 20, 255, 0, 0, 255, "kobra", false);
|
||||
case 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.04, 0.28, 18, 255, 0, 0, 255, "pso_1", true);
|
||||
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.28, Math.max(30 - 4 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo", true);
|
||||
}
|
||||
|
||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.06875, 0.3);
|
||||
|
|
|
@ -92,12 +92,9 @@ public class Hk416ItemRenderer extends GeoItemRenderer<Hk416Item> {
|
|||
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||
|
||||
switch (scopeType) {
|
||||
case 1 ->
|
||||
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.25, 30, 0, 255, 0, 255, "eotech");
|
||||
case 2 ->
|
||||
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.313, 9, 255, 0, 0, 255, "acog");
|
||||
case 3 ->
|
||||
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.29, Math.max(44 - 5 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo");
|
||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.25, 30, 0, 255, 0, 255, "eotech", false);
|
||||
case 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.313, 9, 255, 0, 0, 255, "acog", true);
|
||||
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.29, Math.max(44 - 5 * ClientEventHandler.customZoom, 3), 255, 0, 0, 255, "lpvo", true);
|
||||
}
|
||||
|
||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.440625, 0.3);
|
||||
|
|
Loading…
Add table
Reference in a new issue