Java源码示例:net.minecraft.client.render.VertexFormats

示例1
@Override
public void renderDirtBackground(int i) {
	// Copied mostly from renderDirtBackground()
	RenderSystem.disableLighting();
	RenderSystem.disableFog();
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder builder = tessellator.getBuffer();
	minecraft.getTextureManager().bindTexture(backgroundTexture);
	int brightness = 130;
	RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
	builder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
	builder.vertex(0, height, 0).texture(0, height / 32.0F + i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(width, height, 0).texture(width / 32.0F, height / 32.0F + i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(width, 0, 0).texture(width / 32.0F, i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(0, 0, 0).texture(0, i).color(brightness, brightness, brightness, 255).next();
	tessellator.draw();
}
 
示例2
protected void renderHoleBackground(int top, int bottom, int topAlpha,
	int bottomAlpha)
{
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder bufferBuilder = tessellator.getBuffer();
	client.getTextureManager()
		.bindTexture(DrawableHelper.BACKGROUND_TEXTURE);
	RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
	bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
	bufferBuilder.vertex(left, bottom, 0.0D).texture(0.0F, bottom / 32.0F)
		.color(64, 64, 64, bottomAlpha).next();
	bufferBuilder.vertex(left + width, bottom, 0.0D)
		.texture(width / 32.0F, bottom / 32.0F)
		.color(64, 64, 64, bottomAlpha).next();
	bufferBuilder.vertex(left + width, top, 0.0D)
		.texture(width / 32.0F, top / 32.0F).color(64, 64, 64, topAlpha)
		.next();
	bufferBuilder.vertex(left, top, 0.0D).texture(0.0F, top / 32.0F)
		.color(64, 64, 64, topAlpha).next();
	tessellator.draw();
}
 
示例3
/**
 * Draws a textured rectangle.
 *
 * @param x         the x coordinate of the box on-screen
 * @param y         the y coordinate of the box on-screen
 * @param width     the width of the box on-screen
 * @param height    the height of the box on-screen
 * @param texture   the Identifier for the texture
 * @param u1        the left edge of the texture
 * @param v1        the top edge of the texture
 * @param u2        the right edge of the texture
 * @param v2        the bottom edge of the texture
 * @param color     a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint
 * @param opacity   opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
 * @since 2.0.0
 */
public static void texturedRect(int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) {
	MinecraftClient.getInstance().getTextureManager().bindTexture(texture);

	//float scale = 0.00390625F;

	if (width <= 0) width = 1;
	if (height <= 0) height = 1;

	float r = (color >> 16 & 255) / 255.0F;
	float g = (color >> 8 & 255) / 255.0F;
	float b = (color & 255) / 255.0F;
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buffer = tessellator.getBuffer();
	RenderSystem.enableBlend();
	//GlStateManager.disableTexture2D();
	RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
	buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR_TEXTURE); //I thought GL_QUADS was deprecated but okay, sure.
	buffer.vertex(x,         y + height, 0).color(r, g, b, opacity).texture(u1, v2).next();
	buffer.vertex(x + width, y + height, 0).color(r, g, b, opacity).texture(u2, v2).next();
	buffer.vertex(x + width, y,          0).color(r, g, b, opacity).texture(u2, v1).next();
	buffer.vertex(x,         y,          0).color(r, g, b, opacity).texture(u1, v1).next();
	tessellator.draw();
	//GlStateManager.enableTexture2D();
	RenderSystem.disableBlend();
}
 
示例4
/**
 * Draws an untextured rectangle of the specified RGB color.
 */
public static void coloredRect(int left, int top, int width, int height, int color) {
	if (width <= 0) width = 1;
	if (height <= 0) height = 1;

	float a = (color >> 24 & 255) / 255.0F;
	float r = (color >> 16 & 255) / 255.0F;
	float g = (color >> 8 & 255) / 255.0F;
	float b = (color & 255) / 255.0F;
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buffer = tessellator.getBuffer();
	RenderSystem.enableBlend();
	RenderSystem.disableTexture();
	RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
	buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR); //I thought GL_QUADS was deprecated but okay, sure.
	buffer.vertex(left,         top + height, 0.0D).color(r, g, b, a).next();
	buffer.vertex(left + width, top + height, 0.0D).color(r, g, b, a).next();
	buffer.vertex(left + width, top,          0.0D).color(r, g, b, a).next();
	buffer.vertex(left,         top,          0.0D).color(r, g, b, a).next();
	tessellator.draw();
	RenderSystem.enableTexture();
	RenderSystem.disableBlend();
}
 
示例5
@Environment(EnvType.CLIENT)
private void invertedRect(int x, int y, int width, int height) {
	Tessellator tessellator_1 = Tessellator.getInstance();
	BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
	RenderSystem.color4f(0.0F, 0.0F, 255.0F, 255.0F);
	RenderSystem.disableTexture();
	RenderSystem.enableColorLogicOp();
	RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
	bufferBuilder_1.begin(GL11.GL_QUADS, VertexFormats.POSITION);
	bufferBuilder_1.vertex(x,       y+height, 0.0D).next();
	bufferBuilder_1.vertex(x+width, y+height, 0.0D).next();
	bufferBuilder_1.vertex(x+width, y,        0.0D).next();
	bufferBuilder_1.vertex(x,       y,        0.0D).next();
	tessellator_1.draw();
	RenderSystem.disableColorLogicOp();
	RenderSystem.enableTexture();
}
 
示例6
public static void drawFilledBox(Box box, float r, float g, float b, float a) {
gl11Setup();

Vec3d ren = renderPos();

      /* Fill */
      Tessellator tessellator = Tessellator.getInstance();
      BufferBuilder buffer = tessellator.getBufferBuilder();
      buffer.begin(5, VertexFormats.POSITION_COLOR);
      WorldRenderer.buildBox(buffer,
      		box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z,
      		box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z, r, g, b, a/2f);
      tessellator.draw();
      
      /* Outline */
      WorldRenderer.drawBoxOutline(new Box(
      		box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z,
      		box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z), r, g, b, a);

      gl11Cleanup();
  }
 
示例7
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) {
	gl11Setup();
	GL11.glLineWidth(t);
       
	Vec3d ren = renderPos();
       
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBufferBuilder();
       buffer.begin(3, VertexFormats.POSITION_COLOR);
       buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 0.0F).next();
       buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 1.0F).next();
       buffer.vertex(x2 - ren.x, y2 - ren.y, z2 - ren.z).color(r, g, b, 1.0F).next();
       tessellator.draw();
       
	gl11Cleanup();
       
}
 
