2
* Copyright Staffan Gimåker 2008-2009.
6
* This file is part of peekabot.
8
* peekabot is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* peekabot is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "ModelProxy.hh"
23
#include "../SceneAction.hh"
24
#include "../Scene.hh"
25
#include "../entities/MeshBased.hh"
26
#include "../PbmfLoader.hh"
29
using namespace peekabot;
30
using namespace peekabot::renderer;
31
using namespace peekabot::renderer::api;
34
ModelProxy::ModelProxy(
36
const std::string &filename)
37
: ObjectEntityProxy(renderer)
39
class AddModel : public SceneAction
42
AddModel(EntityID id, const std::string &filename)
43
: m_id(id), m_filename(filename) {}
45
virtual void execute(SceneAction::Context &context)
48
MeshBased *model = loader.load(m_filename);
52
context.scene().add_entity(m_id, model);
63
const std::string m_filename;
66
dispatch(new AddModel(entity_id(), filename));