From df5189ed09cab1197ddbb4e9f5a3d7959c961e3e Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 31 Aug 2024 00:04:15 +0800 Subject: [PATCH] added WorldPosition in TransformBase --- inc/hgl/math/Transform.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/inc/hgl/math/Transform.h b/inc/hgl/math/Transform.h index 3cfb316..1d6aeb4 100644 --- a/inc/hgl/math/Transform.h +++ b/inc/hgl/math/Transform.h @@ -10,6 +10,10 @@ namespace hgl */ class TransformBase:public VersionData { + protected: + + Vector3f WorldPosition; + protected: virtual void MakeNewestData(Matrix4f &)=0; @@ -22,8 +26,10 @@ namespace hgl virtual constexpr const size_t GetTypeHash()const=0; ///<取得类型哈希值 - const uint32 GetMatrix(Matrix4f &mat) ///<取得当前矩阵,并返回当前矩阵版本号 + const uint32 GetMatrix(Matrix4f &mat,const Vector3f &wp) ///<取得当前矩阵,并返回当前矩阵版本号 { + WorldPosition=wp; + return GetNewestVersionData(mat); } @@ -482,7 +488,7 @@ namespace hgl for (TransformBase *tb : transform_list) { - tb->GetMatrix(TempMatrix); + tb->GetMatrix(TempMatrix,WorldPosition); mat*=TempMatrix; } @@ -492,6 +498,8 @@ namespace hgl virtual constexpr const size_t GetTypeHash()const override { return hgl::GetTypeHash(); } + const bool IsEmpty()const { return transform_list.IsEmpty(); } + public: TransformManager()=default;