Java Code Examples for org.lwjgl.opengl.GL11#glTranslated()

The following examples show how to use org.lwjgl.opengl.GL11#glTranslated() . 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: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) {
    if (type == IItemRenderer.ItemRenderType.ENTITY) {
        GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
    } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
        GL11.glTranslatef(0.0F, 0.0F, -0.5F);
    }
    TileNode tjf = new TileNode();
    tjf.setAspects(aspects);
    tjf.setNodeType(nodeType);
    tjf.blockType = ConfigBlocks.blockAiry;
    tjf.blockMetadata = 0;
    GL11.glPushMatrix();
    GL11.glTranslated(0.5D, 0.5D, 0.5D);
    GL11.glScaled(2.0D, 2.0D, 2.0D);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glPopMatrix();
    GL11.glEnable(32826);
}
 
Example 2
Source File: ModuleRegulatorTube.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public IBaseModel getModel(){
    if(model == null) {
        model = new BaseModel("regulatorTubeModule.obj"){
            @Override
            public void renderStatic(float size, TileEntity te){
                GL11.glPushMatrix();
                GL11.glRotated(90, 0, -1, 0);
                GL11.glTranslated(10 / 16D, 24 / 16D, 0);
                if(renderItem) {
                    GL11.glTranslated(1 / 16D, -1 / 16D, 3 / 16D);
                }
                float scale = 1 / 16F;
                GL11.glScalef(scale, scale, scale);
                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                super.renderStatic(size, te);
                GL11.glPopMatrix();
            }
        };
    }
    return model;
}
 
Example 3
Source File: RenderRing.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick, float rotationYaw, float rotationPitch){
    GL11.glPushMatrix();
    double renderProgress = getInter(progress, lastTickLine.progress, partialTick);
    GL11.glTranslated((getInter(endX, lastTickLine.endX, partialTick) - startX) * renderProgress, (getInter(endY, lastTickLine.endY, partialTick) - startY) * renderProgress, (getInter(endZ, lastTickLine.endZ, partialTick) - startZ) * renderProgress);
    GL11.glRotatef(rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rotationPitch, 0.0F, 0.0F, 1.0F);
    Tessellator tess = Tessellator.instance;
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    tess.startDrawing(GL11.GL_LINE_LOOP);
    tess.setColorOpaque_I(color);
    double size = 5 / 16D;
    for(int i = 0; i < PneumaticCraftUtils.circlePoints; i++) {
        tess.addVertex(0, PneumaticCraftUtils.sin[i] * size, PneumaticCraftUtils.cos[i] * size);
    }
    tess.draw();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}
 
Example 4
Source File: RenderUtils.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void offsetRender() {
	Camera camera = BlockEntityRenderDispatcher.INSTANCE.camera;
	Vec3d camPos = camera.getPos();
	GL11.glRotated(MathHelper.wrapDegrees(camera.getPitch()), 1, 0, 0);
	GL11.glRotated(MathHelper.wrapDegrees(camera.getYaw() + 180.0), 0, 1, 0);
	GL11.glTranslated(-camPos.x, -camPos.y, -camPos.z);
}
 
Example 5
Source File: WidgetFluidFilter.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    if(fluid != null) {
        ResourceLocation icon = fluid.getStill();
        if(icon != null) {
            GL11.glColor4d(1, 1, 1, 1);
            GL11.glPushMatrix();
            GL11.glTranslated(x, y, 0);
            Minecraft.getMinecraft().getTextureManager().bindTexture(icon);
            BufferBuilder wr = Tessellator.getInstance().getBuffer();
            wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
            wr.pos(0, 0, 0).tex(0, 0).endVertex();
            wr.pos(0, 16, 0).tex(0, 1).endVertex();
            wr.pos(16, 16, 0).tex(1, 1).endVertex();
            wr.pos(16, 0, 0).tex(1, 0).endVertex();
            Tessellator.getInstance().draw();
            GL11.glPopMatrix();
        }
    }
}
 
