![]() |
VR-Forces 5.0.3 Developer's Guide
|
The window object API supports the drawing of multiple 2D graphical objects and text on screen.
The API implements a parenting system similar to a scene graph, and is maintained outside of OSG in vrvCore.
All of the window objects described have agent implementations. exampleWindowObjects and exampleWindowObjectHud show how to use them.
DtWindowObject - is the base class for all of the following window objects. It has no OSG implementation.
A DtWindowObject holds a child list of DtUniqueIDs, all of the above window objects can be attached to each other using addChild. Although DtWindowObject has no OSG implementation, one can be created to hold a number of objects for control through a single object; this is also the concept behind surfaces.
DtWindowObject::needsUpdate processes its own child list, and calls needsUpdate on them. It also gets information from its own parent that it needs to update specific member variables, more on this below.
The concept of surfaces is that 2D objects can be drawn "on" them, when really they inherit from DtWindowObject and behave like any other window object with a few exceptions.
DtWindowSurface defines a section of the screen that window objects can render within. This is done by setting a clipBox that will clip window object vertices that extend past the edges of the box. Clip boxes are defined in normalised screen coordinates on a per channel basis using two coordinates, a bottom left 2D Vector and top right 2D vector (setClipBox method).
Surfaces should be top level objects. In DtWindowObject::needsUpdate an object will get the clipBox information from its parent and set it to its own myClipBox member variable; this way the information is passed down through the hierarchy.
The UV coordinates passed into setSurfaceCoordinateExtents allow for a sub coordinate system "on" the surface. For example: the screen is 0.0->1.0, the surface clipbox can be from 0.25->0.75 but you may wish to represent the 0.25->0.75 as 0.0->1.0. The scale and origin or position of the surface uses these values (from the setClipBox method):
A DtWindowEntityAttachedSurface allows for surfaces to move around the screen and track an entity's position. A user can set the entity ID on the surface, and the surface will update its own clipBox information in needsUpdate(). As the clip box is constantly updating, the clipbox is specified as a width and height in normalised screen coordinates (setSurfaceWidthHeight). A user can also set offsets from the entity position that are added to the entity position before the position is projected to the screen (setOffsets).
Note that for a DtWindowEntityAttachedSurface a user must set the channel that the surface is to be located by either using - setChannel( DtChannel* channel ) or setChannelOverlay( std::string displayName, std::string windowName, std::string channelName )
By default all channels are ceated with the "showRemoteGraphics" keyword, any window objects created will be shown on all channels with this keyword. When removing the keyword from channels, is it recommended to save the display settings as a .dcx file, and restart vrVantage.
In order to render specific objects on specific channels, a user must remove this keyword from the channel, and call setChannelOverlay. Note that this does not work for remote displays.
setChannelOverlay only needs to be called on the top level parent object, it will traverse the child list and update their channels too.
Each window object has a position, rotation and scale, these are combined into a transform matrix (relative transform) in needsUpdate. If the object has no parent, this transform is set as myWindowTransform, the final transform for the object. If the object has a parent the relative transform matrix is multiplied by the parent objects myWindowTransform, to give its own final window transform.
Non-uniform scales are supported. However, if a user sets a surface as a base level window object, with non-uniform scales, then proceeds to attach children and rotate the child, they will get shear/skewing of the child object. This is a product of parent / child matrice hierarchies. This limitation is expected.
DtWindowPolygon - A simple polygon, the polygons OSG instances utilises a DtFilledPolygon or a DtOutlinedPolygon. The filled polygon does not support concave shapes as the methods used for DtWindowPolygon in DtFilledPolygon triangulate from the center of all vertices.
DtWindowEllipse - Can draw ellipses / circles in almost any manner. Filled, Outlined, with a start and end angle (in radians), inner and outer dimensions. OSG instance uses DtFilledPolygon and DtSegmentedLine.
DtWindowLine - OSG instance uses DtSegmentedLine to render lines, supports a number of stipple patterns.
DtWindowText - OSG instance uses a DtTextProxy to render text. Fonts from the "/data/fonts" folder can be set, and alignment of the text. Text objects are clipped as entire objects (top left corner), we do not support individual character clipping.
DtWindowTriangleStrip - Renders vertices as a triangle strip primitive, does not support outlining. OSG instance utilises a DtFilledPolygon
DtWindowTriangleFan - Renders vertices as a triangle fan primitive, the first vertex passed in is used as the frist vertex for each triangle.
[<< Attributes] [Home] [Top of Page]