ULRE/inc/hgl/graph/Material.h

98 lines
2.5 KiB
C
Raw Normal View History

#ifndef HGL_GRAPH_MATERIAL_INCLUDE
#define HGL_GRAPH_MATERIAL_INCLUDE
2020-01-08 21:52:53 +08:00
#include<hgl/graph/MaterialData.h>
namespace hgl
{
namespace graph
{
2020-01-08 21:52:53 +08:00
class Material
{
2020-01-08 21:52:53 +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
{
2020-01-08 21:52:53 +08:00
Color=0,
Normal,
Tangent,
2020-01-08 21:52:53 +08:00
Metallic,
Roughness,
Emissive,
Specular,
2020-01-08 21:52:53 +08:00
Anisotropy,
2020-01-08 21:52:53 +08:00
Opacity,
2020-01-08 21:52:53 +08:00
SubsurfaceColor,
AmbientOcclusion,
Refraction,
2020-01-08 21:52:53 +08:00
Rotation,
IOR,
2020-01-08 21:52:53 +08:00
ShadingModel,
2020-01-08 21:52:53 +08:00
BEGIN_RANGE =Opaque,
END_RANGE =ShadingModel,
RANGE_SIZE =END_RANGE-BEGIN_RANGE+1,
};//
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 ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(Metallic ),
MC_BIT_DEFINE(Roughness ),
MC_BIT_DEFINE(Emissive ),
MC_BIT_DEFINE(Specular ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(Anisotropy ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(Opacity ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(SubsurfaceColor ),
MC_BIT_DEFINE(AmbientOcclusion ),
MC_BIT_DEFINE(Refraction ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(Rotation ),
MC_BIT_DEFINE(IOR ),
2020-01-08 21:52:53 +08:00
MC_BIT_DEFINE(ShadingModel )
};//enum class MaterialComponentBit
2020-01-08 21:52:53 +08:00
using MCB=MaterialComponentBit;
2020-01-08 21:52:53 +08:00
using MaterialComponentConfig=uint32;
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;
2020-01-08 21:52:53 +08:00
class Material
{
MaterialBlendMode blend_mode;
MaterialComponentConfig component_config;
};//class Material
}//namespace graph
}//namespace hgl
2020-01-08 21:52:53 +08:00
#endif//HGL_GRAPH_MATERIAL_INCLUDE