diff --git a/package/cpp/core/RNFCameraWrapper.cpp b/package/cpp/core/RNFCameraWrapper.cpp index 4706a445..789f61d5 100644 --- a/package/cpp/core/RNFCameraWrapper.cpp +++ b/package/cpp/core/RNFCameraWrapper.cpp @@ -6,6 +6,7 @@ void margelo::CameraWrapper::loadHybridMethods() { registerHybridMethod("lookAt", &CameraWrapper::lookAt, this); registerHybridMethod("setLensProjection", &CameraWrapper::setLensProjection, this); registerHybridMethod("setProjection", &CameraWrapper::setProjection, this); + registerHybridMethod("setOrthographicProjection", &CameraWrapper::setOrthographicProjection, this); } void margelo::CameraWrapper::lookAtCameraManipulator(std::shared_ptr cameraManipulator) { @@ -37,3 +38,7 @@ void margelo::CameraWrapper::setProjection(double fovInDegrees, double aspect, d pointee()->setProjection(static_cast(fovInDegrees), static_cast(aspect), static_cast(near), static_cast(far), direction); } + +void margelo::CameraWrapper::setOrthographicProjection(double left, double right, double bottom, double top, double near, double far) { + pointee()->setProjection(Camera::Projection::ORTHO, left, right, bottom, top, near, far); +} diff --git a/package/cpp/core/RNFCameraWrapper.h b/package/cpp/core/RNFCameraWrapper.h index 51258502..fd021a77 100644 --- a/package/cpp/core/RNFCameraWrapper.h +++ b/package/cpp/core/RNFCameraWrapper.h @@ -18,6 +18,7 @@ class CameraWrapper : public PointerHolder { void lookAt(std::vector eye, std::vector center, std::vector up); void setLensProjection(double fov, double aspect, double near, double far); void setProjection(double fovInDegrees, double aspect, double near, double far, std::string directionStr); + void setOrthographicProjection(double left, double right, double bottom, double top, double near, double far); // Convenience methods void lookAtCameraManipulator(std::shared_ptr cameraManipulator); }; diff --git a/package/src/types/Camera.ts b/package/src/types/Camera.ts index 088a772a..5b047275 100644 --- a/package/src/types/Camera.ts +++ b/package/src/types/Camera.ts @@ -98,4 +98,16 @@ export interface RNFCamera extends PointerHolder { * @see Fov. */ setProjection(fov: number, aspect: number, near: number, far: number): void + + /** + * Sets an orthographic projection matrix from six clip planes. + * + * @param left distance in world units from the camera to the left plane. + * @param right distance in world units from the camera to the right plane. + * @param bottom distance in world units from the camera to the bottom plane. + * @param top distance in world units from the camera to the top plane. + * @param near distance in world units from the camera to the near plane. near != far. + * @param far distance in world units from the camera to the far plane. far != near. + */ + setOrthographicProjection(left: number, right: number, bottom: number, top: number, near: number, far: number): void }