Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

osgAL::OccludeCallback Class Reference

Class to calculate occlusion between the listener and the soundsource. More...

Collaboration diagram for osgAL::OccludeCallback:

Collaboration graph
[legend]
List of all members.

Public Methods

 OccludeCallback (osg::Node *root)
float getEarDistance () const
 Returns the specified distance between the ears. More...

void setNearThreshold (float t)
 If the ray hit an object outstide this distance from the sound node, it is culled. More...

float getNearThreshold () const

Protected Methods

virtual void operator() (double distance, osg::Node *occluder, bool left_occluded, bool right_occluded)
SoundNodegetSoundNode ()

Private Methods

void apply (const osg::Matrix &listener_matrix, const osg::Vec3 &sound_pos, osgAL::SoundNode *node)

Private Attributes

osg::ref_ptr< osg::Node > m_root
SoundNodem_sound_node
float m_ear_distance
float m_near_threshold
bool m_was_occluded
const double m_delay
osg::Timer_t m_start_tick

Friends

class SoundNode

Detailed Description

Class to calculate occlusion between the listener and the soundsource.

OccludeCallback is executed from a SoundNode during traversal of the scene containing the soundnode. By analyzing if the sight is free by shooting a ray from the listener towards the soundnode, a damping factor is applied to the gain of the soundstate for the current sound node.

Currently only one ray is shot from the center of the listener to the center of the soundsource, instead of one per ear.

The operator() method is executed both when the source is occluded as well as it is not. operator() implements the actually occlusion functionality.

The default one, interpolates the damping over a short timeperiod trying to avoid clicks...


Constructor & Destructor Documentation

osgAL::OccludeCallback::OccludeCallback osg::Node *    root
 

Constructor.

Parameters:
root  - The intersection ray will be shot at root:s all childrens.


Member Function Documentation

void osgAL::OccludeCallback::apply const osg::Matrix &    listener_matrix,
const osg::Vec3 &    sound_pos,
osgAL::SoundNode   node
[private]
 

Executed from SoundNode::traverse.

Parameters:
listener_matrix  - contains the transformation matrix for the listener.
sound_pos  - Position of the current sound node
node  - The current sound node.

float osgAL::OccludeCallback::getEarDistance   const [inline]
 

Returns the specified distance between the ears.

float osgAL::OccludeCallback::getNearThreshold   const [inline]
 

SoundNode* osgAL::OccludeCallback::getSoundNode   [inline, protected]
 

virtual void osgAL::OccludeCallback::operator() double    distance,
osg::Node *    occluder,
bool    left_occluded,
bool    right_occluded
[protected, virtual]
 

void osgAL::OccludeCallback::setNearThreshold float    t [inline]
 

If the ray hit an object outstide this distance from the sound node, it is culled.


Friends And Related Function Documentation

friend class SoundNode [friend]
 


Member Data Documentation

const double osgAL::OccludeCallback::m_delay [private]
 

float osgAL::OccludeCallback::m_ear_distance [private]
 

float osgAL::OccludeCallback::m_near_threshold [private]
 

osg::ref_ptr<osg::Node> osgAL::OccludeCallback::m_root [private]
 

SoundNode* osgAL::OccludeCallback::m_sound_node [private]
 

osg::Timer_t osgAL::OccludeCallback::m_start_tick [private]
 

bool osgAL::OccludeCallback::m_was_occluded [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Nov 22 09:27:17 2004 for OpenSceneGraphAudioLibrary(OsgAL) by doxygen1.2.15