Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package t1a.client.modely;
- import static org.lwjgl.opengl.GL11.GL_AMBIENT_AND_DIFFUSE;
- import static org.lwjgl.opengl.GL11.GL_BLEND;
- import static org.lwjgl.opengl.GL11.GL_COLOR_MATERIAL;
- import static org.lwjgl.opengl.GL11.GL_COMPILE;
- import static org.lwjgl.opengl.GL11.GL_FRONT_AND_BACK;
- import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
- import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
- import static org.lwjgl.opengl.GL11.GL_TRIANGLE_STRIP;
- import static org.lwjgl.opengl.GL11.glBegin;
- import static org.lwjgl.opengl.GL11.glBlendFunc;
- import static org.lwjgl.opengl.GL11.glCallList;
- import static org.lwjgl.opengl.GL11.glColor3b;
- import static org.lwjgl.opengl.GL11.glColorMaterial;
- import static org.lwjgl.opengl.GL11.glEnable;
- import static org.lwjgl.opengl.GL11.glEnd;
- import static org.lwjgl.opengl.GL11.glEndList;
- import static org.lwjgl.opengl.GL11.glGenLists;
- import static org.lwjgl.opengl.GL11.glNewList;
- import static org.lwjgl.opengl.GL11.glPopAttrib;
- import static org.lwjgl.opengl.GL11.glPopMatrix;
- import static org.lwjgl.opengl.GL11.glPushAttrib;
- import static org.lwjgl.opengl.GL11.glPushMatrix;
- import static org.lwjgl.opengl.GL11.glTranslated;
- import static org.lwjgl.opengl.GL11.*;
- import java.nio.FloatBuffer;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Random;
- import net.minecraft.client.renderer.entity.Render;
- import net.minecraft.entity.Entity;
- import org.lwjgl.BufferUtils;
- import t1a.common.safeWorldStuff.EntityExplosion;
- import t1a.common.safeWorldStuff.EntityExplosion.NukeParticle;
- import t1a.common.safeWorldStuff.LinearAlgebra;
- public class RenderExplosion extends Render {
- private FloatBuffer fb= BufferUtils.createFloatBuffer(16);
- public List<NukeParticle> particles = new ArrayList<NukeParticle>();
- static int callCube;
- static int callTetra;
- static LinearAlgebra vec;
- Random r = new Random();
- double scale = 2;
- public RenderExplosion(){
- super();
- compileTetra();
- }
- @Override
- public void doRender(Entity entity, double d0, double d1, double d2,
- float f, float f1) {
- assert(entity instanceof EntityExplosion);
- EntityExplosion explosion= (EntityExplosion) entity;
- particles = explosion.particles;
- glPushMatrix();
- glPushAttrib(GL_BLEND);
- glEnable (GL_BLEND);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4b((byte)115, (byte)67, (byte)46, (byte)50);//TODO get this looking better colour.
- glTranslated(d0, d1, d2);//trans whole thing
- //*
- for(NukeParticle particle : particles){
- double x = particle.x,
- y = particle.y,
- z = particle.z;
- /*
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3d(0.5+x,y, z-0.5/1.41);
- glVertex3d(x-0.5, y, z-0.5/1.41);
- glVertex3d(x, y+0.5, z+0.5/1.41);
- glVertex3d(x, y-0.5,z+0.5/1.41);
- glVertex3d(0.5+x,y, z-0.5/1.41);
- glVertex3d(x-0.5, y, z-0.5/1.41);
- glEnd();
- //*/
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3d(x+scale, y, z);
- glVertex3d(x, y, z);
- glVertex3d(x+scale, y+scale, z);
- glVertex3d(x, y+scale, z);
- glVertex3d(x+scale, y+scale, z+scale);
- glVertex3d(x, y+scale,z+ scale);
- glVertex3d(x+scale, y, z+scale);
- glVertex3d(x, y, z+scale);
- glVertex3d(x+scale, y, z);
- glVertex3d(x, y, z);
- glEnd();
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3d(x, y, z);
- glVertex3d(x, y, z+scale);
- glVertex3d(x, y+scale, z);
- glVertex3d(x, y+scale, z+scale);
- glEnd();
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3d(x+scale, y+scale, z);
- glVertex3d(x+scale, y+scale, z+scale);
- glVertex3d(x+scale, y, z);
- glVertex3d(x+scale, y, z+scale);
- glEnd();
- }
- //*/
- glPopAttrib();
- glPopMatrix();
- }
- public static void compileTetra(){
- callTetra= glGenLists(1);
- glNewList(callTetra, GL_COMPILE);
- glBegin(GL_TRIANGLE_STRIP);
- glVertex3f(0.5f, 0, -0.5f/1.41f);
- glVertex3f(-0.5f, 0, -0.5f/1.41f);
- glVertex3f(0, 0.5f, 0.5f/1.41f);
- glVertex3f(0, -0.5f,0.5f/1.41f);
- glVertex3f(0.5f, 0, -0.5f/1.41f);
- glVertex3f(-0.5f, 0, -0.5f/1.41f);
- glEnd();
- glEndList();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment