![]() |
AGX Dynamics 2.40.0.0
|
Decorates a scene with a specific AGX Rendering Style. More...
#include <SceneDecorator.h>
Public Types | |
enum | Lights { LIGHT0 = 0x1 , LIGHT1 = 0x2 , LIGHT2 = 0x4 , ALL = LIGHT0 | LIGHT1 | LIGHT2 } |
enum | LogoLocation { UPPER_LEFT = 0x1 , LOWER_LEFT = 0x2 , UPPER_RIGHT = 0x3 , LOWER_RIGHT = 0x4 , FREE } |
Specifies the location of the logo. More... | |
enum | ShadowMethod { SOFT_SHADOWMAP , SHADOWMAP , SHADOWVOLUME , PARALLELLSPLIT_SHADOWMAP , LIGHTSPACEPERSPECTIVE_SHADOWMAP , SHADOWTEXTURE , NO_SHADOWS } |
Public Member Functions | |
SceneDecorator (int windowSizeX, int windowSizeY, int enabledLights=LIGHT0|LIGHT1) | |
Constructor. | |
virtual bool | addChild (osg::Node *child) |
void | calculateLightPositions (const osg::BoundingBox &boundingBox) |
void | calculateLightPositions (const osg::BoundingSphere &boundingSphere) |
void | calculateLightPositions (osg::Node *bound_node=nullptr) |
Calculate the positions of the light sources from the bound of either a specified node, or if bound_node == 0, the sub-graph of this Group. | |
void | clearText () |
Reset all text to empty strings. | |
osg::StateSet * | getDecoratorStateSet () |
bool | getEnable () const |
Return true if AGX rendering style is enabled. | |
bool | getEnableCalculateLightPositions (Lights l) const |
bool | getEnableLogo () const |
bool | getEnableRenderedCursor () const |
bool | getEnableShaderState () const |
bool | getEnableShadows () const |
std::string | getFontName () const |
Returns the font name. | |
float | getFontSize () const |
Returns the font Size. | |
osg::MatrixTransform * | getHud () |
Return a pointer to the hud group. | |
agxOSG::LightSource | getLightSource (Lights l) |
Get a wrapper for a LightSource with only AGX types. | |
osg::Texture2D * | getLogo () |
const osg::Vec2 & | getLogoDimension () |
LogoLocation | getLogoLocation () const |
osg::Vec2 | getMaximumLogoDimension () |
osg::Group * | getNonShadowedScene () const |
osg::LightSource * | getOSGLight (Lights l) |
osg::Group * | getShadowedScene () const |
osg::LightSource * | getShadowLightSource () |
Return a pointer to the light source used for calculating shadows. | |
ShadowMethod | getShadowMethod () const |
virtual bool | insertChild (unsigned int index, osg::Node *child) |
bool | isEnabled () const |
Return true if AGX rendering style is enabled. | |
bool | removeChild (osg::Node *child) |
bool | removeChild (unsigned int pos, unsigned int numChildrenToRemove=1) |
virtual bool | removeChildren (unsigned int pos, unsigned int numChildrenToRemove) |
virtual bool | replaceChild (osg::Node *origChild, osg::Node *newChild) |
void | resetHUD () |
void | setBackgroundColor (agx::Vec3 color) |
Set a uniform background color using color . | |
void | setBackgroundColor (agx::Vec3 colorUL, agx::Vec3 colorUR, agx::Vec3 colorLL, agx::Vec3 colorLR) |
Set a gradient four color background (each corner) colorUL - Upper left color colorUR - Upper right color colorLL - Lower left color colorLR - Lower right color. | |
void | setBackgroundColor (agx::Vec3 upper, agx::Vec3 lower) |
Set a gradient two color background. | |
void | setBackgroundColor (const agx::Vec4f &color) |
Set a uniform background color using color . | |
void | setBackgroundColor (const agx::Vec4f &color1, const agx::Vec4f &color2) |
Set a gradient two color background. | |
void | setBackgroundColor (const agx::Vec4f &colorUL, const agx::Vec4f &colorUR, const agx::Vec4f &colorLL, const agx::Vec4f &colorLR) |
Set a gradient four color background (each corner) colorUL - Upper left color colorUR - Upper right color colorLL - Lower left color colorLR - Lower right color. | |
bool | setBaseTexture (const std::string &imagePath) |
Specif the path to the base texture on all decorated objects. | |
virtual bool | setChild (unsigned int i, osg::Node *node) |
void | setEnable (bool flag) |
Enable/disable AGX rendering style for sub-graph. | |
void | setEnableCalculateLightPositions (Lights l, bool f) |
void | setEnableLights (int lightMask=ALL) |
Reset and enable the specified lights. | |
void | setEnableLogo (bool flag) |
Enable/disable the rendering of the logo. | |
void | setEnableRenderedCursor (bool enable) |
Enable/disable the mouse cursor. | |
void | setEnableShaderState (bool flag, bool lock=false) |
Enable/disable the use of a shader based default render state. | |
void | setEnableShadows (bool flag) |
Enable/disable shadows for the sub-graph. | |
void | setFontName (const std::string &fontName) |
Sets the font name. | |
void | setFontSize (const float &fontSize) |
Sets the font Size. | |
void | setLogo (osg::Texture2D *logo, float density=1.0) |
Might want to call updateLogo afterwards. | |
bool | setLogoFile (const std::string &filename, float density=1.0) |
Specify a path to the image with the logo and the pixel density (i.e. 2.0 for high DPI and 1.0 for 1:1) | |
void | setLogoLocation (LogoLocation l) |
Set the position of the logo from a list of predefined positions. | |
void | setLogoPosition (float x, float y) |
Set the position of logo into [x , y ] if setLogoLocation(FREE) has been previously called Valid range is [0,1] where 0,0 is lower left corner. | |
void | setMaximumLogoDimension (float x, float y) |
Set the maximum logo dimension. | |
void | setScreenPixelScale (float scale) |
Specify the screen pixel scale (i.e. 2.0 for high DPI and 1.0 for 1:1) | |
bool | setShadowLightSource (Lights l) |
Specify which light source is used for calculating shadows. | |
void | setShadowMethod (ShadowMethod m) |
Specify which method is used for generating shadows,. | |
void | setText (int row, const agx::String &text) |
Print a row of text. | |
void | setText (int row, const agx::String &text, const agx::Vec4f &color) |
void | updateCursorPosition (float x, float y) |
void | updateWindowSize (int sizeX, int sizeY) |
Updates information about the window size in x and y (for logo scaling). | |
Static Public Member Functions | |
static const osg::Material * | getDefaultDecoratorMaterial () |
static osg::Vec2 | getDefaultLogoPosition () |
static size_t | lightToIndex (Lights l) |
Protected Member Functions | |
virtual | ~SceneDecorator () |
void | createBackground () |
void | createDecoratorState () |
void | createHUD () |
void | createLogo () |
void | init (Lights l) |
void | updateLogo () |
Updates the logo scale and position, depending on logo size, and window width and height. | |
Protected Attributes | |
osg::ref_ptr< osg::Vec3Array > | m_backgroundColors |
osg::observer_ptr< osg::Geometry > | m_backgroundQuad |
osg::ref_ptr< osg::Switch > | m_backgroundRoot |
std::string | m_baseTexturePath |
bool | m_calculateLightPosition [3] |
osg::ref_ptr< osg::Group > | m_currentRoot |
osg::ref_ptr< osg::Node > | m_cursorTransform |
osg::ref_ptr< osg::StateSet > | m_decoratorStateSet |
osg::ref_ptr< osg::Group > | m_disabledNonShadowRoot |
osg::ref_ptr< osg::Group > | m_disabledRoot |
bool | m_enabled |
osg::ref_ptr< osg::Group > | m_enabledNonShadowRoot |
osg::ref_ptr< osg::Group > | m_enabledRoot |
bool | m_enabledShadows |
std::string | m_fontName |
float | m_fontSize |
osg::ref_ptr< osg::Camera > | m_hudCamera |
osg::ref_ptr< osg::Projection > | m_hudProjection |
osg::ref_ptr< osg::MatrixTransform > | m_hudRoot |
agx::Vector< osg::ref_ptr< osg::LightSource > > | m_lightSources |
bool | m_logoEnabled |
LogoLocation | m_logoLocation |
float | m_logoPixelDensity |
osg::Vec2 | m_logoPosition |
osg::Vec2 | m_logoSize |
osg::ref_ptr< osg::StateSet > | m_logoStateSet |
osg::ref_ptr< osg::Switch > | m_logoSwitch |
osg::ref_ptr< osg::Texture2D > | m_logoTexture |
osg::ref_ptr< osg::PositionAttitudeTransform > | m_logoTransform |
float | m_maximumLogoDimensionX |
float | m_maximumLogoDimensionY |
float | m_screenPixelScale |
bool | m_shaderSupportAvailable |
osg::ref_ptr< osgShadow::ShadowedScene > | m_shadowedScene |
osg::ref_ptr< osg::LightSource > | m_ShadowlightSource |
ShadowMethod | m_shadowMethod |
osg::ref_ptr< osgShadow::ShadowTechnique > | m_shadowTechnique |
agx::Vector< osgText::Text * > | m_text |
bool | m_useShaderState |
int | m_windowSizeX |
int | m_windowSizeY |
Static Protected Attributes | |
static osg::ref_ptr< osg::Material > | s_decoratorMaterial |
Decorates a scene with a specific AGX Rendering Style.
SceneDecorator is a class that inherits from osg::Group and will decorate the sub-graph with a specific rendering style and a logo.
Definition at line 62 of file SceneDecorator.h.
Enumerator | |
---|---|
LIGHT0 | |
LIGHT1 | |
LIGHT2 | |
ALL |
Definition at line 211 of file SceneDecorator.h.
Specifies the location of the logo.
Enumerator | |
---|---|
UPPER_LEFT | |
LOWER_LEFT | |
UPPER_RIGHT | |
LOWER_RIGHT | |
FREE | Any position can be specified with the setLogoPosition() method. |
Definition at line 90 of file SceneDecorator.h.
Enumerator | |
---|---|
SOFT_SHADOWMAP | |
SHADOWMAP | |
SHADOWVOLUME | |
PARALLELLSPLIT_SHADOWMAP | Deprecated. |
LIGHTSPACEPERSPECTIVE_SHADOWMAP | |
SHADOWTEXTURE | |
NO_SHADOWS |
Definition at line 235 of file SceneDecorator.h.
agxOSG::SceneDecorator::SceneDecorator | ( | int | windowSizeX, |
int | windowSizeY, | ||
int | enabledLights = LIGHT0|LIGHT1 |
||
) |
Constructor.
windowSizeX | - The size of the window in x coordinates. |
windowSizeY | - The size of the window in y coordinates. |
enabledLights | - Specifies (using the Lights enum) which light sources should be created and used |
|
protectedvirtual |
|
inlinevirtual |
Definition at line 173 of file SceneDecorator.h.
void agxOSG::SceneDecorator::calculateLightPositions | ( | const osg::BoundingBox & | boundingBox | ) |
void agxOSG::SceneDecorator::calculateLightPositions | ( | const osg::BoundingSphere & | boundingSphere | ) |
void agxOSG::SceneDecorator::calculateLightPositions | ( | osg::Node * | bound_node = nullptr | ) |
Calculate the positions of the light sources from the bound of either a specified node, or if bound_node == 0, the sub-graph of this Group.
void agxOSG::SceneDecorator::clearText | ( | ) |
Reset all text to empty strings.
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
Definition at line 228 of file SceneDecorator.h.
|
static |
|
static |
bool agxOSG::SceneDecorator::getEnable | ( | ) | const |
Return true if AGX rendering style is enabled.
bool agxOSG::SceneDecorator::getEnableCalculateLightPositions | ( | Lights | l | ) | const |
bool agxOSG::SceneDecorator::getEnableLogo | ( | ) | const |
bool agxOSG::SceneDecorator::getEnableRenderedCursor | ( | ) | const |
bool agxOSG::SceneDecorator::getEnableShaderState | ( | ) | const |
bool agxOSG::SceneDecorator::getEnableShadows | ( | ) | const |
std::string agxOSG::SceneDecorator::getFontName | ( | ) | const |
Returns the font name.
float agxOSG::SceneDecorator::getFontSize | ( | ) | const |
Returns the font Size.
|
inline |
Return a pointer to the hud group.
Any node added here will be rendered in the same coordinate system as the logo. Good for example console text. Calls to resetHUD will invalidate earlier returned HUDs.
Definition at line 169 of file SceneDecorator.h.
agxOSG::LightSource agxOSG::SceneDecorator::getLightSource | ( | Lights | l | ) |
Get a wrapper for a LightSource with only AGX types.
Referenced by agxOSG::LightsSynchronization::operator()().
osg::Texture2D * agxOSG::SceneDecorator::getLogo | ( | ) |
const osg::Vec2 & agxOSG::SceneDecorator::getLogoDimension | ( | ) |
LogoLocation agxOSG::SceneDecorator::getLogoLocation | ( | ) | const |
osg::Vec2 agxOSG::SceneDecorator::getMaximumLogoDimension | ( | ) |
osg::Group * agxOSG::SceneDecorator::getNonShadowedScene | ( | ) | const |
osg::LightSource * agxOSG::SceneDecorator::getOSGLight | ( | Lights | l | ) |
osg::Group * agxOSG::SceneDecorator::getShadowedScene | ( | ) | const |
osg::LightSource * agxOSG::SceneDecorator::getShadowLightSource | ( | ) |
Return a pointer to the light source used for calculating shadows.
|
inline |
Definition at line 249 of file SceneDecorator.h.
|
protected |
|
inlinevirtual |
Definition at line 172 of file SceneDecorator.h.
bool agxOSG::SceneDecorator::isEnabled | ( | ) | const |
Return true if AGX rendering style is enabled.
|
static |
|
inline |
Definition at line 174 of file SceneDecorator.h.
|
inline |
Definition at line 175 of file SceneDecorator.h.
|
inlinevirtual |
Definition at line 178 of file SceneDecorator.h.
|
inlinevirtual |
Definition at line 176 of file SceneDecorator.h.
void agxOSG::SceneDecorator::resetHUD | ( | ) |
void agxOSG::SceneDecorator::setBackgroundColor | ( | agx::Vec3 | color | ) |
Set a uniform background color using color
.
void agxOSG::SceneDecorator::setBackgroundColor | ( | agx::Vec3 | colorUL, |
agx::Vec3 | colorUR, | ||
agx::Vec3 | colorLL, | ||
agx::Vec3 | colorLR | ||
) |
Set a gradient four color background (each corner) colorUL
- Upper left color colorUR
- Upper right color colorLL
- Lower left color colorLR
- Lower right color.
Set a gradient two color background.
upper
- Top color of the gradient color lower
- Lower color of the gradient color
void agxOSG::SceneDecorator::setBackgroundColor | ( | const agx::Vec4f & | color | ) |
Set a uniform background color using color
.
void agxOSG::SceneDecorator::setBackgroundColor | ( | const agx::Vec4f & | color1, |
const agx::Vec4f & | color2 | ||
) |
Set a gradient two color background.
upper
- Top color of the gradient color lower
- Lower color of the gradient color
void agxOSG::SceneDecorator::setBackgroundColor | ( | const agx::Vec4f & | colorUL, |
const agx::Vec4f & | colorUR, | ||
const agx::Vec4f & | colorLL, | ||
const agx::Vec4f & | colorLR | ||
) |
Set a gradient four color background (each corner) colorUL
- Upper left color colorUR
- Upper right color colorLL
- Lower left color colorLR
- Lower right color.
bool agxOSG::SceneDecorator::setBaseTexture | ( | const std::string & | imagePath | ) |
Specif the path to the base texture on all decorated objects.
|
inlinevirtual |
Definition at line 177 of file SceneDecorator.h.
void agxOSG::SceneDecorator::setEnable | ( | bool | flag | ) |
Enable/disable AGX rendering style for sub-graph.
void agxOSG::SceneDecorator::setEnableCalculateLightPositions | ( | Lights | l, |
bool | f | ||
) |
void agxOSG::SceneDecorator::setEnableLights | ( | int | lightMask = ALL | ) |
Reset and enable the specified lights.
lightMask | - Bit mask from the Light enum |
void agxOSG::SceneDecorator::setEnableLogo | ( | bool | flag | ) |
Enable/disable the rendering of the logo.
void agxOSG::SceneDecorator::setEnableRenderedCursor | ( | bool | enable | ) |
Enable/disable the mouse cursor.
enable | - If true the cursor will be visible |
void agxOSG::SceneDecorator::setEnableShaderState | ( | bool | flag, |
bool | lock = false |
||
) |
Enable/disable the use of a shader based default render state.
void agxOSG::SceneDecorator::setEnableShadows | ( | bool | flag | ) |
Enable/disable shadows for the sub-graph.
void agxOSG::SceneDecorator::setFontName | ( | const std::string & | fontName | ) |
Sets the font name.
void agxOSG::SceneDecorator::setFontSize | ( | const float & | fontSize | ) |
Sets the font Size.
void agxOSG::SceneDecorator::setLogo | ( | osg::Texture2D * | logo, |
float | density = 1.0 |
||
) |
Might want to call updateLogo afterwards.
bool agxOSG::SceneDecorator::setLogoFile | ( | const std::string & | filename, |
float | density = 1.0 |
||
) |
Specify a path to the image with the logo and the pixel density (i.e. 2.0 for high DPI and 1.0 for 1:1)
void agxOSG::SceneDecorator::setLogoLocation | ( | LogoLocation | l | ) |
Set the position of the logo from a list of predefined positions.
l | - An enum specifying the position. FREE to make it possible to set any position with setLogoPosition() |
void agxOSG::SceneDecorator::setLogoPosition | ( | float | x, |
float | y | ||
) |
Set the position of logo into [x
, y
] if setLogoLocation(FREE) has been previously called Valid range is [0,1] where 0,0 is lower left corner.
void agxOSG::SceneDecorator::setMaximumLogoDimension | ( | float | x, |
float | y | ||
) |
Set the maximum logo dimension.
Values between 0.0f and 1.0f.
void agxOSG::SceneDecorator::setScreenPixelScale | ( | float | scale | ) |
Specify the screen pixel scale (i.e. 2.0 for high DPI and 1.0 for 1:1)
bool agxOSG::SceneDecorator::setShadowLightSource | ( | Lights | l | ) |
Specify which light source is used for calculating shadows.
void agxOSG::SceneDecorator::setShadowMethod | ( | ShadowMethod | m | ) |
Specify which method is used for generating shadows,.
void agxOSG::SceneDecorator::setText | ( | int | row, |
const agx::String & | text | ||
) |
Print a row of text.
void agxOSG::SceneDecorator::setText | ( | int | row, |
const agx::String & | text, | ||
const agx::Vec4f & | color | ||
) |
void agxOSG::SceneDecorator::updateCursorPosition | ( | float | x, |
float | y | ||
) |
|
protected |
Updates the logo scale and position, depending on logo size, and window width and height.
void agxOSG::SceneDecorator::updateWindowSize | ( | int | sizeX, |
int | sizeY | ||
) |
Updates information about the window size in x and y (for logo scaling).
|
protected |
Definition at line 373 of file SceneDecorator.h.
|
protected |
Definition at line 342 of file SceneDecorator.h.
|
protected |
Definition at line 341 of file SceneDecorator.h.
|
protected |
Definition at line 354 of file SceneDecorator.h.
|
protected |
Definition at line 379 of file SceneDecorator.h.
|
protected |
Definition at line 338 of file SceneDecorator.h.
|
protected |
Definition at line 381 of file SceneDecorator.h.
|
protected |
Definition at line 369 of file SceneDecorator.h.
|
protected |
Definition at line 340 of file SceneDecorator.h.
|
protected |
Definition at line 339 of file SceneDecorator.h.
|
protected |
Definition at line 351 of file SceneDecorator.h.
|
protected |
Definition at line 337 of file SceneDecorator.h.
|
protected |
Definition at line 336 of file SceneDecorator.h.
|
protected |
Definition at line 350 of file SceneDecorator.h.
|
protected |
Definition at line 356 of file SceneDecorator.h.
|
protected |
Definition at line 357 of file SceneDecorator.h.
|
protected |
Definition at line 382 of file SceneDecorator.h.
|
protected |
Definition at line 383 of file SceneDecorator.h.
|
protected |
Definition at line 347 of file SceneDecorator.h.
|
protected |
Definition at line 371 of file SceneDecorator.h.
|
protected |
Definition at line 352 of file SceneDecorator.h.
|
protected |
Definition at line 343 of file SceneDecorator.h.
|
protected |
Definition at line 363 of file SceneDecorator.h.
|
protected |
Definition at line 349 of file SceneDecorator.h.
|
protected |
Definition at line 362 of file SceneDecorator.h.
|
protected |
Definition at line 348 of file SceneDecorator.h.
|
protected |
Definition at line 346 of file SceneDecorator.h.
|
protected |
Definition at line 344 of file SceneDecorator.h.
|
protected |
Definition at line 345 of file SceneDecorator.h.
|
protected |
Definition at line 360 of file SceneDecorator.h.
|
protected |
Definition at line 361 of file SceneDecorator.h.
|
protected |
Definition at line 364 of file SceneDecorator.h.
|
protected |
Definition at line 386 of file SceneDecorator.h.
|
protected |
Definition at line 366 of file SceneDecorator.h.
|
protected |
Definition at line 372 of file SceneDecorator.h.
|
protected |
Definition at line 353 of file SceneDecorator.h.
|
protected |
Definition at line 367 of file SceneDecorator.h.
|
protected |
Definition at line 355 of file SceneDecorator.h.
|
protected |
Definition at line 385 of file SceneDecorator.h.
|
protected |
Definition at line 358 of file SceneDecorator.h.
|
protected |
Definition at line 359 of file SceneDecorator.h.
|
staticprotected |
Definition at line 388 of file SceneDecorator.h.