diff options
author | Anthony LaTorre <telatorre@gmail.com> | 2011-06-03 20:09:15 -0400 |
---|---|---|
committer | Anthony LaTorre <telatorre@gmail.com> | 2011-06-03 20:09:15 -0400 |
commit | bd4250bce0b0df736f41dbfca4b5a902d7cdaf37 (patch) | |
tree | 10e119553c0ea47d67ba0557f16c7d1dda25ccf5 /src/materials.h | |
parent | 4118c62895ac2f011146b4233dad86ff8dc179e3 (diff) | |
download | chroma-bd4250bce0b0df736f41dbfca4b5a902d7cdaf37.tar.gz chroma-bd4250bce0b0df736f41dbfca4b5a902d7cdaf37.tar.bz2 chroma-bd4250bce0b0df736f41dbfca4b5a902d7cdaf37.zip |
load material/surface index lookup arrays to the gpu and bind them to textures. also, forgot to include the gpu code for material/surface structures
Diffstat (limited to 'src/materials.h')
-rw-r--r-- | src/materials.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/materials.h b/src/materials.h new file mode 100644 index 0000000..05aa121 --- /dev/null +++ b/src/materials.h @@ -0,0 +1,35 @@ +struct Material +{ + float *refractive_index; + float *absorption_length; + float *scattering_length; +}; + +struct Surface +{ + float *absorption; + float *reflection_diffuse; + float *reflection_specular; +}; + +__device__ struct Material materials[100]; +__device__ struct Surface surfaces[100]; + +extern "C" +{ + +__global__ void set_material(int material_index, float *refractive_index, float *absorption_length, float *scattering_length) +{ + materials[material_index].refractive_index = refractive_index; + materials[material_index].absorption_length = absorption_length; + materials[material_index].scattering_length = scattering_length; +} + +__global__ void set_surface(int surface_index, float *absorption, float *reflection_diffuse, float *reflection_specular) +{ + surfaces[surface_index].absorption = absorption; + surfaces[surface_index].reflection_diffuse = reflection_diffuse; + surfaces[surface_index].reflection_specular = reflection_specular; +} + +} // extern "c" |