Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpVisualActor.cpp
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | if (m_Unit->GetModel().ToCModel()) | ||||
// Ensure the prop transforms are correct | // Ensure the prop transforms are correct | ||||
CmpPtr<ICmpUnitRenderer> cmpUnitRenderer(GetSystemEntity()); | CmpPtr<ICmpUnitRenderer> cmpUnitRenderer(GetSystemEntity()); | ||||
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle()); | CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle()); | ||||
if (cmpUnitRenderer && cmpPosition) | if (cmpUnitRenderer && cmpPosition) | ||||
{ | { | ||||
float frameOffset = cmpUnitRenderer->GetFrameOffset(); | float frameOffset = cmpUnitRenderer->GetFrameOffset(); | ||||
CMatrix3D transform(cmpPosition->GetInterpolatedTransform(frameOffset)); | CMatrix3D transform(cmpPosition->GetInterpolatedTransform(frameOffset)); | ||||
m_Unit->GetModel().SetTransform(transform); | m_Unit->GetModel().SetTransform(transform); | ||||
m_Unit->GetModel().ValidatePosition(); | m_Unit->GetModel().ValidatePositionRec(); | ||||
} | } | ||||
CModelAbstract* ammo = m_Unit->GetModel().ToCModel()->FindFirstAmmoProp(); | CModelAbstract* ammo = m_Unit->GetModel().ToCModel()->FindFirstAmmoProp(); | ||||
if (ammo) | if (ammo) | ||||
{ | { | ||||
CVector3D vector = ammo->GetTransform().GetTranslation(); | CVector3D vector = ammo->GetTransform().GetTranslation(); | ||||
return CFixedVector3D(fixed::FromFloat(vector.X), fixed::FromFloat(vector.Y), fixed::FromFloat(vector.Z)); | return CFixedVector3D(fixed::FromFloat(vector.X), fixed::FromFloat(vector.Y), fixed::FromFloat(vector.Z)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator