MCPcopy Create free account
hub / github.com/RenderKit/embree / Camera

Class Camera

tutorials/common/tutorial/camera.h:17–129  ·  view source on GitHub ↗

camera settings */

Source from the content-addressed store, hash-verified

15{
16 /* camera settings */
17 struct Camera
18 {
19 enum Handedness {
20 LEFT_HANDED,
21 RIGHT_HANDED
22 };
23
24 struct ISPCCamera
25 {
26 public:
27 ISPCCamera (const AffineSpace3f& xfm)
28 : xfm(xfm) {}
29
30 public:
31 AffineSpace3f xfm;
32 float render_time = 0.0f;
33 };
34
35 public:
36
37 Camera ()
38 : from(0.0001f,0.0001f,-3.0f), to(0,0,0), up(0,1,0), fov(90), handedness(RIGHT_HANDED) {}
39
40 Camera (const Vec3fa& from, const Vec3fa& to, const Vec3fa& up, float fov, Handedness handedness)
41 : from(from), to(to), up(up), fov(fov), handedness(handedness) {}
42
43 Camera (const SceneGraph::PerspectiveCameraData& cam, Handedness handedness)
44 : from(cam.from), to(cam.to), up(cam.up), fov(cam.fov), handedness(handedness) {}
45
46 std::string str() const
47 {
48 std::stringstream stream;
49 stream.precision(10);
50 stream << "--vp " << from.x << " " << from.y << " " << from.z << " "
51 << "--vi " << to.x << " " << to.y << " " << to.z << " "
52 << "--vu " << up.x << " " << up.y << " " << up.z << " "
53 << "--fov " << fov << " "
54 << (handedness == LEFT_HANDED ? "--lefthanded" : "--righthanded");
55 return stream.str();
56 }
57
58 AffineSpace3fa camera2world ()
59 {
60 AffineSpace3fa local2world = AffineSpace3fa::lookat(from, to, up);
61 if (!(local2world == local2world))
62 throw std::runtime_error("invalid camera specified");
63
64 if (handedness == RIGHT_HANDED)
65 local2world.l.vx = -local2world.l.vx;
66
67 return local2world;
68 }
69 AffineSpace3fa world2camera () { return rcp(camera2world()); }
70 Vec3fa world2camera(const Vec3fa& p) { return xfmPoint(world2camera(),p); }
71 Vec3fa camera2world(const Vec3fa& p) { return xfmPoint(camera2world(),p); }
72
73 ISPCCamera getISPCCamera (size_t width, size_t height)
74 {

Callers 2

displayFuncMethod · 0.85
mainMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected