Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
#
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcl committed Sep 28, 2016
1 parent 21424df commit 3dadc7f
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions src/main/java/com/kamesuta/mc/bnnwidget/WGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class WGui extends Gui {
public static final Minecraft mc;
public static final Tessellator t = Tessellator.getInstance();
public static final VertexBuffer v = t.getBuffer();
public static final VertexBuffer vb = t.getBuffer();
@SuppressWarnings("deprecation")
public static final StencilClip clip = StencilClip.instance;
static {
Expand Down Expand Up @@ -62,11 +62,11 @@ public static void drawRect(final float x1, final float y1, final float x2, fina
GlStateManager.disableTexture2D();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GlStateManager.color(r, g, b, a);
v.begin(GL_QUADS, DefaultVertexFormats.POSITION);
v.pos(Math.min(x1, x2), Math.max(y1, y2), 0.0D).endVertex();
v.pos(Math.max(x1, x2), Math.max(y1, y2), 0.0D).endVertex();
v.pos(Math.max(x1, x2), Math.min(y1, y2), 0.0D).endVertex();
v.pos(Math.min(x1, x2), Math.min(y1, y2), 0.0D).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION);
vb.pos(Math.min(x1, x2), Math.max(y1, y2), 0.0D).endVertex();
vb.pos(Math.max(x1, x2), Math.max(y1, y2), 0.0D).endVertex();
vb.pos(Math.max(x1, x2), Math.min(y1, y2), 0.0D).endVertex();
vb.pos(Math.min(x1, x2), Math.min(y1, y2), 0.0D).endVertex();
t.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
Expand All @@ -90,13 +90,13 @@ public static void drawGradientRect(final float x1, final float y1, final float
GlStateManager.disableAlpha();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GlStateManager.shadeModel(GL_SMOOTH);
v.begin(GL_QUADS, DefaultVertexFormats.POSITION);
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION);
GlStateManager.color(r1, g1, b1, a1);
v.pos(x2, y1, 0).endVertex();
v.pos(x1, y1, 0).endVertex();
vb.pos(x2, y1, 0).endVertex();
vb.pos(x1, y1, 0).endVertex();
GlStateManager.color(r2, g2, b2, a2);
v.pos(x1, y2, 0).endVertex();
v.pos(x2, y2, 0).endVertex();
vb.pos(x1, y2, 0).endVertex();
vb.pos(x2, y2, 0).endVertex();
t.draw();
GlStateManager.shadeModel(GL_FLAT);
GlStateManager.disableBlend();
Expand Down Expand Up @@ -133,54 +133,54 @@ public static void drawTexturedModalRect(final float x, final float y, final flo
{
final float f = 0.00390625F;
final float f1 = 0.00390625F;
v.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
v.pos(x + 0, y + height, 0).tex((u + 0) * f, (v + height) * f1).endVertex();
v.pos(x + width, y + height, 0).tex((u + width) * f, (v + height) * f1).endVertex();
v.pos(x + width, y + 0, 0).tex((u + width) * f, (v + 0) * f1).endVertex();
v.pos(x + 0, y + 0, 0).tex((u + 0) * f, (v + 0) * f1).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(x + 0, y + height, 0).tex((u + 0) * f, (v + height) * f1).endVertex();
vb.pos(x + width, y + height, 0).tex((u + width) * f, (v + height) * f1).endVertex();
vb.pos(x + width, y + 0, 0).tex((u + width) * f, (v + 0) * f1).endVertex();
vb.pos(x + 0, y + 0, 0).tex((u + 0) * f, (v + 0) * f1).endVertex();
t.draw();
}

public static void drawTexturedModalRectFromIcon(final float x, final float y, final TextureAtlasSprite image, final float width, final float height)
{
v.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
v.pos(x + 0, y + height, 0).tex(image.getMinU(), image.getMaxV()).endVertex();
v.pos(x + width, y + height, 0).tex(image.getMaxU(), image.getMaxV()).endVertex();
v.pos(x + width, y + 0, 0).tex(image.getMaxU(), image.getMinV()).endVertex();
v.pos(x + 0, y + 0, 0).tex(image.getMinU(), image.getMinV()).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(x + 0, y + height, 0).tex(image.getMinU(), image.getMaxV()).endVertex();
vb.pos(x + width, y + height, 0).tex(image.getMaxU(), image.getMaxV()).endVertex();
vb.pos(x + width, y + 0, 0).tex(image.getMaxU(), image.getMinV()).endVertex();
vb.pos(x + 0, y + 0, 0).tex(image.getMinU(), image.getMinV()).endVertex();
t.draw();
}

public static void drawTexturedModalRect(final float x, final float y, final float u, final float v, final float width, final float height, final float divu, final float divv)
{
final float mulu = 1.0F / divu;
final float mulv = 1.0F / divv;
v.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
v.pos(x, y + height, 0.0D).tex(u * mulu, (v + height) * mulv).endVertex();
v.pos(x + width, y + height, 0.0D).tex((u + width) * mulu, (v + height) * mulv).endVertex();
v.pos(x + width, y, 0.0D).tex((u + width) * mulu, v * mulv).endVertex();
v.pos(x, y, 0.0D).tex(u * mulu, v * mulv).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(x, y + height, 0.0D).tex(u * mulu, (v + height) * mulv).endVertex();
vb.pos(x + width, y + height, 0.0D).tex((u + width) * mulu, (v + height) * mulv).endVertex();
vb.pos(x + width, y, 0.0D).tex((u + width) * mulu, v * mulv).endVertex();
vb.pos(x, y, 0.0D).tex(u * mulu, v * mulv).endVertex();
t.draw();
}

public static void drawModalRectWithCustomSizedTexture(final float x, final float y, final float u, final float v, final float uwidth, final float vheight, final float width, final float height, final float divu, final float divv)
{
final float mulu = 1.0F / divu;
final float mulv = 1.0F / divv;
v.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
v.pos(x, y + height, 0.0D).tex(u * mulu, (v + vheight) * mulv).endVertex();
v.pos(x + width, y + height, 0.0D).tex((u + uwidth) * mulu, (v + vheight) * mulv).endVertex();
v.pos(x + width, y, 0.0D).tex((u + uwidth) * mulu, v * mulv).endVertex();
v.pos(x, y, 0.0D).tex(u * mulu, v * mulv).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(x, y + height, 0.0D).tex(u * mulu, (v + vheight) * mulv).endVertex();
vb.pos(x + width, y + height, 0.0D).tex((u + uwidth) * mulu, (v + vheight) * mulv).endVertex();
vb.pos(x + width, y, 0.0D).tex((u + uwidth) * mulu, v * mulv).endVertex();
vb.pos(x, y, 0.0D).tex(u * mulu, v * mulv).endVertex();
t.draw();
}

public static void draw(final Area p, final int mode) {
v.begin(mode, DefaultVertexFormats.POSITION);
v.pos(p.x1(), p.y1(), 0).endVertex();
v.pos(p.x1(), p.y2(), 0).endVertex();
v.pos(p.x2(), p.y2(), 0).endVertex();
v.pos(p.x2(), p.y1(), 0).endVertex();
vb.begin(mode, DefaultVertexFormats.POSITION);
vb.pos(p.x1(), p.y1(), 0).endVertex();
vb.pos(p.x1(), p.y2(), 0).endVertex();
vb.pos(p.x2(), p.y2(), 0).endVertex();
vb.pos(p.x2(), p.y1(), 0).endVertex();
t.draw();
}

Expand All @@ -201,11 +201,11 @@ public static void drawRect(final Area a)
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
v.begin(7, DefaultVertexFormats.POSITION);
v.pos(a.x1(), a.y2(), .0).endVertex();
v.pos(a.x2(), a.y2(), .0).endVertex();
v.pos(a.x2(), a.y1(), .0).endVertex();
v.pos(a.x1(), a.y1(), .0).endVertex();
vb.begin(7, DefaultVertexFormats.POSITION);
vb.pos(a.x1(), a.y2(), .0).endVertex();
vb.pos(a.x2(), a.y2(), .0).endVertex();
vb.pos(a.x2(), a.y1(), .0).endVertex();
vb.pos(a.x1(), a.y1(), .0).endVertex();
t.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
Expand Down Expand Up @@ -260,11 +260,11 @@ public static void drawTexturedModalRect(final Area a, final Area texture)
{
final float f = 0.00390625F;
final float f1 = 0.00390625F;
v.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
v.pos(a.x1(), a.y2(), 0).tex(texture.x1() * f, texture.y2() * f1).endVertex();
v.pos(a.x2(), a.y2(), 0).tex(texture.x2() * f, texture.y2() * f1).endVertex();
v.pos(a.x2(), a.y1(), 0).tex(texture.x2() * f, texture.y1() * f1).endVertex();
v.pos(a.x1(), a.y1(), 0).tex(texture.x1() * f, texture.y1() * f1).endVertex();
vb.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(a.x1(), a.y2(), 0).tex(texture.x1() * f, texture.y2() * f1).endVertex();
vb.pos(a.x2(), a.y2(), 0).tex(texture.x2() * f, texture.y2() * f1).endVertex();
vb.pos(a.x2(), a.y1(), 0).tex(texture.x2() * f, texture.y1() * f1).endVertex();
vb.pos(a.x1(), a.y1(), 0).tex(texture.x1() * f, texture.y1() * f1).endVertex();
t.draw();
}

Expand Down

0 comments on commit 3dadc7f

Please sign in to comment.