/** Sets this camera in the API */ public void set() { if (fieldOfView != null) { sunflow.parameter(FIELD_OF_VIEW, fieldOfView); } if (aspectRatio != null) { sunflow.parameter(ASPECT_RATIO, aspectRatio); } if (focalDistance != null) { sunflow.parameter(FOCUS_DISTANCE, focalDistance); } if (lensRadius != null) { sunflow.parameter(LENS_RADIUS, lensRadius); } // Perform positioning System.out.println("INCAMERAAAAAA " + sunflow); System.out.println("INCAMERAAAAAA " + TRANSFORM); System.out.println("INCAMERAAAAAA " + eye); System.out.println("INCAMERAAAAAA " + target); System.out.println("INCAMERAAAAAA " + up); sunflow.parameter(TRANSFORM, Matrix4.lookAt(eye, target, up)); // Set as camera sunflow.camera(name, type); sunflow.parameter("camera", name); sunflow.options(SunflowAPI.DEFAULT_OPTIONS); }
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 { 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; }
public BoundingBox getWorldBounds(Matrix4 o2w) { BoundingBox bounds = new BoundingBox(-ro - ri, -ro - ri, -ri); bounds.include(ro + ri, ro + ri, ri); if (o2w != null) bounds = o2w.transform(bounds); return bounds; }