add DataSource of material

This commit is contained in:
hyzboy 2020-01-09 18:22:18 +08:00
parent e77cb00e89
commit ac64f28e2f
3 changed files with 150 additions and 0 deletions

View File

@ -1,3 +1,16 @@
#ifndef HGL_GRAPH_COMBO_MATERIAL_INCLUDE #ifndef HGL_GRAPH_COMBO_MATERIAL_INCLUDE
#define HGL_GRAPH_COMBO_MATERIAL_INCLUDE #define HGL_GRAPH_COMBO_MATERIAL_INCLUDE
#include<hgl/graph/material/Material.h>
BEGIN_MATERIAL_NAMESPACE
/**
* <br>
*
*/
class ComboMaterial
{
};//class ComboMaterial
END_MATERIAL_NAMESPACE
#endif//HGL_GRAPH_COMBO_MATERIAL_INCLUDE #endif//HGL_GRAPH_COMBO_MATERIAL_INCLUDE

View File

@ -70,6 +70,23 @@ BEGIN_MATERIAL_NAMESPACE
Uint, Uint,
};// };//
enum class DataFormat
{
NONE=0,
#define MATERIAL_DATA_FORMAT_DEFINE(long_name,short_name,type) long_name =((uint(ComponentDataType)<<4)|1), \
vec##short_name##1 =((uint(ComponentDataType)<<4)|2), \
vec##short_name##2 =((uint(ComponentDataType)<<4)|3), \
vec##short_name##3 =((uint(ComponentDataType)<<4)|4),
MATERIAL_DATA_FORMAT_DEFINE(boolean,b,Bool ),
MATERIAL_DATA_FORMAT_DEFINE(float, f,Float ),
MATERIAL_DATA_FORMAT_DEFINE(int, i,Int ),
MATERIAL_DATA_FORMAT_DEFINE(uint, u,Uint ),
#undef MATERIAL_DATA_FORMAT_DEFINE
};
using ComponentBitsConfig=uint32; using ComponentBitsConfig=uint32;
constexpr ComponentBitsConfig MCC_PureColor =uint32(ComponentBit::Color); constexpr ComponentBitsConfig MCC_PureColor =uint32(ComponentBit::Color);

View File

@ -0,0 +1,120 @@
#ifndef HGL_GRAPH_MATERIAL_DATA_SOURCE_INCLUDE
#define HGL_GRAPH_MATERIAL_DATA_SOURCE_INCLUDE
#include<hgl/graph/material/Material.h>
#include<hgl/type/BaseString.h>
BEGIN_MATERIAL_NAMESPACE
/**
*
*/
class DataSource
{
DataFormat format;
public:
DataSource()
{
format=DataFormat::NONE;
}
DataSource(const DataFormat &df)
{
format=df;
}
virtual ~DataSource()=default;
virtual bool SetX(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetY(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetZ(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetW(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetXY(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetYZ(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetZW(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetXYZ(UTF8String &,const UTF8String &)const{return false;}
virtual bool SetXYZW(UTF8String &,const UTF8String &)const{return false;}
bool SetR(UTF8String &result,const UTF8String &str)const{return this->SetX(result,str);}
bool SetG(UTF8String &result,const UTF8String &str)const{return this->SetY(result,str);}
bool SetB(UTF8String &result,const UTF8String &str)const{return this->SetZ(result,str);}
bool SetA(UTF8String &result,const UTF8String &str)const{return this->SetW(result,str);}
bool SetRG(UTF8String &result,const UTF8String &str)const{return this->SetXY(result,str);}
bool SetGB(UTF8String &result,const UTF8String &str)const{return this->SetYZ(result,str);}
bool SetBA(UTF8String &result,const UTF8String &str)const{return this->SetZW(result,str);}
bool SetRGB(UTF8String &result,const UTF8String &str)const{return this->SetXYZ(result,str);}
bool SetRGBA(UTF8String &result,const UTF8String &str)const{return this->SetXYZW(result,str);}
virtual bool GetX(UTF8String &)const{return false;}
virtual bool GetY(UTF8String &)const{return false;}
virtual bool GetZ(UTF8String &)const{return false;}
virtual bool GetW(UTF8String &)const{return false;}
virtual bool GetXY(UTF8String &)const{return false;}
virtual bool GetYZ(UTF8String &)const{return false;}
virtual bool GetZW(UTF8String &)const{return false;}
virtual bool GetXYZ(UTF8String &)const{return false;}
virtual bool GetXYZW(UTF8String &)const{return false;}
bool GetR(UTF8String &result)const{return this->GetX(result);}
bool GetG(UTF8String &result)const{return this->GetY(result);}
bool GetB(UTF8String &result)const{return this->GetZ(result);}
bool GetA(UTF8String &result)const{return this->GetW(result);}
bool GetRG(UTF8String &result)const{return this->GetXY(result);}
bool GetGB(UTF8String &result)const{return this->GetYZ(result);}
bool GetBA(UTF8String &result)const{return this->GetZW(result);}
bool GetRGB(UTF8String &result)const{return this->GetXYZ(result);}
bool GetRGBA(UTF8String &result)const{return this->GetXYZW(result);}
};//class DataSource
/**
*
*/
class DataSourceConst:public DataSource
{
};//class DataSourceConst:public DataSource
/**
* Uniform数据源
*/
class DataSourceUniform:public DataSource
{
};//class DataSourceUniform:public DataSource
/**
*
*/
class DataSourceTexture:public DataSource
{
};//class DataSourceTexture:public DataSource
class DataSourceTexture1D:public DataSourceTexture
{
};//class DataSourceTexture1D:public DataSourceTexture
class DataSourceTexture2D:public DataSourceTexture
{
};//class DataSourceTexture2D:public DataSourceTexture
class DataSourceTexture2DArrays:public DataSourceTexture
{
};//class DataSourceTexture2DArrays:public DataSourceTexture
class DataSourceTextureCubemap:public DataSourceTexture
{
};//class DataSourceTextureCubemap:public DataSourceTexture
class DataSourceTextureCubemapArrays:public DataSourceTexture
{
};//class DataSourceTextureCubemapArrays:public DataSourceTexture
END_MATERIAL_NAMESPACE
#endif//HGL_GRAPH_MATERIAL_DATA_SOURCE_INCLUDE