7 #ifndef NAZARA_INSTANCEDRENDERABLE_HPP 8 #define NAZARA_INSTANCEDRENDERABLE_HPP 10 #include <Nazara/Core/ObjectLibrary.hpp> 11 #include <Nazara/Core/ObjectRef.hpp> 12 #include <Nazara/Core/RefCounted.hpp> 13 #include <Nazara/Core/Signal.hpp> 14 #include <Nazara/Graphics/Config.hpp> 15 #include <Nazara/Graphics/CullingList.hpp> 16 #include <Nazara/Graphics/Material.hpp> 17 #include <Nazara/Math/BoundingVolume.hpp> 18 #include <Nazara/Math/Frustum.hpp> 19 #include <Nazara/Math/Matrix4.hpp> 23 class AbstractRenderQueue;
24 class InstancedRenderable;
26 using InstancedRenderableConstRef = ObjectRef<const InstancedRenderable>;
27 using InstancedRenderableLibrary = ObjectLibrary<InstancedRenderable>;
28 using InstancedRenderableRef = ObjectRef<InstancedRenderable>;
40 virtual void AddToRenderQueue(
AbstractRenderQueue* renderQueue,
const InstanceData& instanceData)
const = 0;
42 virtual bool Cull(
const Frustumf& frustum,
const InstanceData& instanceData)
const;
44 inline void EnsureBoundingVolumeUpdated()
const;
48 inline const MaterialRef& GetMaterial(std::size_t matIndex = 0)
const;
49 inline const MaterialRef& GetMaterial(std::size_t skinIndex, std::size_t matIndex)
const;
50 inline std::size_t GetMaterialCount()
const;
51 inline std::size_t GetSkin()
const;
52 inline std::size_t GetSkinCount()
const;
54 virtual void InvalidateData(InstanceData* instanceData, UInt32 flags)
const;
56 inline void SetSkin(std::size_t skinIndex);
57 inline void SetSkinCount(std::size_t skinCount);
59 virtual void UpdateBoundingVolume(InstanceData* instanceData)
const;
60 virtual void UpdateData(InstanceData* instanceData)
const;
70 NazaraSignal(OnInstancedRenderableResetMaterials,
const InstancedRenderable* , std::size_t );
75 InstanceData(
const Matrix4f& transformationMatrix) :
76 localMatrix(transformationMatrix),
81 InstanceData(InstanceData&& instanceData) noexcept =
default;
83 InstanceData& operator=(InstanceData&& instanceData) noexcept
85 data = std::move(instanceData.data);
86 flags = instanceData.flags;
87 renderOrder = instanceData.renderOrder;
88 localMatrix = instanceData.localMatrix;
89 transformMatrix = instanceData.transformMatrix;
90 volume = instanceData.volume;
95 std::vector<UInt8> data;
104 inline void InvalidateBoundingVolume();
105 inline void InvalidateInstanceData(UInt32 flags);
107 virtual void MakeBoundingVolume()
const = 0;
109 inline void ResetMaterials(std::size_t matCount, std::size_t skinCount = 1);
111 inline void SetMaterial(std::size_t matIndex,
MaterialRef material);
112 inline void SetMaterial(std::size_t skinIndex, std::size_t matIndex,
MaterialRef material);
117 inline void UpdateBoundingVolume()
const;
119 std::size_t m_matCount;
121 std::size_t m_skinCount;
122 std::vector<MaterialRef> m_materials;
123 mutable bool m_boundingVolumeUpdated;
125 static InstancedRenderableLibrary::LibraryMap s_library;
129 #include <Nazara/Graphics/InstancedRenderable.inl> 131 #endif // NAZARA_INSTANCEDRENDERABLE_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 an instancer renderable.
Definition: InstancedRenderable.hpp:30
Core class that represents a reference with a counter.
Definition: RefCounted.hpp:21