/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef __TNW_VIEWPOINT_H__ #define __TNW_VIEWPOINT_H__ #include "NwObject.h" #include "RxSystemServices.h" #include "NwExport.h" #include "NwCameraMode.h" #include "NwLightType.h" #include "NwModeType.h" #include "NwViewType.h" #include "NwViewer.h" #include "NwViewerToolType.h" class OdGeQuaternion; class OdGeVector3d; class OdGePoint3d; /** \details This class represents a view of models. */ class NWDBEXPORT OdNwViewpoint : public OdNwObject { //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdNwViewpoint); //DOM-IGNORE-END public: /** \details Default constructor. Creates a new object of the OdNwViewpoint class. */ OdNwViewpoint(); public: /** \details Virtual destructor. Frees allocated resources. */ virtual ~OdNwViewpoint(); public: /** \details Gets the angular speed of the camera. \returns Angular speed of the camera as a double value. */ double getAngularSpeed() const; /** \details Receives the distance from the eye point to the far plane along the view direction. \returns Distance from the eye point to the far plane as a double value. \remarks Must be greater than the near distance. */ double getFarDistance() const; /** \details Receives the focal distance of the camera. \returns Focal distance of the camera as a double value. */ double getFocalDistance() const; /** \details Indicates whether the AngularSpeed is set. \returns The true value if the AngularSpeed is set, or false otherwise. */ bool hasAngularSpeed() const; /** \details Indicates whether the FocalDistance is set. \returns The true if the FocalDistance is set, or false otherwise. */ bool hasFocalDistance() const; /** \details Indicates whether the Lighting is set. \returns The true value if the Lighting is set, or false otherwise. */ bool hasLighting() const; /** \details Indicates whether the LinearSpeed is set. \returns The true value if the LinearSpeed is set, or false otherwise. */ bool hasLinearSpeed() const; /** \details Indicates whether the RenderStyle is set. \returns The true value if the RenderStyle is set, or false otherwise. */ bool hasRenderStyle() const; /** \details Gets whether the WorldUpVector is set. \returns The true value if the WorldUpVector is set, or false otherwise. */ bool hasWorldUpVector() const; /** \details Gets the defined camera's field of view in a combination with the aspect ratio. \returns Defined camera's field of view in a combination with the aspect ratio as a double value. \remarks For perspective, returns the vertical field of the view (the angle between the top and bottom planes of the camera view frustum). For orthographic, returns the distance between the top and bottom planes of the camera view frustum. */ double getHeightField() const; /** \details Gets the required horizontal scaling of an image when adapting the camera view to the display window. \returns Required horizontal scaling of an image as a double value. */ double getHorizontalScale() const; /** \details Gets the type of lighting used for this viewpoint. \returns Type of lighting used for this viewpoint. \remarks Returns one of the following: Name Value Description NwLightType::NO_LIGHT 0 Turns off lighting completely. NwLightType::SCENE_LIGHT 1 Uses lights from the original CAD model. NwLightType::HEAD_LIGHT 2 An automatic headlight from the viewer. NwLightType::FULL_LIGHT 3 Advanced level of lighting from the application.
*/ NwLightType::Enum getLighting() const; /** \details Gets the linear speed of the camera. \returns Linear speed of the camera as a double value. */ double getLinearSpeed() const; /** \details Gets the distance from the eye point to the near plane along the view direction. \returns Distance from the eye point to the near plane as a double value. \remarks Must be greater than zero. */ double getNearDistance() const; /** \details Gets the position of the camera. \returns Position of the camera as an OdGePoint3d value. */ OdGePoint3d getPosition() const; /** \details Gets the projection type of the current viewpoint. \returns Projection type of the current viewpoint. \remarks Returns one of the following: Name Value Description NwViewType::PERSPECTIVE 0 Perspective viewpoint. NwViewType::ORTHOGRAPHIC 1 Orthographic viewpoint.
*/ NwViewType::Enum getProjection() const; /** \details Gets the style used for rendering. \returns Style used for rendering. \remarks Returns one of the following: Name Value Description NwModeType::FULL_RENDER 0 Highest quality, as specified in the model. NwModeType::SHADED 1 Smooth shaded (simple shade model, no textures). NwModeType::WIREFRAME 2 Wireframe. NwModeType::HIDDEN_LINE 3 Hidden-line wireframe.
*/ NwModeType::Enum getRenderStyle() const; /** \details Gets the rotation of the camera from the base orientation. \returns Rotation of the camera from the base orientation as an OdGeQuaternion value. */ OdGeQuaternion getRotation() const; /** \details Gets the avatar used for this viewpoint. \returns Avatar used for this viewpoint. */ OdString getAvatar() const; /** \details Gets the type of avatar for this viewpoint. \returns Avatar type for this viewpoint. \remarks Returns one of the following: Name Value Description NwCameraMode::FIRST 0 First-person mode. NwCameraMode::THIRD 1 Third-person mode.
*/ NwCameraMode::Enum getViewerCameraMode() const; /** \details Gets the up vector. \returns Up vector as an OdGeVector3d value. */ OdGeVector3d getWorldUpVector() const; /** \details Gets the aspect ratio of the camera (width/height). \returns Aspect ratio as a double value. */ double getViewAspect() const; /** \details Gets tool mode. \returns tool mode as OdNwViewerToolType::Enum value. \remarks Return type can be one of the following: Name Value Descritpion OdNwViewerToolType::None 0 None OdNwViewerToolType::Select 1 Select OdNwViewerToolType::SelectBox 100 Select box OdNwViewerToolType::RedlineFreehand 200 Red line freehand OdNwViewerToolType::RedlineLine 201 Red line line OdNwViewerToolType::RedlineEllipse 202 Red line ellipse OdNwViewerToolType::RedlineCloud 203 Red line cloud OdNwViewerToolType::RedlineLineString 204 Red line line string OdNwViewerToolType::RedlineTag 205 Red line tag OdNwViewerToolType::RedlineText 206 Red line text OdNwViewerToolType::RedlineErase 207 Red line erase OdNwViewerToolType::RedlineArrow 208 Red line arrow OdNwViewerToolType::MeasurePointToPoint 300 Measure point to point OdNwViewerToolType::MeasurePointToMultiplePoints 301 Measure point multiple points OdNwViewerToolType::MeasurePointLine 302 Measure point line OdNwViewerToolType::MeasureAccumulate 303 Measure accumulate OdNwViewerToolType::MeasureAngle 304 Measure angle OdNwViewerToolType::MeasureArea 305 Measure area OdNwViewerToolType::MeasureSingle 306 Measure single OdNwViewerToolType::BasicViewObjectWheel 400 Basic view object wheel OdNwViewerToolType::BasicTourBuildingWheel 401 Basic tour building wheel OdNwViewerToolType::FullNavigationWheel 402 Full navigation wheel OdNwViewerToolType::MiniViewObjectWheel 403 Mini view object wheel OdNwViewerToolType::MiniTourBuildingWheel 404 Mini tour building wheel OdNwViewerToolType::MiniFullNavigationWheel 405 Mini full navigation wheel OdNwViewerToolType::Full2DNavigationWheel 406 Full 2dD navigation wheel OdNwViewerToolType::CommonPan 500 Common pan OdNwViewerToolType::CommonZoom 501 Common zoom OdNwViewerToolType::CommonZoomWindow 502 Common zoom window OdNwViewerToolType::CommonOrbit 503 Common orbit OdNwViewerToolType::CommonFreeOrbit 504 Common free orbit OdNwViewerToolType::CommonConstrainedOrbit 505 Common constrained orbit OdNwViewerToolType::CommonLookAt 506 Common look at OdNwViewerToolType::CommonLookAround 507 Common look around OdNwViewerToolType::CommonWalk 508 Common walk OdNwViewerToolType::CommonCenter 509 Common center OdNwViewerToolType::NavigateFixed 600 Navigate fixed OdNwViewerToolType::NavigateFreeLookAround 601 Navigate free look around OdNwViewerToolType::NavigateFreeOrbit 602 Navigate free orbit OdNwViewerToolType::NavigateWalk 603 Navigate walk OdNwViewerToolType::NavigateFly 604 Navigate fly OdNwViewerToolType::NavigateConstrainedOrbit 605 Navigate constrained orbit OdNwViewerToolType::NavigateZoom 607 Navigate zoom OdNwViewerToolType::NavigatePan 608 Navigate pan OdNwViewerToolType::NavigateConstrainedPan 609 Navigate constrained pan OdNwViewerToolType::NavigateLookAround 610 Navigate look around OdNwViewerToolType::NavigateOrbit 611 Navigate orbit OdNwViewerToolType::NavigateZoomWindow 612 Navigate zoom window OdNwViewerToolType::CustomToolPlugin 700 Custom tool plugin
*/ OdNwViewerToolType::Enum getTool() const; /** \details Gets the viewer object. \returns viewer object as OdNwViewer . */ OdNwViewer getViewer() const; /** \details Gets FOV value. \returns FOV value as double. */ double getPreferedFOV() const; public: /** \details Sets the projection type of the viewpoint. \param type [in] Projection type. \returns The eOk value if the type is set to the viewpoint, or an appropriate error code otherwise. \remarks The type must be one of the following: Name Value Description NwViewType::PERSPECTIVE 0 Perspective viewpoint. NwViewType::ORTHOGRAPHIC 1 Orthographic viewpoint.
*/ OdResult setProjection(NwViewType::Enum type); /** \details Sets the style used for rendering. \param style [in] Visual style for rendering. \returns The eOk value if the style is set to the viewpoint, or an appropriate error code otherwise. \remarks The style must be one of the following: Name Value Description NwModeType::FULL_RENDER 0 Highest quality, as specified in the model. NwModeType::SHADED 1 Smooth shaded (simple shade model, no textures). NwModeType::WIREFRAME 2 Wireframe. NwModeType::HIDDEN_LINE 3 Hidden-line wireframe.
Modifying the render mode results in a change to the visual style within Gi/Gs visualization. */ OdResult setRenderStyle(NwModeType::Enum style); /** \details Sets the focal distance of the camera. \param value [in] Focal distance value. \returns The eOk value if the focal distance is set to the viewpoint, or an appropriate error code otherwise. */ OdResult setFocalDistance(double value); /** \details Sets the up vector of the viewpoint. \param up [in] Constant reference to the OdGeVector3d object with the up vector. \returns The eOk value if the up vector is set to the viewpoint, or an appropriate error code otherwise. */ OdResult setWorldUpVector(const OdGeVector3d& up); /** \details Sets the position of the camera. \param pos [in] Constant reference to the OdGePoint3d object with the point of camera's position. \returns The eOk value if the position point is set to the viewpoint, or an appropriate error code otherwise. */ OdResult setPosition(const OdGePoint3d& pos); /** \details Sets the rotation of the camera from the base orientation. \param rot [in] Constant reference to the OdGeQuaternion object with the rotation of the camera. \returns The eOk value if the rotation is set to the viewpoint, or an appropriate error code otherwise. */ OdResult setRotation(const OdGeQuaternion& rot); /** \details Sets the defined camera's field of view in a combination with the aspect ratio. \param value [in] Camera's field of view. \returns The eOk vakue if the field of view is set to the viewpoint, or an appropriate error code otherwise. \remarks For perspective, this is the vertical field of view (the angle between the top and bottom planes of the camera's view frustum). For orthographic, this is the distance between the top and bottom planes of the camera's view frustum. */ OdResult setHeightField(double value); /** \details Sets the aspect ratio of the camera (width/height). \param value [in] Aspect ratio of the camera value. \returns The eOk value if the view aspect ratio is set to the viewpoint, or an appropriate error code otherwise. */ OdResult setViewAspect(double value); /** \details Sets the distance from the eye point to the near plane along the view direction. \param value [in] Near distance value. \returns The eOk value if the near distance is set to the viewpoint, or an appropriate error code otherwise. \remarks For setting current view's near distance use the void OdNwCullingElement::setNearDistance(double dNear) method instead. */ OdResult setNearDistance(double value); /** \details Sets the distance from the eye point to the far plane along the view direction. \param value [in] Far distance value. \returns The eOk value if the far distance is set to the viewpoint, or an appropriate error code otherwise. \remarks For setting current view's far distance use the void OdNwCullingElement::setFarDistance(double dFar) method instead. */ OdResult setFarDistance(double value); /** \details Sets the lighting type of the viewpoint. \param lighting [in] view's lighting type. \returns The eOk value if the lighting is set to the viewpoint, or an appropriate error code otherwise. \remarks The lighting must be one of the following: Name Value Description NwLightType::NO_LIGHT 0 Turns off lighting completely. NwLightType::SCENE_LIGHT 1 Uses lights from the original CAD model. NwLightType::HEAD_LIGHT 2 An automatic headlight from the viewer. NwLightType::FULL_LIGHT 3 Advanced level of lighting from the application.
Modifying the lighting results in a change to the visual style within Gi/Gs visualization. When switching to NwLightType::SCENE_LIGHT or NwLightType::FULL_LIGHT, the existing full lights or scene lights are removed, and the appropriate lighting type is appended to the GS model in Gi/Gs visualization. */ OdResult setLighting(NwLightType::Enum lighting); }; /** \details This template class is a specialization of the OdSmartPtr class for OdNwViewpoint object pointers. */ typedef OdSmartPtr OdNwViewpointPtr; #endif //__TNW_VIEWPOINT_H__