little codes
This commit is contained in:
@@ -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
|
||||
|
24
inc/hgl/graph/mtl/UniformBuffer.h
Normal file
24
inc/hgl/graph/mtl/UniformBuffer.h
Normal 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
|
Reference in New Issue
Block a user