20 VisRTX::Context* rtx = VisRTX_GetContext();
22 if (
type ==
"perspective")
23 this->camera = rtx->CreatePerspectiveCamera();
24 else if (
type ==
"orthographic")
25 this->camera = rtx->CreateOrthographicCamera();
32 this->camera->Release();
38 if (this->
Get3f({
"pos" }, &pos))
39 this->camera->SetPosition(pos);
43 this->camera->SetDirection(
dir);
46 if (this->
Get3f({
"up" }, &up))
47 this->camera->SetUp(up);
49 VisRTX::Vec2f imageBegin, imageEnd;
50 if (this->
Get2f({
"imageStart" }, &imageBegin) && this->
Get2f({
"imageEnd" }, &imageEnd))
51 this->camera->SetImageRegion(imageBegin, imageEnd);
53 if (this->camera->GetType() == VisRTX::CameraType::PERSPECTIVE)
55 VisRTX::PerspectiveCamera* pc =
dynamic_cast<VisRTX::PerspectiveCamera*
>(this->camera);
58 if (this->
Get1f({
"fovy" }, &fovy))
62 if (this->
Get1f({
"aspect" }, &aspect))
63 pc->SetAspect(aspect);
66 if (this->
Get1f({
"focusDistance" }, &focalDistance))
67 pc->SetFocalDistance(focalDistance);
70 if (this->
Get1f({
"apertureRadius" }, &apertureRadius))
71 pc->SetApertureRadius(apertureRadius);
74 else if (this->camera->GetType() == VisRTX::CameraType::ORTHOGRAPHIC)
76 VisRTX::OrthographicCamera* oc =
dynamic_cast<VisRTX::OrthographicCamera*
>(this->camera);
83 if (this->
Get1f({
"aspect" }, &aspect))
84 oc->SetAspect(aspect);
94 VisRTX::Camera* camera =
nullptr;
Camera(const std::string &type)
VisRTX::Vec3f Get3f(const std::vector< std::string > &ids, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f(), bool *found=nullptr) const
VisRTX::Vec2f Get2f(const std::vector< std::string > &ids, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f(), bool *found=nullptr) const
float Get1f(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const