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;
}
}
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;
}
}
}
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);
}
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);
}
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);
}
}
}
}
Aggregations