BrainTrain
 All Classes Namespaces Files Functions Variables Macros Pages
brtr Namespace Reference

Namespace for the whole BrainTrain Project. More...

Classes

class  AddInteractionCallbackToDrawableVisitor
 NodeVisitor for batch replacing all UserDataContainer of all Drawables. More...
 
class  AddPortalGunInteractionCallback
 InteractionCallback for adding the portal gun to the players inventar. More...
 
class  BaseInteractionCallback
 This is the TemplateClass for InteractionCallbacks. More...
 
class  Bench
 Bench class, creates a bench Object. More...
 
struct  BodyOfRotationFunction
 struct holding the function, which calculates the radius in dependece of the height. lambda (double)->double func, int end, BodyOfRotationFunction* nextFunc if one wish to have more then one function then the end value and nextFunc pointer must be set accordingly the end+1 is the beginning x of the next function More...
 
class  CelShading
 CelSading Effect, every child of this node will get the effect. More...
 
class  CelShadingTechnique
 The Technique for the cel-shading effect. More...
 
class  ControlRoom
 Control Room Class, derived from PositionAttitudeTransform, set ups the whole room as its own children. More...
 
class  DrunkenInteractionCallback
 Callback for the drunk effect. More...
 
class  FPSCameraManipulator
 A FPS style CameraManipulator with ground clamping and intersection. More...
 
class  GeometryPlacerVisitor
 NodeVisitor for batch replacing all Geometry in all visited Geodes. More...
 
class  KeyHandler
 Key Handler Class, handles all of our KeyFunctions, which do not belong to camera control (this are handled by FPSCameraManipulator) More...
 
class  ModifyMaterialVisitor
 Visitor for altering the material attributes, mainly used for objects craeted with blender. More...
 
class  ProgramSwitcherCallback
 Callback for switching the postprocess programs. More...
 
struct  RenderingPipeline
 struct holding the camera for the multi-rendering passes. Also holds the program vector for the post process pass. pass0Color, pass0depth, passPostProcess, program array, count programArray The program vector is used by the KeyHandler and the InteractionItems for changing the postprocess programs More...
 
class  ToonTexSwitcherCallback
 Callback for switching the ToonTextures. More...
 
class  TrainSwitcherCallback
 Callback for switching the "trains". More...
 
class  WeaponHUD
 WeaponHUD class, provides the functions to add a HUD camera to the scene. More...
 

Functions

void createRenderingPipeline (unsigned int width, unsigned int height, osg::Node &rootForToon, osgViewer::Viewer &viewer, RenderingPipeline &pipe, osg::Vec3f &fogColor)
 creates the rendering pipeline More...
 
osg::ref_ptr< osg::LightSource > createLight (const osg::Vec3 &pos, int lightNum, int point=1, double spotCutoff=180, double spotExponent=0)
 creates a Light with a lightsource More...
 
osg::ref_ptr< osg::Camera > createRTTCamera (osg::Camera::BufferComponent buffer, osg::Texture *tex, bool isAbsolute=false)
 creates a RTTCam More...
 
osg::ref_ptr< osg::Geode > createScreenQuad (float width, float height, float scale=1.0f)
 creates a texture-ready screen quad for postprocessing More...
 
osg::ref_ptr< osg::Camera > createHUDCamera (double left, double right, double bottom, double top)
 creates a HUD-Cam with a 2D-orthogonal projection matrix More...
 
osg::ref_ptr< osgText::Text > createText (const osg::Vec3 &pos, const std::string &content, float size)
 creates a (arial) text object for use with a hud camera More...
 
osg::ref_ptr< osg::Geometry > createBodyOfRotation (double height, int hsteps, int rsteps, const BodyOfRotationFunction &function)
 Creates a body of rotation. More...
 
osg::ref_ptr< osg::Geometry > createRectangle (double length, double width, int lsteps, int wsteps)
 Creates a Rectangle with TRIANGLE_STRIPS. More...
 
osg::ref_ptr< osg::Geometry > createRectangleWithTexcoords (double length, double width, int lsteps, int wsteps)
 Creates a Rectangle with TRIANGLE_STRIPS. More...
 
