add_shape: Add Shape

View source: R/add_shape.R

add_shapeR Documentation

Add Shape

Description

Add shape to the scene.

Usage

add_shape(scene, shape = NULL)

Arguments

scene

The scene to add the shape.

shape

The mesh to add to the scene.

Value

Scene with shape added.

Examples

if(rayvertex:::run_documentation()) {
#Generate several spheres in the cornell box
scene = generate_cornell_mesh()
set.seed(1)

for(i in 1:30) {
 col = hsv(runif(1))
 scene = add_shape(scene, sphere_mesh(position=runif(3)*400+155/2,
                                      material=material_list(diffuse=col, type="phong",
                                                             ambient=col,ambient_intensity=0.2), 
                                      radius=30))
}
rasterize_scene(scene, light_info=directional_light(direction=c(0.1,0.6,-1)))
}

rayvertex documentation built on July 9, 2023, 5:52 p.m.