63 "f/1.4",
"f/1.8",
"f/2",
"f/2.8",
"f/3.5",
"f/4",
"f/5.6",
"f/8",
"f/11",
"f/16",
"f/22",
"f/32",
"NONE"
70 1.4f, 1.8f, 2.0f, 2.8f, 3.5f, 4.0f, 5.6f, 8.0f, 11.0f, 16.0f, 22.0f, 32.0f
145 void setYaw( const Angle::DEGREES<
F32> angle ) noexcept;
147 void setPitch( const Angle::DEGREES<
F32> angle ) noexcept;
149 void setRoll( const Angle::DEGREES<
F32> angle ) noexcept;
164 void setRotation( const Angle::DEGREES<
F32> yaw, const Angle::DEGREES<
F32> pitch, const Angle::DEGREES<
F32> roll = 0.0f ) noexcept;
169 void rotate( Angle::DEGREES<
F32> yaw, Angle::DEGREES<
F32> pitch, Angle::DEGREES<
F32> roll ) noexcept;
187 void moveUp( const
F32 factor ) noexcept;
192 bool zoom(
F32 zoomFactor ) noexcept;
196 void setEuler( const Angle::DEGREES<
F32>& pitch, const Angle::DEGREES<
F32>& yaw, const Angle::DEGREES<
F32>& roll ) noexcept;
211 void saveToXML( boost::property_tree::ptree& pt,
std::
string prefix = "" ) const;
212 void loadFromXML( const boost::property_tree::ptree& pt,
std::
string prefix = "" );
262 template<
bool zeroToOneDepth = true>
264 template<
bool zeroToOneDepth = true>
266 template<
bool zeroToOneDepth = true>
const mat4< F32 > & worldMatrix() const noexcept
Returns the most recent/up-to-date inverse of the view matrix.
const mat4< F32 > & projectionMatrix() const noexcept
Returns the most recent/up-to-date projection matrix.
static void DestroyPool()
const mat4< F32 > & setProjection(vec2< F32 > zPlanes)
PROPERTY_RW(Mode, mode, Mode::COUNT)
vec3< F32 > _fixedYawAxis
bool updateViewMatrix() noexcept
void rotatePitch(Angle::DEGREES< F32 > angle)
Change camera's pitch.
bool rotateRelative(const vec3< F32 > &relRotation)
static CameraEntry * FindCameraEntryLocked(const U64 nameHash)
const mat4< F32 > & viewProjectionMatrix() const noexcept
Returns the most recent/up-to-date viewProjection matrix.
mat4< F32 > _viewProjectionMatrix
const mat4< F32 > & viewMatrix() const noexcept
Returns the most recent/up-to-date view matrix.
static Camera * GetUtilityCamera(const UtilityCamera type)
void moveStrafe(const F32 factor) noexcept
Moves the camera left or right.
const mat4< F32 > & lookAt(const mat4< F32 > &viewMatrix)
Sets the camera's view matrix to specify the specified value by extracting the eye position,...
const Frustum & getFrustum() const noexcept
Returns the most recent/up-to-date frustum.
bool updateFrustum()
Extract the frustum associated with our current PoV.
Angle::DEGREES< F32 > getHorizontalFoV() const noexcept
Returns the horizontal field of view, calculated from the vertical FoV and aspect ratio.
void rotateYaw(Angle::DEGREES< F32 > angle)
static Camera * CreateCamera(const Str< 256 > &cameraName, Mode cameraMode)
const CameraSnapshot & snapshot() const noexcept
Returns the internal camera snapshot data (eye, orientation, etc)
PROPERTY_R_IW(bool, reflectionActive, false)
static mat4< F32 > LookAt(const vec3< F32 > &eye, const vec3< F32 > &target, const vec3< F32 > &up) noexcept
PROPERTY_RW(F32, curRadius, 8.f)
void setAspectRatio(F32 ratio) noexcept
static constexpr F32 s_minNearZ
Plane< F32 > _reflectionPlane
bool updateLookAt()
Return true if the cached camera state wasn't up-to-date.
void fromSnapshot(const CameraSnapshot &snapshot)
Sets the internal snapshot data (eye, orientation, etc) to match the specified value.
void rotateRoll(Angle::DEGREES< F32 > angle)
Change camera's roll.
CameraListenerMap _updateCameraListeners
void moveUp(const F32 factor) noexcept
Moves the camera up or down.
void setPitch(const Angle::DEGREES< F32 > angle) noexcept
Sets the camera's Pitch angle. Yaw and Roll are previous extracted values.
static Camera * FindCamera(const U64 nameHash)
void setFixedYawAxis(const bool useFixed, const vec3< F32 > &fixedAxis=WORLD_Y_AXIS) noexcept
Exactly as in Ogre3D: locks the yaw movement to the specified axis.
void rotate(const Quaternion< F32 > &q)
Rotates the camera (changes its orientation) by the specified quaternion (_orientation *= q)
PROPERTY_RW(F32, minRadius, 0.1f)
static constexpr F32 MAX_CAMERA_MOVE_SPEED
void setGlobalRotation(F32 yaw, F32 pitch, F32 roll=0.0f) noexcept
Global rotations are applied relative to the world axis, not the camera's.
PROPERTY_RW(F32, maxRadius, 10.f)
void setHorizontalFoV(Angle::DEGREES< F32 > horizontalFoV) noexcept
void setRoll(const Angle::DEGREES< F32 > angle) noexcept
Sets the camera's Roll angle. Yaw and Pitch are previous extracted values.
vec3< Angle::RADIANS< F32 > > _cameraRotation
bool removeUpdateListener(U32 id)
Angle::DEGREES< F32 > _accumPitchDegrees
void setGlobalPitch(const Angle::DEGREES< F32 > angle) noexcept
Sets the camera's Pitch angle. Yaw and Roll are previous extracted values.
void setTarget(TransformComponent *tComp, const vec3< F32 > &offsetDirection=VECTOR3_ZERO) noexcept
Offset direction is a (eventually normalized) vector that is scaled by curRadius and applied to the c...
void setEuler(const vec3< Angle::DEGREES< F32 > > &euler) noexcept
Set the camera's rotation to match the specified euler angles.
bool moveFromPlayerState(const SceneStatePerPlayer &playerState)
static constexpr F32 DEFAULT_CAMERA_TURN_SPEED
vec3< F32 > unProject(F32 winCoordsX, F32 winCoordsY, const Rect< I32 > &viewport) const noexcept
void setVerticalFoV(Angle::DEGREES< F32 > verticalFoV) noexcept
void setGlobalRoll(const Angle::DEGREES< F32 > angle) noexcept
Sets the camera's Roll angle. Yaw and Pitch are previous extracted values.
void setEye(const F32 x, const F32 y, const F32 z) noexcept
Sets the camera's eye position.
static mat4< F32 > Perspective(Angle::DEGREES< F32 > fovyRad, F32 aspect, F32 zNear, F32 zFar) noexcept
static CameraEntry * FindCameraEntry(const U64 nameHash)
TransformComponent * _targetTransform
void moveForward(const F32 factor) noexcept
Moves the camera forward or backwards.
static constexpr F32 MAX_CAMERA_TURN_SPEED
static mat4< F32 > Ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar) noexcept
void saveToXML(boost::property_tree::ptree &pt, std::string prefix="") const
void fromCamera(const Camera &camera)
Copies all of the internal data from the specified camera to the current one.
bool zoom(F32 zoomFactor) noexcept
void setReflection(const Plane< F32 > &reflectionPlane) noexcept
Specify a reflection plane that alters the final view matrix to be a mirror of the internal lookAt ma...
PROPERTY_RW(bool, rotationLocked, false)
bool updateProjection() noexcept
static U32 AddChangeListener(const CameraListener &f)
static bool RemoveChangeListener(U32 id)
static bool DestroyCamera(Camera *&camera)
bool moveRelative(const vec3< F32 > &relMovement)
vec2< F32 > project(const vec3< F32 > &worldCoords, const Rect< I32 > &viewport) const noexcept
static mat4< F32 > FrustumMatrix(F32 left, F32 right, F32 bottom, F32 top, F32 nearVal, F32 farVal) noexcept
void setGlobalYaw(const Angle::DEGREES< F32 > angle) noexcept
PROPERTY_RW(bool, frustumLocked, false)
void loadFromXML(const boost::property_tree::ptree &pt, std::string prefix="")
void setRotation(const Quaternion< F32 > &q) noexcept
Sets the camera's orientation.
static constexpr F32 DEFAULT_CAMERA_MOVE_SPEED
void clearReflection() noexcept
Clears the reflection plane specified (if any)
PROPERTY_RW(bool, movementLocked, false)
static void Update(U64 deltaTimeUS)
void setYaw(const Angle::DEGREES< F32 > angle) noexcept
U32 addUpdateListener(const CameraListener &f)
void move(F32 dx, F32 dy, F32 dz) noexcept
Moves the camera by the specified offsets in each direction.
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
static const char * fStops[]
static const char * cameraMode[]
const char * CameraModeToString(const Camera::Mode mode) noexcept
Camera::Mode StringToCameraMode(const string &name)
FStops StringToFStops(const string &name)
const char * FStopsToString(const FStops stop) noexcept
Handle console commands that start with a forward slash.
static constexpr F32 g_FStopValues[to_base(FStops::COUNT)]
DELEGATE_STD< Ret, Args... > DELEGATE
hashMap< U32, CameraListener > CameraListenerMap
static const vec3< F32 > WORLD_Z_AXIS
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
static const vec4< F32 > VECTOR4_UNIT
DELEGATE< void, const Camera & > CameraListener
static const vec3< F32 > VECTOR3_ZERO
static const vec3< F32 > WORLD_Y_AXIS
constexpr auto to_base(const Type value) -> Type