Java Code Examples for net.minecraft.client.renderer.GlStateManager#glNormal3f()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#glNormal3f() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderUtil.java From seppuku with GNU General Public License v3.0 | 5 votes |
public static void glBillboard(float x, float y, float z) { float scale = 0.016666668f * 1.6f; GlStateManager.translate(x - Minecraft.getMinecraft().getRenderManager().renderPosX, y - Minecraft.getMinecraft().getRenderManager().renderPosY, z - Minecraft.getMinecraft().getRenderManager().renderPosZ); GlStateManager.glNormal3f(0.0f, 1.0f, 0.0f); GlStateManager.rotate(-Minecraft.getMinecraft().player.rotationYaw, 0.0f, 1.0f, 0.0f); GlStateManager.rotate(Minecraft.getMinecraft().player.rotationPitch, Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? -1.0f : 1.0f, 0.0f, 0.0f); GlStateManager.scale(-scale, -scale, scale); }
Example 2
Source File: RenderFukumame.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFukumame entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 3
Source File: RenderBeam.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityBeam entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.depthMask(true); GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 4
Source File: RenderEventHandler.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
protected void renderLabel(String text, double x, double y, double z, float angleH, float angleV) { boolean flag = false; // sneaking FontRenderer fontrenderer = this.mc.fontRenderer; GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-angleH, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-angleV, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-0.025F, -0.025F, 0.025F); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vertexbuffer = tessellator.getBuffer(); int strLenHalved = fontrenderer.getStringWidth(text) / 2; vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos(-strLenHalved - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos(-strLenHalved - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos( strLenHalved + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos( strLenHalved + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(text, -strLenHalved, 0, 0x20FFFFFF); GlStateManager.enableDepth(); GlStateManager.depthMask(true); fontrenderer.drawString(text, -strLenHalved, 0, flag ? 0x20FFFFFF : 0xFFFFFFFF); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); }