|
| MRVIEWER_API | Viewport () |
| |
| MRVIEWER_API | ~Viewport () |
| |
| Viewport | clone () const |
| |
| | Viewport (Viewport &&) noexcept=default |
| |
| Viewport & | operator= (Viewport &&) noexcept=default |
| |
| MRVIEWER_API void | init () |
| | Initialization.
|
| |
| MRVIEWER_API void | setAxesPos (const int pixelXoffset=-100, const int pixelYoffset=-100) |
| |
| MRVIEWER_API void | setAxesSize (const int axisPixSize=80) |
| |
| MRVIEWER_API const Vector2f & | getAxesPosition () const |
| | returns position of basis axes in viewport space
|
| |
| MRVIEWER_API float | getAxesSize () const |
| |
| const Matrix4f & | getAxesProjectionMatrix () const |
| | returns projection matrix that is used for basis axes and view controller rendering
|
| |
| MRVIEWER_API void | shut () |
| | Shutdown.
|
| |
| MRVIEWER_API void | clearFramebuffers () |
| | ----------------— Drawing functions
|
| |
| MRVIEWER_API void | recursiveDraw (const Object &obj, DepthFunction depthFunc=DepthFunction::Default, const AffineXf3f &rootXf={}, RenderModelPassMask renderType=RenderModelPassMask::All, const TransparencyMode &transparentMode={}, int *numDraws=nullptr) const |
| | Immediate draw of given object tree.
|
| |
| MRVIEWER_API bool | draw (const VisualObject &obj, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| |
| MRVIEWER_API bool | draw (const VisualObject &obj, const AffineXf3f &xf, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| |
| MRVIEWER_API bool | draw (const VisualObject &obj, const AffineXf3f &xf, const Matrix4f &projM, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| |
| MRVIEWER_API bool | drawOrthoFixedPos (const VisualObject &obj, const AffineXf3f &xf, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| |
| MRVIEWER_API void | drawLines (const std::vector< LineSegm3f > &lines, const std::vector< SegmEndColors > &colors, const LinePointImmediateRenderParams ¶ms) |
| | Draw lines immediately.
|
| |
| void | drawLines (const std::vector< LineSegm3f > &lines, const std::vector< SegmEndColors > &colors, float width=1, bool depthTest=true) |
| |
| MRVIEWER_API void | drawPoints (const std::vector< Vector3f > &points, const std::vector< Vector4f > &colors, const LinePointImmediateRenderParams ¶ms) |
| | Draw points immediately.
|
| |
| void | drawPoints (const std::vector< Vector3f > &points, const std::vector< Vector4f > &colors, float width=1, bool depthTest=true) |
| |
| MRVIEWER_API void | drawTris (const std::vector< Triangle3f > &tris, const std::vector< TriCornerColors > &colors, const ModelRenderParams ¶ms, bool depthTest=true) |
| | Draw triangles immediately (flat shaded)
|
| |
| MRVIEWER_API void | drawTris (const std::vector< Triangle3f > &tris, const std::vector< TriCornerColors > &colors, const Matrix4f &modelM={}, bool depthTest=true) |
| |
| BaseRenderParams | getBaseRenderParams () const |
| | Prepares base rendering parameters for this viewport.
|
| |
| BaseRenderParams | getBaseRenderParams (const Matrix4f &projM) const |
| | Prepares base rendering parameters for this viewport with custom projection matrix.
|
| |
| BaseRenderParams | getBaseRenderParamsOrthoFixedPos () const |
| | Prepares base rendering parameters for this viewport with orthographic proj matrix and rotation component of view matrix.
|
| |
| ModelRenderParams | getModelRenderParams (const Matrix4f &modelM, Matrix4f *normM, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| | Prepares rendering parameters to draw a model with given transformation in this viewport.
|
| |
| ModelRenderParams | getModelRenderParamsOrthoFixedPos (const Matrix4f &modelM, Matrix4f *normM, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| | Prepares rendering parameters to draw a model with orthographic proj matrix and rotation component of view matrix.
|
| |
| MRVIEWER_API ModelRenderParams | getModelRenderParams (const Matrix4f &modelM, const BaseRenderParams &baseParams, Matrix4f *normM, DepthFunction depthFunc=DepthFunction::Default, RenderModelPassMask pass=RenderModelPassMask::All, const TransparencyMode &transparentMode={}) const |
| | Prepares rendering parameters to draw a model with given transformation in this viewport with custom BaseRenderParams.
|
| |
| MRVIEWER_API ObjAndPick | pickRenderObject (const PickRenderObjectParams ¶ms=PickRenderObjectParams::defaults()) const |
| |
| MRVIEWER_API ObjAndPick | pickRenderObject (std::span< VisualObject *const > objects, const PickRenderObjectParams ¶ms=PickRenderObjectParams::defaults()) const |
| | This overload uses objects from the list (possibly filtered by a predicate).
|
| |
| MRVIEWER_API ConstObjAndPick | pickRenderObjectConst (std::span< const VisualObject *const > objects, const PickRenderObjectParams ¶ms=PickRenderObjectParams::defaults()) const |
| | This overload uses const objects from the list (possibly filtered by a predicate). Sadly need a different name to avoid over resolution issues.
|
| |
| MRVIEWER_API ObjAndPick | pick_render_object () const |
| |
| MRVIEWER_API ObjAndPick | pick_render_object (uint16_t pickRadius) const |
| |
| MRVIEWER_API ObjAndPick | pick_render_object (const std::vector< VisualObject * > &objects) const |
| | NOTE! If your list is hardcoded, use .objects = std::array{ a, b, c }.
|
| |
| MRVIEWER_API ObjAndPick | pick_render_object (const std::vector< VisualObject * > &objects, uint16_t pickRadius, bool exactPickFirst=true) const |
| |
| MRVIEWER_API ObjAndPick | pick_render_object (bool exactPickFirst) const |
| | This function allows to pick point in scene by GL with default pick radius, but with specified exactPickFirst parameter (see description upper).
|
| |
| MRVIEWER_API ObjAndPick | pick_render_object (const Vector2f &viewportPoint) const |
| |
| MRVIEWER_API ObjAndPick | pick_render_object (const std::vector< VisualObject * > &objects, const Vector2f &viewportPoint) const |
| |
| MRVIEWER_API std::vector< ObjAndPick > | multiPickObjects (std::span< VisualObject *const > objects, const std::vector< Vector2f > &viewportPoints, const BaseRenderParams *overrideRenderParams=nullptr) const |
| |
| MRVIEWER_API std::vector< std::shared_ptr< VisualObject > > | findObjectsInRect (const Box2i &rect, int maxRenderResolutionSide=512) const |
| |
| MRVIEWER_API std::unordered_map< std::shared_ptr< ObjectMesh >, FaceBitSet > | findVisibleFaces (const BitSet &includePixBs, int maxRenderResolutionSide=512) const |
| |
| MRVIEWER_API FaceBitSet | findCameraLookingFaces (const Mesh &mesh, const AffineXf3f &meshToWorld) const |
| | finds all triangles of a mesh that having normals oriented toward the camera in this viewport
|
| |
| MRVIEWER_API ConstObjAndPick | const_pick_render_object () const |
| |
| MRVIEWER_API ConstObjAndPick | const_pick_render_object (const std::vector< const VisualObject * > &objects) const |
| |
| MRVIEWER_API std::vector< ConstObjAndPick > | constMultiPickObjects (const std::vector< const VisualObject * > &objects, const std::vector< Vector2f > &viewportPoints) const |
| |
| MRVIEWER_API void | transformView (const AffineXf3f &xf) |
| |
| bool | getRedrawFlag () const |
| |
| void | resetRedrawFlag () |
| |
| MRVIEWER_API void | setRotation (bool state) |
| | Starts or stop rotation.
|
| |
| MRVIEWER_API const ViewportRectangle & | getViewportRect () const |
| | Note, Y is up for this box.
|
| |
| MRVIEWER_API float | getPixelSize () const |
| | Finds length between near pixels on zNear plane. Only good in the orthographic projection.
|
| |
| MRVIEWER_API float | getPixelSizeAtPoint (const Vector3f &worldPoint) const |
| |
| MRVIEWER_API void | setViewportRect (const ViewportRectangle &rect) |
| |
| MRVIEWER_API AffineXf3f | getUnscaledViewXf () const |
| | returns orthonormal matrix with translation
|
| |
| AffineXf3f | getViewXf () const |
| | converts directly from the view matrix
|
| |
| Vector3f | getUpDirection () const |
| | returns unit vector in world space corresponding to up-direction in camera space
|
| |
| Vector3f | getRightDirection () const |
| | assume that viewM is orthogonal and inverse=transpose
|
| |
| Vector3f | getBackwardDirection () const |
| | assume that viewM is orthogonal and inverse=transpose
|
| |
| MRVIEWER_API Line3f | unprojectPixelRay (const Vector2f &viewportPoint) const |
| | assume that viewM is orthogonal and inverse=transpose
|
| |
| MRVIEWER_API Vector3f | worldToCameraSpace (const Vector3f &p) const |
| | convert point(s) to camera space by applying view matrix
|
| |
| MRVIEWER_API std::vector< Vector3f > | worldToCameraSpace (const std::vector< Vector3f > &p) const |
| |
| MRVIEWER_API Vector3f | projectToClipSpace (const Vector3f &worldPoint) const |
| |
| MRVIEWER_API std::vector< Vector3f > | projectToClipSpace (const std::vector< Vector3f > &worldPoints) const |
| |
| MRVIEWER_API Vector3f | unprojectFromClipSpace (const Vector3f &clipPoint) const |
| |
| MRVIEWER_API std::vector< Vector3f > | unprojectFromClipSpace (const std::vector< Vector3f > &clipPoints) const |
| |
| MRVIEWER_API Vector3f | projectToViewportSpace (const Vector3f &worldPoint) const |
| |
| MRVIEWER_API std::vector< Vector3f > | projectToViewportSpace (const std::vector< Vector3f > &worldPoints) const |
| |
| MRVIEWER_API Vector3f | unprojectFromViewportSpace (const Vector3f &viewportPoint) const |
| |
| MRVIEWER_API std::vector< Vector3f > | unprojectFromViewportSpace (const std::vector< Vector3f > &viewportPoints) const |
| |
| MRVIEWER_API Vector3f | clipSpaceToViewportSpace (const Vector3f &p) const |
| |
| MRVIEWER_API std::vector< Vector3f > | clipSpaceToViewportSpace (const std::vector< Vector3f > &p) const |
| |
| MRVIEWER_API Vector3f | viewportSpaceToClipSpace (const Vector3f &p) const |
| |
| MRVIEWER_API std::vector< Vector3f > | viewportSpaceToClipSpace (const std::vector< Vector3f > &p) const |
| |
| void | setupView () |
| | updates view and projection matrices due to camera parameters (called each frame)
|
| |
| void | preDraw () |
| |
| void | postDraw () const |
| |
| MRVIEWER_API void | fitData (float fill=1.0f, bool snapView=true) |
| |
| MRVIEWER_API void | fitBox (const Box3f &newSceneBox, float fill=1.0f, bool snapView=true) |
| |
| MRVIEWER_API void | preciseFitBoxToScreenBorder (const FitBoxParams ¶ms) |
| | fit view and proj matrices to match the screen size with given box
|
| |
| MRVIEWER_API void | preciseFitDataToScreenBorder (const FitDataParams ¶ms={}) |
| | fit view and proj matrices to match the screen size with given objects
|
| |
| MRVIEWER_API float | getRatio () const |
| | returns viewport width/height ratio
|
| |
| MRVIEWER_API bool | allModelsInsideViewportRectangle () const |
| | returns true if all models are fully projected inside the viewport rectangle
|
| |
| MRVIEWER_API const Box3f & | getSceneBox () const |
| |
| const Parameters & | getParameters () const |
| |
| MRVIEWER_API Vector3f | getCameraPoint () const |
| | returns camera world location for the current view
|
| |
| MRVIEWER_API void | setCameraPoint (const Vector3f &cameraWorldPos) |
| | sets camera world location for the current view
|
| |
| MRVIEWER_API void | setCameraTrackballAngle (const Quaternionf &rot) |
| |
| MRVIEWER_API void | setCameraTranslation (const Vector3f &translation) |
| |
| MRVIEWER_API void | setCameraViewAngle (float newViewAngle) |
| |
| MRVIEWER_API void | setCameraZoom (float zoom) |
| |
| MRVIEWER_API void | setOrthographic (bool orthographic) |
| |
| MRVIEWER_API void | setBackgroundColor (const Color &color) |
| |
| MRVIEWER_API void | setClippingPlane (const Plane3f &plane) |
| |
| MRVIEWER_API void | setLabel (std::string s) |
| |
| void | setSelectable (bool on) |
| |
| MRVIEWER_API void | showAxes (bool on) |
| |
| MRVIEWER_API void | showClippingPlane (bool on) |
| |
| MRVIEWER_API void | showRotationCenter (bool on) |
| |
| MRVIEWER_API void | showGlobalBasis (bool on) |
| |
| MRVIEWER_API void | rotationCenterMode (Parameters::RotationCenterMode mode) |
| |
| MRVIEWER_API void | setParameters (const Viewport::Parameters ¶ms) |
| |
| MRVIEWER_API void | cameraLookAlong (const Vector3f &dir, const Vector3f &up) |
| |
| MRVIEWER_API void | cameraRotateAround (const Line3f &axis, float angle) |
| |
| Vector3f | getRotationPivot () const |
| | returns current rotation pivot in world space, which should appear static on a screen during rotation by the user
|
| |
| MRVIEWER_API void | resetStaticRotationPivot (const std::optional< Vector3f > &pivot=std::nullopt) |
| |
Viewport is a rectangular area, in which the objects of interest are going to be rendered. An application can have a number of viewports each with its own ID.