Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package/cpp/core/RNFCameraWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ManipulatorWrapper> cameraManipulator) {
Expand Down Expand Up @@ -37,3 +38,7 @@ void margelo::CameraWrapper::setProjection(double fovInDegrees, double aspect, d
pointee()->setProjection(static_cast<float>(fovInDegrees), static_cast<float>(aspect), static_cast<float>(near), static_cast<float>(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);
}
1 change: 1 addition & 0 deletions package/cpp/core/RNFCameraWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CameraWrapper : public PointerHolder<Camera> {
void lookAt(std::vector<double> eye, std::vector<double> center, std::vector<double> 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<ManipulatorWrapper> cameraManipulator);
};
Expand Down
12 changes: 12 additions & 0 deletions package/src/types/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading