Update some CCL repack stuff
This commit is contained in:
@@ -55,12 +55,14 @@ public class CachedFormat
|
||||
public boolean hasNormal;
|
||||
public boolean hasColor;
|
||||
public boolean hasUV;
|
||||
public boolean hasOverlay;
|
||||
public boolean hasLightMap;
|
||||
|
||||
public int positionIndex = -1;
|
||||
public int normalIndex = -1;
|
||||
public int colorIndex = -1;
|
||||
public int uvIndex = -1;
|
||||
public int overlayIndex = -1;
|
||||
public int lightMapIndex = -1;
|
||||
|
||||
public int elementCount;
|
||||
@@ -104,25 +106,32 @@ public class CachedFormat
|
||||
this.colorIndex = i;
|
||||
break;
|
||||
case UV:
|
||||
if( element.getIndex() == 0 )
|
||||
switch( element.getIndex() )
|
||||
{
|
||||
if( this.hasUV )
|
||||
{
|
||||
throw new IllegalStateException( "Found 2 UV elements.." );
|
||||
}
|
||||
this.hasUV = true;
|
||||
this.uvIndex = i;
|
||||
break;
|
||||
}
|
||||
else if( element.getIndex() == 1 )
|
||||
{
|
||||
if( this.hasLightMap )
|
||||
{
|
||||
throw new IllegalStateException( "Found 2 LightMap elements.." );
|
||||
}
|
||||
this.hasLightMap = true;
|
||||
this.lightMapIndex = i;
|
||||
break;
|
||||
case 0:
|
||||
if( hasUV )
|
||||
{
|
||||
throw new IllegalStateException( "Found 2 UV elements.." );
|
||||
}
|
||||
hasUV = true;
|
||||
uvIndex = i;
|
||||
break;
|
||||
case 1:
|
||||
if( hasOverlay )
|
||||
{
|
||||
throw new IllegalStateException( "Found 2 Overlay elements.." );
|
||||
}
|
||||
hasOverlay = true;
|
||||
overlayIndex = i;
|
||||
break;
|
||||
case 2:
|
||||
if( hasLightMap )
|
||||
{
|
||||
throw new IllegalStateException( "Found 2 LightMap elements.." );
|
||||
}
|
||||
hasLightMap = true;
|
||||
lightMapIndex = i;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+12
-14
@@ -22,6 +22,7 @@ package appeng.thirdparty.codechicken.lib.model;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -313,7 +314,11 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
||||
*/
|
||||
public BakedQuad bake()
|
||||
{
|
||||
int[] packedData = new int[this.format.format.getNextOffset()];
|
||||
if( format.format != DefaultVertexFormats.BLOCK )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to bake this quad to the specified format. " + format.format );
|
||||
}
|
||||
int[] packedData = new int[this.format.format.getSize()];
|
||||
for( int v = 0; v < 4; v++ )
|
||||
{
|
||||
for( int e = 0; e < this.format.elementCount; e++ )
|
||||
@@ -321,19 +326,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
||||
LightUtil.pack( this.vertices[v].raw[e], packedData, this.format.format, v, e );
|
||||
}
|
||||
}
|
||||
return new BakedQuad( packedData, this.tintIndex, this.orientation, this.sprite, this.diffuseLighting, this.format.format );
|
||||
}
|
||||
|
||||
/**
|
||||
* Bakes this quad to an UnpackedBakedQuad.
|
||||
*
|
||||
* @return The UnpackedBakedQuad.
|
||||
*/
|
||||
public UnpackedBakedQuad bakeUnpacked()
|
||||
{
|
||||
UnpackedBakedQuad.Builder quad = new UnpackedBakedQuad.Builder( this.format.format );
|
||||
this.pipe( quad );
|
||||
return quad.build();
|
||||
return new BakedQuad( packedData, this.tintIndex, this.orientation, this.sprite, this.diffuseLighting );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,6 +347,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
||||
public float[] normal;
|
||||
public float[] color;
|
||||
public float[] uv;
|
||||
public float[] overlay;
|
||||
public float[] lightmap;
|
||||
|
||||
/**
|
||||
@@ -406,6 +400,10 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
||||
{
|
||||
this.uv = this.raw[this.format.uvIndex];
|
||||
}
|
||||
if( format.hasOverlay )
|
||||
{
|
||||
overlay = raw[format.overlayIndex];
|
||||
}
|
||||
if( this.format.hasLightMap )
|
||||
{
|
||||
this.lightmap = this.raw[this.format.lightMapIndex];
|
||||
|
||||
Reference in New Issue
Block a user