Lugdunum  0.1.0
Camera.cpp
Go to the documentation of this file.
2 
6 
7 namespace lug {
8 namespace Graphics {
9 namespace Render {
10 namespace Camera {
11 
12 Camera::Camera(const std::string& name) : Resource(Resource::Type::Camera, name) {}
13 
14 void Camera::lookAt(const Math::Vec3f& targetPosition, const Math::Vec3f& up, Node::TransformSpace space) {
15  if (_parent) {
16  _parent->lookAt(targetPosition, {0.0f, 0.0f, -1.0f}, up, space);
17  } else {
18  LUG_LOG.warn("Camera: Attempt to use lookAt on a Camera without parent");
19  }
20 }
21 
22 void Camera::update(const Renderer& renderer, const ::lug::Graphics::Render::View& renderView, Queue& renderQueue) {
23  if (_parent) {
24  _parent->getScene().fetchVisibleObjects(renderer, renderView, *this, renderQueue);
25  }
26 }
27 
29  _viewMatrix = _parent->getTransform().inverse();
30  _needUpdateView = false;
31 }
32 
33 } // Camera
34 } // Render
35 } // Graphics
36 } // lug
Class for resource.
Definition: Resource.hpp:17
#define LUG_LOG
Definition: Logger.hpp:73
void lookAt(const Math::Vec3f &targetPosition, const Math::Vec3f &up, Node::TransformSpace space=Node::TransformSpace::Local)
Definition: Camera.cpp:14
void update(const Renderer &renderer, const View &renderView, Queue &renderQueue)
Update the render queue of the Camera by fetching the visible objects of the attached scene...
Definition: Camera.cpp:22
Type
Type of the resource.
Definition: Resource.hpp:24
const Math::Mat4x4f & getTransform()
Definition: Node.inl:38
void lookAt(const Math::Vec3f &targetPosition, const Math::Vec3f &localDirectionVector, const Math::Vec3f &localUpVector, TransformSpace space=TransformSpace::Local)
Rotates the node in order to look at the target position.
Definition: Node.cpp:154
void fetchVisibleObjects(const Renderer &renderer, const Render::View &renderView, const Render::Camera::Camera &camera, Render::Queue &renderQueue) const
Definition: Scene.cpp:27