1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
/* -*-c++-*- $Id$ */
/**
* OsgAL - OpenSceneGraph Audio Library
* Copyright (C) 2004 VRlab, Ume University
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef osgAL_SoundRoot_
#define osgAL_SoundRoot_ 1
#include "osgAL/Export"
#include <osg/ref_ptr>
#include <osg/Object>
#include <osg/Node>
#include <osg/NodeVisitor>
#include <osg/CopyOp>
#include <osg/Vec3>
#include <osg/Matrix>
namespace osgAL
{
/// A node that updates the transformation of the listener. Should traversed before any SoundNode nodes
/**
This class updates the internal state of the osgAL::SoundManager during cull traversal from the current
modelView matrix.
The cull traversal for this node should be called after any changes are made to the SoundManager (added
SoundState events or such).
*/
class OSGAL_EXPORT SoundRoot: public osg::Node {
public:
/// Default constructor
SoundRoot();
META_Node(osgAL ,SoundRoot);
/*!
Executed during traversal of the scenegraph.
If the NodeVisitor is a CullVisitor the orientation/position and velocity of the
listener is updated.
*/
void traverse(osg::NodeVisitor &nv);
void setUpdateEnable(bool flag) { m_update_enabled = flag; }
bool getUpdateEnable() const { return m_update_enabled; }
protected:
/// Destructor
virtual ~SoundRoot() {}
/// Copy constructor
SoundRoot(const SoundRoot ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
/// Assignment operator
SoundRoot &operator=(const SoundRoot &node);
private:
double m_last_time;
double m_first_run;
osg::Vec3 m_last_pos;
int m_last_traversal_number;
bool m_update_enabled;
};
// INLINE FUNCTIONS
}
#endif
|