More timing functions
This commit is contained in:
parent
6331a2bf79
commit
321c677da2
12 changed files with 184 additions and 129 deletions
23
camera.hpp
23
camera.hpp
|
|
@ -10,21 +10,21 @@ struct camera {
|
|||
vec3 horizontal;
|
||||
vec3 vertical;
|
||||
vec3 u,v,w;
|
||||
double lens_radius;
|
||||
float lens_radius;
|
||||
|
||||
/* Constructors */
|
||||
camera(point3 lookfrom,
|
||||
point3 lookat,
|
||||
vec3 vup,
|
||||
double vfov,
|
||||
double aspect_ratio,
|
||||
double aperture,
|
||||
double focus_dist)
|
||||
float vfov,
|
||||
float aspect_ratio,
|
||||
float aperture,
|
||||
float focus_dist)
|
||||
{
|
||||
double theta = degrees_to_radians(vfov);
|
||||
double h = tan(theta/2);
|
||||
double viewport_height = 2.0 * h;
|
||||
double viewport_width = aspect_ratio * viewport_height;
|
||||
float theta = degrees_to_radians(vfov);
|
||||
float h = tan(theta/2);
|
||||
float viewport_height = 2.0 * h;
|
||||
float viewport_width = aspect_ratio * viewport_height;
|
||||
|
||||
w = normalize(lookfrom - lookat);
|
||||
u = normalize(cross(vup,w));
|
||||
|
|
@ -40,9 +40,8 @@ struct camera {
|
|||
|
||||
/* Methods */
|
||||
|
||||
ray get_ray(double s, double t) const
|
||||
{
|
||||
rmt_ScopedCPUSample(GetRay, RMTSF_Aggregate);
|
||||
ray get_ray(float s, float t) const
|
||||
{
|
||||
vec3 rd = lens_radius * random_in_unit_disk();
|
||||
vec3 offset = u * rd.x + v * rd.y;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue