update codes...but can't compile
This commit is contained in:
46
inc/hgl/graph/mtl/MaterialVertexFormat.h
Normal file
46
inc/hgl/graph/mtl/MaterialVertexFormat.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef HGL_GRAPH_MATERIAL_VERTEX_FORMAT_INCLUDE
|
||||
#define HGL_GRAPH_MATERIAL_VERTEX_FORMAT_INCLUDE
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
/**
|
||||
* Local 2 World <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD>
|
||||
*
|
||||
* 1.Push Constants <20><><EFBFBD><EFBFBD>
|
||||
*
|
||||
* 2.UBO <20>д<EFBFBD><D0B4><EFBFBD>matrix4f<34><66><EFBFBD>У<EFBFBD>vertex attrib<69>д<EFBFBD><D0B4><EFBFBD>ID
|
||||
* UBOͨ<4F><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k/64k<34><6B>һ<EFBFBD><D2BB>matrix4fΪ64<36>ֽڡ<D6BD>
|
||||
*
|
||||
* 3.Vertex Attribute
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>ṹ
|
||||
*/
|
||||
union MaterialVertexFormat
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint position:3;
|
||||
bool normal:1;
|
||||
bool tangent:1;
|
||||
bool bitangent:1;
|
||||
uint color:4;
|
||||
uint texcoord:4;
|
||||
|
||||
bool local2world:1;
|
||||
bool skeleton:1;
|
||||
};
|
||||
|
||||
uint32 format;
|
||||
};//union MaterialVertexFormat
|
||||
|
||||
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_MATERIAL_VERTEX_FORMAT_INCLUDE
|
18
inc/hgl/graph/mtl/ShaderBuffer.h
Normal file
18
inc/hgl/graph/mtl/ShaderBuffer.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef HGL_GRAPH_MTL_SHADER_BUFFER_INCLUDE
|
||||
#define HGL_GRAPH_MTL_SHADER_BUFFER_INCLUDE
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
struct ShaderBufferSource
|
||||
{
|
||||
const char *struct_name;
|
||||
const char *value_name;
|
||||
const char *codes;
|
||||
};
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_MTL_SHADER_BUFFER_INCLUDE
|
@@ -3,7 +3,11 @@
|
||||
#define STD_MTL_NAMESPACE_BEGIN namespace hgl{namespace graph{namespace mtl{
|
||||
#define STD_MTL_NAMESPACE_END }}}
|
||||
|
||||
#define STD_MTL_NAMESPACE_USING using namespace hgl::graph::mtl
|
||||
#define STD_MTL_NAMESPACE_USING using namespace hgl::graph::mtl;
|
||||
|
||||
#include<hgl/graph/mtl/ShaderBuffer.h>
|
||||
|
||||
STD_MTL_NAMESPACE_BEGIN
|
||||
|
||||
enum class CoordinateSystem2D
|
||||
{
|
||||
@@ -12,35 +16,26 @@ enum class CoordinateSystem2D
|
||||
Ortho //左上角为0,0;右下角为(width-1),(height-1)
|
||||
};
|
||||
|
||||
namespace InlineDescriptor
|
||||
constexpr const ShaderBufferSource SBS_ViewportInfo=
|
||||
{
|
||||
struct ShaderStruct
|
||||
{
|
||||
const char *struct_name;
|
||||
const char *name;
|
||||
const char *codes;
|
||||
};
|
||||
"ViewportInfo",
|
||||
"viewport",
|
||||
|
||||
constexpr const ShaderStruct ViewportInfo=
|
||||
{
|
||||
"ViewportInfo",
|
||||
"viewport",
|
||||
|
||||
R"(
|
||||
R"(
|
||||
mat4 ortho_matrix;
|
||||
|
||||
vec2 canvas_resolution;
|
||||
vec2 viewport_resolution;
|
||||
vec2 inv_viewport_resolution;
|
||||
)"
|
||||
};
|
||||
};
|
||||
|
||||
constexpr const ShaderStruct CameraInfo=
|
||||
{
|
||||
"CameraInfo",
|
||||
"camera",
|
||||
constexpr const ShaderBufferSource SBS_CameraInfo=
|
||||
{
|
||||
"CameraInfo",
|
||||
"camera",
|
||||
|
||||
R"(
|
||||
R"(
|
||||
mat4 projection;
|
||||
mat4 inverse_projection;
|
||||
|
||||
@@ -57,5 +52,6 @@ vec3 view_line; //pos-target
|
||||
vec3 world_up;
|
||||
|
||||
float znear,zfar;)"
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
STD_MTL_NAMESPACE_END
|
||||
|
Reference in New Issue
Block a user