little codes

This commit is contained in:
2024-03-06 13:54:05 +08:00
parent dc3d7b7792
commit c355f96f9b
4 changed files with 50 additions and 18 deletions

View File

@@ -1,22 +1,26 @@
#pragma once
#include<hgl/graph/mtl/StdMaterial.h>
#include<hgl/graph/mtl/ShaderBuffer.h>
#include<hgl/math/Vector.h>
namespace hgl
STD_MTL_NAMESPACE_BEGIN
namespace blinnphong
{
namespace graph
struct SunLight
{
namespace mtl
{
namespace blinnphong
{
struct SunLight
{
Vector3f direction;
Vector3f color;
};//struct SunLight
}//namespace blinnphong
}//namespace mtl
}//namespace graph
}//namespace hgl
Vector3f direction;
Vector3f color;
};//struct SunLight
constexpr const ShaderBufferSource SBS_SunLight=
{
"SunLight",
"sun",
R"(
vec3 direction;
vec3 color;
)"
};
}//namespace blinnphong
STD_MTL_NAMESPACE_END

View File

@@ -0,0 +1,24 @@
#pragma once
#include<hgl/graph/mtl/StdMaterial.h>
#include<hgl/graph/mtl/ShaderBuffer.h>
STD_MTL_NAMESPACE_BEGIN
/**
* 所有UBO的基类它即向生成器提供代码也可以为渲染器提供数据
*/
class UniformBuffer
{
private:
ShaderBufferSource *sbs;
public:
virtual const AnsiString &GetStructName ()const{return sbs->struct_name;} ///<取得结构名称
virtual const AnsiString &GetDefaultValueName ()const{return sbs->name;} ///<取得默认变量名称
virtual const AnsiString &GetShaderCodes ()const{return sbs->codes;} ///<取得Shader代码
};//class UniformBuffer
STD_MTL_NAMESPACE_END