Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Billboard.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_BILLBOARD_HPP
8 #define NAZARA_BILLBOARD_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Graphics/InstancedRenderable.hpp>
12 #include <Nazara/Graphics/Material.hpp>
13 
14 namespace Nz
15 {
16  class Billboard;
17 
18  using BillboardConstRef = ObjectRef<const Billboard>;
19  using BillboardLibrary = ObjectLibrary<Billboard>;
20  using BillboardRef = ObjectRef<Billboard>;
21 
22  class NAZARA_GRAPHICS_API Billboard : public InstancedRenderable
23  {
24  public:
25  inline Billboard();
26  inline Billboard(MaterialRef material);
27  inline Billboard(Texture* texture);
28  inline Billboard(const Billboard& billboard);
29  Billboard(Billboard&&) = delete;
30  ~Billboard() = default;
31 
32  void AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const override;
33 
34  inline const Color& GetColor() const;
35  inline float GetRotation() const;
36  inline const Vector2f& GetSize() const;
37 
38  inline void SetColor(const Color& color);
39  inline void SetDefaultMaterial();
40  inline void SetMaterial(MaterialRef material, bool resizeBillboard = true);
41  inline void SetMaterial(std::size_t skinIndex, MaterialRef material, bool resizeBillboard = true);
42  inline void SetRotation(float rotation);
43  inline void SetSize(const Vector2f& size);
44  inline void SetSize(float sizeX, float sizeY);
45  inline void SetTexture(TextureRef texture, bool resizeBillboard = true);
46  inline void SetTexture(std::size_t skinIndex, TextureRef texture, bool resizeBillboard = true);
47 
48  inline Billboard& operator=(const Billboard& billboard);
49  Billboard& operator=(Billboard&&) = delete;
50 
51  template<typename... Args> static BillboardRef New(Args&&... args);
52 
53  private:
54  void MakeBoundingVolume() const override;
55 
56  Color m_color;
57  Vector2f m_sinCos;
58  Vector2f m_size;
59  float m_rotation;
60 
61  static BillboardLibrary::LibraryMap s_library;
62  };
63 }
64 
65 #include <Nazara/Graphics/Billboard.inl>
66 
67 #endif // NAZARA_BILLBOARD_HPP
Core class that represents a color.
Definition: Color.hpp:18
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Graphics class that represents a billboard, a 2D surface which simulates a 3D object.
Definition: Billboard.hpp:22
Graphics class that represents the rendering queue for our scene.
Definition: AbstractRenderQueue.hpp:26
Graphics class that represents an instancer renderable.
Definition: InstancedRenderable.hpp:30