18 enum SMaterialMode { NORMAL = 0, DEFERRED = 1, DEPTH_ONLY = 2 };
22 SType type = SType::UNKNOWN;
23 std::vector<std::string> valueStr;
27 std::function<void()> attachFunc =
nullptr;
30 typedef std::unordered_map<std::string, Element*> ElementsMap;
38 void Exterminate()
override;
40 void AttachElement()
const;
42 void InitElements(
const ElementsMap& elements,
SShaderGroup* shaders);
44 void SetInt(
const std::string& name,
int value);
46 void SetFloat(
const std::string& name,
float value);
48 void SetVec3(
const std::string& name,
const vec3& value);
50 void SetTexture(
const std::string& name,
SResource* texture);
52 short GetOrderLayer()
const;
54 void SetOrderLayer(
int orderLayer);
56 SMaterialMode GetMode()
const;
58 void SetMode(SMaterialMode mode);
62 int GetTextureCount()
const;
64 std::string PrintMaterial()
const;
72 void ReleaseElements();
74 void SetBindFuncByType(Element* element);
76 static void SetIntFunc(Element* element,
int value);
77 static void SetFloatFunc(Element* element,
float value);
78 static void SetBoolFunc(Element* element,
bool value);
80 static void SetMat4Func(Element* element,
mat4 value);
81 static void SetMat3Func(Element* element,
mat3 value);
82 static void SetMat2Func(Element* element,
mat2 value);
83 static void SetVec4Func(Element* element,
vec4 value);
84 static void SetVec3Func(Element* element,
vec3 value);
85 static void SetVec2Func(Element* element,
vec2 value);
87 void SetTextureFunc(Element* element,
SResource* texture);
91 short m_orderLayer = 5000;
93 ElementsMap m_elements;
94 mutable int m_textureLayout = 0;
95 int m_textureCount = 0;
96 SMaterialMode m_mode = NORMAL;
100 std::string m_refHash;