Sha256: 6633ef401e74312b46c7010af25177fb34b72f3b665b8aa4cc32d645ecb81ec4
Contents?: true
Size: 816 Bytes
Versions: 6
Compression:
Stored size: 816 Bytes
Contents
package org.sunflow.core.camera; import org.sunflow.SunflowAPI; import org.sunflow.core.CameraLens; import org.sunflow.core.ParameterList; import org.sunflow.core.Ray; public class SphericalLens implements CameraLens { @Override public boolean update(ParameterList pl, SunflowAPI api) { return true; } @Override public Ray getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, double time) { // Generate environment camera ray direction double theta = 2 * Math.PI * x / imageWidth + Math.PI / 2; double phi = Math.PI * (imageHeight - 1 - y) / imageHeight; return new Ray(0, 0, 0, (float) (Math.cos(theta) * Math.sin(phi)), (float) (Math.cos(phi)), (float) (Math.sin(theta) * Math.sin(phi))); } }
Version data entries
6 entries across 6 versions & 1 rubygems