Rendering cleanup
Replaces the reflexive instantiation of the Renderes with a factory method. Some optimizations to the renderers to no longer push the whole OpenGL state to the stack. General cleanup of duplicate code, etc
This commit is contained in:
@@ -76,6 +76,7 @@ public class AssemblerFX extends EntityFX
|
||||
public void renderParticle( final Tessellator tess, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )
|
||||
{
|
||||
this.time += l;
|
||||
|
||||
if( this.time > 4.0 )
|
||||
{
|
||||
this.time -= 4.0;
|
||||
|
||||
@@ -37,10 +37,12 @@ public class ChargedOreFX extends EntityReddustFX
|
||||
int j1 = super.getBrightnessForRender( par1 );
|
||||
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
||||
j1 += 3;
|
||||
|
||||
if( j1 > 15 )
|
||||
{
|
||||
j1 = 15;
|
||||
}
|
||||
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public class CraftingFx extends EntityBreakingFX
|
||||
final int blkX = MathHelper.floor_double( offX );
|
||||
final int blkY = MathHelper.floor_double( offY );
|
||||
final int blkZ = MathHelper.floor_double( offZ );
|
||||
|
||||
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
|
||||
{
|
||||
offX -= interpPosX;
|
||||
|
||||
@@ -51,8 +51,8 @@ public class LightningArcFX extends LightningFX
|
||||
final double lastDirectionX = this.rx * i;
|
||||
final double lastDirectionY = this.ry * i;
|
||||
final double lastDirectionZ = this.rz * i;
|
||||
|
||||
final double len = Math.sqrt( lastDirectionX * lastDirectionX + lastDirectionY * lastDirectionY + lastDirectionZ * lastDirectionZ );
|
||||
|
||||
for( int s = 0; s < this.getSteps(); s++ )
|
||||
{
|
||||
final double[][] localSteps = this.getPrecomputedSteps();
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.world.World;
|
||||
|
||||
public class LightningFX extends EntityFX
|
||||
{
|
||||
|
||||
private static final Random RANDOM_GENERATOR = new Random();
|
||||
private static final int STEPS = 5;
|
||||
|
||||
@@ -62,6 +61,7 @@ public class LightningFX extends EntityFX
|
||||
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
|
||||
for( int s = 0; s < LightningFX.STEPS; s++ )
|
||||
{
|
||||
this.precomputedSteps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
@@ -86,7 +86,9 @@ public class LightningFX extends EntityFX
|
||||
public void renderParticle( final Tessellator tess, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )
|
||||
{
|
||||
final float j = 1.0f;
|
||||
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
|
||||
|
||||
if( this.particleAge == 3 )
|
||||
{
|
||||
this.regen();
|
||||
@@ -190,10 +192,6 @@ public class LightningFX extends EntityFX
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); GL11.glDisable( GL11.GL_CULL_FACE ); tess.draw();
|
||||
* GL11.glPopAttrib(); tess.startDrawingQuads();
|
||||
*/
|
||||
}
|
||||
|
||||
private void clear()
|
||||
@@ -210,7 +208,9 @@ public class LightningFX extends EntityFX
|
||||
tess.addVertexWithUV( this.verticesWithUV[0], this.verticesWithUV[1], this.verticesWithUV[2], f6, f8 );
|
||||
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
|
||||
}
|
||||
|
||||
this.hasData = true;
|
||||
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
this.vertices[x] = a[x];
|
||||
|
||||
Reference in New Issue
Block a user