ULRE/inc/hgl/graph/Material.h

91 lines
2.1 KiB
C++

#ifndef HGL_GRAPH_MATERIAL_INCLUDE
#define HGL_GRAPH_MATERIAL_INCLUDE
#include<hgl/graph/TextureType.h>
#include<hgl/type/Color4f.h>
namespace hgl
{
namespace graph
{
struct MaterialTextureData
{
TextureType type=TextureType::None;
int32 tex_id=-1;
uint8 uvindex=0;
float blend=0;
uint8 op=0;
uint8 wrap_mode[2]={0,0};
};//struct MaterialTextureData
struct MaterialData
{
uint8 tex_count;
MaterialTextureData *tex_list;
Set<int> uv_use;
bool two_sided=false;
uint shading_model=0;
bool wireframe=false;
uint blend_func;
float opacity; ///<透明度
uint transparency_factor;
float bump_scaling;
float shininess;
float reflectivity; ///<反射率
float shininess_strength;
float refracti; ///<折射率
Color4f diffuse;
Color4f ambient;
Color4f specular;
Color4f emission;
Color4f transparent; ///<透明色
Color4f reflective; ///<反射颜色
public:
MaterialData()
{
tex_count=0;
tex_list=nullptr;
}
void InitDefaultColor()
{
diffuse.Set(1,1,1,1);
specular.Set(0,0,0,1);
ambient.Set(0.2,0.2,0.2,1.0f);
emission.Set(0,0,0,1);
shininess=0;
opacity=1.0f;
refracti=0;
transparent.Set(0,0,0,1);
reflective.Set(1,1,1,1);
}
void Init(const uint32 tc)
{
tex_count=tc;
tex_list=new MaterialTextureData[tc];
}
~MaterialData()
{
delete[] tex_list;
}
};//struct MaterialData
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_MATERIAL_INCLUDE