CameraControl

class CameraControl : public HPS::Control

The HPS::CameraControl class is a smart pointer that is tied to a database object. The CameraControl is used to manipulate the viewpoint, or camera, in a scene. Using this control, the view position, orientation, target, and aspect ratio of a segment’s camera can be set. A camera with all of its properties is considered a single segment attribute, therefore, cameras inherit down the segment hierarchy along with all their properties as a group. Because all properties of a camera inherit together, it is not possible to modify an individual property of an inherited camera. Attempting to do so will create a new camera initially populated with default values. This table lists default values for the various segment attributes accessible from HPS::CameraControl.

Public Functions

CameraControl(CameraControl &&in_that)

The move constructor creates a CameraControl by transferring the underlying impl of the rvalue reference to this CameraControl thereby avoiding a copy and allocation.

Parameters:

in_that – An rvalue reference to a CameraControl to take the impl from.

CameraControl(CameraControl const &in_that)

Initializes a control tied to the same object as in_that.

explicit CameraControl(SegmentKey &in_seg)

Initializes a control tied to the segment in_seg.

CameraControl &Dolly(float in_x_dir, float in_up, float in_forward)

Moves the camera position and target the specified amount but maintains the up vector and field. If a complete camera is not already set up, one will be populated with default values before dollying.

Parameters:
  • in_x_dir – The number of world-space units to move the camera in the x-direction.

  • in_up – The number of world-space units to move the camera up, or if negative, down.

  • in_forward – The number of world-space units to move the camera toward the target, or if negative, away from the target.

Returns:

A reference to this object.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns:

The declared type of the object in question, which may differ from the true, underlying type.

