OMNeT++ Simulation Library
6.0.3
|
#include <cosgcanvas.h>
Wraps an OpenSceneGraph scene, allowing 3D visualization in graphical user interfaces that support it (currently Qtenv).
This class only wraps an OSG scene (as an osg::Node* pointer) and some visualization hints, other tasks like setting up a 3D viewer window are taken care of by the OMNeT++ user interface code (Qtenv). The scene graph can be assembled using the OSG API, e.g. using osgDB::readNodeFile() or creating and adding nodes directly.
Since OpenSceneGraph is not a mandatory part of OMNeT++, it is recommended that you surround your OSG code with #ifdef WITH_OSG.
Classes | |
struct | EarthViewpoint |
Defines a viewpoint in 3D space with geographical coordinates, for osgEarth-style viewing. More... | |
struct | Viewpoint |
Defines a viewpoint in the 3D space. More... | |
Public Types | |
enum | ViewerStyle { STYLE_GENERIC, STYLE_EARTH } |
Viewer styles. More... | |
enum | CameraManipulatorType { CAM_AUTO, CAM_TERRAIN, CAM_OVERVIEW, CAM_TRACKBALL, CAM_EARTH } |
Camera manupulator types. More... | |
Public Member Functions | |
Constructors, destructor, assignment | |
cOsgCanvas (const char *name=nullptr, ViewerStyle viewerStyle=STYLE_GENERIC, osg::Node *scene=nullptr) | |
cOsgCanvas (const cOsgCanvas &other) | |
virtual | ~cOsgCanvas () |
cOsgCanvas & | operator= (const cOsgCanvas &other) |
Redefined cObject member functions. | |
virtual cOsgCanvas * | dup () const override |
virtual std::string | str () const override |
OSG scene. | |
virtual void | setScene (osg::Node *scene) |
virtual osg::Node * | getScene () const |
Hints for the OSG viewer. | |
void | setViewerStyle (ViewerStyle viewerStyle) |
ViewerStyle | getViewerStyle () const |
void | setClearColor (Color clearColor) |
const Color & | getClearColor () const |
void | setCameraManipulatorType (CameraManipulatorType manipulator) |
CameraManipulatorType | getCameraManipulatorType () const |
void | setFieldOfViewAngle (double fieldOfViewAngle) |
double | getFieldOfViewAngle () const |
void | setZNear (double zNear) |
void | setZFar (double zFar) |
void | setZLimits (double zNear, double zFar) |
void | clearZLimits () |
bool | hasZLimits () const |
double | getZNear () const |
double | getZFar () const |
Viewer hints for the generic style. | |
void | setGenericViewpoint (const Viewpoint &viewpoint) |
const Viewpoint & | getGenericViewpoint () const |
osgEarth-related viewer hints. | |
void | setEarthViewpoint (const EarthViewpoint &earthViewpoint) |
const EarthViewpoint & | getEarthViewpoint () const |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual void | parsimPack (cCommBuffer *buffer) const override |
virtual void | parsimUnpack (cCommBuffer *buffer) override |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | setName (const char *s) |
virtual const char * | getName () const override |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
Public Member Functions inherited from cObject | |
cObject () | |
cObject (const cObject &other)=default | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
virtual std::string | getClassAndFullName () const |
virtual std::string | getClassAndFullPath () const |
const cObject * | getThisPtr () const |
virtual std::ostream & | printOn (std::ostream &os) const |
virtual bool | isSoftOwner () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
|
inlineoverridevirtual |
Should be redefined in subclasses to create an exact copy of this object. The default implementation just throws an error, to indicate that the method was not redefined.
Reimplemented from cObject.
|
overridevirtual |
Returns a brief, one-line description of the object. The returned string does (should) NOT include the object's name and class. This method is used to display object information at several places in the Qtenv GUI, among others.
Reimplemented from cObject.
|
virtual |
Set the 3D scene to be displayed. Note that osg::Node implements reference counting, and setScene() increments the reference count.
|
inlinevirtual |
Return the 3D scene to be displayed.
|
inline |
Sets the viewer style. This hint affects the defaults for several other hints, for example the camera maniplator hint. Currently there are two styles, STYLE_GENERIC for generic OSG (non-osgEarth), and STYLE_EARTH for osgEarth models.
|
inline |
Return the viewer style hint.
|
inline |
Set the color hint for the background behind the scene. Note that this hint will be ignored by osgEarth models, because osgEarth uses sky models for the same purpose.
|
inline |
Return the color hint for background behind the scene.
|
inline |
Set the camera manipulator type hint. The camera manipulator determines how the camera reacts to mouse/keyboard actions. CAM_TERRAIN, CAM_OVERVIEW, and CAM_TRACKBALL are useful when viewing generic OSG scenes, and CAM_EARTH is useful for osgEarth scenes.
|
inline |
Return the camera manipulator type hint.
|
inline |
Set the field of view angle hint, in degrees, in the y direction.
|
inline |
Return the field of view angle hint, in degrees, in the y direction.
|
inline |
Set the distance hint from the viewer to the near clipping plane (always positive).
|
inline |
Set the distance hint from the viewer to the far clipping plane (always positive).
|
inline |
Set the distance from the viewer to the near and far clipping planes (always positive) as viewer hint. When not set, the corresponding limits are computed automatically by the viewer.
void clearZLimits | ( | ) |
Unset the zNear/zFar values set via setZLimits().
bool hasZLimits | ( | ) | const |
Returns true if the zNear/zFar values are set manually.
|
inline |
Return the distance hint from the viewer to the near clipping plane. Returns NaN when not set (e.g. after clearZLimits()).
|
inline |
Return the distance from the viewer to the far clipping plane. Returns NaN when not set (e.g. after clearZLimits()).
void setGenericViewpoint | ( | const Viewpoint & | viewpoint | ) |
Sets the initial genericViewpoint hint.
|
inline |
Returns the initial genericViewpoint hint.
void setEarthViewpoint | ( | const EarthViewpoint & | earthViewpoint | ) |
Sets the initial earthViewpoint hint.
|
inline |
Returns the initial earthViewpoint hint.