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


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

本文整理汇总了C++中TransformComponent::GetScale方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::GetScale方法的具体用法?C++ TransformComponent::GetScale怎么用?C++ TransformComponent::GetScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransformComponent的用法示例。


在下文中一共展示了TransformComponent::GetScale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetScale

 Vec3 TransformComponent::GetScale(bool Relative) const
 {
     //Entity* P = m_Entity->GetParent();
     Vec3 Sc = m_Scale;
     if(m_HasParent) {
         TransformComponent* t = (TransformComponent*)m_RelativeTo->GetComponentByType(CT_TRANSFORM);
         if(t) Sc *= t->GetScale(Relative);
     }
     /*if(P && !Relative && m_InheritScale)
     {
         TransformComponent* t = GetTransformComponent(P);
         if(t) Sc *= t->GetScale(Relative);
         P->Destroy();
     }*/
     return Sc;
 }
开发者ID:mdecicco,项目名称:SandboxSimulator2014,代码行数:16,代码来源:TransformComponent.cpp

示例2: CircleCollider

	CollisionComponent*
	CollisionComponent::Factory(GameObject &gameObject, Collider *collider)
	{
		if (nullptr == collider)
		{
			TransformComponent *transform = static_cast<TransformComponent*>(gameObject.FilterComponent("Transform").front().get());
			SDL_Rect pos = transform->GetPosition();
			SDL_Rect *scale = transform->GetScale();
			collider = new CircleCollider(Vector2D((float)pos.x, (float)pos.y), (scale->h/2));
		}

		CollisionComponent *collisionComponent = new CollisionComponent(collider);
		gameObject.RegisterComponent(Component(new CollisionComponent(collider)));

		return collisionComponent;
	}
开发者ID:teemitzitrone,项目名称:Chase-the-Shadow,代码行数:16,代码来源:CollisionComponent.cpp

示例3: 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

示例4: Draw

void GraphicsComponent::Draw(SpriteBatch* spriteBatch)
{
	TransformComponent* transformComponent = owner->GetComponent<TransformComponent>(TransformComponent::name);
	sprite->Draw(spriteBatch, transformComponent->GetPosition(), transformComponent->GetRotation(), transformComponent->GetScale());
}
开发者ID:TysonEX,项目名称:OpenGLGame,代码行数:5,代码来源:GraphicsComponent.cpp


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