QtCraft API C++ classes QML types Handbook

QcPreviewCamera Class

View of the character preview: the figure stands at the origin and turns on the spot (dragging turns it), the camera looks at it from +Z along -Z and zooms from the whole body to the head. More...

Header: #include <clientcore/preview/QcPreviewCamera.h>

Public Types

enum class Side { Front, Back }

Public Functions

QcCamera camera() const
double distance() const
void drag(double pixels)
double modelYaw() const
void reset()
void setModelYaw(double yaw)
void setZoom(double zoom)
void show(QcPreviewCamera::Side side)
QcPreviewCamera::Side side() const
QcVec3 target() const
void wheel(int angleDelta)
double zoom() const

Static Public Members

const double bodyHeight
const double defaultTurn
const double degreesPerPixel
const double farDistance
const float fieldOfView
const double frontYaw
const double headHeight
const double nearDistance
const double zoomPerStep

Detailed Description

GUI-free so the controls can be tested without a window.

Member Type Documentation

enum class QcPreviewCamera::Side

The side of the figure facing the camera.

ConstantValueDescription
QcPreviewCamera::Side::Front0The face looks at the camera
QcPreviewCamera::Side::Back1The back faces the camera

Member Function Documentation

QcCamera QcPreviewCamera::camera() const

Returns where the camera stands and looks (QcCamera conventions).

double QcPreviewCamera::distance() const

Returns the camera's distance from the point it looks at, at the current zoom.

void QcPreviewCamera::drag(double pixels)

Mouse dragged by pixels to the right: the figure turns with it (its front to the right).

double QcPreviewCamera::modelYaw() const

Returns the figure's yaw in degrees, in [0, 360).

See also setModelYaw().

void QcPreviewCamera::reset()

Default turn and no zoom.

void QcPreviewCamera::setModelYaw(double yaw)

Sets the figure's yaw to yaw degrees (wrapped to [0, 360)); values that are not finite are refused with a warning.

See also modelYaw().

void QcPreviewCamera::setZoom(double zoom)

Sets the zoom to zoom (clamped to 0..1); values that are not finite are refused with a warning.

See also zoom().

void QcPreviewCamera::show(QcPreviewCamera::Side side)

Shows the figure straight from side (front or behind), keeping the zoom.

QcPreviewCamera::Side QcPreviewCamera::side() const

Returns the side of the figure that faces the camera (front while turned less than 90 degrees away).

QcVec3 QcPreviewCamera::target() const

Returns the point the camera looks at.

void QcPreviewCamera::wheel(int angleDelta)

Wheel turned by angleDelta (120 per notch, positive away from the user): zooms in.

double QcPreviewCamera::zoom() const

Returns the zoom: 0 shows the whole body, 1 the head and shoulders.

See also setZoom().

Member Variable Documentation

const double QcPreviewCamera::defaultTurn

The default view: a little turned, so the figure shows its depth.

const double QcPreviewCamera::degreesPerPixel

Dragging by one logical pixel turns the figure this far.

const float QcPreviewCamera::fieldOfView

Vertical field of view, narrow like a portrait lens.

const double QcPreviewCamera::frontYaw

The figure's yaw (QcEntityMesher::Placement) when its face looks at the camera.

const double QcPreviewCamera::zoomPerStep

One wheel step (120 units, a notch) changes the zoom by this share.