List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.kegare.frozenland.client.renderer.FrozenlandSkyRenderer.java
License:Minecraft Mod Public
@Override public void render(float ticks, WorldClient world, Minecraft mc) { GL11.glPushMatrix();/*from w w w .j a v a 2 s. co m*/ GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(ticks) * 360.0F, 1.0F, 0.0F, 0.0F); float color = world.getStarBrightness(ticks) * (1.0F - world.getRainStrength(ticks)); if (color > 0.0F) { GL11.glColor4f(color, color, color, color); GL11.glCallList(starGLCallList); } GL11.glPopMatrix(); }
From source file:com.kegare.frozenland.client.renderer.RenderIceball.java
License:Minecraft Mod Public
private void doRender(Tessellator tessellator, IIcon icon) { float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads();/*from www.ja va 2s .co m*/ tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3); tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3); tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2); tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2); tessellator.draw(); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Triangle/*w w w . j a va 2s . c o m*/ * * @param cx * @param cy * @param c */ public static void drawTri(int cx, int cy, int c) { GL11.glRotatef(180, 0F, 0F, 1.0F); float f = ((c >> 24) & 0xff) / 255F; float f1 = ((c >> 16) & 0xff) / 255F; float f2 = ((c >> 8) & 0xff) / 255F; float f3 = (c & 0xff) / 255F; GL11.glColor4f(f1, f2, f3, f); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glBlendFunc(770, 771); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glRotatef(180, 0F, 0F, 1.0F); GL11.glVertex2d(cx, cy + 2); GL11.glVertex2d(cx + 2, cy - 2); GL11.glVertex2d(cx - 2, cy - 2); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glRotatef(-180, 0F, 0F, 1.0F); }
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Triangle. Used for radars//from w ww. jav a 2 s .c o m * * @param e * @param cx * @param cy * @param c */ public static void drawTriangle(Entity e, double cx, double cy, int c) { GL11.glPushMatrix(); GL11.glScaled(0.5, 0.5, 0.5); GL11.glTranslated(cx, cy, 0); if (e instanceof EntityClientPlayerMP) { GL11.glRotatef(e.rotationYaw, 0F, 0F, 1.0F); } else { GL11.glRotatef(-e.rotationYaw, 0F, 0F, 1.0F); } float f = ((c >> 24) & 0xff) / 255F; float f1 = ((c >> 16) & 0xff) / 255F; float f2 = ((c >> 8) & 0xff) / 255F; float f3 = (c & 0xff) / 255F; GL11.glColor4f(f1, f2, f3, f); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glBlendFunc(770, 771); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glVertex2d(0, 0 + 6); GL11.glVertex2d(0 + 3, 0 - 2); GL11.glVertex2d(0 - 3, 0 - 2); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glRotatef(e.rotationYaw, 0F, 0F, 1.0F); GL11.glPopMatrix(); }
From source file:com.mcgoodtime.productionline.client.RenderEntityThrowable.java
License:MIT License
private void draw(Tessellator tessellator, IIcon icon) { float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads();/* w w w . j a v a 2s .c om*/ tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3); tessellator.addVertexWithUV((double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3); tessellator.addVertexWithUV((double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2); tessellator.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2); tessellator.draw(); }
From source file:com.minestellar.api.blocks.WireSpecialRender.java
License:Open Source License
/** * Draws the connector of a line of at least 3 wires connected to each others */// w w w .j a v a 2 s . c o m public void drawStraight(ForgeDirection direction) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.SOUTH) || direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(90, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST) || direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(90, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); { tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); if (drawInside) { tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelX); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.SOUTH) || direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(-90, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST) || direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(-90, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } }
From source file:com.minestellar.api.blocks.WireSpecialRender.java
License:Open Source License
/** * Draws the connector with other wires adjacent to other wires *//*w w w.j a v a 2 s . c o m*/ private void drawConnector(ForgeDirection direction) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.UP)) { // ROTATE } else if (direction.equals(ForgeDirection.DOWN)) { GL11.glRotatef(180, 1, 0, 0); } else if (direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(90, 1, 0, 0); } else if (direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(270, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(90, 0, 0, 1); } else if (direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(270, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); { tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 5 * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); if (drawInside) { tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.UP)) { // NOPE } else if (direction.equals(ForgeDirection.DOWN)) { GL11.glRotatef(-180, 1, 0, 0); } else if (direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(-90, 1, 0, 0); } else if (direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(-270, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(-90, 0, 0, 1); } else if (direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(-270, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } }
From source file:com.minestellar.api.core.WireSpecialRender.java
License:Open Source License
/** * Draws the connector of a line of at least 3 wires connected to each others *//*from ww w. jav a 2 s . c o m*/ public void drawStraight(ForgeDirection direction) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.SOUTH) || direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(90, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST) || direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(90, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); { tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); if (drawInside) { tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelX); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, (imageDimensionX - blockDimension - 1) * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 0, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.SOUTH) || direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(-90, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST) || direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(-90, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } }
From source file:com.minestellar.api.core.WireSpecialRender.java
License:Open Source License
/** * Draws the connector with other wires adjacent to other wires *//*w ww . ja v a 2 s . c o m*/ private void drawConnector(ForgeDirection direction) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); { GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.UP)) { // ROTATE } else if (direction.equals(ForgeDirection.DOWN)) { GL11.glRotatef(180, 1, 0, 0); } else if (direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(90, 1, 0, 0); } else if (direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(270, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(90, 0, 0, 1); } else if (direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(270, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); { tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 5 * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); if (drawInside) { tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(1 - location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(1 - location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, location * pixel / 2, blockDimension * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, location * pixel / 2, blockDimension * 2 * texturePixelX, 0); tessellator.addVertexWithUV(location * pixel / 2, 1, 1 - location * pixel / 2, blockDimension * 2 * texturePixelX, blockDimension * texturePixelY); tessellator.addVertexWithUV(location * pixel / 2, 1 - location * pixel / 2, 1 - location * pixel / 2, blockDimension * texturePixelX, blockDimension * texturePixelY); } } tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (direction.equals(ForgeDirection.UP)) { // NOPE } else if (direction.equals(ForgeDirection.DOWN)) { GL11.glRotatef(-180, 1, 0, 0); } else if (direction.equals(ForgeDirection.SOUTH)) { GL11.glRotatef(-90, 1, 0, 0); } else if (direction.equals(ForgeDirection.NORTH)) { GL11.glRotatef(-270, 1, 0, 0); } else if (direction.equals(ForgeDirection.WEST)) { GL11.glRotatef(-90, 0, 0, 1); } else if (direction.equals(ForgeDirection.EAST)) { GL11.glRotatef(-270, 0, 0, 1); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } }
From source file:com.minestellar.core.render.tile.TileEntityRenderAntenna.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { this.bindTexture(new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/antenna.png")); GL11.glPushMatrix();/*from w w w . ja v a 2 s . c o m*/ GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); modelAntenna.renderModel(0.0625F); // model.render(null, 0.04F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0625F); GL11.glPopMatrix(); }