List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:com.builtbroken.grappling.content.entity.RenderHook.java
@Override public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix();//from w w w.j ava2 s. c o m GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glDisable(GL11.GL_LIGHTING); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); FMLClientHandler.instance().getClient().renderEngine.bindTexture(getEntityTexture(entity)); if (entity instanceof EntityHook) { final Hook hook = ((EntityHook) entity).hook; if (hook != null) { switch (hook.side) { //Bottom case 0: GL11.glRotatef(-90, 1, 0, 0); break; //Top case 1: GL11.glRotatef(90, 1, 0, 0); break; //North case 2: //Default rotation break; //South case 3: GL11.glRotatef(180, 0, 1, 0); break; case 4: GL11.glRotatef(90, 0, 1, 0); break; case 5: GL11.glRotatef(-90, 0, 1, 0); break; } } } MODEL.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.builtbroken.grappling.content.item.ItemHookRenderer.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();//from w w w. j ava 2 s . c o m FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); Entity entity = null; if (data != null && data.length >= 2 && data[1] instanceof Entity) { entity = (Entity) data[1]; } if (type == ItemRenderType.EQUIPPED) { //TODO have rotation match aiming point GL11.glRotatef(-130, 0, 1, 0); //GL11.glRotatef(13, 1, 0, 0); GL11.glTranslatef(0.1f, 0.4f, -1.2f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); if (entity != null && entity == Minecraft.getMinecraft().thePlayer) { if (ClientHookHandler.hook != null) { MODEL.renderAllExcept("group5", "Component_20"); } else { MODEL.renderAll(); } } else { MODEL.renderAll(); } } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glRotatef(140, 0, 1, 0); GL11.glRotatef(-13, 1, 0, 0); GL11.glTranslatef(-0.2f, 0.6f, -0.5f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); if (ClientHookHandler.hook != null) { MODEL.renderAllExcept("group5", "Component_20"); } else { MODEL.renderAll(); } } else if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(0f, 0, -0.9f); final float scale = 0.0625f / 3; GL11.glScalef(scale, scale, scale); MODEL.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.ams.TileAMSClient.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { GL11.glTranslatef(0.5f, 0, 0.5f); GL11.glRotatef(90, 0, 1, 0);/*from w w w . j ava 2 s . c om*/ FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.AMS_TEXTURE); Assets.AMS_BOTTOM_MODEL.renderAll(); GL11.glTranslatef(0, 0.5f, 0); Assets.AMS_TOP_MODEL.renderAll(); }
From source file:com.builtbroken.icbm.content.ams.TileAMSClient.java
@SideOnly(Side.CLIENT) public void renderDynamic(Pos pos, float deltaTime, int pass) { //Lerp rotation values so not to have snapping effects(looks bad) if (!currentAim.isWithin(aim, 1)) { currentAim.moveTowards(aim, ROTATION_SPEED, deltaTime).clampTo360(); }//w w w .j av a2 s .c o m lastRotationUpdate = System.nanoTime(); GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f); GL11.glRotatef((float) ((currentAim.yaw() + 90f) % 360), 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.AMS_TEXTURE); Assets.AMS_BOTTOM_MODEL.renderAll(); GL11.glTranslatef(0, 0.5f, 0); GL11.glRotatef((float) currentAim.pitch(), 0, 0, 1); Assets.AMS_TOP_MODEL.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java
@Override @SideOnly(Side.CLIENT)//from w w w . j a v a 2s . c o m public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); if (getDirection() == ForgeDirection.EAST) { GL11.glRotated(-90, 0, 1, 0); } else if (getDirection() == ForgeDirection.WEST) { GL11.glRotated(90, 0, 1, 0); } else if (getDirection() == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); } Assets.CART1x3.renderAll(); GL11.glPopMatrix(); //render missile if (completedMissile != null) { GL11.glPushMatrix(); TileSmallMissileWorkstationClient.renderMissile(pos, completedMissile, ForgeDirection.UP, getDirection()); GL11.glPopMatrix(); } else if (startedMissile != null) { GL11.glPushMatrix(); TileSmallMissileWorkstationClient.renderMissile(pos, startedMissile, ForgeDirection.UP, getDirection()); GL11.glPopMatrix(); } }
From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { GL11.glTranslatef(0f, 0f, 0f); GL11.glRotatef(-20f, 0, 1, 0);/*from w w w. j a v a 2 s.c om*/ GL11.glScaled(.7f, .7f, .7f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); Assets.CART1x3.renderAll(); }
From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { GL11.glTranslatef(-1f, 0f, 0.1f); GL11.glRotatef(-20f, 0, 1, 0);/*from w ww . j a v a 2 s . co m*/ GL11.glScaled(.7f, .7f, .7f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); Assets.SMALL_MISSILE_STATION_MODEL2.renderAll(); //TODO add work table }
From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java
@SideOnly(Side.CLIENT) public static void renderDynamic(Pos pos, Pos offset, ForgeDirection connectedBlockSide, ForgeDirection direction, IMissile missile, float frame, int pass) { //Render launcher GL11.glPushMatrix();//from ww w . j a v a 2 s. c om GL11.glTranslatef(pos.xf() + offset.xf(), pos.yf() + offset.yf(), pos.zf() + offset.zf()); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); int tableX = 2; //Keep in mind the directions are of the facing block switch (connectedBlockSide) { case UP: if (direction == ForgeDirection.EAST) { GL11.glRotated(-90, 0, 1, 0); //x y z GL11.glTranslatef(-2, 0f, -1); } else if (direction == ForgeDirection.WEST) { GL11.glRotated(90, 0, 1, 0); //x y z GL11.glTranslatef(-1, 0f, 2); } else if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); //x y z GL11.glTranslatef(-3, 0f, 1); } break; case DOWN: GL11.glRotated(180, 1, 0, 0); // z y x GL11.glTranslatef(0f, -1f, 1f); if (direction == ForgeDirection.WEST) { GL11.glRotated(-90, 0, 1, 0); //x y z GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(90, 0, 1, 0); //x y z GL11.glTranslatef(-1f, 0f, 2f); } else if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); //x y z GL11.glTranslatef(-3, 0f, 1); } break; case EAST: GL11.glRotated(90, 1, 0, 0); // z x y GL11.glTranslatef(0f, -1f, 0f); if (direction == ForgeDirection.DOWN) { GL11.glRotated(-90, 0, 1, 0); // y x z GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.UP) { GL11.glRotated(90, 0, 1, 0); // y x z GL11.glTranslatef(-1f, 0f, 2f); } if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); // y x z GL11.glTranslatef(-3f, 0f, 1f); } break; case WEST: GL11.glRotated(-90, 1, 0, 0); // z x y if (direction == ForgeDirection.UP) { GL11.glRotated(-90, 0, 1, 0); // y x z GL11.glTranslatef(-1f, 0f, -1f); } else if (direction == ForgeDirection.DOWN) { GL11.glRotated(90, 0, 1, 0); // y x z GL11.glTranslatef(-2f, 0f, 2f); } else { GL11.glTranslatef(0f, 0f, 1f); if (direction == ForgeDirection.SOUTH) { GL11.glRotated(180, 0, 1, 0); // y x z GL11.glTranslatef(-3f, 0f, 1f); } } break; case NORTH: GL11.glRotated(90, 0, 1, 0); GL11.glRotated(90, 1, 0, 0); // y x z GL11.glTranslatef(-1f, 1f, 0f); if (direction == ForgeDirection.DOWN) { GL11.glRotated(-90, 0, 1, 0); // y z x GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(180, 0, 1, 0); GL11.glTranslatef(-3f, 0f, 1f); } else if (direction == ForgeDirection.UP) { GL11.glRotated(90, 0, 1, 0); // y z x GL11.glTranslatef(-1f, 0f, 2f); } break; case SOUTH: GL11.glRotated(90, 0, 1, 0); GL11.glRotated(-90, 1, 0, 0); // x z y GL11.glTranslatef(-1f, -2f, 1f); if (direction == ForgeDirection.UP) { GL11.glRotated(-90, 0, 1, 0); // y z x GL11.glTranslatef(-2f, 0f, -1f); } else if (direction == ForgeDirection.EAST) { GL11.glRotated(180, 0, 1, 0); // x z y GL11.glTranslatef(-3f, 0, 1f); } else if (direction == ForgeDirection.DOWN) { GL11.glRotated(90, 0, 1, 0); // y z x GL11.glTranslatef(-1f, 0f, 2f); } break; } Assets.SMALL_MISSILE_STATION_MODEL2.renderAll(); GL11.glTranslatef(tableX, 0, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE); SharedAssets.TOOL_TABLE.renderAll(); GL11.glPopMatrix(); //render missile if (missile != null) { GL11.glPushMatrix(); renderMissile(pos, missile, connectedBlockSide, direction); GL11.glPopMatrix(); } }
From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java
/** * Handles rendering of the missile/*w ww . j a v a 2 s. com*/ * * @param pos - offset for render */ public static void renderMissile(Pos pos, IMissile misssile, ForgeDirection connectedBlockSide, ForgeDirection direction) { ///Center render view to tile center GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.5f, pos.zf() + 0.5f); //Slight scale of the lenght to fit on the table GL11.glScaled(1, .9, 1); //Handles setting the rotation based on the side switch (connectedBlockSide) { case UP: case DOWN: handleMissileRotationUD(direction); break; case EAST: case WEST: handleMissileRotationEW(direction); break; case SOUTH: case NORTH: handleMissileRotationNS(direction); break; } //Moves the missile slightly over to sit on its rack GL11.glTranslatef(0, -0.4f, 0); //Bind texture FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_MISSILE_TEXTURE); //Group_001 body //Component_1_001 - 4 Body Fins if (misssile.getWarhead() != null) { //Group_004 nose of warhead //Group_005 warhead Assets.SMALL_MISSILE_MODEL.renderOnly("Group_005"); if (misssile.getWarhead().getExplosive() != null) { Assets.SMALL_MISSILE_MODEL.renderOnly("Group_004"); } } if (misssile.getEngine() != null) { //Group_002 - Engine thruster //Group_003 - Engine case //Component_3_001 - 8 Engine lower segments //Component_2_001 - 4 Engine fins Assets.SMALL_MISSILE_MODEL.renderOnly("Group_002", "Group_003"); for (int i = 1; i < 9; i++) { Assets.SMALL_MISSILE_MODEL.renderOnly("Component_3_00" + i); } for (int i = 1; i < 5; i++) { Assets.SMALL_MISSILE_MODEL.renderOnly("Component_2_00" + i); } } if (misssile.getGuidance() != null) { //TODO add model indication showing no guidance added } //Render body and fins Assets.SMALL_MISSILE_MODEL.renderOnly("Group_001", "Component_1_001", "Component_1_002", "Component_1_003", "Component_1_004"); }
From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStationClient.java
@Override @SideOnly(Side.CLIENT)/*ww w . j a va 2s.c o m*/ public void renderDynamic(Pos pos, float frame, int pass) { GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 1, pos.yf(), pos.zf() + 1); GL11.glRotated(90, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE); SharedAssets.TOOL_TABLE.renderAll(); //TODO render warhead on table, remove some tools GL11.glPopMatrix(); //TODO render warhead //TODO render explosives }