finished the branch,,,local to world in VertexInputStreaming.
This commit is contained in:
@@ -16,7 +16,7 @@ namespace hgl
|
||||
|
||||
struct RenderNode2D
|
||||
{
|
||||
Matrix3x4f local_to_world;
|
||||
Matrix4f local_to_world;
|
||||
|
||||
Renderable *ri;
|
||||
};
|
||||
@@ -81,7 +81,7 @@ namespace hgl
|
||||
MaterialRenderList2D(GPUDevice *d,Material *m);
|
||||
~MaterialRenderList2D();
|
||||
|
||||
void Add(Renderable *ri,const Matrix3x4f &mat);
|
||||
void Add(Renderable *ri,const Matrix4f &mat);
|
||||
|
||||
void ClearData()
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user