Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -30,24 +31,31 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
|
||||
public class SpatialSkyRender extends IRenderHandler
|
||||
{
|
||||
|
||||
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
|
||||
|
||||
private final Random random = new Random();
|
||||
private long cycle = 0;
|
||||
private final int dspList;
|
||||
private long cycle = 0;
|
||||
|
||||
public SpatialSkyRender() {
|
||||
public SpatialSkyRender()
|
||||
{
|
||||
this.dspList = GLAllocation.generateDisplayLists( 1 );
|
||||
}
|
||||
|
||||
public static IRenderHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float partialTicks, WorldClient world, Minecraft mc)
|
||||
public void render( float partialTicks, WorldClient world, Minecraft mc )
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
if ( now - this.cycle > 2000 )
|
||||
if( now - this.cycle > 2000 )
|
||||
{
|
||||
this.cycle = now;
|
||||
GL11.glNewList( this.dspList, GL11.GL_COMPILE );
|
||||
@@ -57,59 +65,59 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
float fade = now - this.cycle;
|
||||
fade /= 1000;
|
||||
fade = 0.15f * (1.0f - Math.abs( (fade - 1.0f) * (fade - 1.0f) ));
|
||||
fade = 0.15f * ( 1.0f - Math.abs( ( fade - 1.0f ) * ( fade - 1.0f ) ) );
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable( GL11.GL_FOG );
|
||||
GL11.glDisable( GL11.GL_ALPHA_TEST );
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
GL11.glDepthMask( false );
|
||||
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 1 )
|
||||
{
|
||||
GL11.glRotatef( 90.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 2)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 2 )
|
||||
{
|
||||
GL11.glRotatef( -90.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 3)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 3 )
|
||||
{
|
||||
GL11.glRotatef( 180.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
if( i == 4 )
|
||||
{
|
||||
GL11.glRotatef( 90.0F, 0.0F, 0.0F, 1.0F );
|
||||
}
|
||||
|
||||
if (i == 5)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
if( i == 5 )
|
||||
{
|
||||
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F );
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(0);
|
||||
tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D);
|
||||
tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
|
||||
tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I( 0 );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDepthMask( true );
|
||||
|
||||
if ( fade > 0.0f )
|
||||
if( fade > 0.0f )
|
||||
{
|
||||
GL11.glDisable( GL11.GL_FOG );
|
||||
GL11.glDisable( GL11.GL_ALPHA_TEST );
|
||||
@@ -129,7 +137,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
GL11.glPopAttrib();
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
}
|
||||
|
||||
private void renderTwinkles()
|
||||
@@ -137,7 +145,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
for (int i = 0; i < 50; ++i)
|
||||
for( int i = 0; i < 50; ++i )
|
||||
{
|
||||
double iX = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
double iY = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
@@ -145,7 +153,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
double d3 = 0.05F + this.random.nextFloat() * 0.1F;
|
||||
double dist = iX * iX + iY * iY + iZ * iZ;
|
||||
|
||||
if ( dist < 1.0D && dist > 0.01D )
|
||||
if( dist < 1.0D && dist > 0.01D )
|
||||
{
|
||||
dist = 1.0D / Math.sqrt( dist );
|
||||
iX *= dist;
|
||||
@@ -164,11 +172,11 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
double d15 = Math.sin( d14 );
|
||||
double d16 = Math.cos( d14 );
|
||||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
for( int j = 0; j < 4; ++j )
|
||||
{
|
||||
double d17 = 0.0D;
|
||||
double d18 = ((j & 2) - 1) * d3;
|
||||
double d19 = ((j + 1 & 2) - 1) * d3;
|
||||
double d18 = ( ( j & 2 ) - 1 ) * d3;
|
||||
double d19 = ( ( j + 1 & 2 ) - 1 ) * d3;
|
||||
double d20 = d18 * d16 - d19 * d15;
|
||||
double d21 = d19 * d16 + d18 * d15;
|
||||
double d22 = d20 * d12 + d17 * d13;
|
||||
@@ -182,10 +190,4 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static IRenderHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user