当前位置: 首页>>代码示例>>Java>>正文


Java GlStateManager.pushAttrib方法代码示例

本文整理汇总了Java中net.minecraft.client.renderer.GlStateManager.pushAttrib方法的典型用法代码示例。如果您正苦于以下问题:Java GlStateManager.pushAttrib方法的具体用法?Java GlStateManager.pushAttrib怎么用?Java GlStateManager.pushAttrib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.renderer.GlStateManager的用法示例。


在下文中一共展示了GlStateManager.pushAttrib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawItemstackTooltip

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
private void drawItemstackTooltip(ItemStack stack, int x, int y, int mouseX, int mouseY, GuiScreen notebook)
{
	if (mouseX >= x && mouseY >= y && mouseX <= x + 16 && mouseY <= y + 16)
	{
		if (stack != null && !stack.isEmpty())
		{
			// A seperate matrix because tooltip rendering changes a bunch of things that we don't want
			GlStateManager.pushMatrix();
			GlStateManager.pushAttrib();

			// Cache the itemstack for drawing
			net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);

			// Actually draw the tooltip
			notebook.drawHoveringText(notebook.getItemToolTip(stack), mouseX, mouseY);

			// Goodbye cached itemstack
			net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();

			// Matrix now gone see u again soon
			GlStateManager.popAttrib();
			GlStateManager.popMatrix();
		}
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:26,代码来源:NotebookEntryCraftingRecipe.java

示例2: render

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
@Override
public void render(TilePotteryKiln te, double x, double y, double z, float partialTicks, int destroyStage,
		float alpha) {
	GlStateManager.pushAttrib();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	GlStateManager.disableRescaleNormal();
	if(te.getWorld().getBlockState(te.getPos()).getBlock()==BlocksRegistry.potteryKiln&&te.getWorld().getBlockState(te.getPos()).getValue(BlockPotteryKiln.TYPE)==EnumKilnTypes.EMPTY){
		ItemStack stack=te.pottery.getStackInSlot(0);
		if(!stack.isEmpty()){
			item=new EntityItem(te.getWorld());
			item.setItem(stack);
			item.hoverStart=0F;
			RenderHelper.enableStandardItemLighting();
			GlStateManager.enableLighting();
			GlStateManager.pushMatrix();
			GlStateManager.translate(0.5D, -0.1D, 0.5D);
			GlStateManager.scale(1D, 1D, 1D);
			Minecraft.getMinecraft().getRenderManager().renderEntity(item, 0, 0, 0, 0, 0, false);
			GlStateManager.popMatrix();
		}
	}
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:26,代码来源:TESRPotteryKiln.java

示例3: renderTileEntityAt

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TilePedestal te, double x, double y, double z, float partialTicks, int destroyStage) {
    GlStateManager.pushAttrib();
    GlStateManager.pushMatrix();

    GlStateManager.translate(x, y, z);
    GlStateManager.disableRescaleNormal();

    renderItem(te);

    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:14,代码来源:TESRPedestal.java

示例4: renderItemWithTransform

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public static void renderItemWithTransform(World world, ItemStack stack,
		ItemCameraTransforms.TransformType transform)
{
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();
	GlStateManager.enableCull();
	GlStateManager.depthMask(true);
	RenderHelper.enableStandardItemLighting();
	GlStateManager.enableAlpha();
	GlStateManager.enableRescaleNormal();
	GlStateManager.alphaFunc(516, 0.1F);
	GlStateManager.enableBlend();
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
			GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
			GlStateManager.DestFactor.ZERO);

	IBakedModel ibakedmodel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world,
			(EntityLivingBase) null);
	IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel,
			transform, false);
	Minecraft.getMinecraft().getRenderItem().renderItem(stack, transformedModel);

	GlStateManager.disableBlend();
	GlStateManager.disableAlpha();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.depthMask(false);
	GlStateManager.disableCull();
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:31,代码来源:GLHelper.java

