Docs/Classes/EditorCamera

Header

include/MeshCraft/Editor/EditorCamera.hpp

Namespace

MeshCraft::Editor

Model

The camera is defined by three parameters plus a target point:

The camera eye position is computed from these four values each frame. There is no separate eye position stored.

Public Fields

FieldTypeDefaultDescription
yawfloat0.0fHorizontal orbit (radians)
pitchfloat0.4fVertical orbit (radians, clamped to ±85°)
distancefloat15.0fDistance from target
fovDegreesfloat60.0fField of view
nearPlanefloat0.1fNear clip
farPlanefloat2000.0fFar clip
targetVector3(0,0,0)The orbit center / look-at point

Methods

MethodDescription
orbit(deltaYaw, deltaPitch)Add to yaw and pitch. Pitch is clamped. Called on middle-mouse drag.
pan(deltaX, deltaY)Translate target in the camera's right+up plane. Called on right-mouse drag.
zoom(delta)Multiply distance by a factor. Clamps result to [0.5, 2000].
focusOn(x, y, z, radius)Move target to (x,y,z), set distance to fit the given radius. Used by F key.
reset()Reset yaw=0, pitch=0.4, distance=15, target=(0,0,0).
viewMatrix()Compute and return the view matrix from yaw/pitch/distance/target.
projectionMatrix(aspectRatio)Return a perspective projection matrix (fovDegrees, aspect, near, far).
position()Compute and return the current eye position (derived from orbit params).
screenRayDirection(ndcX, ndcY, aspect)Unproject a normalized device coordinate to a world-space ray direction. Used for AABB picking.