CameraControl &operator=(CameraControl &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this CameraControl thereby avoiding a copy.

Parameters:

in_that – An rvalue reference to a CameraControl to take the impl from.

Returns:

A reference to this CameraControl.

CameraControl &operator=(CameraControl const &in_that)

Share the underlying smart-pointer of the CameraControl source.

Parameters:

in_that – The CameraControl source of the assignment.

Returns:

A reference to this CameraControl.

CameraControl &Orbit(float in_theta, float in_phi)

Moves the camera around the target in_theta degrees to the right and in_phi degrees up. The target and field are maintained but position and up_vector may change. If a complete camera is not already set up, one will be populated with default values before orbiting.

Parameters:
  • in_theta – The number of degrees to move the the camera position to the right.

  • in_phi – The number of degrees to move the the camera position up.

Returns:

A reference to this object.

CameraControl &Pan(float in_theta, float in_phi)

Pivots the camera on its location in_theta degrees to the right and in_phi degrees up. The position and field remain unchanged while the target and up vector may change. If a complete camera is not already set up, one will be populated with default values before panning.

Parameters:
  • in_theta – The number of degrees to move the the camera target to the right.

  • in_phi – The number of degrees to move the the camera target up.

Returns:

A reference to this object.

CameraControl &Roll(float in_theta)

Spins the camera around its target in_theta degrees counter-clockwise (the scene will appear to move clockwise). The position, field, and target are unchanged while the up-vector may change. If a complete camera is not already set up, one will be populated with default values before rolling.

Parameters:

in_theta – The number of degrees to roll the camera.

Returns:

A reference to this object.

CameraControl &SetField(float in_width, float in_height)

Sets the camera field.

See also

camera field

Parameters:
  • in_width – The width of the camera field, in object-space units.

  • in_height – The height of the camera field, in object-space units.

Returns:

A reference to this object.

CameraControl &SetNearLimit(float in_double)

Sets the near_limit to in_double that defines the near limit of the camera. A value approaching 0.0 will place it close to the camera position (at the cost of poor z-buffer precision), whereas a value approaching 1.0 will place it near the camera target (at the cost of clipping away anything closer than the target). A value exactly equal to 0 will let HOOPS Visualize choose a limit based on the precision of the zbuffer as reported by the driver.

See also

camera near limit

Parameters:

in_double – The value to set the near limit to

Returns:

A reference to this object.

CameraControl &SetPosition(Point const &in_position)

Sets the location of the camera.

See also

camera position

Parameters:

in_position – The location of the camera.

Returns:

A reference to this object.

CameraControl &SetProjection(Camera::Projection in_type, float in_oblique_x_skew = 0.0f, float in_oblique_y_skew = 0.0f)

Sets the camera projection type and the oblique skew, if any.

See also

camera target

Parameters:
  • in_type – The type of camera projection.

  • in_oblique_x_skew – The oblique skew in the horizontal direction.

  • in_oblique_y_skew – The oblique skew in the vertical direction.

Returns:

A reference to this object.

CameraControl &SetTarget(Point const &in_target)

Sets the location that the camera is pointed at.

See also

camera position

Parameters:

in_target – The location that the camera is pointed at.

Returns:

A reference to this object.

CameraControl &SetUpVector(Vector const &in_up)

Sets a vector that defines the vertical up direction of the camera.

See also

camera up vector

Parameters:

in_up – A vector that defines the vertical up direction of the camera.

Returns:

A reference to this object.

bool ShowField(float &out_width, float &out_height) const

Shows the camera field.

Parameters:
  • out_width – The width of the camera field, in object-space units.

  • out_height – The height of the camera field, in object-space units.

Returns:

true if the setting is valid, false otherwise.

bool ShowHeight(float &out_height) const

Shows the height of the camera field.

Parameters:

out_height – The height of the camera field, in object-space units.

Returns:

true if the setting is valid, false otherwise.

bool ShowNearLimit(float &out_near_limit) const

Shows the camera near limit.

Parameters:

out_width – The near limit of the camera field.

Returns:

true if the setting is valid, false otherwise.

bool ShowPosition(Point &out_position) const

Shows the camera position.

Parameters:

out_position – the location of the camera.

Returns:

true if the setting is valid, false otherwise.

bool ShowProjection(Camera::Projection &out_type) const

Shows the camera projection type.

Parameters:

out_type – The type of camera projection.

Returns:

true if the setting is valid, false otherwise.

bool ShowProjection(Camera::Projection &out_type, float &out_oblique_x_skew, float &out_oblique_y_skew) const

Shows the camera projection type and the oblique skew, if any.

Parameters:
  • out_type – The type of camera projection.

  • out_oblique_x_skew – The oblique skew in the horizontal direction.

  • out_oblique_y_skew – The oblique skew in the vertical direction.

Returns:

true if the setting is valid, false otherwise.

bool ShowTarget(Point &out_target) const

Shows the camera target.

Parameters:

out_target – the location that the camera is pointed at.

Returns:

true if the setting is valid, false otherwise.

bool ShowUpVector(Vector &out_up_vector) const

Shows the camera up-vector.

Parameters:

out_up_vector – A vector that defines the vertical up direction of the camera.

Returns:

true if the setting is valid, false otherwise.

bool ShowWidth(float &out_width) const

Shows the width of the camera field.

Parameters:

out_width – The width of the camera field, in object-space units.

Returns:

true if the setting is valid, false otherwise.

CameraControl &UnsetEverything()

Removes all settings from this object. Unlike other attributes, it is not possible to unset just a single field of a camera. If the control is attached to a WindowKey this function restores the default settings of this control as specified by CameraKit::GetDefault().

Returns:

A reference to this object.

CameraControl &Zoom(float in_zoom)

Adjusts the field of view by dividing the width and height by the input value. Numbers greater than one will have the effect of making things on screen appear larger. Numbers between zero and one will have the opposite effect. Only the field is affected. If a complete camera is not already set up, one will be populated with default values before zooming.

Parameters:

in_zoom – The zoom scale factor.

Returns:

A reference to this object.

~CameraControl()

Releases a reference to the database object this control is tied to.

Public Static Attributes

static const HPS::Type staticType = HPS::Type::CameraControl