finished the branch,,,local to world in VertexInputStreaming.

This commit is contained in:
2023-05-06 22:19:50 +08:00
parent abfc84feff
commit 958183bb29
12 changed files with 109 additions and 53 deletions

View File

@@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
#ifndef HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
#define HGL_GRAPH_MTL_2D_VERTEX2D_INCLUDE
#include<hgl/graph/mtl/StdMaterial.h>
@@ -11,7 +11,14 @@ namespace hgl
namespace mtl
{
MaterialCreateInfo *CreateVertexColor2D(const CoordinateSystem2D &);
struct Material2DConfig
{
CoordinateSystem2D coordinate_system; ///<使用的坐标系
bool local_to_world=false; ///<包含LocalToWorld矩阵
};
MaterialCreateInfo *CreateVertexColor2D(const Material2DConfig *);
}//namespace mtl
}//namespace graph
}//namespace hgl

View File

@@ -5,6 +5,7 @@
#define STD_MTL_NAMESPACE_USING using namespace hgl::graph::mtl;
#include<hgl/TypeFunc.h>
#include<hgl/graph/mtl/ShaderBuffer.h>
STD_MTL_NAMESPACE_BEGIN
@@ -13,7 +14,9 @@ enum class CoordinateSystem2D
{
NDC,
ZeroToOne, //左上角为0,0右下角为1,1
Ortho //左上角为0,0右下角为(width-1),(height-1)
Ortho, //左上角为0,0右下角为(width-1),(height-1)
ENUM_CLASS_RANGE(NDC,Ortho)
};
constexpr const ShaderBufferSource SBS_ViewportInfo=
@@ -53,4 +56,17 @@ vec3 world_up;
float znear,zfar;)"
};
namespace func
{
constexpr const char GetLocalToWorld[]=R"(
mat4 GetLocalToWorld()
{
return mat4(LocalToWorld_0,
LocalToWorld_1,
LocalToWorld_2,
LocalToWorld_3);
}
)";
}//namespace func
STD_MTL_NAMESPACE_END