优化瞄准镜准星缩放,添加专注和波塞克的准星
This commit is contained in:
parent
d179badd92
commit
01ca4c0464
13 changed files with 37 additions and 91 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, boolean hasBlackPart) {
|
public static void handleZoomCrossHair(MultiBufferSource currentBuffer, RenderType renderType, String boneName, PoseStack stack, GeoBone bone, MultiBufferSource buffer, int packedLightIn, double x, double y, double z, float size, int r, int g, int b, int a, String name, boolean hasBlackPart) {
|
||||||
if (boneName.equals("cross") && ClientEventHandler.zoomPos > 0.8) {
|
if (boneName.equals("cross") && ClientEventHandler.zoomPos > 0.8) {
|
||||||
stack.pushPose();
|
stack.pushPose();
|
||||||
stack.translate(x, y, -z);
|
stack.translate(x, y, -z);
|
||||||
|
@ -191,26 +191,27 @@ public class AnimationHelper {
|
||||||
Matrix4f $$7 = pose.pose();
|
Matrix4f $$7 = pose.pose();
|
||||||
|
|
||||||
ResourceLocation tex = Mod.loc("textures/crosshair/" + name + ".png");
|
ResourceLocation tex = Mod.loc("textures/crosshair/" + name + ".png");
|
||||||
// 准星里如果有黑色部分则使用此渲染
|
|
||||||
if (hasBlackPart) {
|
int alpha = hasBlackPart ? a : (int) (0.05 * a);
|
||||||
VertexConsumer blackPart = buffer.getBuffer(RenderType.entityTranslucent(tex));
|
|
||||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, 0, 0, 1, r, g, b, a);
|
VertexConsumer blackPart = buffer.getBuffer(RenderType.entityTranslucent(tex));
|
||||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 1.0F, 0, 1, 1, r, g, b, a);
|
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, 0, 0, 1, r, g, b, alpha, size);
|
||||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 1.0F, 1, 1, 0, r, g, b, a);
|
vertexRGB(blackPart, $$7, pose, packedLightIn, size, 0, 1, 1, r, g, b, alpha, size);
|
||||||
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, 1, 0, 0, r, g, b, a);
|
vertexRGB(blackPart, $$7, pose, packedLightIn, size, size, 1, 0, r, g, b, alpha, size);
|
||||||
}
|
vertexRGB(blackPart, $$7, pose, packedLightIn, 0.0F, size, 0, 0, r, g, b, alpha, size);
|
||||||
|
|
||||||
VertexConsumer $$9 = buffer.getBuffer(ModRenderTypes.MUZZLE_FLASH_TYPE.apply(tex));
|
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, 0.0F, 0, 0, 1, r, g, b, a, size);
|
||||||
vertexRGB($$9, $$7, pose, packedLightIn, 1.0F, 0, 1, 1, r, g, b, a);
|
vertexRGB($$9, $$7, pose, packedLightIn, size, 0, 1, 1, r, g, b, a, size);
|
||||||
vertexRGB($$9, $$7, pose, packedLightIn, 1.0F, 1, 1, 0, r, g, b, a);
|
vertexRGB($$9, $$7, pose, packedLightIn, size, size, 1, 0, r, g, b, a, size);
|
||||||
vertexRGB($$9, $$7, pose, packedLightIn, 0.0F, 1, 0, 0, r, g, b, a);
|
vertexRGB($$9, $$7, pose, packedLightIn, 0.0F, size, 0, 0, r, g, b, a, size);
|
||||||
stack.popPose();
|
stack.popPose();
|
||||||
}
|
}
|
||||||
currentBuffer.getBuffer(renderType);
|
currentBuffer.getBuffer(renderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void vertexRGB(VertexConsumer pConsumer, Matrix4f pPose, PoseStack.Pose pNormal, int pLightmapUV, float pX, float pY, int pU, int pV, int r, int g, int b, int a) {
|
private static void vertexRGB(VertexConsumer pConsumer, Matrix4f pPose, PoseStack.Pose pNormal, int pLightmapUV, float pX, float pY, int pU, int pV, int r, int g, int b, int a, float size) {
|
||||||
pConsumer.addVertex(pPose, pX - 0.5F, pY - 0.5F, 0.0F)
|
pConsumer.addVertex(pPose, pX - 0.5F * size, pY - 0.5F * size, 0.0F)
|
||||||
.setColor(r, g, b, a)
|
.setColor(r, g, b, a)
|
||||||
.setUv((float) pU, (float) pV)
|
.setUv((float) pU, (float) pV)
|
||||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.client.layer.gun;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.Mod;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.machinegun.DevotionItem;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
|
||||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
|
||||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
|
||||||
|
|
||||||
public class DevotionLayer extends GeoRenderLayer<DevotionItem> {
|
|
||||||
private static final ResourceLocation LAYER = Mod.loc("textures/item/devotion_e.png");
|
|
||||||
|
|
||||||
public DevotionLayer(GeoRenderer<DevotionItem> entityRenderer) {
|
|
||||||
super(entityRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack poseStack, DevotionItem animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
|
||||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
|
||||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -76,14 +76,14 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
case 0 -> 0.52f;
|
case 0 -> 0.52f;
|
||||||
case 1 -> 0.6f;
|
case 1 -> 0.6f;
|
||||||
case 2 -> 0.77f;
|
case 2 -> 0.77f;
|
||||||
case 3 -> 0.78f;
|
case 3 -> 0.84f;
|
||||||
default -> 0f;
|
default -> 0f;
|
||||||
};
|
};
|
||||||
float posZ = switch (type) {
|
float posZ = switch (type) {
|
||||||
case 0 -> 3f;
|
case 0 -> 3f;
|
||||||
case 1 -> 3.4f;
|
case 1 -> 3.4f;
|
||||||
case 2 -> 4.1f;
|
case 2 -> 4.1f;
|
||||||
case 3 -> 4.5f;
|
case 3 -> 5.14f;
|
||||||
default -> 0f;
|
default -> 0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,9 @@ public class AK12ItemRenderer extends GeoItemRenderer<AK12Item> {
|
||||||
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||||
|
|
||||||
switch (scopeType) {
|
switch (scopeType) {
|
||||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 28, 0, 255, 0, 255, "okp_7", false);
|
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 28, 1, 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 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, 18, 1, 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);
|
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.29, 36, (float) ClientEventHandler.customZoom, 255, 0, 0, 255, "lpvo", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, -0.012, 0.02, 1.25229375, 0.3);
|
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);
|
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||||
|
|
||||||
switch (scopeType) {
|
switch (scopeType) {
|
||||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 20, 255, 0, 0, 255, "kobra", false);
|
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.27363125, 20, 1, 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 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.04, 0.28, 18, 1, 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);
|
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, -0.03, 0.28, 36, (float) ClientEventHandler.customZoom, 255, 0, 0, 255, "lpvo", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.06875, 0.3);
|
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.06875, 0.3);
|
||||||
|
|
|
@ -89,6 +89,8 @@ public class BocekItemRenderer extends GeoItemRenderer<BocekItem> {
|
||||||
bone.setHidden(data.ammo.get() != 0);
|
bone.setHidden(data.ammo.get() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0.002, 0.1790625, 0.13, 0.08f, 255, 0, 0, 255, "dot", false);
|
||||||
|
|
||||||
if (renderingArms) {
|
if (renderingArms) {
|
||||||
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, false, false);
|
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.client.renderer.item;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||||
import com.atsuishio.superbwarfare.client.model.item.DevotionItemModel;
|
import com.atsuishio.superbwarfare.client.model.item.DevotionItemModel;
|
||||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
|
||||||
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import com.atsuishio.superbwarfare.item.gun.machinegun.DevotionItem;
|
import com.atsuishio.superbwarfare.item.gun.machinegun.DevotionItem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
@ -24,8 +23,6 @@ public class DevotionItemRenderer extends GeoItemRenderer<DevotionItem> {
|
||||||
|
|
||||||
public DevotionItemRenderer() {
|
public DevotionItemRenderer() {
|
||||||
super(new DevotionItemModel());
|
super(new DevotionItemModel());
|
||||||
// TODO layer
|
|
||||||
// this.addRenderLayer(new DevotionLayer(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,9 +77,7 @@ public class DevotionItemRenderer extends GeoItemRenderer<DevotionItem> {
|
||||||
|
|
||||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.3875, 0.35);
|
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.3875, 0.35);
|
||||||
|
|
||||||
if (name.equals("holo")) {
|
AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.22993125, 20, 1, 255, 0, 0, 255, "apex_2x", false);
|
||||||
bone.setHidden(ClientEventHandler.zoomPos < 0.7 || !ClientEventHandler.zoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (renderingArms) {
|
if (renderingArms) {
|
||||||
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, true, true);
|
AnimationHelper.renderArms(mc, player, this.transformType, stack, name, bone, SCALE_RECIPROCAL, this.currentBuffer, type, packedLightIn, true, true);
|
||||||
|
|
|
@ -92,9 +92,9 @@ public class Hk416ItemRenderer extends GeoItemRenderer<Hk416Item> {
|
||||||
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
int scopeType = GunData.from(itemStack).attachment.get(AttachmentType.SCOPE);
|
||||||
|
|
||||||
switch (scopeType) {
|
switch (scopeType) {
|
||||||
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.25, 30, 0, 255, 0, 255, "eotech", false);
|
case 1 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.25, 30, 1, 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 2 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.313, 9, 1, 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);
|
case 3 -> AnimationHelper.handleZoomCrossHair(currentBuffer, renderType, name, stack, bone, buffer, packedLightIn, 0, 0.29, 65, (float) ClientEventHandler.customZoom, 255, 0, 0, 255, "lpvo", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.440625, 0.3);
|
AnimationHelper.handleShootFlare(name, stack, itemStack, bone, buffer, packedLightIn, 0, 0, 1.440625, 0.3);
|
||||||
|
|
|
@ -39,6 +39,11 @@
|
||||||
"parent": "bone",
|
"parent": "bone",
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cross",
|
||||||
|
"parent": "0",
|
||||||
|
"pivot": [-0.02, 2.865, -1.94]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "lh",
|
"name": "lh",
|
||||||
"parent": "0",
|
"parent": "0",
|
||||||
|
@ -18805,22 +18810,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "dot",
|
|
||||||
"parent": "bone127",
|
|
||||||
"pivot": [-1.01232, 3.84123, 0.10947],
|
|
||||||
"cubes": [
|
|
||||||
{
|
|
||||||
"origin": [-1.06107, 3.79248, 0.09322],
|
|
||||||
"size": [0.0975, 0.0975, 0.0325],
|
|
||||||
"pivot": [-1.01232, 3.84123, 0.10947],
|
|
||||||
"rotation": [0, 0, 45],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [113, 19], "uv_size": [0.5, 0.5]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "bone128",
|
"name": "bone128",
|
||||||
"parent": "Scope0",
|
"parent": "Scope0",
|
||||||
|
|
|
@ -13115,23 +13115,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "holo",
|
"name": "cross",
|
||||||
"parent": "0",
|
"parent": "0",
|
||||||
"pivot": [0, 3.67891, -4.5],
|
"pivot": [0, 3.67891, -4.5]
|
||||||
"cubes": [
|
|
||||||
{
|
|
||||||
"origin": [-0.19125, 3.48766, -4.5],
|
|
||||||
"size": [0.3825, 0.3825, 0],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [59.53906, 60.625], "uv_size": [3.125, 2.625]},
|
|
||||||
"east": {"uv": [3.16406, 110.30469], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [53.28125, 2.78125], "uv_size": [5, 5]},
|
|
||||||
"west": {"uv": [3.16406, 110.30469], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [11.16406, 118.30469], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [11.16406, 118.30469], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "flare",
|
"name": "flare",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 73 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
Loading…
Add table
Reference in a new issue