[[TracNav(TracNav/TOC)]] = visual_object = == Introduction == All objects in the 3D scene are nodes of the scenegraph. Besides the object management via controlling all object nodes manually, osgVisual provides a module for objects with convenience function for common tasks. The module "visual_object" allows to manage objects in the scene, with fixed or dynamic position. An visual_object can be positioned in latitude, longitude and altitude, as well in rotations along all three axis. The object itself is not visible, it only provides the functions for managing the object. By adding text labels or geometries, it is visible in the scene. If you want to specialize visual_object for more specifiy usage, subclass visual_object and add your new convenient values and calculations, e.g.: * visual_aircraft * Add gear : extraction_value * Add light : navigationlight_value * Add propeller rpm : prop_rpm_value == Overview Convenience Functions == visual_object provides the following convenience variables / functions for simple usage of objects in osgVisual: * positioning in lat, lon, alt (position) * rotating along all 3 object axis (attitude) * scaling along all 3 axis * loading/unloading 3D geometry * setting geometry rotation offset, if 3D model has wrong axis orientation * setting geometry translation offset, if 3D model has wrong coordinate frame origin * setting camera translation offset (used by node attached camera manipulator) * setting camera rotation offset (used by node attached camera manipulator) * adding/removing object_updater (see [http://www.osgvisual.org/projects/osgvisual/wiki/visual_object#Objectupdater object updater] for further information) * adding/removing label (see [http://www.osgvisual.org/projects/osgvisual/wiki/visual_object#Objectlabels object labels] for further information) == Technical Implementation == This description does not replace the dive into the source code, it should give you only a short overview how it works. Please read the doxygen documentation of all function calls: http://www.osgvisual.org/notyetpublished Basically, a visual_object is a subclass of a simple Matrixtransform which has the geometry as child node. Additionally it contains variables and their setters/getter for all specified convenient functions. The Matrixtransform has several child which are matrixes or drawables to provide the functionality: The core functionality is an update callback (installed on the visual_object class by its initializer), which transforms the specified object properties to the corresponding matrices: * lat/lon/alt via OSG'S ellipsoid model and its computeLocalToWorld() to the objects transform matrix. * scale values to the scaling matrix. * camera values to the camera matrix. * geometry offset values to the object matrix. The object updater and label functions are not updated every frame by the callback, it just invokes their own udpdate functions. == Object labels == tbd == Object updater == To allow flexible updates of visual_object or derived classes (short: object), an object_updater can be attached to a object. Update are also attachable to other updaters, so updater chains are possible to create.