Java Code Examples for org.lwjgl.opengl.GL11#glNormal3f()
The following examples show how to use
org.lwjgl.opengl.GL11#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: Snippet195.java From ldparteditor with MIT License | 6 votes |
static void drawTorus(float r, float R, int nsides, int rings) { float ringDelta = 2.0f * (float) Math.PI / rings; float sideDelta = 2.0f * (float) Math.PI / nsides; float theta = 0.0f, cosTheta = 1.0f, sinTheta = 0.0f; for (int i = rings - 1; i >= 0; i--) { float theta1 = theta + ringDelta; float cosTheta1 = (float) Math.cos(theta1); float sinTheta1 = (float) Math.sin(theta1); GL11.glBegin(GL11.GL_QUAD_STRIP); float phi = 0.0f; for (int j = nsides; j >= 0; j--) { phi += sideDelta; float cosPhi = (float) Math.cos(phi); float sinPhi = (float) Math.sin(phi); float dist = R + r * cosPhi; GL11.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); GL11.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); GL11.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); GL11.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); } GL11.glEnd(); theta = theta1; cosTheta = cosTheta1; sinTheta = sinTheta1; } }
Example 2
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void glSetup(double x, double y, double z) { GL11.glPushMatrix(); GL11.glTranslated(x - RenderUtils.renderPos().x, y - RenderUtils.renderPos().y, z - RenderUtils.renderPos().z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); }
Example 3
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void glSetup(double x, double y, double z) { GL11.glPushMatrix(); RenderUtils.offsetRender(); GL11.glTranslated(x, y, z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F); //GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); }
Example 4
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void glSetup(double x, double y, double z) { GL11.glPushMatrix(); RenderUtils.offsetRender(); GL11.glTranslated(x, y, z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F); //GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); }
Example 5
Source File: OpenGLRendererPrimitives20.java From ldparteditor with MIT License | 5 votes |
private void drawMinus(float x, float y) { drawSignBackground(x, y); GL11.glColor4f(View.primitive_plusNminus_Colour_r[0], View.primitive_plusNminus_Colour_g[0], View.primitive_plusNminus_Colour_b[0], 1f); GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0f, 0f, 1f); GL11.glVertex3f(x + 14f, y + 15.75f, 0f); GL11.glVertex3f(x + 14f, y + 15.25f, 0f); GL11.glVertex3f(x + 16f, y + 15.25f, 0f); GL11.glVertex3f(x + 16f, y + 15.75f, 0f); GL11.glEnd(); }
Example 6
Source File: GData4.java From ldparteditor with MIT License | 5 votes |
@Override public void drawGL20_BFCuncertified(Composite3D c3d) { if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; GL11.glBegin(GL11.GL_QUADS); if (GData.globalNegativeDeterminant) { GL11.glColor4f(View.BFC_uncertified_Colour_r[0], View.BFC_uncertified_Colour_g[0], View.BFC_uncertified_Colour_b[0], a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } else { GL11.glColor4f(View.BFC_uncertified_Colour_r[0], View.BFC_uncertified_Colour_g[0], View.BFC_uncertified_Colour_b[0], a); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } GL11.glEnd(); }
Example 7
Source File: GData4.java From ldparteditor with MIT License | 5 votes |
@Override public void drawGL20_RandomColours(Composite3D c3d) { if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; final float r = MathHelper.randomFloat(ID, 0); final float g = MathHelper.randomFloat(ID, 1); final float b = MathHelper.randomFloat(ID, 2); GL11.glBegin(GL11.GL_QUADS); if (GData.globalNegativeDeterminant) { GL11.glColor4f(r, g, b, a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } else { GL11.glColor4f(r, g, b, a); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } GL11.glEnd(); }
Example 8
Source File: GData3.java From ldparteditor with MIT License | 5 votes |
@Override public void drawGL20_RandomColours(Composite3D c3d) { if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; if (!isTriangle) { drawProtractor_GL20(false, c3d, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3); return; } final float r = MathHelper.randomFloat(ID, 0); final float g = MathHelper.randomFloat(ID, 1); final float b = MathHelper.randomFloat(ID, 2); GL11.glBegin(GL11.GL_TRIANGLES); if (GData.globalNegativeDeterminant) { GL11.glColor4f(r, g, b, a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); } else { GL11.glColor4f(r, g, b, a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); } GL11.glEnd(); }
Example 9
Source File: GData3.java From ldparteditor with MIT License | 5 votes |
@Override public void drawGL20_BFCuncertified(Composite3D c3d) { if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; GL11.glBegin(GL11.GL_TRIANGLES); if (GData.globalNegativeDeterminant) { GL11.glColor4f(View.BFC_uncertified_Colour_r[0], View.BFC_uncertified_Colour_g[0], View.BFC_uncertified_Colour_b[0], a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); } else { GL11.glColor4f(View.BFC_uncertified_Colour_r[0], View.BFC_uncertified_Colour_g[0], View.BFC_uncertified_Colour_b[0], a); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); } GL11.glEnd(); }
Example 10
Source File: GData4.java From ldparteditor with MIT License | 5 votes |
@Override public void drawGL20(Composite3D c3d) { if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(r, g, b, a); if (GData.globalNegativeDeterminant) { GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } else { GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } GL11.glEnd(); }
Example 11
Source File: OpenGLHelper.java From Et-Futurum with The Unlicense | 4 votes |
public static void normal(float x, float y, float z) { GL11.glNormal3f(x, y, z); }
Example 12
Source File: MoCRenderShark.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityShark entityshark = (MoCEntityShark) entityliving; super.doRenderLiving(entityshark, d, d1, d2, f, f1); if (entityshark.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer); String s = ""; s = (new StringBuilder()).append(s).append(entityshark.getName()).toString(); if ((f4 < 12F) && (s.length() > 0)) { FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.2F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); if (MoCreatures.proxy.getDisplayPetHealth()) { float f5 = entityshark.getHealth(); float f6 = entityshark.getMaxHealth(); float f7 = f5 / f6; float f8 = 40F * f7; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D); } tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } }
Example 13
Source File: GData4.java From ldparteditor with MIT License | 4 votes |
@Override public void drawGL20_CoplanarityHeatmap(Composite3D c3d) { calculateAngle(); float f = (float) Math.min(1.0, Math.max(0, angle - Threshold.coplanarity_angle_warning) / Threshold.coplanarity_angle_error); float r = 0f; float g = 0f; float b = 0f; if (f < .5) { g = f / .5f; b = (1f - g); } else { r = (f - .5f) / .5f; g = (1f - r); } if (!visible) return; if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f) return; GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(r, g, b, a); if (GData.globalNegativeDeterminant) { GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } else { GL11.glNormal3f(-xn, -yn, -zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x4, y4, z4); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x2, y2, z2); GL11.glNormal3f(xn, yn, zn); GL11.glVertex3f(x1, y1, z1); GL11.glVertex3f(x2, y2, z2); GL11.glVertex3f(x3, y3, z3); GL11.glVertex3f(x4, y4, z4); } GL11.glEnd(); }
Example 14
Source File: MoCRenderDolphin.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving; super.doRenderLiving(entitydolphin, d, d1, d2, f, f1); if (entitydolphin.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer); String s = ""; s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString(); if ((f4 < 12F) && (s.length() > 0)) { FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.3F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); if (MoCreatures.proxy.getDisplayPetHealth()) { float f5 = entitydolphin.getHealth(); float f6 = entitydolphin.getMaxHealth(); float f7 = f5 / f6; float f8 = 40F * f7; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D); } tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } }
Example 15
Source File: RenderEntityVortex.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
private void renderGust(){ byte b0 = 0; //float f2 = 0.0F; //float f3 = 0.5F; //float f4 = (0 + b0 * 10) / 16.0F; // float f5 = (5 + b0 * 10) / 16.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (5 + b0 * 10) / 16.0F; float f9 = (10 + b0 * 10) / 16.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9); double start = 0d; double end = 1 / 16d; tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, start, start); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, start, end); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, end, end); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, end, start); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9); tessellator.draw(); }
Example 16
Source File: MoCRenderShark.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityShark entityshark = (MoCEntityShark) entityliving; super.doRenderLiving(entityshark, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); boolean flag2 = MoCreatures.proxy.getDisplayPetIcons(); if (entityshark.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entityshark.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entityshark.getHealth(); float f7 = entityshark.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }
Example 17
Source File: RenderLaser.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) { this.bindEntityTexture(entityLaser); GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.4F; float f3 = 0.7F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
Example 18
Source File: YeetHandler.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@InvokeEvent public void render(RenderEntitiesEvent event) { for (Yeet yeet : yeets) { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); FontRenderer fontrenderer = renderManager.getFontRenderer(); float f = 1.6F; float f1 = 0.016666668F * f; GlStateManager.pushMatrix(); EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer; float partialTicks = event.getPartialTicks(); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks; EntityPlayer sender = yeet.sender; if (sender == null) continue; double e0 = yeet.sender.lastTickPosX + (yeet.sender.posX - yeet.sender.lastTickPosX) * (double) partialTicks; double e1 = yeet.sender.lastTickPosY + (yeet.sender.posY - yeet.sender.lastTickPosY) * (double) partialTicks; double e2 = yeet.sender.lastTickPosZ + (yeet.sender.posZ - yeet.sender.lastTickPosZ) * (double) partialTicks; GlStateManager.translate(e0 - d0, e1 - d1, e2 - d2); GlStateManager.translate(0, 3, 0); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); int xMultiplier = 1; // Nametag x rotations should flip in front-facing 3rd person if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().gameSettings != null && Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) { xMultiplier = -1; } GlStateManager.rotate(renderManager.playerViewX * xMultiplier, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; String string = "YEET"; int j = fontrenderer.getStringWidth(string) / 2; GlStateManager.disableTexture2D(); GlStateManager.scale(4, 4, 4); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(string, -j, 0, 16777215, true); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
Example 19
Source File: HyperiumRendererLivingEntity.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
public void renderName(T entity, double x, double y, double z, RenderManager renderManager) { if (((IMixinRendererLivingEntity<T>) parent).callCanRenderName(entity)) { double d0 = entity.getDistanceSqToEntity(renderManager.livingPlayer); float f = entity.isSneaking() ? 32.0F : 64.0F; if (d0 < (double) (f * f)) { String s = entity.getDisplayName().getFormattedText(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); if (entity.isSneaking() && (Settings.SHOW_OWN_NAME || !entity.equals(Minecraft.getMinecraft().thePlayer))) { FontRenderer fontrenderer = renderManager.getFontRenderer(); GlStateManager.pushMatrix(); float offset = Utils.INSTANCE.calculateDeadmauEarsOffset(entity); GlStateManager.translate((float) x, (float) y + offset + entity.height + 0.5F - (entity.isChild() ? entity.height / 2.0F : 0.0F), (float) z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-0.02666667F, -0.02666667F, 0.02666667F); GlStateManager.translate(0.0F, 9.374999F, 0.0F); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); int i = fontrenderer.getStringWidth(s) / 2; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } else { ((IMixinRender<T>) parent).callRenderOffsetLivingLabel(entity, x, y - (entity.isChild() ? (double) (entity.height / 2.0F) : 0.0D), z, s, 0.02666667F, d0); } } } }
Example 20
Source File: MoCRenderDolphin.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving; super.doRenderLiving(entitydolphin, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entitydolphin.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); //boolean flag2 = MoCreatures.proxy.getdisplayPetIcons(); if (entitydolphin.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entitydolphin.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entitydolphin.getHealth(); // maxhealth is always 30 for dolphins so we do not need to use a datawatcher float f7 = entitydolphin.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }