add WorldMatrix.h
This commit is contained in:
parent
f3961d7c6b
commit
148372a601
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 5ec34e30035a8ef4eeb8c116e19c79d12663c828
|
Subproject commit cdc2805477fc91ccebb87d56e5e9b8d7bcb492e6
|
@ -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
|
||||||
|
31
inc/hgl/graph/WorldMatrix.h
Normal file
31
inc/hgl/graph/WorldMatrix.h
Normal 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
|
25
res/shader/vertex_shader_output_layout.glsl
Normal file
25
res/shader/vertex_shader_output_layout.glsl
Normal 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
|
@ -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;
|
||||||
|
|
||||||
@ -22,7 +31,7 @@ namespace
|
|||||||
node::VertexFinished vs_fin_node; //创建一个vs最终节点
|
node::VertexFinished vs_fin_node; //创建一个vs最终节点
|
||||||
|
|
||||||
node::VertexInput vi; //创建一个顶点输入节点
|
node::VertexInput vi; //创建一个顶点输入节点
|
||||||
|
|
||||||
param::OutputParam *op=vi.Add( SHADER_VERTEX_INPUT_STREAM_POSITION_NAME, //该节点输出参数名称
|
param::OutputParam *op=vi.Add( SHADER_VERTEX_INPUT_STREAM_POSITION_NAME, //该节点输出参数名称
|
||||||
param::ParamType::Float3); //该节点数据类型
|
param::ParamType::Float3); //该节点数据类型
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user