refactored and broke up rendering godclass, moved parts of it into numina, migrated mode-change overlay to numina events

This commit is contained in:
MachineMuse 2013-09-06 16:10:05 -06:00
parent 686fe8bc50
commit ecce4742d5
63 changed files with 252 additions and 1398 deletions

View file

@ -11,7 +11,7 @@
<property name="mcp.version" value="805"/>
<property name="minecraft.version" value="1.6.2"/>
<property name="forgemajor.version" value="9.10.1"/>
<property name="forgebuild" value="849"/>
<property name="forgebuild" value="851"/>
<property name="forge.version" value="${minecraft.version}-${forgemajor.version}.${forgebuild}"/>
<property name="forgeant.version" value="${forgemajor.version}.${forgebuild}"/>

View file

@ -1,139 +0,0 @@
package net.machinemuse.general.geometry;
import org.lwjgl.opengl.GL11;
import java.awt.*;
/**
* A class representing an RGBA colour and various helper functions. Mainly to
* improve readability elsewhere.
*
* @author MachineMuse
*/
public class Colour {
public static final Colour LIGHTBLUE = new Colour(0.5, 0.5, 1.0, 1.0);
public static final Colour DARKBLUE = new Colour(0.0, 0.0, 0.5, 1.0);
public static final Colour ORANGE = new Colour(0.9, 0.6, 0.2, 1.0);
public static final Colour YELLOW = new Colour(0.0, 0.0, 0.5, 1.0);
public static final Colour WHITE = new Colour(1.0, 1.0, 1.0, 1.0);
public static final Colour BLACK = new Colour(0.0, 0.0, 0.0, 1.0);
public static final Colour RED = new Colour(1.0, 0.2, 0.2, 1.0);
public static final Colour DARKGREEN = new Colour(0.0, 0.8, 0.2, 1.0);
public static final Colour GREEN = new Colour(0.0, 1.0, 0.0, 1.0);
/**
* The RGBA values are stored as floats from 0.0F (nothing) to 1.0F (full
* saturation/opacity)
*/
public double r, g, b, a;
/**
* Constructor. Just sets the RGBA values to the parameters.
*/
public Colour(double r, double g, double b, double a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
/**
* Secondary constructor. Sets RGB accordingly and sets alpha to 1.0F (full
* opacity)
*/
public Colour(float r, float g, float b) {
this(r, g, b, 1.0F);
}
/**
* Takes colours in the integer format that Minecraft uses, and converts.
*/
public Colour(int c) {
this.a = (c >> 24 & 255) / 255.0F;
this.r = (c >> 16 & 255) / 255.0F;
this.g = (c >> 8 & 255) / 255.0F;
this.b = (c & 255) / 255.0F;
}
/**
* Returns this colour as an int in Minecraft's format (I think)
*
* @return int value of this colour
*/
public int getInt() {
int val = 0;
val = val | ((int) (a * 255) << 24);
val = val | ((int) (r * 255) << 16);
val = val | ((int) (g * 255) << 8);
val = val | ((int) (b * 255));
return val;
}
public static int getInt(double r, double g, double b, double a) {
int val = 0;
val = val | ((int) (a * 255) << 24);
val = val | ((int) (r * 255) << 16);
val = val | ((int) (g * 255) << 8);
val = val | ((int) (b * 255));
return val;
}
/**
* Returns a colour with RGB set to the same value ie. a shade of grey.
*/
public static Colour getGreyscale(float value, float alpha) {
return new Colour(value, value, value, alpha);
}
/**
* Returns a colour at interval interval along a linear gradient from this
* to target
*/
public Colour interpolate(Colour target, double d) {
double complement = 1 - d;
return new Colour(this.r * complement + target.r * d, this.g * complement + target.g * d, this.b * complement + target.b * d, this.a
* complement + target.a * d);
}
public void doGL() {
GL11.glColor4d(r, g, b, a);
}
public static void doGLByInt(int c) {
double a = (c >> 24 & 255) / 255.0F;
double r = (c >> 16 & 255) / 255.0F;
double g = (c >> 8 & 255) / 255.0F;
double b = (c & 255) / 255.0F;
GL11.glColor4d(r, g, b, a);
}
public Colour withAlpha(double newalpha) {
return new Colour(this.r, this.g, this.b, newalpha);
}
public double[] asArray() {
return new double[]{r, g, b, a};
}
public String hexColour() {
return hexDigits(r) + hexDigits(g) + hexDigits(b) + (a < 1 ? hexDigits(a) : "");
}
public String hexDigits(double x) {
int y = (int) (x * 255);
String hexDigits = "0123456789ABCDEF";
return hexDigits.charAt(y / 16) + "" + hexDigits.charAt(y % 16);
}
public Color awtColor() {
return new Color((float) r, (float) g, (float) b, (float) a);
}
public boolean equals(Colour o) {
return r == o.r && g == o.g && b == o.b && a == o.a;
}
}

View file

@ -1,53 +0,0 @@
package net.machinemuse.general.geometry;
import net.machinemuse.utils.render.MuseRenderer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import java.nio.DoubleBuffer;
public class DrawableMuseCircle {
public static final double detail = 4;
protected static DoubleBuffer points;
protected DoubleBuffer colour;
public DrawableMuseCircle(Colour c1, Colour c2) {
if (points == null) {
DoubleBuffer arcPoints = MuseRenderer.getArcPoints(0, Math.PI * 2 + 0.0001, detail, 0, 0, 0);
points = BufferUtils.createDoubleBuffer(arcPoints.limit() + 6);
points.put(new double[]{0, 0, 0});
points.put(arcPoints);
arcPoints.rewind();
points.put(arcPoints.get());
points.put(arcPoints.get());
points.put(arcPoints.get());
points.flip();
}
DoubleBuffer colourPoints = MuseRenderer.getColourGradient(c1, c1, points.limit() / 3);
colour = BufferUtils.createDoubleBuffer(colourPoints.limit() + 4);
colour.put(c2.asArray());
colour.put(colourPoints);
colour.flip();
}
public void draw(double radius, double x, double y) {
points.rewind();
colour.rewind();
GL11.glPushMatrix();
GL11.glTranslated(x, y, 0);
GL11.glScaled(radius / detail, radius / detail, 1.0);
MuseRenderer.on2D();
GL11.glEnable(GL11.GL_DEPTH_TEST);
MuseRenderer.arraysOnC();
MuseRenderer.texturelessOn();
MuseRenderer.blendingOn();
GL11.glColorPointer(4, 0, colour);
GL11.glVertexPointer(3, 0, points);
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, 0, points.limit() / 3);
MuseRenderer.blendingOff();
MuseRenderer.texturelessOff();
MuseRenderer.arraysOff();
MuseRenderer.off2D();
GL11.glPopMatrix();
}
}

View file

@ -1,111 +0,0 @@
package net.machinemuse.general.geometry;
import net.machinemuse.utils.render.MuseRenderer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import java.nio.DoubleBuffer;
public class DrawableMuseRect extends MuseRect {
MuseRect lastRect;
Colour insideColour;
Colour outsideColour;
DoubleBuffer vertices;
DoubleBuffer coloursInside;
DoubleBuffer coloursOutside;
public DrawableMuseRect(double left, double top, double right,
double bottom, boolean growFromMiddle, Colour insideColour,
Colour outsideColour) {
super(left, top, right, bottom, growFromMiddle);
this.insideColour = insideColour;
this.outsideColour = outsideColour;
if (growFromMiddle) {
this.lastRect = new MuseRect(left, top, right, bottom);
}
}
public DrawableMuseRect(double left, double top, double right,
double bottom, Colour insideColour, Colour outsideColour) {
super(left, top, right, bottom, false);
this.insideColour = insideColour;
this.outsideColour = outsideColour;
}
public DrawableMuseRect(MusePoint2D ul, MusePoint2D br,
Colour insideColour, Colour outsideColour) {
super(ul, br);
this.insideColour = insideColour;
this.outsideColour = outsideColour;
}
public DrawableMuseRect(MuseRect ref, Colour insideColour, Colour outsideColour) {
super(ref.left(), ref.top(), ref.right(), ref.bottom());
this.insideColour = insideColour;
this.outsideColour = outsideColour;
}
public void draw() {
if (vertices == null || coloursInside == null || coloursOutside == null
|| (lastRect != null && !lastRect.equals(this))) {
this.lastRect = new MuseRect(left(), top(), right(), bottom());
double cornerradius = 3;
double zLevel = 1;
DoubleBuffer corner = MuseRenderer.getArcPoints(Math.PI,
3.0 * Math.PI / 2.0, cornerradius, left() + cornerradius,
top() + cornerradius, zLevel);
vertices = BufferUtils.createDoubleBuffer(corner.limit() * 4);
vertices.put(corner);
corner = MuseRenderer.getArcPoints(3.0 * Math.PI / 2.0,
2.0 * Math.PI, cornerradius, left() + cornerradius,
bottom() - cornerradius, zLevel);
vertices.put(corner);
corner = MuseRenderer.getArcPoints(0, Math.PI / 2.0, cornerradius,
right() - cornerradius, bottom() - cornerradius, zLevel);
vertices.put(corner);
corner = MuseRenderer.getArcPoints(Math.PI / 2.0, Math.PI,
cornerradius, right() - cornerradius, top() + cornerradius,
zLevel);
vertices.put(corner);
vertices.flip();
coloursInside = MuseRenderer.getColourGradient(outsideColour,
outsideColour, vertices.limit() * 4 / 3 + 8);
coloursOutside = MuseRenderer.getColourGradient(insideColour,
insideColour, vertices.limit() * 4 / 3 + 8);
}
MuseRenderer.blendingOn();
MuseRenderer.on2D();
MuseRenderer.texturelessOn();
MuseRenderer.arraysOnC();
GL11.glColorPointer(4, 0, coloursInside);
GL11.glVertexPointer(3, 0, vertices);
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, 0, vertices.limit() / 3);
GL11.glColorPointer(4, 0, coloursOutside);
GL11.glVertexPointer(3, 0, vertices);
GL11.glDrawArrays(GL11.GL_LINE_LOOP, 0, vertices.limit() / 3);
MuseRenderer.texturelessOff();
MuseRenderer.off2D();
MuseRenderer.blendingOff();
MuseRenderer.arraysOff();
}
public DrawableMuseRect setInsideColour(Colour insideColour) {
this.insideColour = insideColour;
return this;
}
public DrawableMuseRect setOutsideColour(Colour outsideColour) {
this.outsideColour = outsideColour;
return this;
}
}

View file

