当前位置: 首页>>代码示例>>C++>>正文


C++ TransformComponent::GetOrientation方法代码示例

本文整理汇总了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;
 }
开发者ID:mdecicco,项目名称:SandboxSimulator2014,代码行数:16,代码来源:TransformComponent.cpp

示例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;
 }
开发者ID:mdecicco,项目名称:SandboxSimulator2014,代码行数:47,代码来源:TransformComponent.cpp


注:本文中的TransformComponent::GetOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。