1 | #include <string> |
---|
2 | |
---|
3 | #include "Model.h" |
---|
4 | #include "../core/CoreIncludes.h" |
---|
5 | #include "../orxonox.h" |
---|
6 | #include "../../tinyxml/tinyxml.h" |
---|
7 | #include "../../misc/Tokenizer.h" |
---|
8 | #include "../../misc/String2Number.h" |
---|
9 | |
---|
10 | namespace orxonox |
---|
11 | { |
---|
12 | CreateFactory(Model); |
---|
13 | |
---|
14 | Model::Model() |
---|
15 | { |
---|
16 | RegisterObject(Model); |
---|
17 | } |
---|
18 | |
---|
19 | Model::~Model() |
---|
20 | { |
---|
21 | } |
---|
22 | |
---|
23 | void Model::loadParams(TiXmlElement* xmlElem) |
---|
24 | { |
---|
25 | std::cout << "### START PARSING MODEL" << std::endl; |
---|
26 | WorldEntity::loadParams(xmlElem); |
---|
27 | |
---|
28 | |
---|
29 | std::cout << "Model: 1\n"; |
---|
30 | if (xmlElem->Attribute("mesh")) |
---|
31 | { |
---|
32 | std::cout << "Model: 2_1\n"; |
---|
33 | std::string src = xmlElem->Attribute("mesh"); |
---|
34 | std::cout << "Model: 2_2\n"; |
---|
35 | std::cout << "Model: mesh before creation: " << &this->mesh_ << std::endl; |
---|
36 | std::cout << "Model: entity before creation: " << this->mesh_.getEntity() << std::endl; |
---|
37 | this->mesh_ = Mesh(src); |
---|
38 | std::cout << "Model: 2_3\n"; |
---|
39 | std::cout << "Model: entity after creation: " << this->mesh_.getEntity() << std::endl; |
---|
40 | std::cout << "Model: mesh after creation: " << &this->mesh_ << std::endl; |
---|
41 | std::cout << "Model: node: " << this->getNode() << std::endl; |
---|
42 | |
---|
43 | //Entity *ent2 = Orxonox::getSingleton()->getSceneManager()->createEntity( "Robot2", "ogrehead.mesh" ); |
---|
44 | //SceneNode *node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode2", Vector3( 50, 0, 0 ) ); |
---|
45 | //node2->attachObject( ent2 ); |
---|
46 | //this->attachObject( ent2 ); |
---|
47 | //node2->attachObject( this->mesh_.getEntity() ); |
---|
48 | this->attachObject( this->mesh_.getEntity() ); |
---|
49 | |
---|
50 | // this->attachObject(this->mesh_.getEntity()); |
---|
51 | std::cout << "Model: 2_4\n"; |
---|
52 | } |
---|
53 | std::cout << "Model: 3\n"; |
---|
54 | std::cout << "### FINISHED PARSING MODEL" << std::endl; |
---|
55 | |
---|
56 | COUT(4) << "Loader: Created model" << std::endl; |
---|
57 | } |
---|
58 | } |
---|