本文整理汇总了C++中TransformComponent::GetOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::GetOrientation方法的具体用法?C++ TransformComponent::GetOrientation怎么用?C++ TransformComponent::GetOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::GetOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOrientation
Quat TransformComponent::GetOrientation(bool Relative) const
{
//Entity* P = m_Entity->GetParent();
Quat Orientation = m_Orientation;
if(m_HasParent) {
TransformComponent* t = (TransformComponent*)m_RelativeTo->GetComponentByType(CT_TRANSFORM);
if(t) Orientation *= t->GetOrientation(Relative);
}
/*if(P && !Relative && m_InheritOrientation)
{
TransformComponent* t = GetTransformComponent(P);
if(t) Orientation *= t->GetOrientation(Relative);
P->Destroy();
}*/
return Orientation;
}
示例2: GetTransform
Mat4 TransformComponent::GetTransform(bool Relative)
{
if(m_Updated)
{
/* To do: Optimize. */
m_Transform = Mat4::Identity;
if(m_Position.x + m_Position.y + m_Position.z != 0.0f) m_Transform = Translation(m_Position);
if(!m_FirstPerson) {
if(m_Orientation.w != 0.0f) m_Transform *= m_Orientation.ToMat();
} else {
Quat pitch = Quat(Vec3(1,0,0), m_FirstPersonYRot);
Quat yaw = Quat(Vec3(0,1,0), m_FirstPersonXRot);
m_Orientation = yaw * pitch;
if(m_Orientation.w != 0.0f) m_Transform *= m_Orientation.ToMat();
}
m_Transform *= SandboxSimulator::Scale(m_Scale);
m_NormalMatrix = m_Orientation.ToMat().Inverse().Transpose();
m_Updated = false;
}
//Entity* Parent = m_Entity->GetParent();
if(m_HasParent) {
TransformComponent* t = (TransformComponent*)m_RelativeTo->GetComponentByType(CT_TRANSFORM);
if(t)
{
Mat4 ret = m_Transform;
ret = t->GetOrientation(false).ToMat() * ret;
ret = SandboxSimulator::Translation(t->GetPosition(false)) * ret;
ret = SandboxSimulator::Scale(t->GetScale()) * ret;
return ret;
}
}
/*if(Parent && !m_Simulated && !Relative && (m_InheritPosition || m_InheritOrientation || m_InheritScale))
{
TransformComponent* t = GetTransformComponent(Parent);
if(t)
{
if(m_InheritPosition && m_InheritOrientation && m_InheritScale) return t->GetTransform(Relative) * m_Transform;
Matrix4 ret = m_Transform;
if(m_InheritOrientation) ret = t->GetOrientation(false).ToMatrix() * ret;
if(m_InheritPosition ) ret = Translation(t->GetPosition(false)) * ret;
if(m_InheritScale ) ret = Reality::Scale(t->GetScale()) * ret;
return ret;
}
}*/
return m_Transform;
}