Applied-Energistics-2-tiler.../src/main/java/appeng/client/render/model/pipeline/QuadVertexData.java
elix-x d7f32a985d Cables & parts and Baking pipeline
- Added cables & parts rendering.
- Facades got a completely new way of rendering. Anvil facades are
totally a thing.
- Added baking pipeline for simplified, highly configurable quad baking.

NOTE: Yes, there are a lot of improvements to do, bugs to fix, stuff to
add. I'm just pushing it prior to code structure change, so it does not
get lost in stashes. But it actually works!
2016-08-19 22:46:13 +02:00

122 lines
2.4 KiB
Java

package appeng.client.render.model.pipeline;
import java.lang.reflect.Field;
import com.google.common.base.Throwables;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public final class QuadVertexData
{
private static final Field unpackedData = ReflectionHelper.findField( UnpackedBakedQuad.class, "unpackedData" );
private static float[][][] unpackedData( UnpackedBakedQuad quad )
{
try
{
return (float[][][]) unpackedData.get( quad );
}
catch( Exception e )
{
throw Throwables.propagate( e );
}
}
private VertexFormat format;
private float[][][] data;
private int tintIndex;
private EnumFacing face;
private TextureAtlasSprite sprite;
protected boolean applyDiffuseLighting;
public QuadVertexData( VertexFormat format, float[][][] data, int tintIndex, EnumFacing face, TextureAtlasSprite sprite, boolean applyDiffuseLighting )
{
this.format = format;
this.data = data;
this.tintIndex = tintIndex;
this.face = face;
this.sprite = sprite;
this.applyDiffuseLighting = applyDiffuseLighting;
}
public QuadVertexData( UnpackedBakedQuad quad )
{
this( quad.getFormat(), unpackedData( quad ), quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting() );
}
public UnpackedBakedQuad toQuad()
{
return new UnpackedBakedQuad( data, tintIndex, face, sprite, applyDiffuseLighting, format );
}
public VertexFormat getFormat()
{
return format;
}
public void setFormat( VertexFormat format )
{
this.format = format;
}
public float[][][] getData()
{
return data;
}
public void setData( float[][][] data )
{
this.data = data;
}
public int getTintIndex()
{
return tintIndex;
}
public void setTintIndex( int tintIndex )
{
this.tintIndex = tintIndex;
}
public EnumFacing getFace()
{
return face;
}
public void setFace( EnumFacing face )
{
this.face = face;
}
public TextureAtlasSprite getSprite()
{
return sprite;
}
public void setSprite( TextureAtlasSprite sprite )
{
this.sprite = sprite;
}
public boolean shouldApplyDiffuseLighting()
{
return applyDiffuseLighting;
}
public void setApplyDiffuseLighting( boolean applyDiffuseLighting )
{
this.applyDiffuseLighting = applyDiffuseLighting;
}
}