QcPreviewPose Namespace
Poses of the character preview: the animations to check a look with (standing with the idle sway, walking on the spot, mining) and the head following the mouse pointer. More...
| Header: | #include <clientcore/preview/QcPreviewPose.h> |
Classes
| struct | Gaze |
Types
| enum class | Animation { Stand, Walk, Mine } |
Variables
| const double | gazeRate |
Functions
| QcPreviewPose::Gaze | approach(QcPreviewPose::Gaze current, QcPreviewPose::Gaze target, double seconds) |
| QcCapeDrive | capeDrive(QcPreviewPose::Animation animation) |
| std::optional<QcPreviewPose::Animation> | fromName(const QString &name) |
| QcPreviewPose::Gaze | gazeAt(QcPreviewCamera camera, double pointerX, double pointerY, double aspect) |
| QString | name(QcPreviewPose::Animation animation) |
| QcEntityPose | pose(QcPreviewPose::Animation animation, double seconds, QcPreviewPose::Gaze gaze) |
Detailed Description
Pure functions of their inputs, so the preview is deterministic and testable.
Classes
class Gaze
Head angles against the body in degrees: yaw positive to the figure's right, pitch positive up. More...
Type Documentation
enum class QcPreviewPose::Animation
The animation the preview shows.
| Constant | Value | Description |
|---|---|---|
QcPreviewPose::Animation::Stand | 0 | Standing with the idle sway |
QcPreviewPose::Animation::Walk | 1 | Walking on the spot |
QcPreviewPose::Animation::Mine | 2 | Mining |
Variable Documentation
const double QcPreviewPose::gazeRate
The head turns towards a new target with this rate (per second, share of the way left).
Function Documentation
QcPreviewPose::Gaze QcPreviewPose::approach(QcPreviewPose::Gaze current, QcPreviewPose::Gaze target, double seconds)
Returns the head moved from current towards target over seconds (smooth, never past the target).
QcCapeDrive QcPreviewPose::capeDrive(QcPreviewPose::Animation animation)
Returns how the figure moves for its cape in animation: walking forwards on the spot, else standing.
std::optional<QcPreviewPose::Animation> QcPreviewPose::fromName(const QString &name)
Returns the animation called name; unset for unknown names.
QcPreviewPose::Gaze QcPreviewPose::gazeAt(QcPreviewCamera camera, double pointerX, double pointerY, double aspect)
Returns where the head looks to follow a pointer at (pointerX, pointerY) in the view of camera (-1..1 from the centre, y up; aspect is width / height). The pointer is taken a third of the way from the figure to the camera, so the head turns clearly towards it. Seen from behind, the head turns back to the front instead of twisting round.
QString QcPreviewPose::name(QcPreviewPose::Animation animation)
Returns the name of animation: "stand", "walk", "mine".
QcEntityPose QcPreviewPose::pose(QcPreviewPose::Animation animation, double seconds, QcPreviewPose::Gaze gaze)
Returns the figure's pose seconds into animation, with the head turned by gaze.