示例8
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.textRenderer.getStringWidth(str) / 2;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
    bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
    float f = mc.options.getTextBackgroundOpacity(0.25F);
    bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.textRenderer.draw(str, -i, 0, 553648127);
    mc.textRenderer.draw(str, -i, 0, -1);
      
    glCleanup();
}
 
示例9
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.textRenderer.getWidth(str) / 2;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
    float f = mc.options.getTextBackgroundOpacity(0.25F);
    bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.textRenderer.draw(new MatrixStack(), str, -i, 0, 553648127);
    mc.textRenderer.draw(new MatrixStack(), str, -i, 0, -1);
      
    glCleanup();
}
 
示例10
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.textRenderer.getStringWidth(str) / 2;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
    float f = mc.options.getTextBackgroundOpacity(0.25F);
    bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.textRenderer.draw(str, -i, 0, 553648127);
    mc.textRenderer.draw(str, -i, 0, -1);
      
    glCleanup();
}
 
示例11
private static void fillSolid(Matrix4f matrix, int x1, int y1, int x2, int y2, int color) {
    int j;
    if (x1 < x2) {
        j = x1;
        x1 = x2;
        x2 = j;
    }

    if (y1 < y2) {
        j = y1;
        y1 = y2;
        y2 = j;
    }

    float f = (float) (color >> 24 & 255) / 255.0F;
    float g = (float) (color >> 16 & 255) / 255.0F;
    float h = (float) (color >> 8 & 255) / 255.0F;
    float k = (float) (color & 255) / 255.0F;
    BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
    RenderSystem.disableBlend();
    RenderSystem.disableTexture();
    RenderSystem.defaultBlendFunc();
    bufferBuilder.begin(7, VertexFormats.POSITION_COLOR);
    bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next();
    bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next();
    bufferBuilder.end();
    BufferRenderer.draw(bufferBuilder);
    RenderSystem.enableTexture();
}
 
