VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
makVrv::DtLightPointNode Class Reference

Derived from osg::Node and is a replacement for the osgSim::LightPointNode represents a group of light points that share a common origin location. In addition to their origin the light point node can group them for things like airport or runway groupings. traversal of this node by the cull visitor passes the view matrix to the light point manager to be placed in an SSBO. Instance manager uses updateDrawable to do the same thing that traversal does for the non instanced case.

Inheritance diagram for makVrv::DtLightPointNode:
Inheritance graph
[legend]

Classes

struct  LightPointInfo
 

Public Member Functions

 DtLightPointNode ()
 
 DtLightPointNode (const DtLightPointNode &lpn, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 
virtual ~DtLightPointNode ()
 
 META_Node (vrvOsg, DtLightPointNode)
 
virtual void traverse (osg::NodeVisitor &nv)
 
virtual void updateDrawable (const osg::Camera *camera, int frameNum, double simTime, const osg::Matrixd &modelViewMatrix, osgUtil::CullVisitor *cv, int groupId, bool shouldCull, const DtIndirectFadeParameters &fadeParameters, float posScale, float radiusScale, bool isInstancedReflection=false)
 
virtual void updateNodeInfo (bool isInstancedReflection=false, bool isForcedAdd=false)
 
virtual int addTypedLightPoint (const osg::Vec3d &pos, int type, const std::string &id, const osg::Vec3 &rotation, float phaseShift)
 
virtual void removeTypedLightPoint (int index)
 
virtual void setLightPointManager (DtOsgLightPointManager *lightPointManager)
 
virtual DtOsgLightPointManagerfindLightPointManager ()
 
virtual void setLightPointsEnabled (bool enabled)
 
virtual bool lightPointsEnabled ()
 
virtual void setGroupId (int id)
 
virtual int groupId ()
 
virtual void freeNodeIdIfNecessary (unsigned int maxNodeIds)
 
virtual osg::BoundingSphere computeBound () const
 
virtual void setLightPointTexture (osg::Texture *texture)
 
virtual void releaseGLObjects (osg::State *state=0) const
 
virtual void applyMatrixToLightPoints (const osg::Matrix &adjustmentMatrix)
 
virtual void applyMatrixToLightPointsIncremental (const osg::Matrix &adjustmentMatrix, int firstNodeToChange)
 
virtual void setFadeParameters (const DtIndirectFadeParameters &fadeParameters)
 
virtual DtIndirectFadeParameters fadeParameters () const
 
virtual int lightPointCount () const
 
virtual osg::Vec3d lightPointPosition (int index) const
 
virtual void setLightPointPosition (int index, const osg::Vec3d &pos)
 
virtual int lightPointType (int index) const
 
virtual int lightPointNodeId () const
 
virtual int lightPointGroupId (int index) const
 
virtual float lightPointPhase (int index) const
 
virtual osg::Vec3 lightPointSectorDir (int index) const
 
virtual const osg::Matrix3 & lightPointSectorLocalToLp (int index) const
 
virtual void setCameraRelativeLightsMode (bool mode=true)
 
virtual bool cameraRelativeLightsMode ()
 

Protected Types

typedef std::vector
< LightPointInfo
LightPointIntList
 

Protected Member Functions

virtual osg::BoundingSphere computeBoundsIncremental (int firstNode) const
 

Protected Attributes

osg::BoundingBox myMutableBoundingBox
 
osg::Vec3 myMutableFurthestPoint
 
LightPointIntList myLightPointTypeList
 
DtOsgLightPointManagermyLightPointManager
 
osg::ref_ptr
< DtLightPointDrawable
myLightPointDrawable
 
std::vector< intmyNodeIds
 
const osg::Camera * myLastCamera
 
int myFrameNum
 
int myCurrentInstance
 
int myAddedInstances
 
bool myLightPointsEnabled
 
int myGroupId
 
osg::ref_ptr< osg::Texture > myLightPointTexture
 
GLuint64 myMutableTextureId
 
DtIndirectFadeParameters myFadeParameters
 
float myFirstFrameTime
 
bool myCameraRelativeLightsMode
 
std::vector< intmyFreeList
 
boost::recursive_mutex myMutableNodeIdMutex
 

Static Protected Attributes

static int theFrameNum
 
static const osg::Camera * theLastCamera
 

Private Member Functions

DtLightPointNodeoperator= (const DtLightPointNode &other)=delete
 

Member Typedef Documentation

Constructor & Destructor Documentation

makVrv::DtLightPointNode::DtLightPointNode ( )

Default constructor.

makVrv::DtLightPointNode::DtLightPointNode ( const DtLightPointNode lpn,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual makVrv::DtLightPointNode::~DtLightPointNode ( )
virtual

DTOR.

Member Function Documentation

makVrv::DtLightPointNode::META_Node ( vrvOsg  ,
DtLightPointNode   
)
DtLightPointNode& makVrv::DtLightPointNode::operator= ( const DtLightPointNode other)
privatedelete

Assignment Operator Not implemented – Assignment Not Allowed.

virtual void makVrv::DtLightPointNode::traverse ( osg::NodeVisitor &  nv)
virtual

Traverse function which if called by the cull visitor then it sets up the Light Points to be drawn.

virtual void makVrv::DtLightPointNode::updateDrawable ( const osg::Camera *  camera,
int  frameNum,
double  simTime,
const osg::Matrixd &  modelViewMatrix,
osgUtil::CullVisitor *  cv,
int  groupId,
bool  shouldCull,
const DtIndirectFadeParameters fadeParameters,
float  posScale,
float  radiusScale,
bool  isInstancedReflection = false 
)
virtual

Makes sure the drawable has enough instances and light points for this node and passes model view matrix to the Light Point Manager posScale is used to scale the position of the light point when model scaling is being used with instanced models radiusScale is used to scale the radius of the light point when model scaling is being used with any model.

virtual void makVrv::DtLightPointNode::updateNodeInfo ( bool  isInstancedReflection = false,
bool  isForcedAdd = false 
)
virtual

Copy DtLightPointNodeDataLayout to the light point node.

virtual int makVrv::DtLightPointNode::addTypedLightPoint ( const osg::Vec3d &  pos,
int  type,
const std::string &  id,
const osg::Vec3 &  rotation,
float  phaseShift 
)
virtual

add a typed light point to this node. This currently does not work correctly if this node has already been drawn once. position and rotation are in light point node local space. So the light point node's transform is applied to to the light points before they are drawn. The model view matrix for the light point node does this and is passed down to the shader in the updateDrawable function. returns the index into the array to allow modifications later.

virtual void makVrv::DtLightPointNode::removeTypedLightPoint ( int  index)
virtual

removes the light point at this index. (currently puts it on a free list) only works for nodes in dynamic Lights Mode.

virtual void makVrv::DtLightPointNode::setLightPointManager ( DtOsgLightPointManager lightPointManager)
virtual

keep a local copy of the light point manager pointer. Also needed since the Light Point Node does not have a reference to the DE.

virtual DtOsgLightPointManager* makVrv::DtLightPointNode::findLightPointManager ( )
virtual

get the light point manager that this light point node is using.

virtual void makVrv::DtLightPointNode::setLightPointsEnabled ( bool  enabled)
virtual

Turn all the light points for this node on or off.

virtual bool makVrv::DtLightPointNode::lightPointsEnabled ( )
virtual

Are all the light points for this node on or off.

virtual void makVrv::DtLightPointNode::setGroupId ( int  id)
virtual

Set the nodes group id. This overrides the light points individual group id unless it is set to 0.

virtual int makVrv::DtLightPointNode::groupId ( )
virtual

get the nodes group id.

virtual void makVrv::DtLightPointNode::freeNodeIdIfNecessary ( unsigned int  maxNodeIds)
virtual

Free up some node Id's if there are more than maxNodeIds allocated. This is used to free up the instanced model light points if a instance is free'd. The reason for using the max id instead of always removing a node id every time and instance is free'd is because the light point may have never been drawn so it may not need to be removed.

virtual osg::BoundingSphere makVrv::DtLightPointNode::computeBound ( ) const
virtual

Compute the bounds for this node based on all the light points it contains.

virtual void makVrv::DtLightPointNode::setLightPointTexture ( osg::Texture *  texture)
virtual

Set the texture to apply to all light points under this node.

virtual void makVrv::DtLightPointNode::releaseGLObjects ( osg::State *  state = 0) const
virtual

Releases the texture addresses for any textures used by this light point node.

virtual void makVrv::DtLightPointNode::applyMatrixToLightPoints ( const osg::Matrix &  adjustmentMatrix)
virtual

Apply a matrix to the light point positions and sectors used by the optimizer to remove the matrix transforms above the light points.

virtual void makVrv::DtLightPointNode::applyMatrixToLightPointsIncremental ( const osg::Matrix &  adjustmentMatrix,
int  firstNodeToChange 
)
virtual

Incremental version of applyMatrixToLightPoints. This applies the matrix to only the nodes >= firstNodeToChange.

virtual void makVrv::DtLightPointNode::setFadeParameters ( const DtIndirectFadeParameters fadeParameters)
virtual
virtual DtIndirectFadeParameters makVrv::DtLightPointNode::fadeParameters ( ) const
virtual
virtual int makVrv::DtLightPointNode::lightPointCount ( ) const
virtual
virtual osg::Vec3d makVrv::DtLightPointNode::lightPointPosition ( int  index) const
virtual
virtual void makVrv::DtLightPointNode::setLightPointPosition ( int  index,
const osg::Vec3d &  pos 
)
virtual
virtual int makVrv::DtLightPointNode::lightPointType ( int  index) const
virtual
virtual int makVrv::DtLightPointNode::lightPointNodeId ( ) const
virtual
virtual int makVrv::DtLightPointNode::lightPointGroupId ( int  index) const
virtual
virtual float makVrv::DtLightPointNode::lightPointPhase ( int  index) const
virtual
virtual osg::Vec3 makVrv::DtLightPointNode::lightPointSectorDir ( int  index) const
virtual
virtual const osg::Matrix3& makVrv::DtLightPointNode::lightPointSectorLocalToLp ( int  index) const
virtual
virtual void makVrv::DtLightPointNode::setCameraRelativeLightsMode ( bool  mode = true)
virtual

set the lights to have position updated each frame, requires DtOsgRenderPassLocalSpaceTransform as a parent to the node

virtual bool makVrv::DtLightPointNode::cameraRelativeLightsMode ( )
virtual
virtual osg::BoundingSphere makVrv::DtLightPointNode::computeBoundsIncremental ( int  firstNode) const
protectedvirtual

Internal, incremental computeLightPointBound. This is incremental because it is called from the incremental form ofapplyMatrixToLightPoints, and it would be expensive to recalculate the entire bound each time a few points were added.

Member Data Documentation

osg::BoundingBox makVrv::DtLightPointNode::myMutableBoundingBox
mutableprotected
osg::Vec3 makVrv::DtLightPointNode::myMutableFurthestPoint
mutableprotected
LightPointIntList makVrv::DtLightPointNode::myLightPointTypeList
protected
DtOsgLightPointManager* makVrv::DtLightPointNode::myLightPointManager
protected
osg::ref_ptr<DtLightPointDrawable> makVrv::DtLightPointNode::myLightPointDrawable
protected
std::vector<int> makVrv::DtLightPointNode::myNodeIds
protected
const osg::Camera* makVrv::DtLightPointNode::myLastCamera
protected
int makVrv::DtLightPointNode::myFrameNum
protected
int makVrv::DtLightPointNode::myCurrentInstance
protected
int makVrv::DtLightPointNode::myAddedInstances
protected
bool makVrv::DtLightPointNode::myLightPointsEnabled
protected
int makVrv::DtLightPointNode::myGroupId
protected
osg::ref_ptr<osg::Texture> makVrv::DtLightPointNode::myLightPointTexture
protected
GLuint64 makVrv::DtLightPointNode::myMutableTextureId
mutableprotected
DtIndirectFadeParameters makVrv::DtLightPointNode::myFadeParameters
protected
float makVrv::DtLightPointNode::myFirstFrameTime
protected
bool makVrv::DtLightPointNode::myCameraRelativeLightsMode
protected
std::vector<int> makVrv::DtLightPointNode::myFreeList
protected
boost::recursive_mutex makVrv::DtLightPointNode::myMutableNodeIdMutex
mutableprotected
int makVrv::DtLightPointNode::theFrameNum
staticprotected
const osg::Camera* makVrv::DtLightPointNode::theLastCamera
staticprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)