added sampler parse in MaterialFileLoader.cpp
This commit is contained in:
parent
bead8128b7
commit
3dd308aff1
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include<hgl/type/Map.h>
|
#include<hgl/type/Map.h>
|
||||||
#include<hgl/graph/VKShaderStage.h>
|
#include<hgl/graph/VKShaderStage.h>
|
||||||
|
#include<hgl/graph/VKSamplerType.h>
|
||||||
|
|
||||||
namespace material_file
|
namespace material_file
|
||||||
{
|
{
|
||||||
@ -24,6 +25,13 @@ namespace material_file
|
|||||||
uint32_t shader_stage_flag_bits;
|
uint32_t shader_stage_flag_bits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SamplerData
|
||||||
|
{
|
||||||
|
char name[SHADER_RESOURCE_NAME_MAX_LENGTH];
|
||||||
|
|
||||||
|
SamplerType type;
|
||||||
|
};
|
||||||
|
|
||||||
struct ShaderData
|
struct ShaderData
|
||||||
{
|
{
|
||||||
VkShaderStageFlagBits shader_stage;
|
VkShaderStageFlagBits shader_stage;
|
||||||
@ -33,6 +41,8 @@ namespace material_file
|
|||||||
|
|
||||||
List<UniformAttrib> output;
|
List<UniformAttrib> output;
|
||||||
|
|
||||||
|
List<SamplerData> sampler;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ShaderData(VkShaderStageFlagBits ss)
|
ShaderData(VkShaderStageFlagBits ss)
|
||||||
@ -76,12 +86,15 @@ namespace material_file
|
|||||||
|
|
||||||
ObjectMap<VkShaderStageFlagBits,ShaderData> shader;
|
ObjectMap<VkShaderStageFlagBits,ShaderData> shader;
|
||||||
|
|
||||||
|
uint32_t shader_stage_flag_bit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MaterialFileData(char *d,int dl)
|
MaterialFileData(char *d,int dl)
|
||||||
{
|
{
|
||||||
data=d;
|
data=d;
|
||||||
data_length=dl;
|
data_length=dl;
|
||||||
|
shader_stage_flag_bit=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
~MaterialFileData()
|
~MaterialFileData()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include<hgl/graph/mtl/Material2DCreateConfig.h>
|
#include<hgl/graph/mtl/Material2DCreateConfig.h>
|
||||||
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
||||||
#include<hgl/graph/VKShaderStage.h>
|
#include<hgl/graph/VKShaderStage.h>
|
||||||
|
#include<hgl/graph/VKSamplerType.h>
|
||||||
|
|
||||||
#include<hgl/io/TextInputStream.h>
|
#include<hgl/io/TextInputStream.h>
|
||||||
#include<hgl/filesystem/FileSystem.h>
|
#include<hgl/filesystem/FileSystem.h>
|
||||||
@ -295,6 +296,33 @@ namespace
|
|||||||
{
|
{
|
||||||
output=true;
|
output=true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(hgl::stricmp(text,"sampler",7)==0)
|
||||||
|
{
|
||||||
|
const char *sp=text;
|
||||||
|
|
||||||
|
while(*text!=' '&&*text!='\t')++text;
|
||||||
|
|
||||||
|
SamplerType st=ParseSamplerType(sp,text-sp);
|
||||||
|
|
||||||
|
RANGE_CHECK_RETURN_FALSE(st);
|
||||||
|
|
||||||
|
while(!hgl::iscodechar(*text))++text;
|
||||||
|
|
||||||
|
sp=text;
|
||||||
|
|
||||||
|
while(hgl::iscodechar(*text))++text;
|
||||||
|
|
||||||
|
SamplerData sd;
|
||||||
|
|
||||||
|
sd.type=st;
|
||||||
|
hgl::strcpy(sd.name,SHADER_RESOURCE_NAME_MAX_LENGTH,sp,text-sp);
|
||||||
|
|
||||||
|
shader_data->sampler.Add(sd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@ -445,6 +473,8 @@ namespace
|
|||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
mfd->shader.Add(sd->GetShaderStage(),sd);
|
mfd->shader.Add(sd->GetShaderStage(),sd);
|
||||||
|
|
||||||
|
mfd->shader_stage_flag_bit|=sd->GetShaderStage();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user