Animated the blood on altars
This commit is contained in:
parent
c8f74029a4
commit
02db97e5a5
|
@ -1,22 +1,28 @@
|
||||||
package WayofTime.alchemicalWizardry.common.renderer.model;
|
package WayofTime.alchemicalWizardry.common.renderer.model;
|
||||||
|
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||||
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
|
||||||
public class ModelBloodAltar extends ModelBase
|
public class ModelBloodAltar extends ModelBase
|
||||||
{
|
{
|
||||||
|
private static final ResourceLocation altar_texture = new ResourceLocation("alchemicalwizardry:textures/models/altar.png");
|
||||||
|
|
||||||
private IModelCustom modelBloodAltar;
|
private IModelCustom modelBloodAltar;
|
||||||
private IModelCustom modelBloodLevel; //TODO
|
|
||||||
|
|
||||||
public ModelBloodAltar()
|
public ModelBloodAltar()
|
||||||
{
|
{
|
||||||
modelBloodAltar = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodaltar-fixeUV.obj"));
|
modelBloodAltar = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodaltar-fixeUV.obj"));
|
||||||
modelBloodLevel = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodlevel.obj"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderBloodAltar()
|
public void renderBloodAltar()
|
||||||
|
@ -24,11 +30,6 @@ public class ModelBloodAltar extends ModelBase
|
||||||
modelBloodAltar.renderAll();
|
modelBloodAltar.renderAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderBloodLevel()
|
|
||||||
{
|
|
||||||
modelBloodLevel.renderAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderBloodAltar(TEAltar altar, double x, double y, double z)
|
public void renderBloodAltar(TEAltar altar, double x, double y, double z)
|
||||||
{
|
{
|
||||||
float scale = 0.1f;
|
float scale = 0.1f;
|
||||||
|
@ -39,9 +40,7 @@ public class ModelBloodAltar extends ModelBase
|
||||||
// Scale our object to about half-size in all directions (the OBJ file is a little large)
|
// Scale our object to about half-size in all directions (the OBJ file is a little large)
|
||||||
GL11.glScalef(scale, scale, scale);
|
GL11.glScalef(scale, scale, scale);
|
||||||
// Bind the texture, so that OpenGL properly textures our block.
|
// Bind the texture, so that OpenGL properly textures our block.
|
||||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/altar.png");
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(altar_texture);
|
||||||
//FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/alchemicalwizardry/textures/models/altar.png");
|
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
|
||||||
// Render the object, using modelTutBox.renderAll();
|
// Render the object, using modelTutBox.renderAll();
|
||||||
this.renderBloodAltar();
|
this.renderBloodAltar();
|
||||||
// Pop this matrix from the stack.
|
// Pop this matrix from the stack.
|
||||||
|
@ -50,21 +49,29 @@ public class ModelBloodAltar extends ModelBase
|
||||||
|
|
||||||
public void renderBloodLevel(TEAltar altar, double x, double y, double z)
|
public void renderBloodLevel(TEAltar altar, double x, double y, double z)
|
||||||
{
|
{
|
||||||
float scale = 0.1f;
|
|
||||||
// Push a blank matrix onto the stack
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
float level = altar.getFluidAmount();
|
float level = altar.getFluidAmount();
|
||||||
// Move the object into the correct position on the block (because the OBJ's origin is the center of the object)
|
GL11.glTranslatef((float) x , (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z);
|
||||||
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z + 0.5f);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
// Scale our object to about half-size in all directions (the OBJ file is a little large)
|
renderBloodLevel(AlchemicalWizardry.lifeEssenceFluid.getStillIcon());
|
||||||
GL11.glScalef(scale, scale, scale);
|
|
||||||
// Bind the texture, so that OpenGL properly textures our block.
|
|
||||||
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/blood.png");
|
|
||||||
//FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/alchemicalwizardry/textures/models/altar.png");
|
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
|
|
||||||
// Render the object, using modelTutBox.renderAll();
|
|
||||||
this.renderBloodLevel();
|
|
||||||
// Pop this matrix from the stack.
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void renderBloodLevel(IIcon icon)
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
double minU = (double) icon.getInterpolatedU(0);
|
||||||
|
double maxU = (double) icon.getInterpolatedU(16);
|
||||||
|
double minV = (double) icon.getInterpolatedV(0);
|
||||||
|
double maxV = (double) icon.getInterpolatedV(16);
|
||||||
|
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal(0, 1, 0);
|
||||||
|
tessellator.addVertexWithUV(1, 0, 1, maxU, maxV);
|
||||||
|
tessellator.addVertexWithUV(1, 0, 0, maxU, minV);
|
||||||
|
tessellator.addVertexWithUV(0, 0, 0, minU, minV);
|
||||||
|
tessellator.addVertexWithUV(0, 0, 1, minU, maxV);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,64 +0,0 @@
|
||||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
|
||||||
# File Created: 07.08.2013 20:12:01
|
|
||||||
|
|
||||||
mtllib bloodlevel.mtl
|
|
||||||
|
|
||||||
#
|
|
||||||
# object headusOBJexport001
|
|
||||||
#
|
|
||||||
|
|
||||||
v -1.2846 0.0000 2.0630
|
|
||||||
v -1.2890 0.0000 -2.0628
|
|
||||||
v -2.0627 0.0000 -1.2993
|
|
||||||
v -2.0628 0.0000 1.2848
|
|
||||||
v 1.2845 0.0000 2.0630
|
|
||||||
v -1.7911 0.0000 3.2857
|
|
||||||
v 1.7911 0.0000 3.2857
|
|
||||||
v 2.0628 0.0000 1.2848
|
|
||||||
v 3.2856 0.0000 1.7912
|
|
||||||
v 2.0628 0.0000 -1.2845
|
|
||||||
v 3.2856 0.0000 -1.7910
|
|
||||||
v 1.2846 0.0000 -2.0627
|
|
||||||
v 1.7911 0.0000 -3.2855
|
|
||||||
v -1.7907 0.0000 -3.2857
|
|
||||||
v -3.2854 0.0000 -1.8107
|
|
||||||
v -3.2856 0.0000 1.7912
|
|
||||||
# 16 vertices
|
|
||||||
|
|
||||||
vn 0.0000 1.0000 -0.0000
|
|
||||||
# 1 vertex normals
|
|
||||||
|
|
||||||
vt 0.3045 0.1861 0.0000
|
|
||||||
vt 0.3038 0.8139 0.0000
|
|
||||||
vt 0.1861 0.6977 0.0000
|
|
||||||
vt 0.1861 0.3045 0.0000
|
|
||||||
vt 0.6955 0.1861 0.0000
|
|
||||||
vt 0.2274 -0.0000 0.0000
|
|
||||||
vt 0.7726 -0.0000 0.0000
|
|
||||||
vt 0.8139 0.3045 0.0000
|
|
||||||
vt 1.0000 0.2274 0.0000
|
|
||||||
vt 0.8139 0.6955 0.0000
|
|
||||||
vt 1.0000 0.7725 0.0000
|
|
||||||
vt 0.6955 0.8139 0.0000
|
|
||||||
vt 0.7726 1.0000 0.0000
|
|
||||||
vt 0.2275 1.0000 0.0000
|
|
||||||
vt 0.0000 0.7755 0.0000
|
|
||||||
vt 0.0000 0.2274 0.0000
|
|
||||||
# 16 texture coords
|
|
||||||
|
|
||||||
g headusOBJexport001
|
|
||||||
usemtl Material__46
|
|
||||||
s 1
|
|
||||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
|
||||||
f 5/5/1 1/1/1 6/6/1 7/7/1
|
|
||||||
f 8/8/1 5/5/1 7/7/1 9/9/1
|
|
||||||
f 10/10/1 8/8/1 9/9/1 11/11/1
|
|
||||||
f 12/12/1 10/10/1 11/11/1 13/13/1
|
|
||||||
f 2/2/1 12/12/1 13/13/1 14/14/1
|
|
||||||
f 3/3/1 2/2/1 14/14/1 15/15/1
|
|
||||||
f 4/4/1 3/3/1 15/15/1 16/16/1
|
|
||||||
f 1/1/1 4/4/1 16/16/1 6/6/1
|
|
||||||
f 12/12/1 5/5/1 8/8/1 10/10/1
|
|
||||||
f 5/5/1 12/12/1 2/2/1 1/1/1
|
|
||||||
# 11 polygons
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 397 B |
Loading…
Reference in a new issue