added MFGetNormal.h
This commit is contained in:
parent
10d4f2f04a
commit
9b5157594f
@ -3,6 +3,7 @@
|
||||
#include<hgl/graph/mtl/3d/Material3DCreateConfig.h>
|
||||
#include<hgl/graph/mtl/UBOCommon.h>
|
||||
#include"common/MFGetPosition.h"
|
||||
#include"common/MFGetNormal.h"
|
||||
#include"common/MFRectPrimitive.h"
|
||||
|
||||
STD_MTL_NAMESPACE_BEGIN
|
||||
@ -36,6 +37,13 @@ bool Std3DMaterial::CustomVertexShader(ShaderCreateInfoVertex *vsc)
|
||||
else
|
||||
vsc->AddFunction(cfg->camera?func::GetPosition3DCamera:func::GetPosition3D);
|
||||
|
||||
//if(cfg->camera
|
||||
// &&cfg->local_to_world)
|
||||
//{
|
||||
// vsc->AddFunction(func::GetNormalMatrix);
|
||||
// vsc->AddFunction(func::GetNormal);
|
||||
//}
|
||||
|
||||
mci->AddUBO(VK_SHADER_STAGE_VERTEX_BIT,
|
||||
DescriptorSetType::Global,
|
||||
SBS_ViewportInfo);
|
||||
|
@ -39,7 +39,9 @@ set(STD_MTL_HEADER_PATH ${ROOT_INCLUDE_PATH}/hgl/graph/mtl)
|
||||
SET(SHADERGEN_COMMON_FILES ${STD_MTL_HEADER_PATH}/UBOCommon.h
|
||||
${STD_MTL_HEADER_PATH}/SamplerName.h
|
||||
common/MFCommon.h
|
||||
common/MFGetPosition.h)
|
||||
common/MFGetPosition.h
|
||||
common/MFGetNormal.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP("Common" FILES ${SHADERGEN_COMMON_FILES})
|
||||
|
||||
|
22
src/ShaderGen/common/MFGetNormal.h
Normal file
22
src/ShaderGen/common/MFGetNormal.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/mtl/StdMaterial.h>
|
||||
#include<hgl/graph/CoordinateSystem.h>
|
||||
STD_MTL_NAMESPACE_BEGIN
|
||||
namespace func
|
||||
{
|
||||
constexpr const char *GetNormalMatrix=R"(
|
||||
mat3 GetNormalMatrix()
|
||||
{
|
||||
return mat3(camera.view*GetLocalToWorld());
|
||||
}
|
||||
)";
|
||||
|
||||
constexpr const char *GetNormal=R"(
|
||||
vec3 GetNormal(mat3 normal_matrix,vec3 normal)
|
||||
{
|
||||
return normalize(normal_matrix*normal);
|
||||
}
|
||||
)";
|
||||
}//namespace func
|
||||
STD_MTL_NAMESPACE_END
|
Loading…
x
Reference in New Issue
Block a user