From Paul Martz, typos and spelling fixes.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Encapsulate OpenGL glAlphaFunc.
|
||||
/** Encapsulates OpenGL glAlphaFunc.
|
||||
*/
|
||||
class SG_EXPORT AlphaFunc : public StateAttribute
|
||||
{
|
||||
@@ -42,7 +42,7 @@ class SG_EXPORT AlphaFunc : public StateAttribute
|
||||
_comparisonFunc(func),
|
||||
_referenceValue(ref) {}
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
AlphaFunc(const AlphaFunc& af,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(af,copyop),
|
||||
_comparisonFunc(af._comparisonFunc),
|
||||
@@ -50,18 +50,18 @@ class SG_EXPORT AlphaFunc : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, AlphaFunc,ALPHAFUNC);
|
||||
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
||||
virtual int compare(const StateAttribute& sa) const
|
||||
{
|
||||
// check the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macro's below.
|
||||
// Check for equal types, then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macros below.
|
||||
COMPARE_StateAttribute_Types(AlphaFunc,sa)
|
||||
|
||||
// compare each paramter in turn against the rhs.
|
||||
// Compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_comparisonFunc)
|
||||
COMPARE_StateAttribute_Parameter(_referenceValue)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // Passed all the above comparison macros, so must be equal.
|
||||
}
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** AnimationPath for specify the time varying transformation pathway to use when update camera and model objects.
|
||||
* Subclassed from Transform::ComputeTransformCallback allows AnimationPath to
|
||||
* be attached directly to Transform nodes to move subgraphs around the scene.
|
||||
/** AnimationPath encapsulates a time varying transformation pathway. Can be
|
||||
* used for updating camera position and model object position.
|
||||
* AnimationPathCallback can be attached directly to Transform nodes to
|
||||
* move subgraphs around the scene.
|
||||
*/
|
||||
class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
{
|
||||
@@ -105,7 +106,7 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
};
|
||||
|
||||
|
||||
/** get the transformation matrix for a point in time.*/
|
||||
/** Given a specific time, return the transformation matrix for a point. */
|
||||
bool getMatrix(double time,Matrixf& matrix) const
|
||||
{
|
||||
ControlPoint cp;
|
||||
@@ -114,7 +115,7 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
return true;
|
||||
}
|
||||
|
||||
/** get the transformation matrix for a point in time.*/
|
||||
/** Given a specific time, return the transformation matrix for a point..*/
|
||||
bool getMatrix(double time,Matrixd& matrix) const
|
||||
{
|
||||
ControlPoint cp;
|
||||
@@ -123,7 +124,7 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
return true;
|
||||
}
|
||||
|
||||
/** get the inverse transformation matrix for a point in time.*/
|
||||
/** Given a specific time, return the inverse transformation matrix for a point. */
|
||||
bool getInverse(double time,Matrixf& matrix) const
|
||||
{
|
||||
ControlPoint cp;
|
||||
@@ -140,7 +141,7 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
return true;
|
||||
}
|
||||
|
||||
/** get the local ControlPoint frame for a point in time.*/
|
||||
/** Given a specific time, return the local ControlPoint frame for a point. */
|
||||
virtual bool getInterpolatedControlPoint(double time,ControlPoint& controlPoint) const;
|
||||
|
||||
void insert(double time,const ControlPoint& controlPoint);
|
||||
@@ -169,10 +170,10 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
|
||||
|
||||
bool empty() const { return _timeControlPointMap.empty(); }
|
||||
|
||||
/** read the anumation path from a flat ascii file stream.*/
|
||||
/** Read the animation path from a flat ASCII file stream. */
|
||||
void read(std::istream& in);
|
||||
|
||||
/** write the anumation path to a flat ascii file stream.*/
|
||||
/** Write the animation path to a flat ASCII file stream. */
|
||||
void write(std::ostream& out) const;
|
||||
|
||||
protected:
|
||||
@@ -247,11 +248,12 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback
|
||||
|
||||
void setPause(bool pause);
|
||||
|
||||
/** get the animation time that is used to specify the position along the AnimationPath.
|
||||
* Animation time is computed from the formula ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/
|
||||
/** Get the animation time that is used to specify the position along
|
||||
* the AnimationPath. Animation time is computed from the formula:
|
||||
* ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/
|
||||
double getAnimationTime() const;
|
||||
|
||||
/** implements the callback*/
|
||||
/** Implements the callback. */
|
||||
virtual void operator()(Node* node, NodeVisitor* nv);
|
||||
|
||||
void update(osg::Node& node);
|
||||
|
||||
@@ -69,13 +69,15 @@ class SG_EXPORT ArgumentParser
|
||||
ValueUnion _value;
|
||||
};
|
||||
|
||||
/** return return true if specified string is an option in the form of -option or --option .*/
|
||||
/** Return true if the specified string is an option in the form
|
||||
* -option or --option. */
|
||||
static bool isOption(const char* str);
|
||||
|
||||
/** return return true if string is any other string apart from an option.*/
|
||||
/** Return true if string is non-NULL and not an option in the form
|
||||
* -option or --option. */
|
||||
static bool isString(const char* str);
|
||||
|
||||
/** return return true if specified parameter is an number.*/
|
||||
/** Return true if specified parameter is a number. */
|
||||
static bool isNumber(const char* str);
|
||||
|
||||
public:
|
||||
@@ -86,44 +88,47 @@ class SG_EXPORT ArgumentParser
|
||||
ApplicationUsage* getApplicationUsage() { return _usage; }
|
||||
const ApplicationUsage* getApplicationUsage() const { return _usage; }
|
||||
|
||||
/** return the argument count.*/
|
||||
/** Return the argument count. */
|
||||
int& argc() { return *_argc; }
|
||||
|
||||
/** return the argument array.*/
|
||||
/** Return the argument array. */
|
||||
char** argv() { return _argv; }
|
||||
|
||||
/** return char* argument at specificed position.*/
|
||||
/** Return the char* argument at the specified position. */
|
||||
char* operator [] (int pos) { return _argv[pos]; }
|
||||
|
||||
/** return const char* argument at specificed position.*/
|
||||
/** Return the const char* argument at the specified position. */
|
||||
const char* operator [] (int pos) const { return _argv[pos]; }
|
||||
|
||||
/** return the application name, as specified by argv[0] */
|
||||
/** Return the application name, as specified by argv[0] */
|
||||
std::string getApplicationName() const;
|
||||
|
||||
/** return the position of an occurance of a string in the argument list.
|
||||
* return -1 when no string is found.*/
|
||||
/** Return the position of an occurance of a string in the argument list.
|
||||
* Return -1 if no string is found. */
|
||||
int find(const std::string& str) const;
|
||||
|
||||
/** return return true if specified parameter is an option in the form of -option or --option .*/
|
||||
/** Return true if the specified parameter is an option in the form of
|
||||
* -option or --option. */
|
||||
bool isOption(int pos) const;
|
||||
|
||||
/** return return true if specified parameter is an string, which can be any other string apart from an option.*/
|
||||
/** Return true if the specified parameter is a string not in
|
||||
* the form of an option. */
|
||||
bool isString(int pos) const;
|
||||
|
||||
/** return return true if specified parameter is an number.*/
|
||||
/** Return true if the specified parameter is a number. */
|
||||
bool isNumber(int pos) const;
|
||||
|
||||
bool containsOptions() const;
|
||||
|
||||
/** remove one or more arguments from the argv argument list, and decrement the argc respectively.*/
|
||||
/** Remove one or more arguments from the argv argument list,
|
||||
* and decrement the argc respectively. */
|
||||
void remove(int pos,int num=1);
|
||||
|
||||
/** return true if specified argument matches string.*/
|
||||
/** Return true if the specified argument matches the given string. */
|
||||
bool match(int pos, const std::string& str) const;
|
||||
|
||||
/** search for an occurance of a string in the argument list, on sucess
|
||||
* remove that occurance from the list and return true, otherwise return false.*/
|
||||
/** Search for an occurance of a string in the argument list. If found,
|
||||
* remove that occurance and return true. Otherwise, return false. */
|
||||
bool read(const std::string& str);
|
||||
bool read(const std::string& str, Parameter value1);
|
||||
bool read(const std::string& str, Parameter value1, Parameter value2);
|
||||
@@ -131,8 +136,9 @@ class SG_EXPORT ArgumentParser
|
||||
bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4);
|
||||
|
||||
|
||||
/** if the argument value at the position pos matches specified string, and subsequent
|
||||
* paramters are also matched then set the paramter values and remove the from the list of arguments.*/
|
||||
/** If the argument value at the speciified position matches the given string,
|
||||
* and subsequent parameters are also matched, then set the parameter values,
|
||||
* remove the arguments from the list, and return true. Otherwise, return false. */
|
||||
bool read(int pos, const std::string& str);
|
||||
bool read(int pos, const std::string& str, Parameter value1);
|
||||
bool read(int pos, const std::string& str, Parameter value1, Parameter value2);
|
||||
@@ -148,22 +154,22 @@ class SG_EXPORT ArgumentParser
|
||||
|
||||
typedef std::map<std::string,ErrorSeverity> ErrorMessageMap;
|
||||
|
||||
/** return the error flag, true if an error has occured when reading arguments.*/
|
||||
/** Return the error flag, true if an error has occured when reading arguments. */
|
||||
bool errors(ErrorSeverity severity=BENIGN) const;
|
||||
|
||||
/** report an error message by adding to the ErrorMessageMap.*/
|
||||
/** Report an error message by adding to the ErrorMessageMap. */
|
||||
void reportError(const std::string& message,ErrorSeverity severity=CRITICAL);
|
||||
|
||||
/** for each remaining option report it as an unrecongnized.*/
|
||||
/** For each remaining option, report it as unrecognized. */
|
||||
void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN);
|
||||
|
||||
/** return the error message, if any has occured.*/
|
||||
/** Return the error message, if any has occured. */
|
||||
ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; }
|
||||
|
||||
/** return the error message, if any has occured.*/
|
||||
/** Return the error message, if any has occured. */
|
||||
const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; }
|
||||
|
||||
/** write out error messages at an above specified .*/
|
||||
/** Write error messages to the given ostream, if at or above the given severiity. */
|
||||
void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN);
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,8 @@ class SG_EXPORT Array : public Object
|
||||
virtual void accept(unsigned int index,ValueVisitor&) = 0;
|
||||
virtual void accept(unsigned int index,ConstValueVisitor&) const = 0;
|
||||
|
||||
/** return -1 if lhs element is less than rhs element, 0 is equal, 1 if lhs element is greater than rhs element.*/
|
||||
/** Return -1 if lhs element is less than rhs element, 0 if equal,
|
||||
* 1 if lhs element is greater than rhs element. */
|
||||
virtual int compare(unsigned int lhs,unsigned int rhs) const = 0;
|
||||
|
||||
Type getType() const { return _arrayType; }
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** AutoTransform - is Transform the automatically scales or rotates
|
||||
* to keep its children relative to screen space coordinates.
|
||||
/** AutoTransform is a derived form of Transform that automatically
|
||||
* scales or rotates to keep its children aligned with screen coordinates.
|
||||
*/
|
||||
class SG_EXPORT AutoTransform : public Transform
|
||||
{
|
||||
@@ -77,14 +77,14 @@ class SG_EXPORT AutoTransform : public Transform
|
||||
void setAutoRotateToScreen(bool autoRotateToScreen)
|
||||
{
|
||||
setAutoRotateMode(autoRotateToScreen?ROTATE_TO_SCREEN:NO_ROTATION);
|
||||
}
|
||||
}
|
||||
|
||||
bool getAutoRotateToCamera() const { return _autoRotateMode==ROTATE_TO_SCREEN; }
|
||||
|
||||
void setAutoRotateToCamera(bool autoRotateToCamera)
|
||||
{
|
||||
{
|
||||
setAutoRotateMode(autoRotateToScreen?ROTATE_TO_CAMERA:NO_ROTATION);
|
||||
}
|
||||
}
|
||||
|
||||
bool getAutoRotateToCamera() const { return _autoRotateMode==ROTATE_TO_SCREEN; }
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Billboard - a Geode which orientates its child osg::Drawable's to face
|
||||
the eye point. Typical uses are for trees, or particle explosions.
|
||||
/** Billboard is a derived form of Geode that orients its osg::Drawable
|
||||
* children to face the eye point. Typical uses incllude trees and
|
||||
* particle explosions,
|
||||
*/
|
||||
class SG_EXPORT Billboard : public Geode
|
||||
{
|
||||
@@ -34,7 +35,7 @@ class SG_EXPORT Billboard : public Geode
|
||||
|
||||
Billboard();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Billboard(const Billboard&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(osg, Billboard);
|
||||
@@ -44,59 +45,57 @@ class SG_EXPORT Billboard : public Geode
|
||||
/** Get the billboard rotation mode. */
|
||||
inline Mode getMode() const { return _mode; }
|
||||
|
||||
/** Set the axis about which all the billboard's drawable rotate. Only utlized when mode==AXIAL_ROT*/
|
||||
/** Set the rotation axis for the billboard's child Drawables.
|
||||
* Only utlized when mode==AXIAL_ROT. */
|
||||
void setAxis(const Vec3& axis);
|
||||
/** Get the axis about which all the billboard's drawable rotate. */
|
||||
/** Get the rotation axis. */
|
||||
inline const Vec3& getAxis() const { return _axis; }
|
||||
|
||||
/** Set the normal which defines the billboard's drawable front face, when unrotated. */
|
||||
/** This normal defines child Drawables' front face direction when unrotated. */
|
||||
void setNormal(const Vec3& normal);
|
||||
/** Get the normal of billboard's drawable front face. */
|
||||
/** Get the front face direction normal. */
|
||||
inline const Vec3& getNormal() const { return _normal; }
|
||||
|
||||
|
||||
#ifdef USE_DEPRECATED_API
|
||||
/** Set the position of specified drawable. */
|
||||
/** Set the specified child Drawable's position. */
|
||||
inline void setPos(unsigned int i,const Vec3& pos) { _positionList[i] = pos; }
|
||||
/** Get the position of specified drawable. */
|
||||
/** Get the specified child Drawable's position. */
|
||||
inline const Vec3& getPos(unsigned int i) const { return _positionList[i]; }
|
||||
#endif
|
||||
|
||||
/** Set the position of specified drawable. */
|
||||
|
||||
/** Set the specified child Drawable's position. */
|
||||
inline void setPosition(unsigned int i,const Vec3& pos) { _positionList[i] = pos; }
|
||||
/** Get the position of specified drawable. */
|
||||
/** Get the specified child Drawable's position. */
|
||||
inline const Vec3& getPosition(unsigned int i) const { return _positionList[i]; }
|
||||
|
||||
/** PositionList represents a list of pivot points for each drawable.*/
|
||||
/** Type definition for pivot point position list. */
|
||||
typedef std::vector<Vec3> PositionList;
|
||||
|
||||
/** Get the PositionList from the billboard.*/
|
||||
/** Get the list of pivot point positions. */
|
||||
inline PositionList& getPositionList() { return _positionList; }
|
||||
|
||||
/** Get a const PositionList from the billboard.*/
|
||||
/** Get a const list of pivot point positions. */
|
||||
inline const PositionList& getPositionList() const { return _positionList; }
|
||||
|
||||
/** Add Drawable to Billboard with default position(0,0,0);
|
||||
* If gset not NULL and is not contained in Billboard then increment its
|
||||
* reference count, and dirty the bounding box to cause it to recompute on
|
||||
* next getBound() and return true for success. Otherwise return false.
|
||||
*/
|
||||
/** Add a Drawable with a default position of Vec3(0,0,0).
|
||||
* Call the base-class Geode::addDrawble() to add the given Drawable
|
||||
* gset as a child. If Geode::addDrawable() returns true, add the
|
||||
* default position to the pivot point position list and return true.
|
||||
* Otherwise, return false. */
|
||||
virtual bool addDrawable( Drawable *gset );
|
||||
|
||||
/** Add Drawable to Geode at position pos.
|
||||
* If gset not NULL and is not contained in Billboard then increment its
|
||||
* reference count, and dirty the bounding box to cause it to recompute on
|
||||
* next getBound() and return true for success. Otherwise return false.
|
||||
*/
|
||||
/** Add a Drawable with a specified position.
|
||||
* Call the base-class Geode::addDrawble() to add the given Drawable
|
||||
* gset as a child. If Geode::addDrawable() returns true, add the
|
||||
* given position pos to the pivot point position list and return true.
|
||||
* Otherwise, return false. */
|
||||
virtual bool addDrawable(Drawable *gset,const Vec3& pos);
|
||||
|
||||
/** Remove Drawable and associated position from Billboard.
|
||||
* If gset is contained in Billboard then remove it from the geoset
|
||||
* list and decrement its reference count, and dirty the
|
||||
* bounding box to cause it to recompute on next getBound() and
|
||||
* return true for success. If gset is not found then return false
|
||||
* and do not the reference count of gset is left unchanged.
|
||||
*/
|
||||
/** Remove a Drawable and its associated position.
|
||||
* If gset is a child, remove it, decrement its reference count,
|
||||
* remove its pivot point position. and return true.
|
||||
* Otherwise, return false. */
|
||||
virtual bool removeDrawable( Drawable *gset );
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** BlendColor - encapsulates the OpenGL blend/transparency state.*/
|
||||
/** Encapsulates OpenGL blend/transparency state. */
|
||||
class SG_EXPORT BlendColor : public StateAttribute
|
||||
{
|
||||
public :
|
||||
@@ -37,17 +37,17 @@ class SG_EXPORT BlendColor : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, BlendColor,BLENDCOLOR);
|
||||
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
||||
virtual int compare(const StateAttribute& sa) const
|
||||
{
|
||||
// check the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macro's below.
|
||||
// Check for equal types, then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macros below.
|
||||
COMPARE_StateAttribute_Types(BlendColor,sa)
|
||||
|
||||
// compare each paramter in turn against the rhs.
|
||||
// Compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_constantColor)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // Passed all the above comparison macros, so must be equal.
|
||||
}
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
@@ -64,9 +64,9 @@ class SG_EXPORT BlendColor : public StateAttribute
|
||||
|
||||
|
||||
|
||||
/** Extensions class which encapsulates the querring of extensions and
|
||||
* associated function pointers, and provide convinience wrappers to
|
||||
* check for the extensions or use the associated functions.*/
|
||||
/** Encapsulates queries of extension availability, obtains extension
|
||||
* function pointers, and provides convinience wrappers for
|
||||
* calling extension functions. */
|
||||
class SG_EXPORT Extensions : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@@ -94,17 +94,16 @@ class SG_EXPORT BlendColor : public StateAttribute
|
||||
|
||||
};
|
||||
|
||||
/** Function to call to get the extension of a specified context.
|
||||
* If the Exentsion object for that context has not yet been created then
|
||||
* and the 'createIfNotInitalized' flag been set to false then returns NULL.
|
||||
* If 'createIfNotInitalized' is true then the Extensions object is
|
||||
* automatically created. However, in this case the extension object
|
||||
* only be created with the graphics context associated with ContextID..*/
|
||||
/** Returns the Extensions object for the given context.
|
||||
* If createIfNotInitalized is true and the Exentsions object doesn't
|
||||
* exist, getExtensions() creates it on the given context.
|
||||
* Returns NULL if createIfNotInitalized is false and the Extensions
|
||||
* object doesn't exist. */
|
||||
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
|
||||
|
||||
/** setExtensions allows users to override the extensions across graphics contexts.
|
||||
* typically used when you have different extensions supported across graphics pipes
|
||||
* but need to ensure that they all use the same low common denominator extensions.*/
|
||||
/** setExtensions() allows users to override the extensions across graphics contexts.
|
||||
* Typically used when you have different extensions supported across graphics pipes,
|
||||
* but need to ensure that they all use the same low common denominator extensions. */
|
||||
static void setExtensions(unsigned int contextID,Extensions* extensions);
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** BlendFunc - encapsulates the OpenGL blend/transparency state.*/
|
||||
/** Encapsulates OpenGL blend/transparency state. */
|
||||
class SG_EXPORT BlendFunc : public StateAttribute
|
||||
{
|
||||
public :
|
||||
@@ -38,7 +38,7 @@ class SG_EXPORT BlendFunc : public StateAttribute
|
||||
|
||||
BlendFunc(GLenum source, GLenum destination);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
BlendFunc(const BlendFunc& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(trans,copyop),
|
||||
_source_factor(trans._source_factor),
|
||||
@@ -46,18 +46,18 @@ class SG_EXPORT BlendFunc : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, BlendFunc,BLENDFUNC);
|
||||
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
||||
virtual int compare(const StateAttribute& sa) const
|
||||
{
|
||||
// check the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macro's below.
|
||||
// Check for equal types, then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macros below.
|
||||
COMPARE_StateAttribute_Types(BlendFunc,sa)
|
||||
|
||||
// compare each paramter in turn against the rhs.
|
||||
// Compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_source_factor)
|
||||
COMPARE_StateAttribute_Parameter(_destination_factor)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // Passed all the above comparison macros, so must be equal.
|
||||
}
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
|
||||
@@ -23,47 +23,47 @@ namespace osg {
|
||||
class BoundingSphere;
|
||||
|
||||
/** General purpose axis-aligned bounding box class for enclosing objects/vertices.
|
||||
Used to bounding the leaf objects in the scene,
|
||||
i.e. osg::Drawable's to assist in view frustum culling etc.
|
||||
* Bounds leaf objects in a scene such as osg::Drawable objects. Used for frustum
|
||||
* culling etc.
|
||||
*/
|
||||
class SG_EXPORT BoundingBox
|
||||
{
|
||||
public:
|
||||
|
||||
/** The corner with the smallest values for each coordinate of the
|
||||
bounding box.*/
|
||||
Vec3 _min;
|
||||
/** The corner with the largest values for each coordinate of the
|
||||
bounding box.*/
|
||||
Vec3 _max;
|
||||
/** Minimum extent. (Smallest X, Y, and Z values of all coordinates.) */
|
||||
Vec3 _min;
|
||||
/** Maximum extent. (Greatest X, Y, and Z values of all coordinates.) */
|
||||
Vec3 _max;
|
||||
|
||||
/** construct to invalid values to represent an unset bounding box.*/
|
||||
/** Creates an uninitialized bounding box. */
|
||||
inline BoundingBox() : _min(FLT_MAX,FLT_MAX,FLT_MAX),
|
||||
_max(-FLT_MAX,-FLT_MAX,-FLT_MAX) {}
|
||||
|
||||
/** construct to with specified min and max values.*/
|
||||
/** Creates a bounding box initialized to the given extents. */
|
||||
inline BoundingBox(float xmin,float ymin,float zmin,
|
||||
float xmax,float ymax,float zmax) :
|
||||
_min(xmin,ymin,zmin),
|
||||
_max(xmax,ymax,zmax) {}
|
||||
|
||||
/** construct to with specified min and max values.*/
|
||||
/** Creates a bounding box initialized to the given extents. */
|
||||
inline BoundingBox(const Vec3& min,const Vec3& max) :
|
||||
_min(min),
|
||||
_max(max) {}
|
||||
|
||||
/** initialize to invalid values to represent an unset bounding box.*/
|
||||
/** Clear the bounding box. Erases existing minimum and maximum extents. */
|
||||
inline void init()
|
||||
{
|
||||
_min.set(FLT_MAX,FLT_MAX,FLT_MAX);
|
||||
_max.set(-FLT_MAX,-FLT_MAX,-FLT_MAX);
|
||||
}
|
||||
|
||||
|
||||
/** Returns true if the bounding box extents are valid, false otherwise. */
|
||||
inline bool valid() const
|
||||
{
|
||||
return _max.x()>=_min.x() && _max.y()>=_min.y() && _max.z()>=_min.z();
|
||||
}
|
||||
|
||||
/** Sets the bounding box extents. */
|
||||
inline void set (float xmin,float ymin,float zmin,
|
||||
float xmax,float ymax,float zmax)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class SG_EXPORT BoundingBox
|
||||
_max.set(xmax,ymax,zmax);
|
||||
}
|
||||
|
||||
/** construct to with specified min and max values.*/
|
||||
/** Sets the bounding box extents. */
|
||||
inline void set(const Vec3& min,const Vec3& max)
|
||||
{
|
||||
_min = min;
|
||||
@@ -97,37 +97,37 @@ class SG_EXPORT BoundingBox
|
||||
inline float& zMax() { return _max.z(); }
|
||||
inline float zMax() const { return _max.z(); }
|
||||
|
||||
/** Calculate and return the center of the bounding box.*/
|
||||
/** Calculates and returns the bounding box center. */
|
||||
inline const Vec3 center() const
|
||||
{
|
||||
return (_min+_max)*0.5f;
|
||||
}
|
||||
|
||||
/** Calculate and return the radius of the bounding box.*/
|
||||
/** Calculates and returns the bounding box radius. */
|
||||
inline float radius() const
|
||||
{
|
||||
return sqrtf(radius2());
|
||||
}
|
||||
|
||||
/** Calculate and return the radius squared of the bounding box.
|
||||
Note, radius2() is faster to calculate than radius().*/
|
||||
/** Calculates and returns the squared length of the bounding box radius.
|
||||
* Note, radius2() is faster to calculate than radius(). */
|
||||
inline float radius2() const
|
||||
{
|
||||
return 0.25f*((_max-_min).length2());
|
||||
}
|
||||
|
||||
/** return the corner of the bounding box.
|
||||
Position (pos) is specified by a number between 0 and 7,
|
||||
the first bit toggles between x min and x max, second
|
||||
bit toggles between y min and y max, third bit toggles
|
||||
between z min and z max.*/
|
||||
/** Returns a specific corner of the bounding box.
|
||||
* pos specifies the corner as a number between 0 and 7.
|
||||
* Each bit selects an axis, X, Y, or Z from least- to
|
||||
* most-significant. Unset bits select the minimum value
|
||||
* for that axis, and set bits select the maximum. */
|
||||
inline const Vec3 corner(unsigned int pos) const
|
||||
{
|
||||
return Vec3(pos&1?_max.x():_min.x(),pos&2?_max.y():_min.y(),pos&4?_max.z():_min.z());
|
||||
}
|
||||
|
||||
/** If the vertex is out-with the box expand to encompass vertex.
|
||||
If this box is empty then move set this box's min max to vertex. */
|
||||
/** Expands the bounding box to include the given coordinate.
|
||||
* If the box is uninitialized, set its min and max extents to v. */
|
||||
inline void expandBy(const Vec3& v)
|
||||
{
|
||||
if(v.x()<_min.x()) _min.x() = v.x();
|
||||
@@ -140,8 +140,9 @@ class SG_EXPORT BoundingBox
|
||||
if(v.z()>_max.z()) _max.z() = v.z();
|
||||
}
|
||||
|
||||
/** If the vertex is out-with the box expand to encompass vertex.
|
||||
If this box is empty then move set this box's min max to vertex. */
|
||||
/** Expands the bounding box to include the given coordinate.
|
||||
* If the box is uninitialized, set its min and max extents to
|
||||
* Vec3(x,y,z). */
|
||||
inline void expandBy(float x,float y,float z)
|
||||
{
|
||||
if(x<_min.x()) _min.x() = x;
|
||||
@@ -154,23 +155,23 @@ class SG_EXPORT BoundingBox
|
||||
if(z>_max.z()) _max.z() = z;
|
||||
}
|
||||
|
||||
/** If incoming box is out-with the box expand to encompass incoming box.
|
||||
If this box is empty then move set this box to incoming box. */
|
||||
/** Expands this bounding box to include the given bounding box.
|
||||
* If this box is uninitialized, set it equal to bb. */
|
||||
void expandBy(const BoundingBox& bb);
|
||||
|
||||
/** If incoming sphere is out-with the box expand to encompass incoming sphere.
|
||||
If this box is empty then move set this box to encompass the sphere. */
|
||||
/** Expands this bounding box to include the given sphere.
|
||||
* If this box is uninitialized, set it to include sh. */
|
||||
void expandBy(const BoundingSphere& sh);
|
||||
|
||||
|
||||
/** Compute the intesection of this bounding box with the specified bounding box.*/
|
||||
/** Returns the intesection of this bounding box and the specified bounding box. */
|
||||
BoundingBox intersect(const BoundingBox& bb) const
|
||||
{ return osg::BoundingBox(osg::maximum(xMin(),bb.xMin()),osg::maximum(yMin(),bb.yMin()),osg::maximum(zMin(),bb.zMin()),
|
||||
osg::minimum(xMax(),bb.xMax()),osg::minimum(yMax(),bb.yMax()),osg::minimum(zMax(),bb.zMax()));
|
||||
|
||||
}
|
||||
|
||||
/** return true if this bounding box with the specified bounding box.*/
|
||||
/** Return true if this bounding box intersects the specified bounding box. */
|
||||
bool intersects(const BoundingBox& bb) const
|
||||
{ return osg::maximum(xMin(),bb.xMin()) <= osg::minimum(xMax(),bb.xMax()) &&
|
||||
osg::maximum(yMin(),bb.yMin()) <= osg::minimum(yMax(),bb.yMax()) &&
|
||||
@@ -178,7 +179,7 @@ class SG_EXPORT BoundingBox
|
||||
|
||||
}
|
||||
|
||||
/** return true is vertex v is within the box.*/
|
||||
/** Returns true if this bounding box contains the specified coordinate. */
|
||||
inline bool contains(const Vec3& v) const
|
||||
{
|
||||
return valid() &&
|
||||
|
||||
Reference in New Issue
Block a user