示例12
@Override
public void drawRepeating(int x, int y, int u, int v, int width, int height, float repeatWidth, float repeatHeight, int texWidth, int texHeight) {
    GlStateManager.disableLighting();
    GlStateManager.disableFog();
    Tessellator tessellator_1 = Tessellator.getInstance();
    BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
    GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR_TEXTURE);
    bufferBuilder_1.vertex(x, y + height, 0.0D).color(255, 255, 255, 255).texture(u / (float) texWidth, (v + repeatHeight) / (float) texHeight).next();
    bufferBuilder_1.vertex(x + width, y + height, 0.0D).color(255, 255, 255, 255).texture((u + repeatWidth) / (float) texWidth, (float) (v + repeatHeight) / (float) texHeight).next();
    bufferBuilder_1.vertex(x + width, y, 0.0D).color(255, 255, 255, 255).texture((u + repeatWidth) / (float) texWidth, v / (float) texHeight).next();
    bufferBuilder_1.vertex(x, y, 0.0D).color(255, 255, 255, 255).texture(u / (float) texWidth, v / (float) texHeight).next();
    tessellator_1.draw();
}
 
示例13
private void fillGradient(int x1, int y1, int x2, int y2, int color1, int color2) {
	float float_1 = (float)(color1 >> 24 & 255) / 255.0F;
	float float_2 = (float)(color1 >> 16 & 255) / 255.0F;
	float float_3 = (float)(color1 >> 8 & 255) / 255.0F;
	float float_4 = (float)(color1 & 255) / 255.0F;
	float float_5 = (float)(color2 >> 24 & 255) / 255.0F;
	float float_6 = (float)(color2 >> 16 & 255) / 255.0F;
	float float_7 = (float)(color2 >> 8 & 255) / 255.0F;
	float float_8 = (float)(color2 & 255) / 255.0F;
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
	GL11.glShadeModel(7425);
	Tessellator tessellator_1 = Tessellator.getInstance();
	BufferBuilder bufferBuilder_1 = tessellator_1.getBufferBuilder();
	bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR);
	bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next();
	bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next();
	tessellator_1.draw();
	GL11.glShadeModel(7424);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
示例14
public static void drawFilledBox(Box box, float r, float g, float b, float a) {
gl11Setup();

      // Fill
      Tessellator tessellator = Tessellator.getInstance();
      BufferBuilder buffer = tessellator.getBuffer();
      buffer.begin(5, VertexFormats.POSITION_COLOR);
      WorldRenderer.drawBox(buffer,
      		box.minX, box.minY, box.minZ,
      		box.maxX, box.maxY, box.maxZ, r, g, b, a/2f);
      tessellator.draw();
      
      // Outline
      buffer.begin(3, VertexFormats.POSITION_COLOR);
      buffer.vertex(box.minX, box.minY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.minY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.minY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.minY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.maxY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.maxY, box.minZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.minX, box.minY, box.maxZ).color(r, b, b, 0f).next();
      buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, b, b, 0f).next();
      buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, b, b, a/2f).next();
      buffer.vertex(box.maxX, box.minY, box.minZ).color(r, b, b, 0f).next();
      buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, b, b, a/2f).next();
      tessellator.draw();
      
      gl11Cleanup();
  }
 
示例15
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) {
	gl11Setup();
	GL11.glLineWidth(t);
       
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBuffer();
       buffer.begin(3, VertexFormats.POSITION_COLOR);
       buffer.vertex(x1, y1, z1).color(r, g, b, 0.0F).next();
       buffer.vertex(x1, y1, z1).color(r, g, b, 1.0F).next();
       buffer.vertex(x2, y2, z2).color(r, g, b, 1.0F).next();
       tessellator.draw();
       
	gl11Cleanup();
       
}
 
示例16
protected void fillGradient(MatrixStack matrix, int x1, int y1, int x2, int y2, int color1, int color2) {
	float float_1 = (float)(color1 >> 24 & 255) / 255.0F;
	float float_2 = (float)(color1 >> 16 & 255) / 255.0F;
	float float_3 = (float)(color1 >> 8 & 255) / 255.0F;
	float float_4 = (float)(color1 & 255) / 255.0F;
	float float_5 = (float)(color2 >> 24 & 255) / 255.0F;
	float float_6 = (float)(color2 >> 16 & 255) / 255.0F;
	float float_7 = (float)(color2 >> 8 & 255) / 255.0F;
	float float_8 = (float)(color2 & 255) / 255.0F;
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
	GL11.glShadeModel(7425);
	Tessellator tessellator_1 = Tessellator.getInstance();
	BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
	bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR);
	bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next();
	bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next();
	tessellator_1.draw();
	GL11.glShadeModel(7424);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
