[WIP] improving SceneOrient

This commit is contained in:
2024-08-25 04:03:57 +08:00
parent f4e16276ff
commit 410b94a127
3 changed files with 75 additions and 38 deletions

View File

@@ -1,9 +1,8 @@
#ifndef HGL_GRAPH_SCENE_ORIENT_INCLUDE
#define HGL_GRAPH_SCENE_ORIENT_INCLUDE
//#include<hgl/type/List.h>
#include<hgl/math/Math.h>
#include<hgl/graph/VK.h>
#include<hgl/math/Transform.h>
namespace hgl
{
namespace graph
@@ -14,15 +13,23 @@ namespace hgl
class SceneOrient ///场景定位类
{
protected:
Matrix4f parent_matrix;
bool parent_matrix_dirty;
Matrix4f local_matrix;
bool local_matrix_dirty;
TransformManager transform_manager;
uint32 transform_version;
Matrix4f ParentMatrix; ///<上级矩阵
uint32 local_to_world_matrix_version;
Matrix4f LocalMatrix; ///<本地到上一级矩阵
Matrix4f LocalToWorldMatrix; ///<本地到世界矩阵
Matrix4f InverseLocalToWorldMatrix; ///<世界到本地矩阵
Matrix4f InverseTransposeLocalToWorldMatrix; ///<世界到本地矩阵的转置矩阵
// LocalToWorld = ParentMatrix * LocalMatrix * TransformMatrix
Matrix4f local_to_world_matrix; ///<本地到世界矩阵
Matrix4f inverse_local_to_world_matrix; ///<世界到本地矩阵
Matrix4f inverse_transpose_local_to_world_matrix; ///<世界到本地矩阵的转置矩阵
virtual void SetWorldMatrix(const Matrix4f &);
@@ -33,18 +40,20 @@ namespace hgl
SceneOrient(const Matrix4f &);
virtual ~SceneOrient()=default;
void SetLocalMatrix(const Matrix4f &); ///<设置本地矩阵
public:
const Matrix4f & GetLocalMatrix ()const{return local_matrix;}
TransformManager * GetTransform (){return &transform_manager;} ///<取得变换管理器
TransformManager & GetTransform () {return transform_manager;} ///<取得变换管理器
const Matrix4f & GetLocalMatrix ()const{return LocalMatrix;}
const Matrix4f & GetLocalToWorldMatrix ()const{return LocalToWorldMatrix;}
const Matrix4f & GetInverseLocalToWorldMatrix ()const{return InverseLocalToWorldMatrix;}
const Matrix4f & GetInverseTransposeLocalToWorldMatrix ()const{return InverseTransposeLocalToWorldMatrix;}
const Matrix4f & GetLocalToWorldMatrix ()const{return local_to_world_matrix;}
const Matrix4f & GetInverseLocalToWorldMatrix ()const{return inverse_local_to_world_matrix;}
const Matrix4f & GetInverseTransposeLocalToWorldMatrix ()const{return inverse_transpose_local_to_world_matrix;}
public:
virtual bool RefreshMatrix (const Matrix4f &); ///<刷新到世界空间变换
virtual bool RefreshMatrix (const Matrix4f &); ///<刷新到世界空间变换
};//class SceneOrient
}//namespace graph
}//namespace hgl