[BUG] gizmoMove rootNote's ScaleMatrix's Z is non-work.
This commit is contained in:
parent
8245d83309
commit
442e52e17c
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 45e02b7c7206ac459692d693c1b840f8378906d3
|
Subproject commit 97743adb3f36fdda659b584e6ff93773b2a85f2a
|
@ -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);
|
root_node->CreateSubNode(sphere);
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@ public:
|
|||||||
// root.SetLocalTransform(tm);
|
// root.SetLocalTransform(tm);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
root.RefreshMatrix();
|
//root.RefreshMatrix();
|
||||||
render_list->UpdateLocalToWorld();
|
//render_list->UpdateLocalToWorld();
|
||||||
|
|
||||||
SceneAppFramework::BuildCommandBuffer(index);
|
SceneAppFramework::BuildCommandBuffer(index);
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,13 @@ namespace hgl
|
|||||||
|
|
||||||
virtual ~SceneNode()=default;
|
virtual ~SceneNode()=default;
|
||||||
|
|
||||||
void Clear()
|
void Clear() override
|
||||||
{
|
{
|
||||||
|
SceneOrient::Clear();
|
||||||
|
|
||||||
|
BoundingBox.SetZero();
|
||||||
|
LocalBoundingBox.SetZero();
|
||||||
|
|
||||||
SubNode.Clear();
|
SubNode.Clear();
|
||||||
render_obj=nullptr;
|
render_obj=nullptr;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,14 @@ namespace hgl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
parent_matrix=Identity4f;
|
||||||
|
local_matrix=Identity4f;
|
||||||
|
transform_matrix=Identity4f;
|
||||||
|
UpdateVersion();
|
||||||
|
}
|
||||||
|
|
||||||
const Matrix4f &GetLocalMatrix()const{return local_matrix;} ///<取得本地矩阵
|
const Matrix4f &GetLocalMatrix()const{return local_matrix;} ///<取得本地矩阵
|
||||||
|
|
||||||
const Matrix4f &GetLocalToWorldMatrix(){return GetNewestVersionData();} ///<取得本地到世界矩阵
|
const Matrix4f &GetLocalToWorldMatrix(){return GetNewestVersionData();} ///<取得本地到世界矩阵
|
||||||
@ -49,9 +57,7 @@ namespace hgl
|
|||||||
|
|
||||||
SceneMatrix():VersionData(Identity4f)
|
SceneMatrix():VersionData(Identity4f)
|
||||||
{
|
{
|
||||||
parent_matrix=Identity4f;
|
Clear();
|
||||||
local_matrix=Identity4f;
|
|
||||||
transform_matrix=Identity4f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneMatrix(SceneMatrix &so):VersionData(so.GetLocalToWorldMatrix())
|
SceneMatrix(SceneMatrix &so):VersionData(so.GetLocalToWorldMatrix())
|
||||||
@ -63,11 +69,13 @@ namespace hgl
|
|||||||
|
|
||||||
inverse_local_to_world_matrix=so.inverse_local_to_world_matrix;
|
inverse_local_to_world_matrix=so.inverse_local_to_world_matrix;
|
||||||
inverse_transpose_local_to_world_matrix=so.inverse_transpose_local_to_world_matrix;
|
inverse_transpose_local_to_world_matrix=so.inverse_transpose_local_to_world_matrix;
|
||||||
|
UpdateVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneMatrix(const Matrix4f &mat):VersionData(Identity4f)
|
SceneMatrix(const Matrix4f &mat):VersionData(Identity4f)
|
||||||
{
|
{
|
||||||
SetLocalMatrix(mat);
|
SetLocalMatrix(mat);
|
||||||
|
UpdateVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLocalMatrix(const Matrix4f &mat)
|
void SetLocalMatrix(const Matrix4f &mat)
|
||||||
@ -117,6 +125,12 @@ namespace hgl
|
|||||||
SceneOrient(const Matrix4f &);
|
SceneOrient(const Matrix4f &);
|
||||||
virtual ~SceneOrient()=default;
|
virtual ~SceneOrient()=default;
|
||||||
|
|
||||||
|
virtual void Clear()
|
||||||
|
{
|
||||||
|
scene_matrix.Clear();
|
||||||
|
WorldPosition=ZeroVector3f;
|
||||||
|
}
|
||||||
|
|
||||||
void SetLocalMatrix (const Matrix4f &mat){scene_matrix.SetLocalMatrix(mat);} ///<设置本地矩阵
|
void SetLocalMatrix (const Matrix4f &mat){scene_matrix.SetLocalMatrix(mat);} ///<设置本地矩阵
|
||||||
void SetParentMatrix (const Matrix4f &mat){scene_matrix.SetParentMatrix(mat);} ///<设置上级到世界空间变换矩阵
|
void SetParentMatrix (const Matrix4f &mat){scene_matrix.SetParentMatrix(mat);} ///<设置上级到世界空间变换矩阵
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ namespace hgl
|
|||||||
*/
|
*/
|
||||||
void SceneNode::RefreshMatrix()
|
void SceneNode::RefreshMatrix()
|
||||||
{
|
{
|
||||||
if (scene_matrix.IsNewestVersion())
|
// if (scene_matrix.IsNewestVersion()) //自己不变,不代表下面不变
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
const Matrix2f &l2w=scene_matrix.GetLocalToWorldMatrix();
|
const Matrix2f &l2w=scene_matrix.GetLocalToWorldMatrix();
|
||||||
|
|
||||||
|
@ -7,13 +7,17 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
scene_matrix=so.scene_matrix;
|
scene_matrix=so.scene_matrix;
|
||||||
WorldPosition=so.WorldPosition;
|
WorldPosition=so.WorldPosition;
|
||||||
|
|
||||||
|
scene_matrix.UpdateNewestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneOrient::SceneOrient(const Matrix4f &mat):SceneOrient()
|
SceneOrient::SceneOrient(const Matrix4f &mat):SceneOrient()
|
||||||
{
|
{
|
||||||
scene_matrix.SetLocalMatrix(mat);
|
scene_matrix.SetLocalMatrix(mat);
|
||||||
|
|
||||||
|
scene_matrix.UpdateNewestData();
|
||||||
|
|
||||||
WorldPosition=TransformPosition(mat,ZeroVector3f);
|
WorldPosition=TransformPosition(GetLocalToWorldMatrix(),ZeroVector3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOrient::RefreshMatrix()
|
void SceneOrient::RefreshMatrix()
|
||||||
@ -24,9 +28,7 @@ namespace hgl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Matrix4f &l2w=scene_matrix.GetNewestVersionData();
|
WorldPosition=TransformPosition(GetLocalToWorldMatrix(),ZeroVector3f);
|
||||||
|
|
||||||
WorldPosition=TransformPosition(l2w,ZeroVector3f);
|
|
||||||
}
|
}
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user