Search in sources :

Example 1 with BoundingBox

use of org.sunflow.math.BoundingBox in project joons-renderer by joonhyublee.

the class CausticPhotonMap method prepare.

@Override
public void prepare(Options options, BoundingBox sceneBounds) {
    // get options
    numEmit = options.getInt("caustics.emit", 10000);
    gatherNum = options.getInt("caustics.gather", 50);
    gatherRadius = options.getFloat("caustics.radius", 0.5f);
    filterValue = options.getFloat("caustics.filter", 1.1f);
    // init
    bounds = new BoundingBox();
    maxPower = 0;
    maxRadius = 0;
    photonList = new ArrayList<Photon>();
    photonList.add(null);
    photons = null;
    storedPhotons = halfStoredPhotons = 0;
}
Also used : BoundingBox(org.sunflow.math.BoundingBox)

Example 2 with BoundingBox

use of org.sunflow.math.BoundingBox in project joons-renderer by joonhyublee.

the class Box method update.

@Override
public boolean update(ParameterList pl, SunflowAPI api) {
    FloatParameter pts = pl.getPointArray("points");
    if (pts != null) {
        BoundingBox bounds = new BoundingBox();
        for (int i = 0; i < pts.data.length; i += 3) {
            bounds.include(pts.data[i], pts.data[i + 1], pts.data[i + 2]);
        }
        // cube extents
        minX = bounds.getMinimum().x;
        minY = bounds.getMinimum().y;
        minZ = bounds.getMinimum().z;
        maxX = bounds.getMaximum().x;
        maxY = bounds.getMaximum().y;
        maxZ = bounds.getMaximum().z;
    }
    return true;
}
Also used : BoundingBox(org.sunflow.math.BoundingBox) FloatParameter(org.sunflow.core.ParameterList.FloatParameter)

Example 3 with BoundingBox

use of org.sunflow.math.BoundingBox in project joons-renderer by joonhyublee.

the class Hair method getWorldBounds.

@Override
public BoundingBox getWorldBounds(Matrix4 o2w) {
    BoundingBox bounds = new BoundingBox();
    for (int i = 0, j = 0; i < points.length; i += 3, j++) {
        float w = 0.5f * getWidth(j);
        bounds.include(points[i] - w, points[i + 1] - w, points[i + 2] - w);
        bounds.include(points[i] + w, points[i + 1] + w, points[i + 2] + w);
    }
    if (o2w != null) {
        bounds = o2w.transform(bounds);
    }
    return bounds;
}
Also used : BoundingBox(org.sunflow.math.BoundingBox)

Example 4 with BoundingBox

use of org.sunflow.math.BoundingBox in project joons-renderer by joonhyublee.

the class ParticleSurface method getWorldBounds.

@Override
public BoundingBox getWorldBounds(Matrix4 o2w) {
    BoundingBox bounds = new BoundingBox();
    for (int i = 0, i3 = 0; i < n; i++, i3 += 3) {
        bounds.include(particles[i3], particles[i3 + 1], particles[i3 + 2]);
    }
    bounds.include(bounds.getMinimum().x - r, bounds.getMinimum().y - r, bounds.getMinimum().z - r);
    bounds.include(bounds.getMaximum().x + r, bounds.getMaximum().y + r, bounds.getMaximum().z + r);
    return o2w == null ? bounds : o2w.transform(bounds);
}
Also used : BoundingBox(org.sunflow.math.BoundingBox)

Example 5 with BoundingBox

use of org.sunflow.math.BoundingBox in project joons-renderer by joonhyublee.

the class QuadMesh method getWorldBounds.

@Override
public BoundingBox getWorldBounds(Matrix4 o2w) {
    BoundingBox bounds = new BoundingBox();
    if (o2w == null) {
        for (int i = 0; i < points.length; i += 3) {
            bounds.include(points[i], points[i + 1], points[i + 2]);
        }
    } else {
        // transform vertices first
        for (int i = 0; i < points.length; i += 3) {
            float x = points[i];
            float y = points[i + 1];
            float z = points[i + 2];
            float wx = o2w.transformPX(x, y, z);
            float wy = o2w.transformPY(x, y, z);
            float wz = o2w.transformPZ(x, y, z);
            bounds.include(wx, wy, wz);
        }
    }
    return bounds;
}
Also used : BoundingBox(org.sunflow.math.BoundingBox)

Aggregations

BoundingBox (org.sunflow.math.BoundingBox)14 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 FloatParameter (org.sunflow.core.ParameterList.FloatParameter)1 Color (org.sunflow.image.Color)1 Point3 (org.sunflow.math.Point3)1 Vector3 (org.sunflow.math.Vector3)1 Timer (org.sunflow.system.Timer)1 IntArray (org.sunflow.util.IntArray)1