@ -1,39 +0,0 @@
package net.machinemuse.general.geometry;
public class FlyFromPointToPoint2D extends MusePoint2D {
protected MusePoint2D prev;
protected long spawnTime;
protected double timeTo;
public FlyFromPointToPoint2D(double x, double y, double x2, double y2,
double timeTo) {
super(x2, y2);
prev = new MusePoint2D(x, y);
spawnTime = System.currentTimeMillis();
this.timeTo = timeTo;
}
public FlyFromPointToPoint2D(MusePoint2D prev, MusePoint2D target, double timeTo) {
this(prev.x(), prev.y(), target.x(), target.y(), timeTo);
}
@Override
public double x() {
return doRatio(prev.x, x);
}
@Override
public double y() {
return doRatio(prev.y, y);
}
public double doRatio(double val1, double val2) {
long elapsed = System.currentTimeMillis() - spawnTime;
double ratio = elapsed / timeTo;
if (ratio > 1.0F) {
return val2;
} else {
return val2 * ratio + val1 * (1 - ratio);
}
}
}

View file

@ -1,11 +0,0 @@
package net.machinemuse.general.geometry;
import java.nio.DoubleBuffer;
public class LightningBolt {
public DoubleBuffer points;
public LightningBolt(double x1, double y1, double z1, double x2, double y2, double z2, double displacement, double detail) {
}
}

View file

@ -1,83 +0,0 @@
package net.machinemuse.general.geometry;
/**
* Base class for Points. The main reason for this is to have a
* pass-by-reference coordinate with getter/setter functions so that points with
* more elaborate behaviour can be implemented - such as for open/close
* animations.
*
* @author MachineMuse
*
*/
public class MusePoint2D {
protected double x;
protected double y;
public MusePoint2D(double x, double y) {
this.x = x;
this.y = y;
}
public MusePoint2D(MusePoint2D p) {
this(p.x, p.y);
}
public double x() {
return x;
}
public double y() {
return y;
}
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
public MusePoint2D plus(MusePoint2D b) {
return new MusePoint2D(x() + b.x(), y() + b.y());
}
public MusePoint2D minus(MusePoint2D b) {
return new MusePoint2D(x() - b.x(), y() - b.y());
}
public MusePoint2D times(double scalefactor) {
return new MusePoint2D(x() * scalefactor, y() * scalefactor);
}
public boolean equals(MusePoint2D other) {
return this.x() == other.x() && this.y() == other.y();
}
public double distance() {
return Math.sqrt(x() * x() + y() * y());
}
public double distanceTo(MusePoint2D position) {
return Math.sqrt(distanceSq(position));
}
public double distanceSq(MusePoint2D position) {
double xdist = position.x() - this.x();
double ydist = position.y() - this.y();
return xdist * xdist + ydist * ydist;
}
public MusePoint2D normalize() {
double distance = distance();
return new MusePoint2D(x() / distance, y() / distance);
}
public MusePoint2D midpoint(MusePoint2D target) {
return new MusePoint2D((this.x() + target.x()) / 2, (this.y() + target.y()) / 2);
}
public MusePoint2D copy() {
return new MusePoint2D(this.x(), this.y());
}
}

View file

@ -1,94 +0,0 @@
package net.machinemuse.general.geometry;
public class MuseRect {
MusePoint2D ul;
MusePoint2D wh;
public MuseRect(double left, double top, double right, double bottom, boolean growFromMiddle) {
ul = new MusePoint2D(left, top);
wh = new MusePoint2D(right - left, bottom - top);
if (growFromMiddle) {
MusePoint2D center = ul.plus(wh.times(0.5));
this.ul = new FlyFromPointToPoint2D(center, ul, 200);
this.wh = new FlyFromPointToPoint2D(new MusePoint2D(0, 0), wh, 200);
}
}
public MuseRect(double left, double top, double right, double bottom) {
this(left, top, right, bottom, false);
}
public MuseRect(MusePoint2D ul, MusePoint2D br) {
this.ul = ul;
this.wh = br.minus(ul);
}
public double left() {
return ul.x();
}
public double right() {
return ul.x() + wh.x();
}
public double top() {
return ul.y();
}
public double bottom() {
return ul.y() + wh.y();
}
public double width() {
return wh.x();
}
public double height() {
return wh.y();
}
public MuseRect setLeft(double value) {
ul.x = value;
return this;
}
public MuseRect setRight(double value) {
wh.x = value - ul.x();
return this;
}
public MuseRect setTop(double value) {
ul.y = value;
return this;
}
public MuseRect setBottom(double value) {
wh.y = value - ul.y();
return this;
}
public MuseRect setWidth(double value) {
wh.x = value;
return this;
}
public MuseRect setHeight(double value) {
wh.y = value;
return this;
}
public boolean equals(MuseRect other) {
return ul.equals(other.ul) && wh.equals(other.wh);
}
public boolean containsPoint(double x, double y) {
return x > left() && x < right() && y > top() && y < bottom();
}
public double centerx() {
return (left() + right()) / 2.0;
}
public double centery() {
return (top() + bottom()) / 2.0;
}
}

View file

@ -1,68 +0,0 @@
package net.machinemuse.general.geometry;
public class MuseRelativeRect extends MuseRect {
protected MuseRect belowme;
protected MuseRect aboveme;
protected MuseRect leftofme;
protected MuseRect rightofme;
public MuseRelativeRect(double left, double top, double right, double bottom) {
super(left, top, right, bottom);
}
public MuseRelativeRect(double left, double top, double right, double bottom, boolean growFromMiddle) {
super(left, top, right, bottom, growFromMiddle);
}
public MuseRelativeRect(MusePoint2D ul, MusePoint2D br) {
super(ul, br);
}
public double left() {
if (rightofme != null) {
return rightofme.right();
}
return ul.x();
}
public double right() {
if (leftofme != null) {
return leftofme.left();
}
return left() + wh.x();
}
public double top() {
if (belowme != null) {
return belowme.bottom();
}
return ul.y();
}
public double bottom() {
if (aboveme != null) {
return aboveme.top();
}
return top() + wh.y();
}
public MuseRelativeRect setBelow(MuseRect belowme) {
this.belowme = belowme;
return this;
}
public MuseRelativeRect setAbove(MuseRect aboveme) {
this.aboveme = aboveme;
return this;
}
public MuseRelativeRect setLeftOf(MuseRect leftofme) {
this.leftofme = leftofme;
return this;
}
public MuseRelativeRect setRightOf(MuseRect rightofme) {
this.rightofme = rightofme;
return this;
}
}

View file

@ -1,127 +0,0 @@
package net.machinemuse.general.geometry;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.util.Icon;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import java.nio.BufferOverflowException;
import java.nio.DoubleBuffer;
/**
* A curved indicator bar. Probably not gonna use this actually...
*
* @author MachineMuse
*/
public class RadialIndicator {
protected DoubleBuffer vertices;
protected DoubleBuffer textures;
protected DoubleBuffer background;
protected DoubleBuffer foreground;
protected Icon icon;
protected String textureFile;
public RadialIndicator(double innerRadius, double outerRadius, double startangle, double endangle, Colour backgroundColour,
Colour foregroundColour,
Icon icon, String texturefile) {
this.icon = icon;
this.textureFile = texturefile;
DoubleBuffer arcPoints1 = MuseRenderer.getArcPoints(startangle, endangle, outerRadius, 0, 0, 1);
DoubleBuffer arcPoints2 = MuseRenderer.getArcPoints(startangle, endangle, innerRadius, 0, 0, 1);
int numpoints = (arcPoints1.limit() + arcPoints2.limit()) / 3;
// MuseLogger.logDebug("Limit1: " + arcPoints1.limit() + " - Limit2: " + arcPoints2.limit() + " - " + numpoints);
vertices = BufferUtils.createDoubleBuffer(numpoints * 3);
while (arcPoints1.hasRemaining() && arcPoints2.hasRemaining()) {
vertices.put(arcPoints1.get());
vertices.put(arcPoints1.get());
vertices.put(arcPoints1.get());
vertices.put(arcPoints2.get());
vertices.put(arcPoints2.get());
vertices.put(arcPoints2.get());
}
vertices.flip();
float u1 = icon.getMinU();
float v1 = icon.getMinV();
float u2 = icon.getMaxU();
float v2 = icon.getMaxV();
textures = BufferUtils.createDoubleBuffer(numpoints * 2);
int numsegments = (numpoints / 4);
for (double i = 0; i < numsegments; i++) {
double offset = (v2 - v1) * i / numsegments;
textures.put(u1);
textures.put(v1 + offset);
textures.put(u2);
textures.put(v1 + offset);
}
for (double i = 0; i < numsegments; i++) {
double offset = (v2 - v1) * i / numsegments;
textures.put(u1);
textures.put(v1 + offset);
textures.put(u2);
textures.put(v1 + offset);
}
textures.flip();
background = BufferUtils.createDoubleBuffer(numpoints * 4);
try {
while (true) {
background.put(backgroundColour.asArray());
}
} catch (BufferOverflowException e) {
}
background.flip();
foreground = BufferUtils.createDoubleBuffer(numpoints * 4);
try {
while (true) {
foreground.put(foregroundColour.asArray());
}
} catch (BufferOverflowException e) {
}
foreground.flip();
}
public void draw(double x, double y, double percent) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
MuseRenderer.texturelessOff();
GL11.glDisable(GL11.GL_TEXTURE_2D);
MuseRenderer.blendingOn();
GL11.glTranslated(x, y, 0);
MuseRenderer.arraysOff();
int pointsToDraw = (int) (percent * textures.limit() / 2);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
GL11.glVertexPointer(3, 0, vertices);
GL11.glColorPointer(4, 0, background);
// Draw background
GL11.glDrawArrays(GL11.GL_QUAD_STRIP, 0, textures.limit() / 2);
MuseRenderer.pushTexture(textureFile);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glColorPointer(4, 0, foreground);
GL11.glVertexPointer(3, 0, vertices);
GL11.glTexCoordPointer(2, 0, textures);
GL11.glDrawArrays(GL11.GL_QUAD_STRIP, 0, pointsToDraw);
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
MuseRenderer.arraysOff();
MuseRenderer.popTexture();
MuseRenderer.blendingOff();
GL11.glEnable(GL11.GL_CULL_FACE);
// GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glPopMatrix();
}
}

View file

