Search in sources :

Example 6 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class XTrbFunc method transform.

@Override
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount) {
    // xtrb by Xyrus02, http://xyrus02.deviantart.com/art/XTrb-Plugin-for-Apophysis-136800563
    double Alpha, Beta, OffsetAl, OffsetBe, OffsetGa, X, Y;
    int M, N;
    // transfer to trilinear coordinates, normalized to real distances from triangle sides
    {
        DirectTrilinearTO to = new DirectTrilinearTO();
        DirectTrilinear(pAffineTP.x, pAffineTP.y, to);
        Alpha = to.Al;
        Beta = to.Be;
    }
    M = (int) Math.floor(Alpha / S2a);
    OffsetAl = Alpha - M * S2a;
    N = (int) Math.floor(Beta / S2b);
    OffsetBe = Beta - N * S2b;
    OffsetGa = S2c - ac * OffsetAl - bc * OffsetBe;
    if (OffsetGa > 0) {
        HexTo to = new HexTo();
        Hex(pContext, OffsetAl, OffsetBe, OffsetGa, to);
        Alpha = to.Al1;
        Beta = to.Be1;
    } else {
        OffsetAl = S2a - OffsetAl;
        OffsetBe = S2b - OffsetBe;
        OffsetGa = -OffsetGa;
        {
            HexTo to = new HexTo();
            Hex(pContext, OffsetAl, OffsetBe, OffsetGa, to);
            Alpha = to.Al1;
            Beta = to.Be1;
        }
        Alpha = S2a - Alpha;
        Beta = S2b - Beta;
    }
    Alpha = Alpha + M * S2a;
    Beta = Beta + N * S2b;
    {
        InverseTrilinearTO to = new InverseTrilinearTO();
        InverseTrilinear(pContext, pAmount, Alpha, Beta, to);
        X = to.x;
        Y = to.y;
    }
    pVarTP.x += pAmount * X;
    pVarTP.y += pAmount * Y;
    if (pContext.isPreserveZCoordinate()) {
        pVarTP.z += pAmount * pAffineTP.z;
    }
}
Also used : XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 7 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class LightViewCalculator method project.

public void project(XYZPoint pPoint, XYZProjectedPoint pProjectedPoint) {
    for (int i = 0; i < lightProjectionMatrix.length; i++) {
        if (lightProjectionMatrix[i] != null) {
            pProjectedPoint.lightX[i] = applyLightProjectionX(i, pPoint.x, pPoint.y, pPoint.z);
            pProjectedPoint.lightY[i] = applyLightProjectionY(i, pPoint.x, pPoint.y, pPoint.z);
            pProjectedPoint.lightZ[i] = applyLightProjectionZ(i, pPoint.x, pPoint.y, pPoint.z);
            pProjectedPoint.hasLight[i] = true;
        } else {
            pProjectedPoint.hasLight[i] = false;
        }
    }
}
Also used : XYZProjectedPoint(org.jwildfire.create.tina.base.XYZProjectedPoint) XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Example 8 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class RectDOFBlurShape method prepare.

@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
    super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
    s = new XYZPoint();
    d = new XYZPoint();
    xform = new XForm();
    fnc = new SquareFunc();
    fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
    width = params.get(PARAM_WIDTH);
}
Also used : SquareFunc(org.jwildfire.create.tina.variation.SquareFunc) XForm(org.jwildfire.create.tina.base.XForm) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) Layer(org.jwildfire.create.tina.base.Layer)

Example 9 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class HeartDOFBlurShape method prepare.

@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
    super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
    s = new XYZPoint();
    d = new XYZPoint();
    xform = new XForm();
    fnc = new XHeartBlurWFFunc();
    for (String paramName : getParamNames()) {
        fnc.setParameter(paramName, params.get(paramName));
    }
    fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
Also used : XHeartBlurWFFunc(org.jwildfire.create.tina.variation.XHeartBlurWFFunc) XForm(org.jwildfire.create.tina.base.XForm) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) Layer(org.jwildfire.create.tina.base.Layer)

Example 10 with XYZPoint

use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.

the class PostBlurRenderIterationState method plotPoint.

