15VTK_ABI_NAMESPACE_BEGIN
23 VisRTX::Context* rtx = VisRTX_GetContext();
25 if (type ==
"perspective")
26 this->camera = rtx->CreatePerspectiveCamera();
27 else if (type ==
"orthographic")
28 this->camera = rtx->CreateOrthographicCamera();
35 this->camera->Release();
41 if (this->
GetVec3f({
"position" }, &pos))
43 this->camera->SetPosition(pos);
47 if (this->
GetVec3f({
"direction" }, &dir))
49 this->camera->SetDirection(dir);
55 this->camera->SetUp(up);
58 VisRTX::Vec2f imageBegin, imageEnd;
59 if (this->
GetVec2f({
"imageStart" }, &imageBegin) && this->
GetVec2f({
"imageEnd" }, &imageEnd))
61 this->camera->SetImageRegion(imageBegin, imageEnd);
64 if (this->camera->GetType() == VisRTX::CameraType::PERSPECTIVE)
66 VisRTX::PerspectiveCamera* pc =
dynamic_cast<VisRTX::PerspectiveCamera*
>(this->camera);
69 if (this->
GetFloat({
"fovy" }, &fovy))
75 if (this->
GetFloat({
"aspect" }, &aspect))
77 pc->SetAspect(aspect);
81 if (this->
GetFloat({
"focusDistance" }, &focalDistance))
83 pc->SetFocalDistance(focalDistance);
87 if (this->
GetFloat({
"apertureRadius" }, &apertureRadius))
89 pc->SetApertureRadius(apertureRadius);
93 else if (this->camera->GetType() == VisRTX::CameraType::ORTHOGRAPHIC)
95 VisRTX::OrthographicCamera* oc =
dynamic_cast<VisRTX::OrthographicCamera*
>(this->camera);
98 if (this->
GetFloat({
"height" }, &height))
100 oc->SetHeight(height);
104 if (this->
GetFloat({
"aspect" }, &aspect))
106 oc->SetAspect(aspect);
117 VisRTX::Camera* camera =
nullptr;
Camera(const std::string &type)
VisRTX::Vec2f GetVec2f(const std::vector< std::string > &ids, const VisRTX::Vec2f &defaultValue=VisRTX::Vec2f(), bool *found=nullptr) const
float GetFloat(const std::vector< std::string > &ids, float defaultValue=0.0f, bool *found=nullptr) const
VisRTX::Vec3f GetVec3f(const std::vector< std::string > &ids, const VisRTX::Vec3f &defaultValue=VisRTX::Vec3f(), bool *found=nullptr) const