@ -1,45 +0,0 @@
package net.machinemuse.general.geometry;
import net.machinemuse.utils.render.MuseRenderer;
import org.lwjgl.opengl.GL11;
import java.nio.DoubleBuffer;
public class SwirlyMuseCircle {
public static final double detail = 4;
protected DoubleBuffer points;
protected DoubleBuffer colour;
public SwirlyMuseCircle(Colour c1, Colour c2) {
if (points == null) {
points = MuseRenderer.getArcPoints(0, Math.PI * 2 + 0.0001, detail, 0, 0, 0);
}
colour = MuseRenderer.getColourGradient(c1, c2, points.limit() / 3);
}
public void draw(double radius, double x, double y) {
int length = points.limit();
double ratio = (System.currentTimeMillis() % 2000) / 2000.0;
colour.rewind();
points.rewind();
GL11.glPushMatrix();
GL11.glTranslated(x, y, 0);
GL11.glScaled(radius / detail, radius / detail, 1.0);
GL11.glRotatef((float) (-ratio * 360.0), 0, 0, 1);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
MuseRenderer.arraysOnC();
MuseRenderer.texturelessOn();
MuseRenderer.blendingOn();
GL11.glColorPointer(4, 0, colour);
GL11.glVertexPointer(3, 0, points);
GL11.glDrawArrays(GL11.GL_LINE_LOOP, 0, length / 3);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
MuseRenderer.blendingOff();
MuseRenderer.texturelessOff();
MuseRenderer.arraysOff();
GL11.glPopMatrix();
}
}

View file

@ -2,11 +2,11 @@ package net.machinemuse.general.gui
import net.minecraft.entity.player.EntityPlayer
import net.machinemuse.general.gui.frame.{ColourPickerFrame, ItemModelViewFrame, PartManipContainer, ItemSelectionFrame}
import net.machinemuse.general.geometry.{MuseRect, Colour, MusePoint2D}
import net.minecraft.item.ItemStack
import net.machinemuse.utils.render.GlowBuffer
import net.minecraft.client.gui.ScaledResolution
import net.machinemuse.powersuits.common.Config
import net.machinemuse.numina.geometry.{MuseRect, Colour, MusePoint2D}
/**
* Author: MachineMuse (Claire Semple)

View file

@ -1,6 +1,8 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.util.Icon;
@ -8,23 +10,23 @@ import org.lwjgl.opengl.GL11;
public class EnergyMeter extends HeatMeter {
public void draw(double xpos, double ypos, double value) {
MuseRenderer.pushTexture(MuseRenderer.BLOCK_TEXTURE_QUILT);
MuseTextureUtils.pushTexture(MuseTextureUtils.BLOCK_TEXTURE_QUILT());
Icon icon = Block.waterStill.getIcon(0, 0);
GL11.glLineWidth(0.5f);
MuseRenderer.on2D();
MuseRenderer.blendingOn();
RenderState.on2D();
RenderState.blendingOn();
if (value < 0.0001) {
Colour.RED.doGL();
} else if (Math.random() / value < 1) {
MuseRenderer.texturelessOn();
RenderState.texturelessOn();
MuseRenderer.drawMPDLightning(xpos + xsize * (Math.random() / 2 + 0.25), ypos + ysize * (1 - value), 1, xpos + xsize
* (Math.random() / 2 + 0.25), ypos + ysize, 1, Colour.WHITE, 4, 1);
MuseRenderer.texturelessOff();
RenderState.texturelessOff();
}
drawFluid(xpos, ypos, value, icon);
drawGlass(xpos, ypos);
MuseRenderer.blendingOff();
MuseRenderer.off2D();
MuseRenderer.popTexture();
RenderState.blendingOff();
RenderState.off2D();
MuseTextureUtils.popTexture();
}
}

View file

@ -1,7 +1,7 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.frame.*;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.entity.EntityClientPlayerMP;

View file

@ -1,7 +1,7 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.frame.*;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.entity.EntityClientPlayerMP;

View file

@ -1,8 +1,10 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseIconUtils;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.util.Icon;
import org.lwjgl.opengl.GL11;
@ -12,15 +14,15 @@ public class HeatMeter {
int ysize = 32;
public void draw(double xpos, double ypos, double value) {
MuseRenderer.pushTexture(MuseRenderer.BLOCK_TEXTURE_QUILT);
MuseRenderer.blendingOn();
MuseRenderer.on2D();
MuseTextureUtils.pushTexture(MuseTextureUtils.BLOCK_TEXTURE_QUILT());
RenderState.blendingOn();
RenderState.on2D();
Icon icon = Block.lavaStill.getIcon(0, 0);
drawFluid(xpos, ypos, value, icon);
drawGlass(xpos, ypos);
MuseRenderer.off2D();
MuseRenderer.blendingOff();
MuseRenderer.popTexture();
RenderState.off2D();
RenderState.blendingOff();
MuseTextureUtils.popTexture();
}
public void drawFluid(double xpos, double ypos, double value, Icon icon) {
@ -30,15 +32,15 @@ public class HeatMeter {
GL11.glPushMatrix();
GL11.glScaled(0.5, 0.5, 0.5);
while (bottomY - 8 > topY) {
MuseRenderer.drawIconAt(xpos * 2, (bottomY - 8) * 2, icon, Colour.WHITE);
MuseIconUtils.drawIconAt(xpos * 2, (bottomY - 8) * 2, icon, Colour.WHITE);
bottomY -= 8;
}
MuseRenderer.drawIconPartial(xpos * 2, (bottomY - 8) * 2, icon, Colour.WHITE, 0, (topY - bottomY + 8) * 2, 16, 16);
MuseIconUtils.drawIconPartial(xpos * 2, (bottomY - 8) * 2, icon, Colour.WHITE, 0, (topY - bottomY + 8) * 2, 16, 16);
GL11.glPopMatrix();
}
public void drawGlass(double xpos, double ypos) {
MuseRenderer.pushTexture(Config.GLASS_TEXTURE);
MuseTextureUtils.pushTexture(Config.GLASS_TEXTURE);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(0, 0);
GL11.glVertex2d(xpos, ypos);
@ -49,6 +51,6 @@ public class HeatMeter {
GL11.glTexCoord2d(1, 0);
GL11.glVertex2d(xpos + xsize, ypos);
GL11.glEnd();
MuseRenderer.popTexture();
MuseTextureUtils.popTexture();
}
}

View file

@ -1,6 +1,6 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.frame.KeybindConfigFrame;
import net.machinemuse.powersuits.control.KeybindManager;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -1,7 +1,7 @@
package net.machinemuse.general.gui;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.DrawableMuseRect;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.general.gui.clickable.IClickable;
import net.machinemuse.general.gui.frame.IGuiFrame;
import net.machinemuse.utils.render.MuseRenderer;

View file

@ -1,6 +1,6 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
import java.util.List;

View file

@ -3,9 +3,9 @@
*/
package net.machinemuse.general.gui.clickable;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.DrawableMuseRect;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.utils.render.MuseRenderer;
import java.util.List;

View file

@ -1,7 +1,7 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;

View file

@ -3,8 +3,8 @@ package net.machinemuse.general.gui.clickable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.powersuits.network.packets.MusePacketToggleRequest;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;

View file

@ -1,6 +1,6 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.utils.render.MuseRenderer;
import java.util.List;

View file