@Override
protected void plotPoint(int screenX, int screenY, double rawX, double rawY, double intensity, XYZPoint origin) {
    if (p.rgbColor) {
        plotRed = p.redColor;
        plotGreen = p.greenColor;
        plotBlue = p.blueColor;
    } else {
        RenderColor color = colorProvider.getColor(p, q);
        plotRed = color.red;
        plotGreen = color.green;
        plotBlue = color.blue;
    }
    transformPlotColor(p);
    if (ctx.random() > blurFade) {
        for (int k = screenY - blurRadius, yk = 0; k <= screenY + blurRadius; k++, yk++) {
            if (k >= 0 && k < rasterHeight) {
                for (int l = screenX - blurRadius, xk = 0; l <= screenX + blurRadius; l++, xk++) {
                    if (l >= 0 && l < rasterWidth) {
                        // y, x
                        double scl = blurKernel[yk][xk];
                        double finalRed = plotRed * scl * prj.intensity;
                        double finalGreen = plotGreen * scl * prj.intensity;
                        double finalBlue = plotBlue * scl * prj.intensity;
                        plotBuffer[plotBufferIdx++].set(l, k, finalRed, finalGreen, finalBlue, rawX, rawY, prj.z * view.bws, p.material, prj.dofDist, origin.x, origin.y, origin.z, p.receiveOnlyShadows);
                        if (plotBufferIdx >= plotBuffer.length) {
                            applySamplesToRaster();
                        }
                        if (observers != null && observers.size() > 0) {
                            for (IterationObserver observer : observers) {
                                observer.notifyIterationFinished(renderThread, l, k, prj, q.x, q.y, q.z, finalRed, finalGreen, finalBlue);
                            }
                        }
                    }
                }
            }
        }
    } else {
        double finalRed = plotRed * prj.intensity;
        double finalGreen = plotGreen * prj.intensity;
        double finalBlue = plotBlue * prj.intensity;
        plotBuffer[plotBufferIdx++].set(screenX, screenY, finalRed, finalGreen, finalBlue, rawX, rawY, prj.z * view.bws, p.material, prj.dofDist, origin.x, origin.y, origin.z, p.receiveOnlyShadows);
        if (plotBufferIdx >= plotBuffer.length) {
            applySamplesToRaster();
        }
        if (observers != null && observers.size() > 0) {
            for (IterationObserver observer : observers) {
                observer.notifyIterationFinished(renderThread, screenX, screenY, prj, q.x, q.y, q.z, finalRed, finalGreen, finalBlue);
            }
        }
    }
}
Also used : RenderColor(org.jwildfire.create.tina.palette.RenderColor) XYZPoint(org.jwildfire.create.tina.base.XYZPoint)

Aggregations

XYZPoint (org.jwildfire.create.tina.base.XYZPoint)102 XForm (org.jwildfire.create.tina.base.XForm)16 Layer (org.jwildfire.create.tina.base.Layer)13 Test (org.junit.Test)4 VectorD (org.jwildfire.base.mathlib.VecMathLib.VectorD)4 Flame (org.jwildfire.create.tina.base.Flame)4 ZigguratRandomGenerator (org.jwildfire.create.tina.random.ZigguratRandomGenerator)4 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)4 SimpleHDRImage (org.jwildfire.image.SimpleHDRImage)4 SimpleImage (org.jwildfire.image.SimpleImage)4 Complex (org.jwildfire.base.mathlib.Complex)2 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)2 Face (org.jwildfire.create.tina.variation.mesh.Face)2 Vertex (org.jwildfire.create.tina.variation.mesh.Vertex)2 VertexWithUV (org.jwildfire.create.tina.variation.mesh.VertexWithUV)2 RenderColor (org.jwildfire.create.tina.palette.RenderColor)1 CannabisCurveWFFunc (org.jwildfire.create.tina.variation.CannabisCurveWFFunc)1 CloverLeafWFFunc (org.jwildfire.create.tina.variation.CloverLeafWFFunc)1 DCPerlinFunc (org.jwildfire.create.tina.variation.DCPerlinFunc)1 FlowerFunc (org.jwildfire.create.tina.variation.FlowerFunc)1