Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
@@ -32,21 +34,22 @@ import appeng.client.texture.MissingIcon;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
|
||||
|
||||
public class ModelGenerator
|
||||
{
|
||||
|
||||
private static final class CachedModel implements IBakedModel
|
||||
{
|
||||
List<BakedQuad>[] faces = new List[6];
|
||||
List<BakedQuad> general;
|
||||
private List<BakedQuad>[] faces = new List[6];
|
||||
private List<BakedQuad> general;
|
||||
|
||||
public CachedModel()
|
||||
{
|
||||
this.general = new ArrayList<BakedQuad>();
|
||||
for ( final EnumFacing f : EnumFacing.VALUES )
|
||||
for( final EnumFacing f : EnumFacing.VALUES )
|
||||
this.faces[f.ordinal()] = new ArrayList<BakedQuad>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isGui3d()
|
||||
{
|
||||
@@ -91,45 +94,66 @@ public class ModelGenerator
|
||||
}
|
||||
}
|
||||
|
||||
public int uvRotateBottom;
|
||||
public int uvRotateEast;
|
||||
public int uvRotateNorth;
|
||||
public int uvRotateSouth;
|
||||
public int uvRotateTop;
|
||||
public int uvRotateWest;
|
||||
public IAESprite overrideBlockTexture;
|
||||
public boolean renderAllFaces;
|
||||
private int uvRotateBottom;
|
||||
private int uvRotateEast;
|
||||
private int uvRotateNorth;
|
||||
private int uvRotateSouth;
|
||||
private int uvRotateTop;
|
||||
private int uvRotateWest;
|
||||
private IAESprite overrideBlockTexture;
|
||||
private boolean renderAllFaces;
|
||||
|
||||
public double renderMinX;
|
||||
public double renderMaxX;
|
||||
|
||||
public double renderMinY;
|
||||
public double renderMaxY;
|
||||
|
||||
public double renderMinZ;
|
||||
public double renderMaxZ;
|
||||
private double renderMinX;
|
||||
private double renderMaxX;
|
||||
|
||||
public IBlockAccess blockAccess;
|
||||
|
||||
CachedModel generatedModel = new CachedModel();
|
||||
private double renderMinY;
|
||||
private double renderMaxY;
|
||||
|
||||
private double renderMinZ;
|
||||
private double renderMaxZ;
|
||||
|
||||
private IBlockAccess blockAccess;
|
||||
|
||||
private CachedModel generatedModel = new CachedModel();
|
||||
|
||||
// used to create faces...
|
||||
final FaceBakery faceBakery = new FaceBakery();
|
||||
private final FaceBakery faceBakery = new FaceBakery();
|
||||
|
||||
float tx=0,ty=0,tz=0;
|
||||
final float[] defUVs = { 0, 0, 1, 1 };
|
||||
private float tx = 0, ty = 0, tz = 0;
|
||||
private final float[] defUVs = { 0, 0, 1, 1 };
|
||||
|
||||
private final float[] quadsUV = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
};
|
||||
private EnumSet<EnumFacing> renderFaces = EnumSet.allOf( EnumFacing.class );
|
||||
private boolean flipTexture = false;
|
||||
private List<SMFace> faces = new ArrayList();
|
||||
|
||||
private int point = 0;
|
||||
private int brightness = -1;
|
||||
private float[][] points = new float[4][];
|
||||
private EnumFacing currentFace = EnumFacing.UP;
|
||||
private int color = -1;
|
||||
|
||||
public void setRenderBoundsFromBlock(
|
||||
final Block block )
|
||||
{
|
||||
if ( block == null ) return;
|
||||
if( block == null )
|
||||
return;
|
||||
|
||||
this.renderMinX = block.getBlockBoundsMinX();
|
||||
this.renderMinY = block.getBlockBoundsMinY();
|
||||
this.renderMinZ = block.getBlockBoundsMinZ();
|
||||
this.renderMaxX = block.getBlockBoundsMaxX();
|
||||
this.renderMaxY = block.getBlockBoundsMaxY();
|
||||
this.renderMaxZ = block.getBlockBoundsMaxZ();
|
||||
this.setRenderMinX( block.getBlockBoundsMinX() );
|
||||
this.setRenderMinY( block.getBlockBoundsMinY() );
|
||||
this.setRenderMinZ( block.getBlockBoundsMinZ() );
|
||||
this.setRenderMaxX( block.getBlockBoundsMaxX() );
|
||||
this.setRenderMaxY( block.getBlockBoundsMaxY() );
|
||||
this.setRenderMaxZ( block.getBlockBoundsMaxZ() );
|
||||
}
|
||||
|
||||
public void setRenderBounds(
|
||||
@@ -140,20 +164,18 @@ public class ModelGenerator
|
||||
final double h,
|
||||
final double i )
|
||||
{
|
||||
this.renderMinX = d;
|
||||
this.renderMinY = e;
|
||||
this.renderMinZ = f;
|
||||
this.renderMaxX = g;
|
||||
this.renderMaxY = h;
|
||||
this.renderMaxZ = i;
|
||||
this.setRenderMinX( d );
|
||||
this.setRenderMinY( e );
|
||||
this.setRenderMinZ( f );
|
||||
this.setRenderMaxX( g );
|
||||
this.setRenderMaxY( h );
|
||||
this.setRenderMaxZ( i );
|
||||
}
|
||||
|
||||
int color = -1;
|
||||
|
||||
public void setBrightness(
|
||||
final int i )
|
||||
{
|
||||
this.brightness =i;
|
||||
this.brightness = i;
|
||||
}
|
||||
|
||||
public void setColorRGBA_F(
|
||||
@@ -162,7 +184,7 @@ public class ModelGenerator
|
||||
final int b,
|
||||
final float a )
|
||||
{
|
||||
final int alpha = ( int ) ( a * 0xff );
|
||||
final int alpha = (int) ( a * 0xff );
|
||||
this.color = alpha << 24 |
|
||||
r << 16 |
|
||||
b << 8 |
|
||||
@@ -173,29 +195,30 @@ public class ModelGenerator
|
||||
final int whiteVariant )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color = //alpha << 24 |
|
||||
whiteVariant;
|
||||
this.color = // alpha << 24 |
|
||||
whiteVariant;
|
||||
}
|
||||
|
||||
public void setColorOpaque(
|
||||
final int r,
|
||||
final int g,
|
||||
final int b )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color =// alpha << 24 |
|
||||
r << 16 |
|
||||
this.color = // alpha << 24 |
|
||||
r << 16 |
|
||||
g << 8 |
|
||||
b;
|
||||
}
|
||||
|
||||
|
||||
public void setColorOpaque_F(
|
||||
final int r,
|
||||
final int g,
|
||||
final int b )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color = //alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 |
|
||||
this.color = // alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 |
|
||||
Math.min( 0xff, Math.max( 0, g ) ) << 8 |
|
||||
Math.min( 0xff, Math.max( 0, b ) );
|
||||
}
|
||||
@@ -205,12 +228,12 @@ public class ModelGenerator
|
||||
final float bf,
|
||||
final float gf )
|
||||
{
|
||||
final int r = (int)( rf * 0xff );
|
||||
final int g = (int)( gf * 0xff );
|
||||
final int b = (int)( bf * 0xff );
|
||||
final int r = (int) ( rf * 0xff );
|
||||
final int g = (int) ( gf * 0xff );
|
||||
final int b = (int) ( bf * 0xff );
|
||||
final int alpha = 0xff;
|
||||
this.color = //alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 |
|
||||
this.color = // alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 |
|
||||
Math.min( 0xff, Math.max( 0, g ) ) << 8 |
|
||||
Math.min( 0xff, Math.max( 0, b ) );
|
||||
}
|
||||
@@ -219,24 +242,24 @@ public class ModelGenerator
|
||||
final ItemStack is )
|
||||
{
|
||||
final Item it = is.getItem();
|
||||
|
||||
if ( it instanceof ItemMultiPart )
|
||||
return ( (ItemMultiPart) it).getIcon( is);
|
||||
|
||||
|
||||
if( it instanceof ItemMultiPart )
|
||||
return ( (ItemMultiPart) it ).getIcon( is );
|
||||
|
||||
final Block blk = Block.getBlockFromItem( it );
|
||||
|
||||
if ( blk != null )
|
||||
return this.getIcon(blk.getStateFromMeta( is.getMetadata() ))[0];
|
||||
|
||||
if ( it instanceof AEBaseItem )
|
||||
if( blk != null )
|
||||
return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0];
|
||||
|
||||
if( it instanceof AEBaseItem )
|
||||
{
|
||||
final IAESprite ico = ( (AEBaseItem)it ).getIcon(is);
|
||||
if ( ico != null ) return ico;
|
||||
final IAESprite ico = ( (AEBaseItem) it ).getIcon( is );
|
||||
if( ico != null )
|
||||
return ico;
|
||||
}
|
||||
|
||||
return new MissingIcon( is );
|
||||
}
|
||||
|
||||
return new MissingIcon( is );
|
||||
}
|
||||
|
||||
public IAESprite[] getIcon(
|
||||
final IBlockState state )
|
||||
@@ -244,62 +267,58 @@ public class ModelGenerator
|
||||
final IAESprite[] out = new IAESprite[6];
|
||||
|
||||
final Block blk = state.getBlock();
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
final AEBaseBlock base = (AEBaseBlock)blk;
|
||||
for ( final EnumFacing face : EnumFacing.VALUES )
|
||||
final AEBaseBlock base = (AEBaseBlock) blk;
|
||||
for( final EnumFacing face : EnumFacing.VALUES )
|
||||
out[face.ordinal()] = base.getIcon( face, state );
|
||||
}
|
||||
else
|
||||
{
|
||||
final TextureAtlasSprite spite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( state );
|
||||
if ( spite == null )
|
||||
if( spite == null )
|
||||
{
|
||||
out[0] = new MissingIcon( blk );
|
||||
out[1] = new MissingIcon( blk );
|
||||
out[2] = new MissingIcon( blk );
|
||||
out[3] = new MissingIcon( blk );
|
||||
out[4] = new MissingIcon( blk );
|
||||
out[5] = new MissingIcon( blk );
|
||||
out[0] = new MissingIcon( blk );
|
||||
out[1] = new MissingIcon( blk );
|
||||
out[2] = new MissingIcon( blk );
|
||||
out[3] = new MissingIcon( blk );
|
||||
out[4] = new MissingIcon( blk );
|
||||
out[5] = new MissingIcon( blk );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAESprite mySpite = new BaseIcon( spite );
|
||||
out[0] = mySpite;
|
||||
out[1] = mySpite;
|
||||
out[2] = mySpite;
|
||||
out[3] = mySpite;
|
||||
out[4] = mySpite;
|
||||
out[5] = mySpite;
|
||||
out[0] = mySpite;
|
||||
out[1] = mySpite;
|
||||
out[2] = mySpite;
|
||||
out[3] = mySpite;
|
||||
out[4] = mySpite;
|
||||
out[5] = mySpite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
public IAESprite[] getIcon( final IBlockAccess world, final BlockPos pos)
|
||||
public IAESprite[] getIcon( final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
final IBlockState state = world.getBlockState( pos );
|
||||
final Block blk = state.getBlock();
|
||||
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
final IAESprite[] out = new IAESprite[6];
|
||||
|
||||
final AEBaseBlock base = (AEBaseBlock)blk;
|
||||
for ( final EnumFacing face : EnumFacing.VALUES )
|
||||
final AEBaseBlock base = (AEBaseBlock) blk;
|
||||
for( final EnumFacing face : EnumFacing.VALUES )
|
||||
out[face.ordinal()] = base.getIcon( world, pos, face );
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
return this.getIcon( state );
|
||||
}
|
||||
|
||||
int point =0;
|
||||
int brightness = -1;
|
||||
float[][] points = new float[4][];
|
||||
|
||||
public void addVertexWithUV(
|
||||
final EnumFacing face,
|
||||
final double x,
|
||||
@@ -308,48 +327,48 @@ public class ModelGenerator
|
||||
final double u,
|
||||
final double v )
|
||||
{
|
||||
this.points[this.point++] = new float[]{ (float)x+ this.tx, (float)y+ this.ty, (float)z+ this.tz, (float)u, (float)v };
|
||||
|
||||
if ( this.point == 4 )
|
||||
this.points[this.point++] = new float[] { (float) x + this.tx, (float) y + this.ty, (float) z + this.tz, (float) u, (float) v };
|
||||
|
||||
if( this.point == 4 )
|
||||
{
|
||||
this.brightness = -1;
|
||||
final int[] vertData = {
|
||||
Float.floatToRawIntBits( this.points[0][0] ),
|
||||
Float.floatToRawIntBits( this.points[0][1] ),
|
||||
Float.floatToRawIntBits( this.points[0][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[0][3] ),
|
||||
Float.floatToRawIntBits( this.points[0][4] ),
|
||||
0,
|
||||
Float.floatToRawIntBits( this.points[0][0] ),
|
||||
Float.floatToRawIntBits( this.points[0][1] ),
|
||||
Float.floatToRawIntBits( this.points[0][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[0][3] ),
|
||||
Float.floatToRawIntBits( this.points[0][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[1][0] ),
|
||||
Float.floatToRawIntBits( this.points[1][1] ),
|
||||
Float.floatToRawIntBits( this.points[1][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[1][3] ),
|
||||
Float.floatToRawIntBits( this.points[1][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[2][0] ),
|
||||
Float.floatToRawIntBits( this.points[2][1] ),
|
||||
Float.floatToRawIntBits( this.points[2][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[2][3] ),
|
||||
Float.floatToRawIntBits( this.points[2][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[3][0] ),
|
||||
Float.floatToRawIntBits( this.points[3][1] ),
|
||||
Float.floatToRawIntBits( this.points[3][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[3][3] ),
|
||||
Float.floatToRawIntBits( this.points[3][4] ),
|
||||
0,
|
||||
Float.floatToRawIntBits( this.points[1][0] ),
|
||||
Float.floatToRawIntBits( this.points[1][1] ),
|
||||
Float.floatToRawIntBits( this.points[1][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[1][3] ),
|
||||
Float.floatToRawIntBits( this.points[1][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[2][0] ),
|
||||
Float.floatToRawIntBits( this.points[2][1] ),
|
||||
Float.floatToRawIntBits( this.points[2][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[2][3] ),
|
||||
Float.floatToRawIntBits( this.points[2][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[3][0] ),
|
||||
Float.floatToRawIntBits( this.points[3][1] ),
|
||||
Float.floatToRawIntBits( this.points[3][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[3][3] ),
|
||||
Float.floatToRawIntBits( this.points[3][4] ),
|
||||
0,
|
||||
};
|
||||
|
||||
this.generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, this.color, face ));
|
||||
this.generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, this.color, face ) );
|
||||
|
||||
this.point =0;
|
||||
this.point = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,9 +376,9 @@ public class ModelGenerator
|
||||
final Block block,
|
||||
final BlockPos pos )
|
||||
{
|
||||
//setRenderBoundsFromBlock( block );
|
||||
// setRenderBoundsFromBlock( block );
|
||||
|
||||
final IAESprite[] textures = this.getIcon( this.blockAccess,pos );
|
||||
final IAESprite[] textures = this.getIcon( this.getBlockAccess(), pos );
|
||||
this.setColorOpaque_I( 0xffffff );
|
||||
|
||||
this.renderFaceXNeg( block, pos, textures[EnumFacing.WEST.ordinal()] );
|
||||
@@ -368,7 +387,7 @@ public class ModelGenerator
|
||||
this.renderFaceYPos( block, pos, textures[EnumFacing.UP.ordinal()] );
|
||||
this.renderFaceZNeg( block, pos, textures[EnumFacing.NORTH.ordinal()] );
|
||||
this.renderFaceZPos( block, pos, textures[EnumFacing.SOUTH.ordinal()] );
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,9 +396,9 @@ public class ModelGenerator
|
||||
final int y,
|
||||
final int z )
|
||||
{
|
||||
this.tx =x;
|
||||
this.ty =y;
|
||||
this.tz =z;
|
||||
this.tx = x;
|
||||
this.ty = y;
|
||||
this.tz = z;
|
||||
}
|
||||
|
||||
public boolean isAlphaPass()
|
||||
@@ -387,31 +406,17 @@ public class ModelGenerator
|
||||
return MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
final float[] quadsUV = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
};
|
||||
public EnumSet<EnumFacing> renderFaces = EnumSet.allOf(EnumFacing.class);
|
||||
public boolean flipTexture=false;
|
||||
private List<SMFace> faces = new ArrayList();
|
||||
|
||||
private float[] getFaceUvs(
|
||||
final EnumFacing face,
|
||||
final Vector3f to_16,
|
||||
final Vector3f from_16 )
|
||||
final Vector3f from_16 )
|
||||
{
|
||||
float from_a = 0;
|
||||
float from_b = 0;
|
||||
float to_a = 0;
|
||||
float to_b = 0;
|
||||
|
||||
switch ( face )
|
||||
switch( face )
|
||||
{
|
||||
case UP:
|
||||
from_a = from_16.x / 16.0f;
|
||||
@@ -473,57 +478,57 @@ public class ModelGenerator
|
||||
|
||||
return afloat;
|
||||
}
|
||||
|
||||
|
||||
public void renderFaceXNeg(
|
||||
final Block blk,
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMinX < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f);
|
||||
final Vector3f from = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f);
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinX() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.WEST;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs,lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
|
||||
public void renderFaceYNeg(
|
||||
final Block blk,
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMinY < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMaxZ * 16.0f );
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinY() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.DOWN;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs, lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceZNeg(
|
||||
final Block blk,
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMinZ < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMinZ * 16.0f );
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinZ() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.NORTH;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs, lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceYPos(
|
||||
final Block blk,
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMaxY > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMinZ * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f);
|
||||
{
|
||||
final boolean isEdge = this.getRenderMaxY() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.UP;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs,lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceZPos(
|
||||
@@ -531,12 +536,12 @@ public class ModelGenerator
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMaxZ > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMinX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMaxZ * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f );
|
||||
final boolean isEdge = this.getRenderMaxZ() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.SOUTH;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs,lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceXPos(
|
||||
@@ -544,45 +549,43 @@ public class ModelGenerator
|
||||
final BlockPos pos,
|
||||
final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.renderMaxX > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMinY * 16.0f, (float) this.renderMinZ * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.renderMaxX * 16.0f, (float) this.renderMaxY * 16.0f, (float) this.renderMaxZ * 16.0f );
|
||||
final boolean isEdge = this.getRenderMaxX() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.EAST;
|
||||
this.addFace(myFace, isEdge,to,from, this.defUVs, lights );
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
private void addFace(
|
||||
final EnumFacing face , final boolean isEdge,
|
||||
final EnumFacing face, final boolean isEdge,
|
||||
final Vector3f to,
|
||||
final Vector3f from,
|
||||
final float[] defUVs2,
|
||||
IAESprite texture )
|
||||
{
|
||||
if ( this.overrideBlockTexture != null )
|
||||
texture = this.overrideBlockTexture;
|
||||
if( this.getOverrideBlockTexture() != null )
|
||||
texture = this.getOverrideBlockTexture();
|
||||
|
||||
this.faces.add( new SMFace( face, isEdge, this.color, to, from, defUVs2, new IconUnwrapper( texture ) ) );
|
||||
}
|
||||
|
||||
EnumFacing currentFace = EnumFacing.UP;
|
||||
|
||||
public void setNormal(
|
||||
final float x,
|
||||
final float y,
|
||||
final float z )
|
||||
{
|
||||
if ( x > 0.5 )
|
||||
if( x > 0.5 )
|
||||
this.currentFace = EnumFacing.EAST;
|
||||
if ( x < -0.5 )
|
||||
if( x < -0.5 )
|
||||
this.currentFace = EnumFacing.WEST;
|
||||
if ( y > 0.5 )
|
||||
if( y > 0.5 )
|
||||
this.currentFace = EnumFacing.UP;
|
||||
if ( y < -0.5 )
|
||||
if( y < -0.5 )
|
||||
this.currentFace = EnumFacing.DOWN;
|
||||
if ( z > 0.5 )
|
||||
if( z > 0.5 )
|
||||
this.currentFace = EnumFacing.SOUTH;
|
||||
if ( z < -0.5 )
|
||||
if( z < -0.5 )
|
||||
this.currentFace = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
@@ -595,31 +598,202 @@ public class ModelGenerator
|
||||
public void finalizeModel( final boolean Flip )
|
||||
{
|
||||
ModelRotation mr = ModelRotation.X0_Y0;
|
||||
|
||||
if ( Flip )
|
||||
mr = ModelRotation.X0_Y180;
|
||||
|
||||
for ( final SMFace face : this.faces )
|
||||
|
||||
if( Flip )
|
||||
mr = ModelRotation.X0_Y180;
|
||||
|
||||
for( final SMFace face : this.faces )
|
||||
{
|
||||
final EnumFacing myFace = face.face;
|
||||
final float[] uvs = this.getFaceUvs( myFace, face.from, face.to );
|
||||
|
||||
final EnumFacing myFace = face.getFace();
|
||||
final float[] uvs = this.getFaceUvs( myFace, face.getFrom(), face.getTo() );
|
||||
|
||||
final BlockFaceUV uv = new BlockFaceUV( uvs, 0 );
|
||||
final BlockPartFace bpf = new BlockPartFace( myFace, face.color, "", uv );
|
||||
|
||||
BakedQuad bf = this.faceBakery.makeBakedQuad( face.to, face.from, bpf, face.spite, myFace, mr, null, true, true );
|
||||
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.color, bf.getFace() );
|
||||
|
||||
if ( face.isEdge )
|
||||
final BlockPartFace bpf = new BlockPartFace( myFace, face.getColor(), "", uv );
|
||||
|
||||
BakedQuad bf = this.faceBakery.makeBakedQuad( face.getTo(), face.getFrom(), bpf, face.getSpite(), myFace, mr, null, true, true );
|
||||
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() );
|
||||
|
||||
if( face.isEdge )
|
||||
this.generatedModel.getFaceQuads( myFace ).add( bf );
|
||||
else
|
||||
this.generatedModel.getGeneralQuads().add( bf );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IBakedModel getOutput()
|
||||
{
|
||||
return this.generatedModel;
|
||||
}
|
||||
|
||||
public IAESprite getOverrideBlockTexture()
|
||||
{
|
||||
return overrideBlockTexture;
|
||||
}
|
||||
|
||||
public IBlockAccess getBlockAccess()
|
||||
{
|
||||
return blockAccess;
|
||||
}
|
||||
|
||||
public void setBlockAccess( IBlockAccess blockAccess )
|
||||
{
|
||||
this.blockAccess = blockAccess;
|
||||
}
|
||||
|
||||
public boolean isRenderAllFaces()
|
||||
{
|
||||
return renderAllFaces;
|
||||
}
|
||||
|
||||
public void setRenderAllFaces( boolean renderAllFaces )
|
||||
{
|
||||
this.renderAllFaces = renderAllFaces;
|
||||
}
|
||||
|
||||
public int getUvRotateBottom()
|
||||
{
|
||||
return uvRotateBottom;
|
||||
}
|
||||
|
||||
public int setUvRotateBottom( int uvRotateBottom )
|
||||
{
|
||||
this.uvRotateBottom = uvRotateBottom;
|
||||
return uvRotateBottom;
|
||||
}
|
||||
|
||||
public int getUvRotateEast()
|
||||
{
|
||||
return uvRotateEast;
|
||||
}
|
||||
|
||||
public int setUvRotateEast( int uvRotateEast )
|
||||
{
|
||||
this.uvRotateEast = uvRotateEast;
|
||||
return uvRotateEast;
|
||||
}
|
||||
|
||||
public int getUvRotateNorth()
|
||||
{
|
||||
return uvRotateNorth;
|
||||
}
|
||||
|
||||
public int setUvRotateNorth( int uvRotateNorth )
|
||||
{
|
||||
this.uvRotateNorth = uvRotateNorth;
|
||||
return uvRotateNorth;
|
||||
}
|
||||
|
||||
public int getUvRotateSouth()
|
||||
{
|
||||
return uvRotateSouth;
|
||||
}
|
||||
|
||||
public int setUvRotateSouth( int uvRotateSouth )
|
||||
{
|
||||
this.uvRotateSouth = uvRotateSouth;
|
||||
return uvRotateSouth;
|
||||
}
|
||||
|
||||
public int getUvRotateTop()
|
||||
{
|
||||
return uvRotateTop;
|
||||
}
|
||||
|
||||
public int setUvRotateTop( int uvRotateTop )
|
||||
{
|
||||
this.uvRotateTop = uvRotateTop;
|
||||
return uvRotateTop;
|
||||
}
|
||||
|
||||
public int getUvRotateWest()
|
||||
{
|
||||
return uvRotateWest;
|
||||
}
|
||||
|
||||
public int setUvRotateWest( int uvRotateWest )
|
||||
{
|
||||
this.uvRotateWest = uvRotateWest;
|
||||
return uvRotateWest;
|
||||
}
|
||||
|
||||
public double getRenderMinX()
|
||||
{
|
||||
return renderMinX;
|
||||
}
|
||||
|
||||
public void setRenderMinX( double renderMinX )
|
||||
{
|
||||
this.renderMinX = renderMinX;
|
||||
}
|
||||
|
||||
public double getRenderMinY()
|
||||
{
|
||||
return renderMinY;
|
||||
}
|
||||
|
||||
public void setRenderMinY( double renderMinY )
|
||||
{
|
||||
this.renderMinY = renderMinY;
|
||||
}
|
||||
|
||||
public double getRenderMinZ()
|
||||
{
|
||||
return renderMinZ;
|
||||
}
|
||||
|
||||
public void setRenderMinZ( double renderMinZ )
|
||||
{
|
||||
this.renderMinZ = renderMinZ;
|
||||
}
|
||||
|
||||
public double getRenderMaxX()
|
||||
{
|
||||
return renderMaxX;
|
||||
}
|
||||
|
||||
public void setRenderMaxX( double renderMaxX )
|
||||
{
|
||||
this.renderMaxX = renderMaxX;
|
||||
}
|
||||
|
||||
public double getRenderMaxY()
|
||||
{
|
||||
return renderMaxY;
|
||||
}
|
||||
|
||||
public void setRenderMaxY( double renderMaxY )
|
||||
{
|
||||
this.renderMaxY = renderMaxY;
|
||||
}
|
||||
|
||||
public double getRenderMaxZ()
|
||||
{
|
||||
return renderMaxZ;
|
||||
}
|
||||
|
||||
public void setRenderMaxZ( double renderMaxZ )
|
||||
{
|
||||
this.renderMaxZ = renderMaxZ;
|
||||
}
|
||||
|
||||
public boolean isFlipTexture()
|
||||
{
|
||||
return flipTexture;
|
||||
}
|
||||
|
||||
public void setFlipTexture( boolean flipTexture )
|
||||
{
|
||||
this.flipTexture = flipTexture;
|
||||
}
|
||||
|
||||
public EnumSet<EnumFacing> getRenderFaces()
|
||||
{
|
||||
return renderFaces;
|
||||
}
|
||||
|
||||
public void setRenderFaces( EnumSet<EnumFacing> renderFaces )
|
||||
{
|
||||
this.renderFaces = renderFaces;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user