added WorldPosition in TransformBase

This commit is contained in:
hyzboy 2024-08-31 00:04:15 +08:00
parent 0ac2a9431a
commit df5189ed09

View File

@ -10,6 +10,10 @@ namespace hgl
*/ */
class TransformBase:public VersionData<Matrix4f> class TransformBase:public VersionData<Matrix4f>
{ {
protected:
Vector3f WorldPosition;
protected: protected:
virtual void MakeNewestData(Matrix4f &)=0; virtual void MakeNewestData(Matrix4f &)=0;
@ -22,8 +26,10 @@ namespace hgl
virtual constexpr const size_t GetTypeHash()const=0; ///<取得类型哈希值 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); return GetNewestVersionData(mat);
} }
@ -482,7 +488,7 @@ namespace hgl
for (TransformBase *tb : transform_list) for (TransformBase *tb : transform_list)
{ {
tb->GetMatrix(TempMatrix); tb->GetMatrix(TempMatrix,WorldPosition);
mat*=TempMatrix; mat*=TempMatrix;
} }
@ -492,6 +498,8 @@ namespace hgl
virtual constexpr const size_t GetTypeHash()const override { return hgl::GetTypeHash<TransformManager>(); } virtual constexpr const size_t GetTypeHash()const override { return hgl::GetTypeHash<TransformManager>(); }
const bool IsEmpty()const { return transform_list.IsEmpty(); }
public: public:
TransformManager()=default; TransformManager()=default;