Java Code Examples for net.minecraft.client.renderer.texture.TextureUtil#anaglyphColor()

The following examples show how to use net.minecraft.client.renderer.texture.TextureUtil#anaglyphColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FacadeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static List<CCQuad> applyItemTint(List<CCQuad> quads, ItemStack stack) {
    List<CCQuad> retQuads = new LinkedList<>();
    for (CCQuad quad : quads) {
        int colour = -1;

        if (quad.hasTint()) {
            colour = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, quad.tintIndex);

            if (EntityRenderer.anaglyphEnable) {
                colour = TextureUtil.anaglyphColor(colour);
            }
            colour = colour | 0xFF000000;
        }
        CCQuad copyQuad = quad.copy();

        Colour c = new ColourARGB(colour);
        for (Colour qC : copyQuad.colours) {
            qC.multiply(c);
        }
        retQuads.add(copyQuad);
    }

    return retQuads;
}
 
Example 2
Source File: RenderUtils.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Reimplement vanilla item so we can draw pearl stacks with opacity support.
 * + FIX THE OPACITY RENDERING.
 */
private static void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack) {
	color &= 0xFF000000;
	boolean flag = !stack.isEmpty();
	int i = 0;

	for (int j = quads.size(); i < j; ++i) {
		BakedQuad bakedquad = quads.get(i);
		int k = color | 0xFFFFFF;

		if (flag && bakedquad.hasTintIndex()) {
			k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());

			if (EntityRenderer.anaglyphEnable) {
				k = TextureUtil.anaglyphColor(k);
			}

			k &= 0xFFFFFF;
			k |= color;
		}

		LightUtil.renderQuadColor(renderer, bakedquad, k);
	}
}
 
Example 3
Source File: BlockModelRendererSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void renderQuadsSmooth(IBlockAccess blockAccessIn, IBlockState stateIn, BlockPos posIn, BufferBuilder buffer, List<BakedQuad> list, float[] quadBounds, BitSet bitSet, AmbientOcclusionFace aoFace)
{
    Vec3d vec3d = stateIn.getOffset(blockAccessIn, posIn);
    double x = (double)posIn.getX() + vec3d.x;
    double y = (double)posIn.getY() + vec3d.y;
    double z = (double)posIn.getZ() + vec3d.z;
    int i = 0;

    for (int j = list.size(); i < j; ++i)
    {
        BakedQuad bakedquad = list.get(i);
        this.fillQuadBounds(stateIn, bakedquad.getVertexData(), bakedquad.getFace(), quadBounds, bitSet);
        aoFace.updateVertexBrightness(blockAccessIn, stateIn, posIn, bakedquad.getFace(), quadBounds, bitSet);
        buffer.addVertexData(bakedquad.getVertexData());
        buffer.putBrightness4(aoFace.vertexBrightness[0], aoFace.vertexBrightness[1], aoFace.vertexBrightness[2], aoFace.vertexBrightness[3]);

        if (bakedquad.hasTintIndex())
        {
            int k = this.blockColors.colorMultiplier(stateIn, blockAccessIn, posIn, bakedquad.getTintIndex());

            if (EntityRenderer.anaglyphEnable)
            {
                k = TextureUtil.anaglyphColor(k);
            }

            float f = (float)(k >> 16 & 255) / 255.0F;
            float f1 = (float)(k >> 8 & 255) / 255.0F;
            float f2 = (float)(k & 255) / 255.0F;
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[0] * f, aoFace.vertexColorMultiplier[0] * f1, aoFace.vertexColorMultiplier[0] * f2, 4);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[1] * f, aoFace.vertexColorMultiplier[1] * f1, aoFace.vertexColorMultiplier[1] * f2, 3);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[2] * f, aoFace.vertexColorMultiplier[2] * f1, aoFace.vertexColorMultiplier[2] * f2, 2);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[3] * f, aoFace.vertexColorMultiplier[3] * f1, aoFace.vertexColorMultiplier[3] * f2, 1);
        }
        else
        {
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[0], aoFace.vertexColorMultiplier[0], aoFace.vertexColorMultiplier[0], 4);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[1], aoFace.vertexColorMultiplier[1], aoFace.vertexColorMultiplier[1], 3);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[2], aoFace.vertexColorMultiplier[2], aoFace.vertexColorMultiplier[2], 2);
            buffer.putColorMultiplier(aoFace.vertexColorMultiplier[3], aoFace.vertexColorMultiplier[3], aoFace.vertexColorMultiplier[3], 1);
        }

        buffer.putPosition(x, y, z);
    }
}
 
Example 4
Source File: BlockModelRendererSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void renderQuadsFlat(IBlockAccess blockAccessIn, IBlockState stateIn, BlockPos posIn, int brightnessIn, boolean ownBrightness, BufferBuilder buffer, List<BakedQuad> list, BitSet bitSet)
{
    Vec3d vec3d = stateIn.getOffset(blockAccessIn, posIn);
    double d0 = (double)posIn.getX() + vec3d.x;
    double d1 = (double)posIn.getY() + vec3d.y;
    double d2 = (double)posIn.getZ() + vec3d.z;
    int i = 0;

    for (int j = list.size(); i < j; ++i)
    {
        BakedQuad bakedquad = list.get(i);

        if (ownBrightness)
        {
            this.fillQuadBounds(stateIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, bitSet);
            BlockPos blockpos = bitSet.get(0) ? posIn.offset(bakedquad.getFace()) : posIn;
            brightnessIn = stateIn.getPackedLightmapCoords(blockAccessIn, blockpos);
        }

        buffer.addVertexData(bakedquad.getVertexData());
        buffer.putBrightness4(brightnessIn, brightnessIn, brightnessIn, brightnessIn);

        if (bakedquad.hasTintIndex())
        {
            int k = this.blockColors.colorMultiplier(stateIn, blockAccessIn, posIn, bakedquad.getTintIndex());

            if (EntityRenderer.anaglyphEnable)
            {
                k = TextureUtil.anaglyphColor(k);
            }

            float f = (float)(k >> 16 & 255) / 255.0F;
            float f1 = (float)(k >> 8 & 255) / 255.0F;
            float f2 = (float)(k & 255) / 255.0F;
            buffer.putColorMultiplier(f, f1, f2, 4);
            buffer.putColorMultiplier(f, f1, f2, 3);
            buffer.putColorMultiplier(f, f1, f2, 2);
            buffer.putColorMultiplier(f, f1, f2, 1);
        }

        buffer.putPosition(d0, d1, d2);
    }
}