Lots of (mostly) doxygen fixes/cleanup.
This commit is contained in:
parent
942181c8ae
commit
3bcd0bafd5
25
Doxyfile
25
Doxyfile
@ -744,30 +744,7 @@ WARN_LOGFILE =
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = DoxygenMain.cxx \
|
||||
simgear/bucket \
|
||||
simgear/canvas \
|
||||
simgear/compiler.h \
|
||||
simgear/constants.h \
|
||||
simgear/debug \
|
||||
simgear/environment \
|
||||
simgear/ephemeris \
|
||||
simgear/io \
|
||||
simgear/magvar \
|
||||
simgear/math \
|
||||
simgear/misc \
|
||||
simgear/nasal \
|
||||
simgear/props \
|
||||
simgear/route \
|
||||
simgear/scene \
|
||||
simgear/screen \
|
||||
simgear/serial \
|
||||
simgear/structure \
|
||||
simgear/sg_inlines.h \
|
||||
simgear/sg_traits.hxx \
|
||||
simgear/sound \
|
||||
simgear/threads \
|
||||
simgear/timing \
|
||||
simgear/xml
|
||||
simgear
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
|
@ -127,21 +127,22 @@ public:
|
||||
|
||||
/**
|
||||
* Construct a bucket given a specific location.
|
||||
* @param dlon longitude specified in degrees
|
||||
* @param dlat latitude specified in degrees
|
||||
*
|
||||
* @param geod Geodetic location
|
||||
*/
|
||||
SGBucket(const SGGeod& geod);
|
||||
|
||||
/** Construct a bucket given a unique bucket index number.
|
||||
*
|
||||
* @param bindex unique bucket index
|
||||
*/
|
||||
SGBucket(const long int bindex);
|
||||
|
||||
#ifndef NO_DEPRECATED_API
|
||||
/**
|
||||
* Reset a bucket to represent a new lat and lon
|
||||
* @param dlon longitude specified in degrees
|
||||
* @param dlat latitude specified in degrees
|
||||
* Reset a bucket to represent a new location.
|
||||
*
|
||||
* @param geod New geodetic location
|
||||
*/
|
||||
void set_bucket(const SGGeod& geod);
|
||||
|
||||
|
@ -228,12 +228,12 @@ namespace canvas
|
||||
ElementWeakPtr _focus_element;
|
||||
|
||||
CullCallbackPtr _cull_callback;
|
||||
bool _render_always; //<! Used to disable automatic lazy rendering (culling)
|
||||
bool _render_always; //!< Used to disable automatic lazy rendering (culling)
|
||||
|
||||
std::vector<SGPropertyNode*> _dirty_placements;
|
||||
std::vector<Placements> _placements;
|
||||
std::set<CanvasWeakPtr> _parent_canvases, //<! Canvases showing this canvas
|
||||
_child_canvases; //<! Canvases displayed within
|
||||
std::set<CanvasWeakPtr> _parent_canvases, //!< Canvases showing this canvas
|
||||
_child_canvases; //!< Canvases displayed within
|
||||
// this canvas
|
||||
|
||||
typedef std::map<std::string, PlacementFactory> PlacementFactoryMap;
|
||||
|
@ -279,9 +279,10 @@ namespace canvas
|
||||
/**
|
||||
* Register a function for setting a style specified by the given property
|
||||
*
|
||||
* @param name Property name
|
||||
* @param type Interpolation type
|
||||
* @param setter Setter function
|
||||
* @param name Property name
|
||||
* @param type Interpolation type
|
||||
* @param setter Setter function
|
||||
* @param inheritable If this style propagates to child elements
|
||||
*
|
||||
* @tparam T1 Type of value used to retrieve value from property
|
||||
* node
|
||||
|
@ -41,6 +41,7 @@ namespace canvas
|
||||
*
|
||||
* @param type_str Event type name (if name does not exist yet it will
|
||||
* be registered as new event type)
|
||||
* @param bubbles If this event should take part in the bubbling phase
|
||||
* @param data Optional user data stored in event
|
||||
*/
|
||||
CustomEvent( std::string const& type_str,
|
||||
@ -50,6 +51,7 @@ namespace canvas
|
||||
/**
|
||||
*
|
||||
* @param type_id Event type id
|
||||
* @param bubbles If this event should take part in the bubbling phase
|
||||
* @param data Optional user data stored in event
|
||||
*/
|
||||
CustomEvent( int type_id,
|
||||
@ -66,10 +68,16 @@ namespace canvas
|
||||
*/
|
||||
StringMap const& getDetail() const { return detail; }
|
||||
|
||||
/**
|
||||
* Get whether this event supports bubbling.
|
||||
*
|
||||
* @see #bubbles
|
||||
* @see CustomEvent()
|
||||
*/
|
||||
virtual bool canBubble() const { return bubbles; }
|
||||
|
||||
StringMap detail; //<! user data map
|
||||
bool bubbles;
|
||||
StringMap detail; //!< User data map
|
||||
bool bubbles; //!< Whether the event supports bubbling
|
||||
};
|
||||
|
||||
} // namespace canvas
|
||||
|
@ -61,14 +61,14 @@ namespace canvas
|
||||
bool isModifier() const;
|
||||
|
||||
protected:
|
||||
uint32_t _key, //<! Key identifier for this event
|
||||
_unmodified_key; //<! Virtual key identifier without any
|
||||
uint32_t _key, //!< Key identifier for this event
|
||||
_unmodified_key; //!< Virtual key identifier without any
|
||||
// modifiers applied
|
||||
bool _repeat; //<! If key has been depressed long enough to
|
||||
bool _repeat; //!< If key has been depressed long enough to
|
||||
// generate key repetition
|
||||
|
||||
mutable std::string _name; //<! Printable representation/name
|
||||
mutable uint8_t _location; //<! Location of the key on the keyboard
|
||||
mutable std::string _name; //!< Printable representation/name
|
||||
mutable uint8_t _location; //!< Location of the key on the keyboard
|
||||
|
||||
};
|
||||
|
||||
|
@ -61,13 +61,13 @@ namespace canvas
|
||||
|
||||
int getCurrentClickCount() const { return click_count; }
|
||||
|
||||
osg::Vec2f screen_pos, //<! Position in screen coordinates
|
||||
client_pos, //<! Position in window/canvas coordinates
|
||||
local_pos, //<! Position in local/element coordinates
|
||||
osg::Vec2f screen_pos, //!< Position in screen coordinates
|
||||
client_pos, //!< Position in window/canvas coordinates
|
||||
local_pos, //!< Position in local/element coordinates
|
||||
delta;
|
||||
int button, //<! Button for this event
|
||||
buttons, //<! Current button state
|
||||
click_count; //<! Current click count
|
||||
int button, //!< Button for this event
|
||||
buttons, //!< Current button state
|
||||
click_count; //!< Current click count
|
||||
};
|
||||
|
||||
} // namespace canvas
|
||||
|
@ -99,9 +99,9 @@ namespace canvas
|
||||
protected:
|
||||
|
||||
typedef const int& (SGVec2i::*CoordGetter)() const;
|
||||
CoordGetter _get_layout_coord, //<! getter for coordinate in layout
|
||||
CoordGetter _get_layout_coord, //!< getter for coordinate in layout
|
||||
// direction
|
||||
_get_fixed_coord; //<! getter for coordinate in secondary
|
||||
_get_fixed_coord; //!< getter for coordinate in secondary
|
||||
// (fixed) direction
|
||||
|
||||
int _padding;
|
||||
|
@ -81,13 +81,13 @@ namespace canvas
|
||||
int size_hint,
|
||||
min_size,
|
||||
max_size,
|
||||
padding_orig, //<! original padding as specified by the user
|
||||
padding, //<! padding before element (layouted)
|
||||
size, //<! layouted size
|
||||
stretch; //<! stretch factor
|
||||
padding_orig, //!< original padding as specified by the user
|
||||
padding, //!< padding before element (layouted)
|
||||
size, //!< layouted size
|
||||
stretch; //!< stretch factor
|
||||
bool visible : 1,
|
||||
has_hfw : 1, //<! height for width
|
||||
done : 1; //<! layouting done
|
||||
has_hfw : 1, //!< height for width
|
||||
done : 1; //!< layouting done
|
||||
|
||||
/** Clear values (reset to default/empty state) */
|
||||
void reset();
|
||||
@ -110,12 +110,12 @@ namespace canvas
|
||||
|
||||
private:
|
||||
|
||||
int _num_not_done, //<! number of children not layouted yet
|
||||
_sum_stretch, //<! sum of stretch factors of all not yet layouted
|
||||
int _num_not_done, //!< number of children not layouted yet
|
||||
_sum_stretch, //!< sum of stretch factors of all not yet layouted
|
||||
// children
|
||||
_space_stretch,//<! space currently assigned to all not yet layouted
|
||||
_space_stretch,//!< space currently assigned to all not yet layouted
|
||||
// stretchable children
|
||||
_space_left; //<! remaining space not used by any child yet
|
||||
_space_left; //!< remaining space not used by any child yet
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,9 +44,8 @@
|
||||
|
||||
#include "sg_file.hxx"
|
||||
|
||||
using std::string;
|
||||
|
||||
SGFile::SGFile(const string &file, int repeat_)
|
||||
SGFile::SGFile(const std::string &file, int repeat_)
|
||||
: file_name(file), fp(-1), eof_flag(true), repeat(repeat_), iteration(0)
|
||||
{
|
||||
set_type( sgFileType );
|
||||
|
@ -1,37 +1,31 @@
|
||||
/** \file sg_file.hxx
|
||||
* File I/O routines.
|
||||
*/
|
||||
|
||||
///@file
|
||||
/// File I/O routines.
|
||||
//
|
||||
// Written by Curtis Olson, started November 1999.
|
||||
//
|
||||
// Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_FILE_HXX
|
||||
#define _SG_FILE_HXX
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "iochannel.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* A file I/O class based on SGIOChannel.
|
||||
@ -91,7 +85,4 @@ public:
|
||||
virtual bool eof() const { return eof_flag; };
|
||||
};
|
||||
|
||||
|
||||
#endif // _SG_FILE_HXX
|
||||
|
||||
|
||||
|
@ -36,8 +36,6 @@
|
||||
|
||||
#include "interpolater.hxx"
|
||||
|
||||
using std::string;
|
||||
|
||||
// Constructor -- starts with an empty table.
|
||||
SGInterpTable::SGInterpTable()
|
||||
{
|
||||
@ -55,7 +53,7 @@ SGInterpTable::SGInterpTable(const SGPropertyNode* interpolation)
|
||||
|
||||
// Constructor -- loads the interpolation table from the specified
|
||||
// file
|
||||
SGInterpTable::SGInterpTable( const string& file )
|
||||
SGInterpTable::SGInterpTable( const std::string& file )
|
||||
{
|
||||
SG_LOG( SG_MATH, SG_INFO, "Initializing Interpolator for " << file );
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "sgstream.hxx"
|
||||
|
||||
using std::string;
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
|
||||
@ -40,7 +39,7 @@ sg_gzifstream::sg_gzifstream()
|
||||
//
|
||||
// Open a possibly gzipped file for reading.
|
||||
//
|
||||
sg_gzifstream::sg_gzifstream( const string& name, ios_openmode io_mode )
|
||||
sg_gzifstream::sg_gzifstream( const std::string& name, ios_openmode io_mode )
|
||||
: istream(&gzbuf)
|
||||
{
|
||||
this->open( name, io_mode );
|
||||
@ -65,12 +64,12 @@ sg_gzifstream::sg_gzifstream( int fd, ios_openmode io_mode )
|
||||
// then append ".gz" and try again.
|
||||
//
|
||||
void
|
||||
sg_gzifstream::open( const string& name, ios_openmode io_mode )
|
||||
sg_gzifstream::open( const std::string& name, ios_openmode io_mode )
|
||||
{
|
||||
gzbuf.open( name.c_str(), io_mode );
|
||||
if ( ! gzbuf.is_open() )
|
||||
{
|
||||
string s = name;
|
||||
std::string s = name;
|
||||
if ( s.substr( s.length() - 3, 3 ) == ".gz" )
|
||||
{
|
||||
// remove ".gz" suffix
|
||||
@ -160,7 +159,7 @@ sg_gzofstream::sg_gzofstream()
|
||||
//
|
||||
// Open a file for gzipped writing.
|
||||
//
|
||||
sg_gzofstream::sg_gzofstream( const string& name, ios_openmode io_mode )
|
||||
sg_gzofstream::sg_gzofstream( const std::string& name, ios_openmode io_mode )
|
||||
: ostream(&gzbuf)
|
||||
{
|
||||
this->open( name, io_mode );
|
||||
@ -181,7 +180,7 @@ sg_gzofstream::sg_gzofstream( int fd, ios_openmode io_mode )
|
||||
// Open a file for gzipped writing.
|
||||
//
|
||||
void
|
||||
sg_gzofstream::open( const string& name, ios_openmode io_mode )
|
||||
sg_gzofstream::open( const std::string& name, ios_openmode io_mode )
|
||||
{
|
||||
gzbuf.open( name.c_str(), io_mode );
|
||||
}
|
||||
|
@ -118,7 +118,6 @@ namespace nasal
|
||||
*
|
||||
* @tparam Sig Function signature
|
||||
* @param name Member name
|
||||
* @param key Member key
|
||||
*/
|
||||
template<class Sig, class Key>
|
||||
typename boost::enable_if< boost::is_function<Sig>,
|
||||
|
@ -47,7 +47,7 @@ namespace nasal
|
||||
*
|
||||
* @param str Existing Nasal String
|
||||
*/
|
||||
String(naRef string);
|
||||
String(naRef str);
|
||||
|
||||
const char* c_str() const;
|
||||
const char* begin() const;
|
||||
|
@ -161,7 +161,7 @@ struct naFunc {
|
||||
struct naCCode {
|
||||
GC_HEADER;
|
||||
union {
|
||||
naCFunction fptr; //<! pointer to simple callback function. Invalid if
|
||||
naCFunction fptr; //!< pointer to simple callback function. Invalid if
|
||||
// fptru is not NULL.
|
||||
struct {
|
||||
void* user_data;
|
||||
|
@ -39,8 +39,8 @@ namespace simgear
|
||||
/**
|
||||
* Remove the property listener of the element.
|
||||
*
|
||||
* You will need to call the appropriate methods (#childAdded,
|
||||
* #childRemoved, #valueChanged) yourself to ensure the element still
|
||||
* You will need to call the appropriate methods (childAdded(),
|
||||
* childRemoved(), valueChanged()) yourself to ensure the element still
|
||||
* receives the needed events.
|
||||
*/
|
||||
void removeListener();
|
||||
|
@ -52,7 +52,6 @@ using std::cerr;
|
||||
using std::endl;
|
||||
using std::find;
|
||||
using std::sort;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::stringstream;
|
||||
|
||||
@ -104,7 +103,7 @@ parse_name (const SGPropertyNode *node, const Range &path)
|
||||
i++;
|
||||
}
|
||||
if (i != max && *i != '/')
|
||||
throw string("illegal character after . or ..");
|
||||
throw std::string("illegal character after . or ..");
|
||||
} else if (isalpha(*i) || *i == '_') {
|
||||
i++;
|
||||
|
||||
@ -117,7 +116,7 @@ parse_name (const SGPropertyNode *node, const Range &path)
|
||||
} else if (*i == '[' || *i == '/') {
|
||||
break;
|
||||
} else {
|
||||
string err = "'";
|
||||
std::string err = "'";
|
||||
err.push_back(*i);
|
||||
err.append("' found in propertyname after '"+node->getNameString()+"'");
|
||||
err.append("\nname may contain only ._- and alphanumeric characters");
|
||||
@ -129,7 +128,7 @@ parse_name (const SGPropertyNode *node, const Range &path)
|
||||
|
||||
else {
|
||||
if (path.begin() == i) {
|
||||
string err = "'";
|
||||
std::string err = "'";
|
||||
err.push_back(*i);
|
||||
err.append("' found in propertyname after '"+node->getNameString()+"'");
|
||||
err.append("\nname must begin with alpha or '_'");
|
||||
@ -140,7 +139,7 @@ parse_name (const SGPropertyNode *node, const Range &path)
|
||||
}
|
||||
|
||||
// Validate the name of a single node
|
||||
inline bool validateName(const string& name)
|
||||
inline bool validateName(const std::string& name)
|
||||
{
|
||||
using namespace boost;
|
||||
if (name.empty())
|
||||
@ -287,7 +286,7 @@ find_node_aux(SGPropertyNode * current, SplitItr& itr, bool create,
|
||||
if (equals(name, "..")) {
|
||||
SGPropertyNode * parent = current->getParent();
|
||||
if (parent == 0)
|
||||
throw string("attempt to move past root with '..'");
|
||||
throw std::string("attempt to move past root with '..'");
|
||||
return find_node_aux(parent, ++itr, create, last_index);
|
||||
}
|
||||
int index = -1;
|
||||
@ -320,10 +319,10 @@ find_node_aux(SGPropertyNode * current, SplitItr& itr, bool create,
|
||||
}
|
||||
}
|
||||
if (i == token.end() || *i != ']')
|
||||
throw string("unterminated index (looking for ']')");
|
||||
throw std::string("unterminated index (looking for ']')");
|
||||
} else {
|
||||
throw string("illegal characters in token: ")
|
||||
+ string(name.begin(), name.end());
|
||||
throw std::string("illegal characters in token: ")
|
||||
+ std::string(name.begin(), name.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -733,12 +732,12 @@ SGPropertyNode::SGPropertyNode (Itr begin, Itr end,
|
||||
_local_val.string_val = 0;
|
||||
_value.val = 0;
|
||||
if (!validateName(_name))
|
||||
throw string("plain name expected instead of '") + _name + '\'';
|
||||
throw std::string("plain name expected instead of '") + _name + '\'';
|
||||
}
|
||||
|
||||
SGPropertyNode::SGPropertyNode (const string& name,
|
||||
int index,
|
||||
SGPropertyNode * parent)
|
||||
SGPropertyNode::SGPropertyNode( const std::string& name,
|
||||
int index,
|
||||
SGPropertyNode * parent)
|
||||
: _index(index),
|
||||
_name(name),
|
||||
_parent(parent),
|
||||
@ -750,7 +749,7 @@ SGPropertyNode::SGPropertyNode (const string& name,
|
||||
_local_val.string_val = 0;
|
||||
_value.val = 0;
|
||||
if (!validateName(name))
|
||||
throw string("plain name expected instead of '") + _name + '\'';
|
||||
throw std::string("plain name expected instead of '") + _name + '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -956,7 +955,7 @@ SGPropertyNode::getChild (const char * name, int index, bool create)
|
||||
}
|
||||
|
||||
SGPropertyNode *
|
||||
SGPropertyNode::getChild (const string& name, int index, bool create)
|
||||
SGPropertyNode::getChild (const std::string& name, int index, bool create)
|
||||
{
|
||||
SGPropertyNode* node = getExistingChild(name.begin(), name.end(), index);
|
||||
if (node) {
|
||||
@ -1072,10 +1071,10 @@ SGPropertyNode::removeAllChildren()
|
||||
_children.clear();
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
SGPropertyNode::getDisplayName (bool simplify) const
|
||||
{
|
||||
string display_name = _name;
|
||||
std::string display_name = _name;
|
||||
if (_index != 0 || !simplify) {
|
||||
stringstream sstr;
|
||||
sstr << '[' << _index << ']';
|
||||
@ -1084,14 +1083,14 @@ SGPropertyNode::getDisplayName (bool simplify) const
|
||||
return display_name;
|
||||
}
|
||||
|
||||
string
|
||||
std::string
|
||||
SGPropertyNode::getPath (bool simplify) const
|
||||
{
|
||||
typedef std::vector<SGConstPropertyNode_ptr> PList;
|
||||
PList pathList;
|
||||
for (const SGPropertyNode* node = this; node->_parent; node = node->_parent)
|
||||
pathList.push_back(node);
|
||||
string result;
|
||||
std::string result;
|
||||
for (PList::reverse_iterator itr = pathList.rbegin(),
|
||||
rend = pathList.rend();
|
||||
itr != rend;
|
||||
@ -1672,7 +1671,7 @@ bool SGPropertyNode::interpolate( const std::string& type,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool SGPropertyNode::interpolate( const std::string& type,
|
||||
const PropertyList& values,
|
||||
const simgear::PropertyList& values,
|
||||
const double_list& deltas,
|
||||
const std::string& easing )
|
||||
{
|
||||
@ -1810,7 +1809,7 @@ SGPropertyNode::untie ()
|
||||
}
|
||||
case props::STRING:
|
||||
case props::UNSPECIFIED: {
|
||||
string val = getStringValue();
|
||||
std::string val = getStringValue();
|
||||
clearValue();
|
||||
_type = props::STRING;
|
||||
_local_val.string_val = copy_string(val.c_str());
|
||||
|
@ -252,15 +252,14 @@ class SGRawBase<T, 0> : public SGRawExtended
|
||||
/**
|
||||
* Abstract base class for a raw value.
|
||||
*
|
||||
* <p>The property manager is implemented in two layers. The {@link
|
||||
* SGPropertyNode} is the highest and most abstract layer,
|
||||
* representing an LValue/RValue pair: it records the position of the
|
||||
* property in the property tree and contains facilities for
|
||||
* navigation to other nodes. It is guaranteed to be persistent: the
|
||||
* {@link SGPropertyNode} will not change during a session, even if
|
||||
* the property is bound and unbound multiple times.</p>
|
||||
* The property manager is implemented in two layers. The SGPropertyNode is the
|
||||
* highest and most abstract layer, representing an LValue/RValue pair: it
|
||||
* records the position of the property in the property tree and contains
|
||||
* facilities for navigation to other nodes. It is guaranteed to be persistent:
|
||||
* the SGPropertyNode will not change during a session, even if the property is
|
||||
* bound and unbound multiple times.
|
||||
*
|
||||
* <p>When the property value is not managed internally in the
|
||||
* When the property value is not managed internally in the
|
||||
* SGPropertyNode, the SGPropertyNode will contain a reference to an
|
||||
* SGRawValue (this class), which provides an abstract way to get,
|
||||
* set, and clone the underlying value. The SGRawValue may change
|
||||
@ -268,13 +267,12 @@ class SGRawBase<T, 0> : public SGRawExtended
|
||||
* unbound to various data source, but the abstract SGPropertyNode
|
||||
* layer insulates the application from those changes.
|
||||
*
|
||||
* <p>The SGPropertyNode class always keeps a *copy* of a raw value,
|
||||
* not the original one passed to it; if you override a derived class
|
||||
* but do not replace the {@link #clone} method, strange things will
|
||||
* happen.</p>
|
||||
* The SGPropertyNode class always keeps a *copy* of a raw value, not the
|
||||
* original one passed to it; if you override a derived class but do not replace
|
||||
* the {@link SGRaw::clone clone()} method, strange things will happen.
|
||||
*
|
||||
* <p>All derived SGRawValue classes must implement {@link #getValue},
|
||||
* {@link #setValue}, and {@link #clone} for the appropriate type.</p>
|
||||
* All derived SGRawValue classes must implement getValue(), setValue(), and
|
||||
* {@link SGRaw::clone clone()} for the appropriate type.
|
||||
*
|
||||
* @see SGPropertyNode
|
||||
* @see SGRawValuePointer
|
||||
@ -696,9 +694,15 @@ class SGPropertyChangeListener
|
||||
{
|
||||
public:
|
||||
virtual ~SGPropertyChangeListener ();
|
||||
virtual void valueChanged (SGPropertyNode * node);
|
||||
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
|
||||
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
|
||||
|
||||
/// Called if value of \a node has changed.
|
||||
virtual void valueChanged(SGPropertyNode * node);
|
||||
|
||||
/// Called if \a child has been added to the given \a parent.
|
||||
virtual void childAdded(SGPropertyNode * parent, SGPropertyNode * child);
|
||||
|
||||
/// Called if \a child has been removed from its \a parent.
|
||||
virtual void childRemoved(SGPropertyNode * parent, SGPropertyNode * child);
|
||||
|
||||
protected:
|
||||
friend class SGPropertyNode;
|
||||
@ -1289,7 +1293,7 @@ public:
|
||||
*
|
||||
* @param type Type of interpolation ("numeric", "color", etc.)
|
||||
* @param values Nodes containing intermediate and target values
|
||||
* @param duration Durations for each interpolation step (in seconds)
|
||||
* @param deltas Durations for each interpolation step (in seconds)
|
||||
* @param easing Easing function (http://easings.net/)
|
||||
*/
|
||||
bool interpolate( const std::string& type,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* \file propsfwwd.hxx
|
||||
/** \file
|
||||
*
|
||||
* Forward declarations for properties (and related structures)
|
||||
*/
|
||||
|
||||
@ -9,10 +9,10 @@
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
|
||||
class SGPropertyNode;
|
||||
|
||||
|
||||
typedef SGSharedPtr<SGPropertyNode> SGPropertyNode_ptr;
|
||||
typedef SGSharedPtr<const SGPropertyNode> SGConstPropertyNode_ptr;
|
||||
|
||||
|
||||
class SGCondition;
|
||||
|
||||
#endif // of SG_PROPS_FWD_HXX
|
||||
|
@ -295,9 +295,9 @@ const SGPropertyNode* getEffectPropertyChild(Effect* effect,
|
||||
const char* name);
|
||||
|
||||
/**
|
||||
* Get the name of a node mentioned in a <use> clause from the global property
|
||||
* Get the name of a node mentioned in a \<use\> clause from the global property
|
||||
* tree.
|
||||
* @return empty if prop doesn't contain a <use> clause; otherwise the
|
||||
* @return empty if prop doesn't contain a \<use\> clause; otherwise the
|
||||
* mentioned node name.
|
||||
*/
|
||||
std::string getGlobalProperty(const SGPropertyNode* prop,
|
||||
@ -597,9 +597,9 @@ inline void setDynamicVariance(osg::Object* obj)
|
||||
/**
|
||||
* Initialize the value and the possible updating of an effect
|
||||
* attribute. If the value is specified directly, set it. Otherwise,
|
||||
* use the <use> tag to look at the parameters. Again, if there is a
|
||||
* use the \<use\> tag to look at the parameters. Again, if there is a
|
||||
* value there set it directly. Otherwise, the parameter contains its
|
||||
* own <use> tag referring to a property in the global property tree;
|
||||
* own \<use\> tag referring to a property in the global property tree;
|
||||
* install a change listener that will set the attribute when the
|
||||
* property changes.
|
||||
*
|
||||
@ -641,12 +641,12 @@ initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj,
|
||||
* The parameter may be updated at runtime.
|
||||
*
|
||||
* If the value is specified directly, set it. Otherwise, use the
|
||||
* <use> tag to look at the parameters. Again, if there is a value
|
||||
* \<use\> tag to look at the parameters. Again, if there is a value
|
||||
* there set it directly. Otherwise, the parameter contains one or several
|
||||
* <use> tags. If there is one tag, it is a property that is the root
|
||||
* \<use\> tags. If there is one tag, it is a property that is the root
|
||||
* for the values needed to update the parameter; nameIter holds the
|
||||
* names of the properties relative to the root. If there are several
|
||||
* <use> tags, they each hold the name of the property holding the
|
||||
* \<use\> tags, they each hold the name of the property holding the
|
||||
* value for the corresponding vector member.
|
||||
*
|
||||
* Install a change listener that will set the attribute when the
|
||||
|
@ -68,10 +68,8 @@
|
||||
#include "Pass.hxx"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
using namespace simgear;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Constructors and destructor.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -82,8 +80,10 @@ SGMaterial::_internal_state::_internal_state(Effect *e, bool l,
|
||||
{
|
||||
}
|
||||
|
||||
SGMaterial::_internal_state::_internal_state(Effect *e, const string &t, bool l,
|
||||
const SGReaderWriterOptions* o)
|
||||
SGMaterial::_internal_state::_internal_state( Effect *e,
|
||||
const std::string &t,
|
||||
bool l,
|
||||
const SGReaderWriterOptions* o )
|
||||
: effect(e), effect_realized(l), options(o)
|
||||
{
|
||||
texture_paths.push_back(std::make_pair(t,0));
|
||||
@ -132,7 +132,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
std::vector<SGPropertyNode_ptr> textures = props->getChildren("texture");
|
||||
for (unsigned int i = 0; i < textures.size(); i++)
|
||||
{
|
||||
string tname = textures[i]->getStringValue();
|
||||
std::string tname = textures[i]->getStringValue();
|
||||
|
||||
if (tname.empty()) {
|
||||
tname = "unknown.rgb";
|
||||
@ -140,7 +140,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
|
||||
SGPath tpath("Textures.high");
|
||||
tpath.append(tname);
|
||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
std::string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty()) {
|
||||
tpath.set("Textures");
|
||||
tpath.append(tname);
|
||||
@ -170,14 +170,14 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
std::vector<SGPropertyNode_ptr> textures = texturesets[i]->getChildren("texture");
|
||||
for (unsigned int j = 0; j < textures.size(); j++)
|
||||
{
|
||||
string tname = textures[j]->getStringValue();
|
||||
std::string tname = textures[j]->getStringValue();
|
||||
if (tname.empty()) {
|
||||
tname = "unknown.rgb";
|
||||
}
|
||||
|
||||
SGPath tpath("Textures.high");
|
||||
tpath.append(tname);
|
||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
std::string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty()) {
|
||||
tpath.set("Textures");
|
||||
tpath.append(tname);
|
||||
@ -215,12 +215,13 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
std::vector<SGPropertyNode_ptr> masks = props->getChildren("object-mask");
|
||||
for (unsigned int i = 0; i < masks.size(); i++)
|
||||
{
|
||||
string omname = masks[i]->getStringValue();
|
||||
std::string omname = masks[i]->getStringValue();
|
||||
|
||||
if (! omname.empty()) {
|
||||
SGPath ompath("Textures.high");
|
||||
ompath.append(omname);
|
||||
string fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
||||
std::string fullMaskPath =
|
||||
SGModelLib::findDataFile(ompath.str(), options);
|
||||
|
||||
if (fullMaskPath.empty()) {
|
||||
ompath.set("Textures");
|
||||
@ -279,7 +280,8 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
building_coverage = props->getDoubleValue("building-coverage", 0.0);
|
||||
building_spacing = props->getDoubleValue("building-spacing-m", 5.0);
|
||||
|
||||
string bt = props->getStringValue("building-texture", "Textures/buildings.png");
|
||||
std::string bt = props->getStringValue( "building-texture",
|
||||
"Textures/buildings.png" );
|
||||
building_texture = SGModelLib::findDataFile(bt, options);
|
||||
|
||||
if (building_texture.empty()) {
|
||||
@ -340,7 +342,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
const SGPropertyNode* treeTexNode = props->getChild("tree-texture");
|
||||
|
||||
if (treeTexNode) {
|
||||
string treeTexPath = props->getStringValue("tree-texture");
|
||||
std::string treeTexPath = props->getStringValue("tree-texture");
|
||||
|
||||
if (! treeTexPath.empty()) {
|
||||
SGPath treePath("Textures.high");
|
||||
@ -540,9 +542,9 @@ void SGMaterial::buildEffectProperties(const SGReaderWriterOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
SGMaterialGlyph* SGMaterial::get_glyph (const string& name) const
|
||||
SGMaterialGlyph* SGMaterial::get_glyph (const std::string& name) const
|
||||
{
|
||||
map<string, SGSharedPtr<SGMaterialGlyph> >::const_iterator it;
|
||||
map<std::string, SGSharedPtr<SGMaterialGlyph> >::const_iterator it;
|
||||
it = glyphs.find(name);
|
||||
if (it == glyphs.end())
|
||||
return 0;
|
||||
|
@ -32,7 +32,7 @@ ConditionNode::ConditionNode()
|
||||
{
|
||||
}
|
||||
|
||||
ConditionNode::ConditionNode(const ConditionNode& rhs, const CopyOp& op)
|
||||
ConditionNode::ConditionNode(const ConditionNode& rhs, const osg::CopyOp& op)
|
||||
: Group(rhs, op), _condition(rhs._condition)
|
||||
{
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ TextureUpdateVisitor::TextureUpdateVisitor(const osgDB::FilePathList& pathList)
|
||||
{
|
||||
}
|
||||
|
||||
void TextureUpdateVisitor::apply(Node& node)
|
||||
void TextureUpdateVisitor::apply(osg::Node& node)
|
||||
{
|
||||
StateSet* stateSet = cloneStateSet(node.getStateSet());
|
||||
if (stateSet)
|
||||
|
@ -500,8 +500,12 @@ bool SGCloudLayer::repaint( const SGVec3f& fog_color ) {
|
||||
// lat specifies a rotation about the new Y axis
|
||||
// spin specifies a rotation about the new Z axis (and orients the
|
||||
// sunrise/set effects
|
||||
bool SGCloudLayer::reposition( const SGVec3f& p, const SGVec3f& up, double lon, double lat,
|
||||
double alt, double dt )
|
||||
bool SGCloudLayer::reposition( const SGVec3f& p,
|
||||
const SGVec3f& up,
|
||||
double lon,
|
||||
double lat,
|
||||
double alt,
|
||||
double dt )
|
||||
{
|
||||
|
||||
if (getCoverage() != SGCloudLayer::SG_CLOUD_CLEAR)
|
||||
|
@ -214,13 +214,13 @@ public:
|
||||
* orientation.
|
||||
* @param p position vector
|
||||
* @param up the local up vector
|
||||
* @param lon specifies a rotation about the Z axis
|
||||
* @param lat specifies a rotation about the new Y axis
|
||||
* @param spin specifies a rotation about the new Z axis
|
||||
* (and orients the sunrise/set effects)
|
||||
* @param lon TODO
|
||||
* @param lat TODO
|
||||
* @param alt TODO
|
||||
* @param dt the time elapsed since the last call
|
||||
*/
|
||||
bool reposition( const SGVec3f& p, const SGVec3f& up,
|
||||
bool reposition( const SGVec3f& p,
|
||||
const SGVec3f& up,
|
||||
double lon, double lat, double alt,
|
||||
double dt = 0.0 );
|
||||
|
||||
|
@ -79,9 +79,12 @@ SGSky::~SGSky( void )
|
||||
|
||||
// initialize the sky and connect the components to the scene graph at
|
||||
// the provided branch
|
||||
void SGSky::build( double h_radius_m, double v_radius_m,
|
||||
double sun_size, double moon_size,
|
||||
const SGEphemeris& eph, SGPropertyNode *property_tree_node,
|
||||
void SGSky::build( double h_radius_m,
|
||||
double v_radius_m,
|
||||
double sun_size,
|
||||
double moon_size,
|
||||
const SGEphemeris& eph,
|
||||
SGPropertyNode *property_tree_node,
|
||||
simgear::SGReaderWriterOptions* options )
|
||||
{
|
||||
dome = new SGSkyDome;
|
||||
|
@ -29,10 +29,6 @@
|
||||
#define _SG_SKY_HXX
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/math/sg_random.h>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
@ -57,29 +53,36 @@ namespace simgear {
|
||||
class SGReaderWriterOptions;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
SGVec3d pos;
|
||||
SGGeod pos_geod;
|
||||
SGQuatd ori;
|
||||
double spin;
|
||||
double gst;
|
||||
double sun_dist;
|
||||
double moon_dist;
|
||||
double sun_angle;
|
||||
} SGSkyState;
|
||||
struct SGSkyState
|
||||
{
|
||||
SGVec3d pos; //!< View position in world Cartesian coordinates.
|
||||
SGGeod pos_geod;
|
||||
SGQuatd ori;
|
||||
double spin; //!< An offset angle for orienting the sky effects with the
|
||||
// sun position so sunset and sunrise effects look correct.
|
||||
double gst; //!< GMT side real time.
|
||||
double sun_dist; //!< the sun's distance from the current view point
|
||||
// (to keep it inside your view volume).
|
||||
double moon_dist;//!< The moon's distance from the current view point.
|
||||
double sun_angle;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SGVec3f sky_color;
|
||||
SGVec3f adj_sky_color;
|
||||
SGVec3f fog_color;
|
||||
SGVec3f cloud_color;
|
||||
double sun_angle, moon_angle;
|
||||
} SGSkyColor;
|
||||
struct SGSkyColor
|
||||
{
|
||||
SGVec3f sky_color;
|
||||
SGVec3f adj_sky_color;
|
||||
SGVec3f fog_color;
|
||||
SGVec3f cloud_color;
|
||||
double sun_angle,
|
||||
moon_angle;
|
||||
};
|
||||
|
||||
/**
|
||||
* \anchor SGSky-details
|
||||
*
|
||||
* A class to model a realistic (time/date/position) based sky.
|
||||
*
|
||||
* Introduction
|
||||
* Introduction
|
||||
*
|
||||
* The SGSky class models a blended sky dome, a haloed sun, a textured
|
||||
* moon with phase that properly matches the date, stars and planets,
|
||||
@ -164,10 +167,10 @@ typedef struct {
|
||||
|
||||
* A typical application might do the following:
|
||||
|
||||
* <li> thesky->preDraw( my_altitude );
|
||||
* <li> thesky->drawUpperClouds();
|
||||
* <li> ssgCullAndDraw ( myscene ) ;
|
||||
* <li> thesky->drawLowerClouds();
|
||||
* \li thesky->preDraw( my_altitude );
|
||||
* \li thesky->drawUpperClouds();
|
||||
* \li ssgCullAndDraw ( myscene ) ;
|
||||
* \li thesky->drawLowerClouds();
|
||||
|
||||
* The current altitude in meters is passed to the preDraw() method
|
||||
* so the clouds layers can be rendered correction from most distant
|
||||
@ -261,84 +264,54 @@ public:
|
||||
|
||||
/**
|
||||
* Initialize the sky and connect the components to the scene
|
||||
* graph at the provided branch. See discussion in detailed class
|
||||
* description.
|
||||
* @param h_radius_m horizontal radius of sky dome
|
||||
* @param v_radius_m vertical radius of sky dome
|
||||
* @param sun_size size of sun
|
||||
* @param moon_size size of moon
|
||||
* @param nplanets number of planets
|
||||
* @param planet_data an array of planet right ascensions, declinations,
|
||||
* and magnitudes
|
||||
* @param nstars number of stars
|
||||
* @param star_data an array of star right ascensions, declinations,
|
||||
* and magnitudes
|
||||
* graph at the provided branch.
|
||||
*
|
||||
* @note See discussion in \ref SGSky-details "detailed class description".
|
||||
*
|
||||
* @param h_radius_m Horizontal radius of sky dome
|
||||
* @param v_radius_m Vertical radius of sky dome
|
||||
* @param sun_size Size of sun
|
||||
* @param moon_size Size of moon
|
||||
* @param eph Current positions of planets and stars
|
||||
* @param node Property node connecting sun with environment
|
||||
* @param options
|
||||
*/
|
||||
void build( double h_radius_m, double v_radius_m,
|
||||
double sun_size, double moon_size,
|
||||
const SGEphemeris& eph, SGPropertyNode *property_tree_node,
|
||||
simgear::SGReaderWriterOptions* options);
|
||||
void build( double h_radius_m,
|
||||
double v_radius_m,
|
||||
double sun_size,
|
||||
double moon_size,
|
||||
const SGEphemeris& eph,
|
||||
SGPropertyNode *node,
|
||||
simgear::SGReaderWriterOptions* options );
|
||||
|
||||
/**
|
||||
* Repaint the sky components based on current value of sun_angle,
|
||||
* sky, and fog colors. You can also specify new star and planet
|
||||
* data so that we can optionally change the magnitude of these
|
||||
* (for day/night transitions.) See discussion in detailed
|
||||
* class description.
|
||||
* Repaint the sky components based on current sun angle, and sky and fog
|
||||
* colors.
|
||||
*
|
||||
* Sun and moon angles are specified in degrees relative to local up
|
||||
* <li> 0 degrees = high noon
|
||||
* <li> 90 degrees = sun rise/set
|
||||
* <li> 180 degrees = darkest midnight
|
||||
* @param sky_color the base sky color (for the top of the dome)
|
||||
* @param fog_color the fog color (for the horizon)
|
||||
* @param sun_angle the sun angle with the horizon (for sunrise/sunset
|
||||
* effects)
|
||||
* @param moon_angle the moon angle (so we can make it more yellow
|
||||
* at the horizon)
|
||||
* @param nplanets number of planets
|
||||
* @param planet_data an array of planet right ascensions, declinations,
|
||||
* and magnitudes
|
||||
* @param nstars number of stars
|
||||
* @param star_data an array of star right ascensions, declinations,
|
||||
* and magnitudes
|
||||
* @note See discussion in \ref SGSky-details "detailed class description".
|
||||
*
|
||||
* @param sky_color The base sky color (for the top of the dome)
|
||||
* @param eph Current positions of planets and stars
|
||||
*/
|
||||
bool repaint( const SGSkyColor &sc, const SGEphemeris& eph );
|
||||
bool repaint( const SGSkyColor &sky_color,
|
||||
const SGEphemeris& eph );
|
||||
|
||||
/**
|
||||
* Reposition the sky at the specified origin and orientation
|
||||
* Reposition the sky at the specified origin and orientation.
|
||||
*
|
||||
* @note See discussion in \ref SGSky-details "detailed class description".
|
||||
*
|
||||
* lon specifies a rotation about the Z axis
|
||||
* lat specifies a rotation about the new Y axis
|
||||
* spin specifies a rotation about the new Z axis (this allows
|
||||
* additional orientation for the sunrise/set effects and is used
|
||||
* by the skydome and perhaps clouds. See discussion in detailed
|
||||
* class description.
|
||||
* @param view_pos specify your view position in world Cartesian
|
||||
* coordinates
|
||||
* @param zero_elev the zero elevation position in world Cartesian
|
||||
* coordinates
|
||||
* @param view_up the up vector in world Cartesian coordinates
|
||||
* @param lon current longitude
|
||||
* @param lat current latitude
|
||||
* @param alt current altitude
|
||||
* @param spin an offset angle for orienting the sky effects with the
|
||||
* sun position so sunset and sunrise effects look correct.
|
||||
* @param gst GMT side real time
|
||||
* @param sun_ra the sun's current right ascension
|
||||
* @param sun_dec the sun's current declination
|
||||
* @param sun_dist the sun's distance from the current view point
|
||||
* (to keep it inside your view volume.)
|
||||
* @param moon_ra the moon's current right ascension
|
||||
* @param moon_dec the moon's current declination
|
||||
* @param moon_dist the moon's distance from the current view point.
|
||||
*/
|
||||
bool reposition( const SGSkyState &st, const SGEphemeris& eph, double dt = 0.0 );
|
||||
bool reposition( const SGSkyState& sky_state,
|
||||
const SGEphemeris& eph,
|
||||
double dt = 0.0 );
|
||||
|
||||
/**
|
||||
* Modify the given visibility based on cloud layers, thickness,
|
||||
* transition range, and simulated "puffs". See discussion in detailed
|
||||
* class description.
|
||||
* transition range, and simulated "puffs".
|
||||
*
|
||||
* @note See discussion in \ref SGSky-details "detailed class description".
|
||||
*
|
||||
* @param alt current altitude
|
||||
* @param time_factor amount of time since modify_vis() last called so
|
||||
* we can scale effect rates properly despite variable frame rates.
|
||||
@ -350,7 +323,8 @@ public:
|
||||
|
||||
/**
|
||||
* Specify the texture path (optional, defaults to current directory)
|
||||
* @param path base path to texture locations
|
||||
*
|
||||
* @param path Base path to texture locations
|
||||
*/
|
||||
void texture_path( const std::string& path );
|
||||
|
||||
@ -424,7 +398,8 @@ public:
|
||||
float get_3dCloudVisRange() const;
|
||||
|
||||
/** Set 3D cloud visibility range
|
||||
* @param density 3D cloud visibility range
|
||||
*
|
||||
* @param vis 3D cloud visibility range
|
||||
*/
|
||||
void set_3dCloudVisRange(float vis);
|
||||
|
||||
@ -432,7 +407,8 @@ public:
|
||||
float get_3dCloudImpostorDistance() const;
|
||||
|
||||
/** Set 3D cloud impostor distance
|
||||
* @param density 3D cloud impostor distance
|
||||
*
|
||||
* @param vis 3D cloud impostor distance
|
||||
*/
|
||||
void set_3dCloudImpostorDistance(float vis);
|
||||
|
||||
@ -456,7 +432,8 @@ public:
|
||||
bool get_3dCloudUseImpostors() const;
|
||||
|
||||
/** Set 3D cloud impostor usage
|
||||
* @param wrap whether use impostors for 3D clouds
|
||||
*
|
||||
* @param imp whether use impostors for 3D clouds
|
||||
*/
|
||||
void set_3dCloudUseImpostors(bool imp);
|
||||
|
||||
|
@ -111,7 +111,6 @@ public:
|
||||
void calcApronPts(double tex_width);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void OceanMesh::calcMesh(const SGVec3d& cartCenter, const SGQuatd& orient,
|
||||
double clon, double clat,
|
||||
@ -238,8 +237,6 @@ void OceanMesh::calcApronPts(double tex_width)
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// Enter the vertices of triangles that fill one row of the
|
||||
// mesh. The vertices are entered in counter-clockwise order.
|
||||
void fillDrawElementsRow(int width, short row0Start, short row1Start,
|
||||
|
@ -28,14 +28,18 @@ namespace simgear
|
||||
{
|
||||
using namespace osg;
|
||||
|
||||
NodeAndDrawableVisitor::NodeAndDrawableVisitor(NodeVisitor::TraversalMode tm) :
|
||||
NodeVisitor(tm)
|
||||
NodeAndDrawableVisitor::NodeAndDrawableVisitor(
|
||||
osg::NodeVisitor::TraversalMode tm
|
||||
):
|
||||
NodeVisitor(tm)
|
||||
{
|
||||
}
|
||||
|
||||
NodeAndDrawableVisitor::NodeAndDrawableVisitor(NodeVisitor::VisitorType type,
|
||||
NodeVisitor::TraversalMode tm) :
|
||||
NodeVisitor(type, tm)
|
||||
NodeAndDrawableVisitor::NodeAndDrawableVisitor(
|
||||
osg::NodeVisitor::VisitorType type,
|
||||
osg::NodeVisitor::TraversalMode tm
|
||||
):
|
||||
NodeVisitor(type, tm)
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,16 +47,16 @@ NodeAndDrawableVisitor::~NodeAndDrawableVisitor()
|
||||
{
|
||||
}
|
||||
|
||||
void NodeAndDrawableVisitor::apply(Node& node)
|
||||
void NodeAndDrawableVisitor::apply(osg::Node& node)
|
||||
{
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
void NodeAndDrawableVisitor::apply(Drawable& Drawable)
|
||||
void NodeAndDrawableVisitor::apply(osg::Drawable& Drawable)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeAndDrawableVisitor::traverse(Node& node)
|
||||
void NodeAndDrawableVisitor::traverse(osg::Node& node)
|
||||
{
|
||||
TraversalMode tm = getTraversalMode();
|
||||
if (tm == TRAVERSE_NONE) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
///@file Helper for OSG related debugging
|
||||
///@file
|
||||
/// Helper for OSG related debugging
|
||||
//
|
||||
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
|
||||
//
|
||||
|
@ -16,7 +16,7 @@ void SplicingVisitor::reset()
|
||||
NodeVisitor::reset();
|
||||
}
|
||||
|
||||
NodeList SplicingVisitor::traverse(Node& node)
|
||||
NodeList SplicingVisitor::traverse(osg::Node& node)
|
||||
{
|
||||
NodeList result;
|
||||
_childStack.push_back(NodeList());
|
||||
@ -25,21 +25,22 @@ NodeList SplicingVisitor::traverse(Node& node)
|
||||
_childStack.pop_back();
|
||||
return result;
|
||||
}
|
||||
void SplicingVisitor::apply(Node& node)
|
||||
void SplicingVisitor::apply(osg::Node& node)
|
||||
{
|
||||
NodeVisitor::traverse(node);
|
||||
pushNode(&node);
|
||||
}
|
||||
|
||||
void SplicingVisitor::apply(Group& node)
|
||||
void SplicingVisitor::apply(osg::Group& node)
|
||||
{
|
||||
if (pushNode(getNewNode(node)))
|
||||
return;
|
||||
pushResultNode(&node, &node, traverse(node));
|
||||
}
|
||||
|
||||
Group* SplicingVisitor::pushResultNode(Group* node, Group* newNode,
|
||||
const NodeList& children)
|
||||
osg::Group* SplicingVisitor::pushResultNode( osg::Group* node,
|
||||
osg::Group* newNode,
|
||||
const osg::NodeList& children )
|
||||
{
|
||||
ref_ptr<Group> result;
|
||||
if (node == newNode) {
|
||||
@ -56,21 +57,21 @@ Group* SplicingVisitor::pushResultNode(Group* node, Group* newNode,
|
||||
return result.get();
|
||||
}
|
||||
|
||||
Node* SplicingVisitor::pushResultNode(Node* node, Node* newNode)
|
||||
osg::Node* SplicingVisitor::pushResultNode(osg::Node* node, osg::Node* newNode)
|
||||
{
|
||||
_childStack.back().push_back(newNode);
|
||||
recordNewNode(node, newNode);
|
||||
return newNode;
|
||||
}
|
||||
|
||||
Node* SplicingVisitor::pushNode(Node* node)
|
||||
osg::Node* SplicingVisitor::pushNode(osg::Node* node)
|
||||
{
|
||||
if (node)
|
||||
_childStack.back().push_back(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
Node* SplicingVisitor::getResult()
|
||||
osg::Node* SplicingVisitor::getResult()
|
||||
{
|
||||
NodeList& top = _childStack.at(0);
|
||||
if (top.empty()) {
|
||||
@ -87,7 +88,7 @@ Node* SplicingVisitor::getResult()
|
||||
}
|
||||
}
|
||||
|
||||
Node* SplicingVisitor::getNewNode(osg::Node* node)
|
||||
osg::Node* SplicingVisitor::getNewNode(osg::Node* node)
|
||||
{
|
||||
ref_ptr<Node> tmpPtr(node);
|
||||
NodeMap::iterator itr;
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "soundmgr_openal_private.hxx"
|
||||
#include "sample_group.hxx"
|
||||
|
||||
using std::string;
|
||||
|
||||
#ifdef HAVE_STD_ISNAN
|
||||
using std::isnan;
|
||||
#endif
|
||||
@ -57,7 +55,8 @@ SGSampleGroup::SGSampleGroup () :
|
||||
_samples.clear();
|
||||
}
|
||||
|
||||
SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr, const string &refname ) :
|
||||
SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr,
|
||||
const std::string &refname ):
|
||||
_smgr(smgr),
|
||||
_refname(refname),
|
||||
_active(false),
|
||||
@ -227,8 +226,9 @@ void SGSampleGroup::update( double dt ) {
|
||||
}
|
||||
|
||||
// add a sound effect, return true if successful
|
||||
bool SGSampleGroup::add( SGSharedPtr<SGSoundSample> sound, const string& refname ) {
|
||||
|
||||
bool SGSampleGroup::add( SGSharedPtr<SGSoundSample> sound,
|
||||
const std::string& refname )
|
||||
{
|
||||
sample_map_iterator sample_it = _samples.find( refname );
|
||||
if ( sample_it != _samples.end() ) {
|
||||
// sample name already exists
|
||||
@ -241,7 +241,7 @@ bool SGSampleGroup::add( SGSharedPtr<SGSoundSample> sound, const string& refname
|
||||
|
||||
|
||||
// remove a sound effect, return true if successful
|
||||
bool SGSampleGroup::remove( const string &refname ) {
|
||||
bool SGSampleGroup::remove( const std::string &refname ) {
|
||||
|
||||
sample_map_iterator sample_it = _samples.find( refname );
|
||||
if ( sample_it == _samples.end() ) {
|
||||
@ -259,7 +259,7 @@ bool SGSampleGroup::remove( const string &refname ) {
|
||||
|
||||
|
||||
// return true of the specified sound exists in the sound manager system
|
||||
bool SGSampleGroup::exists( const string &refname ) {
|
||||
bool SGSampleGroup::exists( const std::string &refname ) {
|
||||
sample_map_iterator sample_it = _samples.find( refname );
|
||||
if ( sample_it == _samples.end() ) {
|
||||
// sample was not found
|
||||
@ -272,7 +272,7 @@ bool SGSampleGroup::exists( const string &refname ) {
|
||||
|
||||
// return a pointer to the SGSoundSample if the specified sound exists
|
||||
// in the sound manager system, otherwise return NULL
|
||||
SGSoundSample *SGSampleGroup::find( const string &refname ) {
|
||||
SGSoundSample *SGSampleGroup::find( const std::string &refname ) {
|
||||
sample_map_iterator sample_it = _samples.find( refname );
|
||||
if ( sample_it == _samples.end() ) {
|
||||
// sample was not found
|
||||
@ -353,7 +353,9 @@ SGSampleGroup::resume ()
|
||||
|
||||
|
||||
// tell the scheduler to play the indexed sample in a continuous loop
|
||||
bool SGSampleGroup::play( const string &refname, bool looping = false ) {
|
||||
bool SGSampleGroup::play( const std::string &refname,
|
||||
bool looping )
|
||||
{
|
||||
SGSoundSample *sample = find( refname );
|
||||
|
||||
if ( sample == NULL ) {
|
||||
@ -366,7 +368,7 @@ bool SGSampleGroup::play( const string &refname, bool looping = false ) {
|
||||
|
||||
|
||||
// return true of the specified sound is currently being played
|
||||
bool SGSampleGroup::is_playing( const string& refname ) {
|
||||
bool SGSampleGroup::is_playing( const std::string& refname ) {
|
||||
SGSoundSample *sample = find( refname );
|
||||
|
||||
if ( sample == NULL ) {
|
||||
@ -377,7 +379,7 @@ bool SGSampleGroup::is_playing( const string& refname ) {
|
||||
}
|
||||
|
||||
// immediate stop playing the sound
|
||||
bool SGSampleGroup::stop( const string& refname ) {
|
||||
bool SGSampleGroup::stop( const std::string& refname ) {
|
||||
SGSoundSample *sample = find( refname );
|
||||
|
||||
if ( sample == NULL ) {
|
||||
@ -488,7 +490,7 @@ void SGSampleGroup::update_sample_config( SGSoundSample *sample )
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SGSampleGroup::testForError(void *p, string s)
|
||||
bool SGSampleGroup::testForError(void *p, std::string s)
|
||||
{
|
||||
if (p == NULL) {
|
||||
SG_LOG( SG_SOUND, SG_ALERT, "Error (sample group): " << s);
|
||||
@ -497,7 +499,7 @@ bool SGSampleGroup::testForError(void *p, string s)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SGSampleGroup::testForALError(string s)
|
||||
bool SGSampleGroup::testForALError(std::string s)
|
||||
{
|
||||
#ifdef SG_C
|
||||
ALenum error = alGetError();
|
||||
|
@ -1,30 +1,26 @@
|
||||
// sample_group.hxx -- Manage a group of samples relative to a base position
|
||||
///@file
|
||||
/// Manage a group of samples relative to a base position
|
||||
///
|
||||
/// Sample groups contain all sounds related to one specific object and
|
||||
/// have to be added to the sound manager, otherwise they won't get processed.
|
||||
//
|
||||
// Written for the new SoundSystem by Erik Hofman, October 2009
|
||||
//
|
||||
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* \file sample_group.hxx
|
||||
* sample groups contain all sounds related to one specific object and
|
||||
* have to be added to the sound manager, otherwise they won't get processed.
|
||||
*/
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_SAMPLE_GROUP_OPENAL_HXX
|
||||
#define _SG_SAMPLE_GROUP_OPENAL_HXX 1
|
||||
@ -137,7 +133,7 @@ public:
|
||||
* @param looping Define if the sound should loop continuously
|
||||
* @return true if the audio sample exsists and is scheduled for playing
|
||||
*/
|
||||
bool play( const std::string& refname, bool looping );
|
||||
bool play( const std::string& refname, bool looping = false );
|
||||
|
||||
/**
|
||||
* Request to start playing the referred audio sample looping.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// sample_openal.hxx -- Audio sample encapsulation class
|
||||
///@file
|
||||
/// Provides an audio sample encapsulation class.
|
||||
//
|
||||
// Written by Curtis Olson, started April 2004.
|
||||
// Modified to match the new SoundSystem by Erik Hofman, October 2009
|
||||
@ -6,26 +7,19 @@
|
||||
// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* \file audio sample.hxx
|
||||
* Provides a audio sample encapsulation
|
||||
*/
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_SAMPLE_HXX
|
||||
#define _SG_SAMPLE_HXX 1
|
||||
@ -45,7 +39,9 @@ class SGPath;
|
||||
|
||||
|
||||
/**
|
||||
* manages everything we need to know for an individual audio sample
|
||||
* Encapsulate and audio sample.
|
||||
*
|
||||
* Manages everything we need to know for an individual audio sample.
|
||||
*/
|
||||
|
||||
class SGSoundSample : public SGReferenced {
|
||||
@ -95,6 +91,7 @@ public:
|
||||
* Test if this audio sample configuration has changed since the last call.
|
||||
* Calling this function will reset the flag so calling it a second
|
||||
* time in a row will return false.
|
||||
*
|
||||
* @return Return true is the configuration has changed in the mean time.
|
||||
*/
|
||||
bool has_changed() {
|
||||
@ -105,6 +102,7 @@ public:
|
||||
* Test if static data of audio sample configuration has changed.
|
||||
* Calling this function will reset the flag so calling it a second
|
||||
* time in a row will return false.
|
||||
*
|
||||
* @return Return true is the static data has changed in the mean time.
|
||||
*/
|
||||
bool has_static_data_changed() {
|
||||
@ -114,7 +112,8 @@ public:
|
||||
/**
|
||||
* Schedule this audio sample for playing. Actual playing will only start
|
||||
* at the next call op SoundGroup::update()
|
||||
* @param _loop Define whether this sound should be played in a loop.
|
||||
*
|
||||
* @param loop Whether this sound should be played in a loop.
|
||||
*/
|
||||
void play( bool loop = false ) {
|
||||
_playing = true; _loop = loop; _changed = true; _static_changed = true;
|
||||
@ -122,6 +121,7 @@ public:
|
||||
|
||||
/**
|
||||
* Check if this audio sample is set to be continuous looping.
|
||||
*
|
||||
* @return Return true if this audio sample is set to looping.
|
||||
*/
|
||||
inline bool is_looping() { return _loop; }
|
||||
@ -405,7 +405,8 @@ public:
|
||||
/**
|
||||
* Set the velocity vector (in meters per second) of this sound.
|
||||
* This is in the local frame coordinate system; x=north, y=east, z=down
|
||||
* @param Velocity vector
|
||||
*
|
||||
* @param vel Velocity vector
|
||||
*/
|
||||
inline void set_velocity( const SGVec3f& vel ) {
|
||||
_velocity = vel; _changed = true;
|
||||
|
@ -1,37 +1,27 @@
|
||||
// queue.hxx -- Sample Queue encapsulation class
|
||||
//
|
||||
///@file
|
||||
/// Provides a sample queue encapsulation
|
||||
//
|
||||
// based on sample.hxx
|
||||
//
|
||||
// Copyright (C) 2010 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* \file audio sample.hxx
|
||||
* Provides a sample queue encapsulation
|
||||
*/
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_QUEUE_HXX
|
||||
#define _SG_QUEUE_HXX 1
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -68,20 +58,23 @@ public:
|
||||
virtual void stop();
|
||||
|
||||
/**
|
||||
* Queue new data for this audio sample
|
||||
* @param data Pointer to a memory block containg this audio sample data.
|
||||
* @param len length of the sample buffer in bytes
|
||||
* Queue new data for this audio sample.
|
||||
*
|
||||
* @param data Pointer to a memory block containg this audio sample data.
|
||||
* @param len Length of the sample buffer in bytes.
|
||||
*/
|
||||
void add( const void* smp_data, size_t len );
|
||||
void add( const void* data, size_t len );
|
||||
|
||||
/**
|
||||
* Set the source id of this source
|
||||
* Set the source id of this source.
|
||||
*
|
||||
* @param sid OpenAL source-id
|
||||
*/
|
||||
virtual void set_source(unsigned int sid);
|
||||
|
||||
/**
|
||||
* Test if the buffer-id of this audio sample may be passed to OpenAL.
|
||||
*
|
||||
* @return false for sample queue
|
||||
*/
|
||||
inline bool is_valid_buffer() const { return false; }
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
|
||||
@ -408,7 +407,7 @@ if (isNaN(_velocity.data())) printf("NaN in listener velocity\n");
|
||||
}
|
||||
|
||||
// add a sample group, return true if successful
|
||||
bool SGSoundMgr::add( SGSampleGroup *sgrp, const string& refname )
|
||||
bool SGSoundMgr::add( SGSampleGroup *sgrp, const std::string& refname )
|
||||
{
|
||||
sample_group_map_iterator sample_grp_it = d->_sample_groups.find( refname );
|
||||
if ( sample_grp_it != d->_sample_groups.end() ) {
|
||||
@ -424,7 +423,7 @@ bool SGSoundMgr::add( SGSampleGroup *sgrp, const string& refname )
|
||||
|
||||
|
||||
// remove a sound effect, return true if successful
|
||||
bool SGSoundMgr::remove( const string &refname )
|
||||
bool SGSoundMgr::remove( const std::string &refname )
|
||||
{
|
||||
sample_group_map_iterator sample_grp_it = d->_sample_groups.find( refname );
|
||||
if ( sample_grp_it == d->_sample_groups.end() ) {
|
||||
@ -439,7 +438,7 @@ bool SGSoundMgr::remove( const string &refname )
|
||||
|
||||
|
||||
// return true of the specified sound exists in the sound manager system
|
||||
bool SGSoundMgr::exists( const string &refname ) {
|
||||
bool SGSoundMgr::exists( const std::string &refname ) {
|
||||
sample_group_map_iterator sample_grp_it = d->_sample_groups.find( refname );
|
||||
return ( sample_grp_it != d->_sample_groups.end() );
|
||||
}
|
||||
@ -447,7 +446,7 @@ bool SGSoundMgr::exists( const string &refname ) {
|
||||
|
||||
// return a pointer to the SGSampleGroup if the specified sound exists
|
||||
// in the sound manager system, otherwise return NULL
|
||||
SGSampleGroup *SGSoundMgr::find( const string &refname, bool create ) {
|
||||
SGSampleGroup *SGSoundMgr::find( const std::string &refname, bool create ) {
|
||||
sample_group_map_iterator sample_grp_it = d->_sample_groups.find( refname );
|
||||
if ( sample_grp_it == d->_sample_groups.end() ) {
|
||||
// sample group was not found.
|
||||
@ -524,7 +523,7 @@ unsigned int SGSoundMgr::request_buffer(SGSoundSample *sample)
|
||||
#ifdef ENABLE_SOUND
|
||||
if ( !sample->is_valid_buffer() ) {
|
||||
// sample was not yet loaded or removed again
|
||||
string sample_name = sample->get_sample_name();
|
||||
std::string sample_name = sample->get_sample_name();
|
||||
void *sample_data = NULL;
|
||||
|
||||
// see if the sample name is already cached
|
||||
@ -588,7 +587,7 @@ void SGSoundMgr::release_buffer(SGSoundSample *sample)
|
||||
{
|
||||
if ( !sample->is_queue() )
|
||||
{
|
||||
string sample_name = sample->get_sample_name();
|
||||
std::string sample_name = sample->get_sample_name();
|
||||
buffer_map_iterator buffer_it = d->_buffers.find( sample_name );
|
||||
if ( buffer_it == d->_buffers.end() ) {
|
||||
// buffer was not found
|
||||
@ -608,8 +607,11 @@ void SGSoundMgr::release_buffer(SGSoundSample *sample)
|
||||
}
|
||||
}
|
||||
|
||||
bool SGSoundMgr::load(const string &samplepath, void **dbuf, int *fmt,
|
||||
size_t *sz, int *frq )
|
||||
bool SGSoundMgr::load( const std::string &samplepath,
|
||||
void **dbuf,
|
||||
int *fmt,
|
||||
size_t *sz,
|
||||
int *frq )
|
||||
{
|
||||
if ( !is_working() )
|
||||
return false;
|
||||
@ -668,7 +670,7 @@ vector<const char*> SGSoundMgr::get_available_devices()
|
||||
}
|
||||
|
||||
|
||||
bool SGSoundMgr::testForError(void *p, string s)
|
||||
bool SGSoundMgr::testForError(void *p, std::string s)
|
||||
{
|
||||
if (p == NULL) {
|
||||
SG_LOG( SG_SOUND, SG_ALERT, "Error: " << s);
|
||||
@ -678,7 +680,7 @@ bool SGSoundMgr::testForError(void *p, string s)
|
||||
}
|
||||
|
||||
|
||||
bool SGSoundMgr::testForALError(string s)
|
||||
bool SGSoundMgr::testForALError(std::string s)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
ALenum error = alGetError();
|
||||
@ -691,7 +693,7 @@ bool SGSoundMgr::testForALError(string s)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SGSoundMgr::testForALCError(string s)
|
||||
bool SGSoundMgr::testForALCError(std::string s)
|
||||
{
|
||||
#ifdef ENABLE_SOUND
|
||||
ALCenum error;
|
||||
|
@ -1,4 +1,8 @@
|
||||
// soundmgr.hxx -- Sound effect management class
|
||||
///@file
|
||||
/// Sound effect management class
|
||||
///
|
||||
/// Provides a sound manager class to keep track of multiple sounds and manage
|
||||
/// playing them with different effects and timings.
|
||||
//
|
||||
// Sound manager initially written by David Findlay
|
||||
// <david_j_findlay@yahoo.com.au> 2001
|
||||
@ -9,28 +13,19 @@
|
||||
// Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* \file soundmgr.hxx
|
||||
* Provides a sound manager class to keep track of
|
||||
* multiple sounds and manage playing them with different effects and
|
||||
* timings.
|
||||
*/
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_SOUNDMGR_OPENAL_HXX
|
||||
#define _SG_SOUNDMGR_OPENAL_HXX 1
|
||||
@ -114,13 +109,16 @@ public:
|
||||
|
||||
/**
|
||||
* Find a specified sample group in the sound manager
|
||||
*
|
||||
* @param refname Reference name of the sample group to find
|
||||
* @param create If the group should be create if it does not exist
|
||||
* @return A pointer to the SGSampleGroup
|
||||
*/
|
||||
SGSampleGroup *find( const std::string& refname, bool create = false );
|
||||
|
||||
/**
|
||||
* Set the Cartesian position of the sound manager.
|
||||
*
|
||||
* @param pos OpenAL listener position
|
||||
*/
|
||||
void set_position( const SGVec3d& pos, const SGGeod& pos_geod );
|
||||
@ -132,6 +130,7 @@ public:
|
||||
/**
|
||||
* Get the position of the sound manager.
|
||||
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
|
||||
*
|
||||
* @return OpenAL listener position
|
||||
*/
|
||||
const SGVec3d& get_position() const;
|
||||
@ -139,7 +138,8 @@ public:
|
||||
/**
|
||||
* Set the velocity vector (in meters per second) of the sound manager
|
||||
* This is the horizontal local frame; x=north, y=east, z=down
|
||||
* @param Velocity vector
|
||||
*
|
||||
* @param vel Velocity vector
|
||||
*/
|
||||
void set_velocity( const SGVec3d& vel ) {
|
||||
_velocity = vel; _changed = true;
|
||||
@ -148,18 +148,21 @@ public:
|
||||
/**
|
||||
* Get the velocity vector of the sound manager
|
||||
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
|
||||
*
|
||||
* @return Velocity vector of the OpenAL listener
|
||||
*/
|
||||
inline SGVec3f get_velocity() { return toVec3f(_velocity); }
|
||||
|
||||
/**
|
||||
* Set the orientation of the sound manager
|
||||
*
|
||||
* @param ori Quaternation containing the orientation information
|
||||
*/
|
||||
void set_orientation( const SGQuatd& ori );
|
||||
|
||||
/**
|
||||
* Get the orientation of the sound manager
|
||||
*
|
||||
* @return Quaternation containing the orientation information
|
||||
*/
|
||||
const SGQuatd& get_orientation() const;
|
||||
@ -167,6 +170,7 @@ public:
|
||||
/**
|
||||
* Get the direction vector of the sound manager
|
||||
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
|
||||
*
|
||||
* @return Look-at direction of the OpenAL listener
|
||||
*/
|
||||
SGVec3f get_direction() const;
|
||||
@ -179,24 +183,28 @@ public:
|
||||
|
||||
/**
|
||||
* Set the master volume.
|
||||
*
|
||||
* @param vol Volume (must be between 0.0 and 1.0)
|
||||
*/
|
||||
void set_volume( float vol );
|
||||
|
||||
/**
|
||||
* Get the master volume.
|
||||
*
|
||||
* @return Volume (must be between 0.0 and 1.0)
|
||||
*/
|
||||
inline float get_volume() { return _volume; }
|
||||
|
||||
/**
|
||||
* Get a free OpenAL source-id
|
||||
*
|
||||
* @return NO_SOURCE if no source is available
|
||||
*/
|
||||
unsigned int request_source();
|
||||
|
||||
/**
|
||||
* Free an OpenAL source-id for future use
|
||||
*
|
||||
* @param source OpenAL source-id to free
|
||||
*/
|
||||
void release_source( unsigned int source );
|
||||
@ -204,6 +212,7 @@ public:
|
||||
/**
|
||||
* Get a free OpenAL buffer-id
|
||||
* The buffer-id will be assigned to the sample by calling this function.
|
||||
*
|
||||
* @param sample Pointer to an audio sample to assign the buffer-id to
|
||||
* @return NO_BUFFER if loading of the buffer failed.
|
||||
*/
|
||||
@ -211,6 +220,7 @@ public:
|
||||
|
||||
/**
|
||||
* Free an OpenAL buffer-id for this sample
|
||||
*
|
||||
* @param sample Pointer to an audio sample for which to free the buffer
|
||||
*/
|
||||
void release_buffer( SGSoundSample *sample );
|
||||
@ -218,6 +228,7 @@ public:
|
||||
/**
|
||||
* Test if the position of the sound manager has changed.
|
||||
* The value will be set to false upon the next call to update_late()
|
||||
*
|
||||
* @return true if the position has changed
|
||||
*/
|
||||
inline bool has_changed() { return _changed; }
|
||||
@ -232,6 +243,7 @@ public:
|
||||
|
||||
/**
|
||||
* Load a sample file and return it's configuration and data.
|
||||
*
|
||||
* @param samplepath Path to the file to load
|
||||
* @param data Pointer to a variable that points to the allocated data
|
||||
* @param format Pointer to a vairable that gets the OpenAL format
|
||||
@ -239,8 +251,11 @@ public:
|
||||
* @param freq Pointer to a vairable that gets the sample frequency in Herz
|
||||
* @return true if succesful, false on error
|
||||
*/
|
||||
bool load(const std::string &samplepath, void **data, int *format,
|
||||
size_t *size, int *freq );
|
||||
bool load( const std::string &samplepath,
|
||||
void **data,
|
||||
int *format,
|
||||
size_t *size,
|
||||
int *freq );
|
||||
|
||||
/**
|
||||
* Get a list of available playback devices.
|
||||
|
@ -88,9 +88,11 @@ SGXmlSound::~SGXmlSound()
|
||||
}
|
||||
|
||||
void
|
||||
SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
|
||||
SGSampleGroup *sgrp, SGSampleGroup *avionics,
|
||||
const SGPath& currentDir)
|
||||
SGXmlSound::init( SGPropertyNode *root,
|
||||
SGPropertyNode *node,
|
||||
SGSampleGroup *sgrp,
|
||||
SGSampleGroup *avionics,
|
||||
const SGPath& path )
|
||||
{
|
||||
|
||||
//
|
||||
@ -279,7 +281,7 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node,
|
||||
_sgrp = sgrp;
|
||||
}
|
||||
string soundFileStr = node->getStringValue("path", "");
|
||||
_sample = new SGSoundSample(soundFileStr.c_str(), currentDir);
|
||||
_sample = new SGSoundSample(soundFileStr.c_str(), path);
|
||||
if (!_sample->file_path().exists()) {
|
||||
throw sg_io_exception("XML sound: couldn't find file: '" + soundFileStr + "'");
|
||||
}
|
||||
|
@ -1,30 +1,26 @@
|
||||
// sound.hxx -- Sound class implementation
|
||||
///@file
|
||||
/// Sound class implementation
|
||||
///
|
||||
/// Provides a class to manage a single sound event including things like
|
||||
/// looping, volume and pitch changes.
|
||||
//
|
||||
// Started by Erik Hofman, February 2002
|
||||
//
|
||||
// Copyright (C) 2002 Erik Hofman - erik@ehofman.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// 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
|
||||
// General Public License for more details.
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* \file sound.hxx
|
||||
* Provides a class to manage a single sound event including things
|
||||
* like looping, volume and pitch changes.
|
||||
*/
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef _SG_SOUND_HXX
|
||||
#define _SG_SOUND_HXX 1
|
||||
@ -71,6 +67,7 @@ public:
|
||||
* and a sound manager class has to be defined.
|
||||
*
|
||||
* A sound configuration file would look like this:
|
||||
* @code{xml}
|
||||
* <fx>
|
||||
* <event_name>
|
||||
* <name/> Define the name of the event. For reference only.
|
||||
@ -98,16 +95,20 @@ public:
|
||||
* <event_name>
|
||||
* </event_name>
|
||||
* </fx>
|
||||
* @endcode
|
||||
*
|
||||
* @param root The root node of the programs property tree.
|
||||
* @param child A pointer to the location of the current event as defined
|
||||
* in the configuration file.
|
||||
* @param sgrp A pointer to a pre-initialized sample group class.
|
||||
* @param avionics A pointer to the pre-initialized avionics sample group.
|
||||
* @param path The path where the audio files remain.
|
||||
* @param root The root node of the programs property tree.
|
||||
* @param child A pointer to the location of the current event as
|
||||
* defined in the configuration file.
|
||||
* @param sgrp A pointer to a pre-initialized sample group class.
|
||||
* @param avionics A pointer to the pre-initialized avionics sample group.
|
||||
* @param path The path where the audio files remain.
|
||||
*/
|
||||
virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *,
|
||||
SGSampleGroup *, const SGPath& currentDir);
|
||||
virtual void init( SGPropertyNode *root,
|
||||
SGPropertyNode *child,
|
||||
SGSampleGroup *sgrp,
|
||||
SGSampleGroup *avionics,
|
||||
const SGPath& path );
|
||||
|
||||
/**
|
||||
* Check whether an event has happened and if action has to be taken.
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
/**
|
||||
* Convenience constructor.
|
||||
*
|
||||
* @param node The binding will be built from this node.
|
||||
* @param commandName TODO
|
||||
*/
|
||||
SGBinding(const std::string& commandName);
|
||||
|
||||
@ -49,8 +49,10 @@ public:
|
||||
* Convenience constructor.
|
||||
*
|
||||
* @param node The binding will be built from this node.
|
||||
* @param root Property root used while building binding.
|
||||
*/
|
||||
SGBinding (const SGPropertyNode * node, SGPropertyNode* root);
|
||||
SGBinding( const SGPropertyNode *node,
|
||||
SGPropertyNode *root );
|
||||
|
||||
|
||||
/**
|
||||
@ -97,6 +99,8 @@ public:
|
||||
* Read a binding from a property node.
|
||||
*
|
||||
* @param node The property node containing the binding.
|
||||
* @param root The property root node used while building the binding from
|
||||
* \a node.
|
||||
*/
|
||||
void read (const SGPropertyNode * node, SGPropertyNode* root);
|
||||
|
||||
|
@ -1,22 +1,21 @@
|
||||
/* -*-c++-*-
|
||||
*
|
||||
* Copyright (C) 2005-2012 Mathias Froehlich
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
///@file
|
||||
/// Pointer proxy doing reference counting.
|
||||
//
|
||||
// Copyright (C) 2005-2012 Mathias Froehlich
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef SGSharedPtr_HXX
|
||||
#define SGSharedPtr_HXX
|
||||
@ -31,7 +30,7 @@ class SGWeakPtr;
|
||||
/// it is pointing to.
|
||||
/// The SGSharedPtr class handles reference counting and possible
|
||||
/// destruction if no nore references are in use automatically.
|
||||
/// Classes derived from @SGReferenced can be handled with SGSharedPtr.
|
||||
/// Classes derived from SGReferenced can be handled with SGSharedPtr.
|
||||
/// Once you have a SGSharedPtr available you can use it just like
|
||||
/// a usual pointer with the exception that you don't need to delete it.
|
||||
/// Such a reference is initialized by zero if not initialized with a
|
||||
|
@ -101,11 +101,11 @@ public:
|
||||
/**
|
||||
* Register a new command with the manager.
|
||||
*
|
||||
* @param name The command name. Any existing command with
|
||||
* the same name will silently be overwritten.
|
||||
* @param command A pointer to a one-arg function returning
|
||||
* a bool result. The argument is always a const pointer to
|
||||
* an SGPropertyNode (which may contain multiple values).
|
||||
* @param name The command name. Any existing command with the same name
|
||||
* will silently be overwritten.
|
||||
* @param f A pointer to a one-arg function returning a bool result. The
|
||||
* argument is always a const pointer to an SGPropertyNode
|
||||
* (which may contain multiple values).
|
||||
*/
|
||||
void addCommand(const std::string& name, command_t f)
|
||||
{ addCommandObject(name, new FunctionCommand(f)); }
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
using std::string;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_location class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -148,10 +146,10 @@ sg_throwable::getMessage () const
|
||||
return _message;
|
||||
}
|
||||
|
||||
const string
|
||||
const std::string
|
||||
sg_throwable::getFormattedMessage () const
|
||||
{
|
||||
return string(getMessage());
|
||||
return std::string(getMessage());
|
||||
}
|
||||
|
||||
void
|
||||
@ -204,7 +202,7 @@ sg_error::sg_error (const char* message, const char *origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_error::sg_error (const string& message, const string& origin)
|
||||
sg_error::sg_error(const std::string& message, const std::string& origin)
|
||||
: sg_throwable(message.c_str(), origin.c_str())
|
||||
{
|
||||
}
|
||||
@ -212,7 +210,7 @@ sg_error::sg_error (const string& message, const string& origin)
|
||||
sg_error::~sg_error () throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_exception class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -227,7 +225,8 @@ sg_exception::sg_exception (const char* message, const char* origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_exception::sg_exception (const string& message, const string& origin)
|
||||
sg_exception::sg_exception( const std::string& message,
|
||||
const std::string& origin )
|
||||
: sg_throwable(message.c_str(), origin.c_str())
|
||||
{
|
||||
}
|
||||
@ -235,7 +234,7 @@ sg_exception::sg_exception (const string& message, const string& origin)
|
||||
sg_exception::~sg_exception () throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_io_exception.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -258,34 +257,36 @@ sg_io_exception::sg_io_exception (const char* message,
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::sg_io_exception (const string& message, const string& origin)
|
||||
sg_io_exception::sg_io_exception( const std::string& message,
|
||||
const std::string& origin )
|
||||
: sg_exception(message, origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::sg_io_exception (const string& message,
|
||||
const sg_location &location,
|
||||
const string& origin)
|
||||
sg_io_exception::sg_io_exception( const std::string& message,
|
||||
const sg_location &location,
|
||||
const std::string& origin )
|
||||
: sg_exception(message, origin),
|
||||
_location(location)
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::sg_io_exception (const string &message, const SGPath& origin)
|
||||
sg_io_exception::sg_io_exception( const std::string &message,
|
||||
const SGPath& origin )
|
||||
: sg_exception(message, origin.str())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
sg_io_exception::~sg_io_exception () throw ()
|
||||
{
|
||||
}
|
||||
|
||||
const string
|
||||
const std::string
|
||||
sg_io_exception::getFormattedMessage () const
|
||||
{
|
||||
string ret = getMessage();
|
||||
string loc = getLocation().asString();
|
||||
std::string ret = getMessage();
|
||||
std::string loc = getLocation().asString();
|
||||
if (loc.length()) {
|
||||
ret += "\n at ";
|
||||
ret += loc;
|
||||
@ -325,9 +326,9 @@ sg_format_exception::sg_format_exception (const char* message,
|
||||
setText(text);
|
||||
}
|
||||
|
||||
sg_format_exception::sg_format_exception (const string& message,
|
||||
const string& text,
|
||||
const string& origin)
|
||||
sg_format_exception::sg_format_exception( const std::string& message,
|
||||
const std::string& text,
|
||||
const std::string& origin )
|
||||
: sg_exception(message, origin)
|
||||
{
|
||||
setText(text.c_str());
|
||||
@ -371,8 +372,8 @@ sg_range_exception::sg_range_exception (const char* message,
|
||||
{
|
||||
}
|
||||
|
||||
sg_range_exception::sg_range_exception(const string& message,
|
||||
const string& origin)
|
||||
sg_range_exception::sg_range_exception(const std::string& message,
|
||||
const std::string& origin)
|
||||
: sg_exception(message, origin)
|
||||
{
|
||||
}
|
||||
|
@ -13,21 +13,18 @@ public:
|
||||
|
||||
/**
|
||||
* Create an SGGuard object and lock the passed lockable object.
|
||||
* @param SGLOCK A lockable object.
|
||||
* @param l A lockable object.
|
||||
*/
|
||||
inline SGGuard( SGLOCK& l ) : lock(l) { lock.lock(); }
|
||||
|
||||
/**
|
||||
* Destroy this object and unlock the locakable object.
|
||||
* Destroy this object and unlock the lockable object.
|
||||
*/
|
||||
inline ~SGGuard() { lock.unlock(); }
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* A lockable object.
|
||||
*/
|
||||
SGLOCK& lock;
|
||||
SGLOCK& lock; //!< A lockable object
|
||||
|
||||
private:
|
||||
// Disable copying.
|
||||
|
@ -38,21 +38,21 @@ public:
|
||||
/**
|
||||
* Add an item to the end of the queue.
|
||||
*
|
||||
* @param T object to add.
|
||||
* @param item object to add.
|
||||
*/
|
||||
virtual void push( const T& item ) = 0;
|
||||
|
||||
/**
|
||||
* View the item from the head of the queue.
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T front() = 0;
|
||||
|
||||
/**
|
||||
* Get an item from the head of the queue.
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T pop() = 0;
|
||||
|
||||
@ -86,12 +86,12 @@ public:
|
||||
/**
|
||||
* Destroy this object.
|
||||
*/
|
||||
~SGLockedQueue() {}
|
||||
virtual ~SGLockedQueue() {}
|
||||
|
||||
/**
|
||||
* Returns whether this queue is empty (contains no elements).
|
||||
*
|
||||
* @return bool True if queue is empty, otherwisr false.
|
||||
* @return True if queue is empty, otherwise false.
|
||||
*/
|
||||
virtual bool empty() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -101,7 +101,7 @@ public:
|
||||
/**
|
||||
* Add an item to the end of the queue.
|
||||
*
|
||||
* @param T object to add.
|
||||
* @param item object to add.
|
||||
*/
|
||||
virtual void push( const T& item ) {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -111,7 +111,7 @@ public:
|
||||
/**
|
||||
* View the item from the head of the queue.
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T front() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -123,7 +123,7 @@ public:
|
||||
/**
|
||||
* Get an item from the head of the queue.
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T pop() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -142,7 +142,7 @@ public:
|
||||
/**
|
||||
* Query the size of the queue
|
||||
*
|
||||
* @return size_t size of queue.
|
||||
* @return Size of queue.
|
||||
*/
|
||||
virtual size_t size() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -178,7 +178,7 @@ public:
|
||||
/**
|
||||
* Destroy this queue.
|
||||
*/
|
||||
~SGBlockingQueue() {}
|
||||
virtual ~SGBlockingQueue() {}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -191,7 +191,7 @@ public:
|
||||
/**
|
||||
* Add an item to the end of the queue.
|
||||
*
|
||||
* @param T object to add.
|
||||
* @param item The object to add.
|
||||
*/
|
||||
virtual void push( const T& item ) {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -203,7 +203,7 @@ public:
|
||||
* View the item from the head of the queue.
|
||||
* Calling thread is not suspended
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T front() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -219,7 +219,7 @@ public:
|
||||
* Get an item from the head of the queue.
|
||||
* If no items are available then the calling thread is suspended
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T pop() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -238,7 +238,7 @@ public:
|
||||
/**
|
||||
* Query the size of the queue
|
||||
*
|
||||
* @return size_t size of queue.
|
||||
* @return Size of queue.
|
||||
*/
|
||||
virtual size_t size() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -280,7 +280,7 @@ public:
|
||||
/**
|
||||
* Destroy this dequeue.
|
||||
*/
|
||||
~SGBlockingDeque() {}
|
||||
virtual ~SGBlockingDeque() {}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -301,7 +301,7 @@ public:
|
||||
/**
|
||||
* Add an item to the front of the queue.
|
||||
*
|
||||
* @param T object to add.
|
||||
* @param item The object to add.
|
||||
*/
|
||||
virtual void push_front( const T& item ) {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -312,7 +312,7 @@ public:
|
||||
/**
|
||||
* Add an item to the back of the queue.
|
||||
*
|
||||
* @param T object to add.
|
||||
* @param item The object to add.
|
||||
*/
|
||||
virtual void push_back( const T& item ) {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -324,7 +324,7 @@ public:
|
||||
* View the item from the head of the queue.
|
||||
* Calling thread is not suspended
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T front() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -340,7 +340,7 @@ public:
|
||||
* Get an item from the head of the queue.
|
||||
* If no items are available then the calling thread is suspended
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T pop_front() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -360,7 +360,7 @@ public:
|
||||
* Get an item from the tail of the queue.
|
||||
* If no items are available then the calling thread is suspended
|
||||
*
|
||||
* @return T next available object.
|
||||
* @return The next available object.
|
||||
*/
|
||||
virtual T pop_back() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
@ -379,7 +379,7 @@ public:
|
||||
/**
|
||||
* Query the size of the queue
|
||||
*
|
||||
* @return size_t size of queue.
|
||||
* @return Size of queue.
|
||||
*/
|
||||
virtual size_t size() {
|
||||
SGGuard<SGMutex> g(mutex);
|
||||
|
@ -146,16 +146,16 @@ public:
|
||||
/**
|
||||
* Wait for this condition variable to be signaled.
|
||||
*
|
||||
* @param SGMutex& reference to a locked mutex.
|
||||
* @param mutex Reference to a locked mutex.
|
||||
*/
|
||||
void wait(SGMutex&);
|
||||
void wait(SGMutex& mutex);
|
||||
|
||||
/**
|
||||
* Wait for this condition variable to be signaled for at most
|
||||
* 'ms' milliseconds.
|
||||
* Wait for this condition variable to be signaled for at most \a 'msec'
|
||||
* milliseconds.
|
||||
*
|
||||
* @param mutex reference to a locked mutex.
|
||||
* @param ms milliseconds to wait for a signal.
|
||||
* @param mutex Reference to a locked mutex.
|
||||
* @param msec Milliseconds to wait for a signal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -116,13 +116,15 @@ public:
|
||||
* If you don't know your position when you call the SGTime
|
||||
* constructor, you can just use the first form (which assumes 0,
|
||||
* 0).
|
||||
* @param lon_rad current longitude (radians)
|
||||
* @param lat_rad current latitude (radians)
|
||||
* @param root root path point to data file location (timezone, etc.)
|
||||
* @param init_time provide an initialization time, 0 means use
|
||||
current clock time */
|
||||
SGTime( const SGGeod& location, const SGPath& root,
|
||||
time_t init_time );
|
||||
*
|
||||
* @param location Current geodetic location
|
||||
* @param root Root path point to data file location (timezone, etc.)
|
||||
* @param init_time Provide an initialization time, 0 means use current
|
||||
* clock time
|
||||
*/
|
||||
SGTime( const SGGeod& location,
|
||||
const SGPath& root,
|
||||
time_t init_time );
|
||||
|
||||
/**
|
||||
* Create an instance given a data file path.
|
||||
@ -140,12 +142,13 @@ public:
|
||||
* you to offset "sim" time relative to "real" time. The update()
|
||||
* method is designed to be called by the host application before
|
||||
* every frame.
|
||||
* @param lon_rad current longitude (radians)
|
||||
* @param lat_rad current latitude (radians)
|
||||
* @param ct specify a unix time, otherwise specify 0 to use current
|
||||
clock time
|
||||
* @param warp an optional time offset specified in seconds. This
|
||||
* allows us to advance or rewind "time" if we choose to. */
|
||||
*
|
||||
* @param location Current geodetic location
|
||||
* @param ct Specify a unix time, otherwise specify 0 to use current
|
||||
* clock time
|
||||
* @param warp Optional time offset in seconds. This allows to advance
|
||||
* or rewind "time".
|
||||
*/
|
||||
void update( const SGGeod& location, time_t ct, long int warp );
|
||||
|
||||
/** Deprecated method. To be removed after the next release... */
|
||||
@ -158,9 +161,10 @@ public:
|
||||
* enough that your timezone may have changed as well. In the
|
||||
* FlightGear project we call updateLocal() every few minutes from
|
||||
* our periodic event manager.
|
||||
* @param lon_rad current longitude (radians)
|
||||
* @param lat_rad current latitude (radians)
|
||||
* @param root base path containing time zone directory */
|
||||
*
|
||||
* @param location Current geodetic location
|
||||
* @param root Bbase path containing time zone directory
|
||||
*/
|
||||
void updateLocal( const SGGeod& location, const std::string& root );
|
||||
|
||||
/** @return current system/unix time in seconds */
|
||||
|
Loading…
Reference in New Issue
Block a user