qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
ccViewportParameters Class Reference

Standard parameters for GL displays/viewports. More...

#include <ccViewportParameters.h>

Inheritance diagram for ccViewportParameters:
Inheritance graph
[legend]
Collaboration diagram for ccViewportParameters:
Collaboration graph
[legend]

Public Member Functions

 ccViewportParameters ()
 Default constructor.
 
 ccViewportParameters (const ccViewportParameters &params)
 Copy constructor.
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out) const override
 Saves data to binary stream. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
void setPivotPoint (const CCVector3d &P, bool autoUpdateFocal)
 Sets the pivot point (for object-centered view mode)
 
const CCVector3d & getPivotPoint () const
 Returns the pivot point (for object-centered view mode)
 
void setCameraCenter (const CCVector3d &C, bool autoUpdateFocal)
 Sets the camera center.
 
const CCVector3d & getCameraCenter () const
 Returns the camera center.
 
void setFocalDistance (double distance)
 Sets the 'focal' distance. More...
 
double getFocalDistance () const
 Computes the 'focal' distance.
 
ccGLMatrixd computeViewMatrix () const
 Computes the view matrix.
 
ccGLMatrixd computeScaleMatrix (const QRect &glViewport) const
 Computes the scale matrix.
 
CCVector3d getViewDir () const
 Returns the viewing direction. More...
 
CCVector3d getUpDir () const
 Returns the up direction. More...
 
const CCVector3d & getRotationCenter () const
 Returns the view rotation 'center'. More...
 
double computeDistanceToHalfWidthRatio () const
 Computes the ratio 'distance to half width' (based on the current FOV) More...
 
double computeDistanceToWidthRatio () const
 Computes the ratio 'distance to width' (based on the current FOV) More...
 
double computeWidthAtFocalDist () const
 Computes the object 'width' at the 'focal' distance.
 
double computePixelSize (int glWidth) const
 Computes the pixel size at the 'focal' distance.
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor.
 
virtual bool isSerializable () const
 Returns whether object is serializable of not. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binary stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
 Loads data from binary stream. More...
 

Static Public Member Functions

static double IncrementToZNearCoef (int i, int iMax)
 Helper: converts an integer (increment) in [0 iMax] to a double (zNear) value in [0.001 1].
 
static int ZNearCoefToIncrement (double coef, int iMax)
 Helper: converts a double (zNear) value in ]0 1] to integer increments in [0 iMax].
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 

Public Attributes

ccGLMatrixd viewMat
 Visualization matrix (rotation only)
 
float defaultPointSize
 Point size.
 
float defaultLineWidth
 Line width.
 
bool perspectiveView
 Perspective view state.
 
bool objectCenteredView
 Whether view is centered on displayed scene (true) or on the user eye (false) More...
 
double zNearCoef
 Theoretical perspective 'zNear' relative position.
 
double zNear
 Actual perspective 'zNear' value.
 
double zFar
 Actual perspective 'zFar' value.
 
float fov_deg
 Camera F.O.V. (field of view) in degrees.
 
float cameraAspectRatio
 Camera aspect ratio.
 

Protected Attributes

double focalDistance
 Focal distance.
 
CCVector3d pivotPoint
 Rotation pivot point (for object-centered view modes)
 
CCVector3d cameraCenter
 Camera center.
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1 , DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID)
 

Detailed Description

Standard parameters for GL displays/viewports.

Member Function Documentation

◆ computeDistanceToHalfWidthRatio()

double ccViewportParameters::computeDistanceToHalfWidthRatio ( ) const

Computes the ratio 'distance to half width' (based on the current FOV)

Half width = ratio * distance = tan(fov / 2) * distance

◆ computeDistanceToWidthRatio()

double ccViewportParameters::computeDistanceToWidthRatio ( ) const

Computes the ratio 'distance to width' (based on the current FOV)

Width = ratio * distance = (2 * tan(fov / 2)) * distance

◆ fromFile()

bool ccViewportParameters::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
overridevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success

Reimplemented from ccSerializableObject.

◆ getRotationCenter()

const CCVector3d & ccViewportParameters::getRotationCenter ( ) const

Returns the view rotation 'center'.

The rotation center is defined as:

  • the pivot point in object-centered view mode
  • the camera center in viewer-centered view mode

◆ getUpDir()

CCVector3d ccViewportParameters::getUpDir ( ) const

Returns the up direction.

This is the vertical direction of the screen (pointing 'upward') in the world coordinate system.

◆ getViewDir()

CCVector3d ccViewportParameters::getViewDir ( ) const

Returns the viewing direction.

This is the direction normal to the screen (pointing 'forward') in the world coordinate system.

◆ isSerializable()

bool ccViewportParameters::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

◆ setFocalDistance()

void ccViewportParameters::setFocalDistance ( double  distance)

Sets the 'focal' distance.

Warning
changes the camera center position in object-centered view mode

◆ toFile()

bool ccViewportParameters::toFile ( QFile &  out) const
overridevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
Returns
success

Reimplemented from ccSerializableObject.

Member Data Documentation

◆ objectCenteredView

bool ccViewportParameters::objectCenteredView

Whether view is centered on displayed scene (true) or on the user eye (false)

Always true for ortho. mode.


The documentation for this class was generated from the following files: