2023-09-21 21:00:28 +02:00
|
|
|
/* Copyright (C) 2023 Wildfire Games.
|
2023-12-03 01:30:12 +01:00
|
|
|
* This file is part of 0 A.D.
|
2009-04-18 19:00:33 +02:00
|
|
|
*
|
2023-12-03 01:30:12 +01:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2009-04-18 19:00:33 +02:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2023-12-03 01:30:12 +01:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2009-04-18 19:00:33 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-12-03 01:30:12 +01:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-18 19:00:33 +02:00
|
|
|
*/
|
|
|
|
|
2009-04-11 19:00:39 +02:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
2021-06-01 20:55:35 +02:00
|
|
|
#include "renderer/Scene.h"
|
|
|
|
|
2009-04-11 19:00:39 +02:00
|
|
|
#include "graphics/Model.h"
|
2011-04-03 21:15:15 +02:00
|
|
|
#include "graphics/ParticleEmitter.h"
|
2009-04-11 19:00:39 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// Default implementation traverses the model recursively and uses
|
|
|
|
// SubmitNonRecursive for the actual work.
|
2011-03-13 20:22:05 +01:00
|
|
|
void SceneCollector::SubmitRecursive(CModelAbstract* model)
|
2009-04-11 19:00:39 +02:00
|
|
|
{
|
2011-03-13 20:22:05 +01:00
|
|
|
if (model->ToCModel())
|
|
|
|
{
|
|
|
|
SubmitNonRecursive(model->ToCModel());
|
2009-04-11 19:00:39 +02:00
|
|
|
|
2011-03-13 20:22:05 +01:00
|
|
|
const std::vector<CModel::Prop>& props = model->ToCModel()->GetProps();
|
|
|
|
for (size_t i = 0; i < props.size(); i++)
|
|
|
|
{
|
|
|
|
if (!props[i].m_Hidden)
|
2023-09-21 21:00:28 +02:00
|
|
|
SubmitRecursive(props[i].m_Model.get());
|
2011-03-13 20:22:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (model->ToCModelDecal())
|
2010-06-05 02:49:14 +02:00
|
|
|
{
|
2011-03-13 20:22:05 +01:00
|
|
|
Submit(model->ToCModelDecal());
|
2009-04-11 19:00:39 +02:00
|
|
|
}
|
2011-04-03 21:15:15 +02:00
|
|
|
else if (model->ToCModelParticleEmitter())
|
|
|
|
{
|
|
|
|
Submit(model->ToCModelParticleEmitter()->m_Emitter.get());
|
|
|
|
}
|
2021-04-09 17:45:31 +02:00
|
|
|
else if (model->ToCModelDummy())
|
|
|
|
{
|
|
|
|
}
|
2011-03-13 20:22:05 +01:00
|
|
|
else
|
|
|
|
debug_warn(L"unknown model type");
|
2009-04-11 19:00:39 +02:00
|
|
|
}
|