use of net.minecraft.client.renderer.texture.TextureManager in project RFToolsDimensions by McJty.
the class SkyRenderer method renderSky.
/**
* Renders the sky with the partial tick time. Args: partialTickTime
*/
@SideOnly(Side.CLIENT)
private static void renderSky(float partialTickTime, DimensionInformation information) {
initialize();
EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
WorldClient world = MinecraftTools.getWorld(Minecraft.getMinecraft());
TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();
GlStateManager.disableTexture2D();
Vec3d vec3 = world.getSkyColor(player, partialTickTime);
float skyRed = (float) vec3.xCoord;
float skyGreen = (float) vec3.yCoord;
float skyBlue = (float) vec3.zCoord;
boolean anaglyph = Minecraft.getMinecraft().gameSettings.anaglyph;
if (anaglyph) {
float f4 = (skyRed * 30.0F + skyGreen * 59.0F + skyBlue * 11.0F) / 100.0F;
float f5 = (skyRed * 30.0F + skyGreen * 70.0F) / 100.0F;
float f6 = (skyRed * 30.0F + skyBlue * 70.0F) / 100.0F;
skyRed = f4;
skyGreen = f5;
skyBlue = f6;
}
GlStateManager.color(skyRed, skyGreen, skyBlue);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer renderer = tessellator.getBuffer();
GlStateManager.depthMask(false);
GlStateManager.enableFog();
GlStateManager.color(skyRed, skyGreen, skyBlue);
// @todo support VBO?
// if (OpenGlHelper.useVbo()) {
// skyVBO.bindBuffer();
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
// GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L);
// this.skyVBO.drawArrays(7);
// this.skyVBO.unbindBuffer();
// GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
//
// } else {
GlStateManager.callList(glSkyList);
// }
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.disableStandardItemLighting();
float[] sunsetColors = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTickTime), partialTickTime);
if (sunsetColors != null) {
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(7425);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(MathHelper.sin(world.getCelestialAngleRadians(partialTickTime)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
float f6 = sunsetColors[0];
float f7 = sunsetColors[1];
float f8 = sunsetColors[2];
if (anaglyph) {
float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
f6 = f9;
f7 = f10;
f8 = f11;
}
renderer.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
renderer.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, sunsetColors[3]).endVertex();
for (int j = 0; j <= 16; ++j) {
float f11 = j * (float) Math.PI * 2.0F / 16.0f;
float f12 = MathHelper.sin(f11);
float f13 = MathHelper.cos(f11);
renderer.pos((f12 * 120.0F), (f13 * 120.0F), (-f13 * 40.0F * sunsetColors[3])).color(sunsetColors[0], sunsetColors[1], sunsetColors[2], 0.0F).endVertex();
}
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.shadeModel(GL11.GL_FLAT);
}
renderCelestialBodies(partialTickTime, information, world, renderEngine, tessellator);
GlStateManager.color(0.0F, 0.0F, 0.0F);
double d0 = player.getPosition().getY() - world.getHorizon();
if (d0 < 0.0D) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 12.0F, 0.0F);
// @todo
// if (this.vboEnabled)
// {
// this.sky2VBO.bindBuffer();
// GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
// GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L);
// this.sky2VBO.drawArrays(7);
// this.sky2VBO.unbindBuffer();
// GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
// }
// else
// {
GlStateManager.callList(glSkyList2);
// GlStateManager.callList(this.glSkyList2);
// }
GlStateManager.popMatrix();
float f8 = 1.0F;
float f9 = -((float) (d0 + 65.0D));
float f10 = -f8;
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
renderer.pos((-f8), f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f9, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, (-f8)).color(0, 0, 0, 255).endVertex();
renderer.pos((-f8), f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, f8).color(0, 0, 0, 255).endVertex();
renderer.pos(f8, f10, (-f8)).color(0, 0, 0, 255).endVertex();
tessellator.draw();
}
if (world.provider.isSkyColored()) {
GlStateManager.color(skyRed * 0.2F + 0.04F, skyGreen * 0.2F + 0.04F, skyBlue * 0.6F + 0.1F);
} else {
GlStateManager.color(skyRed, skyGreen, skyBlue);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
GlStateManager.callList(glSkyList2);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
}
use of net.minecraft.client.renderer.texture.TextureManager in project RFToolsDimensions by McJty.
the class SkyRenderer method renderSkyTexture.
@SideOnly(Side.CLIENT)
private static void renderSkyTexture(ResourceLocation sky, ResourceLocation sky2, int type) {
TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.disableStandardItemLighting();
GlStateManager.depthMask(false);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer renderer = tessellator.getBuffer();
for (int i = 0; i < 6; ++i) {
GlStateManager.pushMatrix();
UV[] uv = faceDown;
boolean white = true;
if (i == 0) {
// Down face
uv = faceDown;
switch(type) {
case SKYTYPE_ALL:
renderEngine.bindTexture(sky);
break;
case SKYTYPE_ALLHORIZONTAL:
case SKYTYPE_ALTERNATING:
renderEngine.bindTexture(sky2);
break;
default:
white = false;
break;
}
} else if (i == 1) {
// North face
renderEngine.bindTexture(sky);
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
uv = faceNorth;
} else if (i == 2) {
// South face
renderEngine.bindTexture(sky);
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
uv = faceSouth;
} else if (i == 3) {
// Up face
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
uv = faceUp;
switch(type) {
case SKYTYPE_ALL:
renderEngine.bindTexture(sky);
break;
case SKYTYPE_ALLHORIZONTAL:
case SKYTYPE_ALTERNATING:
renderEngine.bindTexture(sky2);
break;
default:
white = false;
break;
}
} else if (i == 4) {
// East face
if (type == SKYTYPE_ALTERNATING && sky2 != null) {
renderEngine.bindTexture(sky2);
} else {
renderEngine.bindTexture(sky);
}
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
uv = faceEast;
} else if (i == 5) {
// West face
if (type == SKYTYPE_ALTERNATING && sky2 != null) {
renderEngine.bindTexture(sky2);
} else {
renderEngine.bindTexture(sky);
}
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
uv = faceWest;
}
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
int cc = white ? 255 : 0;
renderer.pos(-100.0D, -100.0D, -100.0D).tex(uv[0].u, uv[0].v).color(cc, cc, cc, 255).endVertex();
renderer.pos(-100.0D, -100.0D, 100.0D).tex(uv[1].u, uv[1].v).color(cc, cc, cc, 255).endVertex();
renderer.pos(100.0D, -100.0D, 100.0D).tex(uv[2].u, uv[2].v).color(cc, cc, cc, 255).endVertex();
renderer.pos(100.0D, -100.0D, -100.0D).tex(uv[3].u, uv[3].v).color(cc, cc, cc, 255).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
}
use of net.minecraft.client.renderer.texture.TextureManager in project ArsMagica2 by Mithion.
the class CloakUtils method downloadCapeTexture.
private static ThreadDownloadImageData downloadCapeTexture(ResourceLocation resourceLocation, String uuid) {
ThreadDownloadImageData data = downloadedCloaks.get(uuid);
if (data == null) {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
Object object = new ThreadDownloadImageData((File) null, AMCore.proxy.playerTracker.getCLF(uuid), null, null);
texturemanager.loadTexture(resourceLocation, (ITextureObject) object);
data = (ThreadDownloadImageData) object;
downloadedCloaks.put(uuid, data);
}
return data;
}
use of net.minecraft.client.renderer.texture.TextureManager in project Railcraft by Railcraft.
the class LiquidSlot method draw.
@Override
public void draw(Renderer renderer, int recipeX, int recipeY, Object[] data, int dataIndex, boolean isMouseOver) {
int x = recipeX + this.x;
int y = recipeY + this.y;
if (data[dataIndex] instanceof FluidStack) {
FluidStack liquid = (FluidStack) data[dataIndex];
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
Fluid fluid = liquid.getFluid();
TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(fluid.getStill(liquid).toString());
if (icon != null) {
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
double u = icon.getInterpolatedU(3.0);
double u2 = icon.getInterpolatedU(13.0);
double v = icon.getInterpolatedV(1.0);
double v2 = icon.getInterpolatedV(15.0);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(u, v);
GL11.glVertex2i(x + 3, y + 1);
GL11.glTexCoord2d(u, v2);
GL11.glVertex2i(x + 3, y + 15);
GL11.glTexCoord2d(u2, v2);
GL11.glVertex2i(x + 13, y + 15);
GL11.glTexCoord2d(u2, v);
GL11.glVertex2i(x + 13, y + 1);
GL11.glEnd();
}
}
renderer.renderRect(x - 1, y - 1, 18, 18, containerTexture);
}
use of net.minecraft.client.renderer.texture.TextureManager in project Engine by VoltzEngine-Project.
the class RenderItemOverlayUtility method renderIcon.
public static void renderIcon(IIcon iicon, int sheet) {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
if (iicon == null)
return;
TextureUtil.func_152777_a(false, false, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
texturemanager.bindTexture(texturemanager.getResourceLocation(sheet));
//TODO add color handling for icon
renderItem.renderIcon(0, 0, iicon, 1, 1);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
texturemanager.bindTexture(texturemanager.getResourceLocation(sheet));
TextureUtil.func_147945_b();
}
Aggregations