codechicken.lib.colour.ColourRGBA Java Examples

The following examples show how to use codechicken.lib.colour.ColourRGBA. 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: RenderWireless.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public static void renderPearl(Vector3 pos, WirelessPart p) {
    GL11.glPushMatrix();

    pos.translation().glApply();
    p.rotationT().at(center).glApply();
    p.getPearlPos().translation().glApply();
    p.getPearlRotation().glApply();
    new Scale(p.getPearlScale()).glApply();
    float light = 1;
    if (p.tile() != null) {
        GL11.glRotatef((float) (p.getPearlSpin() * MathHelper.todeg), 0, 1, 0);
        light = p.getPearlLight();
    }

    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.reset();
    CCRenderState.changeTexture("wrcbe_core:textures/hedronmap.png");
    CCRenderState.pullLightmap();
    CCRenderState.setColour(new ColourRGBA(light, light, light, 1).rgba());
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render();
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glPopMatrix();
}
 
Example #2
Source File: LightMatrix.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void operate() {
    LC lc = CCRenderState.lc;
    float[] a = ao(lc.side);
    float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd);
    int[] b = brightness(lc.side);
    CCRenderState.setColour(ColourRGBA.multiplyC(CCRenderState.colour, f));
    CCRenderState.setBrightness((int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF);
}
 
Example #3
Source File: LightMatrix.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void operate(CCRenderState ccrs) {
    LC lc = ccrs.lc;
    float[] a = ao(lc.side);
    float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd);
    int[] b = brightness(lc.side);
    ccrs.colour = ColourRGBA.multiplyC(ccrs.colour, f);
    //System.out.println("0x808080FF * " + f + " = 0x" + Integer.toHexString(state.colour));
    ccrs.brightness = (int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF;
}
 
Example #4
Source File: CCRenderState.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void operate() {
    if(colourRef != null)
        setColour(ColourRGBA.multiply(baseColour, colourRef[vertexIndex]));
    else
        setColour(baseColour);
}
 
Example #5
Source File: ColourAttribute.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void operate(CCRenderState ccrs) {
    if (colourRef != null) {
        ccrs.colour = ColourRGBA.multiply(ccrs.baseColour, colourRef[ccrs.vertexIndex]);
    } else {
        ccrs.colour = ccrs.baseColour;
    }
}
 
