ezEngine  Milestone 7
MaterialResource.h
1 #pragma once
2 
3 #include <Foundation/Containers/HashTable.h>
4 #include <Core/ResourceManager/Resource.h>
5 #include <RendererCore/Shader/ShaderResource.h>
6 
9 
11 {
13  {
14  ezHashedString m_Name;
15  ezHashedString m_Value;
16  };
17 
19  {
20  ezUInt32 m_NameHash;
21  ezVariant m_Value;
22  };
23 
25  {
26  ezUInt32 m_NameHash;
28  };
29 
30  void Clear()
31  {
32  m_hBaseMaterial.Invalidate();
33  m_hShader.Invalidate();
34  m_PermutationVars.Clear();
35  m_ShaderConstants.Clear();
36  m_TextureBindings.Clear();
37  }
38 
39  ezMaterialResourceHandle m_hBaseMaterial;
40  ezShaderResourceHandle m_hShader;
41  ezDynamicArray<PermutationVar> m_PermutationVars;
42  ezDynamicArray<ShaderConstant> m_ShaderConstants;
43  ezDynamicArray<TextureBinding> m_TextureBindings;
44 };
45 
46 class EZ_RENDERERCORE_DLL ezMaterialResource : public ezResource<ezMaterialResource, ezMaterialResourceDescriptor>
47 {
49 
50 public:
52 
53  EZ_FORCE_INLINE const ezMaterialResourceDescriptor& GetDescriptor()
54  {
55  return m_Desc;
56  }
57 
58 private:
59  virtual ezResourceLoadDesc UnloadData(Unload WhatToUnload) override;
60  virtual ezResourceLoadDesc UpdateContent(ezStreamReaderBase* Stream) override;
61  virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
62  virtual ezResourceLoadDesc CreateResource(const ezMaterialResourceDescriptor& descriptor) override;
63 
64 private:
66 };
67 
68