changes to RiftRender
This commit is contained in:
@@ -10,6 +10,7 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import StevenDimDoors.mod_pocketDim.CommonProxy;
|
||||
import StevenDimDoors.mod_pocketDim.Spells;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||
@@ -24,6 +25,7 @@ public class ClientProxy extends CommonProxy
|
||||
|
||||
//MinecraftForgeClient.preloadTexture(BLOCK_PNG);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimDoor.class, new RenderDimDoor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRift.class, new RenderRift());
|
||||
|
||||
|
||||
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
|
||||
|
||||
@@ -164,8 +164,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
|
||||
GL11.glRotatef((float)(count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
Tessellator var24 = Tessellator.instance;
|
||||
var24.startDrawingQuads();
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
|
||||
|
||||
|
||||
@@ -180,7 +179,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
|
||||
var22 = 1.0F;
|
||||
yConverted = 1.0F;
|
||||
}
|
||||
var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
|
||||
GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F);
|
||||
if(tile.openOrClosed)
|
||||
{
|
||||
|
||||
@@ -188,60 +187,60 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
|
||||
{
|
||||
case 0:
|
||||
|
||||
var24.addVertex(x+.01F, y-1 , z);
|
||||
var24.addVertex(x+.01, y-1, z+1.0D);
|
||||
var24.addVertex(x+.01 , y+1 , z + 1.0D);
|
||||
var24.addVertex(x+.01 , y+1 , z);
|
||||
GL11.glVertex3d(x+.01F, y-1 , z);
|
||||
GL11.glVertex3d(x+.01, y-1, z+1.0D);
|
||||
GL11.glVertex3d(x+.01 , y+1 , z + 1.0D);
|
||||
GL11.glVertex3d(x+.01 , y+1 , z);
|
||||
break;
|
||||
case 1:
|
||||
var24.addVertex(x , y+1 , z+.01);
|
||||
var24.addVertex(x+1 , y+1 , z+.01);
|
||||
var24.addVertex(x+1, y-1, z+.01);
|
||||
var24.addVertex(x, y-1, z+.01);
|
||||
GL11.glVertex3d(x , y+1 , z+.01);
|
||||
GL11.glVertex3d(x+1 , y+1 , z+.01);
|
||||
GL11.glVertex3d(x+1, y-1, z+.01);
|
||||
GL11.glVertex3d(x, y-1, z+.01);
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 2: //
|
||||
var24.addVertex(x+.99 , y+1 , z);
|
||||
var24.addVertex(x+.99 , y+1 , z + 1.0D);
|
||||
var24.addVertex(x+.99, y-1, z+1.0D);
|
||||
var24.addVertex(x+.99, y-1, z);
|
||||
GL11.glVertex3d(x+.99 , y+1 , z);
|
||||
GL11.glVertex3d(x+.99 , y+1 , z + 1.0D);
|
||||
GL11.glVertex3d(x+.99, y-1, z+1.0D);
|
||||
GL11.glVertex3d(x+.99, y-1, z);
|
||||
break;
|
||||
case 3:
|
||||
var24.addVertex(x, y-1, z+.99);
|
||||
var24.addVertex(x+1, y-1, z+.99);
|
||||
var24.addVertex(x+1 , y+1 , z+.99);
|
||||
var24.addVertex(x , y+1 , z+.99);
|
||||
GL11.glVertex3d(x, y-1, z+.99);
|
||||
GL11.glVertex3d(x+1, y-1, z+.99);
|
||||
GL11.glVertex3d(x+1 , y+1 , z+.99);
|
||||
GL11.glVertex3d(x , y+1 , z+.99);
|
||||
break;
|
||||
case 4://
|
||||
// GL11.glTranslatef();
|
||||
|
||||
var24.addVertex(x+.15F, y-1 , z);
|
||||
var24.addVertex(x+.15, y-1, z+1.0D);
|
||||
var24.addVertex(x+.15 , y+1 , z + 1.0D);
|
||||
var24.addVertex(x+.15 , y+1 , z);
|
||||
GL11.glVertex3d(x+.15F, y-1 , z);
|
||||
GL11.glVertex3d(x+.15, y-1, z+1.0D);
|
||||
GL11.glVertex3d(x+.15 , y+1 , z + 1.0D);
|
||||
GL11.glVertex3d(x+.15 , y+1 , z);
|
||||
break;
|
||||
case 5:
|
||||
var24.addVertex(x , y+1 , z+.15);
|
||||
var24.addVertex(x+1 , y+1 , z+.15);
|
||||
var24.addVertex(x+1, y-1, z+.15);
|
||||
var24.addVertex(x, y-1, z+.15);
|
||||
GL11.glVertex3d(x , y+1 , z+.15);
|
||||
GL11.glVertex3d(x+1 , y+1 , z+.15);
|
||||
GL11.glVertex3d(x+1, y-1, z+.15);
|
||||
GL11.glVertex3d(x, y-1, z+.15);
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 6: //
|
||||
var24.addVertex(x+.85 , y+1 , z);
|
||||
var24.addVertex(x+.85 , y+1 , z + 1.0D);
|
||||
var24.addVertex(x+.85, y-1, z+1.0D);
|
||||
var24.addVertex(x+.85, y-1, z);
|
||||
GL11.glVertex3d(x+.85 , y+1 , z);
|
||||
GL11.glVertex3d(x+.85 , y+1 , z + 1.0D);
|
||||
GL11.glVertex3d(x+.85, y-1, z+1.0D);
|
||||
GL11.glVertex3d(x+.85, y-1, z);
|
||||
break;
|
||||
case 7:
|
||||
var24.addVertex(x, y-1, z+.85);
|
||||
var24.addVertex(x+1, y-1, z+.85);
|
||||
var24.addVertex(x+1 , y+1 , z+.85);
|
||||
var24.addVertex(x , y+1 , z+.85);
|
||||
GL11.glVertex3d(x, y-1, z+.85);
|
||||
GL11.glVertex3d(x+1, y-1, z+.85);
|
||||
GL11.glVertex3d(x+1 , y+1 , z+.85);
|
||||
GL11.glVertex3d(x , y+1 , z+.85);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -253,7 +252,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
|
||||
|
||||
|
||||
|
||||
var24.draw();
|
||||
GL11.glEnd();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
package StevenDimDoors.mod_pocketDimClient;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderRift extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double xWorld, double yWorld,
|
||||
double zWorld, float f)
|
||||
{
|
||||
yWorld = yWorld+.75;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL_LIGHTING);
|
||||
|
||||
//GL11.glLogicOp(GL11.GL_INVERT);
|
||||
// GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||
|
||||
GL11.glColor4f(.3F, .3F, .3F, .2F);
|
||||
|
||||
GL11.glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
|
||||
|
||||
/**
|
||||
* just draws the verticies
|
||||
*/
|
||||
//testDraw(TileEntityRift.class.cast(te).renderingCenters, xWorld, yWorld, zWorld);
|
||||
this.drawCrack(TileEntityRift.class.cast(te).renderingCenters, xWorld, yWorld, zWorld);
|
||||
this.drawCrackRotated(TileEntityRift.class.cast(te).renderingCenters, xWorld, yWorld, zWorld);
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL_TEXTURE_2D);
|
||||
|
||||
GL11.glDisable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public void drawCrack(HashMap<Integer, double[]> quads,double xWorld,double yWorld,double zWorld)
|
||||
{
|
||||
GL11.glBegin(GL11.GL_QUAD_STRIP);
|
||||
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
for(int i = 0;;i++)
|
||||
{
|
||||
if(!quads.containsKey(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
double[] coords = quads.get(i);
|
||||
double width=Math.log(quads.size()-i+1)/8;
|
||||
if(coords[3]==0)
|
||||
{
|
||||
|
||||
if(quads.containsKey(i+1))
|
||||
{
|
||||
|
||||
drawVertex(xWorld+coords[0]+.5, yWorld+coords[1]-width/2 , zWorld+coords[2]);
|
||||
drawVertex(xWorld+coords[0]+.5 , yWorld+coords[1]+width/2 , zWorld+coords[2]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
drawVertex(xWorld+coords[0]+.5, yWorld+coords[1]-width/200 , zWorld+coords[2]);
|
||||
drawVertex(xWorld+coords[0]+.5 , yWorld+coords[1]+width/200 , zWorld+coords[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
if(quads.containsKey(i+1))
|
||||
{
|
||||
drawVertex(xWorld+coords[0], yWorld+coords[1]-width/2 , zWorld+coords[2]+.5);
|
||||
drawVertex(xWorld+coords[0], yWorld+coords[1]+width/2 , zWorld+coords[2]+.5);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
drawVertex(xWorld+coords[0], yWorld+coords[1]+width/200 , zWorld+coords[2]+.5);
|
||||
drawVertex(xWorld+coords[0], yWorld+coords[1]-width/200, zWorld+coords[2]+.5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
GL11.glEnd();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void drawCrackRotated(HashMap<Integer, double[]> quads,double xWorld,double yWorld,double zWorld)
|
||||
{
|
||||
GL11.glBegin(GL11.GL_QUAD_STRIP);
|
||||
|
||||
drawVertex(xWorld+.5, yWorld+Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
drawVertex(xWorld+.5, yWorld-Math.log(quads.size()+1)/8, zWorld+.5);
|
||||
for(int i = 0;;i++)
|
||||
{
|
||||
if(!quads.containsKey(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
double[] coords = quads.get(i);
|
||||
double width=Math.log(quads.size()-i+1)/8;
|
||||
if(coords[3]==0)
|
||||
{
|
||||
|
||||
|
||||
if(quads.containsKey(i+1))
|
||||
{
|
||||
drawVertex(xWorld+coords[0]+.5, yWorld-(coords[1]-width/2) , zWorld-coords[2]+1);
|
||||
drawVertex(xWorld+coords[0]+.5 , yWorld-(coords[1]+width/2) , zWorld-coords[2]+1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
drawVertex(xWorld+coords[0]+.5, yWorld-(coords[1]-width/200) , zWorld-coords[2]+1);
|
||||
drawVertex(xWorld+coords[0]+.5 , yWorld-(coords[1]+width/200) , zWorld-coords[2]+1);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if(quads.containsKey(i+1))
|
||||
{
|
||||
|
||||
drawVertex(xWorld-coords[0]+1, yWorld-(coords[1]-width/2) , zWorld+coords[2]+.5);
|
||||
drawVertex(xWorld-coords[0]+1, yWorld-(coords[1]+width/2) , zWorld+coords[2]+.5);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
drawVertex(xWorld-coords[0]+1, yWorld-(coords[1]+width/200) , zWorld+coords[2]+.5);
|
||||
drawVertex(xWorld-coords[0]+1, yWorld-(coords[1]-width/200), zWorld+coords[2]+.5);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnd();
|
||||
}
|
||||
|
||||
public void testDraw(HashMap<Integer, double[]> quads,double xWorld,double yWorld,double zWorld)
|
||||
{
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
for(int i = 0;;i++)
|
||||
{
|
||||
|
||||
if(!quads.containsKey(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
double[] coords = quads.get(i);
|
||||
drawVertex(xWorld-coords[0], yWorld , zWorld+.1);
|
||||
drawVertex(xWorld-coords[0], yWorld+.1 , zWorld+.1);
|
||||
drawVertex(xWorld-coords[0], yWorld +.1, zWorld);
|
||||
drawVertex(xWorld-coords[0], yWorld , zWorld);
|
||||
|
||||
|
||||
}
|
||||
GL11.glEnd();
|
||||
|
||||
}
|
||||
public void drawVertex(double x, double y, double z)
|
||||
{
|
||||
GL11.glVertex3f((float)x,(float)y,(float)z);
|
||||
}
|
||||
public double[] rotateCoords(int rotation, double[] coords)
|
||||
{
|
||||
double[] rotatedCoords = new double[4];
|
||||
if(rotation == 180)
|
||||
{
|
||||
|
||||
|
||||
rotatedCoords[0]=-coords[0];
|
||||
rotatedCoords[1]=-coords[1];
|
||||
|
||||
rotatedCoords[2]=-coords[2];
|
||||
rotatedCoords[3]=-coords[3];
|
||||
//return rotatedCoords;
|
||||
}
|
||||
return coords;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user