Improved battery render
This commit is contained in:
parent
c1f8082fe4
commit
1805ddbbb1
2 changed files with 359 additions and 18 deletions
|
@ -12,10 +12,12 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -35,25 +37,64 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
|||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
||||
{
|
||||
for (int i = 2; i < 6; i++)
|
||||
if (t.worldObj != null)
|
||||
{
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
||||
glScalef(0.46f, 0.46f, 0.46f);
|
||||
GL11.glRotatef(90 * i, 0, 1, 0);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_LEVELS);
|
||||
MODEL.renderPart("Battery");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
MODEL.renderPart("CapInterior");
|
||||
MODEL.renderPart("CapCorner");
|
||||
MODEL.renderPart("CapEdge");
|
||||
MODEL.renderPart("BaseEdge");
|
||||
MODEL.renderPart("BaseInterior");
|
||||
MODEL.renderPart("BaseCorner");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CASE);
|
||||
MODEL.renderPart("VertConnector");
|
||||
MODEL.renderPart("BatteryCase");
|
||||
glPopMatrix();
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
/**
|
||||
* How to render entire battery:
|
||||
for each quadrant:
|
||||
render Battery
|
||||
if corner of multiblock and is the quadrant that has no neighbors
|
||||
if(no battery below)
|
||||
render BaseCorner
|
||||
if(no battery above)
|
||||
render CapCorner
|
||||
if quadrant with one external neighbor
|
||||
if(no battery below)
|
||||
render BaseEdge
|
||||
if(no battery above)
|
||||
render CapEdge
|
||||
if quadrant with three external neighbors //can't have quadrant with 2 external neighbors in rectangular prism
|
||||
if(no battery below)
|
||||
render BaseEdge
|
||||
if(no battery above)
|
||||
render CapEdge
|
||||
for each side:
|
||||
render BatteryCase
|
||||
if(battery above)
|
||||
render VertConnector
|
||||
*/
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
|
||||
glScalef(0.46f, 0.46f, 0.46f);
|
||||
GL11.glRotatef(90 * i, 0, 1, 0);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
|
||||
Vector3 checkPos = new Vector3(t).modifyPositionFromSide(dir);
|
||||
|
||||
// If this face has no other batteries attatched in this direction:
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
MODEL.renderPart("BaseCorner");
|
||||
MODEL.renderPart("CapCorner");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_LEVELS);
|
||||
MODEL.renderPart("Battery");
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CAP);
|
||||
MODEL.renderPart("CapInterior");
|
||||
MODEL.renderPart("CapEdge");
|
||||
MODEL.renderPart("BaseEdge");
|
||||
MODEL.renderPart("BaseInterior");
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_CASE);
|
||||
MODEL.renderPart("VertConnector");
|
||||
|
||||
if (new Vector3(t).modifyPositionFromSide(ForgeDirection.UP).getTileEntity(t.worldObj) instanceof TileBattery)
|
||||
MODEL.renderPart("BatteryCase");
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
300
src/main/resources/assets/resonantinduction/models/battery.obj
Normal file
300
src/main/resources/assets/resonantinduction/models/battery.obj
Normal file
|
@ -0,0 +1,300 @@
|
|||
# Blender v2.69 (sub 0) OBJ File: 'battery.blend'
|
||||
# www.blender.org
|
||||
mtllib battery.mtl
|
||||
g Battery
|
||||
v 0.333532 0.200000 -0.884667
|
||||
v 0.333532 1.600000 -0.884667
|
||||
v 0.566469 0.200000 -0.884667
|
||||
v 0.566469 1.600000 -0.884667
|
||||
v 0.768198 0.200000 -0.768198
|
||||
v 0.768198 1.600000 -0.768198
|
||||
v 0.884667 0.200000 -0.566469
|
||||
v 0.884667 1.600000 -0.566469
|
||||
v 0.884667 0.200000 -0.333531
|
||||
v 0.884667 1.600000 -0.333531
|
||||
v 0.768198 0.200000 -0.131802
|
||||
v 0.768198 1.600000 -0.131802
|
||||
v 0.566469 0.200000 0.000000
|
||||
v 0.566469 1.600000 0.000000
|
||||
v 0.000000 0.200000 -0.566468
|
||||
v 0.000000 1.600000 -0.566468
|
||||
v 0.131802 0.200000 -0.768198
|
||||
v 0.131802 1.600000 -0.768198
|
||||
vt 0.062500 0.000000
|
||||
vt 0.062500 0.625000
|
||||
vt 0.000000 -0.000000
|
||||
vt 0.000000 0.625000
|
||||
usemtl (null)
|
||||
s off
|
||||
f 1/1 2/2 3/3
|
||||
f 3/1 4/2 5/3
|
||||
f 5/1 6/2 7/3
|
||||
f 7/1 8/2 9/3
|
||||
f 9/1 10/2 11/3
|
||||
f 11/1 12/2 13/3
|
||||
f 15/1 16/2 17/3
|
||||
f 17/1 18/2 1/3
|
||||
f 2/2 4/4 3/3
|
||||
f 4/2 6/4 5/3
|
||||
f 6/2 8/4 7/3
|
||||
f 8/2 10/4 9/3
|
||||
f 10/2 12/4 11/3
|
||||
f 12/2 14/4 13/3
|
||||
f 16/2 18/4 17/3
|
||||
f 18/2 2/4 1/3
|
||||
g CapInterior
|
||||
v 0.000000 1.800000 -0.000000
|
||||
v 0.000000 1.800000 -1.000000
|
||||
v 1.000000 1.800000 0.000000
|
||||
v 1.000000 1.800000 -1.000000
|
||||
v 0.000000 1.600000 -0.000000
|
||||
v 0.000000 1.600000 -1.000000
|
||||
v 1.000000 1.600000 0.000000
|
||||
v 1.000000 1.600000 -1.000000
|
||||
vt 0.500000 0.500000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.500000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 19/5 21/6 20/7
|
||||
f 23/5 25/6 24/7
|
||||
f 21/6 22/8 20/7
|
||||
f 25/6 26/8 24/7
|
||||
g CapCorner
|
||||
v 0.900000 1.600000 0.000000
|
||||
v 0.900000 1.600000 -0.900000
|
||||
v 0.000000 1.600000 -0.900000
|
||||
v 0.000000 1.800000 -0.000000
|
||||
v 0.000000 1.800000 -0.750000
|
||||
v 0.750000 1.800000 0.000000
|
||||
v 0.750000 1.800000 -0.750000
|
||||
v 0.000000 1.600000 -0.000000
|
||||
vt 0.249993 0.917969
|
||||
vt 0.250007 0.500000
|
||||
vt 0.390625 1.000000
|
||||
vt 0.390625 0.500000
|
||||
vt 0.250000 0.500000
|
||||
vt 0.390625 0.000000
|
||||
vt 0.417969 0.500000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.417969 0.082031
|
||||
vt 0.500000 0.500000
|
||||
vt 0.500000 0.000000
|
||||
vt 0.250000 0.082031
|
||||
vt 0.000000 0.082031
|
||||
vt 0.000000 0.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 33/9 32/10 28/11
|
||||
f 29/12 31/13 28/14
|
||||
f 30/15 32/16 31/17
|
||||
f 28/18 27/16 29/19
|
||||
f 32/10 27/12 28/11
|
||||
f 31/13 33/20 28/14
|
||||
f 32/16 33/21 31/17
|
||||
f 27/16 34/22 29/19
|
||||
g BaseEdge
|
||||
v 1.000000 0.200000 0.000000
|
||||
v 1.000000 0.200000 -0.900000
|
||||
v 0.000000 0.200000 -0.900000
|
||||
v 0.000000 -0.000000 -0.000000
|
||||
v 0.000000 -0.000000 -1.000000
|
||||
v 1.000000 -0.000000 0.000000
|
||||
v 1.000000 -0.000000 -1.000000
|
||||
v 0.000000 0.200000 -0.000000
|
||||
vt 0.500000 0.000048
|
||||
vt 0.500000 0.449976
|
||||
vt 0.000095 0.000095
|
||||
vt 0.000000 0.500000
|
||||
vt -0.000000 -0.000000
|
||||
vt 0.500000 0.500000
|
||||
vt 0.140625 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.140625 0.500000
|
||||
vt 0.000095 0.450024
|
||||
vt 0.500000 0.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 35/23 36/24 42/25
|
||||
f 41/26 40/27 39/28
|
||||
f 36/29 41/30 37/31
|
||||
f 36/24 37/32 42/25
|
||||
f 40/27 38/33 39/28
|
||||
f 41/30 39/26 37/31
|
||||
g BaseInterior
|
||||
v 1.000000 0.200000 -1.000000
|
||||
v 0.000000 -0.000000 -0.000000
|
||||
v 0.000000 -0.000000 -1.000000
|
||||
v 1.000000 -0.000000 0.000000
|
||||
v 1.000000 -0.000000 -1.000000
|
||||
v 1.000000 0.200000 0.000000
|
||||
v 0.000000 0.200000 -1.000000
|
||||
v 0.000000 0.200000 -0.000000
|
||||
vt 0.496979 0.496979
|
||||
vt -0.000000 0.496979
|
||||
vt 0.496979 0.000000
|
||||
vt 0.000000 -0.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 47/34 46/35 45/36
|
||||
f 43/34 48/35 49/36
|
||||
f 46/35 44/37 45/36
|
||||
f 48/35 50/37 49/36
|
||||
g BaseCorner
|
||||
v 0.900000 0.200000 0.000000
|
||||
v 0.900000 0.200000 -0.900000
|
||||
v 0.000000 0.200000 -0.900000
|
||||
v 0.000000 -0.000000 -0.000000
|
||||
v 0.000000 -0.000000 -1.000000
|
||||
v 1.000000 -0.000000 0.000000
|
||||
v 1.000000 -0.000000 -1.000000
|
||||
v 0.000000 0.200000 -0.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.140625 0.500000
|
||||
vt 0.140625 1.000000
|
||||
vt 0.140625 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.500000 -0.000000
|
||||
vt 0.000000 0.917969
|
||||
vt 0.000000 0.082031
|
||||
vt 0.500000 0.500000
|
||||
usemtl Material
|
||||
s off
|
||||
f 51/38 56/39 57/40
|
||||
f 57/41 55/39 53/38
|
||||
f 57/42 56/43 55/38
|
||||
f 52/44 53/38 51/42
|
||||
f 52/44 51/38 57/40
|
||||
f 52/45 57/41 53/38
|
||||
f 56/43 54/46 55/38
|
||||
f 53/38 58/42 51/42
|
||||
g VertConnector
|
||||
v 0.900000 1.600000 -0.900000
|
||||
v 0.750000 1.800000 -0.750000
|
||||
v 0.900000 2.200000 -0.900000
|
||||
v 0.750000 2.000000 -0.750000
|
||||
v -0.900000 1.600000 -0.900000
|
||||
v -0.750000 1.800000 -0.750000
|
||||
v -0.900000 2.200000 -0.900000
|
||||
v -0.750000 2.000000 -0.750000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.140625 0.082031
|
||||
vt 0.000000 1.000000
|
||||
vt 0.390625 0.000000
|
||||
vt 0.390814 0.999458
|
||||
vt 0.250000 0.082031
|
||||
vt 0.140625 0.917969
|
||||
vt 0.250000 0.917969
|
||||
usemtl Material
|
||||
s off
|
||||
f 61/47 62/48 65/49
|
||||
f 59/50 63/51 60/52
|
||||
f 66/53 62/48 64/54
|
||||
f 62/48 66/53 65/49
|
||||
f 63/51 64/54 60/52
|
||||
f 62/48 60/52 64/54
|
||||
g CapEdge
|
||||
v 0.000000 1.600000 -0.000000
|
||||
v 0.000000 1.600000 -0.900000
|
||||
v 0.000000 1.800000 -0.000000
|
||||
v 0.000000 1.800000 -0.750000
|
||||
v 1.000000 1.800000 0.000000
|
||||
v 1.000000 1.800000 -0.750000
|
||||
v 1.000000 1.600000 -0.900000
|
||||
v 1.000000 1.600000 0.000000
|
||||
vt 0.500000 0.450000
|
||||
vt 0.000000 0.450000
|
||||
vt 0.500000 0.050000
|
||||
vt 0.195312 -0.000000
|
||||
vt 0.195312 0.500000
|
||||
vt 0.125000 0.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.450000 0.000000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.000000 0.050000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.450000 0.500000
|
||||
usemtl Material
|
||||
s off
|
||||
f 69/55 71/56 70/57
|
||||
f 73/58 68/59 72/60
|
||||
f 67/61 68/62 74/63
|
||||
f 71/56 72/64 70/57
|
||||
f 68/59 70/65 72/60
|
||||
f 68/62 73/66 74/63
|
||||
g BatteryCase
|
||||
v 0.900000 1.600000 -0.900000
|
||||
v 0.050000 1.600000 -0.900000
|
||||
v 0.750000 1.600000 -0.900000
|
||||
v 0.050000 1.600000 -0.850000
|
||||
v 0.750000 1.600000 -0.850000
|
||||
v 0.900000 0.200000 -0.900000
|
||||
v 0.050000 0.200000 -0.900000
|
||||
v 0.750000 0.200000 -0.900000
|
||||
v 0.050000 0.200000 -0.850000
|
||||
v 0.750000 0.200000 -0.850000
|
||||
v -0.900000 1.600000 -0.900000
|
||||
v -0.000000 1.600000 -0.900000
|
||||
v -0.050000 1.600000 -0.900000
|
||||
v -0.750000 1.600000 -0.900000
|
||||
v -0.050000 1.600000 -0.850000
|
||||
v -0.750000 1.600000 -0.850000
|
||||
v -0.900000 0.200000 -0.900000
|
||||
v -0.000000 0.200000 -0.900000
|
||||
v -0.050000 0.200000 -0.900000
|
||||
v -0.750000 0.200000 -0.900000
|
||||
v -0.050000 0.200000 -0.850000
|
||||
v -0.750000 0.200000 -0.850000
|
||||
v 0.800000 0.200000 -0.800000
|
||||
v -0.800000 0.200000 -0.800000
|
||||
v 0.800000 1.600000 -0.800000
|
||||
v -0.800000 1.600000 -0.800000
|
||||
vt 0.193694 0.800002
|
||||
vt 0.193694 0.100000
|
||||
vt 0.300810 0.800002
|
||||
vt 0.300810 0.100000
|
||||
vt 0.336515 0.100000
|
||||
vt 0.387262 0.799997
|
||||
vt 0.387262 0.100000
|
||||
vt 0.422968 0.799997
|
||||
vt 0.422967 0.100000
|
||||
vt 0.458674 0.799997
|
||||
vt 0.193442 0.800002
|
||||
vt 0.086326 0.800002
|
||||
vt 0.193442 0.100000
|
||||
vt 0.086326 0.100000
|
||||
vt 0.050620 0.100000
|
||||
vt 0.530084 0.799997
|
||||
vt 0.494379 0.799997
|
||||
vt 0.530084 0.100000
|
||||
vt 0.494378 0.100000
|
||||
vt 0.050621 0.800002
|
||||
vt 0.000126 0.800002
|
||||
vt 0.336516 0.800002
|
||||
vt 0.387010 0.800002
|
||||
vt 0.458672 0.100000
|
||||
vt 0.000126 0.100000
|
||||
vt 0.387010 0.100000
|
||||
usemtl Material.002
|
||||
s off
|
||||
f 75/67 80/68 77/69
|
||||
f 82/70 84/71 77/69
|
||||
f 78/72 83/73 76/74
|
||||
f 76/74 81/75 86/76
|
||||
f 85/77 88/78 91/79
|
||||
f 94/80 88/78 96/81
|
||||
f 89/82 87/83 95/84
|
||||
f 87/83 86/76 93/85
|
||||
f 90/86 100/87 96/81
|
||||
f 79/88 84/71 99/89
|
||||
f 80/68 82/70 77/69
|
||||
f 84/71 79/88 77/69
|
||||
f 83/73 81/75 76/74
|
||||
f 81/75 92/90 86/76
|
||||
f 88/78 94/80 91/79
|
||||
f 88/78 90/86 96/81
|
||||
f 87/83 93/85 95/84
|
||||
f 86/76 92/90 93/85
|
||||
f 100/87 98/91 96/81
|
||||
f 84/71 97/92 99/89
|
Loading…
Reference in a new issue