osg::ref_ptr< osg::Group > createCuboid (const double length, const double width, const double height, const double factor=6)
 Creates a Cubiod with TRIANGLE_STRIPS using the createRectangle function. More...
 
osg::ref_ptr
< osg::PositionAttitudeTransform > 
wrapInPositionAttitudeTransform (osg::Node *srcNode, const osg::Vec3d &pos)
 Return the given Node in a PositionAttitudeTransform with a given position. More...
 
osg::ref_ptr< osg::Geometry > createBeerBottle ()
 Creates a BeerBottle with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr< osg::Geometry > createRealBottle ()
 Creates a Bottle with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr< osg::Geometry > createVase ()
 Creates a vase with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr< osg::Geometry > createStalk ()
 Creates a stalk with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr< osg::Geometry > createBud ()
 Creates a bud with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr< osg::Geometry > createChessFigure ()
 Creates a "ChessFigure" with Material with the help of the BodyOfRotationFunction. More...
 
osg::ref_ptr
< osg::PositionAttitudeTransform > 
createVaseWithFlower ()
 combines the stalk, bud and vase in a postitionAttitudetransform More...
 
osg::ref_ptr< osg::Geode > createCrosshair (unsigned int width, unsigned int height)
 creates a crosshair in the middle of the screen More...
 
osg::ref_ptr< osg::Texture2D > createToonTex (std::string toonTex)
 creates a Texture2D object with the given toonTex More...
 
osg::ref_ptr< osg::Material > createSimpleMaterial (osg::Material::Face face, const osg::Vec4 &diffuse, const osg::Vec4 &ambient, const osg::Vec4 &specular, const double shininess)
 creates a simple material More...
 
osg::Vec3 getDimensionOfNode (osg::Node *source)
 return the dimension of a node (width, height, length) More...
 
ref_ptr< LightSource > createLight (const Vec3 &pos, int lightNum, int point, double spotCutoff, double spotExponent)
 
void createRenderingPipeline (unsigned int width, unsigned int height, osg::Node &rootForToon, osgViewer::Viewer &viewer, RenderingPipeline &pipe, Vec3f &fogColor)
 
osg::Vec3 getDimensionOfNode (Node *source)
 

Variables

const int collisionMask = 0x1
 
const int interactionMask = 0x2
 
const int interactionAndCollisionMask = collisionMask | interactionMask
 
const int fakeWallMask = 0x4
 

Detailed Description

Namespace for the whole BrainTrain Project.

Function Documentation

osg::ref_ptr< osg::Geometry > brtr::createBeerBottle ( )

Creates a BeerBottle with Material with the help of the BodyOfRotationFunction.

Returns
ref_ptr containing the geometry

Definition at line 352 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createBodyOfRotation ( double  height,
int  hsteps,
int  rsteps,
const BodyOfRotationFunction &  function 
)

Creates a body of rotation.

Radius depends on height. (i.e. function x is height) Function is a modified createRectangle() from Chapter 7, CG1 Lecture Script by Frauke Sprengel

Parameters
heightthe height of the body
hstepsheight resolution, more steps equals more triangles, hence better lightning, but more performance cost
rstepsradius resolution, if rsteps value is too small, the cylinder may become a triangle or something else
functiona BodyOfRotationFunction, which determines the radius in dependence of the height
Returns
a ref_ptr<osg::Geometry> containing the body

Definition at line 151 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createBud ( )

Creates a bud with Material with the help of the BodyOfRotationFunction.

Function provided by Florian Wicke

Returns
ref_ptr containing the geometry

Definition at line 477 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createChessFigure ( )

Creates a "ChessFigure" with Material with the help of the BodyOfRotationFunction.

Function provided by Florian Wicke

Returns
ref_ptr containing the geometry

Definition at line 500 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geode > brtr::createCrosshair ( unsigned int  width,
unsigned int  height 
)

creates a crosshair in the middle of the screen

Parameters
widthscreenwidth
heightscreenheight
Returns
ref_ptr conatining the geode with the crosshair

Definition at line 555 of file UtilFunctions.cpp.

ref_ptr< osg::Group > brtr::createCuboid ( const double  length,
const double  width,
const double  height,
const double  factor = 6 
)

