]> git.lizzy.rs Git - dragonfireclient.git/blob - src/content_cao.cpp
reorganized a lot of stuff and modified mapgen and objects slightly while doing it
[dragonfireclient.git] / src / content_cao.cpp
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "content_cao.h"
21 #include "tile.h"
22 #include "environment.h"
23
24 /*
25         TestCAO
26 */
27
28 // Prototype
29 TestCAO proto_TestCAO;
30
31 TestCAO::TestCAO():
32         ClientActiveObject(0),
33         m_node(NULL),
34         m_position(v3f(0,10*BS,0))
35 {
36         ClientActiveObject::registerType(getType(), create);
37 }
38
39 TestCAO::~TestCAO()
40 {
41 }
42
43 ClientActiveObject* TestCAO::create()
44 {
45         return new TestCAO();
46 }
47
48 void TestCAO::addToScene(scene::ISceneManager *smgr)
49 {
50         if(m_node != NULL)
51                 return;
52         
53         video::IVideoDriver* driver = smgr->getVideoDriver();
54         
55         scene::SMesh *mesh = new scene::SMesh();
56         scene::IMeshBuffer *buf = new scene::SMeshBuffer();
57         video::SColor c(255,255,255,255);
58         video::S3DVertex vertices[4] =
59         {
60                 video::S3DVertex(-BS/2,-BS/4,0, 0,0,0, c, 0,1),
61                 video::S3DVertex(BS/2,-BS/4,0, 0,0,0, c, 1,1),
62                 video::S3DVertex(BS/2,BS/4,0, 0,0,0, c, 1,0),
63                 video::S3DVertex(-BS/2,BS/4,0, 0,0,0, c, 0,0),
64         };
65         u16 indices[] = {0,1,2,2,3,0};
66         buf->append(vertices, 4, indices, 6);
67         // Set material
68         buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
69         buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
70         buf->getMaterial().setTexture
71                         (0, driver->getTexture(getTexturePath("rat.png").c_str()));
72         buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
73         buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
74         buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
75         // Add to mesh
76         mesh->addMeshBuffer(buf);
77         buf->drop();
78         m_node = smgr->addMeshSceneNode(mesh, NULL);
79         mesh->drop();
80         updateNodePos();
81 }
82
83 void TestCAO::removeFromScene()
84 {
85         if(m_node == NULL)
86                 return;
87
88         m_node->remove();
89         m_node = NULL;
90 }
91
92 void TestCAO::updateLight(u8 light_at_pos)
93 {
94 }
95
96 v3s16 TestCAO::getLightPosition()
97 {
98         return floatToInt(m_position, BS);
99 }
100
101 void TestCAO::updateNodePos()
102 {
103         if(m_node == NULL)
104                 return;
105
106         m_node->setPosition(m_position);
107         //m_node->setRotation(v3f(0, 45, 0));
108 }
109
110 void TestCAO::step(float dtime, ClientEnvironment *env)
111 {
112         if(m_node)
113         {
114                 v3f rot = m_node->getRotation();
115                 //dstream<<"dtime="<<dtime<<", rot.Y="<<rot.Y<<std::endl;
116                 rot.Y += dtime * 180;
117                 m_node->setRotation(rot);
118         }
119 }
120
121 void TestCAO::processMessage(const std::string &data)
122 {
123         dstream<<"TestCAO: Got data: "<<data<<std::endl;
124         std::istringstream is(data, std::ios::binary);
125         u16 cmd;
126         is>>cmd;
127         if(cmd == 0)
128         {
129                 v3f newpos;
130                 is>>newpos.X;
131                 is>>newpos.Y;
132                 is>>newpos.Z;
133                 m_position = newpos;
134                 updateNodePos();
135         }
136 }
137
138 /*
139         ItemCAO
140 */
141
142 #include "inventory.h"
143
144 // Prototype
145 ItemCAO proto_ItemCAO;
146
147 ItemCAO::ItemCAO():
148         ClientActiveObject(0),
149         m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.),
150         m_node(NULL),
151         m_position(v3f(0,10*BS,0))
152 {
153         ClientActiveObject::registerType(getType(), create);
154 }
155
156 ItemCAO::~ItemCAO()
157 {
158 }
159
160 ClientActiveObject* ItemCAO::create()
161 {
162         return new ItemCAO();
163 }
164
165 void ItemCAO::addToScene(scene::ISceneManager *smgr)
166 {
167         if(m_node != NULL)
168                 return;
169         
170         video::IVideoDriver* driver = smgr->getVideoDriver();
171         
172         scene::SMesh *mesh = new scene::SMesh();
173         scene::IMeshBuffer *buf = new scene::SMeshBuffer();
174         video::SColor c(255,255,255,255);
175         video::S3DVertex vertices[4] =
176         {
177                 /*video::S3DVertex(-BS/2,-BS/4,0, 0,0,0, c, 0,1),
178                 video::S3DVertex(BS/2,-BS/4,0, 0,0,0, c, 1,1),
179                 video::S3DVertex(BS/2,BS/4,0, 0,0,0, c, 1,0),
180                 video::S3DVertex(-BS/2,BS/4,0, 0,0,0, c, 0,0),*/
181                 video::S3DVertex(BS/3.,0,0, 0,0,0, c, 0,1),
182                 video::S3DVertex(-BS/3.,0,0, 0,0,0, c, 1,1),
183                 video::S3DVertex(-BS/3.,0+BS*2./3.,0, 0,0,0, c, 1,0),
184                 video::S3DVertex(BS/3.,0+BS*2./3.,0, 0,0,0, c, 0,0),
185         };
186         u16 indices[] = {0,1,2,2,3,0};
187         buf->append(vertices, 4, indices, 6);
188         // Set material
189         buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
190         buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
191         //buf->getMaterial().setTexture(0, NULL);
192         // Initialize with the stick texture
193         buf->getMaterial().setTexture
194                         (0, driver->getTexture(getTexturePath("stick.png").c_str()));
195         buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
196         buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
197         buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
198         // Add to mesh
199         mesh->addMeshBuffer(buf);
200         buf->drop();
201         m_node = smgr->addMeshSceneNode(mesh, NULL);
202         mesh->drop();
203         // Set it to use the materials of the meshbuffers directly.
204         // This is needed for changing the texture in the future
205         m_node->setReadOnlyMaterials(true);
206         updateNodePos();
207 }
208
209 void ItemCAO::removeFromScene()
210 {
211         if(m_node == NULL)
212                 return;
213
214         m_node->remove();
215         m_node = NULL;
216 }
217
218 void ItemCAO::updateLight(u8 light_at_pos)
219 {
220         if(m_node == NULL)
221                 return;
222
223         u8 li = decode_light(light_at_pos);
224         video::SColor color(255,li,li,li);
225
226         scene::IMesh *mesh = m_node->getMesh();
227         if(mesh == NULL)
228                 return;
229         
230         u16 mc = mesh->getMeshBufferCount();
231         for(u16 j=0; j<mc; j++)
232         {
233                 scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
234                 video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
235                 u16 vc = buf->getVertexCount();
236                 for(u16 i=0; i<vc; i++)
237                 {
238                         vertices[i].Color = color;
239                 }
240         }
241 }
242
243 v3s16 ItemCAO::getLightPosition()
244 {
245         return floatToInt(m_position, BS);
246 }
247
248 void ItemCAO::updateNodePos()
249 {
250         if(m_node == NULL)
251                 return;
252
253         m_node->setPosition(m_position);
254 }
255
256 void ItemCAO::step(float dtime, ClientEnvironment *env)
257 {
258         if(m_node)
259         {
260                 /*v3f rot = m_node->getRotation();
261                 rot.Y += dtime * 120;
262                 m_node->setRotation(rot);*/
263                 LocalPlayer *player = env->getLocalPlayer();
264                 assert(player);
265                 v3f rot = m_node->getRotation();
266                 rot.Y = 180.0 - (player->getYaw());
267                 m_node->setRotation(rot);
268         }
269 }
270
271 void ItemCAO::processMessage(const std::string &data)
272 {
273         dstream<<"ItemCAO: Got message"<<std::endl;
274         std::istringstream is(data, std::ios::binary);
275         // command
276         u8 cmd = readU8(is);
277         if(cmd == 0)
278         {
279                 // pos
280                 m_position = readV3F1000(is);
281                 updateNodePos();
282         }
283 }
284
285 void ItemCAO::initialize(const std::string &data)
286 {
287         dstream<<"ItemCAO: Got init data"<<std::endl;
288         
289         {
290                 std::istringstream is(data, std::ios::binary);
291                 // version
292                 u8 version = readU8(is);
293                 // check version
294                 if(version != 0)
295                         return;
296                 // pos
297                 m_position = readV3F1000(is);
298                 // inventorystring
299                 m_inventorystring = deSerializeString(is);
300         }
301         
302         updateNodePos();
303
304         /*
305                 Update image of node
306         */
307
308         if(m_node == NULL)
309                 return;
310
311         scene::IMesh *mesh = m_node->getMesh();
312
313         if(mesh == NULL)
314                 return;
315         
316         scene::IMeshBuffer *buf = mesh->getMeshBuffer(0);
317
318         if(buf == NULL)
319                 return;
320
321         // Create an inventory item to see what is its image
322         std::istringstream is(m_inventorystring, std::ios_base::binary);
323         video::ITexture *texture = NULL;
324         try{
325                 InventoryItem *item = NULL;
326                 item = InventoryItem::deSerialize(is);
327                 dstream<<__FUNCTION_NAME<<": m_inventorystring=\""
328                                 <<m_inventorystring<<"\" -> item="<<item
329                                 <<std::endl;
330                 if(item)
331                 {
332                         texture = item->getImage();
333                         delete item;
334                 }
335         }
336         catch(SerializationError &e)
337         {
338                 dstream<<"WARNING: "<<__FUNCTION_NAME
339                                 <<": error deSerializing inventorystring \""
340                                 <<m_inventorystring<<"\""<<std::endl;
341         }
342         
343         // Set meshbuffer texture
344         buf->getMaterial().setTexture(0, texture);
345         
346 }
347
348 /*
349         RatCAO
350 */
351
352 #include "inventory.h"
353
354 // Prototype
355 RatCAO proto_RatCAO;
356
357 RatCAO::RatCAO():
358         ClientActiveObject(0),
359         m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS/2.,BS/3.),
360         m_node(NULL),
361         m_position(v3f(0,10*BS,0)),
362         m_yaw(0)
363 {
364         ClientActiveObject::registerType(getType(), create);
365 }
366
367 RatCAO::~RatCAO()
368 {
369 }
370
371 ClientActiveObject* RatCAO::create()
372 {
373         return new RatCAO();
374 }
375
376 void RatCAO::addToScene(scene::ISceneManager *smgr)
377 {
378         if(m_node != NULL)
379                 return;
380         
381         video::IVideoDriver* driver = smgr->getVideoDriver();
382         
383         scene::SMesh *mesh = new scene::SMesh();
384         scene::IMeshBuffer *buf = new scene::SMeshBuffer();
385         video::SColor c(255,255,255,255);
386         video::S3DVertex vertices[4] =
387         {
388                 video::S3DVertex(-BS/2,0,0, 0,0,0, c, 0,1),
389                 video::S3DVertex(BS/2,0,0, 0,0,0, c, 1,1),
390                 video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, 1,0),
391                 video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c, 0,0),
392         };
393         u16 indices[] = {0,1,2,2,3,0};
394         buf->append(vertices, 4, indices, 6);
395         // Set material
396         buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
397         buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
398         //buf->getMaterial().setTexture(0, NULL);
399         buf->getMaterial().setTexture
400                         (0, driver->getTexture(getTexturePath("rat.png").c_str()));
401         buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
402         buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
403         buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
404         // Add to mesh
405         mesh->addMeshBuffer(buf);
406         buf->drop();
407         m_node = smgr->addMeshSceneNode(mesh, NULL);
408         mesh->drop();
409         // Set it to use the materials of the meshbuffers directly.
410         // This is needed for changing the texture in the future
411         m_node->setReadOnlyMaterials(true);
412         updateNodePos();
413 }
414
415 void RatCAO::removeFromScene()
416 {
417         if(m_node == NULL)
418                 return;
419
420         m_node->remove();
421         m_node = NULL;
422 }
423
424 void RatCAO::updateLight(u8 light_at_pos)
425 {
426         if(m_node == NULL)
427                 return;
428
429         u8 li = decode_light(light_at_pos);
430         video::SColor color(255,li,li,li);
431
432         scene::IMesh *mesh = m_node->getMesh();
433         if(mesh == NULL)
434                 return;
435         
436         u16 mc = mesh->getMeshBufferCount();
437         for(u16 j=0; j<mc; j++)
438         {
439                 scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
440                 video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
441                 u16 vc = buf->getVertexCount();
442                 for(u16 i=0; i<vc; i++)
443                 {
444                         vertices[i].Color = color;
445                 }
446         }
447 }
448
449 v3s16 RatCAO::getLightPosition()
450 {
451         return floatToInt(m_position+v3f(0,BS*0.5,0), BS);
452 }
453
454 void RatCAO::updateNodePos()
455 {
456         if(m_node == NULL)
457                 return;
458
459         //m_node->setPosition(m_position);
460         m_node->setPosition(pos_translator.vect_show);
461
462         v3f rot = m_node->getRotation();
463         rot.Y = 180.0 - m_yaw;
464         m_node->setRotation(rot);
465 }
466
467 void RatCAO::step(float dtime, ClientEnvironment *env)
468 {
469         pos_translator.translate(dtime);
470         updateNodePos();
471 }
472
473 void RatCAO::processMessage(const std::string &data)
474 {
475         //dstream<<"RatCAO: Got message"<<std::endl;
476         std::istringstream is(data, std::ios::binary);
477         // command
478         u8 cmd = readU8(is);
479         if(cmd == 0)
480         {
481                 // pos
482                 m_position = readV3F1000(is);
483                 pos_translator.update(m_position);
484                 // yaw
485                 m_yaw = readF1000(is);
486                 updateNodePos();
487         }
488 }
489
490 void RatCAO::initialize(const std::string &data)
491 {
492         //dstream<<"RatCAO: Got init data"<<std::endl;
493         
494         {
495                 std::istringstream is(data, std::ios::binary);
496                 // version
497                 u8 version = readU8(is);
498                 // check version
499                 if(version != 0)
500                         return;
501                 // pos
502                 m_position = readV3F1000(is);
503                 pos_translator.init(m_position);
504         }
505         
506         updateNodePos();
507 }
508
509 /*
510         Oerkki1CAO
511 */
512
513 #include "inventory.h"
514
515 // Prototype
516 Oerkki1CAO proto_Oerkki1CAO;
517
518 Oerkki1CAO::Oerkki1CAO():
519         ClientActiveObject(0),
520         m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS*2.,BS/3.),
521         m_node(NULL),
522         m_position(v3f(0,10*BS,0)),
523         m_yaw(0),
524         m_damage_visual_timer(0),
525         m_damage_texture_enabled(false)
526 {
527         ClientActiveObject::registerType(getType(), create);
528 }
529
530 Oerkki1CAO::~Oerkki1CAO()
531 {
532 }
533
534 ClientActiveObject* Oerkki1CAO::create()
535 {
536         return new Oerkki1CAO();
537 }
538
539 void Oerkki1CAO::addToScene(scene::ISceneManager *smgr)
540 {
541         if(m_node != NULL)
542                 return;
543         
544         video::IVideoDriver* driver = smgr->getVideoDriver();
545         
546         scene::SMesh *mesh = new scene::SMesh();
547         scene::IMeshBuffer *buf = new scene::SMeshBuffer();
548         video::SColor c(255,255,255,255);
549         video::S3DVertex vertices[4] =
550         {
551                 video::S3DVertex(-BS/2-BS,0,0, 0,0,0, c, 0,1),
552                 video::S3DVertex(BS/2+BS,0,0, 0,0,0, c, 1,1),
553                 video::S3DVertex(BS/2+BS,BS*2,0, 0,0,0, c, 1,0),
554                 video::S3DVertex(-BS/2-BS,BS*2,0, 0,0,0, c, 0,0),
555         };
556         u16 indices[] = {0,1,2,2,3,0};
557         buf->append(vertices, 4, indices, 6);
558         // Set material
559         buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
560         buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
561         //buf->getMaterial().setTexture(0, NULL);
562         buf->getMaterial().setTexture
563                         (0, driver->getTexture(getTexturePath("oerkki1.png").c_str()));
564         buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
565         buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
566         buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
567         // Add to mesh
568         mesh->addMeshBuffer(buf);
569         buf->drop();
570         m_node = smgr->addMeshSceneNode(mesh, NULL);
571         mesh->drop();
572         // Set it to use the materials of the meshbuffers directly.
573         // This is needed for changing the texture in the future
574         m_node->setReadOnlyMaterials(true);
575         updateNodePos();
576 }
577
578 void Oerkki1CAO::removeFromScene()
579 {
580         if(m_node == NULL)
581                 return;
582
583         m_node->remove();
584         m_node = NULL;
585 }
586
587 void Oerkki1CAO::updateLight(u8 light_at_pos)
588 {
589         if(m_node == NULL)
590                 return;
591         
592         if(light_at_pos <= 2)
593         {
594                 m_node->setVisible(false);
595                 return;
596         }
597
598         m_node->setVisible(true);
599
600         u8 li = decode_light(light_at_pos);
601         video::SColor color(255,li,li,li);
602
603         scene::IMesh *mesh = m_node->getMesh();
604         if(mesh == NULL)
605                 return;
606         
607         u16 mc = mesh->getMeshBufferCount();
608         for(u16 j=0; j<mc; j++)
609         {
610                 scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
611                 video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
612                 u16 vc = buf->getVertexCount();
613                 for(u16 i=0; i<vc; i++)
614                 {
615                         vertices[i].Color = color;
616                 }
617         }
618 }
619
620 v3s16 Oerkki1CAO::getLightPosition()
621 {
622         return floatToInt(m_position+v3f(0,BS*1.5,0), BS);
623 }
624
625 void Oerkki1CAO::updateNodePos()
626 {
627         if(m_node == NULL)
628                 return;
629
630         //m_node->setPosition(m_position);
631         m_node->setPosition(pos_translator.vect_show);
632
633         v3f rot = m_node->getRotation();
634         rot.Y = 180.0 - m_yaw + 90.0;
635         m_node->setRotation(rot);
636 }
637
638 void Oerkki1CAO::step(float dtime, ClientEnvironment *env)
639 {
640         pos_translator.translate(dtime);
641         updateNodePos();
642
643         LocalPlayer *player = env->getLocalPlayer();
644         assert(player);
645         
646         v3f playerpos = player->getPosition();
647         v2f playerpos_2d(playerpos.X,playerpos.Z);
648         v2f objectpos_2d(m_position.X,m_position.Z);
649
650         if(fabs(m_position.Y - playerpos.Y) < 3.0*BS &&
651                         objectpos_2d.getDistanceFrom(playerpos_2d) < 1.5*BS)
652         {
653                 if(m_attack_interval.step(dtime, 0.5))
654                 {
655                         env->damageLocalPlayer(2);
656                 }
657         }
658
659         if(m_damage_visual_timer > 0)
660         {
661                 if(!m_damage_texture_enabled)
662                 {
663                         // Enable damage texture
664                         if(m_node)
665                         {
666                                 video::IVideoDriver* driver =
667                                         m_node->getSceneManager()->getVideoDriver();
668                                 
669                                 scene::IMesh *mesh = m_node->getMesh();
670                                 if(mesh == NULL)
671                                         return;
672                                 
673                                 u16 mc = mesh->getMeshBufferCount();
674                                 for(u16 j=0; j<mc; j++)
675                                 {
676                                         scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
677                                         buf->getMaterial().setTexture(0, driver->getTexture(
678                                                         getTexturePath("oerkki1_damaged.png").c_str()));
679                                 }
680                         }
681                         m_damage_texture_enabled = true;
682                 }
683                 m_damage_visual_timer -= dtime;
684         }
685         else
686         {
687                 if(m_damage_texture_enabled)
688                 {
689                         // Disable damage texture
690                         if(m_node)
691                         {
692                                 video::IVideoDriver* driver =
693                                         m_node->getSceneManager()->getVideoDriver();
694                                 
695                                 scene::IMesh *mesh = m_node->getMesh();
696                                 if(mesh == NULL)
697                                         return;
698                                 
699                                 u16 mc = mesh->getMeshBufferCount();
700                                 for(u16 j=0; j<mc; j++)
701                                 {
702                                         scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
703                                         buf->getMaterial().setTexture(0, driver->getTexture(
704                                                         getTexturePath("oerkki1.png").c_str()));
705                                 }
706                         }
707                         m_damage_texture_enabled = false;
708                 }
709         }
710 }
711
712 void Oerkki1CAO::processMessage(const std::string &data)
713 {
714         //dstream<<"Oerkki1CAO: Got message"<<std::endl;
715         std::istringstream is(data, std::ios::binary);
716         // command
717         u8 cmd = readU8(is);
718         if(cmd == 0)
719         {
720                 // pos
721                 m_position = readV3F1000(is);
722                 pos_translator.update(m_position);
723                 // yaw
724                 m_yaw = readF1000(is);
725                 updateNodePos();
726         }
727         else if(cmd == 1)
728         {
729                 u16 damage = readU8(is);
730                 m_damage_visual_timer = 1.0;
731         }
732 }
733
734 void Oerkki1CAO::initialize(const std::string &data)
735 {
736         //dstream<<"Oerkki1CAO: Got init data"<<std::endl;
737         
738         {
739                 std::istringstream is(data, std::ios::binary);
740                 // version
741                 u8 version = readU8(is);
742                 // check version
743                 if(version != 0)
744                         return;
745                 // pos
746                 m_position = readV3F1000(is);
747                 pos_translator.init(m_position);
748         }
749         
750         updateNodePos();
751 }
752
753