mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-18 19:29:29 +00:00
who faster?
This commit is contained in:
1 parent
4cbc62afb0
commit
3f8d860b95
1 file changed
+44
-18
@@ -14,17 +14,10 @@ import tombenpotter.emt.common.entities.EntityLaser;
|
||||
|
||||
public class RenderShield extends Render {
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/shield.png");
|
||||
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
|
||||
private static float[] values = new float[6912];
|
||||
|
||||
static{
|
||||
float sin1;
|
||||
float cos1;
|
||||
|
||||
@@ -37,6 +30,8 @@ public class RenderShield extends Render {
|
||||
float hsin2;
|
||||
float hcos2;
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (float h = 0; h < 360; h += 15) {
|
||||
sin1 = 0;
|
||||
cos1 = 1;
|
||||
@@ -47,13 +42,24 @@ public class RenderShield extends Render {
|
||||
for (float angle = 0; angle < 360; angle += 15) {
|
||||
sin2 = MathHelper.sin((float) Math.toRadians(angle + 15));
|
||||
cos2 = MathHelper.cos((float) Math.toRadians(angle + 15));
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(sin1 * hcos1, hsin1, cos1 * hcos1, 1, 1);
|
||||
tessellator.addVertexWithUV(sin1 * hcos2, hsin2, cos1 * hcos2, 1, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos2, hsin2, cos2 * hcos2, 0, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos1, hsin1, cos2 * hcos1, 0, 1);
|
||||
tessellator.draw();
|
||||
|
||||
values[i] = sin1 * hcos1;
|
||||
values[i + 1] = hsin1;
|
||||
values[i + 2] = cos1 * hcos1;
|
||||
|
||||
values[i + 3] = sin1 * hcos2;
|
||||
values[i + 4] = hsin2;
|
||||
values[i + 5] = cos1 * hcos2;
|
||||
|
||||
values[i + 6] = sin2 * hcos2;
|
||||
values[i + 7] = hsin2;
|
||||
values[i + 8] = cos2 * hcos2;
|
||||
|
||||
values[i + 9] = sin2 * hcos1;
|
||||
values[i + 10] = hsin1;
|
||||
values[i + 11] = cos2 * hcos1;
|
||||
|
||||
i += 12;
|
||||
|
||||
sin1 = sin2;
|
||||
cos1 = cos2;
|
||||
@@ -62,6 +68,26 @@ public class RenderShield extends Render {
|
||||
hsin1 = hsin2;
|
||||
hcos1 = hcos2;
|
||||
}
|
||||
}
|
||||
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int v = 0; v < values.length; v += 12) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(values[v] , values[v + 1] , values[v + 2] , 1, 1);
|
||||
tessellator.addVertexWithUV(values[v + 3] , values[v + 4] , values[v + 5] , 1, 0);
|
||||
tessellator.addVertexWithUV(values[v + 6] , values[v + 7] , values[v + 8] , 0, 0);
|
||||
tessellator.addVertexWithUV(values[v + 9] , values[v + 10], values[v + 11], 0, 1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
Reference in new issue
Block a user