render effect iteration

This commit is contained in:
StevenRS11
2014-08-20 16:58:52 -05:00
parent 04ec4b3d2d
commit dc7a19c2f3
5 changed files with 150 additions and 132 deletions

View File

@@ -28,15 +28,16 @@ public class RenderRift extends TileEntitySpecialRenderer
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL_TEXTURE_2D);
GL11.glDisable(GL_LIGHTING);
GL11.glEnable(GL_BLEND);
/**
* GL11.glLogicOp(GL11.GL_INVERT);
* GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
*/
TileEntityRift rift = (TileEntityRift) te;
// draws the verticies corresponding to the passed it
this.drawCrack(((TileEntityRift) te).riftRotation, LSystem.curves.get("terdragon 7"), 3, xWorld, yWorld, zWorld);
this.drawCrack(rift.riftRotation, rift.getCurve(), Math.log(2+rift.growth)/5D, xWorld, yWorld, zWorld);
GL11.glDisable(GL_BLEND);
// reenable all the stuff we disabled
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
@@ -68,24 +69,26 @@ public class RenderRift extends TileEntitySpecialRenderer
double offsetZ = 0;
// changes how far the triangles move
float motionMagnitude = 2.0F;
float motionMagnitude = 3.0F;
// changes how quickly the triangles move
float motionSpeed = 800.0F;
float motionSpeed = 2000.0F;
// number of individual jitter waveforms to generate
// changes how "together" the overall motions are
int jCount = 10;
int jCount = 5;
// Calculate jitter like for monoliths
float time = (float) (((Minecraft.getSystemTime() + 0xF1234568 * this.hashCode()) % 2000000) / motionSpeed);
double[] jitters = new double[jCount];
// generate a series of waveforms
for (int i = 0; i < jCount; i += 2)
for (int i = 0; i < jCount-1; i += 1)
{
jitters[i] = Math.sin((1F + i / 10F) * time) * Math.cos(1F - (i / 10F) * time) / motionMagnitude;
jitters[i + 1] = Math.cos((1F + i / 10F) * time) * Math.sin(1F - (i / 10F) * time) / motionMagnitude;
}
// determines which jitter waveform we select. Modulo so the same point
@@ -95,25 +98,25 @@ public class RenderRift extends TileEntitySpecialRenderer
// set the color for the render
GL11.glColor4f(.3F, .3F, .3F, 1F);
//set the blending mode
GL11.glEnable(GL_BLEND);
//glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
// start rendering triangles for the moving shards
/**best ones so far
* glBlendFunc(GL_SRC_COLOR, GL_ONE);
* glBlendFunc(GL_SRC_COLOR, GL_ONE);
*/
glBlendFunc(GL_SRC_COLOR, GL_ONE);
GL11.glBegin(GL11.GL_TRIANGLES);
for (Point p : poly.points)
{
jIndex = Math.abs(p.x+p.y);
jIndex = Math.abs(((p.x + p.y)*(p.x + p.y + 1)/2) + p.y);
//jIndex++;
// calculate the rotation for the fractal, apply offset, and apply
// jitter
double x = (((p.x + jitters[(jIndex + 1) % jCount]) - offsetX) * Math.cos(Math.toRadians(riftRotation)) - jitters[(jIndex + 2) % jCount]
double x = (((p.x + jitters[(jIndex + 1) % jCount]) - offsetX) * Math.cos(Math.toRadians(riftRotation)) - (jitters[(jIndex + 2) % jCount])
* Math.sin(Math.toRadians(riftRotation)));
double y = p.y + (jitters[jIndex % jCount]);
double z = (((p.x + jitters[(jIndex + 2) % jCount]) - offsetX) * Math.sin(Math.toRadians(riftRotation)) + 0 * Math
double z = (((p.x + jitters[(jIndex + 2) % jCount]) - offsetX) * Math.sin(Math.toRadians(riftRotation)) + (jitters[(jIndex + 2) % jCount]) * Math
.cos(Math.toRadians(riftRotation)));
// apply scaling
x *= scale;
y *= scale;
@@ -131,15 +134,19 @@ public class RenderRift extends TileEntitySpecialRenderer
}
GL11.glEnd();
//GL11.glDisable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
//glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
/**
GL11.glBegin(GL11.GL_TRIANGLES);
/**best one so far
* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
* glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO );
*/
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO );
// draw the next set of triangles to form a background and change their
// color slightly over time
GL11.glBegin(GL11.GL_TRIANGLES);
for (Point p : poly.points)
{
jIndex++;
@@ -160,13 +167,14 @@ public class RenderRift extends TileEntitySpecialRenderer
// stationary shards
if (jIndex % 3 == 0)
{
GL11.glColor4d(jitters[(jIndex + 1) % jCount] / 11, jitters[(jIndex + 2) % jCount] / 8, jitters[(jIndex) % jCount] / 8, 1);
// GL11.glColor4d(jitters[(jIndex + 1) % jCount]/8F , jitters[(jIndex + 2) % jCount] /8F, jitters[(jIndex) % jCount]/8F , 1);
}
GL11.glVertex3d(xWorld + x, yWorld + y, zWorld + z);
}
// stop drawing triangles
GL11.glEnd();
**/
}
}