Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1.  
  2. public static void circle(final float x, final float y, final float radius, final int fill) {
  3. arc(x, y, 0.0f, 360.0f, radius, fill);
  4. }
  5.  
  6. public static void circle(final float x, final float y, final float radius, final Color fill) {
  7. arc(x, y, 0.0f, 360.0f, radius, fill);
  8. }
  9.  
  10. public static void arc(final float x, final float y, final float start, final float end, final float radius, final int color) {
  11. arcEllipse(x, y, start, end, radius, radius, color);
  12. }
  13.  
  14. public static void arc(final float x, final float y, final float start, final float end, final float radius, final Color color) {
  15. arcEllipse(x, y, start, end, radius, radius, color);
  16. }
  17.  
  18. public static void arcEllipse(final float x, final float y, float start, float end, final float w, final float h, final int color) {
  19. GlStateManager.color(0.0f, 0.0f, 0.0f);
  20. GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
  21. float temp = 0.0f;
  22. if (start > end) {
  23. temp = end;
  24. end = start;
  25. start = temp;
  26. }
  27. final float var11 = (color >> 24 & 0xFF) / 255.0f;
  28. final float var12 = (color >> 16 & 0xFF) / 255.0f;
  29. final float var13 = (color >> 8 & 0xFF) / 255.0f;
  30. final float var14 = (color & 0xFF) / 255.0f;
  31. final Tessellator var15 = Tessellator.getInstance();
  32. final WorldRenderer var16 = var15.getWorldRenderer();
  33. GlStateManager.enableBlend();
  34. GlStateManager.disableTexture2D();
  35. GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
  36. GlStateManager.color(var12, var13, var14, var11);
  37. if (var11 > 0.5f) {
  38. GL11.glEnable(2848);
  39. GL11.glLineWidth(2.0f);
  40. GL11.glBegin(3);
  41. for (float i = end; i >= start; i -= 4.0f) {
  42. final float ldx = (float)Math.cos(i * 3.141592653589793 / 180.0) * (w * 1.001f);
  43. final float ldy = (float)Math.sin(i * 3.141592653589793 / 180.0) * (h * 1.001f);
  44. GL11.glVertex2f(x + ldx, y + ldy);
  45. }
  46. GL11.glEnd();
  47. GL11.glDisable(2848);
  48. }
  49. GL11.glBegin(6);
  50. for (float i = end; i >= start; i -= 4.0f) {
  51. final float ldx = (float)Math.cos(i * 3.141592653589793 / 180.0) * w;
  52. final float ldy = (float)Math.sin(i * 3.141592653589793 / 180.0) * h;
  53. GL11.glVertex2f(x + ldx, y + ldy);
  54. }
  55. GL11.glEnd();
  56. GlStateManager.enableTexture2D();
  57. GlStateManager.disableBlend();
  58. }
  59.  
  60. public static void arcEllipse(final float x, final float y, float start, float end, final float w, final float h, final Color color) {
  61. GlStateManager.color(0.0f, 0.0f, 0.0f);
  62. GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
  63. float temp = 0.0f;
  64. if (start > end) {
  65. temp = end;
  66. end = start;
  67. start = temp;
  68. }
  69. final Tessellator var9 = Tessellator.getInstance();
  70. final WorldRenderer var10 = var9.getWorldRenderer();
  71. GlStateManager.enableBlend();
  72. GlStateManager.disableTexture2D();
  73. GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
  74. GlStateManager.color(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f);
  75. if (color.getAlpha() > 0.5f) {
  76. GL11.glEnable(2848);
  77. GL11.glLineWidth(2.0f);
  78. GL11.glBegin(3);
  79. for (float i = end; i >= start; i -= 4.0f) {
  80. final float ldx = (float)Math.cos(i * 3.141592653589793 / 180.0) * (w * 1.001f);
  81. final float ldy = (float)Math.sin(i * 3.141592653589793 / 180.0) * (h * 1.001f);
  82. GL11.glVertex2f(x + ldx, y + ldy);
  83. }
  84. GL11.glEnd();
  85. GL11.glDisable(2848);
  86. }
  87. GL11.glBegin(6);
  88. for (float i = end; i >= start; i -= 4.0f) {
  89. final float ldx = (float)Math.cos(i * 3.141592653589793 / 180.0) * w;
  90. final float ldy = (float)Math.sin(i * 3.141592653589793 / 180.0) * h;
  91. GL11.glVertex2f(x + ldx, y + ldy);
  92. }
  93. GL11.glEnd();
  94. GlStateManager.enableTexture2D();
  95. GlStateManager.disableBlend();
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement