Aether3D Game Engine
SpriteRendererComponent.hpp
1 #ifndef SPRITE_RENDERER_COMPONENT_H
2 #define SPRITE_RENDERER_COMPONENT_H
3 
4 #include <type_traits>
5 #include <string>
6 
7 namespace ae3d
8 {
11  {
12  public:
15 
18 
21 
24 
26  std::string GetSerialized() const;
27 
29  void Clear();
30 
42  void SetTexture( const class TextureBase* texture, const struct Vec3& position, const Vec3& dimensionPixels, const struct Vec4& tintColor );
43 
44  private:
45  friend class GameObject;
46  friend class Scene;
47 
48  /* \return Component's type code. Must be unique for each component type. */
49  static int Type() { return 1; }
50 
51  /* \return Component handle that uniquely identifies the instance. */
52  static unsigned New();
53 
54  /* \return Component at index or null if index is invalid. */
55  static SpriteRendererComponent* Get( unsigned index );
56 
57  /* \param projectionModelMatrix Projection and model matrix combined. */
58  void Render( const float* projectionModelMatrix );
59 
60  struct Impl;
61  Impl& m() { return reinterpret_cast<Impl&>(_storage); }
62  Impl const& m() const { return reinterpret_cast<Impl const&>(_storage); }
63 
64  static const std::size_t StorageSize = 1384;
65  static const std::size_t StorageAlign = 16;
66 
67  std::aligned_storage<StorageSize, StorageAlign>::type _storage;
68  };
69 }
70 #endif
SpriteRendererComponent()
Constructor.
Definition: AudioClip.hpp:4
4-component vector.
Definition: Vec3.hpp:351
void Clear()
Removes all textures that were added using SetTexture.
std::string GetSerialized() const
void SetTexture(const class TextureBase *texture, const struct Vec3 &position, const Vec3 &dimensionPixels, const struct Vec4 &tintColor)
3-component vector.
Definition: Vec3.hpp:12
~SpriteRendererComponent()
Destructor.
GameObject is composed of components that define its behavior.
Definition: GameObject.hpp:9
SpriteRendererComponent & operator=(const SpriteRendererComponent &other)
Renders sprites.
Definition: SpriteRendererComponent.hpp:10
Contains game objects in a transform hierarchy.
Definition: Scene.hpp:16
Base class for textures.
Definition: TextureBase.hpp:47