Example 6
Source File: TunnellerHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void updateCyanList()
{
	GL11.glNewList(displayLists[0], GL11.GL_COMPILE);
	
	GL11.glPushMatrix();
	GL11.glTranslated(start.getX(), start.getY(), start.getZ());
	GL11.glTranslated(0.5, 0.5, 0.5);
	
	GL11.glColor4f(0, 1, 1, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawNode(new Box(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25));
	GL11.glEnd();
	
	RenderUtils.drawArrow(Vec3d.of(direction.getVector()).multiply(0.25),
		Vec3d.of(direction.getVector()).multiply(Math.max(0.5, length)));
	
	GL11.glPopMatrix();
	GL11.glEndList();
}
 
Example 7
Source File: RenderEntityChopperSeeds.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public void renderChopperSeeds(EntityChopperSeeds entity, double x, double y, double z, float var1, float partialTicks){
    float scaleFactor = 0.7F;
    GL11.glPushMatrix(); // start
    GL11.glTranslatef((float)x, (float)y, (float)z); // size
    // GL11.glScalef(1.0F, -1F, -1F);
    GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
    EntityItem ghostEntityItem = new EntityItem(entity.worldObj);
    ghostEntityItem.hoverStart = 0.0F;
    ghostEntityItem.setEntityItemStack(iStack);
    double radius = 0.25D;
    for(int i = 0; i < 4; i++) {
        GL11.glPushMatrix();
        GL11.glTranslated(Math.sin(0.5D * Math.PI * i + (entity.ticksExisted + partialTicks) * 0.4D) * radius, 0, Math.cos(0.5D * Math.PI * i + (entity.ticksExisted + partialTicks) * 0.4D) * radius);
        itemRenderer.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}
 
Example 8
Source File: GuiUnitProgrammer.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
protected void drawBorder(IProgWidget widget, int color){
    GL11.glPushMatrix();
    GL11.glTranslated(widget.getX() + guiLeft, widget.getY() + guiTop, 0);
    GL11.glScaled(0.5, 0.5, 1);
    drawVerticalLine(0, 0, widget.getHeight(), color);
    drawVerticalLine(widget.getWidth(), 0, widget.getHeight(), color);
    drawHorizontalLine(widget.getWidth(), 0, 0, color);
    drawHorizontalLine(widget.getWidth(), 0, widget.getHeight(), color);
    GL11.glPopMatrix();
}
 
Example 9
Source File: ModelAssemblyDrill.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public void renderModel(float size, float[] angles){
    Base.render(size);
    GL11.glPushMatrix();
    GL11.glRotatef(angles[0], 0, 1, 0);
    BaseTurn.render(size);
    BaseTurn2.render(size);
    GL11.glTranslated(0, 18 / 16F, 0);
    GL11.glRotatef(angles[1], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, 0);
    ArmBase1.render(size);
    ArmBase2.render(size);
    SupportMiddle.render(size);
    GL11.glTranslated(0, 18 / 16F, 6 / 16F);
    GL11.glRotatef(angles[2], 1, 0, 0);
    GL11.glTranslated(0, -18 / 16F, -6 / 16F);
    ArmMiddle1.render(size);
    ArmMiddle2.render(size);
    GL11.glTranslated(0, 3 / 16F, 6 / 16F);
    GL11.glRotatef(angles[3], 1, 0, 0);
    GL11.glTranslated(0, -3 / 16F, -6 / 16F);
    DrillBase.render(size);
    GL11.glTranslated(0, 3 / 16F, 0);
    GL11.glRotatef(angles[4], 0, 0, 1);
    GL11.glTranslated(0, -3 / 16F, 0);
    Drill.render(size);
    GL11.glPopMatrix();
}
 
Example 10
Source File: XRay.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onWorldRender(RenderWorldLastEvent event) {
    if (Wrapper.INSTANCE.world() != null && displayListId != 0) {
        double doubleX = RenderManager.renderPosX;
        double doubleY = RenderManager.renderPosY;
        double doubleZ = RenderManager.renderPosZ;
        GL11.glPushMatrix();
        GL11.glTranslated((-doubleX), (-doubleY), (-doubleZ));
        GL11.glCallList(displayListId);
        GL11.glPopMatrix();
    }
}
 
Example 11
Source File: PartFrame.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean drawHighlight(MovingObjectPosition hit, EntityPlayer player, float frame) {

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(0, 0, 0, 0.4F);
    GL11.glLineWidth(2);
    GL11.glDepthMask(true);
    GL11.glPushMatrix();
    RenderUtils.translateToWorldCoords(player, frame);
    GL11.glTranslated(x(), y(), z());
    {
        double d = 0.002;

        if (!is2D()) {
            RenderUtils.drawCuboidOutline(new Cuboid6(2 / 16D + d, isSideHidden(ForgeDirection.DOWN) ? d * 2 : -d * 2, 2 / 16D + d,
                    14 / 16D - d, 1 + (isSideHidden(ForgeDirection.UP) ? -d * 2 : d * 2), 14 / 16D - d));
            RenderUtils.drawCuboidOutline(new Cuboid6(isSideHidden(ForgeDirection.WEST) ? d * 2 : -d * 2, 2 / 16D + d, 2 / 16D + d,
                    1 + (isSideHidden(ForgeDirection.EAST) ? -d * 2 : d * 2), 14 / 16D - d, 14 / 16D - d));
            RenderUtils.drawCuboidOutline(new Cuboid6(2 / 16D + d, 2 / 16D + d, isSideHidden(ForgeDirection.NORTH) ? d : -d,
                    14 / 16D - d, 14 / 16D - d, 1 + (isSideHidden(ForgeDirection.SOUTH) ? -d * 2 : d * 2)));
        }

        RenderUtils.drawCuboidOutline(new Cuboid6(0, 0, 0, 1, 1, 1).expand(d));
    }
    GL11.glPopMatrix();
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);

    return true;
}
 
Example 12
Source File: RenderLaser.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public void doRender(Particle entity, double x, double y, double z,
		float f, float f1) {

	GL11.glPushMatrix();
	GL11.glTranslated(x, y, z);
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDisable(GL11.GL_FOG);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDepthMask(false);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

	Minecraft.getMinecraft().renderEngine.bindTexture(flare);
	//bindTexture(flare);

	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

	GlStateManager.color(flareColor[0],flareColor[1],flareColor[2],flareColor[3]);

	for(int i = 0; i < 4; i++) {
		RenderHelper.renderBottomFaceWithUV(buffer, -y + 200, -(i*6) - x, -(i*6) - z, (i*6) - x, (i*6) - z, 0, 1, 0, 1);
	}

	Tessellator.getInstance().draw();

	GL11.glDisable(GL11.GL_TEXTURE_2D);
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0);
	//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
	GlStateManager.color(color[0], color[1], color[2], color[3]);//0.9F, 0.2F, 0.3F, 0.5F);

	for(float radius = 0.25F; radius < size; radius += .25F) {

		for(double i = 0; i < 2*Math.PI; i += Math.PI) {
			buffer.pos(- x , -y + 200,  - z).endVertex();
			buffer.pos(- x, -y + 200, - z).endVertex();
			buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,- (radius* Math.sin(i)) + 0.5F).endVertex();
			buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, (radius* Math.cos(i)) + 0.5F).endVertex();
		}

		for(double i = 0; i < 2*Math.PI; i += Math.PI) {
			buffer.pos(- x, -y + 200,- z).endVertex();
			buffer.pos(- x, -y + 200, - z).endVertex();
			buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, -(radius* Math.cos(i)) + 0.5F).endVertex();
			buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,(radius* Math.sin(i)) + 0.5F).endVertex();
		}
	}

	Tessellator.getInstance().draw();

	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_FOG);
	GL11.glDepthMask(true);
	GL11.glPopMatrix();
	
	GlStateManager.color(1f, 1f, 1f,1f);
	//Clean up and make player not transparent
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0);

}
 
