A little cleanup and some CCC model system updates.

This commit is contained in:
Chicken Bones committed 2013-06-12 03:15:50 +10:00
1 parent 16a3ea3875
commit 5378912e46
9 files changed
+22 -42

No files matched your search

@@ -23,7 +23,7 @@ object CornerMicroClass extends MicroblockClass
val rx = if((s&4) != 0) -1 else 1
val ry = if((s&1) != 0) -1 else 1
val rz = if((s&2) != 0) -1 else 1
val transform = new Scale(new Vector3(rx, ry, rz), Vector3.center)
val transform = new Scale(new Vector3(rx, ry, rz)).at(Vector3.center)
for(t <- 1 until 8)
{
+4 -3
View File
@@ -73,13 +73,13 @@ object EdgeMicroClass extends MicroblockClass
{
val rx = if((s&2) != 0) -1 else 1
val rz = if((s&1) != 0) -1 else 1
val transform = new TransformationList(new Scale(new Vector3(rx, 1, rz)), AxisCycle.cycles(s>>2))
val transform = new TransformationList(new Scale(new Vector3(rx, 1, rz)), AxisCycle.cycles(s>>2)).at(Vector3.center)
for(t <- 1 until 8)
{
val d = t/8D
aBounds(t<<4|s) = new SelectionBox(new Cuboid6(0, 0, 0, d, 1, d))
.transform(transform, Vector3.center).bound
.transform(transform).bound
}
}
@@ -133,12 +133,13 @@ object PostMicroClass
for(s <- 0 until 3)
{
val transform = Rotation.sideRotations(s<<1).at(Vector3.center)
for(t <- 2 until 8 by 2)
{
val d1 = 0.5-t/16D
val d2 = 0.5+t/16D
aBounds(t<<4|s) = new SelectionBox(new Cuboid6(d1, 0, d1, d2, 1, d2))
.transform(Rotation.sideRotations(s<<1), Vector3.center).bound
.transform(transform).bound
}
}
+4 -1
View File
@@ -45,12 +45,15 @@ object FaceMicroClass extends MicroblockClass
var aBounds:Array[Cuboid6] = new Array(256);
for(s <- 0 until 6)
{
val transform = Rotation.sideRotations(s).at(Vector3.center)
for(t <- 1 until 8)
{
val d = t/8D
aBounds(t<<4|s) = new SelectionBox(new Cuboid6(0, 0, 0, 1, d, 1))
.transform(Rotation.sideRotations(s), Vector3.center).bound
.transform(transform).bound
}
}
def getName = "mcr_face"
+5 -2
View File
@@ -37,6 +37,8 @@ object HollowMicroClass extends MicroblockClass
var pBoxes:Array[Seq[Cuboid6]] = new Array(256)
var occBounds:Array[Cuboid6] = new Array(256)
for(s <- 0 until 6)
{
val transform = Rotation.sideRotations(s).at(Vector3.center)
for(t <- 1 until 8)
{
val d = t/8D
@@ -47,10 +49,11 @@ object HollowMicroClass extends MicroblockClass
new SelectionBox(new Cuboid6(1-w1, 0, 0, 1, d, 1)),
new SelectionBox(new Cuboid6(w1, 0, 0, 1-w1, d, w1)),
new SelectionBox(new Cuboid6(w1, 0, 1-w1, 1-w1, d, 1)))
.map(_.transform(Rotation.sideRotations(s), Vector3.center).bound)
.map(_.transform(transform).bound)
occBounds(t<<4|s) = new SelectionBox(new Cuboid6(1/8D, 0, 1/8D, 7/8D, d, 7/8D))
.transform(Rotation.sideRotations(s), Vector3.center).bound
.transform(transform).bound
}
}
def getName = "mcr_hllw"
+4 -2
View File
@@ -142,10 +142,11 @@ object ItemMicroPartRenderer extends IItemRenderer
def renderItem(t:ItemRenderType, item:ItemStack, data:Object*)
{
GL11.glPushMatrix()
if(t == ItemRenderType.ENTITY)
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glScaled(0.5, 0.5, 0.5)
if(t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY)
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F)
val material = getMaterial(item)
val mcrClass = MicroblockClassRegistry.getMicroClass(item.getItemDamage)
@@ -162,6 +163,7 @@ object ItemMicroPartRenderer extends IItemRenderer
val part = mcrClass.create(size, mcrClass.itemSlot, 0, true).asInstanceOf[MicroblockClient]
part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), null, material, part.getBounds, 0)
CCRenderState.draw()
GL11.glPopMatrix()
}
def renderHighlight(world:World, player:EntityPlayer, stack:ItemStack, hit:MovingObjectPosition):Boolean =
+1 -1
View File
@@ -16,7 +16,7 @@ trait PlacementGrid
val pos = new BlockCoord(hit)
GL11.glPushMatrix()
GL11.glTranslated(pos.x+0.5, pos.y+0.5, pos.z+0.5)
Rotation.sideRotationsG(side).glRotate()
Rotation.sideRotations(side).glApply()
val rhit = new Vector3(pos.x+0.5, pos.y+0.5, pos.z+0.5).subtract(hit).rotate(Rotation.sideQuatsR(side^1))
GL11.glTranslated(0, rhit.y-0.002, 0)
}
@@ -6,6 +6,7 @@ import net.minecraft.block.BlockRedstoneWire
import net.minecraft.world.IBlockAccess
import net.minecraft.util.Direction
import PartMap._
import codechicken.core.vec.Rotation._
trait IRedstonePart
{
-31
View File
@@ -101,35 +101,4 @@ public enum PartMap
throw new IllegalArgumentException("Faces "+s1+" and "+s2+" are opposites");
return 15+edgeBetweenMap[s1*6+s2];
}
private static int[] sideRotMap = new int[]{
3,5,2,4,
3,4,2,5,
1,5,0,4,
1,4,0,5,
1,2,0,3,
1,3,0,2};
public static int rotateSide(int s, int r)
{
return sideRotMap[s<<2|r];
}
private static int[] rotSideMap = new int[]{
-1,-1, 2, 0, 3, 1,
-1,-1, 2, 0, 1, 3,
2, 0,-1,-1, 3, 1,
2, 0,-1,-1, 1, 3,
2, 0, 1, 3,-1,-1,
2, 0, 3, 1,-1,-1};
/**
* Reverse of rotateSide
*/
public static int rotationTo(int s1, int s2)
{
if((s1&6) == (s2&6))
throw new IllegalArgumentException("Faces "+s1+" and "+s2+" are opposites");
return rotSideMap[s1*6+s2];
}
}
@@ -79,6 +79,7 @@ public abstract class McMetaPart extends McBlockPart implements IPartMeta
@Override
public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass)
{
new RenderBlocks(new PartMetaAccess(this)).renderBlockByRenderType(getBlock(), x(), y(), z());
if(pass == 0)
new RenderBlocks(new PartMetaAccess(this)).renderBlockByRenderType(getBlock(), x(), y(), z());
}
}