MCPcopy Create free account
hub / github.com/RenderKit/ospray / commit

Method commit

modules/cpu/camera/PerspectiveCamera.cpp:26–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void PerspectiveCamera::commit()
27{
28 Camera::commit();
29
30 fovy = getParam<float>("fovy", 60.f);
31 aspect = getParam<float>("aspect", 1.f);
32 apertureRadius = getParam<float>("apertureRadius", 0.f);
33 focusDistance = getParam<float>("focusDistance", 1.f);
34 architectural = getParam<bool>("architectural", false);
35 stereoMode = (OSPStereoMode)getParam<uint32_t>("stereoMode", OSP_STEREO_NONE);
36 // the default 63.5mm represents the average human IPD
37 interpupillaryDistance = getParam<float>("interpupillaryDistance", 0.0635f);
38
39 switch (stereoMode) {
40 case OSP_STEREO_SIDE_BY_SIDE:
41 aspect *= 0.5f;
42 break;
43 case OSP_STEREO_TOP_BOTTOM:
44 aspect *= 2.f;
45 break;
46 default:
47 break;
48 }
49
50 vec2f imgPlaneSize;
51 imgPlaneSize.y = 2.f * tanf(deg2rad(0.5f * fovy));
52 imgPlaneSize.x = imgPlaneSize.y * aspect;
53
54 // Set shared structure members
55 {
56 getSh()->scaledAperture = apertureRadius
57 ? apertureRadius / (imgPlaneSize.x * focusDistance)
58 : 0.0f;
59 getSh()->super.needLensSample = getSh()->scaledAperture;
60 getSh()->aspect = aspect;
61 getSh()->stereoMode = stereoMode;
62 getSh()->dir_00 = normalize(dir);
63 getSh()->org = pos;
64 getSh()->imgPlaneSize = imgPlaneSize;
65
66 if (getSh()->super.motionBlur) {
67#ifndef OSPRAY_TARGET_SYCL
68 getSh()->super.initRay = reinterpret_cast<ispc::Camera_initRay>(
69 ispc::PerspectiveCamera_initRayMB_addr());
70#endif
71 getSh()->du_size = vec3f(imgPlaneSize.x, imgPlaneSize.y, architectural);
72 getSh()->dv_up = up;
73 getSh()->ipd_offset =
74 vec3f(0.5f * interpupillaryDistance, focusDistance, 0.0f);
75 } else {
76#ifndef OSPRAY_TARGET_SYCL
77 getSh()->super.initRay = reinterpret_cast<ispc::Camera_initRay>(
78 ispc::PerspectiveCamera_initRay_addr());
79#endif
80 getSh()->du_size = normalize(cross(getSh()->dir_00, up));
81 if (architectural) // orient film to be parallel to 'up'
82 getSh()->dv_up = normalize(up);
83 else // rotate film to be perpendicular to 'dir'

Callers

nothing calls this directly

Calls 1

commitFunction · 0.50

Tested by

no test coverage detected