Creates a Cubiod with TRIANGLE_STRIPS using the createRectangle function.

Uses 6 Rectangles and creates a Cuboid of it.

Parameters
lengthdesired length of the Cuboid
widthdesired length of the Cuboid
heightdesired length of the Cuboid
factorthe higher the number the greater the resolution in all dimension
Returns
a osg::Group containing the Cuboid

Definition at line 245 of file UtilFunctions.cpp.

ref_ptr< Camera > brtr::createHUDCamera ( double  left,
double  right,
double  bottom,
double  top 
)

creates a HUD-Cam with a 2D-orthogonal projection matrix

Original Function by Rui Wang/Xuelei Qian from OSG 3 Cookbook, Packt Publishing, 2012

Parameters
leftleft bound of the projection matrix
rightright bound of the projection matrix
bottombottom bound of the projection matrix
toptop bound of the projection matrix
Returns
the created HUD Camera in a ref_ptr

Definition at line 61 of file UtilFunctions.cpp.

osg::ref_ptr<osg::LightSource> brtr::createLight ( const osg::Vec3 &  pos,
int  lightNum,
int  point = 1,
double  spotCutoff = 180,
double  spotExponent = 0 
)

creates a Light with a lightsource

Parameters
poslight position
lightNumgl_light num (must be 0 to 7)
point1 = point light, 0 = directional light
spotCutoff
spotExponent
Returns
a ref_ptr containing the LightSource
ref_ptr<LightSource> brtr::createLight ( const Vec3 &  pos,
int  lightNum,
int  point,
double  spotCutoff,
double  spotExponent 
)

Definition at line 222 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createRealBottle ( )

Creates a Bottle with Material with the help of the BodyOfRotationFunction.

Function provided by Florian Wicke

Returns
ref_ptr containing the geometry

Definition at line 377 of file UtilFunctions.cpp.

ref_ptr< Geometry > brtr::createRectangle ( double  length,
double  width,
int  lsteps,
int  wsteps 
)

Creates a Rectangle with TRIANGLE_STRIPS.

Function is copy/pasted from Chapter 7, CG1 Lecture Script by Frauke Sprengel

Parameters
lengthdesired length of the rectangle
widthdesired width of the rectangle
lstepsthe higher the number the greater the resolution in the length dimension
wstepsthe higher the number the greater the resolution in the width dimension
Returns
a ref_ptr<osg::Geometry> containing the rectangle

Definition at line 72 of file UtilFunctions.cpp.

ref_ptr< Geometry > brtr::createRectangleWithTexcoords ( double  length,
double  width,
int  lsteps,
int  wsteps 
)

Creates a Rectangle with TRIANGLE_STRIPS.

Function is copy/pasted from Chapter 7, CG1 Lecture Script by Frauke Sprengel Added the TexCoordArray. If the width/length ratio lower than 1:4 or 4:1 the texture coordiantes are streched to fit the Rectangle

Parameters
lengthdesired length of the rectangle
widthdesired width of the rectangle
lstepsthe higher the number the greater the resolution in the length dimension
wstepsthe higher the number the greater the resolution in the width dimension
Returns
a ref_ptr<osg::Geometry> containing the rectangle

Definition at line 118 of file UtilFunctions.cpp.

void brtr::createRenderingPipeline ( unsigned int  width,
unsigned int  height,
osg::Node &  rootForToon,
osgViewer::Viewer &  viewer,
RenderingPipeline &  pipe,
osg::Vec3f &  fogColor 
)

creates the rendering pipeline

Creates the cameras and textures, attachs the textures to the cameras, set the projectionmatrix

Parameters
widththe width of the texture, should be screenwidth
heightthe height of the texture, should be screenheight
rootForToonNode which the CelShade effect will be applied to
viewerclipping pane and projectionmatrix will be set on this viewers cam
pipepipe struct which should be filled
void brtr::createRenderingPipeline ( unsigned int  width,
unsigned int  height,
osg::Node &  rootForToon,
osgViewer::Viewer &  viewer,
RenderingPipeline &  pipe,
Vec3f &  fogColor 
)

Definition at line 283 of file UtilFunctions.cpp.