Example #6
Source File: TextureLavaFX.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public void onTick()
{
    int var2;
    float var3;
    int var5;
    int var6;
    int var7;
    int var8;
    int var9;

    for (int var1 = 0; var1 < tileSizeBase; ++var1)
    {
        for (var2 = 0; var2 < tileSizeBase; ++var2)
        {
            var3 = 0.0F;
            int var4 = (int)(MathHelper.sin(var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
            var5 = (int)(MathHelper.sin(var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);

            for (var6 = var1 - 1; var6 <= var1 + 1; ++var6)
            {
                for (var7 = var2 - 1; var7 <= var2 + 1; ++var7)
                {
                    var8 = var6 + var4 & tileSizeMask;
                    var9 = var7 + var5 & tileSizeMask;
                    var3 += this.field_76876_g[var8 + var9 * tileSizeBase];
                }
            }

            this.field_76878_h[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F;
            this.field_76879_i[var1 + var2 * tileSizeBase] += this.field_76877_j[var1 + var2 * tileSizeBase] * 0.01F;

            if (this.field_76879_i[var1 + var2 * tileSizeBase] < 0.0F)
            {
                this.field_76879_i[var1 + var2 * tileSizeBase] = 0.0F;
            }

            this.field_76877_j[var1 + var2 * tileSizeBase] -= 0.06F;

            if (Math.random() < 0.005D)
            {
                this.field_76877_j[var1 + var2 * tileSizeBase] = 1.5F;
            }
        }
    }

    float[] var11 = this.field_76878_h;
    this.field_76878_h = this.field_76876_g;
    this.field_76876_g = var11;

    for (var2 = 0; var2 < tileSizeSquare; ++var2)
    {
        var3 = this.field_76876_g[var2] * 2.0F;

        if (var3 > 1.0F)
        {
            var3 = 1.0F;
        }

        if (var3 < 0.0F)
        {
            var3 = 0.0F;
        }

        var5 = (int)(var3 * 100.0F + 155.0F);
        var6 = (int)(var3 * var3 * 255.0F);
        var7 = (int)(var3 * var3 * var3 * var3 * 128.0F);

        if (this.anaglyphEnabled)
        {
            var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;
            var9 = (var5 * 30 + var6 * 70) / 100;
            int var10 = (var5 * 30 + var7 * 70) / 100;
            var5 = var8;
            var6 = var9;
            var7 = var10;
        }

        imageData[var2] = new ColourRGBA(var5, var6, var7, -1).argb();
    }
}
 
Example #7
Source File: PlanarLightModel.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate() {
    CCRenderState.setColour(ColourRGBA.multiply(CCRenderState.colour, colours[CCRenderState.side]));
}
 
Example #8
Source File: CCRenderState.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate() {
    setColour(ColourRGBA.multiply(colour, colourRef[vertexIndex]));
}
 
Example #9
Source File: ColourMultiplier.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate() {
    CCRenderState.setColour(ColourRGBA.multiply(CCRenderState.colour, colour));
}
 
Example #10
Source File: TextureLavaFlowFX.java    From CodeChickenCore with MIT License 4 votes vote down vote up
private void writeColour(int px, int py, int var5, int var6, int var7, int var8)
{
    imageData[py*32+px] = new ColourRGBA(var5, var6, var7, var8).argb();
}
 
Example #11
Source File: TextureWaterFlowFX.java    From CodeChickenCore with MIT License 4 votes vote down vote up
private void writeColour(int px, int py, int var5, int var6, int var7, int var8)
{
    imageData[py*32+px] = new ColourRGBA(var5, var6, var7, var8).argb();
}
 
Example #12
Source File: TextureWaterFX.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public void onTick()
{
    int var1;
    int var2;
    float var3;
    int var5;
    int var6;

    for (var1 = 0; var1 < tileSizeBase; ++var1)
    {
        for (var2 = 0; var2 < tileSizeBase; ++var2)
        {
            var3 = 0.0F;

            for (int var4 = var1 - 1; var4 <= var1 + 1; ++var4)
            {
                var5 = var4 & tileSizeMask;
                var6 = var2 & tileSizeMask;
                var3 += this.red[var5 + var6 * tileSizeBase];
            }

            this.green[var1 + var2 * tileSizeBase] = var3 / 3.3F + this.blue[var1 + var2 * tileSizeBase] * 0.8F;
        }
    }

    for (var1 = 0; var1 < tileSizeBase; ++var1)
    {
        for (var2 = 0; var2 < tileSizeBase; ++var2)
        {
            this.blue[var1 + var2 * tileSizeBase] += this.alpha[var1 + var2 * tileSizeBase] * 0.05F;

            if (this.blue[var1 + var2 * tileSizeBase] < 0.0F)
            {
                this.blue[var1 + var2 * tileSizeBase] = 0.0F;
            }

            this.alpha[var1 + var2 * tileSizeBase] -= 0.1F;

            if (Math.random() < 0.05D)
            {
                this.alpha[var1 + var2 * tileSizeBase] = 0.5F;
            }
        }
    }

    float[] var12 = this.green;
    this.green = this.red;
    this.red = var12;

    for (var2 = 0; var2 < tileSizeSquare; ++var2)
    {
        var3 = this.red[var2];

        if (var3 > 1.0F)
        {
            var3 = 1.0F;
        }

        if (var3 < 0.0F)
        {
            var3 = 0.0F;
        }

        float var13 = var3 * var3;
        var5 = (int)(32.0F + var13 * 32.0F);
        var6 = (int)(50.0F + var13 * 64.0F);
        int var7 = 255;
        int var8 = (int)(146.0F + var13 * 50.0F);

        if (this.anaglyphEnabled)
        {
            int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;
            int var10 = (var5 * 30 + var6 * 70) / 100;
            int var11 = (var5 * 30 + var7 * 70) / 100;
            var5 = var9;
            var6 = var10;
            var7 = var11;
        }

        imageData[var2] = new ColourRGBA(var5, var6, var7, var8).argb();
    }
}
 
Example #13
Source File: PlanarFaceBakery.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static BakedQuad bakeFace(Direction face, TextureAtlasSprite sprite, VertexFormat format, int colour) {
    return bakeFace(face, sprite, format, new ColourRGBA(colour));
}
 
Example #14
Source File: PlanarLightModel.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate(CCRenderState ccrs) {
    ccrs.colour = ColourRGBA.multiply(ccrs.colour, colours[ccrs.side]);
}
 
Example #15
Source File: CCRenderState.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ColourRGBA getColour() {
    return new ColourRGBA(colour);
}
 
Example #16
Source File: ColourMultiplier.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate(CCRenderState ccrs) {
    ccrs.colour = ColourRGBA.multiply(ccrs.colour, colour);
}
 
Example #17
Source File: LightingAttribute.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void operate(CCRenderState ccrs) {
    ccrs.colour = ColourRGBA.multiply(ccrs.colour, colourRef[ccrs.vertexIndex]);
}