summaryrefslogtreecommitdiff
path: root/src/materials.h
blob: 05aa1217ff82c9994bbbc5f78795dfcf511ae34d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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"