Example 13
Source File: ClickGuiScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public void render(MatrixStack matrix, int mX, int mY, float float_1) {
	this.renderBackground(matrix);
	textRenderer.draw(matrix, "BleachHack-1.16-" + BleachHack.VERSION, 3, 3, 0x305090);
	textRenderer.draw(matrix, "BleachHack-1.16-" + BleachHack.VERSION, 2, 2, 0x6090d0);
	textRenderer.drawWithShadow(matrix, "Hover over a bind setting and press a key to change a bind" , 2, height-10, 0xff9999);
	textRenderer.drawWithShadow(matrix, "Use .guireset to reset the gui" , 2, height-20, 0x9999ff);
	
	super.render(matrix, mX, mY, float_1);
	
	mouseX = mX;
	mouseY = mY;
	
	len = Math.max(50, (int) Math.round(ModuleManager.getModule(ClickGui.class).getSettings().get(0).toSlider().getValue()));
	for (Window w: windows) {
		if (w instanceof ModuleWindow) {
			ModuleWindow mw = (ModuleWindow) w;
			
			int x = mw.x1 + 1;
			int y = mw.y1 + 13;
			mw.x2 = x + len + 1;
			
			if (rmDown && mouseOver(x, y-12, x+len, y)) {
				client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
				mw.hiding = !mw.hiding;
			}
			
			if (mw.hiding) {
				mw.y2 = y;
				continue;
			} else {
				mw.y2 = y + mw.getHeight();
			}
			
			int count = 0;
			for (Entry<Module, Boolean> m: new LinkedHashMap<>(mw.mods).entrySet()) {
				if (m.getValue()) fillReverseGrey(matrix, x, y+(count*12), x+len-1, y+12+(count*12));
				fill(matrix, x, y+(count*12), x+len, y+12+(count*12),
						mouseOver(x, y+(count*12), x+len, y+12+(count*12)) ? 0x70303070 : 0x00000000);
				
				textRenderer.drawWithShadow(matrix, cutText(m.getKey().getName(), len),
						x+2, y+2+(count*12), m.getKey().isToggled() ? 0x70efe0 : 0xc0c0c0);
				
				//fill(m.getValue() ? x+len-2 : x+len-1, y+(count*12), 
				//		x+len, y+12+(count*12), m.getValue() ? 0x9f70fff0 : 0x5f70fff0);
				
				/* Set which module settings show on */
				if (mouseOver(x, y+(count*12), x+len, y+12+(count*12))) {
					GL11.glTranslated(0, 0, 300);
					/* Match lines to end of words */
			        Matcher mat = Pattern.compile("\\b.{1,22}\\b\\W?").matcher(m.getKey().getDesc());

			        int c2 = 0;
			        int c3 = 0;
			        while(mat.find()) { c2++; } mat.reset();
			        
			        while(mat.find()) {
			        	fill(matrix, x+len+3, y-1+(count*12)-(c2 * 10)+(c3 * 10),
			        			x+len+6+textRenderer.getWidth(mat.group().trim()), y+(count*12)-(c2 * 10)+(c3 * 10)+9,
								0x90000000);
			        	textRenderer.drawWithShadow(matrix, mat.group(), x+len+5, y+(count*12)-(c2 * 10)+(c3 * 10), -1);
						c3++;
					}
					if (lmDown) m.getKey().toggle();
					if (rmDown) mw.mods.replace(m.getKey(), !m.getValue());
					if (lmDown || rmDown) client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
					GL11.glTranslated(0, 0, -300);
				}
				
				/* draw settings */
				if (m.getValue()) {
					for (SettingBase s: m.getKey().getSettings()) {
						count++;
						if (s instanceof SettingMode) drawModeSetting(matrix, s.toMode(), x, y+(count*12));
						if (s instanceof SettingToggle) drawToggleSetting(matrix, s.toToggle(), x, y+(count*12));
						if (s instanceof SettingSlider) drawSliderSetting(matrix, s.toSlider(), x, y+(count*12));
						//fill(x+len-1, y+(count*12), x+len, y+12+(count*12), 0x9f70fff0);
					}
					count++;
					drawBindSetting(matrix, m.getKey(), keyDown, x, y+(count*12));
					//fill(x+len-1, y+(count*12), x+len, y+12+(count*12), 0x9f70fff0);
				}
				count++;
			}
		}
	}
	
	lmDown = false;
	rmDown = false;
	keyDown = -1;
}
 
