diff options
Diffstat (limited to 'src/materials.h')
-rw-r--r-- | src/materials.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/materials.h b/src/materials.h index 47b7d22..77c9f43 100644 --- a/src/materials.h +++ b/src/materials.h @@ -6,15 +6,6 @@ __device__ float max_wavelength; __device__ float wavelength_step; __device__ unsigned int wavelength_size; -enum -{ - INIT = -1, - MAX_DEPTH_REACHED, - NO_HIT, - BULK_ABSORB, - SURFACE_ABSORB -}; - struct Material { float *refractive_index; @@ -40,10 +31,9 @@ __device__ float interp_property(const float &x, const float *fp) if (x > max_wavelength) return fp[wavelength_size-1]; - unsigned int jl = (x-min_wavelength)/wavelength_step; - float xl = min_wavelength + jl*wavelength_step; + int jl = (x-min_wavelength)/wavelength_step; - return xl + (x-xl)*(fp[jl+1]-fp[jl])/wavelength_step; + return fp[jl] + (x-(min_wavelength + jl*wavelength_step))*(fp[jl+1]-fp[jl])/wavelength_step; } extern "C" |