# 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
/**
* 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);
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;
/**
* 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
*
* @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,
/**
*
* @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,
*/
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
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
};
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
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;
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();
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
};
#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 );
-/** \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.
virtual bool eof() const { return eof_flag; };
};
-
#endif // _SG_FILE_HXX
-
-
#include "interpolater.hxx"
-using std::string;
-
// Constructor -- starts with an empty table.
SGInterpTable::SGInterpTable()
{
// 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 );
#include "sgstream.hxx"
-using std::string;
using std::istream;
using std::ostream;
//
// 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 );
// 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
//
// 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 );
// 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 );
}
*
* @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>,
*
* @param str Existing Nasal String
*/
- String(naRef string);
+ String(naRef str);
const char* c_str() const;
const char* begin() const;
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;
/**
* 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();
using std::endl;
using std::find;
using std::sort;
-using std::string;
using std::vector;
using std::stringstream;
i++;
}
if (i != max && *i != '/')
- throw string("illegal character after . or ..");
+ throw std::string("illegal character after . or ..");
} else if (isalpha(*i) || *i == '_') {
i++;
} 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");
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 '_'");
}
// 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())
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;
}
}
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());
}
}
}
_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),
_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::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) {
_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 << ']';
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;
//------------------------------------------------------------------------------
bool SGPropertyNode::interpolate( const std::string& type,
- const PropertyList& values,
+ const simgear::PropertyList& values,
const double_list& deltas,
const std::string& easing )
{
}
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());
/**
* 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
* 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
{
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;
*
* @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,
-/**
- * \file propsfwwd.hxx
+/** \file
+ *
* Forward declarations for properties (and related structures)
*/
#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
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,
/**
* 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.
*
* 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
#include "Pass.hxx"
using std::map;
-using std::string;
using namespace simgear;
-\f
////////////////////////////////////////////////////////////////////////
// Constructors and destructor.
////////////////////////////////////////////////////////////////////////
{
}
-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));
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";
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);
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);
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");
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()) {
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");
}
}
-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;
{
}
-ConditionNode::ConditionNode(const ConditionNode& rhs, const CopyOp& op)
+ConditionNode::ConditionNode(const ConditionNode& rhs, const osg::CopyOp& op)
: Group(rhs, op), _condition(rhs._condition)
{
}
{
}
-void TextureUpdateVisitor::apply(Node& node)
+void TextureUpdateVisitor::apply(osg::Node& node)
{
StateSet* stateSet = cloneStateSet(node.getStateSet());
if (stateSet)
// 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)
* 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 );
// 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;
#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>
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;
-
-typedef struct {
- SGVec3f sky_color;
- SGVec3f adj_sky_color;
- SGVec3f fog_color;
- SGVec3f cloud_color;
- double sun_angle, moon_angle;
-} SGSkyColor;
+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;
+};
+
+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,
* 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
/**
* 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.
+ *
+ * @note See discussion in \ref SGSky-details "detailed class description".
*
- * 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
+ * @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.
/**
* 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 );
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);
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);
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);
void calcApronPts(double tex_width);
};
-}
void OceanMesh::calcMesh(const SGVec3d& cartCenter, const SGQuatd& orient,
double clon, double clat,
}
}
-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,
{
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)
{
}
{
}
-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) {
-///@file Helper for OSG related debugging
+///@file
+/// Helper for OSG related debugging
//
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
NodeVisitor::reset();
}
-NodeList SplicingVisitor::traverse(Node& node)
+NodeList SplicingVisitor::traverse(osg::Node& node)
{
NodeList result;
_childStack.push_back(NodeList());
_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) {
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()) {
}
}
-Node* SplicingVisitor::getNewNode(osg::Node* node)
+osg::Node* SplicingVisitor::getNewNode(osg::Node* node)
{
ref_ptr<Node> tmpPtr(node);
NodeMap::iterator itr;
#include "soundmgr_openal_private.hxx"
#include "sample_group.hxx"
-using std::string;
-
#ifdef HAVE_STD_ISNAN
using std::isnan;
#endif
_samples.clear();
}
-SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr, const string &refname ) :
+SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr,
+ const std::string &refname ):
_smgr(smgr),
_refname(refname),
_active(false),
}
// 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
// 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() ) {
// 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
// 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
// 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 ) {
// 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 ) {
}
// 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 ) {
#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);
return false;
}
-bool SGSampleGroup::testForALError(string s)
+bool SGSampleGroup::testForALError(std::string s)
{
#ifdef SG_C
ALenum error = alGetError();
-// 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
* @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.
-// 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
// 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
/**
- * 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 {
* 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() {
* 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() {
/**
* 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;
/**
* 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; }
/**
* 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;
-// 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>
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; }
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
-using std::string;
using std::vector;
}
// 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() ) {
// 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() ) {
// 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() );
}
// 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.
#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
{
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
}
}
-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;
}
-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);
}
-bool SGSoundMgr::testForALError(string s)
+bool SGSoundMgr::testForALError(std::string s)
{
#ifdef ENABLE_SOUND
ALenum error = alGetError();
return false;
}
-bool SGSoundMgr::testForALCError(string s)
+bool SGSoundMgr::testForALCError(std::string s)
{
#ifdef ENABLE_SOUND
ALCenum error;
-// 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
// 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
/**
* 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 );
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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 );
/**
* 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.
*/
/**
* 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 );
/**
* 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; }
/**
* 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
* @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.
}
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 )
{
//
_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 + "'");
}
-// 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
* 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.
* <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.
/**
* Convenience constructor.
*
- * @param node The binding will be built from this node.
+ * @param commandName TODO
*/
SGBinding(const std::string& commandName);
* 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 );
/**
* 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);
-/* -*-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
/// 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
/**
* 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)); }
#include <simgear/misc/sg_path.hxx>
-using std::string;
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of sg_location class.
////////////////////////////////////////////////////////////////////////
return _message;
}
-const string
+const std::string
sg_throwable::getFormattedMessage () const
{
- return string(getMessage());
+ return std::string(getMessage());
}
void
{
}
-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())
{
}
sg_error::~sg_error () throw ()
{
}
-\f
+
////////////////////////////////////////////////////////////////////////
// Implementation of sg_exception class.
////////////////////////////////////////////////////////////////////////
{
}
-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())
{
}
sg_exception::~sg_exception () throw ()
{
}
-\f
+
////////////////////////////////////////////////////////////////////////
// Implementation of sg_io_exception.
////////////////////////////////////////////////////////////////////////
{
}
-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;
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());
{
}
-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)
{
}
/**
* 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.
/**
* 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;
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* Query the size of the queue
*
- * @return size_t size of queue.
+ * @return Size of queue.
*/
virtual size_t size() {
SGGuard<SGMutex> g(mutex);
/**
* Destroy this queue.
*/
- ~SGBlockingQueue() {}
+ virtual ~SGBlockingQueue() {}
/**
*
/**
* 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);
* 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);
* 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);
/**
* Query the size of the queue
*
- * @return size_t size of queue.
+ * @return Size of queue.
*/
virtual size_t size() {
SGGuard<SGMutex> g(mutex);
/**
* Destroy this dequeue.
*/
- ~SGBlockingDeque() {}
+ virtual ~SGBlockingDeque() {}
/**
*
/**
* 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);
/**
* 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);
* 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);
* 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);
* 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);
/**
* Query the size of the queue
*
- * @return size_t size of queue.
+ * @return Size of queue.
*/
virtual size_t size() {
SGGuard<SGMutex> g(mutex);
/**
* 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
*/
* 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.
* 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... */
* 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 */