@ -1,13 +1,13 @@
package net.machinemuse.general.gui.clickable
import net.machinemuse.api.IPowerModule
import net.machinemuse.general.geometry.Colour
import net.machinemuse.general.geometry.MusePoint2D
import net.machinemuse.utils.render.{MuseRenderer, GuiIcons}
import GuiIcons.Checkmark
import net.machinemuse.utils.MuseStringUtils
import java.util.ArrayList
import java.util.List
import net.machinemuse.numina.geometry.{Colour, MusePoint2D}
import net.machinemuse.numina.render.{MuseIconUtils, MuseTextureUtils}
/**
* Extends the Clickable class to make a clickable Augmentation; note that this
@ -37,9 +37,9 @@ class ClickableModule(val module: IPowerModule, position: MusePoint2D) extends C
def drawPartial(xmino: Double, ymino: Double, xmaxo: Double, ymaxo: Double) {
val left: Double = getPosition.x - 8
val top: Double = getPosition.y - 8
MuseRenderer.pushTexture(getModule.getStitchedTexture(null))
MuseRenderer.drawIconAt(left, top, getModule.getIcon(null), Colour.WHITE)
MuseRenderer.popTexture()
MuseTextureUtils.pushTexture(getModule.getStitchedTexture(null))
MuseIconUtils.drawIconAt(left, top, getModule.getIcon(null), Colour.WHITE)
MuseTextureUtils.popTexture()
if (!allowed) {
val string: String = MuseStringUtils.wrapFormatTags("x", MuseStringUtils.FormatCodes.DarkRed)
MuseRenderer.drawString(string, getPosition.x + 3, getPosition.y + 1)

View file

@ -1,9 +1,9 @@
package net.machinemuse.general.gui.clickable
import java.lang.String
import net.machinemuse.general.geometry.{MusePoint2D, Colour, DrawableMuseRect}
import net.machinemuse.utils.render.MuseRenderer
import net.machinemuse.numina.general.MuseMathUtils
import net.machinemuse.utils.render.MuseRenderer
import net.machinemuse.numina.geometry.{Colour, DrawableMuseRect, MusePoint2D}
/**
* Author: MachineMuse (Claire Semple)

View file

@ -1,6 +1,6 @@
package net.machinemuse.general.gui.clickable;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.minecraft.nbt.NBTTagCompound;
public class ClickableTinkerSlider extends ClickableSlider {

View file

@ -2,7 +2,7 @@ package net.machinemuse.general.gui.clickable;
import java.util.List;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
public interface IClickable {

View file

@ -2,7 +2,6 @@ package net.machinemuse.general.gui.frame
import java.util
import net.machinemuse.general.gui.clickable.ClickableSlider
import net.machinemuse.general.geometry._
import net.machinemuse.utils.MuseItemUtils
import net.machinemuse.utils.render.GuiIcons
import GuiIcons._
@ -15,6 +14,7 @@ import cpw.mods.fml.common.network.Player
import net.minecraft.client.Minecraft
import scala.Some
import net.machinemuse.numina.general.MuseLogger
import net.machinemuse.numina.geometry.{DrawableMuseRect, MusePoint2D, Colour, MuseRect}
/**
* Author: MachineMuse (Claire Semple)
@ -38,13 +38,13 @@ class ColourPickerFrame(val borderRef: MuseRect, val insideColour: Colour, val b
if (renderSpec.hasKey("colours") && renderSpec.getTag("colours").isInstanceOf[NBTTagIntArray]) Some(renderSpec.getTag("colours").asInstanceOf[NBTTagIntArray])
else {
val nbt = new NBTTagIntArray("colours")
if (itemSelector.getSelectedItem.getItem.getItem.isInstanceOf[ItemPowerArmor]) {
val itembase = itemSelector.getSelectedItem.getItem.getItem.asInstanceOf[ItemPowerArmor]
val intArray: Array[Int] = Array(itembase.getColorFromItemStack(itemSelector.getSelectedItem.getItem).getInt, itembase.getGlowFromItemStack(itemSelector.getSelectedItem.getItem).getInt)
renderSpec.setIntArray("colours", intArray)
} else {
val intArray: Array[Int] = Array.empty
renderSpec.setIntArray("colours", intArray)
itemSelector.getSelectedItem.getItem.getItem match {
case itembase: ItemPowerArmor =>
val intArray: Array[Int] = Array(itembase.getColorFromItemStack(itemSelector.getSelectedItem.getItem).getInt, itembase.getGlowFromItemStack(itemSelector.getSelectedItem.getItem).getInt)
renderSpec.setIntArray("colours", intArray)
case _ =>
val intArray: Array[Int] = Array.empty
renderSpec.setIntArray("colours", intArray)
}
val player = Minecraft.getMinecraft.thePlayer
if (player.worldObj.isRemote)

View file

@ -5,8 +5,8 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableButton;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.general.gui.clickable.ClickableModule;

View file

@ -1,8 +1,8 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IModularItem;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;

View file

@ -1,16 +1,15 @@
package net.machinemuse.general.gui.frame
import java.util
import net.machinemuse.general.geometry.{DrawableMuseRect, Colour, MusePoint2D}
import org.lwjgl.input.Mouse
import net.machinemuse.powersuits.client.render.item.ArmorModel
import net.minecraft.client.Minecraft
import org.lwjgl.opengl.GL11._
import net.machinemuse.utils.{MuseItemUtils}
import net.machinemuse.utils.MuseItemUtils
import net.minecraft.nbt.NBTTagCompound
import net.machinemuse.powersuits.item.ItemPowerArmor
import net.machinemuse.utils.render.MuseRenderer
import net.machinemuse.numina.general.MuseMathUtils
import net.machinemuse.numina.geometry.{DrawableMuseRect, Colour, MusePoint2D}
/**
* Author: MachineMuse (Claire Semple)

View file

@ -1,11 +1,12 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.FlyFromPointToPoint2D;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.numina.sound.Musique;
import net.machinemuse.general.sound.SoundLoader;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.FlyFromPointToPoint2D;
import net.machinemuse.numina.geometry.GradientAndArcCalculator;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.sound.Musique;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.entity.player.EntityPlayer;
@ -34,7 +35,7 @@ public class ItemSelectionFrame extends ScrollableFrame {
double centerx = (border.left() + border.right()) / 2;
double centery = (border.top() + border.bottom()) / 2;
itemPoints = new ArrayList();
List<MusePoint2D> targetPoints = MuseRenderer.pointsInLine(num,
List<MusePoint2D> targetPoints = GradientAndArcCalculator.pointsInLine(num,
new MusePoint2D(centerx, border.bottom()),
new MusePoint2D(centerx, border.top()));
for (MusePoint2D point : targetPoints) {

View file

@ -2,13 +2,16 @@ package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.moduletrigger.IToggleableModule;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.general.gui.MuseGui;
import net.machinemuse.general.gui.clickable.ClickableButton;
import net.machinemuse.general.gui.clickable.ClickableKeybinding;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.general.gui.clickable.IClickable;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.GradientAndArcCalculator;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.control.KeybindManager;
import net.machinemuse.utils.MuseItemUtils;
@ -88,7 +91,7 @@ public class KeybindConfigFrame implements IGuiFrame {
public void refreshModules() {
List<IPowerModule> installedModules = MuseItemUtils.getPlayerInstalledModules(player);
List<MusePoint2D> points = MuseRenderer.pointsInLine(
List<MusePoint2D> points = GradientAndArcCalculator.pointsInLine(
installedModules.size(),
new MusePoint2D(ul.x() + 10, ul.y() + 10),
new MusePoint2D(ul.x() + 10, br.y() - 10));
@ -209,17 +212,17 @@ public class KeybindConfigFrame implements IGuiFrame {
@Override
public void draw() {
MusePoint2D center = ul.plus(br).times(0.5);
MuseRenderer.blendingOn();
MuseRenderer.on2D();
RenderState.blendingOn();
RenderState.on2D();
if (selecting) {
MuseRenderer.drawCenteredString("Press Key", center.x(), center.y());
MuseRenderer.off2D();
MuseRenderer.blendingOff();
RenderState.off2D();
RenderState.blendingOff();
return;
}
newKeybindButton.draw();
trashKeybindButton.draw();
MuseRenderer.pushTexture(MuseRenderer.ITEM_TEXTURE_QUILT);
MuseTextureUtils.pushTexture(MuseTextureUtils.ITEM_TEXTURE_QUILT());
MuseRenderer.drawCenteredString("Use 'new' to bind new keys.", center.x(), center.y() + 40);
MuseRenderer.drawCenteredString("Drag and drop modules to bind them to keys.", center.x(), center.y() + 50);
MuseRenderer.drawCenteredString("Drop keys on 'trash' to unbind them.", center.x(), center.y() + 60);
@ -236,9 +239,9 @@ public class KeybindConfigFrame implements IGuiFrame {
if (selectedClickie != null && closestKeybind != null) {
MuseRenderer.drawLineBetween(selectedClickie, closestKeybind, Colour.YELLOW);
}
MuseRenderer.off2D();
MuseRenderer.blendingOff();
MuseRenderer.popTexture();
RenderState.off2D();
RenderState.blendingOff();
MuseTextureUtils.popTexture();
}
@Override

View file

@ -2,10 +2,10 @@ package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.general.geometry.MuseRect;
import net.machinemuse.general.geometry.MuseRelativeRect;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MuseRect;
import net.machinemuse.numina.geometry.MuseRelativeRect;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.numina.sound.Musique;

View file

@ -1,9 +1,9 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.general.geometry.MuseRect;
import net.machinemuse.general.geometry.MuseRelativeRect;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MuseRect;
import net.machinemuse.numina.geometry.MuseRelativeRect;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.utils.render.MuseRenderer;

View file

@ -4,8 +4,8 @@ import cpw.mods.fml.common.network.Player;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.IPropertyModifier;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableItem;
import net.machinemuse.general.gui.clickable.ClickableTinkerSlider;
import net.machinemuse.numina.network.MusePacket;

View file

@ -1,9 +1,9 @@
package net.machinemuse.general.gui.frame
import net.machinemuse.general.geometry.{MuseRelativeRect, MusePoint2D, Colour}
import net.machinemuse.powersuits.client.render.modelspec.{ModelSpec, ModelRegistry}
import net.minecraft.item.ItemStack
import org.lwjgl.opengl.GL11._
import net.machinemuse.numina.geometry.{MuseRelativeRect, Colour, MusePoint2D}
/**
* Author: MachineMuse (Claire Semple)

View file

@ -1,8 +1,7 @@
package net.machinemuse.general.gui.frame
import net.machinemuse.powersuits.client.render.modelspec.{ModelRegistry, ModelPartSpec, ModelSpec}
import net.machinemuse.general.geometry.{Colour, MuseRect, MuseRelativeRect}
import net.machinemuse.utils.{MuseItemUtils}
import net.machinemuse.utils.MuseItemUtils
import org.lwjgl.opengl.GL11._
import net.machinemuse.general.gui.clickable.ClickableItem
import net.minecraft.nbt.NBTTagCompound
@ -12,6 +11,8 @@ import cpw.mods.fml.common.network.Player
import net.minecraft.item.ItemArmor
import net.machinemuse.utils.render.{MuseRenderer, GuiIcons}
import net.machinemuse.numina.general.{MuseLogger, MuseMathUtils}
import net.machinemuse.numina.geometry.{MuseRect, Colour, MuseRelativeRect}
import net.machinemuse.numina.render.RenderState
/**
* Author: MachineMuse (Claire Semple)
@ -113,7 +114,7 @@ class PartManipSubFrame(val model: ModelSpec, val colourframe: ColourPickerFrame
}
def drawOpenArrow(min: Double, max: Double) {
MuseRenderer.texturelessOn()
RenderState.texturelessOn()
Colour.LIGHTBLUE.doGL()
glBegin(GL_TRIANGLES)
import MuseMathUtils._
@ -128,7 +129,7 @@ class PartManipSubFrame(val model: ModelSpec, val colourframe: ColourPickerFrame
}
glEnd()
Colour.WHITE.doGL()
MuseRenderer.texturelessOff()
RenderState.texturelessOff()
}
def getBorder: MuseRect = {

View file

@ -1,10 +1,10 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.DrawableMuseRect;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.general.MuseMathUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseRect;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.render.RenderState;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@ -48,8 +48,8 @@ public class ScrollableFrame implements IGuiFrame {
public void preDraw() {
border.draw();
MuseRenderer.glowOn();
MuseRenderer.texturelessOn();
RenderState.glowOn();
RenderState.texturelessOn();
GL11.glBegin(GL11.GL_TRIANGLES);
Colour.LIGHTBLUE.doGL();
// Can scroll down
@ -66,12 +66,12 @@ public class ScrollableFrame implements IGuiFrame {
}
Colour.WHITE.doGL();
GL11.glEnd();
MuseRenderer.texturelessOff();
MuseRenderer.scissorsOn(border.left() + 4, border.top() + 4, border.width() - 8, border.height() - 8);
RenderState.texturelessOff();
RenderState.scissorsOn(border.left() + 4, border.top() + 4, border.width() - 8, border.height() - 8);
}
public void postDraw() {
MuseRenderer.scissorsOff();
MuseRenderer.glowOff();
RenderState.scissorsOff();
RenderState.glowOff();
}
@Override

View file

@ -1,8 +1,8 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.general.NBTTagAccessor;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.item.ItemStack;

View file

@ -10,6 +10,7 @@ import net.machinemuse.general.sound.SoundLoader;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.numina.network.MusePacket;
import net.machinemuse.numina.network.MusePacketHandler;
import net.machinemuse.numina.render.RenderGameOverlayEventHandler;
import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
import net.machinemuse.powersuits.block.TileEntityTinkerTable;
import net.machinemuse.powersuits.client.render.block.RenderLuxCapacitorTESR;
@ -134,8 +135,7 @@ public class ClientProxy extends CommonProxy {
@Override
public void sendModeChange(EntityPlayer player, int dMode, String newMode) {
RenderTickHandler.lastSwapTime = System.currentTimeMillis();
RenderTickHandler.lastSwapDirection = (int) Math.signum(dMode);
RenderGameOverlayEventHandler.updateSwap((int) Math.signum(dMode));
MusePacket modeChangePacket = new MusePacketModeChangeRequest((Player) player, newMode, player.inventory.currentItem);
((EntityClientPlayerMP) player).sendQueue.addToSendQueue(modeChangePacket.getPacket131());
}

View file

@ -2,13 +2,12 @@ package net.machinemuse.powersuits.client.render.block;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.block.TileEntityLuxCapacitor;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.AdvancedModelLoader;
@ -77,9 +76,9 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
}
if (!Tessellator.instance.isDrawing) {
getFrameModel().renderAll();
MuseRenderer.glowOn();
RenderState.glowOn();
getLightModel().renderAll();
MuseRenderer.glowOff();
RenderState.glowOff();
} else {
MuseLogger.logError("Error: tessellator not flushed properly when MPS got ahold of it!");
}
@ -96,9 +95,9 @@ public class RenderLuxCapacitorTESR extends MuseTESR implements ISimpleBlockRend
double scale = 0.0625;
glScaled(scale, scale, scale);
getFrameModel().renderAll();
MuseRenderer.glowOn();
RenderState.glowOn();
getLightModel().renderAll();
MuseRenderer.glowOff();
RenderState.glowOff();
glPopMatrix();
GL11.glPopMatrix();

View file

@ -1,6 +1,6 @@
package net.machinemuse.powersuits.client.render.block;
import net.machinemuse.utils.render.MuseRenderer;
import net.machinemuse.numina.render.RenderState;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
@ -178,7 +178,7 @@ public class TinkerTableModel extends ModelBase {
public void doRender(Entity entity, double x, double y, double z, float f,
float f1) {
f = 0.0625f;
MuseRenderer.blendingOn();
RenderState.blendingOn();
int timestep = (int) ((System.currentTimeMillis()) % 10000);
double angle = timestep * Math.PI / 5000.0;
GL11.glPushMatrix();
@ -200,7 +200,7 @@ public class TinkerTableModel extends ModelBase {
Wireshort1.render(f);
Wirelong1.render(f);
MuseRenderer.glowOn();
RenderState.glowOn();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0.5f, 1.05f, 0.5f);
@ -233,8 +233,8 @@ public class TinkerTableModel extends ModelBase {
// }
// }
// GL11.glPopMatrix();
MuseRenderer.glowOff();
MuseRenderer.blendingOff();
RenderState.glowOff();
RenderState.blendingOff();
}
private void drawScanLine(double angle) {

View file

@ -1,10 +1,9 @@
package net.machinemuse.powersuits.client.render.entity;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.obj.WavefrontObject;
@ -30,17 +29,17 @@ public class RenderLuxCapacitorEntity extends MuseRender {
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTickTime) {
MuseRenderer.pushTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
glPushMatrix();
glTranslated(x, y, z);
double scale = 0.0625;
glScaled(scale, scale, scale);
getFrameModel().renderAll();
MuseRenderer.glowOn();
RenderState.glowOn();
getLightModel().renderAll();
MuseRenderer.glowOff();
RenderState.glowOff();
glPopMatrix();
MuseRenderer.popTexture();
MuseTextureUtils.popTexture();
}
}

View file

@ -1,10 +1,10 @@
package net.machinemuse.powersuits.client.render.entity;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.DrawableMuseCircle;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.DrawableMuseCircle;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.entity.EntityPlasmaBolt;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -57,7 +57,7 @@ public class RenderPlasmaBolt extends MuseRender {
GL11.glScaled(scale, scale, scale);
int millisPerCycle = 500;
double timeScale = Math.cos((System.currentTimeMillis() % millisPerCycle) * 2.0 / millisPerCycle - 1.0);
MuseRenderer.glowOn();
RenderState.glowOn();
circle1.draw(4, 0, 0);
GL11.glTranslated(0, 0, 0.001);
circle2.draw(3 + timeScale / 2, 0, 0);
@ -71,7 +71,7 @@ public class RenderPlasmaBolt extends MuseRender {
MuseRenderer.drawLightning(Math.cos(angle1) * 0.5, Math.sin(angle1) * 0.5, 0, Math.cos(angle2) * 5, Math.sin(angle2) * 5, 1,
new Colour(1, 1, 1, 0.9));
}
MuseRenderer.glowOff();
RenderState.glowOff();
GL11.glPopMatrix();
}
}

View file

@ -1,8 +1,7 @@
package net.machinemuse.powersuits.client.render.entity;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import static org.lwjgl.opengl.GL11.*;
@ -15,7 +14,7 @@ public class RenderSpinningBlade extends MuseRender {
glPushMatrix();
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_CULL_FACE);
MuseRenderer.pushTexture(Config.TEXTURE_PREFIX + "items/spinningblade.png");
MuseTextureUtils.pushTexture(Config.TEXTURE_PREFIX + "items/spinningblade.png");
glTranslated(x, y, z);
double motionscale = Math.sqrt(entity.motionZ * entity.motionZ + entity.motionX * entity.motionX);
glRotatef(90, 1, 0, 0);
@ -36,7 +35,7 @@ public class RenderSpinningBlade extends MuseRender {
glVertex3d(1, -1, 0);
glEnd();
MuseRenderer.popTexture();
MuseTextureUtils.popTexture();
glPopAttrib();
glPopMatrix();
}

View file

@ -8,11 +8,12 @@ package net.machinemuse.powersuits.client.render.item;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.client.render.entity.RenderPlasmaBolt;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.powermodule.weapon.PlasmaCannonModule;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
@ -369,7 +370,7 @@ public class ToolModel extends ModelBase {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_DEPTH_TEST);
MuseRenderer.pushTexture(Config.SEBK_TOOL_TEXTURE);
MuseTextureUtils.pushTexture(Config.SEBK_TOOL_TEXTURE);
if (c1 != null) {
c1.doGL();
@ -444,7 +445,7 @@ public class ToolModel extends ModelBase {
supportleft3.render(scale);
supportleft4.render(scale);
supportleft5.render(scale);
MuseRenderer.glowOn();
RenderState.glowOn();
glow.doGL();
crystal.render(scale);
Colour.WHITE.doGL();
@ -455,8 +456,8 @@ public class ToolModel extends ModelBase {
RenderPlasmaBolt.doRender(boltSize);
GL11.glPopMatrix();
}
MuseRenderer.glowOff();
MuseRenderer.popTexture();
RenderState.glowOff();
MuseTextureUtils.popTexture();
GL11.glPopMatrix();
GL11.glPopAttrib();
GL11.glPopMatrix();

View file

@ -1,10 +1,10 @@
package net.machinemuse.powersuits.client.render.item;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.render.MuseIconUtils;
import net.machinemuse.powersuits.client.render.entity.MuseRender;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.machinemuse.powersuits.item.ItemPowerFist;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.RenderBlocks;
@ -18,7 +18,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
@ -72,7 +71,7 @@ public class ToolRenderer extends MuseRender implements IItemRenderer {
break;
case INVENTORY:
RenderBlocks renderInventory = (RenderBlocks) data[0];
MuseRenderer.drawIconAt(0, 0, ModularPowersuits.powerTool.getIconIndex(itemStack), colour);
MuseIconUtils.drawIconAt(0, 0, ModularPowersuits.powerTool.getIconIndex(itemStack), colour);
break;
case EQUIPPED:
RenderBlocks renderEquipped = (RenderBlocks) data[0];

View file

@ -1,11 +1,11 @@
package net.machinemuse.powersuits.client.render.modelspec
import net.machinemuse.general.geometry.Colour
import net.minecraft.item.ItemStack
import net.machinemuse.powersuits.item.ItemPowerArmor
import net.machinemuse.utils.MuseStringUtils
import net.minecraft.nbt.NBTTagCompound
import net.machinemuse.numina.general.MuseLogger
import net.machinemuse.numina.geometry.Colour
/**
* Author: MachineMuse (Claire Semple)

View file

@ -2,11 +2,10 @@ package net.machinemuse.powersuits.client.render.modelspec
import net.minecraftforge.client.model.obj.WavefrontObject
import net.minecraftforge.client.model.AdvancedModelLoader
import net.machinemuse.utils.{MuseStringUtils}
import net.machinemuse.utils.MuseStringUtils
import net.minecraft.util.Vec3
import net.machinemuse.general.geometry.Colour
import net.minecraft.nbt.NBTTagCompound
import net.machinemuse.numina.general.{MuseLogger}
import net.machinemuse.numina.general.MuseLogger
import net.machinemuse.numina.scala.MuseRegistry
/**
@ -77,7 +76,7 @@ class ModelPartSpec(val modelSpec: ModelSpec,
if (nbt hasKey "texture") nbt getString "texture" else modelSpec.textures.head
}
def setTexture(nbt: NBTTagCompound, s: String) {
def setTexture(nbt: NBTTagCompound, s: String) {
if (s.equals("") || s.equalsIgnoreCase(modelSpec.textures.head)) nbt removeTag "texture" else nbt setString("texture", s)
}
@ -85,7 +84,7 @@ class ModelPartSpec(val modelSpec: ModelSpec,
if (nbt hasKey "colourindex") nbt getInteger "colourindex" else defaultcolourindex
}
def setColourIndex(nbt: NBTTagCompound, c: Int) {
def setColourIndex(nbt: NBTTagCompound, c: Int) {
if (c == defaultcolourindex) nbt removeTag "colourindex" else nbt setInteger("colourindex", c)
}
@ -93,7 +92,7 @@ class ModelPartSpec(val modelSpec: ModelSpec,
if (nbt hasKey "glow") nbt getBoolean "glow" else defaultglow
}
def setGlow(nbt: NBTTagCompound, g: Boolean) {
def setGlow(nbt: NBTTagCompound, g: Boolean) {
if (g == defaultglow) nbt removeTag "glow" else nbt setBoolean("glow", g)
}

View file

@ -2,11 +2,11 @@ package net.machinemuse.powersuits.client.render.modelspec
import scala.xml.{NodeSeq, XML}
import net.minecraft.util.Vec3
import net.machinemuse.general.geometry.Colour
import java.awt.Color
import net.machinemuse.utils.MuseStringUtils
import java.net.URL
import net.machinemuse.numina.general.MuseLogger
import net.machinemuse.numina.geometry.Colour
/**

View file

@ -1,15 +1,13 @@
package net.machinemuse.powersuits.client.render.modelspec
import net.machinemuse.general.geometry.Colour
import net.minecraft.client.Minecraft
import net.machinemuse.powersuits.client.render.item.ArmorModel
import net.machinemuse.utils.render.{MuseRenderer, Render}
import net.machinemuse.utils.render.Render
import net.minecraft.client.model.{ModelBase, ModelRenderer}
import net.machinemuse.general.NBTTagAccessor
import org.lwjgl.opengl.GL11._
import net.minecraft.nbt.NBTTagCompound
import java.net.URI
import net.minecraft.util.ResourceLocation
import net.machinemuse.numina.geometry.Colour
import net.machinemuse.numina.render.MuseTextureUtils
/**
* Author: MachineMuse (Claire Semple)
@ -32,7 +30,7 @@ class RenderPart(base: ModelBase, val parent: ModelRenderer) extends ModelRender
Render.withPushedMatrix {
Render {
glScaled(scale, scale, scale)
MuseRenderer.bindTexture(part.getTexture(nbt))
MuseTextureUtils.bindTexture(part.getTexture(nbt))
applyTransform
val ix = part.getColourIndex(nbt)
if (ix < colours.size && ix >= 0) {

View file

@ -4,7 +4,7 @@ import cpw.mods.fml.common.Loader;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.general.gui.clickable.ClickableKeybinding;
import net.machinemuse.general.gui.clickable.ClickableModule;
import net.machinemuse.utils.MuseItemUtils;

View file

@ -11,12 +11,11 @@ import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.DamageSource
import net.minecraftforge.common.ISpecialArmor
import scala.Predef.String
import net.machinemuse.general.geometry.Colour
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.client.model.ModelBiped
import net.machinemuse.powersuits.client.render.item.ArmorModel
import net.machinemuse.api.{ModuleManager, ArmorTraits, IModularItem}
import net.machinemuse.api.ModuleManager.{itemHasActiveModule, tagHasModule}
import net.machinemuse.numina.geometry.Colour
/**
* Describes the 4 different modular armor pieces - head, torso, legs, feet.

View file

@ -10,8 +10,8 @@ import atomicscience.api.poison.Poison.ArmorType
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import atomicscience.api.poison.Poison
import net.machinemuse.utils.render.MuseRenderer
import net.machinemuse.api.ModuleManager
import net.machinemuse.utils.render.MuseRenderer
class ItemPowerArmorHelmet(id: Int) extends ItemPowerArmor(id, 0, 0) with IBreathableArmor {
val iconpath = MuseRenderer.ICON_PREFIX + "armorhead"

View file

@ -1,37 +1,63 @@
package net.machinemuse.powersuits.item
import net.machinemuse.numina.item.{NuminaItemUtils, ModeChangingItem}
import net.machinemuse.numina.item.ModeChangingItem
import net.minecraft.item.ItemStack
import net.minecraft.util.Icon
import net.minecraft.entity.player.EntityPlayer
import net.machinemuse.api.{ModuleManager, IModularItem}
import net.minecraft.nbt.NBTTagCompound
import net.machinemuse.api.ModuleManager
import net.machinemuse.utils.MuseItemUtils
import net.machinemuse.powersuits.common.ModularPowersuits
import net.machinemuse.api.moduletrigger.IRightClickModule
import net.machinemuse.numina.general.MuseLogger
import net.minecraft.client.Minecraft
/**
* Author: MachineMuse (Claire Semple)
* Created: 4:52 PM, 9/5/13
*/
trait ModeChangingModularItem extends ModeChangingItem {
override def getActiveMode(stack: ItemStack): String = {
val mode = super.getActiveMode(stack)
val modes = MuseItemUtils.getModes(stack, Minecraft.getMinecraft.thePlayer)
if (mode.isEmpty && modes.size > 0) {
modes.get(0)
} else {
mode
}
}
def getPrevModeIcon(stack: ItemStack): Icon = null
def getPrevModeIcon(stack: ItemStack): Icon = ModuleManager.getModule(prevMode(stack)).getIcon(stack)
def getCurrentModeIcon(stack: ItemStack): Icon = ModuleManager.getModule(getActiveMode(stack)).getIcon(stack)
def getNextModeIcon(stack: ItemStack): Icon = null
def getNextModeIcon(stack: ItemStack): Icon = ModuleManager.getModule(nextMode(stack)).getIcon(stack)
def nextMode(stack: ItemStack): String = {
val mode: String = getActiveMode(stack)
val modes = MuseItemUtils.getModes(stack, Minecraft.getMinecraft.thePlayer)
if (modes.size > 0) {
val modeIndex: Int = modes.indexOf(mode)
modes.get(clampMode(modeIndex + 1, modes.size))
} else {
mode
}
}
def prevMode(stack: ItemStack): String = {
val mode: String = getActiveMode(stack)
val modes = MuseItemUtils.getModes(stack, Minecraft.getMinecraft.thePlayer)
if (modes.size > 0) {
val modeIndex: Int = modes.indexOf(mode)
modes.get(clampMode(modeIndex - 1, modes.size))
} else {
mode
}
}
def cycleMode(stack: ItemStack, dMode: Int, player: EntityPlayer) {
if (stack != null && stack.getItem.isInstanceOf[IModularItem]) {
var mode: String = getActiveMode(stack)
if (stack != null && stack.getItem.isInstanceOf[ModeChangingItem]) {
val mode: String = getActiveMode(stack)
val modes = MuseItemUtils.getModes(stack, player)
if (mode.isEmpty && modes.size > 0) {
mode = modes.get(0)
}
MuseLogger.logDebug(modes.toString)
MuseLogger.logDebug(mode)
if (modes.size > 0 && dMode != 0) {
val modeIndex: Int = modes.indexOf(mode)
val newMode: String = modes.get(clampMode(modeIndex + dMode, modes.size))

View file

@ -2,8 +2,7 @@ package net.machinemuse.powersuits.item
import net.minecraft.item.{ItemStack, Item}
import cpw.mods.fml.relauncher.{SideOnly, Side}
import net.machinemuse.general.geometry.Colour
import net.machinemuse.utils.{MuseItemUtils, MuseStringUtils, MuseCommonStrings}
import net.machinemuse.utils.{MuseStringUtils, MuseCommonStrings}
import scala.Predef.String
import net.minecraft.entity.player.EntityPlayer
import net.machinemuse.powersuits.powermodule.misc.{CosmeticGlowModule, TintModule}
@ -11,9 +10,8 @@ import net.machinemuse.numina.general.MuseMathUtils
import MuseMathUtils._
import net.machinemuse.api.electricity.MuseElectricItem
import net.machinemuse.api.{ModuleManager, IModularItem}
import net.machinemuse.api.ModuleManager.itemHasActiveModule
import net.machinemuse.utils.ElectricItemUtils
import net.machinemuse.numina.general.MuseMathUtils
import net.machinemuse.numina.geometry.Colour
/**
* Author: MachineMuse (Claire Semple)
@ -76,10 +74,10 @@ trait ModularItemBase extends Item with IModularItem with MuseElectricItem {
}
def getArmorDouble(player: EntityPlayer, stack: ItemStack): Double = 0
def getPlayerEnergy(player: EntityPlayer): Double = ElectricItemUtils.getPlayerEnergy(player)
def drainPlayerEnergy(player: EntityPlayer, drainEnergy: Double) = ElectricItemUtils.drainPlayerEnergy(player, drainEnergy)
def givePlayerEnergy(player: EntityPlayer, joulesToGive: Double) = ElectricItemUtils.givePlayerEnergy(player, joulesToGive)
}

View file

@ -4,9 +4,9 @@ import net.machinemuse.api.IModularItem;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.IPropertyModifier;
import net.machinemuse.general.gui.MuseIcon;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -154,7 +154,7 @@ public abstract class PowerModuleBase implements IPowerModule {
@Override
public String getStitchedTexture(ItemStack item) {
return MuseRenderer.ITEM_TEXTURE_QUILT;
return MuseTextureUtils.ITEM_TEXTURE_QUILT();
// alternatively
// return "/terrain.png";
}

View file

@ -3,12 +3,9 @@ package net.machinemuse.powersuits.tick;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.gui.EnergyMeter;
import net.machinemuse.general.gui.HeatMeter;
import net.machinemuse.numina.item.ModeChangingItem;
import net.machinemuse.powersuits.block.BlockTinkerTable;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.common.ModCompatability;
@ -23,13 +20,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeHooks;
import java.util.EnumSet;
import java.util.List;
/**
* Called before and after the 3D world is rendered (tickEnd is called BEFORE
@ -38,9 +30,6 @@ import java.util.List;
* @author MachineMuse
*/
public class RenderTickHandler implements ITickHandler {
private final static int SWAPTIME = 200;
public static long lastSwapTime = 0;
public static int lastSwapDirection = 0;
protected static HeatMeter heat;
protected static HeatMeter energy;
private int lightningCounter = 0;
@ -60,7 +49,6 @@ public class RenderTickHandler implements ITickHandler {
ScaledResolution screen = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
drawMeters(player, screen);
drawGogglesHUD(player, mc, ((Float) tickData[0]));
drawActiveMode(player, screen);
}
}
@ -95,89 +83,6 @@ public class RenderTickHandler implements ITickHandler {
}
}
private void drawActiveMode(EntityPlayer player, ScaledResolution screen) {
int i = player.inventory.currentItem;
ItemStack stack = player.inventory.mainInventory[i];
if (stack != null && stack.getItem() instanceof ModeChangingItem) {
MuseRenderer.pushTexture(MuseRenderer.ITEM_TEXTURE_QUILT);
MuseRenderer.blendingOn();
NBTTagCompound itemTag = MuseItemUtils.getMuseItemTag(stack);
int swapTime = (int) Math.min(System.currentTimeMillis() - lastSwapTime, SWAPTIME);
Icon currentMode = null;
Icon nextMode = null;
Icon prevMode = null;
List<String> modes = MuseItemUtils.getModes(stack, player);
String mode = ((ModeChangingItem)(stack.getItem())).getActiveMode(stack);
int modeIndex = modes.indexOf(mode);
if (modeIndex > -1) {
String prevModeName = modes.get((modeIndex + modes.size() - 1) % modes.size());
String nextModeName = modes.get((modeIndex + 1) % modes.size());
IPowerModule module = ModuleManager.getModule(mode);
IPowerModule nextModule = ModuleManager.getModule(nextModeName);
IPowerModule prevModule = ModuleManager.getModule(prevModeName);
if (module != null) {
currentMode = module.getIcon(stack);
if (!nextModeName.equals(mode)) {
nextMode = nextModule.getIcon(stack);
prevMode = prevModule.getIcon(stack);
}
}
}
double prevX, prevY, currX, currY, nextX, nextY;
int sw = screen.getScaledWidth();
int sh = screen.getScaledHeight();
int baroffset = 22;
if (!player.capabilities.isCreativeMode) {
baroffset += 16;
if (ForgeHooks.getTotalArmorValue(player) > 0) {
baroffset += 8;
}
}
MuseRenderer.scissorsOn(0, 0, sw, sh - baroffset);
baroffset = screen.getScaledHeight() - baroffset;
// Root locations of the mode list
prevX = sw / 2.0 - 105.0 + 20.0 * i;
prevY = baroffset - 8;
currX = sw / 2.0 - 89.0 + 20.0 * i;
currY = baroffset - 18;
nextX = sw / 2.0 - 73.0 + 20.0 * i;
nextY = baroffset - 8;
if (swapTime == SWAPTIME || lastSwapDirection == 0) {
drawIcon(prevX, prevY, prevMode, 0.4);
drawIcon(currX, currY, currentMode, 0.8);
drawIcon(nextX, nextY, nextMode, 0.4);
} else {
double r1 = 1 - swapTime / (double) SWAPTIME;
double r2 = swapTime / (double) SWAPTIME;
if (lastSwapDirection == -1) {
nextX = (currX * r1 + nextX * r2);
nextY = (currY * r1 + nextY * r2);
currX = (prevX * r1 + currX * r2);
currY = (prevY * r1 + currY * r2);
drawIcon(currX, currY, currentMode, 0.8);
drawIcon(nextX, nextY, nextMode, 0.8);
} else {
prevX = (currX * r1 + prevX * r2);
prevY = (currY * r1 + prevY * r2);
currX = (nextX * r1 + currX * r2);
currY = (nextY * r1 + currY * r2);
// MuseRenderer
drawIcon(prevX, prevY, prevMode, 0.8);
drawIcon(currX, currY, currentMode, 0.8);
}
}
MuseRenderer.scissorsOff();
MuseRenderer.blendingOff();
Colour.WHITE.doGL();
MuseRenderer.popTexture();
}
}
private void drawGogglesHUD(EntityPlayer player, Minecraft mc, float partialTickTime) {
if (ModCompatability.isThaumCraftLoaded() && ModCompatability.enableThaumGogglesModule() && player.getCurrentArmor(3) != null && player.getCurrentArmor(3).getItem() instanceof IModularItem && ModuleManager.itemHasActiveModule(player.getCurrentArmor(3), "Aurameter")) {
@ -185,9 +90,6 @@ public class RenderTickHandler implements ITickHandler {
}
}
private void drawIcon(double x, double y, Icon icon, double alpha) {
MuseRenderer.drawIconAt(x, y, icon, Colour.WHITE.withAlpha(alpha));
}
@Override
public EnumSet<TickType> ticks() {

View file

@ -2,11 +2,12 @@ package net.machinemuse.utils.render
import org.lwjgl.opengl.GL11._
import net.minecraft.client.gui.ScaledResolution
import net.machinemuse.general.geometry.Colour
import org.lwjgl.opengl.GL13._
import net.minecraft.client.Minecraft
import net.machinemuse.utils.render.Render._
import net.machinemuse.powersuits.common.Config
import net.machinemuse.numina.geometry.Colour
import net.machinemuse.numina.render.RenderState
/**
* Author: MachineMuse (Claire Semple)
@ -30,8 +31,8 @@ object GlowBuffer {
def drawFullScreen(screen: ScaledResolution) {
import Render._
pushDualIdentityMatrix()
MuseRenderer.glowOn()
MuseRenderer.blendingOn()
RenderState.glowOn()
RenderState.blendingOn()
glPushAttrib(GL_ENABLE_BIT)
glDisable(GL_CULL_FACE)
@ -105,8 +106,8 @@ object GlowBuffer {
glPopAttrib()
MuseRenderer.blendingOff()
MuseRenderer.glowOff()
RenderState.blendingOff()
RenderState.glowOff()
popDualIdentityMatrix()
}

View file

@ -1,9 +1,10 @@
package net.machinemuse.utils.render
import net.minecraft.util.Icon
import net.machinemuse.general.geometry.Colour
import net.machinemuse.powersuits.common.Config
import org.lwjgl.opengl.GL11._
import net.machinemuse.numina.geometry.Colour
import net.machinemuse.numina.render.{MuseTextureUtils, RenderState, MuseIconUtils}
/**
* Author: MachineMuse (Claire Semple)
@ -16,15 +17,15 @@ object GuiIcons {
val size: Double
def apply(x: Double, y: Double, c: Colour = Colour.WHITE, xmin: Double = Integer.MIN_VALUE, ymin: Double = Integer.MIN_VALUE, xmax: Double = Integer.MAX_VALUE, ymax: Double = Integer.MAX_VALUE) {
MuseRenderer.pushTexture(filepath)
MuseTextureUtils.pushTexture(filepath)
glPushMatrix()
MuseRenderer.blendingOn()
RenderState.blendingOn()
val s = size / 16.0
glScaled(s, s, s)
MuseRenderer.drawIconPartialOccluded(x / s, y / s, GuiIconDrawer, c, xmin / s, ymin / s, xmax / s, ymax / s)
MuseRenderer.blendingOff()
MuseIconUtils.drawIconPartialOccluded(x / s, y / s, GuiIconDrawer, c, xmin / s, ymin / s, xmax / s, ymax / s)
RenderState.blendingOff()
glPopMatrix()
MuseRenderer.popTexture()
MuseTextureUtils.popTexture()
}
}

View file

@ -1,16 +1,17 @@
package net.machinemuse.utils.render;
import net.machinemuse.numina.basemod.NuminaConfig;
import net.machinemuse.numina.general.MuseLogger;
import net.machinemuse.general.geometry.Colour;
import net.machinemuse.general.geometry.MusePoint2D;
import net.machinemuse.general.geometry.SwirlyMuseCircle;
import net.machinemuse.general.gui.MuseGui;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.geometry.SwirlyMuseCircle;
import net.machinemuse.general.gui.clickable.IClickable;
import net.machinemuse.numina.render.MuseTextureUtils;
import net.machinemuse.numina.render.RenderState;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.numina.general.MuseMathUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.PositionTextureVertex;
import net.minecraft.client.model.TexturedQuad;
import net.minecraft.client.renderer.OpenGlHelper;
@ -29,7 +30,6 @@ import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* Contains a bunch of random OpenGL-related functions, accessed statically.
@ -42,11 +42,6 @@ public abstract class MuseRenderer {
protected static SwirlyMuseCircle selectionCircle;
private static String TEXTURE_MAP = "textures/atlas/items.png";
private static Stack<String> texturestack = new Stack<String>();
public static final String ITEM_TEXTURE_QUILT = "textures/atlas/items.png";
public static final String BLOCK_TEXTURE_QUILT = "textures/atlas/blocks.png";
public static final String ICON_PREFIX = "powersuits:";
/**
@ -63,300 +58,17 @@ public abstract class MuseRenderer {
selectionCircle.draw(radius, xoffset, yoffset);
}
public static void pushTexture(String filename) {
texturestack.push(TEXTURE_MAP);
TEXTURE_MAP = filename;
bindTexture(TEXTURE_MAP);
}
public static void popTexture() {
TEXTURE_MAP = texturestack.pop();
bindTexture(TEXTURE_MAP);
}
public static void bindTexture(String tex) {
getRenderEngine().bindTexture(new ResourceLocation(tex));
}
/**
* Creates a list of points linearly interpolated between points a and b noninclusive.
*
* @return A list of num points
*/
public static List<MusePoint2D> pointsInLine(int num, MusePoint2D a, MusePoint2D b) {
List<MusePoint2D> points = new ArrayList<MusePoint2D>();
if (num < 1) {
return points;
} else if (num < 2) {
points.add(b.minus(a).times(0.5F).plus(a));
} else {
MusePoint2D step = b.minus(a).times(1.0F / (num + 1));
for (int i = 1; i < num + 1; i++) {
points.add(a.plus(step.times(i)));
}
}
return points;
}
/**
* Returns a DoubleBuffer full of colours that are gradually interpolated
*
* @param c1
* @param c2
* @param numsegments
* @return
*/
public static DoubleBuffer getColourGradient(Colour c1, Colour c2, int numsegments) {
DoubleBuffer buffer = BufferUtils.createDoubleBuffer(numsegments * 4);
for (double i = 0; i < numsegments; i++) {
Colour c3 = c1.interpolate(c2, i / numsegments);
buffer.put(c3.r);
buffer.put(c3.g);
buffer.put(c3.b);
buffer.put(c3.a);
}
buffer.flip();
return buffer;
}
/**
* Efficient algorithm for drawing circles and arcs in pure opengl!
*
* @param startangle Start angle in radians
* @param endangle End angle in radians
* @param radius Radius of the circle (used in calculating number of segments to draw as well as size of the arc)
* @param xoffset Convenience parameter, added to every vertex
* @param yoffset Convenience parameter, added to every vertex
* @param zoffset Convenience parameter, added to every vertex
* @return
*/
public static DoubleBuffer getArcPoints(double startangle, double endangle, double radius, double xoffset, double yoffset, double zoffset) {
// roughly 8 vertices per Minecraft 'pixel' - should result in at least
// 2 vertices per real pixel on the screen.
int numVertices = (int) Math.ceil(Math.abs((endangle - startangle) * 16 * Math.PI));
double theta = (endangle - startangle) / numVertices;
DoubleBuffer buffer = BufferUtils.createDoubleBuffer(numVertices * 3);
double x = radius * Math.sin(startangle);
double y = radius * Math.cos(startangle);
double tf = Math.tan(theta); // precompute tangent factor: how much to
// move along the tangent line each
// iteration
double rf = Math.cos(theta); // precompute radial factor: how much to
// move back towards the origin each
// iteration
double tx;
double ty;
for (int i = 0; i < numVertices; i++) {
buffer.put(x + xoffset);
buffer.put(y + yoffset);
buffer.put(zoffset);
tx = y; // compute tangent lines
ty = -x;
x += tx * tf; // add tangent line * tangent factor
y += ty * tf;
x *= rf;
y *= rf;
}
buffer.flip();
return buffer;
}
/**
* 2D rendering mode on/off
*/
public static void on2D() {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
// attempt at fake antialiasing
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA_SATURATE, GL11.GL_ONE);
// GL11.glColorMask(false, false, false, true);
// GL11.glClearColor(0, 0, 0, 0);
// GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
// GL11.glColorMask(true, true, true, true);
// GL11.glHint(GL11.GL_POINT_SMOOTH, GL11.GL_NICEST);
// GL11.glHint(GL11.GL_LINE_SMOOTH, GL11.GL_NICEST);
// GL11.glHint(GL11.GL_POLYGON_SMOOTH, GL11.GL_NICEST);
// GL11.glDepthFunc(GL11.GL_GREATER);
}
public static void off2D() {
GL11.glPopAttrib();
}
/**
* Arrays on/off
*/
public static void arraysOnC() {
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
// GL11.glEnableClientState(GL11.GL_INDEX_ARRAY);
}
public static void arraysOnT() {
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}
public static void arraysOff() {
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}
/**
* Call before doing any pure geometry (ie. with colours rather than textures).
*/
public static void texturelessOn() {
GL11.glDisable(GL11.GL_TEXTURE_2D);
}
/**
* Call after doing pure geometry (ie. with colours) to go back to the texture mode (default).
*/
public static void texturelessOff() {
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
/**
* Call before doing anything with alpha blending
*/
public static void blendingOn() {
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
if (Minecraft.isFancyGraphicsEnabled()) {
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_ALPHA_TEST);
// GL11.glEnable(GL11.GL_LINE_SMOOTH);
// GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
}
/**
* Call after doing anything with alpha blending
*/
public static void blendingOff() {
GL11.glPopAttrib();
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
public static void scissorsOn(double x, double y, double w, double h) {
// GL11.glPushAttrib(GL11.GL_VIEWPORT_BIT);
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_SCISSOR_BIT);
GL11.glPushMatrix();
Minecraft mc = Minecraft.getMinecraft();
int dw = mc.displayWidth;
int dh = mc.displayHeight;
ScaledResolution res = new ScaledResolution(mc.gameSettings, dw, dh);
double newx = x * res.getScaleFactor();
double newy = dh - h * res.getScaleFactor() - y * res.getScaleFactor();
double neww = w * res.getScaleFactor();
double newh = h * res.getScaleFactor();
// GL11.glTranslated(-x, -y, 0);
// GL11.glScaled(dw/(double)neww, dh/(double)newh, 1);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor((int) newx, (int) newy, (int) neww, (int) newh);
}
public static void scissorsOff() {
GL11.glPopMatrix();
GL11.glPopAttrib();
}
/**
* Makes the appropriate openGL calls and draws an item and overlay using the default icon
*/
public static void drawItemAt(double x, double y, ItemStack item) {
on2D();
RenderState.on2D();
getRenderItem().renderItemAndEffectIntoGUI(getFontRenderer(), getRenderEngine(), item, (int) x, (int) y);
getRenderItem().renderItemOverlayIntoGUI(getFontRenderer(), getRenderEngine(), item, (int) x, (int) y);
off2D();
}
/**
* Draws a MuseIcon
*
* @param x
* @param y
* @param icon
* @param colour
*/
public static void drawIconAt(double x, double y, Icon icon, Colour colour) {
drawIconPartial(x, y, icon, colour, 0, 0, 16, 16);
}
public static void drawIconPartialOccluded(double x, double y, Icon icon, Colour colour, double left, double top, double right, double bottom) {
double xmin = MuseMathUtils.clampDouble(left - x, 0, 16);
double ymin = MuseMathUtils.clampDouble(top - y, 0, 16);
double xmax = MuseMathUtils.clampDouble(right - x, 0, 16);
double ymax = MuseMathUtils.clampDouble(bottom - y, 0, 16);
drawIconPartial(x, y, icon, colour, xmin, ymin, xmax, ymax);
}
/**
* Draws a MuseIcon
*
* @param x
* @param y
* @param icon
* @param colour
*/
public static void drawIconPartial(double x, double y, Icon icon, Colour colour, double left, double top, double right, double bottom) {
if (icon == null) {
return;
}
GL11.glPushMatrix();
on2D();
blendingOn();
if (colour != null) {
colour.doGL();
}
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
float u1 = icon.getMinU();
float v1 = icon.getMinV();
float u2 = icon.getMaxU();
float v2 = icon.getMaxV();
double xoffset1 = left * (u2 - u1) / 16.0f;
double yoffset1 = top * (v2 - v1) / 16.0f;
double xoffset2 = right * (u2 - u1) / 16.0f;
double yoffset2 = bottom * (v2 - v1) / 16.0f;
tess.addVertexWithUV(x + left, y + top, 0, u1 + xoffset1, v1 + yoffset1);
tess.addVertexWithUV(x + left, y + bottom, 0, u1 + xoffset1, v1 + yoffset2);
tess.addVertexWithUV(x + right, y + bottom, 0, u1 + xoffset2, v1 + yoffset2);
tess.addVertexWithUV(x + right, y + top, 0, u1 + xoffset2, v1 + yoffset1);
tess.draw();
MuseRenderer.blendingOff();
off2D();
GL11.glPopMatrix();
}
/**
* Switches to relative coordinate frame (where -1,-1 is top left of the working area, and 1,1 is the bottom right)
*/
public static void relativeCoords(MuseGui gui) {
GL11.glPushMatrix();
GL11.glTranslatef(gui.width / 2, gui.height / 2, 0);
GL11.glScalef(gui.getxSize(), gui.getySize(), 0);
RenderState.off2D();
}
static boolean messagedAboutSlick = false;
@ -370,8 +82,8 @@ public abstract class MuseRenderer {
*/
public static void drawString(String s, double x, double y, Colour c) {
RenderHelper.disableStandardItemLighting();
blendingOn();
on2D();
RenderState.blendingOn();
RenderState.on2D();
if (Config.useCustomFonts()) {
try {
SlickFont.apply(x, y, s, c);
@ -387,8 +99,8 @@ public abstract class MuseRenderer {
getFontRenderer().drawStringWithShadow(s, (int) x, (int) y, c.getInt());
}
off2D();
blendingOff();
RenderState.off2D();
RenderState.blendingOff();
}
/**
@ -440,8 +152,8 @@ public abstract class MuseRenderer {
*/
public static void drawRectPrism(double x, double d, double e, double f, double z, double g, float texturex, float texturey, float texturex2,
float texturey2) {
arraysOnT();
texturelessOff();
RenderState.arraysOnT();
RenderState.texturelessOff();
Vec3[] points = {Vec3.createVectorHelper(x, e, z), Vec3.createVectorHelper(d, e, z), Vec3.createVectorHelper(x, f, z),
Vec3.createVectorHelper(d, f, z), Vec3.createVectorHelper(x, e, g), Vec3.createVectorHelper(d, e, g),
Vec3.createVectorHelper(x, f, g), Vec3.createVectorHelper(d, f, g)};
@ -496,25 +208,8 @@ public abstract class MuseRenderer {
// 0, 4, 6
// };
// drawTriangles3DT(points, textures, indices);
texturelessOff();
arraysOff();
}
private static float lightmapLastX;
private static float lightmapLastY;
public static void glowOn() {
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
lightmapLastX = OpenGlHelper.lastBrightnessX;
lightmapLastY = OpenGlHelper.lastBrightnessY;
RenderHelper.disableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
public static void glowOff() {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY);
GL11.glPopAttrib();
RenderState.texturelessOff();
RenderState.arraysOff();
}
/**
@ -608,10 +303,10 @@ public abstract class MuseRenderer {
double cx = 0, cy = 0, cz = 0;
double jagfactor = 0.3;
on2D();
RenderState.on2D();
GL11.glEnable(GL11.GL_DEPTH_TEST);
pushTexture(Config.LIGHTNING_TEXTURE);
blendingOn();
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE);
RenderState.blendingOn();
colour.doGL();
GL11.glBegin(GL11.GL_QUADS);
while (Math.abs(cx) < Math.abs(tx) && Math.abs(cy) < Math.abs(ty) && Math.abs(cz) < Math.abs(tz)) {
@ -630,12 +325,12 @@ public abstract class MuseRenderer {
drawLightningBetweenPointsFast(ax, ay, az, bx, by, bz, index);
}
GL11.glEnd();
blendingOff();
off2D();
RenderState.blendingOff();
RenderState.off2D();
}
public static void drawLightningBetweenPoints(double x1, double y1, double z1, double x2, double y2, double z2, int index) {
pushTexture(Config.LIGHTNING_TEXTURE);
MuseTextureUtils.pushTexture(Config.LIGHTNING_TEXTURE);
double u1 = index / 50.0;
double u2 = u1 + 0.02;
double px = (y1 - y2) * 0.125;
@ -648,7 +343,7 @@ public abstract class MuseRenderer {
GL11.glVertex3d(x2 - px, y2 - py, z2);
GL11.glTexCoord2d(u2, 1);
GL11.glVertex3d(x2 + px, y2 + py, z2);
popTexture();
MuseTextureUtils.popTexture();
}
public static void drawLightningBetweenPointsFast(double x1, double y1, double z1, double x2, double y2, double z2, int index) {
@ -670,9 +365,9 @@ public abstract class MuseRenderer {
public static void drawLightningLines(double x1, double y1, double z1, double x2, double y2, double z2, Colour colour) {
double tx = x2 - x1, ty = y2 - y1, tz = z2 - z1, cx = 0, cy = 0, cz = 0;
double jagfactor = 0.3;
texturelessOn();
blendingOn();
on2D();
RenderState.texturelessOn();
RenderState.blendingOn();
RenderState.on2D();
GL11.glBegin(GL11.GL_LINE_STRIP);
while (Math.abs(cx) < Math.abs(tx) && Math.abs(cy) < Math.abs(ty) && Math.abs(cz) < Math.abs(tz)) {
colour.doGL();
@ -691,9 +386,9 @@ public abstract class MuseRenderer {
// GL11.glVertex3d(x1 + cx, y1 + cy, z1 + cz);
}
GL11.glEnd();
off2D();
blendingOff();
texturelessOff();
RenderState.off2D();
RenderState.blendingOff();
RenderState.texturelessOff();
}

View file

@ -2,11 +2,11 @@ package net.machinemuse.utils.render
import java.awt.Font
import org.newdawn.slick.{Color, TrueTypeFont}
import net.machinemuse.general.geometry.Colour
import org.newdawn.slick.opengl.TextureImpl
import org.lwjgl.opengl.GL11._
import net.machinemuse.powersuits.common.Config
import net.machinemuse.numina.general.MuseLogger
import net.machinemuse.numina.geometry.Colour
/**
* Author: MachineMuse (Claire Semple)