diff options
author | chai <chaifix@163.com> | 2019-01-27 01:26:36 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-27 01:26:36 +0800 |
commit | 6c8788ed76e1ead173fdeb51caaa43d538fcfe21 (patch) | |
tree | 4ec71c3aca07d58d96574671f83f9750f901cb11 /Source/Asura.Engine/Graphics/Material.h | |
parent | 409262a6a26972770ba64728a60d45dd2d9fb752 (diff) |
*misc
Diffstat (limited to 'Source/Asura.Engine/Graphics/Material.h')
-rw-r--r-- | Source/Asura.Engine/Graphics/Material.h | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/Source/Asura.Engine/Graphics/Material.h b/Source/Asura.Engine/Graphics/Material.h deleted file mode 100644 index 68dfa1e..0000000 --- a/Source/Asura.Engine/Graphics/Material.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef __AE_MATERIAL_H__ -#define __AE_MATERIAL_H__ - -#include "Containers/Vector.hpp" -#include "Containers/String.h" -#include "Math/Vector2.h" -#include "Math/Vector3.h" -#include "Math/Vector4.h" -#include "Math/Matrix44.h" -#include "Scripting/Luax.hpp" - -#include "Shader.h" -#include "Texture.h" -#include "Manager.hpp" - -namespace AsuraEngine -{ - namespace Graphics - { - - class MaterialFactory; - - /// - /// ͨʵShaderеuniformsShaderĵı¶materialÿʿԲ컯ͬɫ - /// ͬͨļ(.mat)ʵ֣ڴáAsuraУShaderֱӦõȾ̶һ - /// ʹɲshaderuniformsmaterial䵱shaderĴ - /// - class Material final : public Filesystem::Asset - { - public: - - enum class UniformsType - { - None = 0, - Float, - Int, - Vector2, - Vector3, - Vector4, - Matrix44, - Texture, - Color, - }; - - struct UniformsInfo - { - uint ID; // uniformID - UniformsType type; // uniform - union - { - float f; - int i; - Math::Vector2 v2; - Math::Vector3 v3; - Math::Vector4 v4; - Math::Matrix44 m44; - Texture* tex; - Color col; - }value; // uniformֵ - }; - - void SetShader(Shader* shader); - - // UniformڲУȾʱϴGPU - - /// - /// uniformIDIDnamemapshader乲uniformֵʱͨIDѯuniform - /// shaderҵuniform locationlocationֵ - /// - static int GetUniformID(const Containers::String& name); - - void SetTexture(uint ID, Texture* texture); - void SetVector2(uint ID, Math::Vector2* vector2); - void SetVector3(uint ID, Math::Vector3* vector3); - void SetVector4(uint ID, Math::Vector4* vector4); - void SetMatrix44(uint ID, Math::Matrix44* matrix44); - void SetFloat(uint ID, float value); - void SetInteger(uint ID, int value); - void SetColor(uint ID, Color color); - - UniformsInfo GetUniformInfo(uint ID); - float GetUniformInfof(uint ID); - int GetUniformInfoi(uint ID); - Math::Vector2 GetUniformInfov2(uint ID); - Math::Vector3 GetUniformInfov3(uint ID); - Math::Vector4 GetUniformInfov4(uint ID); - Math::Matrix44 GetUniformInfom44(uint ID); - Texture* GetUniformInfotex(uint ID); - Color GetUniformInfocol(uint ID); - - // ϴ - - void SetVertexAttributes(); - - private: - - friend class MaterialFactory; - - Material(); - Material(const Material& src); - ~Material(); - - /// - /// - /// - uint mID; - - /// - /// - /// - Shader* mShader; - - /// - /// UniformsֵӳIDֵ - /// - Containers::Map<int, UniformsInfo> mUniforms; - - /// - /// ǷǹIJ - /// - bool mIsShared; - - //---------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Material); - - LUAX_DECL_METHOD(l_Clone); - - LUAX_DECL_METHOD(l_SetShader); - - LUAX_DECL_METHOD(l_SetTexture); - LUAX_DECL_METHOD(l_SetVector2); - LUAX_DECL_METHOD(l_SetVector3); - LUAX_DECL_METHOD(l_SetVector4); - LUAX_DECL_METHOD(l_SetMatrix44); - LUAX_DECL_METHOD(l_SetFloat); - LUAX_DECL_METHOD(l_SetInteger); - LUAX_DECL_METHOD(l_SetColor); - - LUAX_DECL_METHOD(l_GetUniformInfo); - LUAX_DECL_METHOD(l_GetUniformInfof); - LUAX_DECL_METHOD(l_GetUniformInfoi); - LUAX_DECL_METHOD(l_GetUniformInfov2); - LUAX_DECL_METHOD(l_GetUniformInfov3); - LUAX_DECL_METHOD(l_GetUniformInfov4); - LUAX_DECL_METHOD(l_GetUniformInfom44); - LUAX_DECL_METHOD(l_GetUniformInfotex); - LUAX_DECL_METHOD(l_GetUniformInfocol); - - LUAX_DECL_METHOD(l_SetVertexAttributes); - - }; - - class MaterialManager : public Manager - { - public: - - private: - - /// - /// еimage - /// - Containers::Map<uint, Material*> mMaterials; - - /// - /// image·IDӳ䡣Դ.asrimageͨ·õimageԲеimageڴmapС - /// ɳimageֻͨIDȡԳҪID - /// - Containers::StringMap<uint> mMaterialIDs; - - }; - - class MaterialFactory : public Factory - { - public: - - /// - /// һmaterial - /// - Material* Clone(Material* src); - - Material* Create(); - - }; - - } -} - -#endif
\ No newline at end of file |