ref_ptr< osg::Camera > brtr::createRTTCamera ( osg::Camera::BufferComponent  buffer,
osg::Texture *  tex,
bool  isAbsolute = false 
)

creates a RTTCam

Original Function by Rui Wang/Xuelei Qian from OSG 3 Cookbook, Packt Publishing, 2012

Parameters
bufferwhich buffer should be written to texture
texon this texture the buffer will be written to
isAbsoluteabsolute or relative reference frame
Returns
a ref_ptr holding the camera

Definition at line 25 of file UtilFunctions.cpp.

ref_ptr< osg::Geode > brtr::createScreenQuad ( float  width,
float  height,
float  scale = 1.0f 
)

creates a texture-ready screen quad for postprocessing

Original Function by Rui Wang/Xuelei Qian from OSG 3 Cookbook, Packt Publishing, 2012

Parameters
widthwidth of the quad
heightheight of the quad
scalescale of the quad
Returns
a ref_ptr caontaining the geode with the quad

Definition at line 47 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Material > brtr::createSimpleMaterial ( osg::Material::Face  face,
const osg::Vec4 &  diffuse,
const osg::Vec4 &  ambient,
const osg::Vec4 &  specular,
const double  shininess 
)

creates a simple material

Parameters
diffusediffuse lighting
ambientambient lighting
specularspecular lighting
shininessthe shininess
Returns
the material as a osg::ref_ptr<osg::Material>

Definition at line 597 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createStalk ( )

Creates a stalk with Material with the help of the BodyOfRotationFunction.

Function provided by Florian Wicke

Returns
ref_ptr containing the geometry

Definition at line 451 of file UtilFunctions.cpp.

osg::ref_ptr< osgText::Text > brtr::createText ( const osg::Vec3 &  pos,
const std::string &  content,
float  size 
)

creates a (arial) text object for use with a hud camera

Original Function by Rui Wang/Xuelei Qian from OSG 3 Cookbook, Packt Publishing, 2012

Parameters
pospostion of the text in x_y plane
content
size
Returns
a ref_ptr containing the osgText::Text object

Definition at line 210 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Texture2D > brtr::createToonTex ( std::string  toonTex)

creates a Texture2D object with the given toonTex

Parameters
filenameof the toontex
Returns
ref_ptr containing the Texture2D

Definition at line 614 of file UtilFunctions.cpp.

osg::ref_ptr< osg::Geometry > brtr::createVase ( )

Creates a vase with Material with the help of the BodyOfRotationFunction.

Function provided by Florian Wicke

Returns
ref_ptr containing the geometry

Definition at line 412 of file UtilFunctions.cpp.

osg::ref_ptr< osg::PositionAttitudeTransform > brtr::createVaseWithFlower ( )

combines the stalk, bud and vase in a postitionAttitudetransform

Returns
a ref_ptr containing a positionAttitudeTransform containing the vase with a flower

Definition at line 581 of file UtilFunctions.cpp.

osg::Vec3 brtr::getDimensionOfNode ( osg::Node *  source)

return the dimension of a node (width, height, length)

Parameters
sourcenode, which dimension one want to know
Returns
vec3 holding the dimensions
osg::Vec3 brtr::getDimensionOfNode ( Node *  source)

Definition at line 606 of file UtilFunctions.cpp.

osg::ref_ptr< osg::PositionAttitudeTransform > brtr::wrapInPositionAttitudeTransform ( osg::Node *  srcNode,
const osg::Vec3d &  pos 
)

Return the given Node in a PositionAttitudeTransform with a given position.

Parameters
srcNodethe Node which should be moved
posthe relative position change
Returns
a osg::PositionAttitudeTransform containing the Cuboid

Definition at line 238 of file UtilFunctions.cpp.

Variable Documentation

const int brtr::collisionMask = 0x1

Definition at line 27 of file UtilFunctions.h.

const int brtr::fakeWallMask = 0x4

Definition at line 30 of file UtilFunctions.h.

const int brtr::interactionAndCollisionMask = collisionMask | interactionMask

Definition at line 29 of file UtilFunctions.h.

const int brtr::interactionMask = 0x2

Definition at line 28 of file UtilFunctions.h.