source: osgVisual/src/object/object_updater.cpp @ 162

Last change on this file since 162 was 88, checked in by Torben Dannhauer, 14 years ago

Moved memory leak detection from source file to headerfile. Its still in the class but at least not in the source file.

The leak detection works, but the false positives are not stopped.
Use Linux/Valgrind? to make your final leak detection beyond the easy first approach in MSVC

File size: 3.1 KB
Line 
1/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer
2 *
3 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
9 * You have to aquire licenses for all used proprietary modules.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * OpenSceneGraph Public License for more details.
15*/
16
17#include <object_updater.h>
18
19using namespace osgVisual;
20
21object_updater::object_updater(osgVisual::visual_object* object_ )
22{
23}
24
25object_updater::~object_updater(void)
26{
27}
28
29void object_updater::preUpdate(osgVisual::visual_object* object_ )
30{
31        OSG_NOTIFY( osg::INFO ) << "preUpdate visual Object " << object_->getName() << std::endl;
32        // perform this preUpdater...
33        //For each visual_object.member,
34        //      try to search according variable in dataIO with direction TO_OBJ and copy value to visual_object.
35
36       
37        object_->lat = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_LAT", osgVisual::dataIO_slot::TO_OBJ ));
38        object_->lon = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_LON", osgVisual::dataIO_slot::TO_OBJ ));
39        object_->alt = osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_ALT", osgVisual::dataIO_slot::TO_OBJ );
40        object_->azimuthAngle_psi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_Z", osgVisual::dataIO_slot::TO_OBJ ));
41        object_->pitchAngle_theta = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_Y", osgVisual::dataIO_slot::TO_OBJ ));
42        object_->bankAngle_phi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_X", osgVisual::dataIO_slot::TO_OBJ ));
43
44        //object_->setCameraOffsetTranslation(0.0, -150.0, 50.0);       // Trans: (rechts davon, longitudinal, vertikal)
45        object_->setCameraOffsetTranslation( 150.0, 0.0, 30.0);
46        object_->setCameraOffsetRotation( osg::DegreesToRadians(0.0), osg::DegreesToRadians(-15.0), osg::DegreesToRadians(-90.0) );
47       
48
49
50        // Finally execute nested PreUpdater
51        if ( updater.valid() )
52                updater->preUpdate(object_);
53}
54
55void object_updater::postUpdate(osgVisual::visual_object* object_ )
56{
57        OSG_NOTIFY( osg::INFO ) << "postUpdate visual Object " << object_->getName() << std::endl;
58
59        // Finally execute nested PostUpdater
60        if ( updater.valid() )
61                updater->postUpdate(object_);
62}
63
64void object_updater::addUpdater( object_updater* updater_ )
65{
66        if (updater.valid())
67                updater->addUpdater( updater_ );
68        else
69                updater = updater_;
70}
Note: See TracBrowser for help on using the repository browser.