mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Laser Rendering Improvements (#462)
* Improved laser rendering. * Removed unused import.
This commit is contained in:
parent
f937673483
commit
c3ef81ff5f
5 changed files with 37 additions and 23 deletions
|
@ -21,9 +21,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -36,6 +39,9 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public final class AssetUtil{
|
||||
|
||||
public static int maxLightX = 0xF000F0;
|
||||
public static int maxLightY = 0xF000F0;
|
||||
|
||||
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("gui_inventory");
|
||||
|
||||
public static ResourceLocation getGuiLocation(String file){
|
||||
|
@ -233,7 +239,10 @@ public final class AssetUtil{
|
|||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE);
|
||||
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
|
||||
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
|
||||
GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0);
|
||||
GlStateManager.translate(firstX-TileEntityRendererDispatcher.staticPlayerX, firstY-TileEntityRendererDispatcher.staticPlayerY, firstZ-TileEntityRendererDispatcher.staticPlayerZ);
|
||||
GlStateManager.rotate((float)(180*yaw/Math.PI), 0, 1, 0);
|
||||
GlStateManager.rotate((float)(180*pitch/Math.PI), 0, 0, 1);
|
||||
|
@ -286,31 +295,36 @@ public final class AssetUtil{
|
|||
}
|
||||
else{*/
|
||||
GlStateManager.disableTexture2D();
|
||||
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||
render.pos(length, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
for (double i = 0; i < 4; i ++){
|
||||
double width = beamWidth * (i/4.0);
|
||||
render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
|
||||
render.pos(length, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
|
||||
render.pos(length, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
|
||||
render.pos(length, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -beamWidth, beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -beamWidth, -beamWidth).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
|
||||
}
|
||||
tessy.draw();
|
||||
|
||||
GlStateManager.enableTexture2D();
|
||||
//}
|
||||
|
||||
GlStateManager.alphaFunc(func, ref);
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 265 B |
Binary file not shown.
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 244 B |
Binary file not shown.
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 264 B |
Loading…
Reference in a new issue