10
10
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
11
11
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the sphere, used for motion blur.
12
12
# ' @param flipped Default `FALSE`. Whether to flip the normals.
13
- # ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
13
+ # ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
14
+ # ' Note: emissive objects may not currently function correctly when scaled.
14
15
# ' @importFrom grDevices col2rgb
15
16
# '
16
17
# ' @return Single row of a tibble describing the sphere in the scene.
@@ -74,6 +75,7 @@ sphere = function(x = 0, y = 0, z = 0, radius = 1, material = lambertian(),
74
75
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the cube, used for motion blur.
75
76
# ' @param flipped Default `FALSE`. Whether to flip the normals.
76
77
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
78
+ # ' Note: emissive objects may not currently function correctly when scaled.
77
79
# ' @importFrom grDevices col2rgb
78
80
# '
79
81
# ' @return Single row of a tibble describing the cube in the scene.
@@ -130,6 +132,7 @@ cube = function(x = 0, y = 0, z = 0, width = 1, xwidth = 1, ywidth = 1, zwidth =
130
132
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
131
133
# ' @param flipped Default `FALSE`. Whether to flip the normals.
132
134
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
135
+ # ' Note: emissive objects may not currently function correctly when scaled.
133
136
# '
134
137
# ' @return Single row of a tibble describing the XY plane in the scene.
135
138
# ' @export
@@ -183,6 +186,7 @@ xy_rect = function(x = 0, y = 0, z = 0, xwidth = 1, ywidth = 1,
183
186
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
184
187
# ' @param flipped Default `FALSE`. Whether to flip the normals.
185
188
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
189
+ # ' Note: emissive objects may not currently function correctly when scaled.
186
190
# '
187
191
# ' @return Single row of a tibble describing the YZ plane in the scene.
188
192
# ' @export
@@ -235,6 +239,7 @@ yz_rect = function(x = 0, y = 0, z = 0, ywidth = 1, zwidth = 1, material = lambe
235
239
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
236
240
# ' @param flipped Default `FALSE`. Whether to flip the normals.
237
241
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
242
+ # ' Note: emissive objects may not currently function correctly when scaled.
238
243
# '
239
244
# ' @return Single row of a tibble describing the XZ plane in the scene.
240
245
# ' @export
@@ -296,6 +301,7 @@ xz_rect = function(x = 0, xwidth = 1, z = 0, zwidth = 1, y = 0, material = lambe
296
301
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
297
302
# ' @param flipped Default `FALSE`. Whether to flip the normals.
298
303
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
304
+ # ' Note: emissive objects may not currently function correctly when scaled.
299
305
# '
300
306
# ' @return Single row of a tibble describing the XZ plane in the scene.
301
307
# ' @export
@@ -371,6 +377,7 @@ triangle = function(v1 = c(1, 0, 0), v2 = c(0, 1, 0), v3 = c(-1, 0, 0),
371
377
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the disk.
372
378
# ' @param flipped Default `FALSE`. Whether to flip the normals.
373
379
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
380
+ # ' Note: emissive objects may not currently function correctly when scaled.
374
381
# '
375
382
# ' @importFrom grDevices col2rgb
376
383
# '
@@ -421,19 +428,23 @@ disk = function(x = 0, y = 0, z = 0, radius = 1, inner_radius = 0, material = la
421
428
}
422
429
423
430
# ' `obj` File Object
431
+ # '
432
+ # ' Load an obj file via a filepath. Currently only supports the diffuse texture with the `texture` argument.
433
+ # ' Note: light importance sampling currently not supported for this shape.
424
434
# '
425
435
# ' @param filename Filename and path to the `obj` file. Can also be a `txt` file, if it's in the correct `obj` internally.
426
436
# ' @param x Default `0`. x-coordinate to offset the model.
427
437
# ' @param y Default `0`. y-coordinate to offset the model.
428
438
# ' @param z Default `0`. z-coordinate to offset the model.
429
439
# ' @param scale_obj Default `1`. Amount to scale the model.
430
- # ' @param objcolor Default `FALSE`. Whether to load an obj file with vertex colors .
440
+ # ' @param texture Default `FALSE`. Whether to load the obj file texture .
431
441
# ' @param material Default \code{\link{lambertian}}.The material, called from one of the material
432
442
# ' functions \code{\link{lambertian}}, \code{\link{metal}}, or \code{\link{dielectric}}.
433
443
# ' @param angle Default `c(0, 0, 0)`. Angle of rotation around the x, y, and z axes, applied in the order specified in `order_rotation`.
434
444
# ' @param order_rotation Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".
435
445
# ' @param flipped Default `FALSE`. Whether to flip the normals.
436
446
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
447
+ # ' Note: emissive objects may not currently function correctly when scaled.
437
448
# '
438
449
# ' @return Single row of a tibble describing the obj model in the scene.
439
450
# ' @export
@@ -457,12 +468,12 @@ disk = function(x = 0, y = 0, z = 0, radius = 1, inner_radius = 0, material = la
457
468
# ' render_scene(parallel = TRUE, samples = 400,
458
469
# ' tonemap = "reinhold", aperture = 0.05, fov = 32, lookfrom = c(0, 2, 10))
459
470
# ' }
460
- obj_model = function (filename , x = 0 , y = 0 , z = 0 , scale_obj = 1 , objcolor = FALSE ,
471
+ obj_model = function (filename , x = 0 , y = 0 , z = 0 , scale_obj = 1 , texture = FALSE ,
461
472
material = lambertian(),
462
473
angle = c(0 , 0 , 0 ), order_rotation = c(1 , 2 , 3 ),
463
474
flipped = FALSE , scale = c(1 ,1 ,1 )) {
464
475
info = c(unlist(material $ properties ), scale_obj )
465
- if (objcolor ) {
476
+ if (texture ) {
466
477
shape = " objcolor"
467
478
} else {
468
479
shape = " obj"
@@ -497,6 +508,7 @@ obj_model = function(filename, x = 0, y = 0, z = 0, scale_obj = 1, objcolor = FA
497
508
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the cylinder, used for motion blur.
498
509
# ' @param flipped Default `FALSE`. Whether to flip the normals.
499
510
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
511
+ # ' Note: emissive objects may not currently function correctly when scaled.
500
512
# '
501
513
# ' @importFrom grDevices col2rgb
502
514
# '
@@ -558,8 +570,8 @@ cylinder = function(x = 0, y = 0, z = 0, radius = 1, length = 1,
558
570
# ' functions \code{\link{lambertian}}, \code{\link{metal}}, or \code{\link{dielectric}}.
559
571
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the segment, used for motion blur.
560
572
# ' @param flipped Default `FALSE`. Whether to flip the normals.
561
- # ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions. Note : this will
562
- # ' change the stated start/end position of the segment.
573
+ # ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions. Notes : this will
574
+ # ' change the stated start/end position of the segment. Emissive objects may not currently function correctly when scaled.
563
575
# '
564
576
# ' @importFrom grDevices col2rgb
565
577
# '
@@ -628,6 +640,9 @@ segment = function(start = c(0, -1, 0), end = c(0, 1, 0), radius = 1,
628
640
629
641
# ' Ellipsoid Object
630
642
# '
643
+ # ' Note: light importance sampling for this shape is currently approximated by a sphere. This will fail
644
+ # ' for ellipsoids with large differences between axes.
645
+ # '
631
646
# ' @param x Default `0`. x-coordinate of the center of the ellipsoid.
632
647
# ' @param y Default `0`. y-coordinate of the center of the ellipsoid.
633
648
# ' @param z Default `0`. z-coordinate of the center of the ellipsoid.
@@ -641,6 +656,7 @@ segment = function(start = c(0, -1, 0), end = c(0, 1, 0), radius = 1,
641
656
# ' @param velocity Default `c(0, 0, 0)`. Velocity of the segment, used for motion blur.
642
657
# ' @param flipped Default `FALSE`. Whether to flip the normals.
643
658
# ' @param scale Default `c(1,1,1)`. Scale transformation in the x, y, and z directions.
659
+ # ' Note: emissive objects may not currently function correctly when scaled.
644
660
# '
645
661
# ' @importFrom grDevices col2rgb
646
662
# '
0 commit comments