mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
doom commit? who knows
- smooth texture gauge - smooth linear gauge - updated zirnox, ccgt and watz gui (gauges)
This commit is contained in:
parent
6f6ebffd41
commit
ea217756a0
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineTurbineGas;
|
||||
@ -184,7 +185,7 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
int power = (int) (turbinegas.power * 142 / turbinegas.maxPower); //power storage
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 109, 0, 223, power, 16);
|
||||
|
||||
drawRPMGauge(turbinegas.rpm);
|
||||
GUIElements.drawSmoothTextureModalCircle(guiLeft + 64, guiTop + 16, this.zLevel, 176, 64, 48, 48, (double) turbinegas.rpm / 100);
|
||||
drawThermometer(turbinegas.temp);
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 34, 16, 16, 3); //info
|
||||
@ -285,33 +286,33 @@ public class GUIMachineTurbineGas extends GuiInfoContainer {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
protected void drawRPMGauge(int position) {
|
||||
|
||||
int xPos = guiLeft + 64;
|
||||
int yPos = guiTop + 16;
|
||||
|
||||
int squareSideLenght = 48;
|
||||
|
||||
double uMin = (48D / 4848D) * position;
|
||||
double uMax = (48D / 4848D) * (position + 1);
|
||||
double vMin = 0D;
|
||||
double vMax = 1D;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
// protected void drawRPMGauge(int position) {
|
||||
//
|
||||
// int xPos = guiLeft + 64;
|
||||
// int yPos = guiTop + 16;
|
||||
//
|
||||
// int squareSideLenght = 48;
|
||||
//
|
||||
// double uMin = (48D / 4848D) * position;
|
||||
// double uMax = (48D / 4848D) * (position + 1);
|
||||
// double vMin = 0D;
|
||||
// double vMax = 1D;
|
||||
//
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
//
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture(gauge_tex); //long boi
|
||||
//
|
||||
// Tessellator tessellator = Tessellator.instance;
|
||||
//
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.addVertexWithUV(xPos, yPos + squareSideLenght, this.zLevel, uMin, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos + squareSideLenght, this.zLevel, uMax, vMax);
|
||||
// tessellator.addVertexWithUV(xPos + squareSideLenght, yPos, this.zLevel,uMax, vMin);
|
||||
// tessellator.addVertexWithUV(xPos, yPos, this.zLevel, uMin, vMin);
|
||||
// tessellator.draw();
|
||||
//
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import com.hbm.inventory.gui.element.GUIElements;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerReactorZirnox;
|
||||
@ -92,20 +93,12 @@ public class GUIReactorZirnox extends GuiInfoContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int s = zirnox.getGaugeScaled(6, 0);
|
||||
drawTexturedModalRect(guiLeft + 160, guiTop + 108, 238, 0 + 12 * s, 18, 12);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 162, guiTop + 114, this.zLevel, (double) zirnox.steam.getFill() / zirnox.steam.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 144, guiTop + 114, this.zLevel, (double) zirnox.carbonDioxide.getFill() / zirnox.carbonDioxide.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
GUIElements.drawSmoothLinearGauge(guiLeft + 180, guiTop + 114, this.zLevel, (double) zirnox.water.getFill() / zirnox.water.getMaxFill(), 2, 5, 0.75, 14, 0, 0x7F0000);
|
||||
|
||||
int c = zirnox.getGaugeScaled(6, 1);
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 108, 238, 0 + 12 * c, 18, 12);
|
||||
|
||||
int w = zirnox.getGaugeScaled(6, 2);
|
||||
drawTexturedModalRect(guiLeft + 178, guiTop + 108, 238, 0 + 12 * w, 18, 12);
|
||||
|
||||
int h = zirnox.getGaugeScaled(12, 3);
|
||||
drawTexturedModalRect(guiLeft + 160, guiTop + 33, 220, 0 + 18 * h, 18, 17);
|
||||
|
||||
int p = zirnox.getGaugeScaled(12, 4);
|
||||
drawTexturedModalRect(guiLeft + 178, guiTop + 33, 220, 0 + 18 * p, 18, 17);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 169, guiTop + 42, this.zLevel, (double) zirnox.heat/100000, 5, 2, 1, 0x7F0000);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 187, guiTop + 42, this.zLevel, (double) zirnox.pressure/100000, 5, 2, 1, 0x7F0000);
|
||||
|
||||
if(zirnox.isOn) {
|
||||
for(int x = 0; x < 4; x++)
|
||||
|
||||
@ -86,7 +86,7 @@ public class GUIWatz extends GuiInfoContainer {
|
||||
if(watz.isOn) drawTexturedModalRect(guiLeft + 147, guiTop + 8, 176, 0, 8, 8);
|
||||
if(watz.isLocked) drawTexturedModalRect(guiLeft + 142, guiTop + 70, 210, 0, 18, 18);
|
||||
|
||||
GUIElements.renderGauge(Gauge.ROUND_SMALL, guiLeft + 13, guiTop + 100, this.zLevel, 1 - col);
|
||||
GUIElements.drawSmoothGauge(guiLeft + 22, guiTop + 109, this.zLevel, (double) 1 - col, 5, 2, 1, 0x7F0000);
|
||||
|
||||
watz.tanks[0].renderTank(guiLeft + 143, guiTop + 69, this.zLevel, 4, 43);
|
||||
watz.tanks[1].renderTank(guiLeft + 149, guiTop + 69, this.zLevel, 4, 43);
|
||||
|
||||
@ -87,6 +87,142 @@ public class GUIElements {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawSmoothLinearGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, double scale, float rotation, int color) {
|
||||
drawSmoothLinearGauge(x, y, z, progress, tipLength, backLength, backSide, scale, rotation, color, 0x000000);
|
||||
}
|
||||
|
||||
private static Vec3NT Bleft = new Vec3NT();
|
||||
private static Vec3NT Bright = new Vec3NT();
|
||||
|
||||
public static void drawSmoothLinearGauge(int x, int y, double z, double progress, double tipLength, double backLength, double backSide, double scale, float rotation, int color, int colorOuter) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
scale = Math.max(scale, 1);
|
||||
progress = MathHelper.clamp_double(progress, 0, 1) * scale;
|
||||
|
||||
tip.setComponents(0, -tipLength, 0);
|
||||
right.setComponents(-backSide, 0, 0);
|
||||
Bright.setComponents(-backSide, backLength, 0);
|
||||
Bleft.setComponents(backSide, backLength, 0);
|
||||
left.setComponents(backSide, 0, 0);
|
||||
|
||||
float angle = (float) Math.toRadians(-rotation);
|
||||
|
||||
tip.rotateAroundZ(angle);
|
||||
right.rotateAroundZ(angle);
|
||||
Bright.rotateAroundZ(angle);
|
||||
Bleft.rotateAroundZ(angle);
|
||||
left.rotateAroundZ(angle);
|
||||
|
||||
double deltaX = progress * MathHelper.cos(angle);
|
||||
double deltaY = progress * MathHelper.sin(angle);
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_POLYGON);
|
||||
tess.setColorOpaque_I(colorOuter);
|
||||
double mult = 1.5;
|
||||
tess.addVertex(x + deltaX + tip.xCoord * mult, y + deltaY + tip.yCoord * mult, z);
|
||||
tess.addVertex(x + deltaX + right.xCoord * mult, y + deltaY + right.yCoord * mult, z);
|
||||
tess.addVertex(x + deltaX + Bright.xCoord * mult, y + deltaY + Bright.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bleft.xCoord * mult, y + deltaY + Bleft.yCoord, z);
|
||||
tess.addVertex(x + deltaX + left.xCoord * mult, y + deltaY + left.yCoord * mult, z);
|
||||
tess.draw();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
tess.startDrawing(GL11.GL_POLYGON);
|
||||
tess.setColorOpaque_I(color);
|
||||
tess.addVertex(x + deltaX + tip.xCoord, y + deltaY + tip.yCoord, z);
|
||||
tess.addVertex(x + deltaX + right.xCoord, y + deltaY + right.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bright.xCoord, y + deltaY + Bright.yCoord, z);
|
||||
tess.addVertex(x + deltaX + Bleft.xCoord, y + deltaY + Bleft.yCoord, z);
|
||||
tess.addVertex(x + deltaX + left.xCoord, y + deltaY + left.yCoord, z);
|
||||
tess.draw();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawSmoothTextureModalCircle(int xDraw, int yDraw, float zDraw, int xStart, int yStart, int xDelta, int yDelta, double progress) {
|
||||
float var7 = 0.00390625F;
|
||||
float var8 = 0.00390625F;
|
||||
|
||||
progress = MathHelper.clamp_double(progress, 0, 1);
|
||||
float angle = (float) (-progress * 270.0);
|
||||
double theta = Math.toRadians(angle - 135);
|
||||
int addons = 0;
|
||||
double xTarget = 0;
|
||||
double yTarget = 0;
|
||||
|
||||
// addons is just a numeric flag for how many fixed point to add, to generate the triangles
|
||||
if (angle >= -180 && angle < -90) {
|
||||
addons = 1;
|
||||
} else if (angle >= -270 && angle < -180) {
|
||||
addons = 2;
|
||||
}
|
||||
|
||||
// the abysmal control under here is responsible for the positioning of the last point
|
||||
// basically this whole function makes this shape:
|
||||
// + - - - - - - - - - - - +
|
||||
// | \ * * * * * * * * * / |
|
||||
// | * \ * * * * * * * / * |
|
||||
// | * * \ * * * * * / * * |
|
||||
// | * * * \ * * * / * * * |
|
||||
// | * * * * \ * / * * * * |
|
||||
// | * * * * * + * * * * * |
|
||||
// | * * * * / \ * * * * |
|
||||
// | * * * / \ * * * |
|
||||
// | * * / \ * * |
|
||||
// | * / \ * |
|
||||
// | / \ |
|
||||
// + - - - - - - - - - - - +
|
||||
// the "/, \" are the sides, "+" points and "*" rendered part (lower triangle isn't shown)
|
||||
if (angle >= -90) {
|
||||
xTarget = -1;
|
||||
yTarget = -Math.tan(theta);
|
||||
} else if (angle > -135 && angle < -90) {
|
||||
xTarget = Math.tan(Math.PI/2 - theta);
|
||||
yTarget = 1;
|
||||
} else if (angle > -180 && angle < -135) {
|
||||
xTarget = Math.tan(Math.PI/2 - theta);
|
||||
yTarget = 1;
|
||||
} else if (angle <= -180) {
|
||||
xTarget = 1;
|
||||
yTarget = Math.tan(theta);
|
||||
} else if (angle == -135) {
|
||||
xTarget = 0;
|
||||
yTarget = 1;
|
||||
}
|
||||
|
||||
double xMid = (double) xDelta / 2;
|
||||
double yMid = (double) yDelta / 2;
|
||||
|
||||
xTarget *= xMid;
|
||||
yTarget *= yMid;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
tess.startDrawing(GL11.GL_TRIANGLES); // i should've used GL_POLYGON yes i know, too bad im either too retarded to understand it or OpenGL makes it funky, i already tried
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw + yDelta), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart + yDelta) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
if (addons == 2 || addons == 1) {
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.draw();
|
||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||
tess.addVertexWithUV((double) (xDraw), (double) (yDraw), (double) zDraw, (double) ((float) (xStart) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
}
|
||||
if (addons == 2) {
|
||||
tess.addVertexWithUV((double) (xDraw + xDelta), (double) (yDraw), (double) zDraw, (double) ((float) (xStart + xDelta) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.draw();
|
||||
tess.startDrawing(GL11.GL_TRIANGLES);
|
||||
tess.addVertexWithUV((double) (xDraw + xDelta), (double) (yDraw), (double) zDraw, (double) ((float) (xStart + xDelta) * var7), (double) ((float) (yStart) * var8));
|
||||
tess.addVertexWithUV((double) (xDraw + xMid), (double) (yDraw + yMid), (double) zDraw, (double) ((float) (xStart + xMid) * var7), (double) ((float) (yStart + yMid) * var8));
|
||||
}
|
||||
tess.addVertexWithUV((double) (xDraw + xTarget + xMid), (double) (yDraw - yTarget + yMid), (double) zDraw, (double) ((float) (xStart + xTarget + xMid) * var7), (double) ((float) (yStart - yTarget + yMid) * var8));
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
public static final int STANDARD_COLOR_BACKGROUND = -0xFEFFFF0;
|
||||
public static final int STANDARD_COLOR_LINE0 = 0x505000FF;
|
||||
public static final int STANDARD_COLOR_LINE1 = (STANDARD_COLOR_LINE0 & 0xFEFEFE) >> 1 | STANDARD_COLOR_LINE0 & -0xFEFEFE;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 4.7 KiB |
Loading…
x
Reference in New Issue
Block a user