示例17
public static void drawFilledBox(Box box, float r, float g, float b, float a) {
gl11Setup();

      // Fill
      Tessellator tessellator = Tessellator.getInstance();
      BufferBuilder buffer = tessellator.getBuffer();
      buffer.begin(5, VertexFormats.POSITION_COLOR);
      WorldRenderer.drawBox(buffer,
      		box.x1, box.y1, box.z1,
      		box.x2, box.y2, box.z2, r, g, b, a/2f);
      tessellator.draw();
      
      // Outline
      buffer.begin(3, VertexFormats.POSITION_COLOR);
      buffer.vertex(box.x1, box.y1, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y1, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y1, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y1, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y1, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y2, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y2, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y2, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y2, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y2, box.z1).color(r, b, b, a/2f).next();
      buffer.vertex(box.x1, box.y1, box.z2).color(r, b, b, 0f).next();
      buffer.vertex(box.x1, box.y2, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y1, box.z2).color(r, b, b, 0f).next();
      buffer.vertex(box.x2, box.y2, box.z2).color(r, b, b, a/2f).next();
      buffer.vertex(box.x2, box.y1, box.z1).color(r, b, b, 0f).next();
      buffer.vertex(box.x2, box.y2, box.z1).color(r, b, b, a/2f).next();
      tessellator.draw();
      
      gl11Cleanup();
  }
 
示例18
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) {
	gl11Setup();
	GL11.glLineWidth(t);
       
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBuffer();
       buffer.begin(3, VertexFormats.POSITION_COLOR);
       buffer.vertex(x1, y1, z1).color(r, g, b, 0.0F).next();
       buffer.vertex(x1, y1, z1).color(r, g, b, 1.0F).next();
       buffer.vertex(x2, y2, z2).color(r, g, b, 1.0F).next();
       tessellator.draw();
       
	gl11Cleanup();
       
}
 
示例19
protected void fillGradient(int x1, int y1, int x2, int y2, int color1, int color2) {
	float float_1 = (float)(color1 >> 24 & 255) / 255.0F;
	float float_2 = (float)(color1 >> 16 & 255) / 255.0F;
	float float_3 = (float)(color1 >> 8 & 255) / 255.0F;
	float float_4 = (float)(color1 & 255) / 255.0F;
	float float_5 = (float)(color2 >> 24 & 255) / 255.0F;
	float float_6 = (float)(color2 >> 16 & 255) / 255.0F;
	float float_7 = (float)(color2 >> 8 & 255) / 255.0F;
	float float_8 = (float)(color2 & 255) / 255.0F;
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
	GL11.glShadeModel(7425);
	Tessellator tessellator_1 = Tessellator.getInstance();
	BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
	bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR);
	bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next();
	bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next();
	bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next();
	tessellator_1.draw();
	GL11.glShadeModel(7424);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
示例20
public static void drawSphereFaces(Tessellator tessellator, BufferBuilder builder,
                                       float cx, float cy, float cz,
                                       float r, int subd,
                                       float red, float grn, float blu, float alpha)
{

    float step = (float)Math.PI / (subd/2);
    int num_steps180 = (int)(Math.PI / step)+1;
    int num_steps360 = (int)(2*Math.PI / step);
    for (int i = 0; i <= num_steps360; i++)
    {
        float theta = i * step;
        float thetaprime = theta+step;
        builder.begin(GL11.GL_QUAD_STRIP, VertexFormats.POSITION_COLOR);
        for (int j = 0; j <= num_steps180; j++)
        {
            float phi = j * step;
            float x = r * MathHelper.sin(phi) * MathHelper.cos(theta);
            float z = r * MathHelper.sin(phi) * MathHelper.sin(theta);
            float y = r * MathHelper.cos(phi);
            float xp = r * MathHelper.sin(phi) * MathHelper.cos(thetaprime);
            float zp = r * MathHelper.sin(phi) * MathHelper.sin(thetaprime);
            builder.vertex(x + cx, y + cy, z + cz).color(red, grn, blu, alpha).next();
            builder.vertex(xp + cx, y + cy, zp + cz).color(red, grn, blu, alpha).next();
        }
        tessellator.draw();
    }
}
 
