added To parse "require" of the MaterialBlock in MaterialFileLoader.cpp
This commit is contained in:
parent
bee48890cb
commit
27c409c7fd
@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include<hgl/type/Map.h>
|
#include<hgl/type/Map.h>
|
||||||
|
#include<hgl/type/StringList.h>
|
||||||
#include<hgl/graph/VKShaderStage.h>
|
#include<hgl/graph/VKShaderStage.h>
|
||||||
#include<hgl/graph/VKSamplerType.h>
|
#include<hgl/graph/VKSamplerType.h>
|
||||||
|
#include<hgl/graph/VKPrimitiveType.h>
|
||||||
|
|
||||||
namespace material_file
|
namespace material_file
|
||||||
{
|
{
|
||||||
@ -67,6 +69,8 @@ namespace material_file
|
|||||||
using ShaderData::ShaderData;
|
using ShaderData::ShaderData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ShaderDataMap=ObjectMap<VkShaderStageFlagBits,ShaderData>;
|
||||||
|
|
||||||
struct MaterialFileData
|
struct MaterialFileData
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -80,11 +84,14 @@ namespace material_file
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
AnsiStringList require; ///<需求的内部模块(如LocalToWorld,Sun,Shadow等系统内置元素)
|
||||||
|
// AnsiStringList import; ///<引用的外部模块
|
||||||
|
|
||||||
MaterialInstanceData mi{};
|
MaterialInstanceData mi{};
|
||||||
|
|
||||||
List<UniformAttrib> vi;
|
List<UniformAttrib> vi;
|
||||||
|
|
||||||
ObjectMap<VkShaderStageFlagBits,ShaderData> shader;
|
ShaderDataMap shader;
|
||||||
|
|
||||||
uint32_t shader_stage_flag_bit;
|
uint32_t shader_stage_flag_bit;
|
||||||
|
|
||||||
|
@ -67,9 +67,15 @@ namespace
|
|||||||
{
|
{
|
||||||
MaterialFileBlock state;
|
MaterialFileBlock state;
|
||||||
|
|
||||||
MaterialBlockParse()
|
AnsiStringList *require=nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
MaterialBlockParse(AnsiStringList *asl)
|
||||||
{
|
{
|
||||||
state=MaterialFileBlock::None;
|
state=MaterialFileBlock::None;
|
||||||
|
|
||||||
|
require=asl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnLine(char *text,const int len) override
|
bool OnLine(char *text,const int len) override
|
||||||
@ -77,11 +83,27 @@ namespace
|
|||||||
if(!text||!*text||len<=0)
|
if(!text||!*text||len<=0)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
char *ep=text+len;
|
||||||
|
|
||||||
if(hgl::stricmp(text,"Require ",8)==0)
|
if(hgl::stricmp(text,"Require ",8)==0)
|
||||||
{
|
{
|
||||||
|
text+=8;
|
||||||
|
|
||||||
|
char *sp=text;
|
||||||
|
|
||||||
|
while(sp<ep)
|
||||||
|
{
|
||||||
|
while(hgl::iscodechar(*text))++text;
|
||||||
|
|
||||||
|
require->Add(AnsiString(sp,text-sp));
|
||||||
|
|
||||||
|
while(!hgl::iscodechar(*text))++text;
|
||||||
|
|
||||||
|
sp=text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
};//struct MaterialBlockParse
|
};//struct MaterialBlockParse
|
||||||
|
|
||||||
@ -439,7 +461,7 @@ namespace
|
|||||||
state=GetMaterialFileState(text+1,len-1);
|
state=GetMaterialFileState(text+1,len-1);
|
||||||
|
|
||||||
if(state==MaterialFileBlock::Material)
|
if(state==MaterialFileBlock::Material)
|
||||||
parse=new MaterialBlockParse;
|
parse=new MaterialBlockParse(&(mfd->require));
|
||||||
else
|
else
|
||||||
if(state==MaterialFileBlock::MaterialInstance)
|
if(state==MaterialFileBlock::MaterialInstance)
|
||||||
parse=new MaterialInstanceBlockParse(&(mfd->mi));
|
parse=new MaterialInstanceBlockParse(&(mfd->mi));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user