本文整理匯總了Java中net.minecraft.client.renderer.Tessellator.addVertexWithUV方法的典型用法代碼示例。如果您正苦於以下問題:Java Tessellator.addVertexWithUV方法的具體用法?Java Tessellator.addVertexWithUV怎麽用?Java Tessellator.addVertexWithUV使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.Tessellator
的用法示例。
在下文中一共展示了Tessellator.addVertexWithUV方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderParticle
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
@Override
public void renderParticle(Tessellator tessellator, float delta, float rotationX, float rotationXZ,
float rotationZ, float rotationYZ, float rotationXY) {
tessellator.draw();
tessellator.startDrawingQuads();
textureManager.bindTexture(texture);
float f6 = 0.0f;
float f7 = 1.0f;
float f8 = 0.0f;
float f9 = 1.0f;
float scale = 0.1F * this.particleScale;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)delta - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)delta - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)delta - interpPosZ);
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - rotationX * scale - rotationYZ * scale), (double)(f12 - rotationXZ * scale), (double)(f13 - rotationZ * scale - rotationXY * scale), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - rotationX * scale + rotationYZ * scale), (double)(f12 + rotationXZ * scale), (double)(f13 - rotationZ * scale + rotationXY * scale), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + rotationX * scale + rotationYZ * scale), (double)(f12 + rotationXZ * scale), (double)(f13 + rotationZ * scale + rotationXY * scale), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + rotationX * scale - rotationYZ * scale), (double)(f12 - rotationXZ * scale), (double)(f13 + rotationZ * scale - rotationXY * scale), (double)f6, (double)f9);
tessellator.draw();
tessellator.startDrawingQuads();
textureManager.bindTexture(TextureMap.locationItemsTexture);
}
示例2: renderIcon
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
private void renderIcon(IIcon icon) {
Tessellator tessellator = Tessellator.instance;
float minU = icon.getMinU();
float maxU = icon.getMaxU();
float minV = icon.getMinV();
float maxV = icon.getMaxV();
OpenGLHelper.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
OpenGLHelper.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(-0.5F, -0.25F, 0.0D, minU, maxV);
tessellator.addVertexWithUV(0.5F, -0.25F, 0.0D, maxU, maxV);
tessellator.addVertexWithUV(0.5F, 0.75F, 0.0D, maxU, minV);
tessellator.addVertexWithUV(-0.5F, 0.75F, 0.0D, minU, minV);
tessellator.draw();
}
示例3: func_77026_a
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon)
{
float f = par2Icon.getMinU();
float f1 = par2Icon.getMaxU();
float f2 = par2Icon.getMinV();
float f3 = par2Icon.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);
par1Tessellator.startDrawingQuads();
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
par1Tessellator.draw();
}
示例4: overlayBackground
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_)
{
Tessellator var5 = Tessellator.instance;
this.client.renderEngine.bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var6 = 32.0F;
var5.startDrawingQuads();
var5.setColorRGBA_I(4210752, p_22239_4_);
var5.addVertexWithUV(0.0D, (double)p_22239_2_, 0.0D, 0.0D, (double)((float)p_22239_2_ / var6));
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_2_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_2_ / var6));
var5.setColorRGBA_I(4210752, p_22239_3_);
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_1_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_1_ / var6));
var5.addVertexWithUV(0.0D, (double)p_22239_1_, 0.0D, 0.0D, (double)((float)p_22239_1_ / var6));
var5.draw();
}
示例5: drawTexturedModalRectNormal
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void drawTexturedModalRectNormal(int x, int y, int width, int height) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x , y + height, 0, 0.0, 1.0);
tessellator.addVertexWithUV(x + width, y + height, 0, 1.0, 1.0);
tessellator.addVertexWithUV(x + width, y , 0, 1.0, 0.0);
tessellator.addVertexWithUV(x , y , 0, 0.0, 0.0);
tessellator.draw();
}
示例6: doRender
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
if (!(entity instanceof EntityWindBlade)) {
return;
}
this.bindEntityTexture(entity);
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
//原點移到實體中心
GL11.glRotatef(entity.rotationYaw - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.rotationPitch, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(1, 0.1f, 1);
for (int i = 0; i < 180; ++i)
{
GL11.glRotatef(1F, 1.0F, 0.0F, 0.0F);
//GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-1D, -1D, 0.0D, 0, 1); // 左下
tessellator.addVertexWithUV( 1D, -1D, 0.0D, 0, 0); // 左上
tessellator.addVertexWithUV( 1D, 1D, 0.0D, 1, 0); // 右上
tessellator.addVertexWithUV(-1D, 1D, 0.0D, 1, 1); // 右下
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例7: drawScreen
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void drawScreen()
{
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator tessellator = Tessellator.instance;
this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f1 = 32.0F;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(2105376);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.top / f1));
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.top / f1));
tessellator.draw();
GL11.glDisable(GL11.GL_DEPTH_TEST);
byte b0 = 4;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 0, 1);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.left, (double) (this.top + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) (this.top + b0), 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.right, (double) (this.bottom - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) (this.bottom - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int titleWidth = fontRenderer.getStringWidth(title);
fontRenderer.drawStringWithShadow(title, this.left + ((this.right - this.left) / 2) - (titleWidth / 2), this.top + 2, 0xFFFFFF);
int topStart = this.top + 15;
for (String line : lines)
{
if (centeredF)
{
int stringWidth = fontRenderer.getStringWidth(line);
fontRenderer.drawStringWithShadow(line, this.left + ((this.right - this.left) / 2) - (stringWidth / 2), topStart, 0xFFFFFF);
}
else
{
fontRenderer.drawStringWithShadow(line, this.left, topStart, 0xFFFFFF);
}
topStart += 10;
}
}
示例8: doRender_Arrow
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_Arrow(_ProjectileBase shot, double x, double y, double z, float par8, float par9)
{
this.bindEntityTexture(shot);
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glRotatef(shot.prevRotationYaw + (shot.rotationYaw - shot.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(shot.prevRotationPitch + (shot.rotationPitch - shot.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
byte b0 = 0;
float f2 = 0.0F;
float f3 = 0.5F;
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);
float f11 = (float) shot.arrowShake - par9;
if (f11 > 0.0F)
{
float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
}
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();
}
示例9: doRender_DefaultProjectile
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_DefaultProjectile(Entity par1Entity, double x, double y, double z, float yaw, float tick, double length, double width)
{
GL11.glPushMatrix();
this.bindEntityTexture(par1Entity);
GL11.glDisable(GL11.GL_LIGHTING); // For proper world lighting, not internal lighting. Otherwise the entity is too dark
GL11.glDisable(GL11.GL_CULL_FACE); // Disables the culling of back faces. Good for not having to draw front and back of a thing
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glScalef(0.5F, 0.5F, 0.5F);
Tessellator tes = Tessellator.instance; // Grab a instance of the tesselator here (non-static, as they say)
GL11.glRotatef(par1Entity.prevRotationYaw + (par1Entity.rotationYaw - par1Entity.prevRotationYaw) * tick - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1Entity.prevRotationPitch + (par1Entity.rotationPitch - par1Entity.prevRotationPitch) * tick, 0.0F, 0.0F, 1.0F);
float f10 = 0.05625F;
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);
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tes.startDrawingQuads();
// X Y Z TX, TY
tes.addVertexWithUV(-length, -width, 0.0D, 0, 0);
tes.addVertexWithUV( length, -width, 0.0D, 0, 1);
tes.addVertexWithUV( length, width, 0.0D, 1, 1);
tes.addVertexWithUV(-length, width, 0.0D, 1, 0);
tes.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
示例10: doRender_TossedItem
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_TossedItem(Entity shot, double x, double y, double z, int type)
{
GL11.glPushMatrix();
this.bindEntityTexture(shot);
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f2 = 0.5f;
GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
IIcon icon = Items.baked_potato.getIconFromDamage(0); // Default, to be overridden with the actual thing
if (type == 1) { icon = Items.gold_nugget.getIconFromDamage(0); }
else if (type == 2) { icon = Items.glass_bottle.getIconFromDamage(0); }
else if (type == 3) { icon = Items.baked_potato.getIconFromDamage(0); }
else if (type == 4) { icon = Items.melon_seeds.getIconFromDamage(0); }
else if (type == 5) { icon = Items.glowstone_dust.getIconFromDamage(0); }
else if (type == 6) { icon = Items.water_bucket.getIconFromDamage(0); }
else if (type == 7) { icon = Items.snowball.getIconFromDamage(0); }
Tessellator tessellator = Tessellator.instance;
float f3 = icon.getMinU();
float f4 = icon.getMaxU();
float f5 = icon.getMinV();
float f6 = icon.getMaxV();
float f7 = 1.0F;
float f8 = 0.5F;
float f9 = 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();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6);
tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6);
tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5);
tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5);
tessellator.draw();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例11: doRender_PredictiveArrow
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_PredictiveArrow(Entity par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
{
this.bindEntityTexture(par1EntityArrow);
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
byte b0 = 0;
float f2 = 0.0F;
float f3 = 0.5F;
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();
}
示例12: doRender_LightningRed
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_LightningRed(_ProjectileBase entity, double x, double y, double z, float yaw, float tick, double length, double width)
{
GL11.glPushMatrix();
this.bindEntityTexture(entity);
GL11.glDisable(GL11.GL_LIGHTING); // For proper world lighting, not internal lighting. Otherwise the entity is too dark
GL11.glDisable(GL11.GL_CULL_FACE); // Disables the culling of back faces. Good for not having to draw front and back of a thing
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glScalef(0.5F, 0.5F, 0.5F);
Tessellator tes = Tessellator.instance; // Grab a instance of the tesselator here (non-static, as they say)
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * tick - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * tick, 0.0F, 0.0F, 1.0F);
float f10 = 0.05625F;
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);
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tes.startDrawingQuads();
// X Y Z TX, TY
tes.addVertexWithUV(-length, -width, 0.0D, 0, 0);
tes.addVertexWithUV( length, -width, 0.0D, 0, 1);
tes.addVertexWithUV( length, width, 0.0D, 1, 1);
tes.addVertexWithUV(-length, width, 0.0D, 1, 0);
tes.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
示例13: doRender_NeutralBeam
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void doRender_NeutralBeam(_ProjectileBase entity, double x, double y, double z, float yaw, float tick, float beamWidth)
{
//GL11.glPushMatrix();
//float f2 = par9;// (float) player.innerRotation + par9;
float f3 = MathHelper.sin(tick * 0.2F) / 2.0F + 0.5F;
f3 = (f3 * f3 + f3) * 0.2F;
float xPosEnd = (float) (entity.ownerX - entity.posX - (entity.prevPosX - entity.posX) * (double) (1.0F - tick));
float yPosEnd = (float) ((double) f3 + entity.ownerY - entity.posY - (entity.prevPosY - entity.posY) * (double) (1.0F - tick));
float zPosEnd = (float) (entity.ownerZ - entity.posZ - (entity.prevPosZ - entity.posZ) * (double) (1.0F - tick));
//for rotation/distance
float f7 = MathHelper.sqrt_float(xPosEnd * xPosEnd + zPosEnd * zPosEnd);
float f8 = MathHelper.sqrt_float(xPosEnd * xPosEnd + yPosEnd * yPosEnd + zPosEnd * zPosEnd);
// Changing the starting point here slightly, so it doesn't come out of the center
//int distance = 6; // Increasing this will likely increase the distance
//double adjustmentZ = -MathHelper.cos((entity.shootingEntity.rotationYaw) * (float)Math.PI / 180.0F) * (distance * 0.08);
//double adjustmentX = MathHelper.sin((entity.shootingEntity.rotationYaw) * (float)Math.PI / 180.0F) * (distance * 0.08);
// Start drawing (i think)
GL11.glTranslated((float) x, (float) y, (float) z); // Adjusted with distance to shooter
GL11.glRotatef((float) (-Math.atan2((double) zPosEnd, (double) xPosEnd)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float) (-Math.atan2((double) f7, (double) yPosEnd)) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
Tessellator tessellator = Tessellator.instance;
//Makes the beam look nice
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_CULL_FACE);
//Shading?
GL11.glShadeModel(GL11.GL_SMOOTH);
//from what i can tell f9 and f10 make the beam change (looks like its rotating or whatnot)
float f9 = 0.0F - ((float) entity.ticksExisted + tick) * 0.01F;
float f10 = MathHelper.sqrt_float(xPosEnd * xPosEnd + yPosEnd * yPosEnd + zPosEnd * zPosEnd) / 32.0F - ((float) entity.ticksExisted + tick) * 0.01F;
// change draw mode
tessellator.startDrawing(5);
byte b0 = 8; // how many sides the circle has?
//float beamWidth = 0.15f;
for (int i = 0; i <= b0; ++i) // makes one side circular(fancy math stuff)
{
float f11 = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * beamWidth; // "changing the 2 or .75 should change size of circle"
float f12 = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * beamWidth; // The 2 seems to be there to describe a full circle
float f13 = (float) (i % b0) * 1.0F / (float) b0; // 1 makes it a half circle
tessellator.setColorOpaque_I(0);
tessellator.addVertexWithUV((double) (f11 * 0.2F), (double) (f12 * 0.2F), 0.0D, (double) f13, (double) f10); // Now how do I shorten the beam slightly
tessellator.setColorOpaque_I(16777215); // so it doesn't appear from the center of the shooter
tessellator.addVertexWithUV((double) f11, (double) f12, (double) f8, (double) f13, (double) f9);
}
tessellator.draw(); // draw added vertices
// reset openGl stuff?
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_FLAT);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
示例14: render
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void render(EntityProjectileSharpStone entity, double x, double y, double z, float par8, float par9)
{
bindEntityTexture(entity);
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
float fx1 = 0.0F;
float fx2 = 8 / 32.0F;
float fy1 = 0.0F;
float fy2 = 8 / 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);
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-2.0D, -2.0D, 0.0D, fx1, fy1);
tessellator.addVertexWithUV(2.0D, -2.0D, 0.0D, fx2, fy1);
tessellator.addVertexWithUV(2.0D, 2.0D, 0.0D, fx2, fy2);
tessellator.addVertexWithUV(-2.0D, 2.0D, 0.0D, fx1, fy2);
tessellator.draw();
}
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, -2.0D, -2.0D, fx1, fy1);
tessellator.addVertexWithUV(0.0D, -2.0D, 2.0D, fx2, fy1);
tessellator.addVertexWithUV(0.0D, 2.0D, 2.0D, fx2, fy2);
tessellator.addVertexWithUV(0.0D, 2.0D, -2.0D, fx1, fy2);
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例15: render
import net.minecraft.client.renderer.Tessellator; //導入方法依賴的package包/類
public void render(EntityProjectileSoftStone entity, double x, double y, double z, float par8, float par9)
{
bindEntityTexture(entity);
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
float fx1 = 0.0F;
float fx2 = 8 / 32.0F;
float fy1 = 0.0F;
float fy2 = 8 / 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);
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-2.0D, -2.0D, 0.0D, fx1, fy1);
tessellator.addVertexWithUV(2.0D, -2.0D, 0.0D, fx2, fy1);
tessellator.addVertexWithUV(2.0D, 2.0D, 0.0D, fx2, fy2);
tessellator.addVertexWithUV(-2.0D, 2.0D, 0.0D, fx1, fy2);
tessellator.draw();
}
for (int i = 0; i < 2; ++i)
{
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, -2.0D, -2.0D, fx1, fy1);
tessellator.addVertexWithUV(0.0D, -2.0D, 2.0D, fx2, fy1);
tessellator.addVertexWithUV(0.0D, 2.0D, 2.0D, fx2, fy2);
tessellator.addVertexWithUV(0.0D, 2.0D, -2.0D, fx1, fy2);
tessellator.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}