2019-05-30 19:51:20 +08:00
|
|
|
|
#ifndef HGL_GRAPH_MATERIAL_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_MATERIAL_INCLUDE
|
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
#include<hgl/graph/MaterialData.h>
|
2019-05-30 19:51:20 +08:00
|
|
|
|
namespace hgl
|
|
|
|
|
{
|
|
|
|
|
namespace graph
|
|
|
|
|
{
|
2020-01-08 21:52:53 +08:00
|
|
|
|
class Material
|
2019-05-30 19:51:20 +08:00
|
|
|
|
{
|
2020-01-08 21:52:53 +08:00
|
|
|
|
};//
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
enum class MaterialBlendMode
|
|
|
|
|
{
|
|
|
|
|
Opaque=0,
|
|
|
|
|
Mask,
|
|
|
|
|
Alpha,
|
|
|
|
|
Additive,
|
|
|
|
|
Modulate,
|
|
|
|
|
PreMultiAlpha, //预计算好一半的Alpha
|
|
|
|
|
|
|
|
|
|
BEGIN_RANGE =Opaque,
|
|
|
|
|
END_RANGE =PreMultiAlpha,
|
|
|
|
|
RANGE_SIZE =END_RANGE-BEGIN_RANGE+1
|
|
|
|
|
};//
|
|
|
|
|
|
|
|
|
|
enum class MaterialComponent
|
2019-05-30 19:51:20 +08:00
|
|
|
|
{
|
2020-01-08 21:52:53 +08:00
|
|
|
|
Color=0,
|
|
|
|
|
Normal,
|
|
|
|
|
Tangent,
|
2019-06-06 18:19:41 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
Metallic,
|
|
|
|
|
Roughness,
|
|
|
|
|
Emissive,
|
|
|
|
|
Specular,
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
Anisotropy,
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
Opacity,
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
SubsurfaceColor,
|
|
|
|
|
AmbientOcclusion,
|
|
|
|
|
Refraction,
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
Rotation,
|
|
|
|
|
IOR,
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
ShadingModel,
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
BEGIN_RANGE =Opaque,
|
|
|
|
|
END_RANGE =ShadingModel,
|
|
|
|
|
RANGE_SIZE =END_RANGE-BEGIN_RANGE+1,
|
|
|
|
|
};//
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
enum class MaterialComponentBit
|
|
|
|
|
{
|
|
|
|
|
#define MC_BIT_DEFINE(name) name=1<<MaterialComponent::name
|
|
|
|
|
MC_BIT_DEFINE(Color ),
|
|
|
|
|
MC_BIT_DEFINE(Normal ),
|
|
|
|
|
MC_BIT_DEFINE(Tangent ),
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(Metallic ),
|
|
|
|
|
MC_BIT_DEFINE(Roughness ),
|
|
|
|
|
MC_BIT_DEFINE(Emissive ),
|
|
|
|
|
MC_BIT_DEFINE(Specular ),
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(Anisotropy ),
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(Opacity ),
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(SubsurfaceColor ),
|
|
|
|
|
MC_BIT_DEFINE(AmbientOcclusion ),
|
|
|
|
|
MC_BIT_DEFINE(Refraction ),
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(Rotation ),
|
|
|
|
|
MC_BIT_DEFINE(IOR ),
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
MC_BIT_DEFINE(ShadingModel )
|
|
|
|
|
};//enum class MaterialComponentBit
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
using MCB=MaterialComponentBit;
|
2019-05-31 19:03:25 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
using MaterialComponentConfig=uint32;
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
constexpr MaterialComponentConfig MC_PureColor =MCB::Color;
|
|
|
|
|
constexpr MaterialComponentConfig MC_ColorNormal =MCB::Color|MCB::Normal;
|
|
|
|
|
constexpr MaterialComponentConfig MC_PBR =MCB::Color|MCB::Normal|MCB::Metallic|MCB::Roughness;
|
2019-05-30 19:51:20 +08:00
|
|
|
|
|
2020-01-08 21:52:53 +08:00
|
|
|
|
class Material
|
|
|
|
|
{
|
|
|
|
|
MaterialBlendMode blend_mode;
|
|
|
|
|
MaterialComponentConfig component_config;
|
|
|
|
|
};//class Material
|
2019-05-30 19:51:20 +08:00
|
|
|
|
}//namespace graph
|
|
|
|
|
}//namespace hgl
|
2020-01-08 21:52:53 +08:00
|
|
|
|
#endif//HGL_GRAPH_MATERIAL_INCLUDE
|