Example 14
Source File: RenderUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static void translateToPlayer(Entity e, float partialTickTime) {
	GL11.glTranslated(
			interpolateValue(e.posX, e.prevPosX, partialTickTime) - TileEntityRendererDispatcher.staticPlayerX,
			interpolateValue(e.posY, e.prevPosY, partialTickTime) - TileEntityRendererDispatcher.staticPlayerY,
			interpolateValue(e.posZ, e.prevPosZ, partialTickTime) - TileEntityRendererDispatcher.staticPlayerZ);
}
 
Example 15
Source File: KillauraHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	if(target == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	AxisAlignedBB box = new AxisAlignedBB(BlockPos.ORIGIN);
	float p = (target.getMaxHealth() - target.getHealth())
		/ target.getMaxHealth();
	float red = p * 2F;
	float green = 2 - red;
	
	GL11.glTranslated(target.posX, target.posY, target.posZ);
	GL11.glTranslated(0, 0.05, 0);
	GL11.glScaled(target.width, target.height, target.width);
	GL11.glTranslated(-0.5, 0, -0.5);
	
	if(p < 1)
	{
		GL11.glTranslated(0.5, 0.5, 0.5);
		GL11.glScaled(p, p, p);
		GL11.glTranslated(-0.5, -0.5, -0.5);
	}
	
	GL11.glColor4f(red, green, 0, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(box);
	GL11.glEnd();
	
	GL11.glColor4f(red, green, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEnd();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 16
Source File: RenderUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static void translateToWorld(Entity e, float partialTickTime) {
	GL11.glTranslated(
			interpolateValue(e.posX, e.prevPosX, partialTickTime),
			interpolateValue(e.posY, e.prevPosY, partialTickTime),
			interpolateValue(e.posZ, e.prevPosZ, partialTickTime));
}
 
Example 17
Source File: ModelAssemblyController.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void renderModel(float size, boolean[] connectedSides, boolean shouldFacePlayer, String displayedText, boolean hasProblem){
    Base.render(size);
    GL11.glPushMatrix();
    if(connectedSides[ForgeDirection.NORTH.ordinal()]) {
        InputBack1.render(size);
        InputBack2.render(size);
        InputBack3.render(size);
        InputBack4.render(size);
        InputBack5.render(size);
        InputBack6.render(size);
        InputBack7.render(size);
    }
    GL11.glRotated(90, 0, 1, 0);
    if(connectedSides[ForgeDirection.EAST.ordinal()]) {
        InputBack1.render(size);
        InputBack2.render(size);
        InputBack3.render(size);
        InputBack4.render(size);
        InputBack5.render(size);
        InputBack6.render(size);
        InputBack7.render(size);
    }
    GL11.glRotated(90, 0, 1, 0);
    if(connectedSides[ForgeDirection.SOUTH.ordinal()]) {
        InputBack1.render(size);
        InputBack2.render(size);
        InputBack3.render(size);
        InputBack4.render(size);
        InputBack5.render(size);
        InputBack6.render(size);
        InputBack7.render(size);
    }
    GL11.glRotated(90, 0, 1, 0);
    if(connectedSides[ForgeDirection.WEST.ordinal()]) {
        InputBack1.render(size);
        InputBack2.render(size);
        InputBack3.render(size);
        InputBack4.render(size);
        InputBack5.render(size);
        InputBack6.render(size);
        InputBack7.render(size);
    }
    GL11.glPopMatrix();
    if(shouldFacePlayer) GL11.glRotatef(180 + RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    ScreenLeg.render(size);
    Screen.render(size);
    ScreenLegPart.render(size);
    double textSize = 1 / 100D;
    GL11.glTranslated(-0.25D, 0.53D, 0.04D);
    GL11.glRotated(-34, 1, 0, 0);
    GL11.glScaled(textSize, textSize, textSize);
    GL11.glDisable(GL11.GL_LIGHTING);
    Minecraft.getMinecraft().fontRenderer.drawString(displayedText, 1, 4, 0xFFFFFFFF);
    if(hasProblem) GuiPneumaticContainerBase.drawTexture(Textures.GUI_PROBLEMS_TEXTURE, 28, 12);
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 18
Source File: RenderUtils.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
public static void drawArrow(Vec3d from, Vec3d to)
{
	double startX = WVec3d.getX(from);
	double startY = WVec3d.getY(from);
	double startZ = WVec3d.getZ(from);
	
	double endX = WVec3d.getX(to);
	double endY = WVec3d.getY(to);
	double endZ = WVec3d.getZ(to);
	
	GL11.glPushMatrix();
	
	GL11.glBegin(GL11.GL_LINES);
	GL11.glVertex3d(startX, startY, startZ);
	GL11.glVertex3d(endX, endY, endZ);
	GL11.glEnd();
	
	GL11.glTranslated(endX, endY, endZ);
	GL11.glScaled(0.1, 0.1, 0.1);
	
	double angleX = Math.atan2(endY - startY, startZ - endZ);
	GL11.glRotated(Math.toDegrees(angleX) + 90, 1, 0, 0);
	
	double angleZ = Math.atan2(endX - startX,
		Math.sqrt(Math.pow(endY - startY, 2) + Math.pow(endZ - startZ, 2)));
	GL11.glRotated(Math.toDegrees(angleZ), 0, 0, 1);
	
	GL11.glBegin(GL11.GL_LINES);
	GL11.glVertex3d(0, 2, 1);
	GL11.glVertex3d(-1, 2, 0);
	
	GL11.glVertex3d(-1, 2, 0);
	GL11.glVertex3d(0, 2, -1);
	
	GL11.glVertex3d(0, 2, -1);
	GL11.glVertex3d(1, 2, 0);
	
	GL11.glVertex3d(1, 2, 0);
	GL11.glVertex3d(0, 2, 1);
	
	GL11.glVertex3d(1, 2, 0);
	GL11.glVertex3d(-1, 2, 0);
	
	GL11.glVertex3d(0, 2, 1);
	GL11.glVertex3d(0, 2, -1);
	
	GL11.glVertex3d(0, 0, 0);
	GL11.glVertex3d(1, 2, 0);
	
	GL11.glVertex3d(0, 0, 0);
	GL11.glVertex3d(-1, 2, 0);
	
	GL11.glVertex3d(0, 0, 0);
	GL11.glVertex3d(0, 2, -1);
	
	GL11.glVertex3d(0, 0, 0);
	GL11.glVertex3d(0, 2, 1);
	GL11.glEnd();
	
	GL11.glPopMatrix();
}
 
Example 19
Source File: RenderBlockArrows.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(World world, int x, int y, int z, float partialTicks){
    // if(true) return;
    Block block = world.getBlock(x, y, z);
    block.setBlockBoundsBasedOnState(world, x, y, z);
    double minX = block.getBlockBoundsMinX();
    double minY = block.getBlockBoundsMinY();
    double minZ = block.getBlockBoundsMinZ();
    double maxX = block.getBlockBoundsMaxX();
    double maxY = block.getBlockBoundsMaxY();
    double maxZ = block.getBlockBoundsMaxZ();
    if(ticksExisted > 10) ticksExisted = 0;
    float progress = (ticksExisted + partialTicks) / 10F;
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(1, 1, 1, progress);
    GL11.glPushMatrix();
    GL11.glTranslated(-0.5D, -0.5D, -0.5D);

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}
 
Example 20
Source File: RendererPipe.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void render(TileEntity tile, double x, double y,
		double z, float f, int damage, float a) {
	
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();

	GL11.glPushMatrix();

	GL11.glTranslated(x + 0.5F, y + 0.5F, z + 0.5F);
	
	bindTexture(texture);
	
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	//GL11.glDisable(GL11.GL_LIGHTING);
	GlStateManager.color(0.4f, 0.4f, 0.4f);
	for(int i=0; i < 6; i++) {
		if(((TilePipe)tile).canConnect(i)) {
			GL11.glPushMatrix();

			EnumFacing dir = EnumFacing.values()[i];

			GL11.glTranslated(0.5*dir.getFrontOffsetX(), 0.5*dir.getFrontOffsetY(), 0.5*dir.getFrontOffsetZ());
			
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL);

			//buffer.color(.4f, 0.4f, 0.4f,1f);
			RenderHelper.renderCube(buffer, -0.25f,  -0.25f,  -0.25f,  0.25f, 0.25f, 0.25f);
				//drawCube(0.25D, tessellator);
			//}
			Tessellator.getInstance().draw();

			GL11.glPopMatrix();
		}
	}
	GlStateManager.color(1f,1f,1f);

	//GL11.glDisable(GL11.GL_BLEND);
	//GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glPopMatrix();
}