7 #ifndef NAZARA_MATERIALPIPELINE_HPP 8 #define NAZARA_MATERIALPIPELINE_HPP 10 #include <Nazara/Prerequesites.hpp> 11 #include <Nazara/Graphics/Config.hpp> 12 #include <Nazara/Graphics/Enums.hpp> 13 #include <Nazara/Renderer/RenderPipeline.hpp> 14 #include <Nazara/Renderer/UberShader.hpp> 19 struct MaterialPipelineInfo : RenderStates
21 bool alphaTest =
false;
22 bool depthSorting =
false;
23 bool hasAlphaMap =
false;
24 bool hasDiffuseMap =
false;
25 bool hasEmissiveMap =
false;
26 bool hasHeightMap =
false;
27 bool hasNormalMap =
false;
28 bool hasSpecularMap =
false;
29 bool reflectionMapping =
false;
30 bool shadowReceive =
true;
32 UberShaderConstRef uberShader;
35 inline bool operator==(
const MaterialPipelineInfo& lhs,
const MaterialPipelineInfo& rhs);
36 inline bool operator!=(
const MaterialPipelineInfo& lhs,
const MaterialPipelineInfo& rhs);
38 class MaterialPipeline;
40 using MaterialPipelineConstRef = ObjectRef<const MaterialPipeline>;
41 using MaterialPipelineLibrary = ObjectLibrary<MaterialPipeline>;
42 using MaterialPipelineRef = ObjectRef<MaterialPipeline>;
47 friend MaterialPipelineLibrary;
56 inline const Instance&
Apply(UInt32 flags = ShaderFlags_None)
const;
61 inline const MaterialPipelineInfo& GetInfo()
const;
62 inline const Instance& GetInstance(UInt32 flags = ShaderFlags_None)
const;
68 RenderPipeline renderPipeline;
69 UberShaderInstance* uberInstance =
nullptr;
70 std::array<int, MaterialUniform_Max + 1> uniforms;
76 void GenerateRenderPipeline(UInt32 flags)
const;
78 static bool Initialize();
80 static void Uninitialize();
82 MaterialPipelineInfo m_pipelineInfo;
83 mutable std::array<Instance, ShaderFlags_Max + 1> m_instances;
85 using PipelineCache = std::unordered_map<MaterialPipelineInfo, MaterialPipelineRef>;
86 static PipelineCache s_pipelineCache;
88 static MaterialPipelineLibrary::LibraryMap s_library;
92 #include <Nazara/Graphics/MaterialPipeline.inl> 94 #endif // NAZARA_MATERIALPIPELINE_HPP TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Graphics class that represents the module initializer of Graphics.
Definition: Graphics.hpp:15
bool operator!=(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1503
decltype(auto) Apply(F &&fn, Tuple &&t)
Applies the tuple to the function (e.g. calls the function using the tuple content as arguments) ...
Definition: Algorithm.inl:48
Core class that represents a reference with a counter.
Definition: RefCounted.hpp:21
Core class that represents a reference to an object.
Definition: ObjectRef.hpp:18
Graphics class used to contains all rendering states that are not allowed to change individually on r...
Definition: MaterialPipeline.hpp:44
bool operator==(const Bitset< Block, Allocator > &lhs, const Nz::Bitset< Block, Allocator > &rhs)
Compares two bitsets.
Definition: Bitset.inl:1469