示例21
public static RenderLayer getTintedTexturedLayer(Identifier texture, float red, float green, float blue, float alpha) {
    return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, 7, 256, true, true, RenderLayer.MultiPhaseParameters.builder()
            .texture(new Color(texture, red, green, blue, alpha))
            .writeMaskState(COLOR_MASK)
            .alpha(ONE_TENTH_ALPHA)
            .transparency(GLOWING_TRANSPARENCY)
            .lightmap(DISABLE_LIGHTMAP)
            .overlay(DISABLE_OVERLAY_COLOR)
            .cull(DISABLE_CULLING)
            .build(true));
}
 
示例22
protected void renderList(MatrixStack matrixStack, int i, int j, int k,
	int l, float f)
{
	int m = getItemCount();
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder bufferBuilder = tessellator.getBuffer();
	
	for(int n = 0; n < m; ++n)
	{
		int o = j + n * itemHeight + headerHeight;
		int p = itemHeight - 4;
		if(o > bottom || o + p < top)
			updateItemPosition(n, i, o, f);
		
		if(renderSelection && isSelectedItem(n))
		{
			int q = left + width / 2 - getRowWidth() / 2;
			int r = left + width / 2 + getRowWidth() / 2;
			RenderSystem.disableTexture();
			float g = isFocused() ? 1.0F : 0.5F;
			RenderSystem.color4f(g, g, g, 1.0F);
			bufferBuilder.begin(7, VertexFormats.POSITION);
			bufferBuilder.vertex(q, o + p + 2, 0.0D).next();
			bufferBuilder.vertex(r, o + p + 2, 0.0D).next();
			bufferBuilder.vertex(r, o - 2, 0.0D).next();
			bufferBuilder.vertex(q, o - 2, 0.0D).next();
			tessellator.draw();
			RenderSystem.color4f(0.0F, 0.0F, 0.0F, 1.0F);
			bufferBuilder.begin(7, VertexFormats.POSITION);
			bufferBuilder.vertex(q + 1, o + p + 1, 0.0D).next();
			bufferBuilder.vertex(r - 1, o + p + 1, 0.0D).next();
			bufferBuilder.vertex(r - 1, o - 1, 0.0D).next();
			bufferBuilder.vertex(q + 1, o - 1, 0.0D).next();
			tessellator.draw();
			RenderSystem.enableTexture();
		}
		
		renderItem(matrixStack, n, i, o, p, k, l, f);
	}
	
}
 
示例23
public static void drawLine(Tessellator tessellator, BufferBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha) {
    builder.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR); // 3
    builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next();
    builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
    tessellator.draw();
}
 
示例24
public static void drawBoxWireGLLines(
        Tessellator tessellator, BufferBuilder builder,
        float x1, float y1, float z1,
        float x2, float y2, float z2,
        boolean xthick, boolean ythick, boolean zthick,
        float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2)
{
    builder.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR); // 3
    if (xthick)
    {
        builder.vertex(x1, y1, z1).color(red1, grn2, blu2, alpha).next();
        builder.vertex(x2, y1, z1).color(red1, grn2, blu2, alpha).next();

        builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
    }
    if (ythick)
    {
        builder.vertex(x1, y1, z1).color(red2, grn1, blu2, alpha).next();
        builder.vertex(x1, y2, z1).color(red2, grn1, blu2, alpha).next();

        builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
    }
    if (zthick)
    {
        builder.vertex(x1, y1, z1).color(red2, grn2, blu1, alpha).next();
        builder.vertex(x1, y1, z2).color(red2, grn2, blu1, alpha).next();

        builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).next();

        builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
    }
    tessellator.draw();
}
 
示例25
public static void drawBoxFaces(
        Tessellator tessellator, BufferBuilder builder,
        float x1, float y1, float z1,
        float x2, float y2, float z2,
        boolean xthick, boolean ythick, boolean zthick,
        float red1, float grn1, float blu1, float alpha)
{
    builder.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR);

    if (xthick && ythick)
    {
        builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).next();
        if (zthick)
        {
            builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();
        }
    }


    if (zthick && ythick)
    {
        builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).next();

        if (xthick)
        {
            builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();
        }
    }

    // now at least drawing one
    if (zthick && xthick)
    {
        builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y1, z1).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x2, y1, z2).color(red1, grn1, blu1, alpha).next();
        builder.vertex(x1, y1, z2).color(red1, grn1, blu1, alpha).next();


        if (ythick)
        {
            builder.vertex(x1, y2, z1).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y2, z1).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
            builder.vertex(x1, y2, z2).color(red1, grn1, blu1, alpha).next();
        }
    }
    tessellator.draw();
}