mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 23:58:34 +01:00
Remove unused vertex attributes from laser
This commit is contained in:
parent
5fb22fa63c
commit
de635bb709
1 changed files with 32 additions and 45 deletions
|
@ -26,7 +26,6 @@ import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.resources.model.BakedModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -254,35 +253,29 @@ public final class AssetUtil {
|
||||||
|
|
||||||
Matrix4f matrix = matrixStack.last().pose();
|
Matrix4f matrix = matrixStack.last().pose();
|
||||||
|
|
||||||
TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE);
|
|
||||||
float minU = sprite.getU0();
|
|
||||||
float maxU = sprite.getU1();
|
|
||||||
float minV = sprite.getV0();
|
|
||||||
float maxV = sprite.getV1();
|
|
||||||
|
|
||||||
//Draw laser tube faces
|
//Draw laser tube faces
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
float width = beamWidth * (i / 4.0f);
|
float width = beamWidth * (i / 4.0f);
|
||||||
//top
|
//top
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//bottom
|
//bottom
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//left
|
//left
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
//right
|
//right
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setLight(lightmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -336,35 +329,29 @@ public final class AssetUtil {
|
||||||
|
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||||
|
|
||||||
TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE);
|
|
||||||
float minU = sprite.getU0();
|
|
||||||
float maxU = sprite.getU1();
|
|
||||||
float minV = sprite.getV0();
|
|
||||||
float maxV = sprite.getV1();
|
|
||||||
|
|
||||||
//Draw laser tube faces
|
//Draw laser tube faces
|
||||||
for (int i = 1; i < 4; i++) {
|
for (int i = 1; i < 4; i++) {
|
||||||
float width = beamWidth * (i / 4.0f);
|
float width = beamWidth * (i / 4.0f);
|
||||||
//top
|
//top
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a);
|
||||||
//bottom
|
//bottom
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
//left
|
//left
|
||||||
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a);
|
||||||
//right
|
//right
|
||||||
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a);
|
||||||
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap);
|
builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a);
|
||||||
|
|
||||||
}
|
}
|
||||||
matrixStack.popPose();
|
matrixStack.popPose();
|
||||||
|
|
Loading…
Reference in a new issue