add WorldMatrix.h

This commit is contained in:
hyzboy 2020-01-11 21:28:41 +08:00
parent f3961d7c6b
commit 148372a601
6 changed files with 69 additions and 3 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 5ec34e30035a8ef4eeb8c116e19c79d12663c828 Subproject commit cdc2805477fc91ccebb87d56e5e9b8d7bcb492e6

View File

@ -1,7 +1,7 @@
#ifndef HGL_GRAPH_CAMERA_INCLUDE #ifndef HGL_GRAPH_CAMERA_INCLUDE
#define HGL_GRAPH_CAMERA_INCLUDE #define HGL_GRAPH_CAMERA_INCLUDE
#include<hgl/math/Math.h> #include<hgl/graph/WorldMatrix.h>
namespace hgl namespace hgl
{ {
namespace graph namespace graph

View File

@ -0,0 +1,31 @@
#ifndef HGL_GRAPH_WORLD_MATRIX_INCLUDE
#define HGL_GRAPH_WORLD_MATRIX_INCLUDE
#include<hgl/math/Math.h>
namespace hgl
{
namespace graph
{
/**
*
* @see res/shader/UBO_WorldMatrix.glsl
*/
struct WorldMatrix
{
alignas(16) Matrix4f ortho; //2D正角视图矩阵
alignas(16) Matrix4f projection;
alignas(16) Matrix4f inverse_projection;
alignas(16) Matrix4f modelview;
alignas(16) Matrix4f inverse_modelview;
alignas(16) Matrix4f mvp;
alignas(16) Matrix4f inverse_map;
alignas(16) Vector4f view_pos; ///<眼睛坐标
};//struct WorldMatrix
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_WORLD_MATRIX_INCLUDE

View File

@ -0,0 +1,25 @@
#ifdef THIS_IS_VERTEX_SHADER
#define VS_OUTPUT_LAYOUT out
#else
#define VS_OUTPUT_LAYOUT in
#endif//THIS_IS_VERTEX_SHADER
#ifdef FS_USE_POSITION
layout(location = 0) VS_OUTPUT_LAYOUT vec3 v2fPosition;
#endif//FS_USE_POSITION
#ifdef FS_USE_COLOR
layout(location = 1) VS_OUTPUT_LAYOUT vec3 v2fColor;
#endif//FS_USE_COLOR
#ifdef FS_USE_NORMAL
layout(location = 2) VS_OUTPUT_LAYOUT vec3 v2fNormal;
#endif//FS_USE_NORMAL
#ifdef FS_USE_TANGENT
layout(location = 3) VS_OUTPUT_LAYOUT vec3 v2fTangent;
#endif//FS_USE_TANGENT
#ifdef FS_USE_TEX_COORD
layout(location = 4) VS_OUTPUT_LAYOUT vec2 v2fTexCoord;
#endif//FS_USE_TEX_COORD

View File

@ -9,6 +9,15 @@
BEGIN_SHADER_NAMESPACE BEGIN_SHADER_NAMESPACE
namespace namespace
{ {
namespace InlineShader
{
UTF8String Header;
UTF8String UBOWorldMatrix;
UTF8String PushConstant;
UTF8String VSOutputLayout;
}//namespace InlineShader
constexpr enum class API DEFAULT_RENDER_API =API::Vulkan; constexpr enum class API DEFAULT_RENDER_API =API::Vulkan;
constexpr uint DEFAULT_RENDER_API_VERSION =450; constexpr uint DEFAULT_RENDER_API_VERSION =450;

View File

@ -12,6 +12,7 @@ SOURCE_GROUP("VertexBuffer" FILES ${SG_VERTEX_SOURCE})
SET(SCENE_GRAPH_HEADER ${ROOT_INCLUDE_PATH}/hgl/graph/Coordinate.h SET(SCENE_GRAPH_HEADER ${ROOT_INCLUDE_PATH}/hgl/graph/Coordinate.h
${ROOT_INCLUDE_PATH}/hgl/graph/AABox.h ${ROOT_INCLUDE_PATH}/hgl/graph/AABox.h
${ROOT_INCLUDE_PATH}/hgl/graph/WorldMatrix.h
${ROOT_INCLUDE_PATH}/hgl/graph/Camera.h ${ROOT_INCLUDE_PATH}/hgl/graph/Camera.h
${ROOT_INCLUDE_PATH}/hgl/graph/Light.h ${ROOT_INCLUDE_PATH}/hgl/graph/Light.h
${ROOT_INCLUDE_PATH}/hgl/graph/SceneDB.h ${ROOT_INCLUDE_PATH}/hgl/graph/SceneDB.h