-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathrender_plastic.cu
59 lines (49 loc) · 2.4 KB
/
render_plastic.cu
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This file is distributed under the MIT license.
// See the LICENSE file for details.
#include <visionaray/kernels.h> // make_kernel_params()
#include "render.h"
namespace visionaray
{
void render_plastic_cu(
cuda_index_bvh<basic_triangle<3, float>>& bvh,
thrust::device_vector<vec3> const& geometric_normals,
thrust::device_vector<vec3> const& shading_normals,
thrust::device_vector<vec2> const& tex_coords,
thrust::device_vector<plastic_t> const& materials,
thrust::device_vector<cuda_texture_t> const& textures,
aligned_vector<point_light<float>> const& host_lights,
unsigned bounces,
float epsilon,
vec4 bgcolor,
vec4 ambient,
host_device_rt& rt,
cuda_sched<ray_type_gpu>& sched,
camera_t const& cam,
unsigned& frame_num,
algorithm algo,
unsigned ssaa_samples
)
{
using bvh_ref = cuda_index_bvh<basic_triangle<3, float>>::bvh_ref;
thrust::device_vector<bvh_ref> primitives;
primitives.push_back(bvh.ref());
thrust::device_vector<point_light<float>> device_lights = host_lights;
auto kparams = make_kernel_params(
normals_per_vertex_binding{},
thrust::raw_pointer_cast(primitives.data()),
thrust::raw_pointer_cast(primitives.data()) + primitives.size(),
thrust::raw_pointer_cast(geometric_normals.data()),
thrust::raw_pointer_cast(shading_normals.data()),
thrust::raw_pointer_cast(tex_coords.data()),
thrust::raw_pointer_cast(materials.data()),
thrust::raw_pointer_cast(textures.data()),
thrust::raw_pointer_cast(device_lights.data()),
thrust::raw_pointer_cast(device_lights.data()) + device_lights.size(),
bounces,
epsilon,
bgcolor,
ambient
);
call_kernel( algo, sched, kparams, frame_num, ssaa_samples, cam, rt );
}
} // visionaray