[BUG] gizmoMove rootNote's ScaleMatrix's Z is non-work.

This commit is contained in:
hyzboy 2024-08-29 13:37:13 +08:00
parent 8245d83309
commit 442e52e17c
7 changed files with 35 additions and 14 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 45e02b7c7206ac459692d693c1b840f8378906d3
Subproject commit 97743adb3f36fdda659b584e6ff93773b2a85f2a

View File

@ -82,7 +82,7 @@ bool InitGizmoMoveStaticMesh()
}
{
SceneNode *root_node=new SceneNode();
SceneNode *root_node=new SceneNode(scale(1,1,2)); //.////// XY有效Z无效。。。在查为什么
root_node->CreateSubNode(sphere);

View File

@ -149,8 +149,8 @@ public:
// root.SetLocalTransform(tm);
//}
root.RefreshMatrix();
render_list->UpdateLocalToWorld();
//root.RefreshMatrix();
//render_list->UpdateLocalToWorld();
SceneAppFramework::BuildCommandBuffer(index);
}

View File

@ -37,8 +37,13 @@ namespace hgl
virtual ~SceneNode()=default;
void Clear()
void Clear() override
{
SceneOrient::Clear();
BoundingBox.SetZero();
LocalBoundingBox.SetZero();
SubNode.Clear();
render_obj=nullptr;
}

View File

@ -33,6 +33,14 @@ namespace hgl
public:
void Clear()
{
parent_matrix=Identity4f;
local_matrix=Identity4f;
transform_matrix=Identity4f;
UpdateVersion();
}
const Matrix4f &GetLocalMatrix()const{return local_matrix;} ///<取得本地矩阵
const Matrix4f &GetLocalToWorldMatrix(){return GetNewestVersionData();} ///<取得本地到世界矩阵
@ -49,9 +57,7 @@ namespace hgl
SceneMatrix():VersionData(Identity4f)
{
parent_matrix=Identity4f;
local_matrix=Identity4f;
transform_matrix=Identity4f;
Clear();
}
SceneMatrix(SceneMatrix &so):VersionData(so.GetLocalToWorldMatrix())
@ -63,11 +69,13 @@ namespace hgl
inverse_local_to_world_matrix=so.inverse_local_to_world_matrix;
inverse_transpose_local_to_world_matrix=so.inverse_transpose_local_to_world_matrix;
UpdateVersion();
}
SceneMatrix(const Matrix4f &mat):VersionData(Identity4f)
{
SetLocalMatrix(mat);
UpdateVersion();
}
void SetLocalMatrix(const Matrix4f &mat)
@ -117,6 +125,12 @@ namespace hgl
SceneOrient(const Matrix4f &);
virtual ~SceneOrient()=default;
virtual void Clear()
{
scene_matrix.Clear();
WorldPosition=ZeroVector3f;
}
void SetLocalMatrix (const Matrix4f &mat){scene_matrix.SetLocalMatrix(mat);} ///<设置本地矩阵
void SetParentMatrix (const Matrix4f &mat){scene_matrix.SetParentMatrix(mat);} ///<设置上级到世界空间变换矩阵

View File

@ -44,8 +44,8 @@ namespace hgl
*/
void SceneNode::RefreshMatrix()
{
if (scene_matrix.IsNewestVersion())
return;
// if (scene_matrix.IsNewestVersion()) //自己不变,不代表下面不变
//return;
const Matrix2f &l2w=scene_matrix.GetLocalToWorldMatrix();

View File

@ -7,13 +7,17 @@ namespace hgl
{
scene_matrix=so.scene_matrix;
WorldPosition=so.WorldPosition;
scene_matrix.UpdateNewestData();
}
SceneOrient::SceneOrient(const Matrix4f &mat):SceneOrient()
{
scene_matrix.SetLocalMatrix(mat);
scene_matrix.UpdateNewestData();
WorldPosition=TransformPosition(mat,ZeroVector3f);
WorldPosition=TransformPosition(GetLocalToWorldMatrix(),ZeroVector3f);
}
void SceneOrient::RefreshMatrix()
@ -24,9 +28,7 @@ namespace hgl
return;
}
const Matrix4f &l2w=scene_matrix.GetNewestVersionData();
WorldPosition=TransformPosition(l2w,ZeroVector3f);
WorldPosition=TransformPosition(GetLocalToWorldMatrix(),ZeroVector3f);
}
}//namespace graph
}//namespace hgl