BoxLayout.hxx   BoxLayout.hxx 
// Align items horizontally or vertically in a box /// @file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 29 skipping to change at line 29
#ifndef SG_CANVAS_BOX_LAYOUT_HXX_ #ifndef SG_CANVAS_BOX_LAYOUT_HXX_
#define SG_CANVAS_BOX_LAYOUT_HXX_ #define SG_CANVAS_BOX_LAYOUT_HXX_
#include "Layout.hxx" #include "Layout.hxx"
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/**
* Align LayoutItems horizontally or vertically in a box.
*
* @see http://qt-project.org/doc/qt-4.8/qboxlayout.html#details
*/
class BoxLayout: class BoxLayout:
public Layout public Layout
{ {
public: public:
enum Direction enum Direction
{ {
LeftToRight, LeftToRight,
RightToLeft, RightToLeft,
TopToBottom, TopToBottom,
BottomToTop BottomToTop
}; };
BoxLayout(Direction dir); BoxLayout(Direction dir);
~BoxLayout(); ~BoxLayout();
virtual void addItem(const LayoutItemRef& item); virtual void addItem(const LayoutItemRef& item);
void addItem(const LayoutItemRef& item, int stretch); void addItem( const LayoutItemRef& item,
int stretch,
uint8_t alignment = 0 );
void addStretch(int stretch = 0); void addStretch(int stretch = 0);
void addSpacing(int size); void addSpacing(int size);
void insertItem(int index, const LayoutItemRef& item, int stretch = 0 void insertItem( int index,
); const LayoutItemRef& item,
int stretch = 0,
uint8_t alignment = 0 );
void insertStretch(int index, int stretch = 0); void insertStretch(int index, int stretch = 0);
void insertSpacing(int index, int size); void insertSpacing(int index, int size);
virtual size_t count() const; virtual size_t count() const;
virtual LayoutItemRef itemAt(size_t index); virtual LayoutItemRef itemAt(size_t index);
virtual LayoutItemRef takeAt(size_t index); virtual LayoutItemRef takeAt(size_t index);
virtual void clear(); virtual void clear();
skipping to change at line 89 skipping to change at line 99
*/ */
int stretch(size_t index) const; int stretch(size_t index) const;
virtual void setSpacing(int spacing); virtual void setSpacing(int spacing);
virtual int spacing() const; virtual int spacing() const;
void setDirection(Direction dir); void setDirection(Direction dir);
Direction direction() const; Direction direction() const;
virtual bool hasHeightForWidth() const; virtual bool hasHeightForWidth() const;
virtual int heightForWidth(int w) const;
virtual int minimumHeightForWidth(int w) const;
virtual void setCanvas(const CanvasWeakPtr& canvas); virtual void setCanvas(const CanvasWeakPtr& canvas);
bool horiz() const; bool horiz() const;
protected: protected:
typedef const int& (SGVec2i::*CoordGetter)() const; typedef const int& (SGVec2i::*CoordGetter)() const;
CoordGetter _get_layout_coord, //<! getter for coordinate in layou t CoordGetter _get_layout_coord, //!< getter for coordinate in layou t
// direction // direction
_get_fixed_coord; //<! getter for coordinate in secon dary _get_fixed_coord; //!< getter for coordinate in secon dary
// (fixed) direction // (fixed) direction
int _padding; int _padding;
Direction _direction; Direction _direction;
typedef std::vector<ItemData> LayoutItems; typedef std::vector<ItemData> LayoutItems;
mutable LayoutItems _layout_items; mutable LayoutItems _layout_items;
mutable ItemData _layout_data; mutable ItemData _layout_data;
skipping to change at line 124 skipping to change at line 132
_hfw_height, _hfw_height,
_hfw_min_height; _hfw_min_height;
void updateSizeHints() const; void updateSizeHints() const;
void updateWFHCache(int w) const; void updateWFHCache(int w) const;
virtual SGVec2i sizeHintImpl() const; virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const; virtual SGVec2i minimumSizeImpl() const;
virtual SGVec2i maximumSizeImpl() const; virtual SGVec2i maximumSizeImpl() const;
virtual int heightForWidthImpl(int w) const;
virtual int minimumHeightForWidthImpl(int w) const;
virtual void doLayout(const SGRecti& geom); virtual void doLayout(const SGRecti& geom);
virtual void visibilityChanged(bool visible);
}; };
/** /**
* Shortcut for creating a horizontal box layout * Shortcut for creating a horizontal box layout
*/ */
class HBoxLayout: class HBoxLayout:
public BoxLayout public BoxLayout
{ {
public: public:
HBoxLayout(); HBoxLayout();
 End of changes. 9 change blocks. 
8 lines changed or deleted 20 lines changed or added


 Canvas.hxx   Canvas.hxx 
///@file The canvas for rendering with the 2d API ///@file
/// The canvas for rendering with the 2d API
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 46 skipping to change at line 47
#include <string> #include <string>
namespace simgear namespace simgear
{ {
/// Canvas 2D drawing API /// Canvas 2D drawing API
namespace canvas namespace canvas
{ {
class CanvasMgr; class CanvasMgr;
class MouseEvent; class MouseEvent;
/**
* Canvas to draw onto (to an off-screen render target).
*/
class Canvas: class Canvas:
public PropertyBasedElement, public PropertyBasedElement,
public nasal::Object public nasal::Object
{ {
public: public:
enum StatusFlags enum StatusFlags
{ {
STATUS_OK, STATUS_OK,
STATUS_DIRTY = 1, STATUS_DIRTY = 1,
LAYOUT_DIRTY = STATUS_DIRTY << 1, MISSING_SIZE_X = STATUS_DIRTY << 1,
MISSING_SIZE_X = LAYOUT_DIRTY << 1,
MISSING_SIZE_Y = MISSING_SIZE_X << 1, MISSING_SIZE_Y = MISSING_SIZE_X << 1,
MISSING_SIZE = MISSING_SIZE_X | MISSING_SIZE_Y, MISSING_SIZE = MISSING_SIZE_X | MISSING_SIZE_Y,
CREATE_FAILED = MISSING_SIZE_Y << 1 CREATE_FAILED = MISSING_SIZE_Y << 1
}; };
/** /**
* This callback is installed on every placement of the canvas in the * This callback is installed on every placement of the canvas in the
* scene to only render the canvas if at least one placement is visib le * scene to only render the canvas if at least one placement is visib le
*/ */
class CullCallback: class CullCallback:
skipping to change at line 137 skipping to change at line 140
*/ */
GroupPtr getRootGroup(); GroupPtr getRootGroup();
/** /**
* Set the layout of the canvas (the layout will automatically update with * Set the layout of the canvas (the layout will automatically update with
* the viewport size of the canvas) * the viewport size of the canvas)
*/ */
void setLayout(const LayoutRef& layout); void setLayout(const LayoutRef& layout);
/** /**
* Set the focus to the given element.
*
* The focus element will receive all keyboard events propagated to t
his
* canvas. If there is no valid focus element the root group will rec
eive
* the events instead.
*/
void setFocusElement(const ElementPtr& el);
/**
* Clear the focus element.
*
* @see setFocusElement()
*/
void clearFocusElement();
/**
* Enable rendering for the next frame * Enable rendering for the next frame
* *
* @param force Force redraw even if nothing has changed (if dirty flag * @param force Force redraw even if nothing has changed (if dirty flag
* is not set) * is not set)
*/ */
void enableRendering(bool force = false); void enableRendering(bool force = false);
void update(double delta_time_sec); void update(double delta_time_sec);
bool addEventListener(const std::string& type, const EventListener& c b); bool addEventListener(const std::string& type, const EventListener& c b);
skipping to change at line 163 skipping to change at line 182
int getSizeY() const; int getSizeY() const;
void setViewWidth(int w); void setViewWidth(int w);
void setViewHeight(int h); void setViewHeight(int h);
int getViewWidth() const; int getViewWidth() const;
int getViewHeight() const; int getViewHeight() const;
SGRect<int> getViewport() const; SGRect<int> getViewport() const;
bool handleMouseEvent(const MouseEventPtr& event); bool handleMouseEvent(const MouseEventPtr& event);
bool handleKeyboardEvent(const KeyboardEventPtr& event);
bool propagateEvent( EventPtr const& event, bool propagateEvent( EventPtr const& event,
EventPropagationPath const& path ); EventPropagationPath const& path );
virtual void childAdded( SGPropertyNode * parent, virtual void childAdded( SGPropertyNode * parent,
SGPropertyNode * child ); SGPropertyNode * child );
virtual void childRemoved( SGPropertyNode * parent, virtual void childRemoved( SGPropertyNode * parent,
SGPropertyNode * child ); SGPropertyNode * child );
virtual void valueChanged (SGPropertyNode * node); virtual void valueChanged (SGPropertyNode * node);
osg::Texture2D* getTexture() const; osg::Texture2D* getTexture() const;
skipping to change at line 214 skipping to change at line 235
bool _sampling_dirty, bool _sampling_dirty,
_render_dirty, _render_dirty,
_visible; _visible;
ODGauge _texture; ODGauge _texture;
GroupPtr _root_group; GroupPtr _root_group;
LayoutRef _layout; LayoutRef _layout;
ElementWeakPtr _focus_element;
CullCallbackPtr _cull_callback; CullCallbackPtr _cull_callback;
bool _render_always; //<! Used to disable automatic lazy rendering (c ulling) bool _render_always; //!< Used to disable automatic lazy rendering (c ulling)
std::vector<SGPropertyNode*> _dirty_placements; std::vector<SGPropertyNode*> _dirty_placements;
std::vector<Placements> _placements; std::vector<Placements> _placements;
std::set<CanvasWeakPtr> _parent_canvases, //<! Canvases showing this std::set<CanvasWeakPtr> _parent_canvases, //!< Canvases showing this
canvas canvas
_child_canvases; //<! Canvases displayed wit _child_canvases; //!< Canvases displayed wit
hin hin
// this canvas // this canvas
typedef std::map<std::string, PlacementFactory> PlacementFactoryMap; typedef std::map<std::string, PlacementFactory> PlacementFactoryMap;
static PlacementFactoryMap _placement_factories; static PlacementFactoryMap _placement_factories;
void setStatusFlags(unsigned int flags, bool set = true); void setStatusFlags(unsigned int flags, bool set = true);
private: private:
static SystemAdapterPtr _system_adapter; static SystemAdapterPtr _system_adapter;
 End of changes. 8 change blocks. 
8 lines changed or deleted 33 lines changed or added


 CanvasElement.hxx   CanvasElement.hxx 
///@file Interface for 2D Canvas elements ///@file
/// Interface for 2D Canvas elements
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 45 skipping to change at line 46
{ {
class Drawable; class Drawable;
} }
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/** /**
* Baseclass for Elements displayed inside a Canvas. * Base class for Elements displayed inside a Canvas.
*/ */
class Element: class Element:
public PropertyBasedElement public PropertyBasedElement
{ {
public: public:
/** /**
* Store pointer to window as user data * Store pointer to window as user data
*/ */
class OSGUserData: class OSGUserData:
skipping to change at line 111 skipping to change at line 112
/** /**
* Called every frame to update internal state * Called every frame to update internal state
* *
* @param dt Frame time in seconds * @param dt Frame time in seconds
*/ */
virtual void update(double dt); virtual void update(double dt);
bool addEventListener(const std::string& type, const EventListener& c b); bool addEventListener(const std::string& type, const EventListener& c b);
virtual void clearEventListener(); virtual void clearEventListener();
/// Get (keyboard) input focus.
void setFocus();
virtual bool accept(EventVisitor& visitor); virtual bool accept(EventVisitor& visitor);
virtual bool ascend(EventVisitor& visitor); virtual bool ascend(EventVisitor& visitor);
virtual bool traverse(EventVisitor& visitor); virtual bool traverse(EventVisitor& visitor);
/// Get the number of event handlers for the given type
size_t numEventHandler(int type) const;
virtual bool handleEvent(const EventPtr& event); virtual bool handleEvent(const EventPtr& event);
bool dispatchEvent(const EventPtr& event); bool dispatchEvent(const EventPtr& event);
/** /**
* *
* @param global_pos Position in global (canvas) coordinate frame * @param global_pos Position in global (canvas) coordinate frame
* @param parent_pos Position in parent coordinate frame * @param parent_pos Position in parent coordinate frame
* @param local_pos Position in local (element) coordinate frame * @param local_pos Position in local (element) coordinate frame
*/ */
virtual bool hitBound( const osg::Vec2f& global_pos, virtual bool hitBound( const osg::Vec2f& global_pos,
const osg::Vec2f& parent_pos, const osg::Vec2f& parent_pos,
const osg::Vec2f& local_pos ) const; const osg::Vec2f& local_pos ) const;
/** /**
* Set visibility of the element. * Set visibility of the element.
*/ */
void setVisible(bool visible); virtual void setVisible(bool visible);
/** /**
* Get whether the element is visible or hidden. * Get whether the element is visible or hidden.
*/ */
bool isVisible() const; virtual bool isVisible() const;
osg::MatrixTransform* getMatrixTransform(); osg::MatrixTransform* getMatrixTransform();
osg::MatrixTransform const* getMatrixTransform() const; osg::MatrixTransform const* getMatrixTransform() const;
/** /**
* Transform position to local coordinages. * Transform position to local coordinages.
*/ */
osg::Vec2f posToLocal(const osg::Vec2f& pos) const; osg::Vec2f posToLocal(const osg::Vec2f& pos) const;
virtual void childAdded( SGPropertyNode * parent, virtual void childAdded( SGPropertyNode * parent,
skipping to change at line 275 skipping to change at line 282
if( is_init ) if( is_init )
return true; return true;
is_init = true; is_init = true;
return false; return false;
} }
/** /**
* Register a function for setting a style specified by the given pro perty * Register a function for setting a style specified by the given pro perty
* *
* @param name Property name * @param name Property name
* @param type Interpolation type * @param type Interpolation type
* @param setter Setter function * @param setter Setter function
* @param inheritable If this style propagates to child elements
* *
* @tparam T1 Type of value used to retrieve value from prope rty * @tparam T1 Type of value used to retrieve value from prope rty
* node * node
* @tparam T2 Type of value the setter function expects * @tparam T2 Type of value the setter function expects
* @tparam Derived Type of class the setter can be applied to * @tparam Derived Type of class the setter can be applied to
* *
* @note T1 needs to be convertible to T2 * @note T1 needs to be convertible to T2
*/ */
template< template<
typename T1, typename T1,
skipping to change at line 559 skipping to change at line 567
virtual void childAdded(SGPropertyNode * child) {} virtual void childAdded(SGPropertyNode * child) {}
virtual void childRemoved(SGPropertyNode * child){} virtual void childRemoved(SGPropertyNode * child){}
virtual void childChanged(SGPropertyNode * child){} virtual void childChanged(SGPropertyNode * child){}
void setDrawable(osg::Drawable* drawable); void setDrawable(osg::Drawable* drawable);
/** /**
* Get stateset of drawable if available or use transform otherwise * Get stateset of drawable if available or use transform otherwise
*/ */
osg::StateSet* getOrCreateStateSet(); virtual osg::StateSet* getOrCreateStateSet();
void setupStyle(); void setupStyle();
private: private:
osg::ref_ptr<osg::Drawable> _drawable; osg::ref_ptr<osg::Drawable> _drawable;
Element(const Element&);// = delete Element(const Element&);// = delete
template<class Derived> template<class Derived>
 End of changes. 8 change blocks. 
8 lines changed or deleted 16 lines changed or added


 CanvasEvent.hxx   CanvasEvent.hxx 
// Canvas Event for event model similar to DOM Level 3 Event Model /// @file
/// Canvas Event for event model similar to DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 31
#define CANVAS_EVENT_HXX_ #define CANVAS_EVENT_HXX_
#include "canvas_fwd.hxx" #include "canvas_fwd.hxx"
#include <boost/bimap.hpp> #include <boost/bimap.hpp>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/**
* Base class for all Canvas events.
*
* The event system is closely following the specification of the DOM Lev
el 3
* Event Model.
*/
class Event: class Event:
public SGReferenced public SGReferenced
{ {
public: public:
/// Event type identifier
enum Type enum Type
{ {
UNKNOWN, UNKNOWN,
# define ENUM_MAPPING(name, str) name, # define ENUM_MAPPING(name, str, class_name)\
name, /*!< class_name (type=str) */
# include "CanvasEventTypes.hxx" # include "CanvasEventTypes.hxx"
# undef ENUM_MAPPING # undef ENUM_MAPPING
CUSTOM_EVENT ///< all user defined event types share the same id. T CUSTOM_EVENT ///< First event type id available for user defined ev
hey ent
/// are just differentiated by using the type string. /// type.
/// @see CustomEvent
}; };
int type; int type;
ElementWeakPtr target, ElementWeakPtr target,
current_target; current_target;
double time; double time;
bool propagation_stopped; bool propagation_stopped,
default_prevented;
Event(); Event();
// We need a vtable to allow nasal::Ghost to determine the dynamic ty pe // We need a vtable to allow nasal::Ghost to determine the dynamic ty pe
// of the actual event instances. // of the actual event instances.
virtual ~Event(); virtual ~Event();
/** /**
* Get whether this events support bubbling * Get whether this events support bubbling
*/ */
skipping to change at line 75 skipping to change at line 86
* If no such type exists it is registered. * If no such type exists it is registered.
*/ */
void setType(const std::string& type); void setType(const std::string& type);
int getType() const; int getType() const;
std::string getTypeString() const; std::string getTypeString() const;
ElementWeakPtr getTarget() const; ElementWeakPtr getTarget() const;
ElementWeakPtr getCurrentTarget() const; ElementWeakPtr getCurrentTarget() const;
/**
* Get time at which the event was generated.
*/
double getTime() const; double getTime() const;
/**
* Prevent further propagation of the event during event flow.
*
* @note This does not prevent calling further event handlers registe
red
* on the current event target.
*/
void stopPropagation(); void stopPropagation();
/**
* Cancel any default action normally taken as result of this event.
*
* @note For event handlers registered on the DesktopGroup (Nasal:
* canvas.getDesktop()) this stops the event from being further
* propagated to the normal FlightGear input event handling cod
e.
*/
void preventDefault();
/**
* Get if preventDefault() has been called.
*/
bool defaultPrevented() const;
static int getOrRegisterType(const std::string& type); static int getOrRegisterType(const std::string& type);
static int strToType(const std::string& type); static int strToType(const std::string& type);
static std::string typeToStr(int type); static std::string typeToStr(int type);
protected: protected:
struct name {}; struct name {};
struct id {}; struct id {};
typedef boost::bimaps::bimap< typedef boost::bimaps::bimap<
boost::bimaps::tagged<std::string, name>, boost::bimaps::tagged<std::string, name>,
boost::bimaps::tagged<int, id> boost::bimaps::tagged<int, id>
 End of changes. 9 change blocks. 
6 lines changed or deleted 43 lines changed or added


 CanvasEventTypes.hxx   CanvasEventTypes.hxx 
skipping to change at line 23 skipping to change at line 23
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef ENUM_MAPPING #ifndef ENUM_MAPPING
# error "Don't include this file directly!" # error "Don't include this file directly!"
#endif #endif
ENUM_MAPPING(MOUSE_DOWN, "mousedown") ENUM_MAPPING(MOUSE_DOWN, "mousedown", MouseEvent)
ENUM_MAPPING(MOUSE_UP, "mouseup") ENUM_MAPPING(MOUSE_UP, "mouseup", MouseEvent)
ENUM_MAPPING(CLICK, "click") ENUM_MAPPING(CLICK, "click", MouseEvent)
ENUM_MAPPING(DBL_CLICK, "dblclick") ENUM_MAPPING(DBL_CLICK, "dblclick", MouseEvent)
ENUM_MAPPING(DRAG, "drag") ENUM_MAPPING(DRAG, "drag", MouseEvent)
ENUM_MAPPING(WHEEL, "wheel") ENUM_MAPPING(WHEEL, "wheel", MouseEvent)
ENUM_MAPPING(MOUSE_MOVE, "mousemove") ENUM_MAPPING(MOUSE_MOVE, "mousemove", MouseEvent)
ENUM_MAPPING(MOUSE_OVER, "mouseover") ENUM_MAPPING(MOUSE_OVER, "mouseover", MouseEvent)
ENUM_MAPPING(MOUSE_OUT, "mouseout") ENUM_MAPPING(MOUSE_OUT, "mouseout", MouseEvent)
ENUM_MAPPING(MOUSE_ENTER, "mouseenter") ENUM_MAPPING(MOUSE_ENTER, "mouseenter", MouseEvent)
ENUM_MAPPING(MOUSE_LEAVE, "mouseleave") ENUM_MAPPING(MOUSE_LEAVE, "mouseleave", MouseEvent)
ENUM_MAPPING(KEY_DOWN, "keydown", KeyboardEvent)
ENUM_MAPPING(KEY_UP, "keyup", KeyboardEvent)
ENUM_MAPPING(KEY_PRESS, "keypress", KeyboardEvent)
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 CanvasObjectPlacement.hxx   CanvasObjectPlacement.hxx 
///@file Placement for putting a canvas texture onto OpenSceneGraph objects ///@file
. /// Placement for putting a canvas texture onto OpenSceneGraph objects.
// ///
// It also provides a SGPickCallback for passing mouse events to the canvas /// It also provides a SGPickCallback for passing mouse events to the canva
and s and
// manages emissive lighting of the placed canvas. /// manages emissive lighting of the placed canvas.
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
 End of changes. 1 change blocks. 
6 lines changed or deleted 6 lines changed or added


 CanvasText.hxx   CanvasText.hxx 
skipping to change at line 32 skipping to change at line 32
#include "CanvasElement.hxx" #include "CanvasElement.hxx"
#include <osgText/Text> #include <osgText/Text>
#include <map> #include <map>
#include <vector> #include <vector>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
class TextLine;
class Text: class Text:
public Element public Element
{ {
public: public:
static const std::string TYPE_NAME; static const std::string TYPE_NAME;
static void staticInit(); static void staticInit();
Text( const CanvasWeakPtr& canvas, Text( const CanvasWeakPtr& canvas,
const SGPropertyNode_ptr& node, const SGPropertyNode_ptr& node,
const Style& parent_style, const Style& parent_style,
Element* parent = 0 ); Element* parent = 0 );
~Text(); ~Text();
void setText(const char* text); void setText(const char* text);
void setFont(const char* name); void setFont(const char* name);
void setAlignment(const char* align); void setAlignment(const char* align);
int heightForWidth(int w) const; int heightForWidth(int w) const;
int maxWidth() const; int maxWidth() const;
/// Number of text lines.
size_t lineCount() const;
/// Number of characters in @a line.
size_t lineLength(size_t line) const;
osg::Vec2 getNearestCursor(const osg::Vec2& pos) const; osg::Vec2 getNearestCursor(const osg::Vec2& pos) const;
osg::Vec2 getCursorPos(size_t line, size_t character) const;
protected: protected:
friend class TextLine;
class TextOSG; class TextOSG;
osg::ref_ptr<TextOSG> _text; osg::ref_ptr<TextOSG> _text;
virtual osg::StateSet* getOrCreateStateSet();
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* CANVAS_TEXT_HXX_ */ #endif /* CANVAS_TEXT_HXX_ */
 End of changes. 5 change blocks. 
0 lines changed or deleted 12 lines changed or added


 CanvasWindow.hxx   CanvasWindow.hxx 
skipping to change at line 87 skipping to change at line 87
void setCanvasContent(CanvasPtr canvas); void setCanvasContent(CanvasPtr canvas);
simgear::canvas::CanvasWeakPtr getCanvasContent() const; simgear::canvas::CanvasWeakPtr getCanvasContent() const;
void setLayout(const LayoutRef& layout); void setLayout(const LayoutRef& layout);
CanvasPtr getCanvasDecoration() const; CanvasPtr getCanvasDecoration() const;
bool isResizable() const; bool isResizable() const;
bool isCapturingEvents() const; bool isCapturingEvents() const;
virtual void setVisible(bool visible);
virtual bool isVisible() const;
/** /**
* Moves window on top of all other windows with the same z-index. * Moves window on top of all other windows with the same z-index.
* *
* @note If no z-index is set it defaults to 0. * @note If no z-index is set it defaults to 0.
*/ */
void raise(); void raise();
void handleResize( uint8_t mode, void handleResize( uint8_t mode,
const osg::Vec2f& offset = osg::Vec2f() ); const osg::Vec2f& offset = osg::Vec2f() );
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 CloudShaderGeometry.hxx   CloudShaderGeometry.hxx 
skipping to change at line 35 skipping to change at line 35
#include <vector> #include <vector>
#include <osg/BoundingBox> #include <osg/BoundingBox>
#include <osg/CopyOp> #include <osg/CopyOp>
#include <osg/Drawable> #include <osg/Drawable>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/RenderInfo> #include <osg/RenderInfo>
#include <osg/Vec3> #include <osg/Vec3>
#include <osg/Vec4> #include <osg/Vec4>
#include <osg/buffered_value> #include <osg/buffered_value>
#include <osg/Version>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
namespace simgear namespace simgear
{ {
class CloudShaderGeometry : public osg::Drawable class CloudShaderGeometry : public osg::Drawable
{ {
public: public:
const static unsigned int USR_ATTR_1 = 10; const static unsigned int USR_ATTR_1 = 10;
const static unsigned int USR_ATTR_2 = 11; const static unsigned int USR_ATTR_2 = 11;
const static unsigned int USR_ATTR_3 = 12; const static unsigned int USR_ATTR_3 = 12;
CloudShaderGeometry() CloudShaderGeometry()
{ {
setUseDisplayList(false); setUseDisplayList(false);
} }
CloudShaderGeometry(int vx, int vy, float width, float height, floa CloudShaderGeometry(int vx, int vy, float width, float height, floa
t ts, float ms, float bs, float shade, float ch, float zsc) : t ts, float ms, float bs, float shade, float ch, float zsc, float af) :
varieties_x(vx), varieties_y(vy), top_factor(ts), middle_factor varieties_x(vx), varieties_y(vy), top_factor(ts), middle_factor
(ms), bottom_factor(bs), shade_factor(shade), cloud_height(ch), zscale(zsc) (ms),
bottom_factor(bs), shade_factor(shade), cloud_height(ch), zscal
e(zsc),
alpha_factor(af)
{ {
setUseDisplayList(false); setUseDisplayList(false);
float x = width/2.0f; float x = width/2.0f;
float z = height/2.0f; float z = height/2.0f;
_bbox.expandBy(-x, -x, -z); _bbox.expandBy(-x, -x, -z);
_bbox.expandBy(x, x, z); _bbox.expandBy(x, x, z);
} }
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
CloudShaderGeometry(const CloudShaderGeometry& CloudShaderGeometry, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): CloudShaderGeometry(const CloudShaderGeometry& CloudShaderGeometry, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
skipping to change at line 97 skipping to change at line 100
{ _cloudsprites.push_back(t); } { _cloudsprites.push_back(t); }
void insert(SGVec3f& p, int tx, int ty, float w, float h) void insert(SGVec3f& p, int tx, int ty, float w, float h)
{ insert(CloudSprite(p, tx, ty, w, h)); } { insert(CloudSprite(p, tx, ty, w, h)); }
unsigned getNumCloudSprite() const unsigned getNumCloudSprite() const
{ return _cloudsprites.size(); } { return _cloudsprites.size(); }
CloudSprite& getCloudSprite(unsigned i) CloudSprite& getCloudSprite(unsigned i)
{ return _cloudsprites[i]; } { return _cloudsprites[i]; }
virtual void drawImplementation(osg::RenderInfo& renderInfo) const; virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const virtual osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2)
computeBound()
#else
computeBoundingBox()
#endif
const
{ {
return _bbox; return _bbox;
} }
void addSprite(const SGVec3f& p, int tx, int ty, float w, float h, float cull); void addSprite(const SGVec3f& p, int tx, int ty, float w, float h, float cull);
void generateGeometry(); void generateGeometry();
void rebuildGeometry(); void rebuildGeometry();
osg::ref_ptr<osg::Drawable> _geometry; osg::ref_ptr<osg::Drawable> _geometry;
int varieties_x; int varieties_x;
int varieties_y; int varieties_y;
float top_factor; float top_factor;
float middle_factor; float middle_factor;
float bottom_factor; float bottom_factor;
float shade_factor; float shade_factor;
float cloud_height; float cloud_height;
float zscale; float zscale;
float alpha_factor;
// Bounding box extents. // Bounding box extents.
osg::BoundingBox _bbox; osg::BoundingBox _bbox;
struct SortData struct SortData
{ {
struct SortItem struct SortItem
{ {
SortItem(size_t idx_, float depth_) : idx(idx_), depth(depth_) {} SortItem(size_t idx_, float depth_) : idx(idx_), depth(depth_) {}
SortItem() : idx(0), depth(0.0f) {} SortItem() : idx(0), depth(0.0f) {}
 End of changes. 4 change blocks. 
5 lines changed or deleted 16 lines changed or added


 CustomEvent.hxx   CustomEvent.hxx 
///@file Canvas user defined event ///@file
/// Canvas user defined event
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 31
#define CANVAS_CUSTOM_EVENT_HXX_ #define CANVAS_CUSTOM_EVENT_HXX_
#include <simgear/canvas/CanvasEvent.hxx> #include <simgear/canvas/CanvasEvent.hxx>
#include <simgear/structure/map.hxx> #include <simgear/structure/map.hxx>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/**
* User defined event (optionally carrying additional context information
or
* data).
*/
class CustomEvent: class CustomEvent:
public Event public Event
{ {
public: public:
/** /**
* *
* @param type_str Event type name (if name does not exist yet it will * @param type_str Event type name (if name does not exist yet it will
* be registered as new event type) * 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 * @param data Optional user data stored in event
*/ */
CustomEvent( std::string const& type_str, CustomEvent( std::string const& type_str,
bool bubbles = false, bool bubbles = false,
StringMap const& data = StringMap() ); StringMap const& data = StringMap() );
/** /**
* *
* @param type_id Event type id * @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 * @param data Optional user data stored in event
*/ */
CustomEvent( int type_id, CustomEvent( int type_id,
bool bubbles = false, bool bubbles = false,
StringMap const& data = StringMap() ); StringMap const& data = StringMap() );
/** /**
* Set user data * Set user data
*/ */
void setDetail(StringMap const& data); void setDetail(StringMap const& data);
/** /**
* Get user data * Get user data
*/ */
StringMap const& getDetail() const { return detail; } StringMap const& getDetail() const { return detail; }
/**
* Get whether this event supports bubbling.
*
* @see #bubbles
* @see CustomEvent()
*/
virtual bool canBubble() const { return bubbles; } virtual bool canBubble() const { return bubbles; }
StringMap detail; //<! user data map StringMap detail; //!< User data map
bool bubbles; bool bubbles; //!< Whether the event supports bubbling
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* CANVAS_CUSTOM_EVENT_HXX_ */ #endif /* CANVAS_CUSTOM_EVENT_HXX_ */
 End of changes. 6 change blocks. 
3 lines changed or deleted 17 lines changed or added


 Effect.hxx   Effect.hxx 
skipping to change at line 102 skipping to change at line 102
*/ */
bool realizeTechniques(const SGReaderWriterOptions* options = 0); bool realizeTechniques(const SGReaderWriterOptions* options = 0);
void addDeferredPropertyListener(DeferredPropertyListener* listener); void addDeferredPropertyListener(DeferredPropertyListener* listener);
// Callback that is added to the effect geode to initialize the // Callback that is added to the effect geode to initialize the
// effect. // effect.
friend struct InitializeCallback; friend struct InitializeCallback;
struct InitializeCallback : public UpdateOnceCallback struct InitializeCallback : public UpdateOnceCallback
{ {
void doUpdate(osg::Node* node, osg::NodeVisitor* nv); void doUpdate(osg::Node* node, osg::NodeVisitor* nv);
}; };
std::string getName(){return _name;}
void setName(std::string name){_name = name;}
protected: protected:
~Effect(); ~Effect();
// Support for a cache of effects that inherit from this one, so // Support for a cache of effects that inherit from this one, so
// Effect objects with the same parameters and techniques can be // Effect objects with the same parameters and techniques can be
// shared. // shared.
struct Key struct Key
{ {
Key() {} Key() {}
Key(SGPropertyNode* unmerged_, const osgDB::FilePathList& paths_) Key(SGPropertyNode* unmerged_, const osgDB::FilePathList& paths_)
: unmerged(unmerged_), paths(paths_) : unmerged(unmerged_), paths(paths_)
skipping to change at line 140 skipping to change at line 143
{ {
if (!_cache) if (!_cache)
_cache = new Cache; _cache = new Cache;
return _cache; return _cache;
} }
Cache* _cache; Cache* _cache;
friend size_t hash_value(const Key& key); friend size_t hash_value(const Key& key);
friend Effect* makeEffect(SGPropertyNode* prop, bool realizeTechniques, friend Effect* makeEffect(SGPropertyNode* prop, bool realizeTechniques,
const SGReaderWriterOptions* options); const SGReaderWriterOptions* options);
bool _isRealized; bool _isRealized;
std::string _name;
}; };
// Automatic support for boost hash function // Automatic support for boost hash function
size_t hash_value(const Effect::Key&); size_t hash_value(const Effect::Key&);
Effect* makeEffect(const std::string& name, Effect* makeEffect(const std::string& name,
bool realizeTechniques, bool realizeTechniques,
const SGReaderWriterOptions* options); const SGReaderWriterOptions* options);
Effect* makeEffect(SGPropertyNode* prop, Effect* makeEffect(SGPropertyNode* prop,
bool realizeTechniques, bool realizeTechniques,
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 EffectBuilder.hxx   EffectBuilder.hxx 
skipping to change at line 297 skipping to change at line 297
const SGPropertyNode* prop); const SGPropertyNode* prop);
/** /**
* Get a named child property from pass parameters or effect * Get a named child property from pass parameters or effect
* parameters. * parameters.
*/ */
const SGPropertyNode* getEffectPropertyChild(Effect* effect, const SGPropertyNode* getEffectPropertyChild(Effect* effect,
const SGPropertyNode* prop, const SGPropertyNode* prop,
const char* name); const char* name);
/** /**
* Get the name of a node mentioned in a <use> clause from the global prope rty * Get the name of a node mentioned in a \<use\> clause from the global pro perty
* tree. * 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. * mentioned node name.
*/ */
std::string getGlobalProperty(const SGPropertyNode* prop, std::string getGlobalProperty(const SGPropertyNode* prop,
const SGReaderWriterOptions *); const SGReaderWriterOptions *);
template<typename NameItr> template<typename NameItr>
std::vector<std::string> std::vector<std::string>
getVectorProperties(const SGPropertyNode* prop, getVectorProperties(const SGPropertyNode* prop,
const SGReaderWriterOptions *options, size_t vecSize, const SGReaderWriterOptions *options, size_t vecSize,
NameItr defaultNames) NameItr defaultNames)
skipping to change at line 599 skipping to change at line 599
} }
inline void setDynamicVariance(osg::Object* obj) inline void setDynamicVariance(osg::Object* obj)
{ {
obj->setDataVariance(osg::Object::DYNAMIC); obj->setDataVariance(osg::Object::DYNAMIC);
} }
/** /**
* Initialize the value and the possible updating of an effect * Initialize the value and the possible updating of an effect
* attribute. If the value is specified directly, set it. Otherwise, * 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 * 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 * install a change listener that will set the attribute when the
* property changes. * property changes.
* *
* For relative property names, the property root found in options is * For relative property names, the property root found in options is
* used. * used.
*/ */
template<typename OSGParamType, typename ObjType, typename F> template<typename OSGParamType, typename ObjType, typename F>
void void
initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj , initFromParameters(Effect* effect, const SGPropertyNode* prop, ObjType* obj ,
const F& setter, const SGReaderWriterOptions* options) const F& setter, const SGReaderWriterOptions* options)
skipping to change at line 644 skipping to change at line 644
{ {
initFromParameters<OSGParamType>(effect, prop, obj, initFromParameters<OSGParamType>(effect, prop, obj,
boost::bind(setter, _1, _2), options); boost::bind(setter, _1, _2), options);
} }
/* /*
* Initialize vector parameters from individual properties. * Initialize vector parameters from individual properties.
* The parameter may be updated at runtime. * The parameter may be updated at runtime.
* *
* If the value is specified directly, set it. Otherwise, use the * 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 * 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 * for the values needed to update the parameter; nameIter holds the
* names of the properties relative to the root. If there are several * 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. * value for the corresponding vector member.
* *
* Install a change listener that will set the attribute when the * Install a change listener that will set the attribute when the
* property changes. * property changes.
* *
* For relative property names, the property root found in options is * For relative property names, the property root found in options is
* used. * used.
*/ */
template<typename OSGParamType, typename ObjType, typename NameItrType, template<typename OSGParamType, typename ObjType, typename NameItrType,
typename F> typename F>
 End of changes. 7 change blocks. 
7 lines changed or deleted 7 lines changed or added


 EffectGeode.hxx   EffectGeode.hxx 
skipping to change at line 21 skipping to change at line 21
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
#ifndef SIMGEAR_EFFECT_GEODE_HXX #ifndef SIMGEAR_EFFECT_GEODE_HXX
#define SIMGEAR_EFFECT_GEODE_HXX 1 #define SIMGEAR_EFFECT_GEODE_HXX 1
#include <osg/Geode> #include <osg/Geode>
#include <osg/Version>
#include <boost/iterator/iterator_adaptor.hpp>
#include "Effect.hxx" #include "Effect.hxx"
#include "mat.hxx"
namespace simgear namespace simgear
{ {
class EffectGeode : public osg::Geode class EffectGeode : public osg::Geode
{ {
public: public:
#if OSG_VERSION_LESS_THAN(3,3,2)
typedef DrawableList::iterator DrawablesIterator;
#else
class DrawablesIterator:
public boost::iterator_adaptor<
DrawablesIterator,
osg::NodeList::iterator,
osg::ref_ptr<osg::Drawable>,
boost::use_default,
osg::ref_ptr<osg::Drawable> // No reference as Reference type.
// The child list does not contain Draw
able
// ref_ptr so we can not return any
// references to them.
>
{
public:
DrawablesIterator()
{}
explicit DrawablesIterator(osg::NodeList::iterator const& node_it):
DrawablesIterator::iterator_adaptor_(node_it)
{}
private:
friend class boost::iterator_core_access;
osg::ref_ptr<osg::Drawable> dereference() const
{
return base_reference()->get()->asDrawable();
}
};
#endif
EffectGeode(); EffectGeode();
EffectGeode(const EffectGeode& rhs, EffectGeode(const EffectGeode& rhs,
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(simgear,EffectGeode); META_Node(simgear,EffectGeode);
Effect* getEffect() const { return _effect.get(); } Effect* getEffect() const { return _effect.get(); }
void setEffect(Effect* effect); void setEffect(Effect* effect);
SGMaterial* getMaterial() const { return _material; }
void setMaterial(SGMaterial* mat) { _material = mat; }
virtual void resizeGLObjectBuffers(unsigned int maxSize); virtual void resizeGLObjectBuffers(unsigned int maxSize);
virtual void releaseGLObjects(osg::State* = 0) const; virtual void releaseGLObjects(osg::State* = 0) const;
typedef DrawableList::iterator DrawablesIterator;
#if OSG_VERSION_LESS_THAN(3,3,2)
DrawablesIterator drawablesBegin() { return _drawables.begin(); } DrawablesIterator drawablesBegin() { return _drawables.begin(); }
DrawablesIterator drawablesEnd() { return _drawables.end(); } DrawablesIterator drawablesEnd() { return _drawables.end(); }
#else
DrawablesIterator drawablesBegin() { return DrawablesIterator(_children
.begin()); }
DrawablesIterator drawablesEnd() { return DrawablesIterator(_children.e
nd()); }
#endif
void runGenerators(osg::Geometry *geometry); void runGenerators(osg::Geometry *geometry);
private: private:
osg::ref_ptr<Effect> _effect; osg::ref_ptr<Effect> _effect;
SGMaterial* _material;
}; };
} }
#endif #endif
 End of changes. 7 change blocks. 
2 lines changed or deleted 52 lines changed or added


 Ghost.hxx   Ghost.hxx 
skipping to change at line 330 skipping to change at line 330
"is '%s' expected '%s'", "is '%s' expected '%s'",
naIsNil(me) ? "nil" naIsNil(me) ? "nil"
: (ghost_type ? ghost_type->name : "unknown") , : (ghost_type ? ghost_type->name : "unknown") ,
_ghost_type_strong.name _ghost_type_strong.name
); );
} }
return holder->_method return holder->_method
( (
*get_pointer(ref), *get_pointer(ref),
CallContext(c, argc, args) CallContext(c, me, argc, args)
); );
} }
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
naRuntimeError(c, "Fatal error in method call: %s", ex.what() ); naRuntimeError(c, "Fatal error in method call: %s", ex.what() );
} }
catch(...) catch(...)
{ {
naRuntimeError(c, "Unknown exception in method call."); naRuntimeError(c, "Unknown exception in method call.");
} }
skipping to change at line 883 skipping to change at line 883
{ {
strong_ref ref = fromNasal(c, *parent); strong_ref ref = fromNasal(c, *parent);
if( get_pointer(ref) ) if( get_pointer(ref) )
return ref; return ref;
} }
} }
return strong_ref(); return strong_ref();
} }
/**
* Convert Nasal object to C++ object and check if it has the correct
* type.
*
* @see fromNasal
*/
static strong_ref fromNasalChecked(naContext c, naRef me)
{
strong_ref obj = fromNasal(c, me);
if( obj )
return obj;
if( naIsNil(me) )
return strong_ref();
std::string msg = "Can not convert to '"
+ getSingletonPtr()->_name_strong
+ "': ";
naGhostType* ghost_type = naGhost_type(me);
if( ghost_type )
msg += "not a derived class (or expired weak ref): "
"'" + std::string(ghost_type->name) + "'";
else if( naIsHash(me) )
{
if( !naIsVector(naHash_cget(me, const_cast<char*>("parents"))) )
msg += "missing parents vector";
else
msg += "not a derived hash";
}
else
msg += "not an object";
throw bad_nasal_cast(msg);
}
private: private:
template<class, class> template<class, class>
friend class Ghost; friend class Ghost;
static naGhostType _ghost_type_strong, //!< Stored as shared pointer static naGhostType _ghost_type_strong, //!< Stored as shared pointer
_ghost_type_weak; //!< Stored as weak shared poi nter _ghost_type_weak; //!< Stored as weak shared poi nter
typedef naRef (*to_nasal_t)(naContext, const strong_ref&, bool); typedef naRef (*to_nasal_t)(naContext, const strong_ref&, bool);
typedef strong_ref (*from_nasal_t)(naContext, naRef); typedef strong_ref (*from_nasal_t)(naContext, naRef);
skipping to change at line 1423 skipping to change at line 1458
template<class T> template<class T>
typename boost::enable_if< typename boost::enable_if<
nasal::internal::has_element_type< nasal::internal::has_element_type<
typename nasal::internal::reduced_type<T>::type typename nasal::internal::reduced_type<T>::type
>, >,
T T
>::type >::type
from_nasal_helper(naContext c, naRef ref, const T*) from_nasal_helper(naContext c, naRef ref, const T*)
{ {
typedef typename nasal::shared_ptr_traits<T>::strong_ref strong_ref; typedef typename nasal::shared_ptr_traits<T>::strong_ref strong_ref;
return T(nasal::Ghost<strong_ref>::fromNasal(c, ref)); return T(nasal::Ghost<strong_ref>::fromNasalChecked(c, ref));
} }
/** /**
* Convert any pointer to a SGReferenced based object to a ghost. * Convert any pointer to a SGReferenced based object to a ghost.
*/ */
template<class T> template<class T>
typename boost::enable_if_c< typename boost::enable_if_c<
boost::is_base_of<SGReferenced, T>::value boost::is_base_of<SGReferenced, T>::value
|| boost::is_base_of<SGWeakReferenced, T>::value, || boost::is_base_of<SGWeakReferenced, T>::value,
naRef naRef
skipping to change at line 1458 skipping to change at line 1493
>::value >::value
|| boost::is_base_of< || boost::is_base_of<
SGWeakReferenced, SGWeakReferenced,
typename boost::remove_pointer<T>::type typename boost::remove_pointer<T>::type
>::value, >::value,
T T
>::type >::type
from_nasal_helper(naContext c, naRef ref, const T*) from_nasal_helper(naContext c, naRef ref, const T*)
{ {
typedef SGSharedPtr<typename boost::remove_pointer<T>::type> TypeRef; typedef SGSharedPtr<typename boost::remove_pointer<T>::type> TypeRef;
return T(nasal::Ghost<TypeRef>::fromNasal(c, ref)); return T(nasal::Ghost<TypeRef>::fromNasalChecked(c, ref));
} }
/** /**
* Convert any pointer to a osg::Referenced based object to a ghost. * Convert any pointer to a osg::Referenced based object to a ghost.
*/ */
template<class T> template<class T>
typename boost::enable_if< typename boost::enable_if<
boost::is_base_of<osg::Referenced, T>, boost::is_base_of<osg::Referenced, T>,
naRef naRef
>::type >::type
skipping to change at line 1485 skipping to change at line 1520
* Convert nasal ghosts/hashes to pointer (of a osg::Referenced based ghost ). * Convert nasal ghosts/hashes to pointer (of a osg::Referenced based ghost ).
*/ */
template<class T> template<class T>
typename boost::enable_if< typename boost::enable_if<
boost::is_base_of<osg::Referenced, typename boost::remove_pointer<T>::typ e>, boost::is_base_of<osg::Referenced, typename boost::remove_pointer<T>::typ e>,
T T
>::type >::type
from_nasal_helper(naContext c, naRef ref, const T*) from_nasal_helper(naContext c, naRef ref, const T*)
{ {
typedef osg::ref_ptr<typename boost::remove_pointer<T>::type> TypeRef; typedef osg::ref_ptr<typename boost::remove_pointer<T>::type> TypeRef;
return T(nasal::Ghost<TypeRef>::fromNasal(c, ref)); return T(nasal::Ghost<TypeRef>::fromNasalChecked(c, ref));
} }
#endif /* SG_NASAL_GHOST_HXX_ */ #endif /* SG_NASAL_GHOST_HXX_ */
 End of changes. 5 change blocks. 
4 lines changed or deleted 39 lines changed or added


 HTTPFileRequest.hxx   HTTPFileRequest.hxx 
///@file HTTP request writing response to a file. ///@file
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 30
#define SG_HTTP_FILEREQUEST_HXX_ #define SG_HTTP_FILEREQUEST_HXX_
#include "HTTPRequest.hxx" #include "HTTPRequest.hxx"
#include <fstream> #include <fstream>
namespace simgear namespace simgear
{ {
namespace HTTP namespace HTTP
{ {
/**
* HTTP request writing response to a file.
*/
class FileRequest: class FileRequest:
public Request public Request
{ {
public: public:
/** /**
* *
* @param url Adress to download from * @param url Adress to download from
* @param path Path to file for saving response * @param path Path to file for saving response
*/ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 HTTPMemoryRequest.hxx   HTTPMemoryRequest.hxx 
///@file HTTP request keeping response in memory. ///@file
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 30
#define SG_HTTP_MEMORYREQUEST_HXX_ #define SG_HTTP_MEMORYREQUEST_HXX_
#include "HTTPRequest.hxx" #include "HTTPRequest.hxx"
#include <fstream> #include <fstream>
namespace simgear namespace simgear
{ {
namespace HTTP namespace HTTP
{ {
/**
* HTTP request keeping response in memory.
*/
class MemoryRequest: class MemoryRequest:
public Request public Request
{ {
public: public:
/** /**
* *
* @param url Adress to download from * @param url Adress to download from
*/ */
MemoryRequest(const std::string& url); MemoryRequest(const std::string& url);
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 HTTPRequest.hxx   HTTPRequest.hxx 
///@file
//
// Copyright (C) 2011 James Turner <zakalawe@mac.com>
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
//
// 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, U
SA
#ifndef SG_HTTP_REQUEST_HXX #ifndef SG_HTTP_REQUEST_HXX
#define SG_HTTP_REQUEST_HXX #define SG_HTTP_REQUEST_HXX
#include <map> #include <map>
#include <simgear/structure/function_list.hxx> #include <simgear/structure/function_list.hxx>
#include <simgear/structure/map.hxx> #include <simgear/structure/map.hxx>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
class SGPropertyNode; class SGPropertyNode;
namespace simgear namespace simgear
{ {
namespace HTTP namespace HTTP
{ {
/**
* Base class for HTTP request (and answer).
*/
class Request: class Request:
public SGReferenced public SGReferenced
{ {
public: public:
typedef boost::function<void(Request*)> Callback; typedef boost::function<void(Request*)> Callback;
enum ReadyState enum ReadyState
{ {
UNSENT = 0, UNSENT = 0,
OPENED, OPENED,
 End of changes. 2 change blocks. 
0 lines changed or deleted 23 lines changed or added


 Layout.hxx   Layout.hxx 
// Basic class for canvas layouts /// @file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 30 skipping to change at line 30
#define SG_CANVAS_LAYOUT_HXX_ #define SG_CANVAS_LAYOUT_HXX_
#include "LayoutItem.hxx" #include "LayoutItem.hxx"
#include <vector> #include <vector>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/**
* Base class for all Canvas layouts.
*/
class Layout: class Layout:
public LayoutItem public LayoutItem
{ {
public: public:
void update();
virtual void invalidate();
virtual void setGeometry(const SGRecti& geom);
virtual void addItem(const LayoutItemRef& item) = 0; virtual void addItem(const LayoutItemRef& item) = 0;
virtual void setSpacing(int spacing) = 0; virtual void setSpacing(int spacing) = 0;
virtual int spacing() const = 0; virtual int spacing() const = 0;
/** /**
* Get the number of items. * Get the number of items.
*/ */
virtual size_t count() const = 0; virtual size_t count() const = 0;
/** /**
skipping to change at line 74 skipping to change at line 72
/** /**
* Remove the given @a item from the layout. * Remove the given @a item from the layout.
*/ */
void removeItem(const LayoutItemRef& item); void removeItem(const LayoutItemRef& item);
/** /**
* Remove all items. * Remove all items.
*/ */
virtual void clear(); virtual void clear();
/**
* Get the actual geometry of this layout given the rectangle \a geom
* taking into account the alignment flags and size hints. For layout
s,
* if no alignment (different to AlignFill) is set, the whole area is
* used. Excess space is distributed by the layouting algorithm and
* handled by the individual children.
*
* @param geom Area available to this layout.
* @return The resulting geometry for this layout.
*/
virtual SGRecti alignmentRect(const SGRecti& geom) const;
protected: protected:
enum LayoutFlags enum LayoutFlags
{ {
LAYOUT_DIRTY = LayoutItem::LAST_FLAG << 1, LAST_FLAG = LayoutItem::LAST_FLAG
LAST_FLAG = LAYOUT_DIRTY
}; };
struct ItemData struct ItemData
{ {
LayoutItemRef layout_item; LayoutItemRef layout_item;
int size_hint, int size_hint,
min_size, min_size,
max_size, max_size,
padding_orig, //<! original padding as specified by the use padding_orig, //!< original padding as specified by the use
r r
padding, //<! padding before element (layouted) padding, //!< padding before element (layouted)
size, //<! layouted size size, //!< layouted size
stretch; //<! stretch factor stretch; //!< stretch factor
bool has_hfw : 1, //<! height for width bool visible : 1,
done : 1; //<! layouting done has_align: 1, //!< Has alignment factor set (!= AlignFill)
has_hfw : 1, //!< height for width
done : 1; //!< layouting done
/** Clear values (reset to default/empty state) */ /** Clear values (reset to default/empty state) */
void reset(); void reset();
int hfw(int w) const; int hfw(int w) const;
int mhfw(int w) const; int mhfw(int w) const;
}; };
Layout();
virtual void contentsRectChanged(const SGRecti& rect);
/** /**
* Override to implement the actual layouting * Override to implement the actual layouting
*/ */
virtual void doLayout(const SGRecti& geom) = 0; virtual void doLayout(const SGRecti& geom) = 0;
/** /**
* Add two integers taking care of overflow (limit to INT_MAX)
*/
static void safeAdd(int& a, int b);
/**
* Distribute the available @a space to all @a items * Distribute the available @a space to all @a items
*/ */
void distribute(std::vector<ItemData>& items, const ItemData& space); void distribute(std::vector<ItemData>& items, const ItemData& space);
private: private:
int _num_not_done, //<! number of children not layouted yet int _num_not_done, //!< number of children not layouted yet
_sum_stretch, //<! sum of stretch factors of all not yet layoute _sum_stretch, //!< sum of stretch factors of all not yet layoute
d d
// children // children
_space_stretch,//<! space currently assigned to all not yet layou ted _space_stretch,//!< space currently assigned to all not yet layou ted
// stretchable children // stretchable children
_space_left; //<! remaining space not used by any child yet _space_left; //!< remaining space not used by any child yet
}; };
typedef SGSharedPtr<Layout> LayoutRef; typedef SGSharedPtr<Layout> LayoutRef;
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_LAYOUT_HXX_ */ #endif /* SG_CANVAS_LAYOUT_HXX_ */
 End of changes. 11 change blocks. 
25 lines changed or deleted 36 lines changed or added


 LayoutItem.hxx   LayoutItem.hxx 
///@file Basic element for layouting canvas elements ///@file
/// Basic element for layouting canvas elements.
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 38 skipping to change at line 39
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
class LayoutItem; class LayoutItem;
typedef SGSharedPtr<LayoutItem> LayoutItemRef; typedef SGSharedPtr<LayoutItem> LayoutItemRef;
typedef SGWeakPtr<LayoutItem> LayoutItemWeakRef; typedef SGWeakPtr<LayoutItem> LayoutItemWeakRef;
/** /**
* Holds the four margins for a rectangle.
*/
struct Margins
{
int l, t, r, b;
/**
* Set all margins to the same value @a m.
*/
explicit Margins(int m = 0);
/**
* Set horizontal and vertical margins to the same values @a h and @a v
* respectively.
*
* @param h Horizontal margins
* @param v Vertical margins
*/
Margins(int h, int v);
/**
* Set the margins to the given values.
*/
Margins(int left, int top, int right, int bottom);
/**
* Get the total horizontal margin (sum of left and right margin).
*/
int horiz() const;
/**
* Get the total vertical margin (sum of top and bottom margin).
*/
int vert() const;
/**
* Get total horizontal and vertical margin as vector.
*/
SGVec2i size() const;
/**
* Returns true if all margins are 0.
*/
bool isNull() const;
};
/**
* Flags for LayoutItem alignment inside {@link Layout Layouts}.
*
* @note You can only use one horizontal and one vertical flag at the sam
e.
*/
enum AlignmentFlag
{
#define ALIGN_ENUM_MAPPING(key, val, comment) key = val, /*!< comment */
# include "AlignFlag_values.hxx"
#undef ALIGN_ENUM_MAPPING
};
/**
* Base class for all layouting elements. Specializations either implemen t a * Base class for all layouting elements. Specializations either implemen t a
* layouting algorithm or a widget. * layouting algorithm or a widget.
*/ */
class LayoutItem: class LayoutItem:
public virtual SGVirtualWeakReferenced public virtual SGVirtualWeakReferenced
{ {
public: public:
/** Maximum item size (indicating no limit) */ /** Maximum item size (indicating no limit) */
static const SGVec2i MAX_SIZE; static const SGVec2i MAX_SIZE;
LayoutItem(); LayoutItem();
virtual ~LayoutItem(); virtual ~LayoutItem();
/** /**
* Set the margins to use by the layout system around the item.
*
* The margins define the size of the clear area around an item. It
* increases the size hints and reduces the size of the geometry()
* available to child layouts and widgets.
*
* @see Margins
*/
void setContentsMargins(const Margins& margins);
/**
* Set the individual margins.
*
* @see setContentsMargins(const Margins&)
*/
void setContentsMargins(int left, int top, int right, int bottom);
/**
* Set all margins to the same value.
*
* @see setContentsMargins(const Margins&)
*/
void setContentsMargin(int margin);
/**
* Get the currently used margins.
*
* @see setContentsMargins(const Margins&)
* @see Margins
*/
Margins getContentsMargins() const;
/**
* Get the area available to the contents.
*
* This is equal to the geometry() reduced by the sizes of the margin
s.
*
* @see setContentsMargins(const Margins&)
* @see geometry()
*/
SGRecti contentsRect() const;
/**
* Get the preferred size of this item. * Get the preferred size of this item.
*/ */
SGVec2i sizeHint() const; SGVec2i sizeHint() const;
/** /**
* Get the minimum amount of the space this item requires. * Get the minimum amount of the space this item requires.
*/ */
SGVec2i minimumSize() const; SGVec2i minimumSize() const;
/** /**
* Get the maximum amount of space this item can use. * Get the maximum amount of space this item can use.
*/ */
SGVec2i maximumSize() const; SGVec2i maximumSize() const;
/**
* Returns true if this items preferred and minimum height depend on
its
* width.
*
* The default implementation returns false. Reimplement for items
* providing height for width.
*
* @see heightForWidth()
* @see minimumHeightForWidth()
*/
virtual bool hasHeightForWidth() const; virtual bool hasHeightForWidth() const;
virtual int heightForWidth(int w) const;
virtual int minimumHeightForWidth(int w) const; /**
* Returns the preferred height for the given width @a w.
*
* Reimplement heightForWidthImpl() for items providing height for wi
dth.
*
* @see hasHeightForWidth()
*/
int heightForWidth(int w) const;
/**
* Returns the minimum height for the given width @a w.
*
* Reimplement minimumHeightForWidthImpl() for items providing height
for
* width.
*
* @see hasHeightForWidth()
*/
int minimumHeightForWidth(int w) const;
/**
* Set alignment of item within {@link Layout Layouts}.
*
* @param alignment Bitwise combination of vertical and horizontal
* alignment flags.
* @see AlignmentFlag
*/
void setAlignment(uint8_t alignment);
/**
* Get all alignment flags.
*
* @see AlignmentFlag
*/
uint8_t alignment() const;
virtual void setVisible(bool visible);
virtual bool isVisible() const;
bool isExplicitlyHidden() const;
void show() { setVisible(true); }
void hide() { setVisible(false); }
/** /**
* Mark all cached data as invalid and require it to be recalculated. * Mark all cached data as invalid and require it to be recalculated.
*/ */
virtual void invalidate(); virtual void invalidate();
/** /**
* Mark all cached data of parent item as invalid (if it is known) * Mark all cached data of parent item as invalid (if the parent is s et).
*/ */
void invalidateParent(); void invalidateParent();
/** /**
* Apply any changes not applied yet.
*/
void update();
/**
* Set position and size of this element. For layouts this triggers a * Set position and size of this element. For layouts this triggers a
* recalculation of the layout. * recalculation of the layout.
*/ */
virtual void setGeometry(const SGRecti& geom); virtual void setGeometry(const SGRecti& geom);
/** /**
* Get position and size of this element. * Get position and size of this element.
*/ */
virtual SGRecti geometry() const; virtual SGRecti geometry() const;
/** /**
* Get the actual geometry of this item given the rectangle \a geom
* taking into account the alignment flags and size hints.
*
* @param geom Area available to this item.
* @return The resulting geometry for this item.
*
* @see setAlignment()
* @see minimumSize()
* @see maximumSize()
* @see sizeHint()
*/
virtual SGRecti alignmentRect(const SGRecti& geom) const;
/**
* Set the canvas this item is attached to. * Set the canvas this item is attached to.
*/ */
virtual void setCanvas(const CanvasWeakPtr& canvas); virtual void setCanvas(const CanvasWeakPtr& canvas);
/** /**
* Get the canvas this item is attached to. * Get the canvas this item is attached to.
*/ */
CanvasPtr getCanvas() const; CanvasPtr getCanvas() const;
/** /**
skipping to change at line 127 skipping to change at line 300
friend class Canvas; friend class Canvas;
enum Flags enum Flags
{ {
SIZE_HINT_DIRTY = 1, SIZE_HINT_DIRTY = 1,
MINIMUM_SIZE_DIRTY = SIZE_HINT_DIRTY << 1, MINIMUM_SIZE_DIRTY = SIZE_HINT_DIRTY << 1,
MAXIMUM_SIZE_DIRTY = MINIMUM_SIZE_DIRTY << 1, MAXIMUM_SIZE_DIRTY = MINIMUM_SIZE_DIRTY << 1,
SIZE_INFO_DIRTY = SIZE_HINT_DIRTY SIZE_INFO_DIRTY = SIZE_HINT_DIRTY
| MINIMUM_SIZE_DIRTY | MINIMUM_SIZE_DIRTY
| MAXIMUM_SIZE_DIRTY, | MAXIMUM_SIZE_DIRTY,
LAST_FLAG = MAXIMUM_SIZE_DIRTY EXPLICITLY_HIDDEN = MAXIMUM_SIZE_DIRTY << 1,
VISIBLE = EXPLICITLY_HIDDEN << 1,
LAYOUT_DIRTY = VISIBLE << 1,
LAST_FLAG = LAYOUT_DIRTY
}; };
CanvasWeakPtr _canvas; CanvasWeakPtr _canvas;
LayoutItemWeakRef _parent; LayoutItemWeakRef _parent;
SGRecti _geometry; SGRecti _geometry;
Margins _margins;
uint8_t _alignment;
mutable uint32_t _flags; mutable uint32_t _flags;
mutable SGVec2i _size_hint, mutable SGVec2i _size_hint,
_min_size, _min_size,
_max_size; _max_size;
virtual SGVec2i sizeHintImpl() const; virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const; virtual SGVec2i minimumSizeImpl() const;
virtual SGVec2i maximumSizeImpl() const; virtual SGVec2i maximumSizeImpl() const;
/**
* Returns the preferred height for the given width @a w.
*
* The default implementation returns -1, indicating that the preferr
ed
* height is independent of the given width.
*
* Reimplement this function for items supporting height for width.
*
* @note Do not take margins into account, as this is already handled
* before calling this function.
*
* @see hasHeightForWidth()
*/
virtual int heightForWidthImpl(int w) const;
/**
* Returns the minimum height for the given width @a w.
*
* The default implementation returns -1, indicating that the minimum
* height is independent of the given width.
*
* Reimplement this function for items supporting height for width.
*
* @note Do not take margins into account, as this is already handled
* before calling this function.
*
* @see hasHeightForWidth()
*/
virtual int minimumHeightForWidthImpl(int w) const;
/**
* @return whether the visibility has changed.
*/
void setVisibleInternal(bool visible);
virtual void contentsRectChanged(const SGRecti& rect) {};
virtual void visibilityChanged(bool visible) {}
/**
* Allow calling the protected setVisibleImpl from derived classes
*/
static void callSetVisibleInternal(LayoutItem* item, bool visible);
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_LAYOUT_ITEM_HXX_ */ #endif /* SG_CANVAS_LAYOUT_ITEM_HXX_ */
 End of changes. 11 change blocks. 
5 lines changed or deleted 233 lines changed or added


 MouseEvent.hxx   MouseEvent.hxx 
///@file Mouse event ///@file
/// Mouse event
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef CANVAS_MOUSE_EVENT_HXX_ #ifndef CANVAS_MOUSE_EVENT_HXX_
#define CANVAS_MOUSE_EVENT_HXX_ #define CANVAS_MOUSE_EVENT_HXX_
#include <simgear/canvas/CanvasEvent.hxx> #include "DeviceEvent.hxx"
#include <osgGA/GUIEventAdapter>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/**
* Mouse (button/move/wheel) event
*/
class MouseEvent: class MouseEvent:
public Event public DeviceEvent
{ {
public: public:
MouseEvent(); MouseEvent();
MouseEvent(const osgGA::GUIEventAdapter& ea); MouseEvent(const osgGA::GUIEventAdapter& ea);
virtual bool canBubble() const; virtual bool canBubble() const;
osg::Vec2f getScreenPos() const { return screen_pos; } osg::Vec2f getScreenPos() const { return screen_pos; }
osg::Vec2f getClientPos() const { return client_pos; } osg::Vec2f getClientPos() const { return client_pos; }
osg::Vec2f getLocalPos() const { return local_pos; } osg::Vec2f getLocalPos() const { return local_pos; }
skipping to change at line 58 skipping to change at line 61
float getClientY() const { return client_pos.y(); } float getClientY() const { return client_pos.y(); }
float getLocalX() const { return local_pos.x(); } float getLocalX() const { return local_pos.x(); }
float getLocalY() const { return local_pos.y(); } float getLocalY() const { return local_pos.y(); }
float getDeltaX() const { return delta.x(); } float getDeltaX() const { return delta.x(); }
float getDeltaY() const { return delta.y(); } float getDeltaY() const { return delta.y(); }
int getButton() const { return button; } int getButton() const { return button; }
int getButtonMask() const { return buttons; } int getButtonMask() const { return buttons; }
int getModifiers() const { return modifiers; }
int getCurrentClickCount() const { return click_count; } int getCurrentClickCount() const { return click_count; }
osg::Vec2f screen_pos, //<! Position in screen coordinates osg::Vec2f screen_pos, //!< Position in screen coordinates
client_pos, //<! Position in window/canvas coordinates client_pos, //!< Position in window/canvas coordinates
local_pos, //<! Position in local/element coordinates local_pos, //!< Position in local/element coordinates
delta; delta;
int button, //<! Button for this event int button, //!< Button for this event
buttons, //<! Current button state buttons, //!< Current button state
modifiers, //<! Keyboard modifier state click_count; //!< Current click count
click_count; //<! Current click count
}; };
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* CANVAS_MOUSE_EVENT_HXX_ */ #endif /* CANVAS_MOUSE_EVENT_HXX_ */
 End of changes. 7 change blocks. 
12 lines changed or deleted 13 lines changed or added


 NasalCallContext.hxx   NasalCallContext.hxx 
skipping to change at line 35 skipping to change at line 35
namespace nasal namespace nasal
{ {
/** /**
* Context passed to a function/method being called from Nasal * Context passed to a function/method being called from Nasal
*/ */
class CallContext class CallContext
{ {
public: public:
CallContext(naContext c, size_t argc, naRef* args): CallContext(naContext c, naRef me, size_t argc, naRef* args):
c(c), c(c),
me(me),
argc(argc), argc(argc),
args(args) args(args)
{} {}
#define SG_CTX_CHECK_ARG(name, check)\ #define SG_CTX_CHECK_ARG(name, check)\
bool is##name(size_t index) const\ bool is##name(size_t index) const\
{\ {\
return (index < argc && naIs##check(args[index]));\ return (index < argc && naIs##check(args[index]));\
} }
skipping to change at line 123 skipping to change at line 124
} }
template<class T> template<class T>
typename from_nasal_ptr<T>::return_type typename from_nasal_ptr<T>::return_type
from_nasal(naRef ref) const from_nasal(naRef ref) const
{ {
return (*from_nasal_ptr<T>::get())(c, ref); return (*from_nasal_ptr<T>::get())(c, ref);
} }
naContext c; naContext c;
naRef me;
size_t argc; size_t argc;
naRef *args; naRef *args;
}; };
} // namespace nasal } // namespace nasal
#endif /* SG_NASAL_CALL_CONTEXT_HXX_ */ #endif /* SG_NASAL_CALL_CONTEXT_HXX_ */
 End of changes. 3 change blocks. 
1 lines changed or deleted 3 lines changed or added


 NasalContext.hxx   NasalContext.hxx 
///@file Manage lifetime and encapsulate a Nasal context ///@file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 27 skipping to change at line 27
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef SG_NASAL_CONTEXT_HXX_ #ifndef SG_NASAL_CONTEXT_HXX_
#define SG_NASAL_CONTEXT_HXX_ #define SG_NASAL_CONTEXT_HXX_
#include "NasalHash.hxx" #include "NasalHash.hxx"
namespace nasal namespace nasal
{ {
/**
* Manage lifetime and encapsulate a Nasal context.
*/
class Context class Context
{ {
public: public:
Context(); Context();
~Context(); ~Context();
operator naContext(); operator naContext();
Hash newHash(); Hash newHash();
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 NasalHash.hxx   NasalHash.hxx 
///@file Wrapper class for Nasal hashes ///@file
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 32 skipping to change at line 32
#include "from_nasal.hxx" #include "from_nasal.hxx"
#include "to_nasal.hxx" #include "to_nasal.hxx"
#include <simgear/structure/map.hxx> #include <simgear/structure/map.hxx>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
namespace nasal namespace nasal
{ {
/** /**
* A Nasal Hash * Wrapper class for Nasal hashes.
*/ */
class Hash class Hash
{ {
public: public:
template<bool> class Entry; template<bool> class Entry;
template<bool> class Iterator; template<bool> class Iterator;
typedef Entry<false> reference; typedef Entry<false> reference;
typedef Entry<true> const_reference; typedef Entry<true> const_reference;
skipping to change at line 121 skipping to change at line 121
)); ));
return from_nasal<T>(_context, get(name)); return from_nasal<T>(_context, get(name));
} }
/** /**
* Get member converted to callable object * Get member converted to callable object
* *
* @tparam Sig Function signature * @tparam Sig Function signature
* @param name Member name * @param name Member name
* @param key Member key
*/ */
template<class Sig, class Key> template<class Sig, class Key>
typename boost::enable_if< boost::is_function<Sig>, typename boost::enable_if< boost::is_function<Sig>,
boost::function<Sig> boost::function<Sig>
>::type >::type
get(const Key& name) const get(const Key& name) const
{ {
BOOST_STATIC_ASSERT(( boost::is_convertible<Key, naRef>::value BOOST_STATIC_ASSERT(( boost::is_convertible<Key, naRef>::value
|| boost::is_convertible<Key, std::string>::valu e || boost::is_convertible<Key, std::string>::valu e
)); ));
 End of changes. 3 change blocks. 
3 lines changed or deleted 2 lines changed or added


 NasalObject.hxx   NasalObject.hxx 
///@file Object exposed to Nasal including a Nasal hash for data storage. ///@file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U SA
#ifndef SG_NASAL_OBJECT_HXX_ #ifndef SG_NASAL_OBJECT_HXX_
#define SG_NASAL_OBJECT_HXX_ #define SG_NASAL_OBJECT_HXX_
#include "NasalContext.hxx"
#include "NasalObjectHolder.hxx" #include "NasalObjectHolder.hxx"
#include "Ghost.hxx" #include "Ghost.hxx"
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
namespace nasal namespace nasal
{ {
/**
* Object exposed to Nasal including a Nasal hash for data storage.
*/
class Object: class Object:
public virtual SGVirtualWeakReferenced public virtual SGVirtualWeakReferenced
{ {
public: public:
/** /**
* *
* @param impl Initial implementation hash (nasal part of * @param impl Initial implementation hash (nasal part of
* implementation) * implementation)
*/ */
Object(naRef impl = naNil()); Object(naRef impl = naNil());
void setImpl(naRef obj); void setImpl(naRef obj);
naRef getImpl() const; naRef getImpl() const;
bool valid() const; bool valid() const;
// Build dependency for CMake, gcc, etc.
#define SG_DONT_DO_ANYTHING
# include <simgear/nasal/cppbind/detail/NasalObject_callMethod_templates.hx
x>
#undef SG_DONT_DO_ANYTHING
#define BOOST_PP_ITERATION_LIMITS (0, 9)
#define BOOST_PP_FILENAME_1 <simgear/nasal/cppbind/detail/NasalObject_callM
ethod_templates.hxx>
#include BOOST_PP_ITERATE()
bool _set(naContext c, const std::string& key, naRef val); bool _set(naContext c, const std::string& key, naRef val);
bool _get(naContext c, const std::string& key, naRef& out); bool _get(naContext c, const std::string& key, naRef& out);
static void setupGhost(); static void setupGhost();
protected: protected:
ObjectHolder<> _nasal_impl; ObjectHolder<> _nasal_impl;
}; };
 End of changes. 5 change blocks. 
1 lines changed or deleted 19 lines changed or added


 NasalObjectHolder.hxx   NasalObjectHolder.hxx 
///@file Wrapper class for keeping Nasal objects save from the garbage coll ///@file
ector /// Wrapper class for keeping Nasal objects save from the garbage collector
.
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
 End of changes. 1 change blocks. 
2 lines changed or deleted 3 lines changed or added


 NasalString.hxx   NasalString.hxx 
///@file Wrapper class for Nasal strings ///@file
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 29 skipping to change at line 29
#ifndef SG_NASAL_STRING_HXX_ #ifndef SG_NASAL_STRING_HXX_
#define SG_NASAL_STRING_HXX_ #define SG_NASAL_STRING_HXX_
#include "from_nasal.hxx" #include "from_nasal.hxx"
#include "to_nasal.hxx" #include "to_nasal.hxx"
namespace nasal namespace nasal
{ {
/** /**
* A Nasal String * Wrapper class for Nasal strings.
*/ */
class String class String
{ {
public: public:
static const size_t npos; static const size_t npos;
/** /**
* Create a new Nasal String * Create a new Nasal String
* *
* @param c Nasal context for creating the string * @param c Nasal context for creating the string
* @param str String data * @param str String data
*/ */
String(naContext c, const char* str); String(naContext c, const char* str);
/** /**
* Initialize from an existing Nasal String * Initialize from an existing Nasal String
* *
* @param str Existing Nasal String * @param str Existing Nasal String
*/ */
String(naRef string); String(naRef str);
const char* c_str() const; const char* c_str() const;
const char* begin() const; const char* begin() const;
const char* end() const; const char* end() const;
size_t size() const; size_t size() const;
size_t length() const; size_t length() const;
bool empty() const; bool empty() const;
int compare(size_t pos, size_t len, const String& rhs) const; int compare(size_t pos, size_t len, const String& rhs) const;
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 NasalWidget.hxx   NasalWidget.hxx 
///@file Glue for GUI widgets implemented in Nasal space ///@file
/// Glue for GUI widgets implemented in Nasal space.
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 34 skipping to change at line 35
#include <simgear/nasal/cppbind/from_nasal.hxx> #include <simgear/nasal/cppbind/from_nasal.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx> #include <simgear/nasal/cppbind/NasalHash.hxx>
#include <simgear/nasal/cppbind/NasalObject.hxx> #include <simgear/nasal/cppbind/NasalObject.hxx>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
{ {
/** /**
* Baseclass/ghost to create widgets with Nasal. * Base class/ghost to implement gui widgets in Nasal space.
*/ */
class NasalWidget: class NasalWidget:
public LayoutItem, public LayoutItem,
public nasal::Object public nasal::Object
{ {
public: public:
typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometry Func; typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometry Func;
typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc; typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc;
/** /**
* *
* @param impl Initial implementation hash (nasal part of * @param impl Initial implementation hash (nasal part of
* implementation) * implementation)
*/ */
NasalWidget(naRef impl); NasalWidget(naRef impl);
~NasalWidget(); ~NasalWidget();
virtual void invalidate();
virtual void setGeometry(const SGRecti& geom);
virtual void onRemove(); virtual void onRemove();
void setSetGeometryFunc(const SetGeometryFunc& func); void setSetGeometryFunc(const SetGeometryFunc& func);
void setHeightForWidthFunc(const HeightForWidthFunc& func); void setHeightForWidthFunc(const HeightForWidthFunc& func);
void setMinimumHeightForWidthFunc(const HeightForWidthFunc& func); void setMinimumHeightForWidthFunc(const HeightForWidthFunc& func);
/** Set size hint. /** Set size hint.
* *
* Overrides default size hint. Set to (0, 0) to fall back to default size * Overrides default size hint. Set to (0, 0) to fall back to default size
* hint. * hint.
skipping to change at line 88 skipping to change at line 87
* Overrides default maximum size hint. Set to LayoutItem::MAX_SIZE t o * Overrides default maximum size hint. Set to LayoutItem::MAX_SIZE t o
* fall back to default maximum size. * fall back to default maximum size.
*/ */
void setMaximumSize(const SGVec2i& s); void setMaximumSize(const SGVec2i& s);
void setLayoutSizeHint(const SGVec2i& s); void setLayoutSizeHint(const SGVec2i& s);
void setLayoutMinimumSize(const SGVec2i& s); void setLayoutMinimumSize(const SGVec2i& s);
void setLayoutMaximumSize(const SGVec2i& s); void setLayoutMaximumSize(const SGVec2i& s);
virtual bool hasHeightForWidth() const; virtual bool hasHeightForWidth() const;
virtual int heightForWidth(int w) const;
virtual int minimumHeightForWidth(int w) const;
/** /**
* @param ns Namespace to register the class interface * @param ns Namespace to register the class interface
*/ */
static void setupGhost(nasal::Hash& ns); static void setupGhost(nasal::Hash& ns);
protected: protected:
enum WidgetFlags enum WidgetFlags
{ {
LAYOUT_DIRTY = LayoutItem::LAST_FLAG << 1, LAYOUT_DIRTY = LayoutItem::LAST_FLAG << 1,
skipping to change at line 121 skipping to change at line 118
_user_min_size, _user_min_size,
_user_max_size; _user_max_size;
int callHeightForWidthFunc( const HeightForWidthFunc& hfw, int callHeightForWidthFunc( const HeightForWidthFunc& hfw,
int w ) const; int w ) const;
virtual SGVec2i sizeHintImpl() const; virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const; virtual SGVec2i minimumSizeImpl() const;
virtual SGVec2i maximumSizeImpl() const; virtual SGVec2i maximumSizeImpl() const;
virtual int heightForWidthImpl(int w) const;
virtual int minimumHeightForWidthImpl(int w) const;
virtual void contentsRectChanged(const SGRecti& rect);
virtual void visibilityChanged(bool visible);
}; };
typedef SGSharedPtr<NasalWidget> NasalWidgetRef; typedef SGSharedPtr<NasalWidget> NasalWidgetRef;
} // namespace canvas } // namespace canvas
} // namespace simgear } // namespace simgear
#endif /* SG_CANVAS_NASAL_WIDGET_HXX_ */ #endif /* SG_CANVAS_NASAL_WIDGET_HXX_ */
 End of changes. 5 change blocks. 
6 lines changed or deleted 10 lines changed or added


 OsgDebug.hxx   OsgDebug.hxx 
///@file Helper for OSG related debugging ///@file
/// Helper for OSG related debugging
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
 End of changes. 1 change blocks. 
1 lines changed or deleted 2 lines changed or added


 PropertyBasedElement.hxx   PropertyBasedElement.hxx 
skipping to change at line 42 skipping to change at line 42
public SGPropertyChangeListener, public SGPropertyChangeListener,
public virtual SGVirtualWeakReferenced public virtual SGVirtualWeakReferenced
{ {
public: public:
PropertyBasedElement(SGPropertyNode* node); PropertyBasedElement(SGPropertyNode* node);
virtual ~PropertyBasedElement(); virtual ~PropertyBasedElement();
/** /**
* Remove the property listener of the element. * Remove the property listener of the element.
* *
* You will need to call the appropriate methods (#childAdded, * You will need to call the appropriate methods (childAdded(),
* #childRemoved, #valueChanged) yourself to ensure the element still * childRemoved(), valueChanged()) yourself to ensure the element sti
ll
* receives the needed events. * receives the needed events.
*/ */
void removeListener(); void removeListener();
/** /**
* Destroys this element (removes node from property tree) * Destroys this element (removes node from property tree)
*/ */
void destroy(); void destroy();
virtual void update(double delta_time_sec) = 0; virtual void update(double delta_time_sec) = 0;
 End of changes. 1 change blocks. 
2 lines changed or deleted 3 lines changed or added


 SGBinding.hxx   SGBinding.hxx 
skipping to change at line 43 skipping to change at line 43
public: public:
/** /**
* Default constructor. * Default constructor.
*/ */
SGBinding (); SGBinding ();
/** /**
* Convenience constructor. * Convenience constructor.
* *
* @param node The binding will be built from this node. * @param commandName TODO
*/ */
SGBinding(const std::string& commandName); SGBinding(const std::string& commandName);
/** /**
* Convenience constructor. * Convenience constructor.
* *
* @param node The binding will be built from this node. * @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 );
/** /**
* Destructor. * Destructor.
*/ */
virtual ~SGBinding (); virtual ~SGBinding ();
/** /**
* clear internal state of the binding back to empty. This is useful * clear internal state of the binding back to empty. This is useful
* if you don't want the 'remove on delete' behaviour of the * if you don't want the 'remove on delete' behaviour of the
* destructor. * destructor.
skipping to change at line 93 skipping to change at line 95
* *
* @return A property node that will be passed to the command as its * @return A property node that will be passed to the command as its
* argument, or 0 if none was supplied. * argument, or 0 if none was supplied.
*/ */
const SGPropertyNode * getArg () { return _arg; } const SGPropertyNode * getArg () { return _arg; }
/** /**
* Read a binding from a property node. * Read a binding from a property node.
* *
* @param node The property node containing the binding. * @param node The property node containing the binding.
* @param root The property root node used while building the binding fro
m
* \a node.
*/ */
void read (const SGPropertyNode * node, SGPropertyNode* root); void read (const SGPropertyNode * node, SGPropertyNode* root);
/** /**
* Fire a binding. * Fire a binding.
*/ */
void fire () const; void fire () const;
/** /**
* Fire a binding with a scaled movement (rather than absolute position). * Fire a binding with a scaled movement (rather than absolute position).
 End of changes. 4 change blocks. 
2 lines changed or deleted 7 lines changed or added


 SGGuard.hxx   SGGuard.hxx 
skipping to change at line 16 skipping to change at line 16
* An SGGuard object locks its synchronization object during creation and * An SGGuard object locks its synchronization object during creation and
* automatically unlocks it when it goes out of scope. * automatically unlocks it when it goes out of scope.
*/ */
template<class SGLOCK> template<class SGLOCK>
class SGGuard class SGGuard
{ {
public: public:
/** /**
* Create an SGGuard object and lock the passed lockable object. * 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(); } 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(); } inline ~SGGuard() { lock.unlock(); }
private: private:
/** SGLOCK& lock; //!< A lockable object
* A lockable object.
*/
SGLOCK& lock;
private: private:
// Disable copying. // Disable copying.
SGGuard(const SGLOCK&); SGGuard(const SGLOCK&);
SGLOCK& operator= (const SGLOCK&); SGLOCK& operator= (const SGLOCK&);
}; };
#endif // SGGUARD_HXX_INCLUDED #endif // SGGUARD_HXX_INCLUDED
 End of changes. 3 change blocks. 
6 lines changed or deleted 3 lines changed or added


 SGMisc.hxx   SGMisc.hxx 
skipping to change at line 44 skipping to change at line 44
{ return a > b ? a : b; } { return a > b ? a : b; }
static T max(const T& a, const T& b, const T& c) static T max(const T& a, const T& b, const T& c)
{ return max(max(a, b), c); } { return max(max(a, b), c); }
static T max(const T& a, const T& b, const T& c, const T& d) static T max(const T& a, const T& b, const T& c, const T& d)
{ return max(max(max(a, b), c), d); } { return max(max(max(a, b), c), d); }
// clip the value of a to be in the range between and including _min and _max // clip the value of a to be in the range between and including _min and _max
static T clip(const T& a, const T& _min, const T& _max) static T clip(const T& a, const T& _min, const T& _max)
{ return max(_min, min(_max, a)); } { return max(_min, min(_max, a)); }
/// Add two (integer) values taking care of overflows.
static T addClipOverflow(T a, T b)
{
if( b > 0 )
{
if( SGLimits<T>::max() - b < a )
return SGLimits<T>::max();
}
else
{
if( SGLimits<T>::min() - b > a )
return SGLimits<T>::min();
}
return a + b;
}
/// Add two (integer) values in place, taking care of overflows.
static T& addClipOverflowInplace(T& a, T b)
{
return a = addClipOverflow(a, b);
}
/** /**
* Seek a variable towards a target value with given rate and timestep * Seek a variable towards a target value with given rate and timestep
* *
* @param var Variable or eg. SGPropObj * @param var Variable or eg. SGPropObj
* @param target Target value * @param target Target value
* @param rate Max. change rate/sec * @param rate Max. change rate/sec
* @param dt Time step (sec) * @param dt Time step (sec)
*/ */
template<class Var> template<class Var>
static T seek(Var& var, T target, T rate, T dt) static T seek(Var& var, T target, T rate, T dt)
 End of changes. 1 change blocks. 
0 lines changed or deleted 23 lines changed or added


 SGQueue.hxx   SGQueue.hxx 
skipping to change at line 41 skipping to change at line 41
/** /**
* Returns whether this queue is empty (contains no elements). * Returns whether this queue is empty (contains no elements).
* *
* @return bool True if queue is empty, otherwisr false. * @return bool True if queue is empty, otherwisr false.
*/ */
virtual bool empty() = 0; virtual bool empty() = 0;
/** /**
* Add an item to the end of the queue. * 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; virtual void push( const T& item ) = 0;
/** /**
* View the item from the head of the queue. * View the item from the head of the queue.
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T front() = 0; virtual T front() = 0;
/** /**
* Get an item from the head of the queue. * Get an item from the head of the queue.
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T pop() = 0; virtual T pop() = 0;
/** /**
* Query the size of the queue * Query the size of the queue
* *
* @return size_t size of queue. * @return size_t size of queue.
*/ */
virtual size_t size() = 0; virtual size_t size() = 0;
skipping to change at line 89 skipping to change at line 89
public: public:
/** /**
* Create a new SGLockedQueue object. * Create a new SGLockedQueue object.
*/ */
SGLockedQueue() {} SGLockedQueue() {}
/** /**
* Destroy this object. * Destroy this object.
*/ */
~SGLockedQueue() {} virtual ~SGLockedQueue() {}
/** /**
* Returns whether this queue is empty (contains no elements). * 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() { virtual bool empty() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->fifo.empty(); return this->fifo.empty();
} }
/** /**
* Add an item to the end of the queue. * 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 ) { virtual void push( const T& item ) {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
this->fifo.push( item ); this->fifo.push( item );
} }
/** /**
* View the item from the head of the queue. * View the item from the head of the queue.
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T front() { virtual T front() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
assert( ! this->fifo.empty() ); assert( ! this->fifo.empty() );
T item = this->fifo.front(); T item = this->fifo.front();
return item; return item;
} }
/** /**
* Get an item from the head of the queue. * Get an item from the head of the queue.
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T pop() { virtual T pop() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
if (this->fifo.empty()) return T(); // assumes T is default cons tructable if (this->fifo.empty()) return T(); // assumes T is default cons tructable
// if (fifo.empty()) // if (fifo.empty())
// { // {
// mutex.unlock(); // mutex.unlock();
// pthread_exit( PTHREAD_CANCELED ); // pthread_exit( PTHREAD_CANCELED );
// } // }
T item = this->fifo.front(); T item = this->fifo.front();
this->fifo.pop(); this->fifo.pop();
return item; return item;
} }
/** /**
* Query the size of the queue * Query the size of the queue
* *
* @return size_t size of queue. * @return Size of queue.
*/ */
virtual size_t size() { virtual size_t size() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->fifo.size(); return this->fifo.size();
} }
private: private:
/** /**
* Mutex to serialise access. * Mutex to serialise access.
skipping to change at line 181 skipping to change at line 181
{ {
public: public:
/** /**
* Create a new SGBlockingQueue. * Create a new SGBlockingQueue.
*/ */
SGBlockingQueue() {} SGBlockingQueue() {}
/** /**
* Destroy this queue. * Destroy this queue.
*/ */
~SGBlockingQueue() {} virtual ~SGBlockingQueue() {}
/** /**
* *
*/ */
virtual bool empty() { virtual bool empty() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->fifo.empty(); return this->fifo.empty();
} }
/** /**
* Add an item to the end of the queue. * 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 ) { virtual void push( const T& item ) {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
this->fifo.push( item ); this->fifo.push( item );
not_empty.signal(); not_empty.signal();
} }
/** /**
* View the item from the head of the queue. * View the item from the head of the queue.
* Calling thread is not suspended * Calling thread is not suspended
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T front() { virtual T front() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
assert(this->fifo.empty() != true); assert(this->fifo.empty() != true);
//if (fifo.empty()) throw ?? //if (fifo.empty()) throw ??
T item = this->fifo.front(); T item = this->fifo.front();
return item; return item;
} }
/** /**
* Get an item from the head of the queue. * Get an item from the head of the queue.
* If no items are available then the calling thread is suspended * If no items are available then the calling thread is suspended
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T pop() { virtual T pop() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
while (this->fifo.empty()) while (this->fifo.empty())
not_empty.wait(mutex); not_empty.wait(mutex);
assert(this->fifo.empty() != true); assert(this->fifo.empty() != true);
//if (fifo.empty()) throw ?? //if (fifo.empty()) throw ??
T item = this->fifo.front(); T item = this->fifo.front();
this->fifo.pop(); this->fifo.pop();
return item; return item;
} }
/** /**
* Query the size of the queue * Query the size of the queue
* *
* @return size_t size of queue. * @return Size of queue.
*/ */
virtual size_t size() { virtual size_t size() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->fifo.size(); return this->fifo.size();
} }
private: private:
/** /**
* Mutex to serialise access. * Mutex to serialise access.
skipping to change at line 282 skipping to change at line 282
{ {
public: public:
/** /**
* Create a new SGBlockingDequeue. * Create a new SGBlockingDequeue.
*/ */
SGBlockingDeque() {} SGBlockingDeque() {}
/** /**
* Destroy this dequeue. * Destroy this dequeue.
*/ */
~SGBlockingDeque() {} virtual ~SGBlockingDeque() {}
/** /**
* *
*/ */
virtual void clear() { virtual void clear() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
this->queue.clear(); this->queue.clear();
} }
/** /**
* *
*/ */
virtual bool empty() { virtual bool empty() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->queue.empty(); return this->queue.empty();
} }
/** /**
* Add an item to the front of the queue. * 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 ) { virtual void push_front( const T& item ) {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
this->queue.push_front( item ); this->queue.push_front( item );
not_empty.signal(); not_empty.signal();
} }
/** /**
* Add an item to the back of the queue. * 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 ) { virtual void push_back( const T& item ) {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
this->queue.push_back( item ); this->queue.push_back( item );
not_empty.signal(); not_empty.signal();
} }
/** /**
* View the item from the head of the queue. * View the item from the head of the queue.
* Calling thread is not suspended * Calling thread is not suspended
* *
* @return T next available object. * @return The next available object.
*/ */
virtual T front() { virtual T front() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
assert(this->queue.empty() != true); assert(this->queue.empty() != true);
//if (queue.empty()) throw ?? //if (queue.empty()) throw ??
T item = this->queue.front(); T item = this->queue.front();
return item; return item;
} }
/** /**
* Get an item from the head of the queue. * Get an item from the head of the queue.
* If no items are available then the calling thread is suspended * 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() { virtual T pop_front() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
while (this->queue.empty()) while (this->queue.empty())
not_empty.wait(mutex); not_empty.wait(mutex);
assert(this->queue.empty() != true); assert(this->queue.empty() != true);
//if (queue.empty()) throw ?? //if (queue.empty()) throw ??
T item = this->queue.front(); T item = this->queue.front();
this->queue.pop_front(); this->queue.pop_front();
return item; return item;
} }
/** /**
* Get an item from the tail of the queue. * Get an item from the tail of the queue.
* If no items are available then the calling thread is suspended * 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() { virtual T pop_back() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
while (this->queue.empty()) while (this->queue.empty())
not_empty.wait(mutex); not_empty.wait(mutex);
assert(this->queue.empty() != true); assert(this->queue.empty() != true);
//if (queue.empty()) throw ?? //if (queue.empty()) throw ??
T item = this->queue.back(); T item = this->queue.back();
this->queue.pop_back(); this->queue.pop_back();
return item; return item;
} }
/** /**
* Query the size of the queue * Query the size of the queue
* *
* @return size_t size of queue. * @return Size of queue.
*/ */
virtual size_t size() { virtual size_t size() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
return this->queue.size(); return this->queue.size();
} }
void waitOnNotEmpty() { void waitOnNotEmpty() {
SGGuard<SGMutex> g(mutex); SGGuard<SGMutex> g(mutex);
while (this->queue.empty()) while (this->queue.empty())
not_empty.wait(mutex); not_empty.wait(mutex);
 End of changes. 21 change blocks. 
21 lines changed or deleted 21 lines changed or added


 SGSharedPtr.hxx   SGSharedPtr.hxx 
/* -*-c++-*- ///@file
* /// Pointer proxy doing reference counting.
* Copyright (C) 2005-2012 Mathias Froehlich //
* // 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 // This library is free software; you can redistribute it and/or
* published by the Free Software Foundation; either version 2 of the // modify it under the terms of the GNU Library General Public
* License, or (at your option) any later version. // 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,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // but WITHOUT ANY WARRANTY; without even the implied warranty of
* General Public License for more details. // 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 General Public License //
* along with this program; if not, write to the Free Software // You should have received a copy of the GNU Library General Public
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 // License along with this library; if not, write to the Free Software
1, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
* SA.
*/
#ifndef SGSharedPtr_HXX #ifndef SGSharedPtr_HXX
#define SGSharedPtr_HXX #define SGSharedPtr_HXX
#include "SGReferenced.hxx" #include "SGReferenced.hxx"
#include <algorithm> #include <algorithm>
template<typename T> template<typename T>
class SGWeakPtr; class SGWeakPtr;
/// This class is a pointer proxy doing reference counting on the object /// This class is a pointer proxy doing reference counting on the object
/// it is pointing to. /// it is pointing to.
/// The SGSharedPtr class handles reference counting and possible /// The SGSharedPtr class handles reference counting and possible
/// destruction if no nore references are in use automatically. /// 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 /// 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. /// 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 /// Such a reference is initialized by zero if not initialized with a
/// class pointer. /// class pointer.
/// One thing you need to avoid are cyclic loops with such pointers. /// One thing you need to avoid are cyclic loops with such pointers.
/// As long as such a cyclic loop exists the reference count never drops /// As long as such a cyclic loop exists the reference count never drops
/// to zero and consequently the objects will never be destroyed. /// to zero and consequently the objects will never be destroyed.
/// Always try to use directed graphs where the references away from the /// Always try to use directed graphs where the references away from the
/// top node are made with SGSharedPtr's and the back references are done w ith /// top node are made with SGSharedPtr's and the back references are done w ith
/// ordinary pointers or SGWeakPtr's. /// ordinary pointers or SGWeakPtr's.
 End of changes. 2 change blocks. 
21 lines changed or deleted 20 lines changed or added


 SGTexturedTriangleBin.hxx   SGTexturedTriangleBin.hxx 
skipping to change at line 25 skipping to change at line 25
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
* *
*/ */
#ifndef SG_TEXTURED_TRIANGLE_BIN_HXX #ifndef SG_TEXTURED_TRIANGLE_BIN_HXX
#define SG_TEXTURED_TRIANGLE_BIN_HXX #define SG_TEXTURED_TRIANGLE_BIN_HXX
#define MAX_RANDOM_OBJECTS 100.0
#include <osg/Array> #include <osg/Array>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/PrimitiveSet> #include <osg/PrimitiveSet>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <stdio.h> #include <stdio.h>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/scene/util/OsgMath.hxx> #include <simgear/scene/util/OsgMath.hxx>
#include "SGTriangleBin.hxx" #include "SGTriangleBin.hxx"
skipping to change at line 103 skipping to change at line 105
}; };
// Use a DrawElementsUShort if there are few enough vertices, // Use a DrawElementsUShort if there are few enough vertices,
// otherwise fallback to DrawElementsUInt. Hide the differences // otherwise fallback to DrawElementsUInt. Hide the differences
// between the two from the rest of the code. // between the two from the rest of the code.
// //
// We don't bother with DrawElementsUByte because that is generally // We don't bother with DrawElementsUByte because that is generally
// not an advantage on modern hardware. // not an advantage on modern hardware.
class DrawElementsFacade { class DrawElementsFacade {
public: public:
DrawElementsFacade(unsigned numVerts) : DrawElementsFacade(void) : count(0)
_ushortElements(0), _uintElements(0)
{ {
if (numVerts > 65535) _uintElements = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANG
_uintElements LES);
= new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES); _ushortElements = new osg::DrawElementsUShort(osg::PrimitiveSet::TR
else IANGLES);
_ushortElements
= new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES)
;
} }
void push_back(unsigned val) void push_back(unsigned val)
{ {
if (_uintElements) count++;
_uintElements->push_back(val); if (count < 65536) {
else
_ushortElements->push_back(val); _ushortElements->push_back(val);
}
_uintElements->push_back(val);
} }
osg::DrawElements* getDrawElements() osg::DrawElements* getDrawElements()
{ {
if (_uintElements) if (count > 65535) {
free (_ushortElements);
return _uintElements; return _uintElements;
return _ushortElements; } else {
free (_uintElements);
return _ushortElements;
}
} }
protected: protected:
osg::DrawElementsUShort* _ushortElements; osg::DrawElementsUShort* _ushortElements;
osg::DrawElementsUInt* _uintElements; osg::DrawElementsUInt* _uintElements;
unsigned count;
}; };
class SGTexturedTriangleBin : public SGTriangleBin<SGVertNormTex> { class SGTexturedTriangleBin : public SGTriangleBin<SGVertNormTex> {
public: public:
SGTexturedTriangleBin() SGTexturedTriangleBin()
{ {
mt_init(&seed, 123); mt_init(&seed, 123);
has_sec_tcs = false; has_sec_tcs = false;
} }
skipping to change at line 292 skipping to change at line 295
} }
} }
} }
} }
void addRandomPoints(double coverage, void addRandomPoints(double coverage,
double spacing, double spacing,
osg::Texture2D* object_mask, osg::Texture2D* object_mask,
std::vector<std::pair<SGVec3f, float> >& points) std::vector<std::pair<SGVec3f, float> >& points)
{ {
unsigned num = getNumTriangles(); unsigned numtriangles = getNumTriangles();
for (unsigned i = 0; i < num; ++i) { for (unsigned i = 0; i < numtriangles; ++i) {
triangle_ref triangleRef = getTriangleRef(i); triangle_ref triangleRef = getTriangleRef(i);
SGVec3f v0 = getVertex(triangleRef[0]).GetVertex(); SGVec3f v0 = getVertex(triangleRef[0]).GetVertex();
SGVec3f v1 = getVertex(triangleRef[1]).GetVertex(); SGVec3f v1 = getVertex(triangleRef[1]).GetVertex();
SGVec3f v2 = getVertex(triangleRef[2]).GetVertex(); SGVec3f v2 = getVertex(triangleRef[2]).GetVertex();
SGVec2f t0 = getVertex(triangleRef[0]).GetTexCoord(0); SGVec2f t0 = getVertex(triangleRef[0]).GetTexCoord(0);
SGVec2f t1 = getVertex(triangleRef[1]).GetTexCoord(0); SGVec2f t1 = getVertex(triangleRef[1]).GetTexCoord(0);
SGVec2f t2 = getVertex(triangleRef[2]).GetTexCoord(0); SGVec2f t2 = getVertex(triangleRef[2]).GetTexCoord(0);
SGVec3f normal = cross(v1 - v0, v2 - v0); SGVec3f normal = cross(v1 - v0, v2 - v0);
// Compute the area // Compute the area
float area = 0.5f*length(normal); float area = 0.5f*length(normal);
if (area <= SGLimitsf::min()) if (area <= SGLimitsf::min())
continue; continue;
// for partial units of area, use a zombie door method to // for partial units of area, use a zombie door method to
// create the proper random chance of an object being created // create the proper random chance of an object being created
// for this triangle. // for this triangle.
double num = area / coverage + mt_rand(&seed); double num = area / coverage + mt_rand(&seed);
if (num > MAX_RANDOM_OBJECTS) {
SG_LOG(SG_TERRAIN, SG_ALERT,
"Per-triangle random object count exceeded limits ("
<< MAX_RANDOM_OBJECTS << ") " << num);
num = MAX_RANDOM_OBJECTS;
}
// place an object each unit of area // place an object each unit of area
while ( num > 1.0 ) { while ( num > 1.0 ) {
float a = mt_rand(&seed); float a = mt_rand(&seed);
float b = mt_rand(&seed); float b = mt_rand(&seed);
if ( a + b > 1 ) { if ( a + b > 1 ) {
a = 1 - a; a = 1 - a;
b = 1 - b; b = 1 - b;
} }
float c = 1 - a - b; float c = 1 - a - b;
SGVec3f randomPoint = a*v0 + b*v1 + c*v2; SGVec3f randomPoint = a*v0 + b*v1 + c*v2;
skipping to change at line 390 skipping to change at line 400
if ( has_sec_tcs ) { if ( has_sec_tcs ) {
geometry->setTexCoordArray(0, priTexCoords); geometry->setTexCoordArray(0, priTexCoords);
geometry->setTexCoordArray(1, secTexCoords); geometry->setTexCoordArray(1, secTexCoords);
} else { } else {
geometry->setTexCoordArray(0, priTexCoords); geometry->setTexCoordArray(0, priTexCoords);
} }
const unsigned invalid = ~unsigned(0); const unsigned invalid = ~unsigned(0);
std::vector<unsigned> indexMap(getNumVertices(), invalid); std::vector<unsigned> indexMap(getNumVertices(), invalid);
DrawElementsFacade deFacade(vertices->size()); DrawElementsFacade deFacade;
for (index_type i = 0; i < triangles.size(); ++i) { for (index_type i = 0; i < triangles.size(); ++i) {
triangle_ref triangle = triangles[i]; triangle_ref triangle = triangles[i];
if (indexMap[triangle[0]] == invalid) { if (indexMap[triangle[0]] == invalid) {
indexMap[triangle[0]] = vertices->size(); indexMap[triangle[0]] = vertices->size();
vertices->push_back(toOsg(getVertex(triangle[0]).GetVertex())); vertices->push_back(toOsg(getVertex(triangle[0]).GetVertex()));
normals->push_back(toOsg(getVertex(triangle[0]).GetNormal())); normals->push_back(toOsg(getVertex(triangle[0]).GetNormal()));
priTexCoords->push_back(toOsg(getVertex(triangle[0]).GetTexCoord(0) )); priTexCoords->push_back(toOsg(getVertex(triangle[0]).GetTexCoord(0) ));
if ( has_sec_tcs ) { if ( has_sec_tcs ) {
secTexCoords->push_back(toOsg(getVertex(triangle[0]).GetTexCoor d(1))); secTexCoords->push_back(toOsg(getVertex(triangle[0]).GetTexCoor d(1)));
} }
 End of changes. 11 change blocks. 
17 lines changed or deleted 28 lines changed or added


 SGThread.hxx   SGThread.hxx 
skipping to change at line 149 skipping to change at line 149
SGWaitCondition(); SGWaitCondition();
/** /**
* Destroy the condition object. * Destroy the condition object.
*/ */
~SGWaitCondition(); ~SGWaitCondition();
/** /**
* Wait for this condition variable to be signaled. * 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 * Wait for this condition variable to be signaled for at most \a 'msec
* 'ms' milliseconds. '
* milliseconds.
* *
* @param mutex reference to a locked mutex. * @param mutex Reference to a locked mutex.
* @param ms milliseconds to wait for a signal. * @param msec Milliseconds to wait for a signal.
* *
* @return * @return
*/ */
bool wait(SGMutex& mutex, unsigned msec); bool wait(SGMutex& mutex, unsigned msec);
/** /**
* Wake one thread waiting on this condition variable. * Wake one thread waiting on this condition variable.
* Nothing happens if no threads are waiting. * Nothing happens if no threads are waiting.
* If several threads are waiting exactly one thread is restarted. It * If several threads are waiting exactly one thread is restarted. It
* is not specified which. * is not specified which.
 End of changes. 4 change blocks. 
6 lines changed or deleted 7 lines changed or added


 SGVasiDrawable.hxx   SGVasiDrawable.hxx 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
* *
*/ */
#ifndef _SG_VASI_DRAWABLE_HXX #ifndef _SG_VASI_DRAWABLE_HXX
#define _SG_VASI_DRAWABLE_HXX #define _SG_VASI_DRAWABLE_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/SGMath.hxx>
#include <osg/Drawable> #include <osg/Drawable>
#include <simgear/math/SGMath.hxx> #include <osg/Version>
class SGVasiDrawable : public osg::Drawable { class SGVasiDrawable : public osg::Drawable {
struct LightData; struct LightData;
public: public:
META_Object(SimGear, SGVasiDrawable); META_Object(SimGear, SGVasiDrawable);
SGVasiDrawable(const SGVasiDrawable&, const osg::CopyOp&); SGVasiDrawable(const SGVasiDrawable&, const osg::CopyOp&);
SGVasiDrawable(const SGVec4f& red = SGVec4f(1, 0, 0, 1), SGVasiDrawable(const SGVec4f& red = SGVec4f(1, 0, 0, 1),
const SGVec4f& white = SGVec4f(1, 1, 1, 1)); const SGVec4f& white = SGVec4f(1, 1, 1, 1));
/// Add a red/white switching light pointing into the direction that /// Add a red/white switching light pointing into the direction that
skipping to change at line 52 skipping to change at line 53
void addLight(const SGVec3f& position, const SGVec3f& normal, void addLight(const SGVec3f& position, const SGVec3f& normal,
const SGVec3f& up, float azimutDeg); const SGVec3f& up, float azimutDeg);
/// add a red/white switching light pointing towards normal /// add a red/white switching light pointing towards normal
/// at the given position with the given up vector. The up direction /// at the given position with the given up vector. The up direction
/// is the world up direction that defines the horizontal plane. /// is the world up direction that defines the horizontal plane.
void addLight(const SGVec3f& position, const SGVec3f& normal, void addLight(const SGVec3f& position, const SGVec3f& normal,
const SGVec3f& up); const SGVec3f& up);
virtual void drawImplementation(osg::RenderInfo& renderInfo) const; virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const; virtual osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2)
computeBound()
#else
computeBoundingBox()
#endif
const;
private: private:
SGVec4f getColor(float angleDeg) const; SGVec4f getColor(float angleDeg) const;
void draw(const SGVec3f& eyePoint, const LightData& light) const; void draw(const SGVec3f& eyePoint, const LightData& light) const;
std::vector<LightData> _lights; std::vector<LightData> _lights;
SGVec4f _red; SGVec4f _red;
SGVec4f _white; SGVec4f _white;
}; };
 End of changes. 3 change blocks. 
2 lines changed or deleted 9 lines changed or added


 SGVec2.hxx   SGVec2.hxx 
skipping to change at line 199 skipping to change at line 199
inline inline
SGVec2<T> SGVec2<T>
max(const SGVec2<T>& v, S s) max(const SGVec2<T>& v, S s)
{ return SGVec2<T>(SGMisc<T>::max(s, v(0)), SGMisc<T>::max(s, v(1))); } { return SGVec2<T>(SGMisc<T>::max(s, v(0)), SGMisc<T>::max(s, v(1))); }
template<typename S, typename T> template<typename S, typename T>
inline inline
SGVec2<T> SGVec2<T>
max(S s, const SGVec2<T>& v) max(S s, const SGVec2<T>& v)
{ return SGVec2<T>(SGMisc<T>::max(s, v(0)), SGMisc<T>::max(s, v(1))); } { return SGVec2<T>(SGMisc<T>::max(s, v(0)), SGMisc<T>::max(s, v(1))); }
/// Add two vectors taking care of (integer) overflows. The values are limi
ted
/// to the respective minimum and maximum values.
template<class T>
SGVec2<T> addClipOverflow(SGVec2<T> const& lhs, SGVec2<T> const& rhs)
{
return SGVec2<T>(
SGMisc<T>::addClipOverflow(lhs.x(), rhs.x()),
SGMisc<T>::addClipOverflow(lhs.y(), rhs.y())
);
}
/// Scalar dot product /// Scalar dot product
template<typename T> template<typename T>
inline inline
T T
dot(const SGVec2<T>& v1, const SGVec2<T>& v2) dot(const SGVec2<T>& v1, const SGVec2<T>& v2)
{ return v1(0)*v2(0) + v1(1)*v2(1); } { return v1(0)*v2(0) + v1(1)*v2(1); }
/// The euclidean norm of the vector, that is what most people call length /// The euclidean norm of the vector, that is what most people call length
template<typename T> template<typename T>
inline inline
 End of changes. 1 change blocks. 
0 lines changed or deleted 12 lines changed or added


 SGVec3.hxx   SGVec3.hxx 
skipping to change at line 291 skipping to change at line 291
template<typename S, typename T> template<typename S, typename T>
inline inline
SGVec3<T> SGVec3<T>
max(S s, const SGVec3<T>& v) max(S s, const SGVec3<T>& v)
{ {
return SGVec3<T>(SGMisc<T>::max(s, v(0)), return SGVec3<T>(SGMisc<T>::max(s, v(0)),
SGMisc<T>::max(s, v(1)), SGMisc<T>::max(s, v(1)),
SGMisc<T>::max(s, v(2))); SGMisc<T>::max(s, v(2)));
} }
/// Add two vectors taking care of (integer) overflows. The values are limi
ted
/// to the respective minimum and maximum values.
template<class T>
SGVec3<T> addClipOverflow(SGVec3<T> const& lhs, SGVec3<T> const& rhs)
{
return SGVec3<T>(
SGMisc<T>::addClipOverflow(lhs.x(), rhs.x()),
SGMisc<T>::addClipOverflow(lhs.y(), rhs.y()),
SGMisc<T>::addClipOverflow(lhs.z(), rhs.z())
);
}
/// Scalar dot product /// Scalar dot product
template<typename T> template<typename T>
inline inline
T T
dot(const SGVec3<T>& v1, const SGVec3<T>& v2) dot(const SGVec3<T>& v1, const SGVec3<T>& v2)
{ return v1(0)*v2(0) + v1(1)*v2(1) + v1(2)*v2(2); } { return v1(0)*v2(0) + v1(1)*v2(1) + v1(2)*v2(2); }
/// The euclidean norm of the vector, that is what most people call length /// The euclidean norm of the vector, that is what most people call length
template<typename T> template<typename T>
inline inline
 End of changes. 1 change blocks. 
0 lines changed or deleted 13 lines changed or added


 SGVec4.hxx   SGVec4.hxx 
skipping to change at line 247 skipping to change at line 247
inline inline
SGVec4<T> SGVec4<T>
max(S s, const SGVec4<T>& v) max(S s, const SGVec4<T>& v)
{ {
return SGVec4<T>(SGMisc<T>::max(s, v(0)), return SGVec4<T>(SGMisc<T>::max(s, v(0)),
SGMisc<T>::max(s, v(1)), SGMisc<T>::max(s, v(1)),
SGMisc<T>::max(s, v(2)), SGMisc<T>::max(s, v(2)),
SGMisc<T>::max(s, v(3))); SGMisc<T>::max(s, v(3)));
} }
/// Add two vectors taking care of (integer) overflows. The values are limi
ted
/// to the respective minimum and maximum values.
template<class T>
SGVec4<T> addClipOverflow(SGVec4<T> const& lhs, SGVec4<T> const& rhs)
{
return SGVec4<T>(
SGMisc<T>::addClipOverflow(lhs.x(), rhs.x()),
SGMisc<T>::addClipOverflow(lhs.y(), rhs.y()),
SGMisc<T>::addClipOverflow(lhs.z(), rhs.z()),
SGMisc<T>::addClipOverflow(lhs.w(), rhs.w())
);
}
/// Scalar dot product /// Scalar dot product
template<typename T> template<typename T>
inline inline
T T
dot(const SGVec4<T>& v1, const SGVec4<T>& v2) dot(const SGVec4<T>& v1, const SGVec4<T>& v2)
{ return v1(0)*v2(0) + v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3); } { return v1(0)*v2(0) + v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3); }
/// The euclidean norm of the vector, that is what most people call length /// The euclidean norm of the vector, that is what most people call length
template<typename T> template<typename T>
inline inline
 End of changes. 1 change blocks. 
0 lines changed or deleted 14 lines changed or added


 SVGpreserveAspectRatio.hxx   SVGpreserveAspectRatio.hxx 
///@file Parse and represent SVG preserveAspectRatio attribute ///@file
/// Parse and represent SVG preserveAspectRatio attribute.
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 56 skipping to change at line 57
Align alignY() const; Align alignY() const;
bool scaleToFill() const; bool scaleToFill() const;
bool scaleToFit() const; bool scaleToFit() const;
bool scaleToCrop() const; bool scaleToCrop() const;
bool meet() const; bool meet() const;
bool operator==(const SVGpreserveAspectRatio& rhs) const; bool operator==(const SVGpreserveAspectRatio& rhs) const;
/// Parse preserveAspectRatio from string.
static SVGpreserveAspectRatio parse(const std::string& str); static SVGpreserveAspectRatio parse(const std::string& str);
private: private:
Align _align_x, Align _align_x,
_align_y; _align_y;
bool _meet; //!< uniform scale to fit, if true bool _meet; //!< uniform scale to fit, if true
// uniform scale to fill+crop, if false // uniform scale to fill+crop, if false
}; };
} // namespace simgear } // namespace simgear
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added


 ShaderGeometry.hxx   ShaderGeometry.hxx 
skipping to change at line 35 skipping to change at line 35
#include <vector> #include <vector>
#include <osg/Array> #include <osg/Array>
#include <osg/BoundingBox> #include <osg/BoundingBox>
#include <osg/CopyOp> #include <osg/CopyOp>
#include <osg/Drawable> #include <osg/Drawable>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/RenderInfo> #include <osg/RenderInfo>
#include <osg/Vec3> #include <osg/Vec3>
#include <osg/Vec4> #include <osg/Vec4>
#include <osg/Version>
namespace simgear namespace simgear
{ {
class ShaderGeometry : public osg::Drawable class ShaderGeometry : public osg::Drawable
{ {
public: public:
ShaderGeometry() : ShaderGeometry() :
varieties(1) varieties(1)
{ {
skipping to change at line 61 skipping to change at line 62
setSupportsDisplayList(false); setSupportsDisplayList(false);
} }
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ShaderGeometry(const ShaderGeometry& ShaderGeometry,const osg::Copy Op& copyop=osg::CopyOp::SHALLOW_COPY): ShaderGeometry(const ShaderGeometry& ShaderGeometry,const osg::Copy Op& copyop=osg::CopyOp::SHALLOW_COPY):
osg::Drawable(ShaderGeometry,copyop) {} osg::Drawable(ShaderGeometry,copyop) {}
META_Object(flightgear, ShaderGeometry); META_Object(flightgear, ShaderGeometry);
virtual void drawImplementation(osg::RenderInfo& renderInfo) const; virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const;
virtual osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2)
computeBound()
#else
computeBoundingBox()
#endif
const;
void setGeometry(osg::Geometry* geometry) void setGeometry(osg::Geometry* geometry)
{ {
_geometry = geometry; _geometry = geometry;
} }
void addObject(const osg::Vec3& position, float scale, int texture_inde x); void addObject(const osg::Vec3& position, float scale, int texture_inde x);
osg::ref_ptr<osg::Geometry> _geometry; osg::ref_ptr<osg::Geometry> _geometry;
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 SimpleMarkdown.hxx   SimpleMarkdown.hxx 
///@file Really simple markdown parser ///@file
/// Really simple markdown parser.
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
 End of changes. 1 change blocks. 
1 lines changed or deleted 2 lines changed or added


 SpacerItem.hxx   SpacerItem.hxx 
///@file Element providing blank space in a layout. ///@file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 canvas_fwd.hxx   canvas_fwd.hxx 
skipping to change at line 56 skipping to change at line 56
SG_FWD_DECL(Element) SG_FWD_DECL(Element)
SG_FWD_DECL(Group) SG_FWD_DECL(Group)
SG_FWD_DECL(Image) SG_FWD_DECL(Image)
SG_FWD_DECL(Map) SG_FWD_DECL(Map)
SG_FWD_DECL(Path) SG_FWD_DECL(Path)
SG_FWD_DECL(Text) SG_FWD_DECL(Text)
SG_FWD_DECL(Window) SG_FWD_DECL(Window)
SG_FWD_DECL(Event) SG_FWD_DECL(Event)
SG_FWD_DECL(CustomEvent) SG_FWD_DECL(CustomEvent)
SG_FWD_DECL(DeviceEvent)
SG_FWD_DECL(KeyboardEvent)
SG_FWD_DECL(MouseEvent) SG_FWD_DECL(MouseEvent)
#undef SG_FWD_DECL #undef SG_FWD_DECL
#define SG_FWD_DECL(name)\ #define SG_FWD_DECL(name)\
class name;\ class name;\
typedef boost::shared_ptr<name> name##Ptr;\ typedef boost::shared_ptr<name> name##Ptr;\
typedef boost::weak_ptr<name> name##WeakPtr; typedef boost::weak_ptr<name> name##WeakPtr;
SG_FWD_DECL(Placement) SG_FWD_DECL(Placement)
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 cloud.hxx   cloud.hxx 
skipping to change at line 214 skipping to change at line 214
* repaint the cloud colors based on the specified fog_color * repaint the cloud colors based on the specified fog_color
* @param fog_color the fog color * @param fog_color the fog color
*/ */
bool repaint( const SGVec3f& fog_color ); bool repaint( const SGVec3f& fog_color );
/** /**
* reposition the cloud layer at the specified origin and * reposition the cloud layer at the specified origin and
* orientation. * orientation.
* @param p position vector * @param p position vector
* @param up the local up vector * @param up the local up vector
* @param lon specifies a rotation about the Z axis * @param lon TODO
* @param lat specifies a rotation about the new Y axis * @param lat TODO
* @param spin specifies a rotation about the new Z axis * @param alt TODO
* (and orients the sunrise/set effects)
* @param dt the time elapsed since the last call * @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 lon, double lat, double alt,
double dt = 0.0 ); double dt = 0.0 );
osg::Switch* getNode() { return cloud_root.get(); } osg::Switch* getNode() { return cloud_root.get(); }
/** return the 3D layer cloud associated with this 2D layer */ /** return the 3D layer cloud associated with this 2D layer */
SGCloudField *get_layer3D(void) { return layer3D; } SGCloudField *get_layer3D(void) { return layer3D; }
protected: protected:
void setTextureOffset(const osg::Vec2& offset); void setTextureOffset(const osg::Vec2& offset);
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 commands.hxx   commands.hxx 
skipping to change at line 102 skipping to change at line 102
/** /**
* Destructor. (sets instance to NULL) * Destructor. (sets instance to NULL)
*/ */
virtual ~SGCommandMgr (); virtual ~SGCommandMgr ();
static SGCommandMgr* instance(); static SGCommandMgr* instance();
/** /**
* Register a new command with the manager. * Register a new command with the manager.
* *
* @param name The command name. Any existing command with * @param name The command name. Any existing command with the same na
* the same name will silently be overwritten. me
* @param command A pointer to a one-arg function returning * will silently be overwritten.
* a bool result. The argument is always a const pointer to * @param f A pointer to a one-arg function returning a bool result
* an SGPropertyNode (which may contain multiple values). . The
* argument is always a const pointer to an SGPropertyNode
* (which may contain multiple values).
*/ */
void addCommand(const std::string& name, command_t f) void addCommand(const std::string& name, command_t f)
{ addCommandObject(name, new FunctionCommand(f)); } { addCommandObject(name, new FunctionCommand(f)); }
void addCommandObject (const std::string &name, Command* command); void addCommandObject (const std::string &name, Command* command);
template<class OBJ, typename METHOD> template<class OBJ, typename METHOD>
void addCommand(const std::string& name, const OBJ& o, METHOD m) void addCommand(const std::string& name, const OBJ& o, METHOD m)
{ {
addCommandObject(name, make_functor(o,m)); addCommandObject(name, make_functor(o,m));
 End of changes. 1 change blocks. 
5 lines changed or deleted 7 lines changed or added


 from_nasal.hxx   from_nasal.hxx 
skipping to change at line 50 skipping to change at line 50
* Type from_nasal_helper(naContext, naRef, Type*) * Type from_nasal_helper(naContext, naRef, Type*)
*/ */
template<class T> template<class T>
T from_nasal(naContext c, naRef ref) T from_nasal(naContext c, naRef ref)
{ {
return from_nasal_helper(c, ref, static_cast<T*>(0)); return from_nasal_helper(c, ref, static_cast<T*>(0));
} }
/** /**
* Get pointer to specific version of from_nasal, converting to a type * Get pointer to specific version of from_nasal, converting to a type
* compatible to Var. * compatible to \a Var.
*/ */
template<class Var> template<class Var>
struct from_nasal_ptr struct from_nasal_ptr
{ {
typedef typename boost::remove_const typedef typename boost::remove_const
< typename boost::remove_reference<Var>::type < typename boost::remove_reference<Var>::type
>::type return_type; >::type return_type;
typedef return_type(*type)(naContext, naRef); typedef return_type(*type)(naContext, naRef);
static type get() static type get()
{ {
return &from_nasal<return_type>; return &from_nasal<return_type>;
} }
}; };
/**
* Get member of hash, ghost (also searching in parent objects).
*/
template<class T> template<class T>
T get_member(naContext c, naRef obj, const std::string& name) T get_member(naContext c, naRef obj, const std::string& name)
{ {
naRef out; naRef out;
if( !naMember_get(c, obj, to_nasal(c, name), &out) ) if( !naMember_get(c, obj, to_nasal(c, name), &out) )
return T(); return T();
return from_nasal<T>(c, out); return from_nasal<T>(c, out);
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 function_list.hxx   function_list.hxx 
///@file Handle a list of callbacks like a single boost::function ///@file
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 42 skipping to change at line 42
// Build dependency for CMake, gcc, etc. // Build dependency for CMake, gcc, etc.
# define SG_DONT_DO_ANYTHING # define SG_DONT_DO_ANYTHING
# include <simgear/structure/detail/function_list_template.hxx> # include <simgear/structure/detail/function_list_template.hxx>
# undef SG_DONT_DO_ANYTHING # undef SG_DONT_DO_ANYTHING
# define BOOST_PP_ITERATION_LIMITS (0, 3) # define BOOST_PP_ITERATION_LIMITS (0, 3)
# define BOOST_PP_FILENAME_1 <simgear/structure/detail/function_list_templa te.hxx> # define BOOST_PP_FILENAME_1 <simgear/structure/detail/function_list_templa te.hxx>
# include BOOST_PP_ITERATE() # include BOOST_PP_ITERATE()
/**
* Handle a list of callbacks like a single boost::function.
*
* @tparam Sig Function signature.
*/
template<typename Sig> template<typename Sig>
class function_list<boost::function<Sig> >: class function_list<boost::function<Sig> >:
public function_list<Sig> public function_list<Sig>
{ {
}; };
} // namespace simgear } // namespace simgear
#endif /* SG_FUNCTION_LIST_HXX_ */ #endif /* SG_FUNCTION_LIST_HXX_ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 6 lines changed or added


 map.hxx   map.hxx 
///@file Extended std::map with methods for easier usage. ///@file
// //
// Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 28 skipping to change at line 28
#ifndef SG_MAP_HXX_ #ifndef SG_MAP_HXX_
#define SG_MAP_HXX_ #define SG_MAP_HXX_
#include <map> #include <map>
#include <string> #include <string>
namespace simgear namespace simgear
{ {
/**
* Extended std::map with methods for easier usage.
*/
template<class Key, class Value> template<class Key, class Value>
class Map: class Map:
public std::map<Key, Value> public std::map<Key, Value>
{ {
public: public:
Map() {} Map() {}
/** /**
* Initialize a new map with the given key/value pair. * Initialize a new map with the given key/value pair.
*/ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 mat.hxx   mat.hxx 
skipping to change at line 44 skipping to change at line 44
#include "Effect.hxx" #include "Effect.hxx"
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Texture2D> #include <osg/Texture2D>
namespace osg namespace osg
{ {
class StateSet; class StateSet;
} }
typedef osg::ref_ptr<osg::Texture2D> Texture2DRef;
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/threads/SGThread.hxx> // for SGMutex #include <simgear/threads/SGThread.hxx> // for SGMutex
#include <simgear/math/SGLimits.hxx>
#include <simgear/math/SGMisc.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/math/SGVec2.hxx>
#include <simgear/math/SGRect.hxx>
#include <simgear/bvh/BVHMaterial.hxx> #include <simgear/bvh/BVHMaterial.hxx>
typedef osg::ref_ptr<osg::Texture2D> Texture2DRef;
typedef std::vector<SGRect <float> > AreaList;
namespace simgear namespace simgear
{ {
class Effect; class Effect;
void reload_shaders(); void reload_shaders();
class SGReaderWriterOptions; class SGReaderWriterOptions;
} }
class SGMatModelGroup; class SGMatModelGroup;
class SGCondition; class SGCondition;
class SGPropertyNode; class SGPropertyNode;
skipping to change at line 88 skipping to change at line 93
// Public Constructors. // Public Constructors.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
/** /**
* Construct a material from a set of properties. * Construct a material from a set of properties.
* *
* @param props A property node containing subnodes with the * @param props A property node containing subnodes with the
* state information for the material. This node is usually * state information for the material. This node is usually
* loaded from the $FG_ROOT/materials.xml file. * loaded from the $FG_ROOT/materials.xml file.
*/ */
SGMaterial( const osgDB::Options*, SGMaterial(const osgDB::Options*,
const SGPropertyNode *props, const SGPropertyNode *props,
SGPropertyNode *prop_root); SGPropertyNode *prop_root,
AreaList *a,
SGSharedPtr<const SGCondition> c);
SGMaterial(const simgear::SGReaderWriterOptions*, SGMaterial(const simgear::SGReaderWriterOptions*,
const SGPropertyNode *props, const SGPropertyNode *props,
SGPropertyNode *prop_root); SGPropertyNode *prop_root,
AreaList *a,
SGSharedPtr<const SGCondition> c);
/** /**
* Destructor. * Destructor.
*/ */
~SGMaterial( void ); ~SGMaterial( void );
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Public methods. // Public methods.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
/** /**
* Get the textured state. * Get the textured state.
*/ */
simgear::Effect* get_effect(const SGTexturedTriangleBin& triangleBin); simgear::Effect* get_one_effect(int texIndex);
simgear::Effect* get_effect(); simgear::Effect* get_effect();
/** /**
* Get the textured state. * Get the textured state.
*/ */
osg::Texture2D* get_object_mask(const SGTexturedTriangleBin& triangleBin) ; osg::Texture2D* get_one_object_mask(int texIndex);
/** /**
* Get the number of textures assigned to this material. * Get the number of textures assigned to this material.
*/ */
inline int get_num() const { return _status.size(); } inline int get_num() const { return _status.size(); }
/** /**
* Get the xsize of the texture, in meters. * Get the xsize of the texture, in meters.
*/ */
inline double get_xsize() const { return xsize; } inline double get_xsize() const { return xsize; }
skipping to change at line 299 skipping to change at line 309
/** /**
* Get a randomly-placed object for this material. * Get a randomly-placed object for this material.
*/ */
SGMatModelGroup * get_object_group (int index) const { SGMatModelGroup * get_object_group (int index) const {
return object_groups[index]; return object_groups[index];
} }
/** /**
* Evaluate whether this material is valid given the current global * Evaluate whether this material is valid given the current global
* property state. * property state and the tile location.
*/ */
bool valid() const; bool valid(SGVec2f loc) const;
/** /**
* Return pointer to glyph class, or 0 if it doesn't exist. * Return pointer to glyph class, or 0 if it doesn't exist.
*/ */
SGMaterialGlyph * get_glyph (const std::string& name) const; SGMaterialGlyph * get_glyph (const std::string& name) const;
void set_light_color(const SGVec4f& color) void set_light_color(const SGVec4f& color)
{ emission = color; } { emission = color; }
const SGVec4f& get_light_color() const const SGVec4f& get_light_color() const
{ return emission; } { return emission; }
skipping to change at line 465 skipping to change at line 475
// Tree texture, typically a strip of applicable tree textures // Tree texture, typically a strip of applicable tree textures
std::string tree_texture; std::string tree_texture;
// Object mask, a simple RGB texture used as a mask when placing // Object mask, a simple RGB texture used as a mask when placing
// random vegetation, objects and buildings // random vegetation, objects and buildings
std::vector<Texture2DRef> _masks; std::vector<Texture2DRef> _masks;
// Condition, indicating when this material is active // Condition, indicating when this material is active
SGSharedPtr<const SGCondition> condition; SGSharedPtr<const SGCondition> condition;
// List of geographical rectangles for this material
AreaList* areas;
// Parameters from the materials file // Parameters from the materials file
const SGPropertyNode* parameters; const SGPropertyNode* parameters;
// per-material lock for entrypoints called from multiple threads // per-material lock for entrypoints called from multiple threads
SGMutex _lock; SGMutex _lock;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Internal constructors and methods. // Internal constructors and methods.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
 End of changes. 11 change blocks. 
10 lines changed or deleted 23 lines changed or added


 matlib.hxx   matlib.hxx 
skipping to change at line 30 skipping to change at line 30
// //
// $Id$ // $Id$
#ifndef _MATLIB_HXX #ifndef _MATLIB_HXX
#define _MATLIB_HXX #define _MATLIB_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/SGMath.hxx>
#include <memory> #include <memory>
#include <string> // Standard C++ string library #include <string> // Standard C++ string library
#include <map> // STL associative "array" #include <map> // STL associative "array"
#include <vector> // STL "array" #include <vector> // STL "array"
class SGMaterial; class SGMaterial;
class SGPropertyNode; class SGPropertyNode;
namespace simgear { class Effect; } namespace simgear { class Effect; }
namespace osg { class Geode; } namespace osg { class Geode; }
// Material cache class
class SGMaterialCache : public osg::Referenced
{
private:
typedef std::map < std::string, SGSharedPtr<SGMaterial> > material_cach
e;
material_cache cache;
public:
// Constructor
SGMaterialCache ( void );
// Insertion
void insert( const std::string& name, SGSharedPtr<SGMaterial> material
);
// Lookup
SGMaterial *find( const std::string& material ) const;
// Destructor
~SGMaterialCache ( void );
};
// Material management class // Material management class
class SGMaterialLib : public SGReferenced class SGMaterialLib : public SGReferenced
{ {
private: private:
class MatLibPrivate; class MatLibPrivate;
std::auto_ptr<MatLibPrivate> d; std::auto_ptr<MatLibPrivate> d;
// associative array of materials // associative array of materials
typedef std::vector< SGSharedPtr<SGMaterial> > material_list; typedef std::vector< SGSharedPtr<SGMaterial> > material_list;
typedef material_list::iterator material_list_iterator; typedef material_list::iterator material_list_iterator;
typedef std::map < std::string, material_list> material_map; typedef std::map < std::string, material_list> material_map;
typedef material_map::iterator material_map_iterator; typedef material_map::iterator material_map_iterator;
typedef material_map::const_iterator const_material_map_iterator; typedef material_map::const_iterator const_material_map_iterator;
material_map matlib; material_map matlib;
typedef std::map < std::string, SGSharedPtr<SGMaterial> > active_materi
al_cache;
active_material_cache active_cache;
public: public:
// Constructor // Constructor
SGMaterialLib ( void ); SGMaterialLib ( void );
// Load a library of material properties // Load a library of material properties
bool load( const std::string &fg_root, const std::string& mpath, bool load( const std::string &fg_root, const std::string& mpath,
SGPropertyNode *prop_root ); SGPropertyNode *prop_root );
// find a material record by material name // find a material record by material name
SGMaterial *find( const std::string& material ) const; SGMaterial *find( const std::string& material, SGVec2f center ) const;
SGMaterial *find( const std::string& material, const SGGeod& center ) c
onst;
/** /**
* Material lookup involves evaluation of SGConditions to determine whi * Material lookup involves evaluation of position and SGConditions to
ch * determine which possible material (by season, region, etc) is valid.
* possible material (by season, region, etc) is valid. This involves * This involves property tree queries, so repeated calls to find() can
* vproperty tree queries, so repeated calls to find() can cause cause
* race conditions when called from the osgDB pager thread. (especially * race conditions when called from the osgDB pager thread. (especially
* during startup) * during startup)
* *
* To fix this, and also avoid repeated re-evaluation of the material * To fix this, and also avoid repeated re-evaluation of the material
* conditions, we provide a version which uses a cached, threadsafe tab * conditions, we provide factory method to generate a material library
le * cache of the valid materials based on the current state and a given
* of the currently valid materials. The main thread calls the refresh position.
* method below to evaluate the valid materials, and findCached can be
* safely called from other threads with no access to unprotected state
.
*/ */
SGMaterial *findCached( const std::string& material ) const;
void refreshActiveMaterials(); SGMaterialCache *generateMatCache( SGVec2f center);
SGMaterialCache *generateMatCache( SGGeod center);
material_map_iterator begin() { return matlib.begin(); } material_map_iterator begin() { return matlib.begin(); }
const_material_map_iterator begin() const { return matlib.begin(); } const_material_map_iterator begin() const { return matlib.begin(); }
material_map_iterator end() { return matlib.end(); } material_map_iterator end() { return matlib.end(); }
const_material_map_iterator end() const { return matlib.end(); } const_material_map_iterator end() const { return matlib.end(); }
static const SGMaterial *findMaterial(const osg::Geode* geode); static const SGMaterial *findMaterial(const osg::Geode* geode);
// Destructor // Destructor
~SGMaterialLib ( void ); ~SGMaterialLib ( void );
}; };
typedef SGSharedPtr<SGMaterialLib> SGMaterialLibPtr; typedef SGSharedPtr<SGMaterialLib> SGMaterialLibPtr;
#endif // _MATLIB_HXX #endif // _MATLIB_HXX
 End of changes. 8 change blocks. 
17 lines changed or deleted 38 lines changed or added


 nasal.h   nasal.h 
skipping to change at line 284 skipping to change at line 284
*/ */
naRef naNewGhost(naContext c, naGhostType* t, void* ghost); naRef naNewGhost(naContext c, naGhostType* t, void* ghost);
/** /**
* Create a ghost for an object. This version uses the get_member and set_m ember * Create a ghost for an object. This version uses the get_member and set_m ember
* function pointers in ::t upon trying to get or set a member respectively from * function pointers in ::t upon trying to get or set a member respectively from
* Nasal. * Nasal.
*/ */
naRef naNewGhost2(naContext c, naGhostType* t, void* ghost); naRef naNewGhost2(naContext c, naGhostType* t, void* ghost);
naGhostType* naGhost_type(naRef ghost); naGhostType* naGhost_type(naRef ghost);
void* naGhost_ptr(naRef ghost); void* naGhost_ptr(naRef ghost);
/**
* Attach a nasal object to the given ghost. Binds the lifetime of @a data
to
* the lifetime of the @a ghost.
*/
void naGhost_setData(naRef ghost, naRef data);
/**
* Retrieve the object attached to the @a ghost, previously set with
* naGhost_setData().
*/
naRef naGhost_data(naRef ghost);
int naIsGhost(naRef r); int naIsGhost(naRef r);
// Acquires a "modification lock" on a context, allowing the C code to // Acquires a "modification lock" on a context, allowing the C code to
// modify Nasal data without fear that such data may be "lost" by the // modify Nasal data without fear that such data may be "lost" by the
// garbage collector (nasal data on the C stack is not examined in // garbage collector (nasal data on the C stack is not examined in
// GC!). This disallows garbage collection until the current thread // GC!). This disallows garbage collection until the current thread
// can be blocked. The lock should be acquired whenever nasal objects // can be blocked. The lock should be acquired whenever nasal objects
// are being modified. It need not be acquired when only read access // are being modified. It need not be acquired when only read access
// is needed, PRESUMING that the Nasal data being read is findable by // is needed, PRESUMING that the Nasal data being read is findable by
// the collector (via naSave, for example) and that another Nasal // the collector (via naSave, for example) and that another Nasal
 End of changes. 1 change blocks. 
0 lines changed or deleted 11 lines changed or added


 newbucket.hxx   newbucket.hxx 
skipping to change at line 128 skipping to change at line 128
/** /**
* Construct a bucket given a specific location. * Construct a bucket given a specific location.
* @param dlon longitude specified in degrees * @param dlon longitude specified in degrees
* @param dlat latitude specified in degrees * @param dlat latitude specified in degrees
*/ */
SGBucket(const double dlon, const double dlat); SGBucket(const double dlon, const double dlat);
#endif #endif
/** /**
* Construct a bucket given a specific location. * 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); SGBucket(const SGGeod& geod);
/** Construct a bucket given a unique bucket index number. /** Construct a bucket given a unique bucket index number.
*
* @param bindex unique bucket index * @param bindex unique bucket index
*/ */
SGBucket(const long int bindex); SGBucket(const long int bindex);
#ifndef NO_DEPRECATED_API #ifndef NO_DEPRECATED_API
/** /**
* Reset a bucket to represent a new lat and lon * Reset a bucket to represent a new location.
* @param dlon longitude specified in degrees *
* @param dlat latitude specified in degrees * @param geod New geodetic location
*/ */
void set_bucket(const SGGeod& geod); void set_bucket(const SGGeod& geod);
/** /**
* Reset a bucket to represent a new lat and lon * Reset a bucket to represent a new lat and lon
* @param dlon longitude specified in degrees * @param dlon longitude specified in degrees
* @param dlat latitude specified in degrees * @param dlat latitude specified in degrees
*/ */
void set_bucket( double dlon, double dlat ); void set_bucket( double dlon, double dlat );
#endif #endif
 End of changes. 3 change blocks. 
5 lines changed or deleted 6 lines changed or added


 newcloud.hxx   newcloud.hxx 
skipping to change at line 95 skipping to change at line 95
// The density of the cloud is the shading applied // The density of the cloud is the shading applied
// to cloud sprites on the opposite side of the cloud // to cloud sprites on the opposite side of the cloud
// from the sun. For an individual cloud instance a value // from the sun. For an individual cloud instance a value
// between min_density and max_density is chosen. // between min_density and max_density is chosen.
float min_density; float min_density;
float max_density; float max_density;
// zscale indicates how sprites should be scaled vertically // zscale indicates how sprites should be scaled vertically
// after billboarding. // after billboarding.
float zscale; float zscale;
// alpha_factor is the transparency adjustment of the clouds
float alpha_factor;
bool height_map_texture; bool height_map_texture;
int num_sprites; int num_sprites;
int num_textures_x; int num_textures_x;
int num_textures_y; int num_textures_y;
string texture; string texture;
osg::Geometry* quad; osg::Geometry* quad;
osg::ref_ptr<simgear::Effect> effect; osg::ref_ptr<simgear::Effect> effect;
static float sprite_density; static float sprite_density;
// RNG seed for this cloud // RNG seed for this cloud
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 oursun.hxx   oursun.hxx 
skipping to change at line 53 skipping to change at line 53
osg::ref_ptr<osg::Vec4Array> sun_cl; osg::ref_ptr<osg::Vec4Array> sun_cl;
osg::ref_ptr<osg::Vec4Array> scene_cl; osg::ref_ptr<osg::Vec4Array> scene_cl;
osg::ref_ptr<osg::Vec4Array> ihalo_cl; osg::ref_ptr<osg::Vec4Array> ihalo_cl;
osg::ref_ptr<osg::Vec4Array> ohalo_cl; osg::ref_ptr<osg::Vec4Array> ohalo_cl;
double visibility; double visibility;
double prev_sun_angle; double prev_sun_angle;
// distance of light traveling through the atmosphere // distance of light traveling through the atmosphere
double path_distance; double path_distance;
double sun_exp2_punch_through; double sun_exp2_punch_through;
double horizon_angle;
SGPropertyNode_ptr env_node; SGPropertyNode_ptr env_node;
public: public:
// Constructor // Constructor
SGSun( void ); SGSun( void );
// Destructor // Destructor
~SGSun( void ); ~SGSun( void );
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 precipitation.hxx   precipitation.hxx 
skipping to change at line 39 skipping to change at line 39
#include <osg/Group> #include <osg/Group>
#include <osg/Referenced> #include <osg/Referenced>
#include <osgParticle/PrecipitationEffect> #include <osgParticle/PrecipitationEffect>
class SGPrecipitation : public osg::Referenced class SGPrecipitation : public osg::Referenced
{ {
private: private:
bool _freeze; bool _freeze;
bool _enabled; bool _enabled;
bool _droplet_external;
float _snow_intensity; float _snow_intensity;
float _rain_intensity; float _rain_intensity;
float _clip_distance; float _clip_distance;
float _rain_droplet_size;
float _snow_flake_size;
float _illumination;
osg::Vec3 _wind_vec; osg::Vec3 _wind_vec;
osg::ref_ptr<osgParticle::PrecipitationEffect> _precipitationEffect; osg::ref_ptr<osgParticle::PrecipitationEffect> _precipitationEffect;
public: public:
SGPrecipitation(); SGPrecipitation();
virtual ~SGPrecipitation() {} virtual ~SGPrecipitation() {}
osg::Group* build(void); osg::Group* build(void);
bool update(void); bool update(void);
void setWindProperty(double, double); void setWindProperty(double, double);
void setFreezing(bool); void setFreezing(bool);
void setDropletExternal(bool);
void setRainIntensity(float); void setRainIntensity(float);
void setSnowIntensity(float); void setSnowIntensity(float);
void setRainDropletSize(float);
void setSnowFlakeSize(float);
void setIllumination(float);
void setClipDistance(float);
void setEnabled( bool ); void setEnabled( bool );
bool getEnabled() const; bool getEnabled() const;
}; };
#endif #endif
 End of changes. 4 change blocks. 
0 lines changed or deleted 9 lines changed or added


 props.hxx   props.hxx 
skipping to change at line 252 skipping to change at line 252
class SGRawBase<T, 0> : public SGRawExtended class SGRawBase<T, 0> : public SGRawExtended
{ {
virtual SGRawExtended* makeContainer() const; virtual SGRawExtended* makeContainer() const;
virtual std::ostream& printOn(std::ostream& stream) const; virtual std::ostream& printOn(std::ostream& stream) const;
virtual std::istream& readFrom(std::istream& stream); virtual std::istream& readFrom(std::istream& stream);
}; };
/** /**
* Abstract base class for a raw value. * Abstract base class for a raw value.
* *
* <p>The property manager is implemented in two layers. The {@link * The property manager is implemented in two layers. The SGPropertyNode is
* SGPropertyNode} is the highest and most abstract layer, the
* representing an LValue/RValue pair: it records the position of the * highest and most abstract layer, representing an LValue/RValue pair: it
* property in the property tree and contains facilities for * records the position of the property in the property tree and contains
* navigation to other nodes. It is guaranteed to be persistent: the * facilities for navigation to other nodes. It is guaranteed to be persist
* {@link SGPropertyNode} will not change during a session, even if ent:
* the property is bound and unbound multiple times.</p> * the SGPropertyNode will not change during a session, even if the propert
y 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 * SGPropertyNode, the SGPropertyNode will contain a reference to an
* SGRawValue (this class), which provides an abstract way to get, * SGRawValue (this class), which provides an abstract way to get,
* set, and clone the underlying value. The SGRawValue may change * set, and clone the underlying value. The SGRawValue may change
* frequently during a session as a value is retyped or bound and * frequently during a session as a value is retyped or bound and
* unbound to various data source, but the abstract SGPropertyNode * unbound to various data source, but the abstract SGPropertyNode
* layer insulates the application from those changes. * layer insulates the application from those changes.
* *
* <p>The SGPropertyNode class always keeps a *copy* of a raw value, * The SGPropertyNode class always keeps a *copy* of a raw value, not the
* not the original one passed to it; if you override a derived class * original one passed to it; if you override a derived class but do not re
* but do not replace the {@link #clone} method, strange things will place
* happen.</p> * the {@link SGRaw::clone clone()} method, strange things will happen.
* *
* <p>All derived SGRawValue classes must implement {@link #getValue}, * All derived SGRawValue classes must implement getValue(), setValue(), an
* {@link #setValue}, and {@link #clone} for the appropriate type.</p> d
* {@link SGRaw::clone clone()} for the appropriate type.
* *
* @see SGPropertyNode * @see SGPropertyNode
* @see SGRawValuePointer * @see SGRawValuePointer
* @see SGRawValueFunctions * @see SGRawValueFunctions
* @see SGRawValueFunctionsIndexed * @see SGRawValueFunctionsIndexed
* @see SGRawValueMethods * @see SGRawValueMethods
* @see SGRawValueMethodsIndexed * @see SGRawValueMethodsIndexed
* @see SGRawValueContainer * @see SGRawValueContainer
*/ */
template <class T> template <class T>
skipping to change at line 685 skipping to change at line 683
/** /**
* The property change listener interface. * The property change listener interface.
* *
* <p>Any class that needs to listen for property changes must implement * <p>Any class that needs to listen for property changes must implement
* this interface.</p> * this interface.</p>
*/ */
class SGPropertyChangeListener class SGPropertyChangeListener
{ {
public: public:
virtual ~SGPropertyChangeListener (); virtual ~SGPropertyChangeListener ();
virtual void valueChanged (SGPropertyNode * node);
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child) /// Called if value of \a node has changed.
; virtual void valueChanged(SGPropertyNode * node);
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * chil
d); /// 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: protected:
friend class SGPropertyNode; friend class SGPropertyNode;
virtual void register_property (SGPropertyNode * node); virtual void register_property (SGPropertyNode * node);
virtual void unregister_property (SGPropertyNode * node); virtual void unregister_property (SGPropertyNode * node);
private: private:
std::vector<SGPropertyNode *> _properties; std::vector<SGPropertyNode *> _properties;
}; };
skipping to change at line 1232 skipping to change at line 1236
bool interpolate( const std::string& type, bool interpolate( const std::string& type,
const SGPropertyNode& target, const SGPropertyNode& target,
double duration = 0.6, double duration = 0.6,
const std::string& easing = "swing" ); const std::string& easing = "swing" );
/** /**
* Interpolate current value to a series of values within given durations . * Interpolate current value to a series of values within given durations .
* *
* @param type Type of interpolation ("numeric", "color", etc.) * @param type Type of interpolation ("numeric", "color", etc.)
* @param values Nodes containing intermediate and target values * @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/) * @param easing Easing function (http://easings.net/)
*/ */
bool interpolate( const std::string& type, bool interpolate( const std::string& type,
const simgear::PropertyList& values, const simgear::PropertyList& values,
const double_list& deltas, const double_list& deltas,
const std::string& easing = "swing" ); const std::string& easing = "swing" );
/** /**
* Set the interpolation manager used by the interpolate methods. * Set the interpolation manager used by the interpolate methods.
*/ */
 End of changes. 6 change blocks. 
20 lines changed or deleted 28 lines changed or added


 propsfwd.hxx   propsfwd.hxx 
/** /** \file
* \file propsfwwd.hxx *
* Forward declarations for properties (and related structures) * Forward declarations for properties (and related structures)
*/ */
#ifndef SG_PROPS_FWD_HXX #ifndef SG_PROPS_FWD_HXX
#define SG_PROPS_FWD_HXX #define SG_PROPS_FWD_HXX
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
class SGPropertyNode; class SGPropertyNode;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 sample_group.hxx   sample_group.hxx 
// sample_group.hxx -- Manage a group of samples relative to a base positio ///@file
n /// 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 process
ed.
// //
// Written for the new SoundSystem by Erik Hofman, October 2009 // Written for the new SoundSystem by Erik Hofman, October 2009
// //
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com> // Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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 // You should have received a copy of the GNU Library General Public
// along with this program; if not, write to the Free Software Foundation, // License along with this library; if not, write to the Free Software
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
// SA.
// $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 processe
d.
*/
#ifndef _SG_SAMPLE_GROUP_OPENAL_HXX #ifndef _SG_SAMPLE_GROUP_OPENAL_HXX
#define _SG_SAMPLE_GROUP_OPENAL_HXX 1 #define _SG_SAMPLE_GROUP_OPENAL_HXX 1
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
skipping to change at line 138 skipping to change at line 134
* Request to resume playing all audio samples. * Request to resume playing all audio samples.
*/ */
void resume(); void resume();
/** /**
* Request to start playing the referred audio sample. * Request to start playing the referred audio sample.
* @param refname Reference name of the audio sample to start playing * @param refname Reference name of the audio sample to start playing
* @param looping Define if the sound should loop continuously * @param looping Define if the sound should loop continuously
* @return true if the audio sample exsists and is scheduled for playin g * @return true if the audio sample exsists and is scheduled for playin g
*/ */
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. * Request to start playing the referred audio sample looping.
* @param refname Reference name of the audio sample to start playing * @param refname Reference name of the audio sample to start playing
* @return true if the audio sample exsists and is scheduled for playin g * @return true if the audio sample exsists and is scheduled for playin g
*/ */
inline bool play_looped( const std::string& refname ) { inline bool play_looped( const std::string& refname ) {
return play( refname, true ); return play( refname, true );
} }
 End of changes. 6 change blocks. 
22 lines changed or deleted 18 lines changed or added


 sample_openal.hxx   sample_openal.hxx 
// sample_openal.hxx -- Audio sample encapsulation class ///@file
/// Provides an audio sample encapsulation class.
// //
// Written by Curtis Olson, started April 2004. // Written by Curtis Olson, started April 2004.
// Modified to match the new SoundSystem by Erik Hofman, October 2009 // Modified to match the new SoundSystem by Erik Hofman, October 2009
// //
// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt // Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com> // Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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 // You should have received a copy of the GNU Library General Public
// along with this program; if not, write to the Free Software Foundation, // License along with this library; if not, write to the Free Software
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
// SA.
// $Id$
/**
* \file audio sample.hxx
* Provides a audio sample encapsulation
*/
#ifndef _SG_SAMPLE_HXX #ifndef _SG_SAMPLE_HXX
#define _SG_SAMPLE_HXX 1 #define _SG_SAMPLE_HXX 1
#include <string> #include <string>
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
class SGPath; class SGPath;
#ifndef AL_FORMAT_MONO8 #ifndef AL_FORMAT_MONO8
#define AL_FORMAT_MONO8 0x1100 #define AL_FORMAT_MONO8 0x1100
#endif #endif
/** /**
* 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 { class SGSoundSample : public SGReferenced {
public: public:
/** /**
* Empty constructor, can be used to read data to the systems * Empty constructor, can be used to read data to the systems
* memory and not to the driver. * memory and not to the driver.
*/ */
SGSoundSample(); SGSoundSample();
skipping to change at line 97 skipping to change at line 93
* @return Return true if this audio sample is to be constructed from a file. * @return Return true if this audio sample is to be constructed from a file.
*/ */
inline bool is_file() const { return _is_file; } inline bool is_file() const { return _is_file; }
SGPath file_path() const; SGPath file_path() const;
/** /**
* Test if this audio sample configuration has changed since the last c all. * Test if this audio sample configuration has changed since the last c all.
* Calling this function will reset the flag so calling it a second * Calling this function will reset the flag so calling it a second
* time in a row will return false. * time in a row will return false.
*
* @return Return true is the configuration has changed in the mean tim e. * @return Return true is the configuration has changed in the mean tim e.
*/ */
bool has_changed() { bool has_changed() {
bool b = _changed; _changed = false; return b; bool b = _changed; _changed = false; return b;
} }
/** /**
* Test if static data of audio sample configuration has changed. * Test if static data of audio sample configuration has changed.
* Calling this function will reset the flag so calling it a second * Calling this function will reset the flag so calling it a second
* time in a row will return false. * time in a row will return false.
*
* @return Return true is the static data has changed in the mean time. * @return Return true is the static data has changed in the mean time.
*/ */
bool has_static_data_changed() { bool has_static_data_changed() {
bool b = _static_changed; _static_changed = false; return b; bool b = _static_changed; _static_changed = false; return b;
} }
/** /**
* Schedule this audio sample for playing. Actual playing will only sta rt * Schedule this audio sample for playing. Actual playing will only sta rt
* at the next call op SoundGroup::update() * 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 ) { void play( bool loop = false ) {
_playing = true; _loop = loop; _changed = true; _static_changed = t rue; _playing = true; _loop = loop; _changed = true; _static_changed = t rue;
} }
/** /**
* Check if this audio sample is set to be continuous looping. * Check if this audio sample is set to be continuous looping.
*
* @return Return true if this audio sample is set to looping. * @return Return true if this audio sample is set to looping.
*/ */
inline bool is_looping() { return _loop; } inline bool is_looping() { return _loop; }
/** /**
* Schedule this audio sample to stop playing. * Schedule this audio sample to stop playing.
*/ */
virtual void stop() { virtual void stop() {
_playing = false; _changed = true; _playing = false; _changed = true;
} }
skipping to change at line 406 skipping to change at line 406
/** /**
* Get the remaining gain at the edge of the outer cone. * Get the remaining gain at the edge of the outer cone.
* @return Gain * @return Gain
*/ */
float get_outergain() { return _outer_gain; } float get_outergain() { return _outer_gain; }
/** /**
* Set the velocity vector (in meters per second) of this sound. * Set the velocity vector (in meters per second) of this sound.
* This is in the local frame coordinate system; x=north, y=east, z=dow n * This is in the local frame coordinate system; x=north, y=east, z=dow n
* @param Velocity vector *
* @param vel Velocity vector
*/ */
inline void set_velocity( const SGVec3f& vel ) { inline void set_velocity( const SGVec3f& vel ) {
_velocity = vel; _changed = true; _velocity = vel; _changed = true;
} }
/** /**
* Get velocity vector (in meters per second) of this sound. * Get velocity vector (in meters per second) of this sound.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht * This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht
* @return Velocity vector * @return Velocity vector
*/ */
 End of changes. 11 change blocks. 
21 lines changed or deleted 23 lines changed or added


 sample_queue.hxx   sample_queue.hxx 
// queue.hxx -- Sample Queue encapsulation class ///@file
/// Provides a sample queue encapsulation
// //
// based on sample.hxx // based on sample.hxx
// //
// Copyright (C) 2010 Erik Hofman <erik@ehofman.com> // Copyright (C) 2010 Erik Hofman <erik@ehofman.com>
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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 // You should have received a copy of the GNU Library General Public
// along with this program; if not, write to the Free Software Foundation, // License along with this library; if not, write to the Free Software
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
// SA.
// $Id$
/**
* \file audio sample.hxx
* Provides a sample queue encapsulation
*/
#ifndef _SG_QUEUE_HXX #ifndef _SG_QUEUE_HXX
#define _SG_QUEUE_HXX 1 #define _SG_QUEUE_HXX 1
#ifndef __cplusplus
# error This library requires C++
#endif
#include <string> #include <string>
#include <vector> #include <vector>
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include "sample_openal.hxx" #include "sample_openal.hxx"
/** /**
skipping to change at line 70 skipping to change at line 60
* Destructor * Destructor
*/ */
~SGSampleQueue (); ~SGSampleQueue ();
/** /**
* Schedule this audio sample to stop playing. * Schedule this audio sample to stop playing.
*/ */
virtual void stop(); virtual void stop();
/** /**
* Queue new data for this audio sample * Queue new data for this audio sample.
* @param data Pointer to a memory block containg this audio sample dat *
a. * @param data Pointer to a memory block containg this audio sample da
* @param len length of the sample buffer in bytes ta.
* @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 * @param sid OpenAL source-id
*/ */
virtual void set_source(unsigned int sid); virtual void set_source(unsigned int sid);
/** /**
* Test if the buffer-id of this audio sample may be passed to OpenAL. * Test if the buffer-id of this audio sample may be passed to OpenAL.
*
* @return false for sample queue * @return false for sample queue
*/ */
inline bool is_valid_buffer() const { return false; } inline bool is_valid_buffer() const { return false; }
inline virtual bool is_queue() const { return true; } inline virtual bool is_queue() const { return true; }
private: private:
std::string _refname; // sample name std::string _refname; // sample name
std::vector<unsigned int> _buffers; std::vector<unsigned int> _buffers;
 End of changes. 10 change blocks. 
28 lines changed or deleted 22 lines changed or added


 sg_file.hxx   sg_file.hxx 
/** \file sg_file.hxx ///@file
* File I/O routines. /// File I/O routines.
*/ //
// Written by Curtis Olson, started November 1999. // Written by Curtis Olson, started November 1999.
// //
// Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt // Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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-130
1, 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, U
SA.
#ifndef _SG_FILE_HXX #ifndef _SG_FILE_HXX
#define _SG_FILE_HXX #define _SG_FILE_HXX
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include "iochannel.hxx"
#include <string> #include <string>
#include "iochannel.hxx"
/** /**
* A file I/O class based on SGIOChannel. * A file I/O class based on SGIOChannel.
*/ */
class SGFile : public SGIOChannel { class SGFile : public SGIOChannel {
std::string file_name; std::string file_name;
int fp; int fp;
bool eof_flag; bool eof_flag;
// Number of repetitions to play. -1 means loop infinitely. // Number of repetitions to play. -1 means loop infinitely.
const int repeat; const int repeat;
 End of changes. 7 change blocks. 
19 lines changed or deleted 15 lines changed or added


 sg_time.hxx   sg_time.hxx 
skipping to change at line 116 skipping to change at line 116
* Create an instance based on a specified position and data file path. * Create an instance based on a specified position and data file path.
* This creates an instance of the SGTime object. When calling the * This creates an instance of the SGTime object. When calling the
* constructor you need to provide a root path pointing to your * constructor you need to provide a root path pointing to your
* time zone definition tree. Optionally, you can call a form of * time zone definition tree. Optionally, you can call a form of
* the constructor that accepts your current longitude and * the constructor that accepts your current longitude and
* latitude in radians. * latitude in radians.
* *
* If you don't know your position when you call the SGTime * If you don't know your position when you call the SGTime
* constructor, you can just use the first form (which assumes 0, * constructor, you can just use the first form (which assumes 0,
* 0). * 0).
* @param lon_rad current longitude (radians) *
* @param lat_rad current latitude (radians) * @param location Current geodetic location
* @param root root path point to data file location (timezone, etc.) * @param root Root path point to data file location (timezone, et
* @param init_time provide an initialization time, 0 means use c.)
current clock time */ * @param init_time Provide an initialization time, 0 means use current
SGTime( const SGGeod& location, const SGPath& root, * clock time
time_t init_time ); */
SGTime( const SGGeod& location,
const SGPath& root,
time_t init_time );
/** /**
* Create an instance given a data file path. * Create an instance given a data file path.
* @param root root path point to data file location (timezone, etc.) * @param root root path point to data file location (timezone, etc.)
*/ */
SGTime( const SGPath& root ); SGTime( const SGPath& root );
/** Destructor */ /** Destructor */
~SGTime(); ~SGTime();
/** /**
* Update the time related variables. * Update the time related variables.
* The update() method requires you to pass in your position and * The update() method requires you to pass in your position and
* an optional time offset in seconds. The offset (or warp) allows * an optional time offset in seconds. The offset (or warp) allows
* you to offset "sim" time relative to "real" time. The update() * you to offset "sim" time relative to "real" time. The update()
* method is designed to be called by the host application before * method is designed to be called by the host application before
* every frame. * every frame.
* @param lon_rad current longitude (radians) *
* @param lat_rad current latitude (radians) * @param location Current geodetic location
* @param ct specify a unix time, otherwise specify 0 to use current * @param ct Specify a unix time, otherwise specify 0 to use cur
clock time rent
* @param warp an optional time offset specified in seconds. This * clock time
* allows us to advance or rewind "time" if we choose to. */ * @param warp Optional time offset in seconds. This allows to adv
ance
* or rewind "time".
*/
void update( const SGGeod& location, time_t ct, long int warp ); void update( const SGGeod& location, time_t ct, long int warp );
/** Deprecated method. To be removed after the next release... */ /** Deprecated method. To be removed after the next release... */
void update( double lon_rad, double lat_rad, time_t ct, long int warp ) DEPRECATED; void update( double lon_rad, double lat_rad, time_t ct, long int warp ) DEPRECATED;
/** /**
* Given lon/lat, update timezone information and local_offset * Given lon/lat, update timezone information and local_offset
* The updateLocal() method is intended to be called less * The updateLocal() method is intended to be called less
* frequently - only when your position is likely to be changed * frequently - only when your position is likely to be changed
* enough that your timezone may have changed as well. In the * enough that your timezone may have changed as well. In the
* FlightGear project we call updateLocal() every few minutes from * FlightGear project we call updateLocal() every few minutes from
* our periodic event manager. * our periodic event manager.
* @param lon_rad current longitude (radians) *
* @param lat_rad current latitude (radians) * @param location Current geodetic location
* @param root base path containing time zone directory */ * @param root Bbase path containing time zone directory
*/
void updateLocal( const SGGeod& location, const std::string& root ); void updateLocal( const SGGeod& location, const std::string& root );
/** @return current system/unix time in seconds */ /** @return current system/unix time in seconds */
inline time_t get_cur_time() const { return cur_time; }; inline time_t get_cur_time() const { return cur_time; };
/** @return time zone name for your current position*/ /** @return time zone name for your current position*/
inline const char * get_zonename() const { return zonename.c_str(); } inline const char * get_zonename() const { return zonename.c_str(); }
/** @return GMT in a "brokent down" tm structure */ /** @return GMT in a "brokent down" tm structure */
inline struct tm* getGmt()const { return (struct tm *)&m_gmt; }; inline struct tm* getGmt()const { return (struct tm *)&m_gmt; };
 End of changes. 3 change blocks. 
16 lines changed or deleted 23 lines changed or added


 sky.hxx   sky.hxx 
skipping to change at line 30 skipping to change at line 30
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 1, USA.
// //
// $Id$ // $Id$
#ifndef _SG_SKY_HXX #ifndef _SG_SKY_HXX
#define _SG_SKY_HXX #define _SG_SKY_HXX
#ifndef __cplusplus
# error This library requires C++
#endif
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <vector> #include <vector>
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <osg/Node> #include <osg/Node>
skipping to change at line 58 skipping to change at line 54
#include <simgear/scene/sky/cloud.hxx> #include <simgear/scene/sky/cloud.hxx>
#include <simgear/scene/sky/dome.hxx> #include <simgear/scene/sky/dome.hxx>
#include <simgear/scene/sky/moon.hxx> #include <simgear/scene/sky/moon.hxx>
#include <simgear/scene/sky/oursun.hxx> #include <simgear/scene/sky/oursun.hxx>
#include <simgear/scene/sky/stars.hxx> #include <simgear/scene/sky/stars.hxx>
namespace simgear { namespace simgear {
class SGReaderWriterOptions; class SGReaderWriterOptions;
} }
typedef struct { struct SGSkyState
SGVec3d pos; {
SGGeod pos_geod; SGVec3d pos; //!< View position in world Cartesian coordinates.
SGQuatd ori; SGGeod pos_geod;
double spin; SGQuatd ori;
double gst; double spin; //!< An offset angle for orienting the sky effects with
double sun_dist; the
double moon_dist; // sun position so sunset and sunrise effects look cor
double sun_angle; rect.
} SGSkyState; double gst; //!< GMT side real time.
double sun_dist; //!< the sun's distance from the current view point
typedef struct { // (to keep it inside your view volume).
SGVec3f sky_color; double moon_dist;//!< The moon's distance from the current view point.
SGVec3f adj_sky_color; double sun_angle;
SGVec3f fog_color; };
SGVec3f cloud_color;
double sun_angle, moon_angle; struct SGSkyColor
} 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. * 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 * The SGSky class models a blended sky dome, a haloed sun, a textured
* moon with phase that properly matches the date, stars and planets, * moon with phase that properly matches the date, stars and planets,
* and cloud layers. SGSky is designed to be dropped into existing * and cloud layers. SGSky is designed to be dropped into existing
* plib based applications and depends heavily on plib's scene graph * plib based applications and depends heavily on plib's scene graph
* library, ssg. The sky implements various time of day lighting * library, ssg. The sky implements various time of day lighting
* effects, it plays well with fog and visibility effects, and * effects, it plays well with fog and visibility effects, and
skipping to change at line 165 skipping to change at line 168
* is done before translucent objects in the main scene are drawn. It * is done before translucent objects in the main scene are drawn. It
* is seperated from the preDraw routine to enable to implement a * is seperated from the preDraw routine to enable to implement a
* multi passes technique and is located in the drawUpperClouds() method. * multi passes technique and is located in the drawUpperClouds() method.
* The third stage renders the clouds that are below the viewer an which * The third stage renders the clouds that are below the viewer an which
* are likely to be translucent (depending on type) and should be drawn * are likely to be translucent (depending on type) and should be drawn
* after your scene has been rendered. Use the drawLowerClouds() method * after your scene has been rendered. Use the drawLowerClouds() method
* to draw the second stage of the sky. * to draw the second stage of the sky.
* A typical application might do the following: * A typical application might do the following:
* <li> thesky->preDraw( my_altitude ); * \li thesky->preDraw( my_altitude );
* <li> thesky->drawUpperClouds(); * \li thesky->drawUpperClouds();
* <li> ssgCullAndDraw ( myscene ) ; * \li ssgCullAndDraw ( myscene ) ;
* <li> thesky->drawLowerClouds(); * \li thesky->drawLowerClouds();
* The current altitude in meters is passed to the preDraw() method * The current altitude in meters is passed to the preDraw() method
* so the clouds layers can be rendered correction from most distant * so the clouds layers can be rendered correction from most distant
* to closest. * to closest.
* Visibility Effects * Visibility Effects
* Visibility and fog is important for correctly rendering the * Visibility and fog is important for correctly rendering the
* sky. You can inform SGSky of the current visibility by calling the * sky. You can inform SGSky of the current visibility by calling the
* set_visibility() method. * set_visibility() method.
skipping to change at line 262 skipping to change at line 265
public: public:
/** Constructor */ /** Constructor */
SGSky( void ); SGSky( void );
/** Destructor */ /** Destructor */
~SGSky( void ); ~SGSky( void );
/** /**
* Initialize the sky and connect the components to the scene * Initialize the sky and connect the components to the scene
* graph at the provided branch. See discussion in detailed class * graph at the provided branch.
* description. *
* @param h_radius_m horizontal radius of sky dome * @note See discussion in \ref SGSky-details "detailed class descripti
* @param v_radius_m vertical radius of sky dome on".
* @param sun_size size of sun *
* @param moon_size size of moon * @param h_radius_m Horizontal radius of sky dome
* @param nplanets number of planets * @param v_radius_m Vertical radius of sky dome
* @param planet_data an array of planet right ascensions, declinations * @param sun_size Size of sun
, * @param moon_size Size of moon
* and magnitudes * @param eph Current positions of planets and stars
* @param nstars number of stars * @param node Property node connecting sun with environment
* @param star_data an array of star right ascensions, declinations, * @param options
* and magnitudes */
*/ void build( double h_radius_m,
void build( double h_radius_m, double v_radius_m, double v_radius_m,
double sun_size, double moon_size, double sun_size,
const SGEphemeris& eph, SGPropertyNode *property_tree_node, double moon_size,
simgear::SGReaderWriterOptions* options); 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 * Repaint the sky components based on current sun angle, and sky and f
* (for day/night transitions.) See discussion in detailed og
* class description. * colors.
* *
* Sun and moon angles are specified in degrees relative to local up * @note See discussion in \ref SGSky-details "detailed class descripti
* <li> 0 degrees = high noon on".
* <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 sky_color the base sky color (for the top of the dome) * @param eph Current positions of planets and stars
* @param fog_color the fog color (for the horizon) */
* @param sun_angle the sun angle with the horizon (for sunrise/sunset bool repaint( const SGSkyColor &sky_color,
* effects) const SGEphemeris& eph );
* @param moon_angle the moon angle (so we can make it more yellow
* at the horizon) /**
* @param nplanets number of planets * Reposition the sky at the specified origin and orientation.
* @param planet_data an array of planet right ascensions, declinations *
, * @note See discussion in \ref SGSky-details "detailed class descripti
* and magnitudes on".
* @param nstars number of stars *
* @param star_data an array of star right ascensions, declinations,
* and magnitudes
*/
bool repaint( const SGSkyColor &sc, const SGEphemeris& eph );
/**
* Reposition the sky at the specified origin and orientation
*
* 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 d bool reposition( const SGSkyState& sky_state,
t = 0.0 ); const SGEphemeris& eph,
double dt = 0.0 );
/** /**
* Modify the given visibility based on cloud layers, thickness, * Modify the given visibility based on cloud layers, thickness,
* transition range, and simulated "puffs". See discussion in detailed * transition range, and simulated "puffs".
* class description. *
* @note See discussion in \ref SGSky-details "detailed class descripti
on".
*
* @param alt current altitude * @param alt current altitude
* @param time_factor amount of time since modify_vis() last called so * @param time_factor amount of time since modify_vis() last called so
* we can scale effect rates properly despite variable frame rat es. * we can scale effect rates properly despite variable frame rat es.
*/ */
void modify_vis( float alt, float time_factor ); void modify_vis( float alt, float time_factor );
osg::Group* getPreRoot() { return pre_root.get(); } osg::Group* getPreRoot() { return pre_root.get(); }
osg::Group* getCloudRoot() { return cloud_root.get(); } osg::Group* getCloudRoot() { return cloud_root.get(); }
/** /**
* Specify the texture path (optional, defaults to current directory) * 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 ); void texture_path( const std::string& path );
/** /**
* Get the current sun color * Get the current sun color
*/ */
inline SGVec4f get_sun_color() { return oursun->get_color(); } inline SGVec4f get_sun_color() { return oursun->get_color(); }
/** /**
* Get the current scene color * Get the current scene color
skipping to change at line 421 skipping to change at line 395
/** Set 3D cloud density /** Set 3D cloud density
* @param density 3D cloud density * @param density 3D cloud density
*/ */
void set_3dCloudDensity(double density); void set_3dCloudDensity(double density);
/** Get 3D cloud visibility range*/ /** Get 3D cloud visibility range*/
float get_3dCloudVisRange() const; float get_3dCloudVisRange() const;
/** Set 3D cloud visibility range /** Set 3D cloud visibility range
* @param density 3D cloud visibility range *
* @param vis 3D cloud visibility range
*/ */
void set_3dCloudVisRange(float vis); void set_3dCloudVisRange(float vis);
/** Get 3D cloud impostor distance*/ /** Get 3D cloud impostor distance*/
float get_3dCloudImpostorDistance() const; float get_3dCloudImpostorDistance() const;
/** Set 3D cloud impostor distance /** Set 3D cloud impostor distance
* @param density 3D cloud impostor distance *
* @param vis 3D cloud impostor distance
*/ */
void set_3dCloudImpostorDistance(float vis); void set_3dCloudImpostorDistance(float vis);
/** Get 3D cloud LoD1 Range*/ /** Get 3D cloud LoD1 Range*/
float get_3dCloudLoD1Range() const; float get_3dCloudLoD1Range() const;
/** Set 3D cloud LoD1 Range /** Set 3D cloud LoD1 Range
* @param vis LoD1 Range * @param vis LoD1 Range
*/ */
void set_3dCloudLoD1Range(float vis); void set_3dCloudLoD1Range(float vis);
skipping to change at line 453 skipping to change at line 429
/** Set 3D cloud LoD2 Range /** Set 3D cloud LoD2 Range
* @param vis LoD2 Range * @param vis LoD2 Range
*/ */
void set_3dCloudLoD2Range(float vis); void set_3dCloudLoD2Range(float vis);
/** Get 3D cloud impostor usage */ /** Get 3D cloud impostor usage */
bool get_3dCloudUseImpostors() const; bool get_3dCloudUseImpostors() const;
/** Set 3D cloud impostor usage /** 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 set_3dCloudUseImpostors(bool imp);
/** Get 3D cloud wrapping */ /** Get 3D cloud wrapping */
bool get_3dCloudWrap() const; bool get_3dCloudWrap() const;
/** Set 3D cloud wrapping /** Set 3D cloud wrapping
* @param wrap whether to wrap 3D clouds * @param wrap whether to wrap 3D clouds
*/ */
void set_3dCloudWrap(bool wrap); void set_3dCloudWrap(bool wrap);
 End of changes. 11 change blocks. 
107 lines changed or deleted 88 lines changed or added


 soundmgr_openal.hxx   soundmgr_openal.hxx 
// soundmgr.hxx -- Sound effect management class ///@file
/// Sound effect management class
///
/// Provides a sound manager class to keep track of multiple sounds and man
age
/// playing them with different effects and timings.
// //
// Sound manager initially written by David Findlay // Sound manager initially written by David Findlay
// <david_j_findlay@yahoo.com.au> 2001 // <david_j_findlay@yahoo.com.au> 2001
// //
// C++-ified by Curtis Olson, started March 2001. // C++-ified by Curtis Olson, started March 2001.
// Modified for the new SoundSystem by Erik Hofman, October 2009 // Modified for the new SoundSystem by Erik Hofman, October 2009
// //
// Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt // Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt
// Copyright (C) 2009 Erik Hofman <erik@ehofman.com> // Copyright (C) 2009 Erik Hofman <erik@ehofman.com>
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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 // You should have received a copy of the GNU Library General Public
// along with this program; if not, write to the Free Software Foundation, // License along with this library; if not, write to the Free Software
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
// SA.
// $Id$
/**
* \file soundmgr.hxx
* Provides a sound manager class to keep track of
* multiple sounds and manage playing them with different effects and
* timings.
*/
#ifndef _SG_SOUNDMGR_OPENAL_HXX #ifndef _SG_SOUNDMGR_OPENAL_HXX
#define _SG_SOUNDMGR_OPENAL_HXX 1 #define _SG_SOUNDMGR_OPENAL_HXX 1
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
#include <memory> // for std::auto_ptr #include <memory> // for std::auto_ptr
#include <simgear/compiler.h> #include <simgear/compiler.h>
skipping to change at line 117 skipping to change at line 112
/** /**
* Test if a specified sample group is registered at the sound manager * Test if a specified sample group is registered at the sound manager
* @param refname Reference name of the sample group test for * @param refname Reference name of the sample group test for
* @return true if the specified sample group exists * @return true if the specified sample group exists
*/ */
bool exists( const std::string& refname ); bool exists( const std::string& refname );
/** /**
* Find a specified sample group in the sound manager * Find a specified sample group in the sound manager
*
* @param refname Reference name of the sample group to find * @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 * @return A pointer to the SGSampleGroup
*/ */
SGSampleGroup *find( const std::string& refname, bool create = false ); SGSampleGroup *find( const std::string& refname, bool create = false );
/** /**
* Set the Cartesian position of the sound manager. * Set the Cartesian position of the sound manager.
*
* @param pos OpenAL listener position * @param pos OpenAL listener position
*/ */
void set_position( const SGVec3d& pos, const SGGeod& pos_geod ); void set_position( const SGVec3d& pos, const SGGeod& pos_geod );
void set_position_offset( const SGVec3d& pos ) { void set_position_offset( const SGVec3d& pos ) {
_offset_pos = pos; _changed = true; _offset_pos = pos; _changed = true;
} }
/** /**
* Get the position of the sound manager. * Get the position of the sound manager.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht * This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht
*
* @return OpenAL listener position * @return OpenAL listener position
*/ */
const SGVec3d& get_position() const; const SGVec3d& get_position() const;
/** /**
* Set the velocity vector (in meters per second) of the sound manager * Set the velocity vector (in meters per second) of the sound manager
* This is the horizontal local frame; x=north, y=east, z=down * 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 ) { void set_velocity( const SGVec3d& vel ) {
_velocity = vel; _changed = true; _velocity = vel; _changed = true;
} }
/** /**
* Get the velocity vector of the sound manager * Get the velocity vector of the sound manager
* This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht. * This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht.
*
* @return Velocity vector of the OpenAL listener * @return Velocity vector of the OpenAL listener
*/ */
inline SGVec3f get_velocity() { return toVec3f(_velocity); } inline SGVec3f get_velocity() { return toVec3f(_velocity); }
/** /**
* Set the orientation of the sound manager * Set the orientation of the sound manager
*
* @param ori Quaternation containing the orientation information * @param ori Quaternation containing the orientation information
*/ */
void set_orientation( const SGQuatd& ori ); void set_orientation( const SGQuatd& ori );
/** /**
* Get the orientation of the sound manager * Get the orientation of the sound manager
*
* @return Quaternation containing the orientation information * @return Quaternation containing the orientation information
*/ */
const SGQuatd& get_orientation() const; const SGQuatd& get_orientation() const;
/** /**
* Get the direction vector of the sound manager * Get the direction vector of the sound manager
* This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht. * This is in the same coordinate system as OpenGL; y=up, z=back, x=rig ht.
*
* @return Look-at direction of the OpenAL listener * @return Look-at direction of the OpenAL listener
*/ */
SGVec3f get_direction() const; SGVec3f get_direction() const;
enum { enum {
NO_SOURCE = (unsigned int)-1, NO_SOURCE = (unsigned int)-1,
NO_BUFFER = (unsigned int)-1, NO_BUFFER = (unsigned int)-1,
FAILED_BUFFER = (unsigned int)-2 FAILED_BUFFER = (unsigned int)-2
}; };
/** /**
* Set the master volume. * Set the master volume.
*
* @param vol Volume (must be between 0.0 and 1.0) * @param vol Volume (must be between 0.0 and 1.0)
*/ */
void set_volume( float vol ); void set_volume( float vol );
/** /**
* Get the master volume. * Get the master volume.
*
* @return Volume (must be between 0.0 and 1.0) * @return Volume (must be between 0.0 and 1.0)
*/ */
inline float get_volume() { return _volume; } inline float get_volume() { return _volume; }
/** /**
* Get a free OpenAL source-id * Get a free OpenAL source-id
*
* @return NO_SOURCE if no source is available * @return NO_SOURCE if no source is available
*/ */
unsigned int request_source(); unsigned int request_source();
/** /**
* Free an OpenAL source-id for future use * Free an OpenAL source-id for future use
*
* @param source OpenAL source-id to free * @param source OpenAL source-id to free
*/ */
void release_source( unsigned int source ); void release_source( unsigned int source );
/** /**
* Get a free OpenAL buffer-id * Get a free OpenAL buffer-id
* The buffer-id will be assigned to the sample by calling this functio n. * The buffer-id will be assigned to the sample by calling this functio n.
*
* @param sample Pointer to an audio sample to assign the buffer-id to * @param sample Pointer to an audio sample to assign the buffer-id to
* @return NO_BUFFER if loading of the buffer failed. * @return NO_BUFFER if loading of the buffer failed.
*/ */
unsigned int request_buffer(SGSoundSample *sample); unsigned int request_buffer(SGSoundSample *sample);
/** /**
* Free an OpenAL buffer-id for this sample * Free an OpenAL buffer-id for this sample
*
* @param sample Pointer to an audio sample for which to free the buffe r * @param sample Pointer to an audio sample for which to free the buffe r
*/ */
void release_buffer( SGSoundSample *sample ); void release_buffer( SGSoundSample *sample );
/** /**
* Test if the position of the sound manager has changed. * Test if the position of the sound manager has changed.
* The value will be set to false upon the next call to update_late() * The value will be set to false upon the next call to update_late()
*
* @return true if the position has changed * @return true if the position has changed
*/ */
inline bool has_changed() { return _changed; } inline bool has_changed() { return _changed; }
/** /**
* Some implementations seem to need the velocity multiplied by a * Some implementations seem to need the velocity multiplied by a
* factor of 100 to make them distinct. I've not found if this is * factor of 100 to make them distinct. I've not found if this is
* a problem in the implementation or in out code. Until then * a problem in the implementation or in out code. Until then
* this function is used to detect the problematic implementations. * this function is used to detect the problematic implementations.
*/ */
inline bool bad_doppler_effect() { return _bad_doppler; } inline bool bad_doppler_effect() { return _bad_doppler; }
/** /**
* Load a sample file and return it's configuration and data. * Load a sample file and return it's configuration and data.
*
* @param samplepath Path to the file to load * @param samplepath Path to the file to load
* @param data Pointer to a variable that points to the allocated data * @param data Pointer to a variable that points to the allocated data
* @param format Pointer to a vairable that gets the OpenAL format * @param format Pointer to a vairable that gets the OpenAL format
* @param size Pointer to a vairable that gets the sample size in bytes * @param size Pointer to a vairable that gets the sample size in bytes
* @param freq Pointer to a vairable that gets the sample frequency in Herz * @param freq Pointer to a vairable that gets the sample frequency in Herz
* @return true if succesful, false on error * @return true if succesful, false on error
*/ */
bool load(const std::string &samplepath, void **data, int *format, bool load( const std::string &samplepath,
size_t *size, int *freq ); void **data,
int *format,
size_t *size,
int *freq );
/** /**
* Get a list of available playback devices. * Get a list of available playback devices.
*/ */
std::vector<const char*> get_available_devices(); std::vector<const char*> get_available_devices();
/** /**
* Get the current OpenAL vendor or rendering backend. * Get the current OpenAL vendor or rendering backend.
*/ */
const std::string& get_vendor() { return _vendor; } const std::string& get_vendor() { return _vendor; }
 End of changes. 23 change blocks. 
23 lines changed or deleted 40 lines changed or added


 version.h   version.h 
#define SIMGEAR_VERSION 3.2.0 #define SIMGEAR_VERSION 3.4.0
 End of changes. 1 change blocks. 
lines changed or deleted lines changed or added


 xmlsound.hxx   xmlsound.hxx 
// 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 // Started by Erik Hofman, February 2002
// //
// Copyright (C) 2002 Erik Hofman - erik@ehofman.com // Copyright (C) 2002 Erik Hofman - erik@ehofman.com
// //
// This program is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU Library General Public
// published by the Free Software Foundation; either version 2 of the // License as published by the Free Software Foundation; either
// License, or (at your option) any later version. // 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 // This library is distributed in the hope that it will be useful,
// WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // 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 // You should have received a copy of the GNU Library General Public
// along with this program; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
1, USA. SA.
//
// $Id$
/**
* \file sound.hxx
* Provides a class to manage a single sound event including things
* like looping, volume and pitch changes.
*/
#ifndef _SG_SOUND_HXX #ifndef _SG_SOUND_HXX
#define _SG_SOUND_HXX 1 #define _SG_SOUND_HXX 1
#include <vector> #include <vector>
#include <string> #include <string>
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/props/propsfwd.hxx> #include <simgear/props/propsfwd.hxx>
skipping to change at line 72 skipping to change at line 68
virtual ~SGXmlSound(); virtual ~SGXmlSound();
/** /**
* Initialize the sound event. * Initialize the sound event.
* *
* Prior to initialization of the sound event the program's property root * Prior to initialization of the sound event the program's property root
* has to be defined, the sound configuration XML tree has to be loaded * has to be defined, the sound configuration XML tree has to be loaded
* and a sound manager class has to be defined. * and a sound manager class has to be defined.
* *
* A sound configuration file would look like this: * A sound configuration file would look like this:
* @code{xml}
* <fx> * <fx>
* <event_name> * <event_name>
* <name/> Define the name of the event. For reference only. * <name/> Define the name of the event. For reference only.
* <mode/> Either: * <mode/> Either:
* looped: play this sound looped. * looped: play this sound looped.
* in-transit: play looped while the event is happening. * in-transit: play looped while the event is happening.
* once: play this sound once. * once: play this sound once.
* <path/> The relative path to the audio file. * <path/> The relative path to the audio file.
* <property/> Take action if this property becomes true. * <property/> Take action if this property becomes true.
* <condition/> Take action if this condition becomes true. * <condition/> Take action if this condition becomes true.
skipping to change at line 99 skipping to change at line 96
* <offset/> Add this value to the result. * <offset/> Add this value to the result.
* <factor/> Multiply the result by this factor. * <factor/> Multiply the result by this factor.
* <min/> Make sure the value is never less than this value. * <min/> Make sure the value is never less than this value.
* <max/> Make sure the value is never larger than this value. * <max/> Make sure the value is never larger than this value.
* </volume> or </pitch> * </volume> or </pitch>
* </event_name> * </event_name>
* *
* <event_name> * <event_name>
* </event_name> * </event_name>
* </fx> * </fx>
* @endcode
* *
* @param root The root node of the programs property tree. * @param root The root node of the programs property tree.
* @param child A pointer to the location of the current event as defined * @param child A pointer to the location of the current event as
* in the configuration file. * defined in the configuration file.
* @param sgrp A pointer to a pre-initialized sample group class. * @param sgrp A pointer to a pre-initialized sample group class.
* @param avionics A pointer to the pre-initialized avionics sample group * @param avionics A pointer to the pre-initialized avionics sample gr
. oup.
* @param path The path where the audio files remain. * @param path The path where the audio files remain.
*/ */
virtual void init (SGPropertyNode *, SGPropertyNode *, SGSampleGroup *, virtual void init( SGPropertyNode *root,
SGSampleGroup *, const SGPath& currentDir); SGPropertyNode *child,
SGSampleGroup *sgrp,
SGSampleGroup *avionics,
const SGPath& path );
/** /**
* Check whether an event has happened and if action has to be taken. * Check whether an event has happened and if action has to be taken.
*/ */
virtual void update (double dt); virtual void update (double dt);
/** /**
* Stop taking action on the pre-defined events. * Stop taking action on the pre-defined events.
*/ */
void stop(); void stop();
 End of changes. 9 change blocks. 
29 lines changed or deleted 30 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/