diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-30 21:03:45 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-07-30 21:03:45 -0400 |
commit | 2b1a23e20c08423dd6f0d290ec87bef2f836fbe1 (patch) | |
tree | 5746b37bdb1152d37b8943193242ab4c4ef0010b /src/kernel.cu | |
parent | 1a6dc30108d3e78f72f773ec025fc98e246f68f5 (diff) | |
download | chroma-2b1a23e20c08423dd6f0d290ec87bef2f836fbe1.tar.gz chroma-2b1a23e20c08423dd6f0d290ec87bef2f836fbe1.tar.bz2 chroma-2b1a23e20c08423dd6f0d290ec87bef2f836fbe1.zip |
you can rotate just the camera by holding the control key and take movies by pressing the m key.
Diffstat (limited to 'src/kernel.cu')
-rw-r--r-- | src/kernel.cu | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/kernel.cu b/src/kernel.cu index be0087d..82efe88 100644 --- a/src/kernel.cu +++ b/src/kernel.cu @@ -62,27 +62,39 @@ __device__ __noinline__ void to_diffuse(Photon &p, State &s, curandState &rng, c extern "C" { -/* Translate `points` by the vector `v` */ -__global__ void translate(int nthreads, float3 *points, float3 v) +/* Translate the points `a` by the vector `v` */ +__global__ void translate(int nthreads, float3 *a, float3 v) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; - points[id] += v; + a[id] += v; } -/* Rotate `points` through an angle `phi` counter-clockwise about the +/* Rotate the points `a` through an angle `phi` counter-clockwise about the axis `axis` (when looking towards +infinity). */ -__global__ void rotate(int nthreads, float3 *points, float phi, float3 axis) +__global__ void rotate(int nthreads, float3 *a, float phi, float3 axis) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; - points[id] = rotate(points[id], phi, axis); + a[id] = rotate(a[id], phi, axis); +} + +__global__ void rotate_around_point(int nthreads, float3 *a, float phi, float3 axis, float3 point) +{ + int id = blockIdx.x*blockDim.x + threadIdx.x; + + if (id >= nthreads) + return; + + a[id] -= point; + a[id] = rotate(a[id], phi, axis); + a[id] += point; } __global__ void update_xyz_lookup(int nthreads, int total_threads, int offset, float3 position, curandState *rng_states, float wavelength, float3 xyz, float3 *xyz_lookup1, float3 *xyz_lookup2, int max_steps) |