|
| | Camera (std::string name="Camera", Math::Vector3D Position=Math::Vector3D(0, 0, -3.5), float fov=60, float near=1.0f, float far=1000.0f) |
| void | AddDirection (const Math::Vector3D &direction) |
| void | AddLookTarget (const Math::Vector3D &target) |
| void | AddPosition (const Math::Vector3D &position) |
| Math::Vector3D | GetDirection () const |
| float | GetFarPlane () const |
| float | GetFieldOfView () const |
| Math::Vector3D | GetLookTarget () const |
| float | GetNearPlane () const |
| Math::Vector3D | GetPosition () const |
| ProjectionType | GetProjectionType () const |
| Math::Vector3D | GetUp () const |
| void | Initialize () override |
| | Initializes the object and its components; called once before the first Update.
|
| void | OnResize (uint32_t width, uint32_t height) |
| | Updates the viewport dimensions and recomputes the projection matrix.
|
| void | SetDirection (const Math::Vector3D &direction) |
| void | SetFarPlane (float farPlaneValue) |
| void | SetFieldOfView (float fov) |
| void | SetLookTarget (const Math::Vector3D &target) |
| void | SetNearPlane (float nearPlaneValue) |
| void | SetPosition (const Math::Vector3D &position) |
| void | SetProjectionType (ProjectionType type) |
| void | SetUp (const Math::Vector3D &up) |
| void | Update (float DeltaTime) override |
| | Recalculates the view/projection matrices and frustum while active.
|
| | GameObject (const std::string &name="GameObject") |
| | ~GameObject () override |
| void | AddChild (GameObject *child) |
| template<typename T, typename... Args> |
| void | AddComponent (Args &&... args) |
| | Constructs and attaches a component of type T. Warns and no-ops if one already exists.
|
| virtual void | FixedUpdate (float fixedDeltaTime) |
| const List< GameObject * > & | GetChildren () const |
| template<typename T> |
| T * | GetComponent () |
| | Finds the first attached component of type T, or nullptr.
|
| GameObject * | GetParent () const |
| const std::string & | GetTag () const |
| bool | HasChildren () const |
| template<typename T> |
| bool | HasComponent () |
| | True if a component of type T is attached.
|
| bool | HasParent () const |
| bool | IsActive () const |
| virtual bool | IsLight () const |
| bool | IsPendingDestroy () const |
| virtual void | LateUpdate (float deltaTime) |
| void | MarkForDestroy () |
| | Flags the object for deferred destruction on the next scene pass.
|
| void | RemoveChild (GameObject *child) |
| template<typename T> |
| void | RemoveComponent () |
| | Destroys and detaches the first component of type T, if present.
|
| void | SetActive (bool active) |
| | Enables or disables the object, firing OnEnable/OnDisable on its components.
|
| void | SetParent (GameObject *parent) |
| | Reparents this object, updating both the old and new parent's child lists.
|
| void | SetTag (const std::string &tag) |
| | Object (const std::string &name="Object") |
| virtual | ~Object ()=default |
| const std::string & | GetName () const |
| uint64_t | GetUniqueID () const |
| void | SetName (const std::string &value) |
|
| static const Math::Vector3D & | GetMainCameraPosition () |
| static const Math::Matrix4 & | GetMainProjectionMatrix () |
| static const ViewFrustum & | GetMainViewFrustum () |
| static const Math::Matrix4 & | GetMainViewMatrix () |
| static GameObject * | CreateCapsule (Math::Vector3D position, int segments=16, int rings=8, float height=1, float radius=0.5) |
| static GameObject * | CreateCube (Math::Vector3D position) |
| static GameObject * | CreateCylinder (Math::Vector3D position, int segments=16, float height=1, float radius=0.5) |
| static GameObject * | CreatePlane (Math::Vector3D position, int width=100, int height=100) |
| | Built-in primitive factories, mainly for prototyping and debug scenes.
|
| static GameObject * | CreateSphere (Math::Vector3D position, int stack=16, int slices=16) |
| static GameObject * | CreateTorus (Math::Vector3D position, int segments=16, int rings=8, float innerRadius=8, float outerRadius=9) |
GameObject that owns the engine's single active view/projection matrices and view frustum. Position/orientation come from CameraController subclasses.
Create one, add it to the scene, and call SceneBase::SetActiveCamera() so the renderer knows which view to draw from. Because Camera is a GameObject, it also carries components: attach a FreeLookCameraController for a debug or spectator view, or a FirstPersonController plus a ColliderComponent and RigidbodyComponent for a player character that collides with the world.
The view and projection matrices are static, shared state. The active camera rewrites them each Update() through GetMainViewMatrix(), GetMainProjectionMatrix(), GetMainCameraPosition(), and GetMainViewFrustum(), which is how the renderer and CullingSystem read the current view. Only one camera should be active at a time.
Orientation is expressed as a look target rather than a rotation. SetLookTarget() aims at a world point and SetDirection() aims along a vector; GetDirection() returns the normalized facing.
"MainCamera",
60.0f, 0.01f, 200.0f);
if (auto* ctrl =
ctrl->SetEnabled(true);
}
AddObject(cam);
SetActiveCamera(cam);
bool Initialize() override
Derives initial yaw/pitch from the camera's current facing direction.
- See also
- CameraController, FreeLookCameraController, FirstPersonController, ViewFrustum, CullingSystem
Definition at line 59 of file Camera.hpp.