18 enum SMaterialMode { FORWARD = 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 int AttachElement(
int textureLayout)
const;
42 SMaterial::Element* GetElement(
const std::string& key)
const;
44 const ElementsMap& GetElements()
const {
48 void InitElements(
const ElementsMap& elements,
SShaderGroup* shaders);
50 void SetInt(
const std::string& name,
int value);
52 void SetFloat(
const std::string& name,
float value);
54 void SetVec3(
const std::string& name,
const vec3& value);
56 void SetTexture(
const std::string& name,
SResource* texture);
58 void SetRawData(
const std::string& name, std::vector<std::string> raw);
60 short GetOrderLayer()
const;
62 void SetOrderLayer(
int orderLayer);
64 SMaterialMode GetMode()
const;
66 void SetMode(SMaterialMode mode);
70 int GetTextureCount()
const;
72 std::string PrintMaterial()
const;
76 void SetValue(std::string name_str, Arguments value)
override;
78 std::string PrintValue()
const override;
84 void ReleaseElements();
86 void SetBindFuncByType(Element* element);
88 static void SetIntFunc(Element* element,
int value);
89 static void SetFloatFunc(Element* element,
float value);
90 static void SetBoolFunc(Element* element,
bool value);
92 static void SetMat4Func(Element* element,
mat4 value);
93 static void SetMat3Func(Element* element,
mat3 value);
94 static void SetMat2Func(Element* element,
mat2 value);
95 static void SetVec4Func(Element* element,
vec4 value);
96 static void SetVec3Func(Element* element,
vec3 value);
97 static void SetVec2Func(Element* element,
vec2 value);
99 void SetTextureFunc(Element* element,
SResource* texture);
103 short m_orderLayer = 5000;
105 ElementsMap m_elements;
106 mutable int m_textureLayout = 0;
107 int m_textureCount = 0;
108 SMaterialMode m_mode = FORWARD;
112 std::string m_refHash;