diff options
author | syeyoung <cyong06@naver.com> | 2021-01-15 23:18:13 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-15 23:18:13 +0900 |
commit | 2f31ee747d693ed444334c84b4e2b112ef142531 (patch) | |
tree | 6d45305ca7547710081bf866970d6a320358d4b0 /src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit | |
parent | 58040f039287bcbfcfb6a5bd06172820f0fa16cf (diff) | |
download | Skyblock-Dungeons-Guide-2f31ee747d693ed444334c84b4e2b112ef142531.tar.gz Skyblock-Dungeons-Guide-2f31ee747d693ed444334c84b4e2b112ef142531.tar.bz2 Skyblock-Dungeons-Guide-2f31ee747d693ed444334c84b4e2b112ef142531.zip |
facking glstatemanager
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java | 53 | ||||
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java | 36 |
2 files changed, 46 insertions, 43 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java index 1a277cb1..5d63afe1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java @@ -118,7 +118,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { if (hsv[2] < 0) hsv[2] = 0; if (hsv[1] > 1) hsv[1] = 1; if (hsv[1] < 0) hsv[1] = 0; - parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | ((int)(alpha * 255)) << 24, true )); + parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | (MathHelper.clamp_int((int)(alpha * 255), 0, 255) << 24), true )); h.setData((float) Math.floor(hsv[0] * 360)); s.setData((float) Math.floor(hsv[1] * 100)); v.setData((float) Math.floor(hsv[2] * 100)); @@ -127,6 +127,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { s.updateSelected(); v.updateSelected(); a.updateSelected(); + System.out.println(((AColor)parameter.getNewData()).getAlpha()); } @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { @@ -135,11 +136,13 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + GlStateManager.enableBlend(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull();; + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); @@ -147,26 +150,26 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float g = (rgb >> 8 & 255) / 255.0f; float b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0); - GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0); + GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glColor4f(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); GL11.glEnd(); rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]); r = (rgb >> 16 & 255) / 255.0f; g = (rgb >> 8 & 255) / 255.0f; b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); - GL11.glColor4f(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); + GlStateManager.color(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); + GlStateManager.color(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); - GL11.glColor4f(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); +// GlStateManager.color(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); +// GlStateManager.color(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); +// GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); GL11.glEnd(); @@ -175,7 +178,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float cy = 45 + radius; GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GL11.glColor4f(1,1,1,alpha); + GlStateManager.color(1,1,1,alpha); GL11.glVertex3f(cx,cy,0); for (int i = 0; i <= 360; i++) { float rad = 3.141592653f * i / 180; @@ -183,13 +186,13 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float r2 = (rgb2 >> 16 & 255) / 255.0f; float g2 = (rgb2 >> 8 & 255) / 255.0f; float b2 = (rgb2 & 255) / 255.0f; - GL11.glColor4f(r2,g2,b2, alpha); + GlStateManager.color(r2,g2,b2, alpha); GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0); } GL11.glEnd(); - GL11.glShadeModel(shademodel); + GlStateManager.shadeModel(shademodel); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); float rad2 = 2 * 3.141592653f * hsv[0] ; float x = 5 + radius + (MathHelper.cos(rad2)) * hsv[1] * radius; @@ -210,9 +213,9 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { worldrenderer.pos(52+width, 45 + (alpha) * width, 0.5).endVertex(); tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1,1,1,1); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.color(1,1,1,1); GlStateManager.color(1,1,1,1); } private int selected = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java index e4c7d528..6e08bdfe 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java @@ -115,11 +115,11 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); @@ -127,13 +127,13 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float g = (rgb >> 8 & 255) / 255.0f; float b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); - GL11.glColor4f(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); + GlStateManager.color(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glColor4f(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); GL11.glEnd(); float radius = width/2f; @@ -141,7 +141,7 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float cy = 45 + radius; GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); GL11.glVertex3f(cx,cy,0); for (int i = 0; i <= 360; i++) { float rad = 3.141592653f * i / 180; @@ -149,13 +149,13 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float r2 = (rgb2 >> 16 & 255) / 255.0f; float g2 = (rgb2 >> 8 & 255) / 255.0f; float b2 = (rgb2 & 255) / 255.0f; - GL11.glColor4f(r2,g2,b2, 1); + GlStateManager.color(r2,g2,b2, 1); GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0); } GL11.glEnd(); - GL11.glShadeModel(shademodel); + GlStateManager.shadeModel(shademodel); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); float rad2 = 2 * 3.141592653f * hsv[0] ; float x = 5 + radius + (MathHelper.cos(rad2)) * hsv[1] * radius; @@ -171,9 +171,9 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex(); tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1,1,1,1); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.color(1,1,1,1); GlStateManager.color(1,1,1,1); } private int selected = 0; |