Update some CCL repack stuff
This commit is contained in:
@@ -55,12 +55,14 @@ public class CachedFormat
|
|||||||
public boolean hasNormal;
|
public boolean hasNormal;
|
||||||
public boolean hasColor;
|
public boolean hasColor;
|
||||||
public boolean hasUV;
|
public boolean hasUV;
|
||||||
|
public boolean hasOverlay;
|
||||||
public boolean hasLightMap;
|
public boolean hasLightMap;
|
||||||
|
|
||||||
public int positionIndex = -1;
|
public int positionIndex = -1;
|
||||||
public int normalIndex = -1;
|
public int normalIndex = -1;
|
||||||
public int colorIndex = -1;
|
public int colorIndex = -1;
|
||||||
public int uvIndex = -1;
|
public int uvIndex = -1;
|
||||||
|
public int overlayIndex = -1;
|
||||||
public int lightMapIndex = -1;
|
public int lightMapIndex = -1;
|
||||||
|
|
||||||
public int elementCount;
|
public int elementCount;
|
||||||
@@ -104,24 +106,31 @@ public class CachedFormat
|
|||||||
this.colorIndex = i;
|
this.colorIndex = i;
|
||||||
break;
|
break;
|
||||||
case UV:
|
case UV:
|
||||||
if( element.getIndex() == 0 )
|
switch( element.getIndex() )
|
||||||
{
|
{
|
||||||
if( this.hasUV )
|
case 0:
|
||||||
|
if( hasUV )
|
||||||
{
|
{
|
||||||
throw new IllegalStateException( "Found 2 UV elements.." );
|
throw new IllegalStateException( "Found 2 UV elements.." );
|
||||||
}
|
}
|
||||||
this.hasUV = true;
|
hasUV = true;
|
||||||
this.uvIndex = i;
|
uvIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
case 1:
|
||||||
else if( element.getIndex() == 1 )
|
if( hasOverlay )
|
||||||
{
|
{
|
||||||
if( this.hasLightMap )
|
throw new IllegalStateException( "Found 2 Overlay elements.." );
|
||||||
|
}
|
||||||
|
hasOverlay = true;
|
||||||
|
overlayIndex = i;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if( hasLightMap )
|
||||||
{
|
{
|
||||||
throw new IllegalStateException( "Found 2 LightMap elements.." );
|
throw new IllegalStateException( "Found 2 LightMap elements.." );
|
||||||
}
|
}
|
||||||
this.hasLightMap = true;
|
hasLightMap = true;
|
||||||
this.lightMapIndex = i;
|
lightMapIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
@@ -313,7 +314,11 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
|||||||
*/
|
*/
|
||||||
public BakedQuad bake()
|
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 v = 0; v < 4; v++ )
|
||||||
{
|
{
|
||||||
for( int e = 0; e < this.format.elementCount; e++ )
|
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 );
|
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 );
|
return new BakedQuad( packedData, this.tintIndex, this.orientation, this.sprite, this.diffuseLighting );
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -354,6 +347,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
|||||||
public float[] normal;
|
public float[] normal;
|
||||||
public float[] color;
|
public float[] color;
|
||||||
public float[] uv;
|
public float[] uv;
|
||||||
|
public float[] overlay;
|
||||||
public float[] lightmap;
|
public float[] lightmap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,6 +400,10 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer
|
|||||||
{
|
{
|
||||||
this.uv = this.raw[this.format.uvIndex];
|
this.uv = this.raw[this.format.uvIndex];
|
||||||
}
|
}
|
||||||
|
if( format.hasOverlay )
|
||||||
|
{
|
||||||
|
overlay = raw[format.overlayIndex];
|
||||||
|
}
|
||||||
if( this.format.hasLightMap )
|
if( this.format.hasLightMap )
|
||||||
{
|
{
|
||||||
this.lightmap = this.raw[this.format.lightMapIndex];
|
this.lightmap = this.raw[this.format.lightMapIndex];
|
||||||
|
|||||||
Reference in New Issue
Block a user