1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "PanoramicCamera.h"
// ispc exports
#ifndef OSPRAY_TARGET_SYCL
#include "camera/PanoramicCamera_ispc.h"
#else
namespace ispc {
void *PanoramicCamera_initRay_addr();
}
#endif
namespace ospray {
PanoramicCamera::PanoramicCamera(api::ISPCDevice &device)
: AddStructShared(device.getDRTDevice(), device, FFO_CAMERA_PANORAMIC)
{
#ifndef OSPRAY_TARGET_SYCL
getSh()->super.initRay = reinterpret_cast<ispc::Camera_initRay>(
ispc::PanoramicCamera_initRay_addr());
#endif
}
std::string PanoramicCamera::toString() const
{
return "ospray::PanoramicCamera";
}
void PanoramicCamera::commit()
{
Camera::commit();
getSh()->org = pos;
if (getSh()->super.motionBlur) {
getSh()->frame.vz = -dir;
getSh()->frame.vy = up;
} else {
getSh()->frame.vz = -normalize(dir);
getSh()->frame.vx = normalize(cross(up, getSh()->frame.vz));
getSh()->frame.vy = cross(getSh()->frame.vz, getSh()->frame.vx);
}
getSh()->stereoMode =
(OSPStereoMode)getParam<uint32_t>("stereoMode", OSP_STEREO_NONE);
getSh()->ipd_offset =
0.5f * getParam<float>("interpupillaryDistance", 0.0635f);
// flip offset to have left eye at top (image coord origin at lower left)
if (getSh()->stereoMode == OSP_STEREO_TOP_BOTTOM)
getSh()->ipd_offset = -getSh()->ipd_offset;
}
} // namespace ospray
|