Начинающий
- Статус
- Оффлайн
- Регистрация
- 11 Май 2024
- Сообщения
- 281
- Реакции
- 3
решено
Последнее редактирование:
Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD
попробуй в colorutils создать цвет с нужными параметрами и импортнуть в нужное местопопробуй изменить цвет на черный и попробуй, видно ли рект либо на очень яркий цвет
Пожалуйста, зарегистрируйтесь или авторизуйтесь, чтобы увидеть содержимое.
оба не работают там проблема именно в ректах а не в утилке тк с дефолт джавой утилкой тоже самоепопробуй изменить цвет на черный и попробуй, видно ли рект либо на очень яркий цвет
попробуй в colorutils создать цвет с нужными параметрами и импортнуть в нужное место
Долбаеб?спс за код
Пожалуйста, зарегистрируйтесь или авторизуйтесь, чтобы увидеть содержимое.
я чо нахуй должен сам догадаться где траблоба не работают там проблема именно в ректах а не в утилке тк с дефолт джавой утилкой тоже самое
Долбаеб?
код дай свойоба не работают там проблема именно в ректах а не в утилке тк с дефолт джавой утилкой тоже самое
Долбаеб?
класс конкретный какой скажикод дай свой
ну бля где ошибка, очевиднокласс конкретный какой скажи
трабл в рендерутилке экспунсиватак он нихуя не дал, я чо должен мысленно догадаться где трабл?
Скрытое содержимое
я чо нахуй должен сам догадаться где трабл
логов нету
кода нету
package ru.karatel.system.render;
import com.jhlabs.image.GaussianFilter;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import ru.karatel.system.client.IMinecraft;
import ru.karatel.system.math.Vector4i;
import ru.karatel.system.shader.ShaderUtil;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.optifine.util.TextureUtils;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Objects;
import static net.minecraft.client.renderer.vertex.DefaultVertexFormats.*;
import static org.lwjgl.opengl.GL11C.*;
public class RenderUtils implements IMinecraft {
private static final Tessellator tessellator = Tessellator.getInstance();
private static final BufferBuilder buffer = tessellator.getBuffer();
public static float[] getColorComponents(Color color) {
return new float[] {
color.getRed() / 255f,
color.getGreen() / 255f,
color.getBlue() / 255f,
color.getAlpha() / 255f
};
}
public static void drawGradientOutlineRoundedRect(float x, float y, float width, float height, Vector4f roundingVec, float lineWidth, int... colors) {
GlStateManager.pushMatrix();
ShaderUtil.setupRenderState();
ShaderUtil.roundedout.attach();
ShaderUtil.roundedout.setUniformf("size", width, height);
ShaderUtil.roundedout.setUniformf("round", roundingVec.getX(), roundingVec.getY(), roundingVec.getZ(), roundingVec.getW());
ShaderUtil.roundedout.setUniformf("lineWidth", lineWidth);
ShaderUtil.roundedout.setUniformf("smoothness", 0.0f, 1.5f);
float[] color1 = ColorUtils.rgba(colors[0]);
float[] color2 = ColorUtils.rgba(colors[1]);
float[] color3 = ColorUtils.rgba(colors[2]);
float[] color4 = ColorUtils.rgba(colors[3]);
ShaderUtil.roundedout.setUniformf("colorOutline1", color1[0], color1[1], color1[2], color1[3]);
ShaderUtil.roundedout.setUniformf("colorOutline2", color2[0], color2[1], color2[2], color2[3]);
ShaderUtil.roundedout.setUniformf("colorOutline3", color3[0], color3[1], color3[2], color3[3]);
ShaderUtil.roundedout.setUniformf("colorOutline4", color4[0], color4[1], color4[2], color4[3]);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
buffer.pos(x, y, 0).endVertex();
buffer.pos(x, y + height, 0).endVertex();
buffer.pos(x + width, y + height, 0).endVertex();
buffer.pos(x + width, y, 0).endVertex();
tessellator.draw();
ShaderUtil.roundedout.detach();
ShaderUtil.cleanup();
GlStateManager.popMatrix();
}
public static void drawRoundedOutline(double x, double y, double width, double height, double radius, float lineWidth, Color color) {
GlStateManager.pushMatrix();
ShaderUtil.setupRenderState();
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
GL11.glLineWidth(lineWidth);
float[] c = getColorComponents(color);
GL11.glColor4f(c[0], c[1], c[2], c[3]);
double x2 = x + width;
double y2 = y + height;
buffer.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
int segments = 36;
double theta = Math.PI / 2 / segments;
for (int i = 0; i <= segments; i++) {
buffer.pos(x2 - radius + radius * Math.cos(theta * i), y + radius - radius * Math.sin(theta * i), 0).endVertex();
}
for (int i = 0; i <= segments; i++) {
buffer.pos(x + radius - radius * Math.sin(theta * i), y + radius - radius * Math.cos(theta * i), 0).endVertex();
}
for (int i = 0; i <= segments; i++) {
buffer.pos(x + radius - radius * Math.cos(theta * i), y2 - radius + radius * Math.sin(theta * i), 0).endVertex();
}
for (int i = 0; i <= segments; i++) {
buffer.pos(x2 - radius + radius * Math.sin(theta * i), y2 - radius + radius * Math.cos(theta * i), 0).endVertex();
}
tessellator.draw();
glDisable(GL_LINE_SMOOTH);
GL11.glLineWidth(1.0f);
ShaderUtil.cleanup();
GlStateManager.popMatrix();
}
public static void drawShadowOutline(double x, double y, double width, double height, double radius, float lineWidth, int shadowRadius, Color outlineColor) {
float shadowX = (float)x - shadowRadius;
float shadowY = (float)y - shadowRadius;
float shadowWidth = (float)width + shadowRadius * 2;
float shadowHeight = (float)height + shadowRadius * 2;
int identifier = Objects.hash(shadowWidth, shadowHeight, shadowRadius, lineWidth);
int textureId;
if (shadowCache.containsKey(identifier)) {
textureId = shadowCache.get(identifier);
GlStateManager.bindTexture(textureId);
} else {
BufferedImage originalImage = new BufferedImage((int) shadowWidth, (int) shadowHeight, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics2D graphics = originalImage.createGraphics();
graphics.setColor(Color.WHITE);
graphics.setStroke(new BasicStroke(lineWidth));
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.drawRoundRect(shadowRadius, shadowRadius, (int)(width), (int)(height), (int)(radius * 2), (int)(radius * 2));
graphics.dispose();
GaussianFilter filter = new GaussianFilter(shadowRadius);
BufferedImage blurredImage = filter.filter(originalImage, null);
DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage));
texture.setBlurMipmap(false, false);
textureId = texture.getGlTextureId();
shadowCache.put(identifier, textureId);
}
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.alphaFunc(GL_GREATER, 0.01f);
GlStateManager.disableAlphaTest();
float[] shadowColorComps = getColorComponents(outlineColor);
shadowColorComps[3] = 0.25f;
buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
buffer.pos(shadowX, shadowY, 0)
.color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3])
.tex(0, 0).endVertex();
buffer.pos(shadowX, shadowY + shadowHeight, 0)
.color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3])
.tex(0, 1).endVertex();
buffer.pos(shadowX + shadowWidth, shadowY + shadowHeight, 0)
.color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3])
.tex(1, 1).endVertex();
buffer.pos(shadowX + shadowWidth, shadowY, 0)
.color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3])
.tex(1, 0).endVertex();
tessellator.draw();
GlStateManager.enableAlphaTest();
GlStateManager.bindTexture(0);
GlStateManager.disableBlend();
}
public static void quads(float x, float y, float width, float height, int glQuads, int color) {
buffer.begin(glQuads, POSITION_TEX_COLOR);
{
buffer.pos(x, y, 0).tex(0, 0).color(color).endVertex();
buffer.pos(x, y + height, 0).tex(0, 1).color(color).endVertex();
buffer.pos(x + width, y + height, 0).tex(1, 1).color(color).endVertex();
buffer.pos(x + width, y, 0).tex(1, 0).color(color).endVertex();
}
tessellator.draw();
}
public static void scissor(double x, double y, double width, double height) {
final double scale = mc.getMainWindow().getGuiScaleFactor();
y = mc.getMainWindow().getScaledHeight() - y;
x *= scale;
y *= scale;
width *= scale;
height *= scale;
GL11.glScissor((int) x, (int) (y - height), (int) width, (int) height);
}
public static int reAlphaInt(final int color, final int alpha) {
return (MathHelper.clamp(alpha, 0, 255) << 24) | (color & 16777215);
}
private static final HashMap<Integer, Integer> shadowCache = new HashMap<Integer, Integer>();
public static void drawShadow(float x, float y, float width, float height, int radius, int color, int i) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f);
GlStateManager.disableAlphaTest();
GL11.glShadeModel(7425);
x -= radius;
y -= radius;
width = width + radius * 2;
height = height + radius * 2;
x -= 0.25f;
y += 0.25f;
int identifier = Objects.hash(width, height, radius);
int textureId;
if (shadowCache.containsKey(identifier)) {
textureId = shadowCache.get(identifier);
GlStateManager.bindTexture(textureId);
} else {
if (width <= 0) {
width = 1;
}
if (height <= 0) {
height = 1;
}
BufferedImage originalImage = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics2D graphics = originalImage.createGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(radius, radius, (int) (width - radius * 2), (int) (height - radius * 2));
graphics.dispose();
GaussianFilter filter = new GaussianFilter(radius);
BufferedImage blurredImage = filter.filter(originalImage, null);
DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage));
texture.setBlurMipmap(true, true);
textureId = texture.getGlTextureId();
shadowCache.put(identifier, textureId);
}
float[] startColorComponents = ColorUtils.rgba(color);
float[] i1 = ColorUtils.rgba(i);
buffer.begin(GL11.GL_QUADS, POSITION_COLOR_TEX);
buffer.pos(x, y, 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(0.0f, 0.0f)
.endVertex();
buffer.pos(x, y + (float) ((int) height), 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(0.0f, 1.0f)
.endVertex();
buffer.pos(x + (float) ((int) width), y + (float) ((int) height), 0.0f)
.color(i1[0], i1[1], i1[2],
i1[3])
.tex(1.0f, 1.0f)
.endVertex();
buffer.pos(x + (float) ((int) width), y, 0.0f)
.color(i1[0], i1[1], i1[2],
i1[3])
.tex(1.0f, 0.0f)
.endVertex();
tessellator.draw();
GlStateManager.enableAlphaTest();
GL11.glShadeModel(7424);
GlStateManager.bindTexture(0);
GlStateManager.disableBlend();
}
public static void drawShadow(float x, float y, float width, float height, int radius, int color) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f);
GlStateManager.disableAlphaTest();
x -= radius;
y -= radius;
width = width + radius * 2;
height = height + radius * 2;
x -= 0.25f;
y += 0.25f;
int identifier = Objects.hash(width, height, radius);
int textureId;
if (shadowCache.containsKey(identifier)) {
textureId = shadowCache.get(identifier);
GlStateManager.bindTexture(textureId);
} else {
if (width <= 0) {
width = 1;
}
if (height <= 0) {
height = 1;
}
BufferedImage originalImage = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics2D graphics = originalImage.createGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(radius, radius, (int) (width - radius * 2), (int) (height - radius * 2));
graphics.dispose();
GaussianFilter filter = new GaussianFilter(radius);
BufferedImage blurredImage = filter.filter(originalImage, null);
DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage));
texture.setBlurMipmap(true, true);
try {
textureId = texture.getGlTextureId();
} catch (Exception e) {
throw new RuntimeException(e);
}
shadowCache.put(identifier, textureId);
}
float[] startColorComponents = ColorUtils.rgba(color);
buffer.begin(GL11.GL_QUADS, POSITION_COLOR_TEX);
buffer.pos(x, y, 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(0.0f, 0.0f)
.endVertex();
buffer.pos(x, y + (float) ((int) height), 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(0.0f, 1.0f)
.endVertex();
buffer.pos(x + (float) ((int) width), y + (float) ((int) height), 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(1.0f, 1.0f)
.endVertex();
buffer.pos(x + (float) ((int) width), y, 0.0f)
.color(startColorComponents[0], startColorComponents[1], startColorComponents[2],
startColorComponents[3])
.tex(1.0f, 0.0f)
.endVertex();
tessellator.draw();
GlStateManager.enableAlphaTest();
GlStateManager.bindTexture(0);
GlStateManager.disableBlend();
}
public static void drawImage(ResourceLocation resourceLocation, float x, float y, float width, float height,
int color) {
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.shadeModel(7425);
mc.getTextureManager().bindTexture(resourceLocation);
quads(x, y, width, height, 7, color);
RenderSystem.shadeModel(7424);
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.popMatrix();
}
public static void drawImage(ResourceLocation resourceLocation, float x, float y, float width, float height,
Vector4i color) {
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.shadeModel(7425);
mc.getTextureManager().bindTexture(resourceLocation);
buffer.begin(7, POSITION_TEX_COLOR);
{
buffer.pos(x, y, 0).tex(0, 0).color(color.x).endVertex();
buffer.pos(x, y + height, 0).tex(0, 1).color(color.y).endVertex();
buffer.pos(x + width, y + height, 0).tex(1, 1).color(color.z).endVertex();
buffer.pos(x + width, y, 0).tex(1, 0).color(color.w).endVertex();
}
tessellator.draw();
RenderSystem.shadeModel(7424);
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.popMatrix();
}
public static void drawRectBuilding(
double left,
double top,
double right,
double bottom,
int color) {
if (left < right) {
double i = left;
left = right;
right = i;
}
if (top < bottom) {
double j = top;
top = bottom;
bottom = j;
}
float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
bufferbuilder.pos(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
}
public static void drawMCVerticalBuilding(double x,
double y,
double width,
double height,
int start,
int end) {
float f = (float) (start >> 24 & 255) / 255.0F;
float f1 = (float) (start >> 16 & 255) / 255.0F;
float f2 = (float) (start >> 8 & 255) / 255.0F;
float f3 = (float) (start & 255) / 255.0F;
float f4 = (float) (end >> 24 & 255) / 255.0F;
float f5 = (float) (end >> 16 & 255) / 255.0F;
float f6 = (float) (end >> 8 & 255) / 255.0F;
float f7 = (float) (end & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.pos(x, height, 0f).color(f1, f2, f3, f).endVertex();
bufferbuilder.pos(width, height, 0f).color(f1, f2, f3, f).endVertex();
bufferbuilder.pos(width, y, 0f).color(f5, f6, f7, f4).endVertex();
bufferbuilder.pos(x, y, 0f).color(f5, f6, f7, f4).endVertex();
}
public static void drawMCHorizontalBuilding(double x,
double y,
double width,
double height,
int start,
int end) {
float f = (float) (start >> 24 & 255) / 255.0F;
float f1 = (float) (start >> 16 & 255) / 255.0F;
float f2 = (float) (start >> 8 & 255) / 255.0F;
float f3 = (float) (start & 255) / 255.0F;
float f4 = (float) (end >> 24 & 255) / 255.0F;
float f5 = (float) (end >> 16 & 255) / 255.0F;
float f6 = (float) (end >> 8 & 255) / 255.0F;
float f7 = (float) (end & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.pos(x, height, 0f).color(f1, f2, f3, f).endVertex();
bufferbuilder.pos(width, height, 0f).color(f5, f6, f7, f4).endVertex();
bufferbuilder.pos(width, y, 0f).color(f5, f6, f7, f4).endVertex();
bufferbuilder.pos(x, y, 0f).color(f1, f2, f3, f).endVertex();
}
public static void drawRectW(
double x,
double y,
double w,
double h,
int color) {
w = x + w;
h = y + h;
if (x < w) {
double i = x;
x = w;
w = i;
}
if (y < h) {
double j = y;
y = h;
h = j;
}
float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(x, h, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(w, h, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(w, y, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.pos(x, y, 0.0F).color(f, f1, f2, f3).endVertex();
bufferbuilder.finishDrawing();
WorldVertexBufferUploader.draw(bufferbuilder);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}
public static void drawRectVerticalW(
double x,
double y,
double w,
double h,
int color,
int color1) {
w = x + w;
h = y + h;
if (x < w) {
double i = x;
x = w;
w = i;
}
if (y < h) {
double j = y;
y = h;
h = j;
}
float[] colorOne = ColorUtils.rgba(color);
float[] colorTwo = ColorUtils.rgba(color1);
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.shadeModel(7425);
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos(x, h, 0.0F).color(colorOne[0], colorOne[1], colorOne[2], colorOne[3]).endVertex();
bufferbuilder.pos(w, h, 0.0F).color(colorTwo[0], colorTwo[1], colorTwo[2], colorTwo[3]).endVertex();
bufferbuilder.pos(w, y, 0.0F).color(colorTwo[0], colorTwo[1], colorTwo[2], colorTwo[3]).endVertex();
bufferbuilder.pos(x, y, 0.0F).color(colorOne[0], colorOne[1], colorOne[2], colorOne[3]).endVertex();
bufferbuilder.finishDrawing();
WorldVertexBufferUploader.draw(bufferbuilder);
RenderSystem.enableTexture();
RenderSystem.shadeModel(7424);
RenderSystem.disableBlend();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
Vector4f vector4f,
int color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.rounded.attach();
ShaderUtil.rounded.setUniform("size", width * 2, height * 2);
ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.rounded.setUniform("color1",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color2",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color3",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color4",
ColorUtils.rgba(color));
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
Vector4f vector4f,
Vector4i color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.rounded.attach();
ShaderUtil.rounded.setUniform("size", width * 2, height * 2);
ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.rounded.setUniform("color1",
ColorUtils.rgba(color.getX()));
ShaderUtil.rounded.setUniform("color2",
ColorUtils.rgba(color.getY()));
ShaderUtil.rounded.setUniform("color3",
ColorUtils.rgba(color.getZ()));
ShaderUtil.rounded.setUniform("color4",
ColorUtils.rgba(color.getW()));
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
float outline,
int color1,
Vector4f vector4f,
Vector4i color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.roundedout.attach();
ShaderUtil.roundedout.setUniform("size", width * 2, height * 2);
ShaderUtil.roundedout.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.roundedout.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.roundedout.setUniform("outlineColor",
ColorUtils.rgba(color.getX()));
ShaderUtil.roundedout.setUniform("outlineColor1",
ColorUtils.rgba(color.getY()));
ShaderUtil.roundedout.setUniform("outlineColor2",
ColorUtils.rgba(color.getZ()));
ShaderUtil.roundedout.setUniform("outlineColor3",
ColorUtils.rgba(color.getW()));
ShaderUtil.roundedout.setUniform("color", ColorUtils.rgba(color1));
ShaderUtil.roundedout.setUniform("outline",
outline);
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
float radius,
int color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.smooth.attach();
ShaderUtil.smooth.setUniformf("location", (float) (x * mc.getMainWindow().getGuiScaleFactor()),
(float) ((mc.getMainWindow().getHeight() - (height * mc.getMainWindow().getGuiScaleFactor()))
- (y * mc.getMainWindow().getGuiScaleFactor())));
ShaderUtil.smooth.setUniformf("rectSize", width * mc.getMainWindow().getGuiScaleFactor(),
height * mc.getMainWindow().getGuiScaleFactor());
ShaderUtil.smooth.setUniformf("radius", radius * mc.getMainWindow().getGuiScaleFactor());
ShaderUtil.smooth.setUniform("blur", 0);
ShaderUtil.smooth.setUniform("color",
ColorUtils.rgba(color));
drawQuads(x, y, width, height, 7);
ShaderUtil.smooth.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawCircle(float x, float y, float radius, int color) {
drawRoundedRect(x - radius / 2f, y - radius / 2f, radius, radius,
radius / 2f, color);
}
public static void drawShadowCircle(float x, float y, float radius, int color) {
drawShadow(x - radius / 2f, y - radius / 2f, radius, radius,
(int) radius, color);
}
public static void drawQuads(float x, float y, float width, float height, int glQuads) {
buffer.begin(glQuads, POSITION_TEX);
{
buffer.pos(x, y, 0).tex(0, 0).endVertex();
buffer.pos(x, y + height, 0).tex(0, 1).endVertex();
buffer.pos(x + width, y + height, 0).tex(1, 1).endVertex();
buffer.pos(x + width, y, 0).tex(1, 0).endVertex();
}
Tessellator.getInstance().draw();
}
public static void drawBox(double x, double y, double width, double height, double size, int color) {
drawRectBuilding(x + size, y, width - size, y + size, color);
drawRectBuilding(x, y, x + size, height, color);
drawRectBuilding(width - size, y, width, height, color);
drawRectBuilding(x + size, height - size, width - size, height, color);
}
public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4i colors) {
drawMCHorizontalBuilding(x + size, y, width - size, y + size, colors.x, colors.z);
drawMCVerticalBuilding(x, y, x + size, height, colors.z, colors.x);
drawMCVerticalBuilding(width - size, y, width, height, colors.x, colors.z);
drawMCHorizontalBuilding(x + size, height - size, width - size, height, colors.z, colors.x);
}
}
а краш лог есть?трабл в рендерутилке экспунсива
sosoutil:package ru.karatel.system.render; import com.jhlabs.image.GaussianFilter; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import ru.karatel.system.client.IMinecraft; import ru.karatel.system.math.Vector4i; import ru.karatel.system.shader.ShaderUtil; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldVertexBufferUploader; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector4f; import net.optifine.util.TextureUtils; import org.lwjgl.opengl.GL11; import java.awt.*; import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Objects; import static net.minecraft.client.renderer.vertex.DefaultVertexFormats.*; import static org.lwjgl.opengl.GL11C.*; public class RenderUtils implements IMinecraft { private static final Tessellator tessellator = Tessellator.getInstance(); private static final BufferBuilder buffer = tessellator.getBuffer(); public static float[] getColorComponents(Color color) { return new float[] { color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f }; } public static void drawGradientOutlineRoundedRect(float x, float y, float width, float height, Vector4f roundingVec, float lineWidth, int... colors) { GlStateManager.pushMatrix(); ShaderUtil.setupRenderState(); ShaderUtil.roundedout.attach(); ShaderUtil.roundedout.setUniformf("size", width, height); ShaderUtil.roundedout.setUniformf("round", roundingVec.getX(), roundingVec.getY(), roundingVec.getZ(), roundingVec.getW()); ShaderUtil.roundedout.setUniformf("lineWidth", lineWidth); ShaderUtil.roundedout.setUniformf("smoothness", 0.0f, 1.5f); float[] color1 = ColorUtils.rgba(colors[0]); float[] color2 = ColorUtils.rgba(colors[1]); float[] color3 = ColorUtils.rgba(colors[2]); float[] color4 = ColorUtils.rgba(colors[3]); ShaderUtil.roundedout.setUniformf("colorOutline1", color1[0], color1[1], color1[2], color1[3]); ShaderUtil.roundedout.setUniformf("colorOutline2", color2[0], color2[1], color2[2], color2[3]); ShaderUtil.roundedout.setUniformf("colorOutline3", color3[0], color3[1], color3[2], color3[3]); ShaderUtil.roundedout.setUniformf("colorOutline4", color4[0], color4[1], color4[2], color4[3]); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); buffer.pos(x, y, 0).endVertex(); buffer.pos(x, y + height, 0).endVertex(); buffer.pos(x + width, y + height, 0).endVertex(); buffer.pos(x + width, y, 0).endVertex(); tessellator.draw(); ShaderUtil.roundedout.detach(); ShaderUtil.cleanup(); GlStateManager.popMatrix(); } public static void drawRoundedOutline(double x, double y, double width, double height, double radius, float lineWidth, Color color) { GlStateManager.pushMatrix(); ShaderUtil.setupRenderState(); glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); GL11.glLineWidth(lineWidth); float[] c = getColorComponents(color); GL11.glColor4f(c[0], c[1], c[2], c[3]); double x2 = x + width; double y2 = y + height; buffer.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION); int segments = 36; double theta = Math.PI / 2 / segments; for (int i = 0; i <= segments; i++) { buffer.pos(x2 - radius + radius * Math.cos(theta * i), y + radius - radius * Math.sin(theta * i), 0).endVertex(); } for (int i = 0; i <= segments; i++) { buffer.pos(x + radius - radius * Math.sin(theta * i), y + radius - radius * Math.cos(theta * i), 0).endVertex(); } for (int i = 0; i <= segments; i++) { buffer.pos(x + radius - radius * Math.cos(theta * i), y2 - radius + radius * Math.sin(theta * i), 0).endVertex(); } for (int i = 0; i <= segments; i++) { buffer.pos(x2 - radius + radius * Math.sin(theta * i), y2 - radius + radius * Math.cos(theta * i), 0).endVertex(); } tessellator.draw(); glDisable(GL_LINE_SMOOTH); GL11.glLineWidth(1.0f); ShaderUtil.cleanup(); GlStateManager.popMatrix(); } public static void drawShadowOutline(double x, double y, double width, double height, double radius, float lineWidth, int shadowRadius, Color outlineColor) { float shadowX = (float)x - shadowRadius; float shadowY = (float)y - shadowRadius; float shadowWidth = (float)width + shadowRadius * 2; float shadowHeight = (float)height + shadowRadius * 2; int identifier = Objects.hash(shadowWidth, shadowHeight, shadowRadius, lineWidth); int textureId; if (shadowCache.containsKey(identifier)) { textureId = shadowCache.get(identifier); GlStateManager.bindTexture(textureId); } else { BufferedImage originalImage = new BufferedImage((int) shadowWidth, (int) shadowHeight, BufferedImage.TYPE_INT_ARGB_PRE); Graphics2D graphics = originalImage.createGraphics(); graphics.setColor(Color.WHITE); graphics.setStroke(new BasicStroke(lineWidth)); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.drawRoundRect(shadowRadius, shadowRadius, (int)(width), (int)(height), (int)(radius * 2), (int)(radius * 2)); graphics.dispose(); GaussianFilter filter = new GaussianFilter(shadowRadius); BufferedImage blurredImage = filter.filter(originalImage, null); DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage)); texture.setBlurMipmap(false, false); textureId = texture.getGlTextureId(); shadowCache.put(identifier, textureId); } GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GlStateManager.alphaFunc(GL_GREATER, 0.01f); GlStateManager.disableAlphaTest(); float[] shadowColorComps = getColorComponents(outlineColor); shadowColorComps[3] = 0.25f; buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX); buffer.pos(shadowX, shadowY, 0) .color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3]) .tex(0, 0).endVertex(); buffer.pos(shadowX, shadowY + shadowHeight, 0) .color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3]) .tex(0, 1).endVertex(); buffer.pos(shadowX + shadowWidth, shadowY + shadowHeight, 0) .color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3]) .tex(1, 1).endVertex(); buffer.pos(shadowX + shadowWidth, shadowY, 0) .color(shadowColorComps[0], shadowColorComps[1], shadowColorComps[2], shadowColorComps[3]) .tex(1, 0).endVertex(); tessellator.draw(); GlStateManager.enableAlphaTest(); GlStateManager.bindTexture(0); GlStateManager.disableBlend(); } public static void quads(float x, float y, float width, float height, int glQuads, int color) { buffer.begin(glQuads, POSITION_TEX_COLOR); { buffer.pos(x, y, 0).tex(0, 0).color(color).endVertex(); buffer.pos(x, y + height, 0).tex(0, 1).color(color).endVertex(); buffer.pos(x + width, y + height, 0).tex(1, 1).color(color).endVertex(); buffer.pos(x + width, y, 0).tex(1, 0).color(color).endVertex(); } tessellator.draw(); } public static void scissor(double x, double y, double width, double height) { final double scale = mc.getMainWindow().getGuiScaleFactor(); y = mc.getMainWindow().getScaledHeight() - y; x *= scale; y *= scale; width *= scale; height *= scale; GL11.glScissor((int) x, (int) (y - height), (int) width, (int) height); } public static int reAlphaInt(final int color, final int alpha) { return (MathHelper.clamp(alpha, 0, 255) << 24) | (color & 16777215); } private static final HashMap<Integer, Integer> shadowCache = new HashMap<Integer, Integer>(); public static void drawShadow(float x, float y, float width, float height, int radius, int color, int i) { GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f); GlStateManager.disableAlphaTest(); GL11.glShadeModel(7425); x -= radius; y -= radius; width = width + radius * 2; height = height + radius * 2; x -= 0.25f; y += 0.25f; int identifier = Objects.hash(width, height, radius); int textureId; if (shadowCache.containsKey(identifier)) { textureId = shadowCache.get(identifier); GlStateManager.bindTexture(textureId); } else { if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } BufferedImage originalImage = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE); Graphics2D graphics = originalImage.createGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(radius, radius, (int) (width - radius * 2), (int) (height - radius * 2)); graphics.dispose(); GaussianFilter filter = new GaussianFilter(radius); BufferedImage blurredImage = filter.filter(originalImage, null); DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage)); texture.setBlurMipmap(true, true); textureId = texture.getGlTextureId(); shadowCache.put(identifier, textureId); } float[] startColorComponents = ColorUtils.rgba(color); float[] i1 = ColorUtils.rgba(i); buffer.begin(GL11.GL_QUADS, POSITION_COLOR_TEX); buffer.pos(x, y, 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(0.0f, 0.0f) .endVertex(); buffer.pos(x, y + (float) ((int) height), 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(0.0f, 1.0f) .endVertex(); buffer.pos(x + (float) ((int) width), y + (float) ((int) height), 0.0f) .color(i1[0], i1[1], i1[2], i1[3]) .tex(1.0f, 1.0f) .endVertex(); buffer.pos(x + (float) ((int) width), y, 0.0f) .color(i1[0], i1[1], i1[2], i1[3]) .tex(1.0f, 0.0f) .endVertex(); tessellator.draw(); GlStateManager.enableAlphaTest(); GL11.glShadeModel(7424); GlStateManager.bindTexture(0); GlStateManager.disableBlend(); } public static void drawShadow(float x, float y, float width, float height, int radius, int color) { GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f); GlStateManager.disableAlphaTest(); x -= radius; y -= radius; width = width + radius * 2; height = height + radius * 2; x -= 0.25f; y += 0.25f; int identifier = Objects.hash(width, height, radius); int textureId; if (shadowCache.containsKey(identifier)) { textureId = shadowCache.get(identifier); GlStateManager.bindTexture(textureId); } else { if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } BufferedImage originalImage = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE); Graphics2D graphics = originalImage.createGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(radius, radius, (int) (width - radius * 2), (int) (height - radius * 2)); graphics.dispose(); GaussianFilter filter = new GaussianFilter(radius); BufferedImage blurredImage = filter.filter(originalImage, null); DynamicTexture texture = new DynamicTexture(TextureUtils.toNativeImage(blurredImage)); texture.setBlurMipmap(true, true); try { textureId = texture.getGlTextureId(); } catch (Exception e) { throw new RuntimeException(e); } shadowCache.put(identifier, textureId); } float[] startColorComponents = ColorUtils.rgba(color); buffer.begin(GL11.GL_QUADS, POSITION_COLOR_TEX); buffer.pos(x, y, 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(0.0f, 0.0f) .endVertex(); buffer.pos(x, y + (float) ((int) height), 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(0.0f, 1.0f) .endVertex(); buffer.pos(x + (float) ((int) width), y + (float) ((int) height), 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(1.0f, 1.0f) .endVertex(); buffer.pos(x + (float) ((int) width), y, 0.0f) .color(startColorComponents[0], startColorComponents[1], startColorComponents[2], startColorComponents[3]) .tex(1.0f, 0.0f) .endVertex(); tessellator.draw(); GlStateManager.enableAlphaTest(); GlStateManager.bindTexture(0); GlStateManager.disableBlend(); } public static void drawImage(ResourceLocation resourceLocation, float x, float y, float width, float height, int color) { RenderSystem.pushMatrix(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.shadeModel(7425); mc.getTextureManager().bindTexture(resourceLocation); quads(x, y, width, height, 7, color); RenderSystem.shadeModel(7424); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.popMatrix(); } public static void drawImage(ResourceLocation resourceLocation, float x, float y, float width, float height, Vector4i color) { RenderSystem.pushMatrix(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.shadeModel(7425); mc.getTextureManager().bindTexture(resourceLocation); buffer.begin(7, POSITION_TEX_COLOR); { buffer.pos(x, y, 0).tex(0, 0).color(color.x).endVertex(); buffer.pos(x, y + height, 0).tex(0, 1).color(color.y).endVertex(); buffer.pos(x + width, y + height, 0).tex(1, 1).color(color.z).endVertex(); buffer.pos(x + width, y, 0).tex(1, 0).color(color.w).endVertex(); } tessellator.draw(); RenderSystem.shadeModel(7424); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.popMatrix(); } public static void drawRectBuilding( double left, double top, double right, double bottom, int color) { if (left < right) { double i = left; left = right; right = i; } if (top < bottom) { double j = top; top = bottom; bottom = j; } float f3 = (float) (color >> 24 & 255) / 255.0F; float f = (float) (color >> 16 & 255) / 255.0F; float f1 = (float) (color >> 8 & 255) / 255.0F; float f2 = (float) (color & 255) / 255.0F; BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); bufferbuilder.pos(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(right, top, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(left, top, 0.0F).color(f, f1, f2, f3).endVertex(); } public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) { float f = (float) (start >> 24 & 255) / 255.0F; float f1 = (float) (start >> 16 & 255) / 255.0F; float f2 = (float) (start >> 8 & 255) / 255.0F; float f3 = (float) (start & 255) / 255.0F; float f4 = (float) (end >> 24 & 255) / 255.0F; float f5 = (float) (end >> 16 & 255) / 255.0F; float f6 = (float) (end >> 8 & 255) / 255.0F; float f7 = (float) (end & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.pos(x, height, 0f).color(f1, f2, f3, f).endVertex(); bufferbuilder.pos(width, height, 0f).color(f1, f2, f3, f).endVertex(); bufferbuilder.pos(width, y, 0f).color(f5, f6, f7, f4).endVertex(); bufferbuilder.pos(x, y, 0f).color(f5, f6, f7, f4).endVertex(); } public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) { float f = (float) (start >> 24 & 255) / 255.0F; float f1 = (float) (start >> 16 & 255) / 255.0F; float f2 = (float) (start >> 8 & 255) / 255.0F; float f3 = (float) (start & 255) / 255.0F; float f4 = (float) (end >> 24 & 255) / 255.0F; float f5 = (float) (end >> 16 & 255) / 255.0F; float f6 = (float) (end >> 8 & 255) / 255.0F; float f7 = (float) (end & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.pos(x, height, 0f).color(f1, f2, f3, f).endVertex(); bufferbuilder.pos(width, height, 0f).color(f5, f6, f7, f4).endVertex(); bufferbuilder.pos(width, y, 0f).color(f5, f6, f7, f4).endVertex(); bufferbuilder.pos(x, y, 0f).color(f1, f2, f3, f).endVertex(); } public static void drawRectW( double x, double y, double w, double h, int color) { w = x + w; h = y + h; if (x < w) { double i = x; x = w; w = i; } if (y < h) { double j = y; y = h; h = j; } float f3 = (float) (color >> 24 & 255) / 255.0F; float f = (float) (color >> 16 & 255) / 255.0F; float f1 = (float) (color >> 8 & 255) / 255.0F; float f2 = (float) (color & 255) / 255.0F; BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos(x, h, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(w, h, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(w, y, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.pos(x, y, 0.0F).color(f, f1, f2, f3).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.enableTexture(); RenderSystem.disableBlend(); } public static void drawRectVerticalW( double x, double y, double w, double h, int color, int color1) { w = x + w; h = y + h; if (x < w) { double i = x; x = w; w = i; } if (y < h) { double j = y; y = h; h = j; } float[] colorOne = ColorUtils.rgba(color); float[] colorTwo = ColorUtils.rgba(color1); BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); RenderSystem.enableBlend(); RenderSystem.shadeModel(7425); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos(x, h, 0.0F).color(colorOne[0], colorOne[1], colorOne[2], colorOne[3]).endVertex(); bufferbuilder.pos(w, h, 0.0F).color(colorTwo[0], colorTwo[1], colorTwo[2], colorTwo[3]).endVertex(); bufferbuilder.pos(w, y, 0.0F).color(colorTwo[0], colorTwo[1], colorTwo[2], colorTwo[3]).endVertex(); bufferbuilder.pos(x, y, 0.0F).color(colorOne[0], colorOne[1], colorOne[2], colorOne[3]).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.enableTexture(); RenderSystem.shadeModel(7424); RenderSystem.disableBlend(); } public static void drawRoundedRect(float x, float y, float width, float height, Vector4f vector4f, int color) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); ShaderUtil.rounded.attach(); ShaderUtil.rounded.setUniform("size", width * 2, height * 2); ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2); ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f); ShaderUtil.rounded.setUniform("color1", ColorUtils.rgba(color)); ShaderUtil.rounded.setUniform("color2", ColorUtils.rgba(color)); ShaderUtil.rounded.setUniform("color3", ColorUtils.rgba(color)); ShaderUtil.rounded.setUniform("color4", ColorUtils.rgba(color)); drawQuads(x, y, width, height, 7); ShaderUtil.rounded.detach(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawRoundedRect(float x, float y, float width, float height, Vector4f vector4f, Vector4i color) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); ShaderUtil.rounded.attach(); ShaderUtil.rounded.setUniform("size", width * 2, height * 2); ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2); ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f); ShaderUtil.rounded.setUniform("color1", ColorUtils.rgba(color.getX())); ShaderUtil.rounded.setUniform("color2", ColorUtils.rgba(color.getY())); ShaderUtil.rounded.setUniform("color3", ColorUtils.rgba(color.getZ())); ShaderUtil.rounded.setUniform("color4", ColorUtils.rgba(color.getW())); drawQuads(x, y, width, height, 7); ShaderUtil.rounded.detach(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawRoundedRect(float x, float y, float width, float height, float outline, int color1, Vector4f vector4f, Vector4i color) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); ShaderUtil.roundedout.attach(); ShaderUtil.roundedout.setUniform("size", width * 2, height * 2); ShaderUtil.roundedout.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2); ShaderUtil.roundedout.setUniform("smoothness", 0.f, 1.5f); ShaderUtil.roundedout.setUniform("outlineColor", ColorUtils.rgba(color.getX())); ShaderUtil.roundedout.setUniform("outlineColor1", ColorUtils.rgba(color.getY())); ShaderUtil.roundedout.setUniform("outlineColor2", ColorUtils.rgba(color.getZ())); ShaderUtil.roundedout.setUniform("outlineColor3", ColorUtils.rgba(color.getW())); ShaderUtil.roundedout.setUniform("color", ColorUtils.rgba(color1)); ShaderUtil.roundedout.setUniform("outline", outline); drawQuads(x, y, width, height, 7); ShaderUtil.rounded.detach(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawRoundedRect(float x, float y, float width, float height, float radius, int color) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); ShaderUtil.smooth.attach(); ShaderUtil.smooth.setUniformf("location", (float) (x * mc.getMainWindow().getGuiScaleFactor()), (float) ((mc.getMainWindow().getHeight() - (height * mc.getMainWindow().getGuiScaleFactor())) - (y * mc.getMainWindow().getGuiScaleFactor()))); ShaderUtil.smooth.setUniformf("rectSize", width * mc.getMainWindow().getGuiScaleFactor(), height * mc.getMainWindow().getGuiScaleFactor()); ShaderUtil.smooth.setUniformf("radius", radius * mc.getMainWindow().getGuiScaleFactor()); ShaderUtil.smooth.setUniform("blur", 0); ShaderUtil.smooth.setUniform("color", ColorUtils.rgba(color)); drawQuads(x, y, width, height, 7); ShaderUtil.smooth.detach(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawCircle(float x, float y, float radius, int color) { drawRoundedRect(x - radius / 2f, y - radius / 2f, radius, radius, radius / 2f, color); } public static void drawShadowCircle(float x, float y, float radius, int color) { drawShadow(x - radius / 2f, y - radius / 2f, radius, radius, (int) radius, color); } public static void drawQuads(float x, float y, float width, float height, int glQuads) { buffer.begin(glQuads, POSITION_TEX); { buffer.pos(x, y, 0).tex(0, 0).endVertex(); buffer.pos(x, y + height, 0).tex(0, 1).endVertex(); buffer.pos(x + width, y + height, 0).tex(1, 1).endVertex(); buffer.pos(x + width, y, 0).tex(1, 0).endVertex(); } Tessellator.getInstance().draw(); } public static void drawBox(double x, double y, double width, double height, double size, int color) { drawRectBuilding(x + size, y, width - size, y + size, color); drawRectBuilding(x, y, x + size, height, color); drawRectBuilding(width - size, y, width, height, color); drawRectBuilding(x + size, height - size, width - size, height, color); } public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4i colors) { drawMCHorizontalBuilding(x + size, y, width - size, y + size, colors.x, colors.z); drawMCVerticalBuilding(x, y, x + size, height, colors.z, colors.x); drawMCVerticalBuilding(width - size, y, width, height, colors.x, colors.z); drawMCHorizontalBuilding(x + size, height - size, width - size, height, colors.z, colors.x); } }
Нету краша там тупо оно перестает рендерится если прозрачность меньше 26-27а краш лог есть?
я тебе скинул свой утил для рендера, если у тебя 3.1, попробуй проверь может так заработаетНету краша там тупо оно перестает рендерится если прозрачность меньше 26-27
какой метод при рендере юзаешь?Нету краша там тупо оно перестает рендерится если прозрачность меньше 26-27
Ошибок дохуя броу он на аргументы жалуется кинь фулл класс простоpublic static void drawRoundedRect(float x,
float y,
float width,
float height,
Vector4f vector4f,
int color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.rounded.attach();
ShaderUtil.rounded.setUniform("size", width * 2, height * 2);
ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.rounded.setUniform("color1",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color2",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color3",
ColorUtils.rgba(color));
ShaderUtil.rounded.setUniform("color4",
ColorUtils.rgba(color));
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
Vector4f vector4f,
Vector4i color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.rounded.attach();
ShaderUtil.rounded.setUniform("size", width * 2, height * 2);
ShaderUtil.rounded.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.rounded.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.rounded.setUniform("color1",
ColorUtils.rgba(color.getX()));
ShaderUtil.rounded.setUniform("color2",
ColorUtils.rgba(color.getY()));
ShaderUtil.rounded.setUniform("color3",
ColorUtils.rgba(color.getZ()));
ShaderUtil.rounded.setUniform("color4",
ColorUtils.rgba(color.getW()));
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
public static void drawRoundedRect(float x,
float y,
float width,
float height,
float outline,
int color1,
Vector4f vector4f,
Vector4i color) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ShaderUtil.roundedout.attach();
ShaderUtil.roundedout.setUniform("size", width * 2, height * 2);
ShaderUtil.roundedout.setUniform("round", vector4f.x * 2, vector4f.y * 2, vector4f.z * 2, vector4f.w * 2);
ShaderUtil.roundedout.setUniform("smoothness", 0.f, 1.5f);
ShaderUtil.roundedout.setUniform("outlineColor",
ColorUtils.rgba(color.getX()));
ShaderUtil.roundedout.setUniform("outlineColor1",
ColorUtils.rgba(color.getY()));
ShaderUtil.roundedout.setUniform("outlineColor2",
ColorUtils.rgba(color.getZ()));
ShaderUtil.roundedout.setUniform("outlineColor3",
ColorUtils.rgba(color.getW()));
ShaderUtil.roundedout.setUniform("color", ColorUtils.rgba(color1));
ShaderUtil.roundedout.setUniform("outline",
outline);
drawQuads(x, y, width, height, 7);
ShaderUtil.rounded.detach();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
я тебе скинул свой утил для рендера, если у тебя 3.1, попробуй проверь может так заработает
drawRoundedRectкакой метод при рендере юзаешь?
4 метода раунд ректа пробывал ни один не работаеткакой метод при рендере юзаешь?
покажи как ты roundedrect вызываешь строкуОшибок дохуя броу он на аргументы жалуется кинь фулл класс просто
drawRoundedRect
4 метода раунд ректа пробывал ни один не работает
Короче ошибка глубже проблема не в ректе а в шейдере который использует рект вот этот вот RoundedGlslпокажи как ты roundedrect вызываешь строку
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz