Namespace OmegaEngine.Graphics.Cameras
Cameras manage:
- Position and orientation - The camera's location and direction in 3D space
- Projection parameters - Field of view, near/far clipping planes, aspect ratio
- View frustum - Automatic calculation for culling objects outside the camera's view
- Input handling - Integration with input system for interactive camera control
You can pick from several built-in camera types to suit your needs.
Floating coordinate system
The positions of renderables, light sources, etc. are stored with 64-bit precision in OmegaEngine. However, they must be converted to 32-bit coordinates for rendering with DirectX. To mitigate the resulting loss of precision, OmegaEngine uses an internal floating coordinate system.
The origin of this coordinate system is defined by the camera's FloatingOrigin property. This value is subtracted from each 64-bit position before conversion to 32-bit and submission to DirectX.
Most camera types automatically adjust FloatingOrigin once the camera moves more than FloatingOriginMaxDistance units away from it. This keeps the coordinate origin close to the camera, ensuring higher precision for objects near the viewer.
Tip
To pick a suitable value for FloatingOriginMaxDistance, you can use this formula:
\(FloatingOriginMaxDistance=DesiredMaxError*2^{23}\)
For example, if 1 world unit corresponds to 1 meter and you want to achieve a precision of 1 millimeter:
\(FloatingOriginMaxDistance=0.001*2^{23}\approx8388\)
API
Classes
- ArcballCamera
A camera that orbits around a target point. Adjustable yaw, pitch, and roll. Panning the target respects the current yaw and roll.
Useful for building model viewers, character inspection screens, or turntable presentations.
- CloneCamera
A camera that imitates the perspective of another Camera.
- FirstPersonCamera
A camera that allows movement, yaw and pitch, but no roll. Movement in the XY-plane respects the current yaw but ignores the pitch (fixed "Up" vector).
Useful for building first-person or third-person games with ground-based movement.
- FreeFlyCamera
A camera with free 6-degrees-of-freedom movement (movement and rotation in all directions).
Useful for building tools, debugging, or games with free-flying movement (space sims, spectator modes).
- MatrixCamera
A camera that internally uses matrixes for representing rotations.
- QuaternionCamera
A camera that internally uses quaternions for representing rotations.
- ReflectCamera
A camera that reflects the perspective of another camera along a plane.
- StrategyCamera
An overhead camera that allows panning across the map, rotating, and zooming in/out. The pitch angle is automatically adjusted based on the zoom level.
Useful for building RTS games, tactical games, or top-down views.
- TransitionCamera
A camera that smoothly transitions between two camera states over time. Usually used via TransitionCameraTo(Camera, TransitionCameraOptions?).
Useful for cinematic camera movements or smooth transitions between different viewpoints.
- TransitionCameraOptions
Options controlling a camera transition.
- ZoomCamera
Common base class for cameras that support zooming.