示例5: drawCircle2D

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public static void drawCircle2D(double radius, double x, double y, Color color, int accuracy, int lineWidth)
{
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();

	GlStateManager.disableTexture2D();
	GlStateManager.enableBlend();
	GlStateManager.disableAlpha();
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
			GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
			GlStateManager.DestFactor.ZERO);
	GlStateManager.shadeModel(7425);

	GL11.glLineWidth(lineWidth);
	Tessellator tes = Tessellator.getInstance();
	BufferBuilder vb = tes.getBuffer();
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	for (int seg = 0; seg < (360 / accuracy); seg++)
	{
		vb.pos(x + (Math.cos(Math.toRadians(seg * accuracy)) * radius),
				y + (Math.sin(Math.toRadians(seg * accuracy)) * radius), 0)
				.color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();
	}
	tes.draw();

	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.disableBlend();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.enableTexture2D();
	GlStateManager.enableAlpha();
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:36,代码来源:GLHelper.java

示例6: onRenderHand

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onRenderHand(RenderSpecificHandEvent ev)
{
	EntityPlayer player = Minecraft.getMinecraft().player;
	if (!player.isSneaking() && ev.getItemStack().getItem() instanceof ItemParchment)
	{

		float f = player.getSwingProgress(ev.getPartialTicks());
		float f1 = player.prevRotationPitch
				+ (player.rotationPitch - player.prevRotationPitch) * ev.getPartialTicks();

		ItemRenderer itemrenderer = Minecraft.getMinecraft().getItemRenderer();

		float prevEquipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.prevEquippedProgressMainHand
				: itemrenderer.prevEquippedProgressOffHand;
		float equipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.equippedProgressMainHand
				: itemrenderer.equippedProgressOffHand;
		float f5 = 1.0F - (prevEquipProgress + (equipProgress - prevEquipProgress) * ev.getPartialTicks());

		GlStateManager.pushMatrix();
		GlStateManager.pushAttrib();

		if (ev.getHand() == EnumHand.MAIN_HAND && player.getHeldItemOffhand().isEmpty())
		{
			GLHelper.renderParchmentFirstPerson(f1, f5, f, ev.getItemStack());
		} else
		{
			EnumHandSide enumhandside = ev.getHand() == EnumHand.MAIN_HAND ? player.getPrimaryHand()
					: player.getPrimaryHand().opposite();
			GLHelper.renderParchmentFirstPersonSide(f5, enumhandside, f, ev.getItemStack());
		}

		GlStateManager.popAttrib();
		GlStateManager.popMatrix();
		ev.setCanceled(true);
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:38,代码来源:ClientEvents.java

示例7: drawGuiContainerForegroundLayer

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mx, int my) {
    if(title)
        this.fontRendererObj.drawString(this.name, this.xSize / 2 - this.fontRendererObj.getStringWidth(this.name) / 2, 6, 0xa0a0a0);
    
    GlStateManager.pushAttrib();
    GlStateManager.color(1, 1, 1, 1);
    
    Minecraft.getMinecraft().renderEngine.bindTexture(getTexture());
    GlStateManager.popAttrib();

    if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && getShouldOutline() != null)
        drawOutlines();
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:15,代码来源:GuiBase.java

示例8: drawPowerBar

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void drawPowerBar(BaseTeslaContainer container, int mx, int my) {
    GlStateManager.pushAttrib();
    int barWidth = (int) (((float) container.getStoredPower() / container.getCapacity()) * 88);
    drawTexturedModalRect(44, 60, 44, 166, barWidth, 19);
    GlStateManager.popAttrib();
    if(mx >= guiLeft + 44 && mx <= guiLeft + 132 && my >= guiTop + 60 && my <= guiTop + 79) {
        StringBuilder builder = new StringBuilder();
        builder.append(container.getStoredPower()).append(ChatFormatting.DARK_AQUA).append("T").append(ChatFormatting.RESET).append("/").append(container.getCapacity()).append(ChatFormatting.DARK_AQUA).append("T");
        String percentage = String.format("%.2f%s", ((container.getStoredPower() + 0.0) / container.getCapacity() * 100.0), "%");
        drawHoveringText(Arrays.asList(builder.toString(), percentage), mx - guiLeft, my - guiTop);
    }
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:13,代码来源:GuiBase.java

示例9: renderSkull

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void renderSkull(float rot, ModelSkullBase modelIn, ItemStack stack) {
	ModelSkullBase modelbase = modelIn;
	bindTexture(modelbase.getTexture());
	GlStateManager.pushAttrib();
	GlStateManager.pushMatrix();
	//GlStateManager.disableCull();
	//GlStateManager.enableAlpha();
	//GlStateManager.disableDepth();
	GlStateManager.enableLighting();
	GlStateManager.translate(0.5, 0.0, 0.5);
	if (stack.isOnItemFrame()) {
		GlStateManager.scale(-2.0F, -2.0F, 2.0F);
	}
	else {
		GlStateManager.scale(-1.5F, -1.5F, 1.5F);
	}
	if (stack.isOnItemFrame()) {
		rot = 180.0F;
	}
	modelbase.render(rot);

	modelbase.renderOverlay(rot);
	if (modelbase.getLightMap() != null) {
		bindTexture(modelbase.getLightMap());
		modelbase.renderLightMap(rot);
	}
	GlStateManager.translate(-0.5, -0.0, -0.5);
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	GlStateManager.disableLighting();
	//GlStateManager.enableDepth();
	GlStateManager.popMatrix();
	GlStateManager.popAttrib();
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:34,代码来源:ItemSkullRenderer.java

示例10: drawGuiContainerBackgroundLayer

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    GlStateManager.pushAttrib();
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    Minecraft.getMinecraft().renderEngine.bindTexture(getTexture());
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    GlStateManager.popAttrib();
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:9,代码来源:GuiBase.java

示例11: render

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void render( double x, double y, double z)
{
    if(child==null)
    {
        parent.connectionLines.remove(this);
        return;
    }

    GlStateManager.pushMatrix();
    GlStateManager.pushAttrib();
    //if(dim!=Minecraft.getMinecraft().theWorld.provider.getDimension())return;
    Minecraft.getMinecraft().getTextureManager().bindTexture(this.type.texture);
    Tessellator tessellator = Tessellator.getInstance();
    //tessellator.getBuffer().setTranslation(x,y,x);
    GlStateManager.translate(x,y,z);

    GL11.glEnable(GL11.GL_BLEND);
    GlStateManager.enableAlpha();

    //long angle = (System.currentTimeMillis() / 10) % 360;
    //GlStateManager.translate(0, 0.07 * Math.sin(Math.PI * angle / 180), 0);
    //GlStateManager.rotate(-angle, 1, 1, 1);

    GlStateManager.rotate(180, 1, 0, 0);


    RenderHelper.disableStandardItemLighting();

    GlStateManager.translate(0.33D*parent.x+0.1666,-0.08,-0.33D*parent.z-0.1666);
    GlStateManager.rotate(90+(float)heading, 0, 1, 0);


    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    } else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    //GlStateManager.translate(-(pX+cX)/2,-(pY+cY)/2+0.5,-(pZ+cZ)/2);

    Color newColor = new Color(this.parent.getSignal().type.color);

    tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
    int state = (int)(System.currentTimeMillis()/100)%4+1;
    tessellator.getBuffer().pos(width/2,0,0).tex(0.25D*state,length).color(newColor.getRed(),newColor.getGreen(),newColor.getBlue(),newColor.getAlpha()).endVertex();
    tessellator.getBuffer().pos(width/2,0,length).tex(0.25D*state,0).color(newColor.getRed(),newColor.getGreen(),newColor.getBlue(),newColor.getAlpha()).endVertex();
    tessellator.getBuffer().pos(-width/2,0,length).tex(0.25D*(state-1),0).color(newColor.getRed(),newColor.getGreen(),newColor.getBlue(),newColor.getAlpha()).endVertex();
    tessellator.getBuffer().pos(-width/2,0,0).tex(0.25D*(state-1),length).color(newColor.getRed(),newColor.getGreen(),newColor.getBlue(),newColor.getAlpha()).endVertex();
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();
    GlStateManager.popAttrib();

}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:56,代码来源:DustConnectionLine.java

示例12: renderPapers

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
private void renderPapers(ItemStack stack, int slot, TileEntityWritingDesk te)
{
	if (stack != null && !stack.isEmpty())
	{
		RenderHelper.enableStandardItemLighting();
		GlStateManager.enableLighting();
		GlStateManager.pushMatrix();
		GlStateManager.translate(0.75, .8, 0.5);
		GlStateManager.scale(.5f, .5f, .5f);
		GlStateManager.disableLighting();
		GlStateManager.disableCull();
		Minecraft.getMinecraft().getTextureManager()
				.bindTexture(new ResourceLocation(ArcaneMagic.MODID, "textures/misc/parchment.png"));
		Tessellator tessellator = Tessellator.getInstance();
		BufferBuilder bufferbuilder = tessellator.getBuffer();
		GlStateManager.translate(-0.5F, -0.5F, 0.0F);
		//GlStateManager.rotate(te.getAge(), 0,1,0);
		bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
		bufferbuilder.pos(0, 0, -0.4).tex(0.0D, 1.0D).endVertex();
		bufferbuilder.pos(0, 0, 0.4).tex(1.0D, 1.0D).endVertex();
		bufferbuilder.pos(0, 0.8, 0.4).tex(1.0D, 0.0D).endVertex();
		bufferbuilder.pos(0, 0.8, -0.4).tex(0.0D, 0.0D).endVertex();
		tessellator.draw();

		GlStateManager.rotate(180, 0, 0, 1);
		GlStateManager.rotate(90, 0, 1, 0);
		GlStateManager.translate(0, -0.59, 0);
		GlStateManager.translate(0, 0, -0.0005);

		for (int side = 0; side < 2; side++)
		{
			if (side == 1)
			{
				GlStateManager.translate(0, 0, 0.001);
				GlStateManager.rotate(180, 0, 1, 0);
				//GlStateManager.rotate(180,0,0,1);

			}
			GlStateManager.pushMatrix();
			GlStateManager.pushAttrib();
			GlStateManager.scale(0.008, 0.008, 0.008);

			GLHelper.drawCenteredSplitString(Minecraft.getMinecraft().fontRenderer, "Manipulation Magic", 0, -15,
					100, 0x000000);

			GlStateManager.popAttrib();
			GlStateManager.popMatrix();

			GlStateManager.pushMatrix();
			GlStateManager.pushAttrib();
			GlStateManager.scale(0.005, 0.005, 0.005);
			GLHelper.drawCenteredSplitString(Minecraft.getMinecraft().fontRenderer,
					"Manipulating Anima directly would be a powerful ability, if only you could obtain the right items to learn how.\n\nLuckily, your new discoveries should aid you greatly in this process.",
					0, 0, 130, 0x000000);
			GlStateManager.popAttrib();
			GlStateManager.popMatrix();
		}
		GlStateManager.popMatrix();
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:61,代码来源:WritingDeskTESR.java

示例13: renderTubeItems

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
private void renderTubeItems(TileTube tile, double x, double y, double z, float parTicks) {

		for (TubeItem item : tile.getItemList()) {

			if (item.getItemStack() == null)
				continue;

			GlStateManager.pushMatrix();
			{
				GlStateManager.translate(x, y, z);
				GlStateManager.disableLighting();
				ItemStack stack = item.getItemStack();

				float xPos = item.getItemX(parTicks);
				float yPos = item.getItemY(parTicks);
				float zPos = item.getItemZ(parTicks);

				GlStateManager.translate(xPos, yPos, zPos);

				if (item.getColor() != null)
					renderItemColor(new Color(item.getColor().getMapColor().colorValue));

				EntityItem entityitem = new EntityItem(tile.getWorld(), 0.0D, 0.0D, 0.0D, stack);
				entityitem.getItem().setCount(stack.getCount());
				entityitem.hoverStart = 0.0F;
				GlStateManager.pushMatrix();
				{
					GlStateManager.disableLighting();

					GlStateManager.scale(0.5F, 0.5F, 0.5F);
					GlStateManager.pushAttrib();
					RenderHelper.enableStandardItemLighting();
					Minecraft.getMinecraft().getRenderItem().renderItem(entityitem.getItem(), ItemCameraTransforms.TransformType.FIXED);
					RenderHelper.disableStandardItemLighting();
					GlStateManager.popAttrib();

					GlStateManager.enableLighting();
				}
				GlStateManager.popMatrix();
			}
			GlStateManager.enableLighting();
			GlStateManager.popMatrix();
		}
	}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:45,代码来源:TubeItemRenderer.java

示例14: drawTriangle2D

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public static void drawTriangle2D(double width, float rotation, double x, double y, Color color, int lineWidth)
{
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();

	GlStateManager.translate(x, y, 0);
	GlStateManager.rotate(rotation, 0, 0, 1);
	double p = (3 * width) / 2;
	double area = Math.sqrt((p * (p - width) * (p - width) * (p - width)));
	double height = 2 * (area / width);

	GlStateManager.disableTexture2D();
	GlStateManager.enableBlend();
	GlStateManager.disableAlpha();
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
			GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
			GlStateManager.DestFactor.ZERO);
	GlStateManager.shadeModel(7425);

	GL11.glLineWidth(lineWidth);
	Tessellator tes = Tessellator.getInstance();
	BufferBuilder vb = tes.getBuffer();

	GlStateManager.rotate(60f, 0, 0, 1);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(0, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.rotate(60f, 0, 0, 1);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(0, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.rotate(60f, 0, 0, 1);
	GlStateManager.translate(0, -height, 0);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(-width / 2, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width / 2, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.disableBlend();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.enableTexture2D();
	GlStateManager.enableAlpha();
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:61,代码来源:GLHelper.java

示例15: renderFancyBeams2D

import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public static void renderFancyBeams2D(double x, double y, Color color, long seed, long continuousTick, float scale,
		int countFancy, int countNormal)
{
	int dstJump = 16;
	Random rand = new Random(seed);
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();
	GlStateManager.translate(x, y, 0);
	int fancy_count = !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics ? countNormal
			: countFancy;

	Tessellator tes = Tessellator.getInstance();
	BufferBuilder vb = tes.getBuffer();

	RenderHelper.disableStandardItemLighting();
	float rotateSpeed = continuousTick / 1000.0F;
	float beamSize = 0.9F;

	GlStateManager.disableTexture2D();
	GlStateManager.shadeModel(GL11.GL_SMOOTH);
	GlStateManager.enableBlend();
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	GlStateManager.depthMask(false);
	GlStateManager.pushMatrix();
	for (int i = 0; i < fancy_count; i++)
	{
		GlStateManager.rotate(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.rotate(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);

		// Animate the beams spinning
		GlStateManager.rotate(rand.nextFloat() * 360.0F + rotateSpeed * 360.0F, 0.0F, 0.0F, 1.0F);

		vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
		// length and width of the individual beams
		float length = (rand.nextFloat() * 20.0F + 5.0F + beamSize * 10.0F)
				/ (30.0F / (Math.min(dstJump, 10 * scale) / 10.0F));
		length *= 90;
		float width = 3;

		vb.pos(0, 0, 0)
				.color(color.getRed(), color.getGreen(), color.getBlue(), (int) (255.0F * (1.0F - beamSize)) * 10)
				.endVertex();
		vb.pos(-0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		vb.pos(0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		vb.pos(0.0D, length, 1.0F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0).endVertex();
		vb.pos(-0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		tes.draw();
	}
	GlStateManager.popMatrix();
	GlStateManager.depthMask(true);
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.disableBlend();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.enableTexture2D();
	GlStateManager.enableAlpha();
	RenderHelper.enableStandardItemLighting();

	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:65,代码来源:GLHelper.java


注:本文中的net.minecraft.client.renderer.GlStateManager.pushAttrib方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。