1.delete MaterialData.h
2.add StandardMaterial and PBRMaterial
This commit is contained in:
parent
8e6f672505
commit
818946a7e7
@ -4,9 +4,9 @@ using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
using namespace hgl::graph::shader;
|
||||
|
||||
BEGIN_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_BEGIN
|
||||
bool CreateDefaultMaterial();
|
||||
END_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_END
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace hgl
|
||||
* 世界矩阵数据
|
||||
* @see res/shader/UBO_WorldMatrix.glsl
|
||||
*/
|
||||
struct alignas(4) WorldMatrix
|
||||
struct WorldMatrix
|
||||
{
|
||||
Matrix4f ortho; //2D正角视图矩阵
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/graph/material/Material.h>
|
||||
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 简易组合材质<br>
|
||||
* 提供最简单的材质定义方案
|
||||
@ -12,5 +12,5 @@ class ComboMaterial
|
||||
{
|
||||
|
||||
};//class ComboMaterial
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_COMBO_MATERIAL_INCLUDE
|
||||
|
@ -3,18 +3,18 @@
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
|
||||
#define BEGIN_MATERIAL_NAMESPACE namespace hgl{namespace graph{namespace material{
|
||||
#define END_MATERIAL_NAMESPACE }}}
|
||||
#define MATERIAL_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace material{
|
||||
#define MATERIAL_NAMESPACE_END }}}
|
||||
|
||||
#define MATERIAL_NAMESPACE hgl::graph::material
|
||||
#define USING_MATERIAL_NAMESPACE using namespace MATERIAL_NAMESPACE;
|
||||
#define MATERIAL_NAMESPACE_USING using namespace MATERIAL_NAMESPACE;
|
||||
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
enum class Component
|
||||
{
|
||||
ShadingModel=0,
|
||||
|
||||
Color,
|
||||
BaseColor,
|
||||
Mask,
|
||||
Opacity,
|
||||
Normal,
|
||||
@ -43,7 +43,7 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
#define MC_BIT_DEFINE(name) name=1<<(uint)Component::name
|
||||
MC_BIT_DEFINE(ShadingModel ),
|
||||
|
||||
MC_BIT_DEFINE(Color ),
|
||||
MC_BIT_DEFINE(BaseColor ),
|
||||
MC_BIT_DEFINE(Mask ),
|
||||
MC_BIT_DEFINE(Opacity ),
|
||||
MC_BIT_DEFINE(Normal ),
|
||||
@ -96,11 +96,11 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
|
||||
using ComponentBitsConfig=uint32;
|
||||
|
||||
constexpr ComponentBitsConfig MCC_PureColor =uint32(ComponentBit::Color);
|
||||
constexpr ComponentBitsConfig MCC_PureColor =uint32(ComponentBit::BaseColor);
|
||||
constexpr ComponentBitsConfig MCC_PureNormal =uint32(ComponentBit::Normal);
|
||||
constexpr ComponentBitsConfig MCC_PureOpacity =uint32(ComponentBit::Opacity);
|
||||
constexpr ComponentBitsConfig MCC_ColorNormal =uint32(ComponentBit::Color)|uint32(ComponentBit::Normal);
|
||||
constexpr ComponentBitsConfig MCC_CNMR =uint32(ComponentBit::Color)|uint32(ComponentBit::Normal)|uint32(ComponentBit::Metallic)|uint32(ComponentBit::Roughness);
|
||||
constexpr ComponentBitsConfig MCC_ColorNormal =uint32(ComponentBit::BaseColor)|uint32(ComponentBit::Normal);
|
||||
constexpr ComponentBitsConfig MCC_CNMR =uint32(ComponentBit::BaseColor)|uint32(ComponentBit::Normal)|uint32(ComponentBit::Metallic)|uint32(ComponentBit::Roughness);
|
||||
|
||||
struct ComponentConfig
|
||||
{
|
||||
@ -111,5 +111,5 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
};//struct ComponentConfig
|
||||
|
||||
const ComponentConfig *GetConfig(const enum class Component c);
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_MATERIAL_COMPONENT_INCLUDE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/material/Material.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
@ -54,12 +54,22 @@ public:
|
||||
/**
|
||||
* 函数数据源
|
||||
*/
|
||||
class DataSourceFunction:public DataSource
|
||||
{
|
||||
class DataSourceFunction:public DataSource
|
||||
{
|
||||
public:
|
||||
|
||||
using DataSource::DataSource;
|
||||
};//class DataSourceFunction:public DataSource
|
||||
};//class DataSourceFunction:public DataSource
|
||||
|
||||
/**
|
||||
* 顶点数据源
|
||||
*/
|
||||
class DataSourceVertex:public DataSource
|
||||
{
|
||||
public:
|
||||
|
||||
using DataSource::DataSource;
|
||||
};//class DataSourceVertex:public DataSource
|
||||
|
||||
/**
|
||||
* 纹理数据源
|
||||
@ -112,5 +122,5 @@ public:
|
||||
|
||||
using DataSourceTexture::DataSourceTexture;
|
||||
};//class DataSourceTextureCubemapArrays:public DataSourceTexture
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_MATERIAL_DATA_SOURCE_INCLUDE
|
||||
|
@ -2,13 +2,16 @@
|
||||
#define HGL_GRAPH_MATERIAL_INCLUDE
|
||||
|
||||
#include<hgl/graph/material/Component.h>
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
#include<hgl/type/BaseString.h>
|
||||
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
enum class BlendMode
|
||||
{
|
||||
Opaque=0,
|
||||
Mask,
|
||||
Alpha,
|
||||
Additive,
|
||||
Subtractive,
|
||||
Modulate,
|
||||
PreMultiAlpha, // 预计算好一半的Alpha
|
||||
|
||||
@ -19,8 +22,30 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
|
||||
class Material
|
||||
{
|
||||
BlendMode blend_mode;
|
||||
UTF8String name;
|
||||
|
||||
ComponentBitsConfig comp_cfg;
|
||||
BlendMode blend_mode;
|
||||
|
||||
bool two_sided=false;
|
||||
bool wire_frame=false;
|
||||
|
||||
public:
|
||||
|
||||
Material(const UTF8String &n,
|
||||
const ComponentBitsConfig &cbf,
|
||||
const BlendMode &bm=BlendMode::Opaque,
|
||||
const bool ts=false,
|
||||
const bool wf=false)
|
||||
{
|
||||
name=n;
|
||||
comp_cfg=cbf;
|
||||
blend_mode=bm;
|
||||
two_sided=false;
|
||||
wire_frame=false;
|
||||
}
|
||||
|
||||
virtual ~Material()=default;
|
||||
};//class Material
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_MATERIAL_INCLUDE
|
||||
|
@ -1,94 +0,0 @@
|
||||
#ifndef HGL_GRAPH_MATERIAL_DATA_INCLUDE
|
||||
#define HGL_GRAPH_MATERIAL_DATA_INCLUDE
|
||||
|
||||
#include<hgl/graph/TextureType.h>
|
||||
#include<hgl/type/Color4f.h>
|
||||
#include<hgl/type/Set.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
|
||||
{
|
||||
UTF8String name;
|
||||
|
||||
uint8 tex_count;
|
||||
|
||||
MaterialTextureData *tex_list;
|
||||
|
||||
Set<uint> 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.2f,0.2f,0.2f,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_DATA_INCLUDE
|
23
inc/hgl/graph/material/PBRMaterial.h
Normal file
23
inc/hgl/graph/material/PBRMaterial.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef HGL_GRAPH_MATERIAL_PBR_INCLUDE
|
||||
#define HGL_GRAPH_MATERIAL_PBR_INCLUDE
|
||||
|
||||
#include<hgl/graph/material/Material.h>
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 标准PBR材质<br>
|
||||
* BaseColor/Normal/Metallic/Roughness四个属性必须都有。如未提供,则会使用const方式提供一个数值
|
||||
*/
|
||||
class PBRMaterial:public Material
|
||||
{
|
||||
public:
|
||||
|
||||
PBRMaterial(const UTF8String & n,
|
||||
const BlendMode & bm =BlendMode::Opaque,
|
||||
const bool ts =false,
|
||||
const bool wf =false):
|
||||
Material(n,MCC_CNMR,bm,ts,wf){}
|
||||
|
||||
virtual ~PBRMaterial()=default;
|
||||
};//class PBRMaterial:public Material
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_MATERIAL_PBR_INCLUDE
|
40
inc/hgl/graph/material/StandardMaterial.h
Normal file
40
inc/hgl/graph/material/StandardMaterial.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef HGL_GRAPH_MATERIAL_STANDARD_INCLUDE
|
||||
#define HGL_GRAPH_MATERIAL_STANDARD_INCLUDE
|
||||
|
||||
#include<hgl/graph/material/Material.h>
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 传统标准材质
|
||||
*/
|
||||
class StandardMaterial:public Material
|
||||
{
|
||||
public:
|
||||
|
||||
enum class DataSource
|
||||
{
|
||||
Const,
|
||||
Param,
|
||||
Texture,
|
||||
Vertex,
|
||||
};//
|
||||
|
||||
struct
|
||||
{
|
||||
Component comp; ///<成份
|
||||
DataSource source; ///<来源
|
||||
DataFormat format; ///<数据格式
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
StandardMaterial( const UTF8String & n,
|
||||
const ComponentBitsConfig & cbf,
|
||||
const BlendMode & bm =BlendMode::Opaque,
|
||||
const bool ts =false,
|
||||
const bool wf =false):
|
||||
Material(n,cbf,bm,ts,wf){}
|
||||
|
||||
virtual ~StandardMaterial()=default;
|
||||
};//class StandardMaterial:public Material
|
||||
MATERIAL_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_MATERIAL_STANDARD_INCLUDE
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/shader/node/finished.h>
|
||||
#include<hgl/graph/shader/node/vertex_input.h>
|
||||
#include<hgl/type/StringList.h>
|
||||
BEGIN_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_BEGIN
|
||||
|
||||
using NodeList=List<node::Node *>;
|
||||
|
||||
@ -75,5 +75,5 @@ public:
|
||||
|
||||
virtual bool SaveToFile(const OSString &);
|
||||
};//class ShaderMaker
|
||||
END_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_MAKER_INCLUDE
|
||||
|
@ -2,26 +2,26 @@
|
||||
#define HGL_GRAPH_SHADER_COMMON_INCLUDE
|
||||
|
||||
#define SHADER_NAMESPACE hgl::graph::shader
|
||||
#define BEGIN_SHADER_NAMESPACE namespace hgl{namespace graph{namespace shader{
|
||||
#define END_SHADER_NAMESPACE }}}
|
||||
#define USING_SHADER_NAMESPACE using SHADER_NAMESPACE;
|
||||
#define SHADER_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace shader{
|
||||
#define SHADER_NAMESPACE_END }}}
|
||||
#define SHADER_NAMESPACE_USING using SHADER_NAMESPACE;
|
||||
|
||||
#define SHADER_NODE_NAMESPACE hgl::graph::shader::node
|
||||
#define BEGIN_SHADER_NODE_NAMESPACE namespace hgl{namespace graph{namespace shader{namespace node{
|
||||
#define END_SHADER_NODE_NAMESPACE }}}}
|
||||
#define USING_SHADER_NODE_NAMESPACE using SHADER_NODE_NAMESPACE;
|
||||
#define SHADER_NODE_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace shader{namespace node{
|
||||
#define SHADER_NODE_NAMESPACE_END }}}}
|
||||
#define SHADER_NODE_NAMESPACE_USING using SHADER_NODE_NAMESPACE;
|
||||
|
||||
#define SHADER_PARAM_NAMESPACE hgl::graph::shader::param
|
||||
#define BEGIN_SHADER_PARAM_NAMESPACE namespace hgl{namespace graph{namespace shader{namespace param{
|
||||
#define END_SHADER_PARAM_NAMESPACE }}}}
|
||||
#define USING_SHADER_PARAM_NAMESPACE using SHADER_PARAM_NAMESPACE;
|
||||
#define SHADER_PARAM_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace shader{namespace param{
|
||||
#define SHADER_PARAM_NAMESPACE_END }}}}
|
||||
#define SHADER_PARAM_NAMESPACE_USING using SHADER_PARAM_NAMESPACE;
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class Node;
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
class Param;
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
|
||||
#endif//HGL_GRAPH_SHADER_COMMON_INCLUDE
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_GRAPH_SHADER_NODE_COMBO_VECTOR_INCLUDE
|
||||
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class ComboVector1to2:public Node
|
||||
{
|
||||
param::InputParam *ip_x,*ip_y;
|
||||
@ -110,5 +110,5 @@ public:
|
||||
|
||||
bool GenCode(UTF8StringList &) override;
|
||||
};//class ComboVector22to4:public Node
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_COMBO_VECTOR_INCLUDE
|
||||
|
@ -1,12 +1,14 @@
|
||||
#ifndef HGL_GRAPH_SHADER_NODE_DEFINE_INCLUDE
|
||||
#define HGL_GRAPH_SHADER_NODE_DEFINE_INCLUDE
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
#include<hgl/graph/shader/common.h>
|
||||
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class Bool
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
};//class Bool
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_DEFINE_INCLUDE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
#include<hgl/graph/shader/param/in.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 最终节点,用于最终结果的一类节点,无输出部分
|
||||
*/
|
||||
@ -59,5 +59,5 @@ public:
|
||||
|
||||
~FragmentFinished()=default;
|
||||
};//class FragmentFinished:public Finished
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_FINISHED_INCLUDE
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include<hgl/graph/shader/param/in.h>
|
||||
#include<hgl/graph/shader/param/out.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
|
||||
#define SHADER_INPUT_PARAM(mj,name,type) AddInput(mj,#name,SHADER_PARAM_NAMESPACE::ParamType::type);
|
||||
#define SHADER_OUTPUT_PARAM(name,type) AddOutput(#name,SHADER_PARAM_NAMESPACE::ParamType::type);
|
||||
@ -99,5 +99,5 @@ public:
|
||||
|
||||
|
||||
};//template<typename T> class NativeValue:public Node
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_INCLUDE
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_GRAPH_SHADER_NODE_OP_INCLUDE
|
||||
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
enum class ScalarOpType:uint
|
||||
{
|
||||
Add=0, Sub, Mul, Div,
|
||||
@ -64,5 +64,5 @@ enum class ColorOpType:uint
|
||||
END_OP_RANGE=HardLight,
|
||||
RANGE_SIZE=(END_OP_RANGE-BEGIN_OP_RANGE)+1
|
||||
};//enum class ColorOpType:uint
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_OP_INCLUDE
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_GRAPH_SHADER_NODE_SPLIT_VECTOR_INCLUDE
|
||||
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class SplitVector2to1:public Node
|
||||
{
|
||||
public:
|
||||
@ -83,5 +83,5 @@ public:
|
||||
SHADER_INPUT_PARAM(true,XYZW,Float4)
|
||||
}
|
||||
};//class SplitVector4to22:public Node
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_SPLIT_VECTOR_INCLUDE
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/graph/shader/node/vector.h>
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class texture:public Node
|
||||
{
|
||||
param::ParamType texture_type;
|
||||
@ -67,5 +67,5 @@ public:
|
||||
SHADER_INPUT_PARAM(false,XYZ,Float3)
|
||||
}
|
||||
};//class TextureCube:public texture
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_TEXTURE_INCLUDE
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/graph/shader/common.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
enum class NodeType:int
|
||||
{
|
||||
VertexInput=0, ///<顶点输入流节点
|
||||
@ -26,5 +26,5 @@ enum class NodeType:int
|
||||
END_NODE_TYPE_RANGE =Finished,
|
||||
NODE_TYPE_RANGE_SIZE =(END_NODE_TYPE_RANGE-BEGIN_NODE_TYPE_RANGE)+1
|
||||
};//enum class NodeType
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_TYPE_INCLUDE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/shader/param/out.h>
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
class Parameter:public Node
|
||||
{
|
||||
param::ParamType param_type;
|
||||
@ -61,5 +61,5 @@ public:
|
||||
};//class Float4:public Parameter
|
||||
|
||||
#undef SHADER_PARAMETER_CONSTRUCT_FUNC
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_VECTOR_INCLUDE
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_GRAPH_SHADER_NODE_VERTEX_INPUT_INCLUDE
|
||||
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 顶点输入流节点
|
||||
*/
|
||||
@ -27,5 +27,5 @@ public:
|
||||
|
||||
bool GetOutputParamName(UTF8String &,const param::OutputParam *) override;
|
||||
};//class VertexInput:public Node
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_NODE_VERTEX_INPUT_INCLUDE
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/graph/shader/param/out.h>
|
||||
#include<hgl/graph/shader/param/param.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* 输入参数定义
|
||||
@ -51,5 +51,5 @@ public:
|
||||
|
||||
virtual bool Check(){return(must_join?join_param:true);} ///<检测当前节点是否可用
|
||||
};//class InputParam:public Param
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
#endif//#ifndef HGL_GRAPH_SHADER_PARAM_INPUT_INCLUDE
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/graph/shader/param/param.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
|
||||
using namespace hgl;
|
||||
|
||||
@ -18,5 +18,5 @@ public:
|
||||
virtual ~OutputParam()=default;
|
||||
};//class OutputParam:public Param
|
||||
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_PARAM_OUTPUT_INCLUDE
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/graph/shader/common.h>
|
||||
#include<hgl/graph/shader/param/type.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 参数定义
|
||||
*/
|
||||
@ -27,5 +27,5 @@ public:
|
||||
const UTF8String & GetName()const{return name;}
|
||||
const ParamType GetType()const{return type;}
|
||||
};//class Param
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_PARAM_INCLUDE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include<hgl/graph/shader/common.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
/**
|
||||
* 参数类型
|
||||
*/
|
||||
@ -84,5 +84,5 @@ enum class ParamType
|
||||
};//enum class ParamType
|
||||
|
||||
const char *GetTypename(const ParamType);
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_SHADER_PARAM_TYPE_INCLUDE
|
||||
|
@ -65,7 +65,13 @@ enum class ShaderStage
|
||||
Compute =VK_SHADER_STAGE_COMPUTE_BIT
|
||||
};//enum class ShaderStage
|
||||
|
||||
struct alignas(4) PushConstant
|
||||
/**
|
||||
* max-lengths:
|
||||
*
|
||||
256 bytes: nvidia,arm
|
||||
128 bytes: amd,intel,powervr,adreno
|
||||
*/
|
||||
struct PushConstant
|
||||
{
|
||||
Matrix4f local_to_world;
|
||||
Matrix3f normal;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include<hgl/graph/shader/node/combo_vector.h>
|
||||
#include<hgl/assets/AssetsSource.h>
|
||||
|
||||
BEGIN_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_BEGIN
|
||||
namespace
|
||||
{
|
||||
namespace InlineShader
|
||||
@ -106,4 +106,4 @@ bool CreateDefaultMaterial()
|
||||
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_END
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
*/
|
||||
|
||||
BEGIN_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_BEGIN
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -286,4 +286,4 @@ bool ShaderMaker::SaveToFile(const OSString &filename)
|
||||
delete tos;
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NAMESPACE
|
||||
SHADER_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/shader/node/combo_vector.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
bool ComboVector1to2::GenOutputParamCode(UTF8StringList &sl)
|
||||
{
|
||||
UTF8String name_x,name_y;
|
||||
@ -31,4 +31,4 @@ bool ComboVector1to3::GenOutputParamCode(UTF8StringList &sl)
|
||||
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/shader/node/finished.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
bool VertexFinished::GenCode(UTF8StringList &sl)
|
||||
{
|
||||
if(!Finished::GenCode(sl))
|
||||
@ -14,4 +14,4 @@ bool VertexFinished::GenCode(UTF8StringList &sl)
|
||||
sl.Add("gl_Position="+name+";");
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
param::InputParam *Node::AddInput(bool mj,const UTF8String &n,const param::ParamType &pt)
|
||||
{
|
||||
param::InputParam *ip=new param::InputParam(mj,n,pt);
|
||||
@ -170,4 +170,4 @@ bool Node::GenCode(UTF8StringList &sl)
|
||||
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/shader/node/vertex_input.h>
|
||||
|
||||
BEGIN_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_BEGIN
|
||||
bool VertexInput::GetOutputParamName(UTF8String &result,const param::OutputParam *op)
|
||||
{
|
||||
if(!op||!IsOutput(op))
|
||||
@ -9,4 +9,4 @@ bool VertexInput::GetOutputParamName(UTF8String &result,const param::OutputParam
|
||||
result=op->GetName();
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_NODE_NAMESPACE
|
||||
SHADER_NODE_NAMESPACE_END
|
@ -1,7 +1,7 @@
|
||||
#include<hgl/graph/shader/param/in.h>
|
||||
#include<hgl/graph/shader/node/node.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
bool InputParam::Join(node::Node *n,param::OutputParam *op)
|
||||
{
|
||||
if(!n||!op)return(false);
|
||||
@ -17,4 +17,4 @@ bool InputParam::Join(node::Node *n,param::OutputParam *op)
|
||||
|
||||
return(true);
|
||||
}
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/shader/param/type.h>
|
||||
|
||||
BEGIN_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_BEGIN
|
||||
const char *GetTypename(const ParamType pt)
|
||||
{
|
||||
constexpr char *name[]=
|
||||
@ -83,4 +83,4 @@ const char *GetTypename(const ParamType pt)
|
||||
|
||||
return name[size_t(pt)-size_t(ParamType::BEGIN_RANGE)];
|
||||
}
|
||||
END_SHADER_PARAM_NAMESPACE
|
||||
SHADER_PARAM_NAMESPACE_END
|
@ -3,7 +3,7 @@
|
||||
#include<hgl/io/DataInputStream.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
//bool LoadMaterialFile(MaterialData &md,const OSString &filename)//,Texture **tex_list)
|
||||
//{
|
||||
// io::FileInputStream fis;
|
||||
@ -61,4 +61,4 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
|
||||
// return(true);
|
||||
//}
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include<hgl/graph/material/Component.h>
|
||||
|
||||
BEGIN_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_BEGIN
|
||||
namespace
|
||||
{
|
||||
constexpr ComponentConfig material_component_config_list[]=
|
||||
@ -39,4 +39,4 @@ BEGIN_MATERIAL_NAMESPACE
|
||||
|
||||
return material_component_config_list+(uint)c;
|
||||
}
|
||||
END_MATERIAL_NAMESPACE
|
||||
MATERIAL_NAMESPACE_END
|
||||
|
Loading…
x
Reference in New Issue
Block a user