Merge 'remotes/trunk'
[0ad.git] / source / renderer / Scene.cpp
bloba499b03f1d4451064a2a0a50bbfa8ba11182a4ab
1 /* Copyright (C) 2011 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/>.
19 * File : Scene.cpp
20 * Project : graphics
21 * Description : This file contains default implementations and utilities
22 * : to be used together with the Scene interface and related
23 * : classes.
25 * @note This file would fit just as well into the graphics/ subdirectory.
28 #include "precompiled.h"
30 #include "graphics/Model.h"
31 #include "graphics/ParticleEmitter.h"
32 #include "renderer/Scene.h"
34 ///////////////////////////////////////////////////////////
35 // Default implementation traverses the model recursively and uses
36 // SubmitNonRecursive for the actual work.
37 void SceneCollector::SubmitRecursive(CModelAbstract* model)
39 if (model->ToCModel())
41 SubmitNonRecursive(model->ToCModel());
43 const std::vector<CModel::Prop>& props = model->ToCModel()->GetProps();
44 for (size_t i = 0; i < props.size(); i++)
46 if (!props[i].m_Hidden)
47 SubmitRecursive(props[i].m_Model);
50 else if (model->ToCModelDecal())
52 Submit(model->ToCModelDecal());
54 else if (model->ToCModelParticleEmitter())
56 Submit(model->ToCModelParticleEmitter()->m_Emitter.get());
58 else
59 debug_warn(L"unknown model type");