Added IdentityLocalMatrix in SceneOrient
This commit is contained in:
parent
a04752b391
commit
d11b84222f
@ -21,6 +21,8 @@ namespace hgl
|
|||||||
Vector3f Position; ///<坐标
|
Vector3f Position; ///<坐标
|
||||||
Vector3f Direction; ///<方向
|
Vector3f Direction; ///<方向
|
||||||
|
|
||||||
|
bool IdentityLocalMatrix; ///<是否为空矩阵
|
||||||
|
|
||||||
Matrix4f LocalMatrix; ///<当前矩阵(指相对上一级的变换矩阵)
|
Matrix4f LocalMatrix; ///<当前矩阵(指相对上一级的变换矩阵)
|
||||||
Matrix4f LocalToWorldMatrix; ///<当前到世界矩阵
|
Matrix4f LocalToWorldMatrix; ///<当前到世界矩阵
|
||||||
|
|
||||||
@ -43,6 +45,8 @@ namespace hgl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
const bool IsIdentityLocalMatrix ()const{return IdentityLocalMatrix;} ///<是否为空矩阵(相对上一级没变化)
|
||||||
|
|
||||||
Matrix4f & SetLocalMatrix (const Matrix4f &); ///<设定当前节点矩阵
|
Matrix4f & SetLocalMatrix (const Matrix4f &); ///<设定当前节点矩阵
|
||||||
Matrix4f & SetLocalToWorldMatrix (const Matrix4f &); ///<设定当前节点到世界矩阵
|
Matrix4f & SetLocalToWorldMatrix (const Matrix4f &); ///<设定当前节点到世界矩阵
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ namespace hgl
|
|||||||
Position=Vector3f(0.0f);
|
Position=Vector3f(0.0f);
|
||||||
Direction=Vector3f(0.0f);
|
Direction=Vector3f(0.0f);
|
||||||
|
|
||||||
|
IdentityLocalMatrix=true;
|
||||||
|
|
||||||
LocalMatrix =Identity4f;
|
LocalMatrix =Identity4f;
|
||||||
LocalToWorldMatrix =Identity4f;
|
LocalToWorldMatrix =Identity4f;
|
||||||
InverseLocalMatrix =Identity4f;
|
InverseLocalMatrix =Identity4f;
|
||||||
@ -26,6 +28,8 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
LocalMatrix=m;
|
LocalMatrix=m;
|
||||||
|
|
||||||
|
IdentityLocalMatrix=IsIdentity(m);
|
||||||
|
|
||||||
InverseLocalMatrix=inverse(LocalMatrix);
|
InverseLocalMatrix=inverse(LocalMatrix);
|
||||||
|
|
||||||
return LocalMatrix;
|
return LocalMatrix;
|
||||||
@ -46,7 +50,10 @@ namespace hgl
|
|||||||
*/
|
*/
|
||||||
void SceneOrient::RefreshLocalToWorldMatrix(const Matrix4f *m)
|
void SceneOrient::RefreshLocalToWorldMatrix(const Matrix4f *m)
|
||||||
{
|
{
|
||||||
SetLocalToWorldMatrix(TransformMatrix(*m,LocalMatrix));
|
if(IdentityLocalMatrix)
|
||||||
|
SetLocalToWorldMatrix(*m);
|
||||||
|
else
|
||||||
|
SetLocalToWorldMatrix(TransformMatrix(*m,LocalMatrix));
|
||||||
}
|
}
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user