Merge 'remotes/trunk'
[0ad.git] / source / renderer / Scene.cpp
blob8f143b838ad4775c95db3ba60184d070a357324a
1 /* Copyright (C) 2021 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #include "precompiled.h"
20 #include "renderer/Scene.h"
22 #include "graphics/Model.h"
23 #include "graphics/ParticleEmitter.h"
25 ///////////////////////////////////////////////////////////
26 // Default implementation traverses the model recursively and uses
27 // SubmitNonRecursive for the actual work.
28 void SceneCollector::SubmitRecursive(CModelAbstract* model)
30 if (model->ToCModel())
32 SubmitNonRecursive(model->ToCModel());
34 const std::vector<CModel::Prop>& props = model->ToCModel()->GetProps();
35 for (size_t i = 0; i < props.size(); i++)
37 if (!props[i].m_Hidden)
38 SubmitRecursive(props[i].m_Model);
41 else if (model->ToCModelDecal())
43 Submit(model->ToCModelDecal());
45 else if (model->ToCModelParticleEmitter())
47 Submit(model->ToCModelParticleEmitter()->m_Emitter.get());
49 else if (model->ToCModelDummy())
52 else
53 debug_warn(L"unknown model type");