#include <PVLE/Export.h>
#include <utility>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Matrix>
#include <boost/filesystem/path.hpp>
Go to the source code of this file.
Classes | |
class | CloudParams |
Parameters for createCloud() - only supports standard sprites for now (will support billboard and point sprites). More... | |
Namespaces | |
namespace | osg |
OSG missing operators, added by PVLE. | |
namespace | osgText |
Functions | |
PVLE_EXPORT osg::Transform * | createSkySphere (const boost::filesystem::path &texturePath, float detailRatio=0.5f) |
Creates a sky sphere at an "infinite distance" (actually use a MoveWithEyePointTransform to do as-if). | |
PVLE_EXPORT osg::Geode * | createCloud (const CloudParams ¶ms) |
Creates a cloud made of sprites, from given parameters. | |
PVLE_EXPORT osg::Geode * | createCloud (const boost::filesystem::path &imagePath, unsigned int numSprites=100) |
Creates a random cloud made of sprites. | |
PVLE_EXPORT osg::Geometry * | createAxisDrawable (const osg::Vec3 &corner, const osg::Vec3 &xdir, const osg::Vec3 &ydir, const osg::Vec3 &zdir) |
Creates a drawable that represent 3 axis. | |
PVLE_EXPORT osg::Geometry * | createSegmentDrawable (const osg::Vec3 &p1, const osg::Vec3 &p2, float width=3, const osg::Vec4 &color1=osg::Vec4(1, 1, 1, 1), const osg::Vec4 &color2=osg::Vec4(-1,-1,-1,-1)) |
Creates a segment drawable. | |
PVLE_EXPORT osg::Geode * | createAxis (float axisSize) |
Convinience function that creates a node with 3 axis. | |
PVLE_EXPORT osg::Geode * | createSegment (const osg::Vec3 &p1, const osg::Vec3 &p2, float width=3, const osg::Vec4 &color1=osg::Vec4(1, 1, 1, 1), const osg::Vec4 &color2=osg::Vec4(-1,-1,-1,-1)) |
Convinience function that creates a segment. | |
PVLE_EXPORT osgText::Text * | createText (osgText::Font *pFont, float height=20.f, const osg::Vec3f &position=osg::Vec3f(0, 0, 0), const osg::Vec4f &color=osg::Vec4f(.5f,.5f,.5f, 1)) |
Convinience function that create an osgText::Text and then calls appropriate methods on it. | |
PVLE_EXPORT osg::Geometry * | createSquare (const osg::Vec3 &corner, const osg::Vec3 &width, const osg::Vec3 &height, osg::Image *image=NULL, unsigned int nbTextureCoords=1, bool invertYTexCoords=false) |
Creates a quad at a given position. | |
osg::Geometry * | createSquareFor2D (const osg::Vec3 &corner2D, const osg::Vec3 &boxSize2D, osg::Image *image=NULL, unsigned int nbTextureCoords=1, bool invertYTexCoords=false) |
Creates a quad from 2D coordinates (used in Hud derivates) that can be put under a projection matrix (such as those in Hud's). | |
osg::Geometry * | createSquareFor2D (const osg::Vec3 &corner2D, float boxSize2DX, float boxSize2DY, osg::Image *image=NULL, unsigned int nbTextureCoords=1, bool invertYTexCoords=false) |
Creates a quad from 2D coordinates (used in Hud derivates) that can be put under a projection matrix (such as those in Hud's). | |
PVLE_EXPORT void | updateSquare (osg::Geometry *pGeometry, const osg::Vec3 &width, const osg::Vec3 &height) |
Updates a quad created by createSquare() with new dimensions, generally to use it as a progress bar. | |
PVLE_EXPORT void | updateSquare (osg::Geometry *pGeometry, const osg::Vec3 &corner, const osg::Vec3 &width, const osg::Vec3 &height) |
Redifines a quad created by createSquare() with new dimensions and position, generally to use it as a progress bar. | |
void | updateSquareFor2D (osg::Geometry *pGeometry, float width, float height) |
Updates a quad created by createSquareFor2D() with new dimensions, generally to use it as a progress bar. | |
void | updateSquareFor2D (osg::Geometry *pGeometry, const osg::Vec3 &corner, float width, float height) |
Redifines a quad created by createSquareFor2D() with new dimensions and position, generally to use it as a progress bar. | |
PVLE_EXPORT std::pair < osg::Projection *, osg::MatrixTransform * > | create2DProjection (const osg::Matrix &orthoProjectionMatrix) |
Creates a 2D projection, return that projection node and its first children (a MatrixTransform to which nodes can be added). | |
PVLE_EXPORT osg::Projection * | encapsulateIn2DProjection (osg::Node *pNode, const osg::Matrix &orthoProjectionMatrix) |
Sets the given node to be child of a 2D projection, and return that projection node. | |
PVLE_EXPORT void | setHudStatset (osg::StateSet *pStateset) |
PVLE_EXPORT void | setColor (osg::StateSet *pStateSet, const osg::Vec4 &color) |
Convinience function for setting diffuse and ambiant parameters. Creates a material and add it to the given stateset, or modifies the existing one. | |
PVLE_EXPORT void | setColor (osg::Node *pNode, const osg::Vec4 &color) |
Convinience function for setting diffuse and ambiant parameters. Creates a material and add it to the stateset of the node, or modifies the existing one. | |
PVLE_EXPORT osg::MatrixTransform * | createShapeGeode (osg::Shape *shape, float tesselationDetailRatio=0) |
Creates a geode with a ShapeDrawable encapsulated in a MatrixTransform. | |
PVLE_EXPORT osg::MatrixTransform * | createShapeGeodeBox (const osg::Vec3 &size) |
Creates a box (geode with a ShapeDrawable) encapsulated in a MatrixTransform. | |
PVLE_EXPORT osg::MatrixTransform * | createShapeGeodeSphere (const float radius, float tesselationDetailRatio=0) |
Creates a sphere (geode with a ShapeDrawable) encapsulated in a MatrixTransform. | |
PVLE_EXPORT osg::MatrixTransform * | createShapeGeodeCapsule (const float radius, const float length, float tesselationDetailRatio=0) |
Creates a capsule (geode with a ShapeDrawable) encapsulated in a MatrixTransform. | |
PVLE_EXPORT osg::MatrixTransform * | createShapeGeodeCylinder (const float radius, const float length, float tesselationDetailRatio=0) |
Creates a cylinder (geode with a ShapeDrawable) encapsulated in a MatrixTransform. | |
PVLE_EXPORT osg::HeightField * | readHeightMap (const boost::filesystem::path &path, const float vScale=1.f, const float hScale=3000.f) |
Loads a heightmap (grey scale) into an osg::HeightField centered in (0,0,0). |
that are often used.
Definition in file 3D/Commons.h.
PVLE_EXPORT std::pair<osg::Projection*, osg::MatrixTransform*> create2DProjection | ( | const osg::Matrix & | orthoProjectionMatrix | ) |
Creates a 2D projection, return that projection node and its first children (a MatrixTransform to which nodes can be added).
Definition at line 235 of file 3D/Commons.cpp.
Referenced by encapsulateIn2DProjection(), and Hud::Hud().
PVLE_EXPORT osg::Geode* createAxis | ( | float | axisSize | ) |
Convinience function that creates a node with 3 axis.
Definition at line 154 of file 3D/Commons.cpp.
References createAxisDrawable().
PVLE_EXPORT osg::Geometry* createAxisDrawable | ( | const osg::Vec3 & | corner, | |
const osg::Vec3 & | xdir, | |||
const osg::Vec3 & | ydir, | |||
const osg::Vec3 & | zdir | |||
) |
Creates a drawable that represent 3 axis.
Definition at line 94 of file 3D/Commons.cpp.
Referenced by createAxis().
PVLE_EXPORT osg::Geode* createCloud | ( | const boost::filesystem::path & | imagePath, | |
unsigned int | numSprites = 100 | |||
) |
Creates a random cloud made of sprites.
Definition at line 357 of file 3D/Commons.cpp.
References createCloud(), CloudParams::imagePath, and CloudParams::numSprites.
PVLE_EXPORT osg::Geode* createCloud | ( | const CloudParams & | params | ) |
Creates a cloud made of sprites, from given parameters.
Definition at line 364 of file 3D/Commons.cpp.
References CloudParams::alphaOffsetMax, CloudParams::alphaOffsetMin, CloudParams::axis, CloudParams::colorScaleRand, createSquare(), CloudParams::density, CloudParams::hiColor, CloudParams::imagePath, CloudParams::lowColor, CloudParams::numSprites, rand(), CloudParams::ratio, osgDB::readImageFile(), CloudParams::skewHMax, CloudParams::skewHMin, CloudParams::skewVMax, CloudParams::skewVMin, CloudParams::spriteSizeMax, CloudParams::spriteSizeMin, and toVec3().
Referenced by createCloud().
PVLE_EXPORT osg::Geode* createSegment | ( | const osg::Vec3 & | p1, | |
const osg::Vec3 & | p2, | |||
float | width = 3 , |
|||
const osg::Vec4 & | color1 = osg::Vec4(1, 1, 1, 1) , |
|||
const osg::Vec4 & | color2 = osg::Vec4(-1,-1,-1,-1) | |||
) |
Convinience function that creates a segment.
Definition at line 160 of file 3D/Commons.cpp.
References createSegmentDrawable().
PVLE_EXPORT osg::Geometry* createSegmentDrawable | ( | const osg::Vec3 & | p1, | |
const osg::Vec3 & | p2, | |||
float | width = 3 , |
|||
const osg::Vec4 & | color1 = osg::Vec4(1, 1, 1, 1) , |
|||
const osg::Vec4 & | color2 = osg::Vec4(-1,-1,-1,-1) | |||
) |
Creates a segment drawable.
Definition at line 120 of file 3D/Commons.cpp.
Referenced by createSegment().
PVLE_EXPORT osg::MatrixTransform* createShapeGeode | ( | osg::Shape * | shape, | |
float | tesselationDetailRatio = 0 | |||
) |
Creates a geode with a ShapeDrawable encapsulated in a MatrixTransform.
Definition at line 282 of file 3D/Commons.cpp.
Referenced by createShapeGeodeBox(), createShapeGeodeCapsule(), createShapeGeodeCylinder(), and createShapeGeodeSphere().
PVLE_EXPORT osg::MatrixTransform* createShapeGeodeBox | ( | const osg::Vec3 & | size | ) |
Creates a box (geode with a ShapeDrawable) encapsulated in a MatrixTransform.
Definition at line 296 of file 3D/Commons.cpp.
References createShapeGeode().
Referenced by createBox3DPhy(), createFixedBox3DPhy(), and C3DPhy::createPhysicsDebugView().
PVLE_EXPORT osg::MatrixTransform* createShapeGeodeCapsule | ( | const float | radius, | |
const float | length, | |||
float | tesselationDetailRatio = 0 | |||
) |
Creates a capsule (geode with a ShapeDrawable) encapsulated in a MatrixTransform.
Definition at line 298 of file 3D/Commons.cpp.
References createShapeGeode().
Referenced by createCapsule3DPhy(), createFixedCapsule3DPhy(), and C3DPhy::createPhysicsDebugView().
PVLE_EXPORT osg::MatrixTransform* createShapeGeodeCylinder | ( | const float | radius, | |
const float | length, | |||
float | tesselationDetailRatio = 0 | |||
) |
Creates a cylinder (geode with a ShapeDrawable) encapsulated in a MatrixTransform.
Definition at line 299 of file 3D/Commons.cpp.
References createShapeGeode().
Referenced by createCylinder3DPhy(), createFixedCylinder3DPhy(), and C3DPhy::createPhysicsDebugView().
PVLE_EXPORT osg::MatrixTransform* createShapeGeodeSphere | ( | const float | radius, | |
float | tesselationDetailRatio = 0 | |||
) |
Creates a sphere (geode with a ShapeDrawable) encapsulated in a MatrixTransform.
Definition at line 297 of file 3D/Commons.cpp.
References createShapeGeode().
Referenced by createFixedSphere3DPhy(), C3DPhy::createPhysicsDebugView(), createSphere3DPhy(), and Explosion::init().
PVLE_EXPORT osg::Transform* createSkySphere | ( | const boost::filesystem::path & | texturePath, | |
float | detailRatio = 0.5f | |||
) |
Creates a sky sphere at an "infinite distance" (actually use a MoveWithEyePointTransform to do as-if).
texturePath | Path of the texture used. | |
detailRatio | Same as osg::TessellationHints::setDetailRatio(float). |
Definition at line 59 of file 3D/Commons.cpp.
References osgDB::readImageFile().
PVLE_EXPORT osg::Geometry* createSquare | ( | const osg::Vec3 & | corner, | |
const osg::Vec3 & | width, | |||
const osg::Vec3 & | height, | |||
osg::Image * | image = NULL , |
|||
unsigned int | nbTextureCoords = 1 , |
|||
bool | invertYTexCoords = false | |||
) |
Creates a quad at a given position.
Similar to osg::createTexturedQuadGeometry().
Definition at line 166 of file 3D/Commons.cpp.
Referenced by createCloud(), and createSquareFor2D().
osg::Geometry* createSquareFor2D | ( | const osg::Vec3 & | corner2D, | |
float | boxSize2DX, | |||
float | boxSize2DY, | |||
osg::Image * | image = NULL , |
|||
unsigned int | nbTextureCoords = 1 , |
|||
bool | invertYTexCoords = false | |||
) | [inline] |
Creates a quad from 2D coordinates (used in Hud derivates) that can be put under a projection matrix (such as those in Hud's).
Definition at line 125 of file 3D/Commons.h.
References createSquareFor2D().
osg::Geometry* createSquareFor2D | ( | const osg::Vec3 & | corner2D, | |
const osg::Vec3 & | boxSize2D, | |||
osg::Image * | image = NULL , |
|||
unsigned int | nbTextureCoords = 1 , |
|||
bool | invertYTexCoords = false | |||
) | [inline] |
Creates a quad from 2D coordinates (used in Hud derivates) that can be put under a projection matrix (such as those in Hud's).
Definition at line 120 of file 3D/Commons.h.
References createSquare().
Referenced by createSquareFor2D().
PVLE_EXPORT osgText::Text* createText | ( | osgText::Font * | pFont, | |
float | height = 20.f , |
|||
const osg::Vec3f & | position = osg::Vec3f(0, 0, 0) , |
|||
const osg::Vec4f & | color = osg::Vec4f(.5f,.5f,.5f, 1) | |||
) |
Convinience function that create an osgText::Text and then calls appropriate methods on it.
Definition at line 329 of file 3D/Commons.cpp.
PVLE_EXPORT osg::Projection* encapsulateIn2DProjection | ( | osg::Node * | pNode, | |
const osg::Matrix & | orthoProjectionMatrix | |||
) |
Sets the given node to be child of a 2D projection, and return that projection node.
Definition at line 248 of file 3D/Commons.cpp.
References create2DProjection().
PVLE_EXPORT osg::HeightField* readHeightMap | ( | const boost::filesystem::path & | path, | |
const float | vScale = 1.f , |
|||
const float | hScale = 3000.f | |||
) |
Loads a heightmap (grey scale) into an osg::HeightField centered in (0,0,0).
path | Path for the bitmap | |
vScale | Vertical (height) scale. | |
hScale | Horizontal scale. |
Definition at line 302 of file 3D/Commons.cpp.
References osgDB::readImageFile(), THROW_TRACED_EXCEPTION, and THROW_TRACED_FMT_EXCEPTION.
PVLE_EXPORT void setColor | ( | osg::Node * | pNode, | |
const osg::Vec4 & | color | |||
) |
Convinience function for setting diffuse and ambiant parameters. Creates a material and add it to the stateset of the node, or modifies the existing one.
Definition at line 275 of file 3D/Commons.cpp.
References ASSERT, and setColor().
PVLE_EXPORT void setColor | ( | osg::StateSet * | pStateSet, | |
const osg::Vec4 & | color | |||
) |
Convinience function for setting diffuse and ambiant parameters. Creates a material and add it to the given stateset, or modifies the existing one.
Definition at line 265 of file 3D/Commons.cpp.
References ASSERT.
Referenced by PhysicsDebugUpdateCB::operator()(), and setColor().
PVLE_EXPORT void setHudStatset | ( | osg::StateSet * | pStateset | ) |
PVLE_EXPORT void updateSquare | ( | osg::Geometry * | pGeometry, | |
const osg::Vec3 & | corner, | |||
const osg::Vec3 & | width, | |||
const osg::Vec3 & | height | |||
) |
Redifines a quad created by createSquare() with new dimensions and position, generally to use it as a progress bar.
setUseDisplayList(false)
after createSquare()
. Definition at line 224 of file 3D/Commons.cpp.
PVLE_EXPORT void updateSquare | ( | osg::Geometry * | pGeometry, | |
const osg::Vec3 & | width, | |||
const osg::Vec3 & | height | |||
) |
Updates a quad created by createSquare() with new dimensions, generally to use it as a progress bar.
setUseDisplayList(false)
after createSquare()
. Definition at line 218 of file 3D/Commons.cpp.
References updateSquare().
Referenced by updateSquare(), and updateSquareFor2D().
void updateSquareFor2D | ( | osg::Geometry * | pGeometry, | |
const osg::Vec3 & | corner, | |||
float | width, | |||
float | height | |||
) | [inline] |
Redifines a quad created by createSquareFor2D() with new dimensions and position, generally to use it as a progress bar.
setUseDisplayList(false)
after createSquare()
. Definition at line 145 of file 3D/Commons.h.
References updateSquare().
void updateSquareFor2D | ( | osg::Geometry * | pGeometry, | |
float | width, | |||
float | height | |||
) | [inline] |
Updates a quad created by createSquareFor2D() with new dimensions, generally to use it as a progress bar.
setUseDisplayList(false)
after createSquare()
. Definition at line 139 of file 3D/Commons.h.
References updateSquare().