|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Camera component driven by VR headset tracking. More...
#include <VrCameraComponent.h>
Public Member Functions | |
| VrCamera (Entities::Scene *owningScene, std::shared_ptr< Entities::SceneNode > sceneNode, Rendering::Headset *headset) | |
| ~VrCamera () override=default | |
| void | tick (double deltaTime) override |
| Called every frame if ticking is enabled. | |
| glm::mat4 | getEyeViewMatrix (size_t eyeIndex) const override |
| Gets the view matrix for a specific eye. Base returns getViewMatrix() for both (mono). | |
| glm::mat4 | getEyeProjectionMatrix (size_t eyeIndex) const override |
| Gets the projection matrix for a specific eye. Base returns getProjectionMatrix() for both (mono). | |
| Rendering::Headset * | getHeadset () const |
| Public Member Functions inherited from Engine::Components::Camera | |
| Camera (Entities::Scene *owningScene, std::shared_ptr< Entities::SceneNode > sceneNode, float fov=60.0f, float nearPlane=0.01f, float farPlane=1000.0f) | |
| Constructs a camera component with default parameters. | |
| ~Camera () override=default | |
| void | beginPlay () override |
| Called when the component is added to the scene or the game starts. | |
| void | endPlay () override |
| Called when the component is removed or the game ends. | |
| void | setActive (bool active) |
| Sets this camera as the active camera for rendering. | |
| bool | isActive () const |
| Checks if this camera is currently the active camera. | |
| virtual glm::mat4 | getViewMatrix () const |
| Gets the view matrix computed from the camera's world transform. | |
| virtual glm::mat4 | getProjectionMatrix () const |
| Gets the projection matrix based on FOV, aspect ratio, and clipping planes. | |
| glm::mat4 | getViewProjectionMatrix () const |
| Gets the combined view-projection matrix. | |
| void | setFov (float fov) |
| Sets the vertical field of view. | |
| float | getFov () const |
| Gets the vertical field of view. | |
| void | setAspectRatio (float aspectRatio) |
| Sets the aspect ratio (width / height) | |
| float | getAspectRatio () const |
| Gets the aspect ratio. | |
| void | setNearPlane (float nearPlane) |
| Sets the near clipping plane distance. | |
| float | getNearPlane () const |
| Gets the near clipping plane distance. | |
| void | setFarPlane (float farPlane) |
| Sets the far clipping plane distance. | |
| float | getFarPlane () const |
| Gets the far clipping plane distance. | |
| glm::vec3 | getWorldPosition () const |
| Gets the camera's world position from its scene node. | |
| glm::vec3 | getForwardVector () const |
| Gets the forward direction vector of the camera. | |
| glm::vec3 | getRightVector () const |
| Gets the right direction vector of the camera. | |
| glm::vec3 | getUpVector () const |
| Gets the up direction vector of the camera. | |
| std::shared_ptr< Entities::SceneNode > | getSceneNode () const |
| Gets the scene node associated with this camera. | |
| Public Member Functions inherited from Engine::Components::Logic | |
| Logic (Entities::Scene *owningScene) | |
| virtual | ~Logic ()=default |
| virtual std::string | getComponentName () const |
| Gets the component type name for debugging/UI. | |
| bool | hasBegunPlay () const |
| bool | canTick () const |
| Checks if the component is currently set to tick. | |
| void | setCanTick (bool enable) |
| Enables or disables ticking for this component. | |
| Entities::Entity * | getOwningEntity () const |
| Gets the entity this component belongs to. | |
Static Public Attributes | |
| static constexpr bool | IsUnique = true |
| static constexpr const char * | ComponentName = "VrCamera" |
| Static Public Attributes inherited from Engine::Components::Camera | |
| static constexpr bool | IsUnique = true |
| static constexpr const char * | ComponentName = "Camera" |
| Static Public Attributes inherited from Engine::Components::Logic | |
| static constexpr bool | IsUnique = false |
| Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique = true; if needed. | |
| static constexpr const char * | ComponentName = "Logic" |
| Fallback component type name. Derived classes may override getComponentName() for custom labels. | |
Private Attributes | |
| Rendering::Headset * | headset_ = nullptr |
Additional Inherited Members | |
| Protected Member Functions inherited from Engine::Components::Logic | |
| Entities::Scene * | getScene () const |
| Gets the scene this component belongs to. | |
| Core::SceneManager * | getSceneManager () const |
| Helper to get the SceneManager from the owning scene. | |
Camera component driven by VR headset tracking.
Each frame, reads headset orientation from OpenXR and writes it to the SceneNode. Provides per-eye view and projection matrices that incorporate IPD offsets from the headset.
Locomotion (player world position) is handled externally — typically by VrMovementComponent writing to the same actor's SceneNode.
Definition at line 21 of file VrCameraComponent.h.
| Engine::Components::VrCamera::VrCamera | ( | Entities::Scene * | owningScene, |
| std::shared_ptr< Entities::SceneNode > | sceneNode, | ||
| Rendering::Headset * | headset ) |
|
overridedefault |
|
nodiscardoverridevirtual |
Gets the projection matrix for a specific eye. Base returns getProjectionMatrix() for both (mono).
| eyeIndex | 0 = left eye, 1 = right eye |
Reimplemented from Engine::Components::Camera.
|
nodiscardoverridevirtual |
Gets the view matrix for a specific eye. Base returns getViewMatrix() for both (mono).
| eyeIndex | 0 = left eye, 1 = right eye |
Reimplemented from Engine::Components::Camera.
|
inlinenodiscard |
Definition at line 37 of file VrCameraComponent.h.
References headset_.
|
overridevirtual |
Called every frame if ticking is enabled.
| deltaTime | Time elapsed since last frame. |
Reimplemented from Engine::Components::Camera.
|
staticconstexpr |
Definition at line 24 of file VrCameraComponent.h.
|
private |
Definition at line 40 of file VrCameraComponent.h.
Referenced by getHeadset().
|
staticconstexpr |
Definition at line 23 of file VrCameraComponent.h.