Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ParticleEmitter.cpp
/* Copyright (C) 2020 Wildfire Games. | /* Copyright (C) 2021 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 246 Lines • ▼ Show 20 Lines | |||||
void CModelParticleEmitter::SetEntityVariable(const std::string& name, float value) | void CModelParticleEmitter::SetEntityVariable(const std::string& name, float value) | ||||
{ | { | ||||
m_Emitter->SetEntityVariable(name, value); | m_Emitter->SetEntityVariable(name, value); | ||||
} | } | ||||
CModelAbstract* CModelParticleEmitter::Clone() const | CModelAbstract* CModelParticleEmitter::Clone() const | ||||
{ | { | ||||
return new CModelParticleEmitter(m_Type); | CModelAbstract* clone = new CModelParticleEmitter(m_Type); | ||||
CModelAbstract::Clone(*clone); | |||||
return clone; | |||||
} | } | ||||
void CModelParticleEmitter::CalcBounds() | void CModelParticleEmitter::CalcBounds() | ||||
{ | { | ||||
// TODO: we ought to compute sensible bounds here, probably based on the | // TODO: we ought to compute sensible bounds here, probably based on the | ||||
// current computed particle positions plus the emitter type's largest | // current computed particle positions plus the emitter type's largest | ||||
// potential bounding box at the current position | // potential bounding box at the current position | ||||
m_WorldBounds = m_Type->CalculateBounds(m_Emitter->GetPosition(), m_Emitter->GetParticleBounds()); | m_WorldBounds = m_Type->CalculateBounds(m_Emitter->GetPosition(), m_Emitter->GetParticleBounds()); | ||||
} | } | ||||
void CModelParticleEmitter::ValidatePosition() | void CModelParticleEmitter::UpdatePositionTransforms() | ||||
{ | { | ||||
// TODO: do we need to do anything here? | // TODO: do we need to do anything here? | ||||
// This is a convenient (though possibly not particularly appropriate) place | // This is a convenient (though possibly not particularly appropriate) place | ||||
// to invalidate bounds so they'll be recomputed from the recent particle data | // to invalidate bounds so they'll be recomputed from the recent particle data | ||||
InvalidateBounds(); | InvalidateBounds(); | ||||
} | } | ||||
void CModelParticleEmitter::InvalidatePosition() | |||||
{ | |||||
} | |||||
void CModelParticleEmitter::SetTransform(const CMatrix3D& transform) | void CModelParticleEmitter::SetTransform(const CMatrix3D& transform) | ||||
{ | { | ||||
if (m_Transform == transform) | if (m_Transform == transform) | ||||
return; | return; | ||||
m_Emitter->SetPosition(transform.GetTranslation()); | m_Emitter->SetPosition(transform.GetTranslation()); | ||||
m_Emitter->SetRotation(transform.GetRotation()); | m_Emitter->SetRotation(transform.GetRotation()); | ||||
// call base class to set transform on this object | // call base class to set transform on this object | ||||
CRenderableObject::SetTransform(transform); | CRenderableObject::SetTransform(transform); | ||||
} | } |
Wildfire Games · Phabricator