Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Renderable.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Graphics module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_RENDERABLE_HPP
8 #define NAZARA_RENDERABLE_HPP
9 
10 #include <Nazara/Graphics/Config.hpp>
11 #include <Nazara/Math/BoundingVolume.hpp>
12 #include <Nazara/Math/Frustum.hpp>
13 #include <Nazara/Math/Matrix4.hpp>
14 
15 namespace Nz
16 {
17  class AbstractRenderQueue;
18 
19  class NAZARA_GRAPHICS_API Renderable
20  {
21  public:
22  Renderable() = default;
23  Renderable(const Renderable& renderable) = default;
24  Renderable(Renderable&&) = default;
25  virtual ~Renderable();
26 
27  virtual void AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix) const = 0;
28 
29  virtual bool Cull(const Frustumf& frustum, const Matrix4f& transformMatrix) const;
30 
31  inline void EnsureBoundingVolumeUpdated() const;
32  virtual const BoundingVolumef& GetBoundingVolume() const;
33  virtual void UpdateBoundingVolume(const Matrix4f& transformMatrix);
34 
35  Renderable& operator=(const Renderable& renderable) = default;
36  Renderable& operator=(Renderable&& renderable) = default;
37 
38  protected:
39  virtual void MakeBoundingVolume() const = 0;
40  inline void InvalidateBoundingVolume();
41 
42  mutable BoundingVolumef m_boundingVolume;
43 
44  private:
45  inline void UpdateBoundingVolume() const;
46 
47  mutable bool m_boundingVolumeUpdated;
48  };
49 }
50 
51 #include <Nazara/Graphics/Renderable.inl>
52 
53 #endif // NAZARA_RENDERABLE_HPP
Math class that represents a frustum in the three dimensional vector space.
Definition: Frustum.hpp:24
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Graphics class that represents the rendering queue for our scene.
Definition: AbstractRenderQueue.hpp:26
Graphics class that represents a renderable element for our scene.
Definition: Renderable.hpp:19