use newly Compartor<>
This commit is contained in:
parent
abad1784c2
commit
a1d8ad52cb
@ -1 +1 @@
|
|||||||
Subproject commit 85436b5a7b0bc9347fcd3321a6895464470f1353
|
Subproject commit cf6a54d484436eea700bc4f4ea002ed23eed6dc8
|
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 753b78dddf234cd305b5d211c687b311eebaaf8a
|
Subproject commit 6e1f32f38eca4cdc1088e737abf58ffec5e2592b
|
@ -1 +1 @@
|
|||||||
Subproject commit c958a6cb2ac4a52716eabc1c45eba184f4c7e46c
|
Subproject commit b1e3ffe312b18ecad36849d9d53288bbb25af8dc
|
2
CMUtil
2
CMUtil
@ -1 +1 @@
|
|||||||
Subproject commit f7dce0304822280d0db23ae607783b7c3cd183fa
|
Subproject commit a7f4afab8029f52dff43840062c8b6cb2008bd67
|
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include<hgl/graph/VK.h>
|
#include<hgl/graph/VK.h>
|
||||||
#include<hgl/graph/VKDevice.h>
|
#include<hgl/graph/VKDevice.h>
|
||||||
@ -60,6 +60,8 @@ class GraphModule
|
|||||||
|
|
||||||
AnsiIDName module_name;
|
AnsiIDName module_name;
|
||||||
|
|
||||||
|
SortedSet<AnsiIDName> dependent_module; ///<依赖的模块
|
||||||
|
|
||||||
bool module_enable;
|
bool module_enable;
|
||||||
bool module_ready;
|
bool module_ready;
|
||||||
|
|
||||||
@ -93,6 +95,13 @@ public:
|
|||||||
|
|
||||||
virtual bool Init(){return true;} ///<初始化当前模块
|
virtual bool Init(){return true;} ///<初始化当前模块
|
||||||
|
|
||||||
|
int Comp(const GraphModule *gm)const
|
||||||
|
{
|
||||||
|
return(dependent_module.Contains(gm->module_name)?1:-1); //如果我依赖于他,那么我比他大
|
||||||
|
}
|
||||||
|
|
||||||
|
CompOperator(const GraphModule *,Comp)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GraphModule * GetModule(const AnsiIDName &name,bool create=false){return module_manager->GetModule(name,create);} ///<获取指定名称的模块
|
GraphModule * GetModule(const AnsiIDName &name,bool create=false){return module_manager->GetModule(name,create);} ///<获取指定名称的模块
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include<hgl/graph/VertexAttrib.h>
|
#include<hgl/graph/VertexAttrib.h>
|
||||||
|
|
||||||
STD_MTL_NAMESPACE_BEGIN
|
STD_MTL_NAMESPACE_BEGIN
|
||||||
struct Material2DCreateConfig:public MaterialCreateConfig
|
struct Material2DCreateConfig:public MaterialCreateConfig,public Comparator<Material2DCreateConfig>
|
||||||
{
|
{
|
||||||
CoordinateSystem2D coordinate_system; ///<使用的坐标系
|
CoordinateSystem2D coordinate_system; ///<使用的坐标系
|
||||||
|
|
||||||
@ -32,9 +32,9 @@ public:
|
|||||||
position_format=VAT_VEC2;
|
position_format=VAT_VEC2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Comp(const Material2DCreateConfig &cfg)const
|
const int compare(const Material2DCreateConfig &cfg)const override
|
||||||
{
|
{
|
||||||
int off=MaterialCreateConfig::Comp(cfg);
|
int off=MaterialCreateConfig::compare(cfg);
|
||||||
|
|
||||||
if(off)return off;
|
if(off)return off;
|
||||||
|
|
||||||
@ -48,8 +48,6 @@ public:
|
|||||||
|
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompOperator(const Material2DCreateConfig &,Comp)
|
|
||||||
};//struct Material2DCreateConfig:public MaterialCreateConfig
|
};//struct Material2DCreateConfig:public MaterialCreateConfig
|
||||||
|
|
||||||
MaterialCreateInfo *CreateVertexColor2D(const Material2DCreateConfig *);
|
MaterialCreateInfo *CreateVertexColor2D(const Material2DCreateConfig *);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
STD_MTL_NAMESPACE_BEGIN
|
STD_MTL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
struct Material3DCreateConfig:public MaterialCreateConfig
|
struct Material3DCreateConfig:public MaterialCreateConfig,public Comparator<Material3DCreateConfig>
|
||||||
{
|
{
|
||||||
bool camera; ///<包含摄像机矩阵信息
|
bool camera; ///<包含摄像机矩阵信息
|
||||||
|
|
||||||
@ -32,9 +32,9 @@ public:
|
|||||||
// reverse_depth=false;
|
// reverse_depth=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Comp(const Material3DCreateConfig &cfg)const
|
const int compare(const Material3DCreateConfig &cfg)const override
|
||||||
{
|
{
|
||||||
int off=MaterialCreateConfig::Comp(cfg);
|
int off=MaterialCreateConfig::compare(cfg);
|
||||||
|
|
||||||
if(off)return off;
|
if(off)return off;
|
||||||
|
|
||||||
@ -48,8 +48,6 @@ public:
|
|||||||
|
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompOperator(const Material3DCreateConfig &,Comp)
|
|
||||||
};//struct Material3DCreateConfig:public MaterialCreateConfig
|
};//struct Material3DCreateConfig:public MaterialCreateConfig
|
||||||
|
|
||||||
MaterialCreateInfo *CreateVertexColor3D(const Material3DCreateConfig *);
|
MaterialCreateInfo *CreateVertexColor3D(const Material3DCreateConfig *);
|
||||||
|
@ -13,7 +13,7 @@ class MaterialCreateInfo;
|
|||||||
/**
|
/**
|
||||||
* 材质配置结构
|
* 材质配置结构
|
||||||
*/
|
*/
|
||||||
struct MaterialCreateConfig
|
struct MaterialCreateConfig:public Comparator<MaterialCreateConfig>
|
||||||
{
|
{
|
||||||
const GPUDeviceAttribute *dev_attr;
|
const GPUDeviceAttribute *dev_attr;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
prim=p;
|
prim=p;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int Comp(const MaterialCreateConfig &cfg)const
|
const int compare(const MaterialCreateConfig &cfg)const override
|
||||||
{
|
{
|
||||||
int off;
|
int off;
|
||||||
|
|
||||||
@ -59,8 +59,6 @@ public:
|
|||||||
|
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompOperator(const MaterialCreateConfig &,Comp)
|
|
||||||
};//struct MaterialCreateConfig
|
};//struct MaterialCreateConfig
|
||||||
STD_MTL_NAMESPACE_END
|
STD_MTL_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_MTL_CONFIG_INCLUDE
|
#endif//HGL_GRAPH_MTL_CONFIG_INCLUDE
|
||||||
|
@ -28,7 +28,7 @@ namespace hgl
|
|||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
|
|
||||||
struct ShaderVariableType
|
struct ShaderVariableType:public Comparator<ShaderVariableType>
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -158,9 +158,7 @@ namespace hgl
|
|||||||
|
|
||||||
const bool Check()const;
|
const bool Check()const;
|
||||||
|
|
||||||
int Comp(const ShaderVariableType &svt)const;
|
const int compare(const ShaderVariableType &svt)const override;
|
||||||
|
|
||||||
CompOperator(const ShaderVariableType &,Comp)
|
|
||||||
|
|
||||||
const char *GetTypename()const;
|
const char *GetTypename()const;
|
||||||
|
|
||||||
@ -281,7 +279,7 @@ namespace hgl
|
|||||||
|
|
||||||
using SVList=List<ShaderVariable>;
|
using SVList=List<ShaderVariable>;
|
||||||
|
|
||||||
struct ShaderVariableArray
|
struct ShaderVariableArray:public Comparator<ShaderVariableArray>
|
||||||
{
|
{
|
||||||
uint count;
|
uint count;
|
||||||
|
|
||||||
@ -304,44 +302,36 @@ namespace hgl
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Comp(const ShaderVariableArray *sva)const
|
const int compare(const ShaderVariableArray &sva)const override
|
||||||
{
|
{
|
||||||
if(!sva)
|
int off=count-sva.count;
|
||||||
return 1;
|
|
||||||
|
|
||||||
int off=count-sva->count;
|
|
||||||
if(off)return off;
|
if(off)return off;
|
||||||
|
|
||||||
for(uint i=0;i<count;i++)
|
for(uint i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
off=items[i].location-sva->items[i].location;
|
off=items[i].location-sva.items[i].location;
|
||||||
if(off)
|
if(off)
|
||||||
return off;
|
return off;
|
||||||
|
|
||||||
if(items[i].type.ToCode()>sva->items[i].type.ToCode())
|
if(items[i].type.ToCode()>sva.items[i].type.ToCode())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
//ToCode返回的是uint64,可能差值超大,所以不能直接用-的结果
|
//ToCode返回的是uint64,可能差值超大,所以不能直接用-的结果
|
||||||
|
|
||||||
if(items[i].type.ToCode()<sva->items[i].type.ToCode())
|
if(items[i].type.ToCode()<sva.items[i].type.ToCode())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
off=int(items[i].interpolation)-int(sva->items[i].interpolation);
|
off=int(items[i].interpolation)-int(sva.items[i].interpolation);
|
||||||
if(off)
|
if(off)
|
||||||
return off;
|
return off;
|
||||||
|
|
||||||
off=hgl::strcmp(items[i].name,sva->items[i].name);
|
off=hgl::strcmp(items[i].name,sva.items[i].name);
|
||||||
if(off)
|
if(off)
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Comp(const ShaderVariableArray &sva)const{return Comp(&sva);}
|
|
||||||
|
|
||||||
CompOperator(const ShaderVariableArray *,Comp)
|
|
||||||
CompOperator(const ShaderVariableArray &,Comp)
|
|
||||||
|
|
||||||
bool Init(const uint c=0)
|
bool Init(const uint c=0)
|
||||||
{
|
{
|
||||||
|
2
res
2
res
@ -1 +1 @@
|
|||||||
Subproject commit e1a36d78f0eead5f6bb65493432c4690637b991d
|
Subproject commit 475d8ad43ceee084cd24f5d0bed59de9f6aa36fd
|
@ -85,7 +85,7 @@ const bool ShaderVariableType::Check()const
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ShaderVariableType::Comp(const ShaderVariableType &svt)const
|
const int ShaderVariableType::compare(const ShaderVariableType &svt)const
|
||||||
{
|
{
|
||||||
int off=(int)base_type-(int)svt.base_type;
|
int off=(int)base_type-(int)svt.base_type;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user