From Eric Hammil, typo and spelling fixes
This commit is contained in:
parent
63f8935afb
commit
ee67127279
@ -16,7 +16,7 @@
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
// non windows, doesn't require nonsense as seen below :-)
|
||||
// Non Windows, doesn't require nonsense as seen below :-)
|
||||
#ifndef __gl_h_
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
@ -25,7 +25,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// required for compatibility with glext.h sytle function definitions of
|
||||
// Required for compatibility with glext.h sytle function definitions of
|
||||
// OpenGL extensions, such as in src/osg/Point.cpp.
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
#else // ! __CYGWIN__
|
||||
|
||||
// Under windows avoid including <windows.h>
|
||||
// Under Windows avoid including <windows.h>
|
||||
// to avoid name space pollution, but Win32's <GL/gl.h>
|
||||
// needs APIENTRY and WINGDIAPI defined properly.
|
||||
// XXX This is from Win32's <windef.h>
|
||||
|
@ -33,19 +33,19 @@ namespace osg {
|
||||
|
||||
|
||||
|
||||
/** return true if OpenGL "extension" is supported.
|
||||
* note: Must only called within a valid OpenGL context,
|
||||
/** Return true if OpenGL "extension" is supported.
|
||||
* Note: Must only be called within a valid OpenGL context,
|
||||
* undefined behavior may occur otherwise.
|
||||
*/
|
||||
*/
|
||||
extern SG_EXPORT bool isGLExtensionSupported(const char *extension);
|
||||
|
||||
/** return the address of the specified OpenGL function.
|
||||
* return NULL if function not supported by OpenGL library.
|
||||
/** Return the address of the specified OpenGL function.
|
||||
* Return NULL if function not supported by OpenGL library.
|
||||
* Note, glGLExtensionFuncPtr is declared inline so that the code
|
||||
* is compiled localy to the calling code. This should get by Windows
|
||||
* is compiled locally to the calling code. This should get by Windows'
|
||||
* dumb implementation of having different GL function ptr's for each
|
||||
* library when links to it.
|
||||
*/
|
||||
* library when linked to it.
|
||||
*/
|
||||
inline void* getGLExtensionFuncPtr(const char *funcName)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
@ -80,26 +80,26 @@ inline void* getGLExtensionFuncPtr(const char *funcName)
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Set a list of extensions to disable for different OpenGL renders, this allows
|
||||
* OSG applications to work around OpenGL drivers bugs which are due to problemenatic extension support.
|
||||
/** Set a list of extensions to disable for different OpenGL renderers. This allows
|
||||
* OSG applications to work around OpenGL drivers' bugs which are due to problematic extension support.
|
||||
* The format of the string is:
|
||||
* "GLRendererString : ExtensionName, ExtensionName; GLRenderString2 : ExtensionName;"
|
||||
* An example of is : "SUN_XVR1000:GL_EXT_texture_filter_anisotropic"
|
||||
* The default setting of GLExtensionDisableString is obtain from the OSG_GL_EXTENSION_DISABLE
|
||||
* The default setting of GLExtensionDisableString is obtained from the OSG_GL_EXTENSION_DISABLE
|
||||
* environmental variable.
|
||||
*/
|
||||
*/
|
||||
extern SG_EXPORT void setGLExtensionDisableString(const std::string& disableString);
|
||||
|
||||
/** Get the list of extensions that are disabled for various OpenGL renders.*/
|
||||
/** Get the list of extensions that are disabled for various OpenGL renderers. */
|
||||
extern SG_EXPORT std::string& getGLExtensionDisableString();
|
||||
|
||||
|
||||
|
||||
/** return the address of the specified OpenGL function, if not found then
|
||||
/** Return the address of the specified OpenGL function. If not found then
|
||||
* check a second function name, if this fails then return NULL as function is
|
||||
* not supported by OpenGL library. This is usual for checking something
|
||||
* not supported by OpenGL library. This is used for checking something
|
||||
* like glActiveTexture (which is in OGL1.3) or glActiveTextureARB.
|
||||
*/
|
||||
*/
|
||||
inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFuncName)
|
||||
{
|
||||
void* ptr = getGLExtensionFuncPtr(funcName);
|
||||
@ -107,10 +107,10 @@ inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFunc
|
||||
return getGLExtensionFuncPtr(fallbackFuncName);
|
||||
}
|
||||
|
||||
/** return true if OpenGL "extension" is supported.
|
||||
* note: Must only called within a valid OpenGL context,
|
||||
/** Return true if OpenGL "extension" is supported.
|
||||
* Note: Must only be called within a valid OpenGL context,
|
||||
* undefined behavior may occur otherwise.
|
||||
*/
|
||||
*/
|
||||
extern SG_EXPORT bool isGLUExtensionSupported(const char *extension);
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ class SG_EXPORT Geometry : public Drawable
|
||||
|
||||
Geometry();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual Object* cloneType() const { return new Geometry(); }
|
||||
@ -137,8 +137,9 @@ class SG_EXPORT Geometry : public Drawable
|
||||
mutable unsigned int offset;
|
||||
};
|
||||
|
||||
/** static ArrayData which is returned get getTexCoordData(i) const and getVertexAttribData(i) const
|
||||
* when i is out of range.*/
|
||||
/** Static ArrayData which is returned from getTexCoordData(i) const and getVertexAttribData(i) const
|
||||
* when i is out of range.
|
||||
*/
|
||||
static const ArrayData s_InvalidArrayData;
|
||||
|
||||
typedef std::vector< ArrayData > ArrayList;
|
||||
@ -275,34 +276,36 @@ class SG_EXPORT Geometry : public Drawable
|
||||
PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); }
|
||||
const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); }
|
||||
|
||||
/** Add a primitive set to the geometry.*/
|
||||
/** Add a primitive set to the geometry. */
|
||||
bool addPrimitiveSet(PrimitiveSet* primitiveset);
|
||||
|
||||
/** Set a primitive set to the specified position in geometry's primitive set list.*/
|
||||
/** Set a primitive set to the specified position in geometry's primitive set list. */
|
||||
bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
|
||||
|
||||
/** Insert a primitive set to the specified position in geometry's primitive set list.*/
|
||||
/** Insert a primitive set to the specified position in geometry's primitive set list. */
|
||||
bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
|
||||
|
||||
/** Remove primitive set(s) from the specified position in geometry's primitive set list.*/
|
||||
/** Remove primitive set(s) from the specified position in geometry's primitive set list. */
|
||||
bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1);
|
||||
|
||||
/** Get the index number of a primitive set, return a value between
|
||||
* 0 and getNumPrimitiveSet()-1 if found, if not found then return getNumPrimitiveSet().
|
||||
* When checking for a valid find value use if ((value=geoemtry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet()) as*/
|
||||
* When checking for a valid find value use if ((value=geometry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet())
|
||||
*/
|
||||
unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const;
|
||||
|
||||
|
||||
/** Set whether fast paths should be used when supported.*/
|
||||
/** Set whether fast paths should be used when supported. */
|
||||
void setFastPathHint(bool on) { _fastPathHint = on; }
|
||||
|
||||
/** Get whether fast paths should be used when supported.*/
|
||||
/** Get whether fast paths should be used when supported. */
|
||||
bool getFastPathHint() const { return _fastPathHint; }
|
||||
|
||||
/** return true if OpenGL fast paths will be used with drawing this Geometry.
|
||||
/** Return true if OpenGL fast paths will be used with drawing this Geometry.
|
||||
* Fast paths use vertex arrays, and glDrawArrays/glDrawElements. Slow paths
|
||||
* use glBegin()/glVertex.../glEnd(). Use of per primitive bindings or per vertex indexed
|
||||
* arrays will drop the rendering path off the fast path.*/
|
||||
* arrays will drop the rendering path off the fast path.
|
||||
*/
|
||||
inline bool areFastPathsUsed() const { return _fastPath && _fastPathHint; }
|
||||
|
||||
bool computeFastPathsUsed();
|
||||
@ -327,34 +330,34 @@ class SG_EXPORT Geometry : public Drawable
|
||||
const osg::Geometry* getInternalOptimizedGeometry() const { return _internalOptimizedGeometry.get(); }
|
||||
|
||||
|
||||
/** draw Geometry directly ignoring an OpenGL display list which could be attached.
|
||||
/** Draw Geometry directly ignoring an OpenGL display list which could be attached.
|
||||
* This is the internal draw method which does the drawing itself,
|
||||
* and is the method to override when deriving from Geometry for user-drawn objects.
|
||||
*/
|
||||
*/
|
||||
virtual void drawImplementation(State& state) const;
|
||||
|
||||
/** return true, osg::Geometry does support accept(AttributeFunctor&).*/
|
||||
/** Return true, osg::Geometry does support accept(AttributeFunctor&). */
|
||||
virtual bool supports(AttributeFunctor&) const { return true; }
|
||||
|
||||
/** accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** Accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. */
|
||||
virtual void accept(AttributeFunctor& af);
|
||||
|
||||
/** return true, osg::Geometry does support accept(ConstAttributeFunctor&).*/
|
||||
/** Return true, osg::Geometry does support accept(ConstAttributeFunctor&). */
|
||||
virtual bool supports(ConstAttributeFunctor&) const { return true; }
|
||||
|
||||
/** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** Accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. */
|
||||
virtual void accept(ConstAttributeFunctor& af) const;
|
||||
|
||||
/** return true, osg::Geometry does support accept(PrimitiveFunctor&) .*/
|
||||
/** Return true, osg::Geometry does support accept(PrimitiveFunctor&). */
|
||||
virtual bool supports(PrimitiveFunctor&) const { return true; }
|
||||
|
||||
/** accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has.*/
|
||||
/** Accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has. */
|
||||
virtual void accept(PrimitiveFunctor& pf) const;
|
||||
|
||||
/** return true, osg::Geometry does support accept(PrimitiveIndexFunctor&) .*/
|
||||
/** Return true, osg::Geometry does support accept(PrimitiveIndexFunctor&). */
|
||||
virtual bool supports(PrimitiveIndexFunctor&) const { return true; }
|
||||
|
||||
/** accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has.*/
|
||||
/** Accept a PrimitiveFunctor and call its methods to tell it about the interal primitives that this Drawable has. */
|
||||
virtual void accept(PrimitiveIndexFunctor& pf) const;
|
||||
|
||||
|
||||
@ -387,11 +390,13 @@ class SG_EXPORT Geometry : public Drawable
|
||||
};
|
||||
|
||||
/** Convenience function to be used for creating quad geometry with texture coords.
|
||||
* Tex coords go from left bottom (l,b) to right top (r,t).*/
|
||||
* Tex coords go from left bottom (l,b) to right top (r,t).
|
||||
*/
|
||||
extern SG_EXPORT Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVec,const Vec3& heightVec, float l, float b, float r, float t);
|
||||
|
||||
/** Convenience function to be used for creating quad geometry with texture coords.
|
||||
* Tex coords go from bottom left (0,0) to top right (s,t).*/
|
||||
* Tex coords go from bottom left (0,0) to top right (s,t).
|
||||
*/
|
||||
inline Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVec,const Vec3& heightVec, float s=1.0f, float t=1.0f)
|
||||
{
|
||||
return createTexturedQuadGeometry(corner,widthVec,heightVec, 0.0f, 0.0f, s, t);
|
||||
|
@ -22,8 +22,8 @@ namespace osg {
|
||||
typedef std::vector< ref_ptr<Node> > NodeList;
|
||||
|
||||
/** General group node which maintains a list of children.
|
||||
Children are reference counted. This allows children to be shared
|
||||
with memory management handled automatically via osg::Referenced.
|
||||
* Children are reference counted. This allows children to be shared
|
||||
* with memory management handled automatically via osg::Referenced.
|
||||
*/
|
||||
class SG_EXPORT Group : public Node
|
||||
{
|
||||
@ -32,7 +32,7 @@ class SG_EXPORT Group : public Node
|
||||
|
||||
Group();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Group(const Group&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(osg, Group);
|
||||
@ -43,57 +43,58 @@ class SG_EXPORT Group : public Node
|
||||
virtual void traverse(NodeVisitor& nv);
|
||||
|
||||
/** Add Node to Group.
|
||||
* If node is not NULL and is not contained in Group then increment its
|
||||
* reference count, add it to the child list and dirty the bounding
|
||||
* sphere to force it to recompute on next getBound() and return true for success.
|
||||
* Otherwise return false. Scene nodes can't be added as child nodes.
|
||||
*/
|
||||
* If node is not NULL and is not contained in Group then increment its
|
||||
* reference count, add it to the child list and dirty the bounding
|
||||
* sphere to force it to recompute on next getBound() and return true for success.
|
||||
* Otherwise return false. Scene nodes can't be added as child nodes.
|
||||
*/
|
||||
virtual bool addChild( Node *child );
|
||||
|
||||
/** Insert Node to Group at specific location.
|
||||
* The new child node is inserted into the child list
|
||||
* before the node at the specified index. No nodes
|
||||
* are removed from the group with this operation.
|
||||
*/
|
||||
* The new child node is inserted into the child list
|
||||
* before the node at the specified index. No nodes
|
||||
* are removed from the group with this operation.
|
||||
*/
|
||||
virtual bool insertChild( unsigned int index, Node *child );
|
||||
|
||||
/** Remove Node from Group.
|
||||
* If Node is contained in Group then remove it from the child
|
||||
* list, decrement its reference count, and dirty the
|
||||
* bounding sphere to force it to recompute on next getBound() and
|
||||
* return true for success. If Node is not found then return false
|
||||
* and do not change the reference count of the Node.
|
||||
*/
|
||||
* If Node is contained in Group then remove it from the child
|
||||
* list, decrement its reference count, and dirty the
|
||||
* bounding sphere to force it to recompute on next getBound() and
|
||||
* return true for success. If Node is not found then return false
|
||||
* and do not change the reference count of the Node.
|
||||
*/
|
||||
virtual bool removeChild( Node *child );
|
||||
|
||||
virtual bool removeChild(unsigned int pos,unsigned int numChildrenToRemove=1);
|
||||
|
||||
/** Replace specified Node with another Node.
|
||||
* Equivalent to setChild(getChildIndex(orignChild),node),
|
||||
* see docs for setChild for futher details on implementation.*/
|
||||
* Equivalent to setChild(getChildIndex(orignChild),node)
|
||||
* See docs for setChild for futher details on implementation.
|
||||
*/
|
||||
virtual bool replaceChild( Node *origChild, Node* newChild );
|
||||
|
||||
/** return the number of chilren nodes.*/
|
||||
/** Return the number of chilren nodes. */
|
||||
inline unsigned int getNumChildren() const { return _children.size(); }
|
||||
|
||||
/** set child node at position i.
|
||||
* return true if set correctly, false on failure (if node==NULL || i is out of range).
|
||||
* When set can be successful applied, the algorithm is : decrement the reference count origNode and increments the
|
||||
* reference count of newNode, and dirty the bounding sphere
|
||||
* to force it to recompute on next getBound() and returns true.
|
||||
* If origNode is not found then return false and do not
|
||||
* add newNode. If newNode is NULL then return false and do
|
||||
* not remove origNode. Also returns false if newChild is a Scene node.
|
||||
*/
|
||||
/** Set child node at position i.
|
||||
* Return true if set correctly, false on failure (if node==NULL || i is out of range).
|
||||
* When Set can be successful applied, the algorithm is : decrement the reference count origNode and increment the
|
||||
* reference count of newNode, and dirty the bounding sphere
|
||||
* to force it to recompute on next getBound() and return true.
|
||||
* If origNode is not found then return false and do not
|
||||
* add newNode. If newNode is NULL then return false and do
|
||||
* not remove origNode. Also returns false if newChild is a Scene node.
|
||||
*/
|
||||
virtual bool setChild( unsigned int i, Node* node );
|
||||
|
||||
/** return child node at position i.*/
|
||||
/** Return child node at position i. */
|
||||
inline Node* getChild( unsigned int i ) { return _children[i].get(); }
|
||||
|
||||
/** return child node at position i.*/
|
||||
/** Return child node at position i. */
|
||||
inline const Node* getChild( unsigned int i ) const { return _children[i].get(); }
|
||||
|
||||
/** return true if node is contained within Group.*/
|
||||
/** Return true if node is contained within Group. */
|
||||
inline bool containsNode( const Node* node ) const
|
||||
{
|
||||
|
||||
@ -108,7 +109,8 @@ class SG_EXPORT Group : public Node
|
||||
|
||||
/** Get the index number of child, return a value between
|
||||
* 0 and _children.size()-1 if found, if not found then
|
||||
* return _children.size().*/
|
||||
* return _children.size().
|
||||
*/
|
||||
inline unsigned int getChildIndex( const Node* node ) const
|
||||
{
|
||||
for (unsigned int childNum=0;childNum<_children.size();++childNum)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <vector>
|
||||
|
||||
#ifndef GL_VERSION_1_2
|
||||
/* 1.2 definitions...*/
|
||||
// 1.2 definitions...
|
||||
#define GL_BGR 0x80E0
|
||||
#define GL_BGRA 0x80E1
|
||||
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Image class for encapsulating the storage texture image data.*/
|
||||
/** Image class for encapsulating the storage texture image data. */
|
||||
class SG_EXPORT Image : public Object
|
||||
{
|
||||
|
||||
@ -50,7 +50,7 @@ class SG_EXPORT Image : public Object
|
||||
|
||||
Image();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual Object* cloneType() const { return new Image(); }
|
||||
@ -59,7 +59,7 @@ class SG_EXPORT Image : public Object
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "Image"; }
|
||||
|
||||
/** 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 Image& rhs) const;
|
||||
|
||||
void setFileName(const std::string& fileName);
|
||||
@ -72,25 +72,25 @@ class SG_EXPORT Image : public Object
|
||||
USE_MALLOC_FREE
|
||||
};
|
||||
|
||||
/** Set the method used for deleting data once it goes out of scope.*/
|
||||
/** Set the method used for deleting data once it goes out of scope. */
|
||||
void setAllocationMode(AllocationMode mode) { _allocationMode = mode; }
|
||||
|
||||
/** Get the method used for deleting data once it goes out of scope.*/
|
||||
/** Get the method used for deleting data once it goes out of scope. */
|
||||
AllocationMode getAllocationMode() const { return _allocationMode; }
|
||||
|
||||
|
||||
/* allocated a pixel block of specified size and type.*/
|
||||
/** Allocate a pixel block of specified size and type. */
|
||||
void allocateImage(int s,int t,int r,
|
||||
GLenum pixelFormat,GLenum type,
|
||||
int packing=1);
|
||||
|
||||
|
||||
/** set the image data and pixelFormat.
|
||||
* note, when the packing value is negative (the default is -1) this method assumes
|
||||
/** Set the image data and pixelFormat.
|
||||
* Note, when the packing value is negative (the default is -1) this method assumes
|
||||
* a _packing width of 1 if the width is not a multiple of 4,
|
||||
* otherwise automatically sets to _packing to 4. If a positive
|
||||
* value of packing is supplied than _packing is simply set to that value.
|
||||
*/
|
||||
*/
|
||||
void setImage(int s,int t,int r,
|
||||
GLint internalTextureformat,
|
||||
GLenum pixelFormat,GLenum type,
|
||||
@ -98,14 +98,16 @@ class SG_EXPORT Image : public Object
|
||||
AllocationMode mode,
|
||||
int packing=1);
|
||||
|
||||
/** read pixels from current frame buffer at specified position and size, using glReadPixels.
|
||||
* Create memory for storage if required, reuse existing pixel coords if possible.*/
|
||||
/** Read pixels from current frame buffer at specified position and size, using glReadPixels.
|
||||
* Create memory for storage if required, reuse existing pixel coords if possible.
|
||||
*/
|
||||
void readPixels(int x,int y,int width,int height,
|
||||
GLenum pixelFormat,GLenum type);
|
||||
|
||||
|
||||
/** read the contents of the current bound texture, handling compressed pixelFormats if present.
|
||||
* Create memory for storage if required, reuse existing pixel coords if possible.*/
|
||||
/** Read the contents of the current bound texture, handling compressed pixelFormats if present.
|
||||
* Create memory for storage if required, reuse existing pixel coords if possible.
|
||||
*/
|
||||
void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable);
|
||||
|
||||
|
||||
@ -118,22 +120,23 @@ class SG_EXPORT Image : public Object
|
||||
/** Copy a source Image into a subpart of this Image at specified position.
|
||||
* Typically used to copy to an already allocated image, such as creating
|
||||
* a 3D image from a stack 2D images.
|
||||
* If the this Image is empty then image data is created to
|
||||
* accomodate the imaging image in its offset position.
|
||||
* If source is NULL then no operation happens, this Image is left unchanged.*/
|
||||
* If this Image is empty then image data is created to
|
||||
* accomodate the source image in its offset position.
|
||||
* If source is NULL then no operation happens, this Image is left unchanged.
|
||||
*/
|
||||
void copySubImage(int s_offset,int t_offset,int r_offset,osg::Image* source);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Width of image.*/
|
||||
/** Width of image. */
|
||||
inline int s() const { return _s; }
|
||||
|
||||
/** Height of image.*/
|
||||
/** Height of image. */
|
||||
inline int t() const { return _t; }
|
||||
|
||||
/** Depth of image.*/
|
||||
/** Depth of image. */
|
||||
inline int r() const { return _r; }
|
||||
|
||||
void setInternalTextureFormat(GLint internalFormat);
|
||||
@ -146,25 +149,25 @@ class SG_EXPORT Image : public Object
|
||||
|
||||
inline unsigned int getPacking() const { return _packing; }
|
||||
|
||||
/** return the numbers of bits required for each pixel.*/
|
||||
/** Return the number of bits required for each pixel. */
|
||||
inline unsigned int getPixelSizeInBits() const { return computePixelSizeInBits(_pixelFormat,_dataType); }
|
||||
|
||||
/** return the numbers of bytes each row of pixels occupies once it has been packed.*/
|
||||
/** Return the number of bytes each row of pixels occupies once it has been packed. */
|
||||
inline unsigned int getRowSizeInBytes() const { return computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing); }
|
||||
|
||||
/** return the numbers of bytes each image (_s*_t) of pixels occupies..*/
|
||||
/** Return the number of bytes each image (_s*_t) of pixels occupies. */
|
||||
inline unsigned int getImageSizeInBytes() const { return getRowSizeInBytes()*_t; }
|
||||
|
||||
/** return the numbers of bytes the whole row/image/volume of pixels occupies.*/
|
||||
/** Return the number of bytes the whole row/image/volume of pixels occupies. */
|
||||
inline unsigned int getTotalSizeInBytes() const { return getImageSizeInBytes()*_r; }
|
||||
|
||||
/** return the numbers of bytes the whole row/image/volume of pixels occupies, including all mip maps if included.*/
|
||||
/** Return the number of bytes the whole row/image/volume of pixels occupies, including all mip maps if included. */
|
||||
unsigned int getTotalSizeInBytesIncludingMipmaps() const;
|
||||
|
||||
/** raw image data.*/
|
||||
/** Raw image data. */
|
||||
inline unsigned char *data() { return _data; }
|
||||
|
||||
/** raw const image data.*/
|
||||
/** Raw const image data. */
|
||||
inline const unsigned char *data() const { return _data; }
|
||||
|
||||
|
||||
@ -180,26 +183,27 @@ class SG_EXPORT Image : public Object
|
||||
return _data+(column*getPixelSizeInBits())/8+row*getRowSizeInBytes()+image*getImageSizeInBytes();
|
||||
}
|
||||
|
||||
/** Flip the image horizontally.*/
|
||||
/** Flip the image horizontally. */
|
||||
void flipHorizontal();
|
||||
|
||||
/** Flip the image vertically.*/
|
||||
/** Flip the image vertically. */
|
||||
void flipVertical();
|
||||
|
||||
|
||||
/** Ensure image dimensions are a power of two.
|
||||
* Mip Mapped texture require the image dimensions to be
|
||||
* Mipmapped textures require the image dimensions to be
|
||||
* power of two and are within the maxiumum texture size for
|
||||
* the host machine.*/
|
||||
* the host machine.
|
||||
*/
|
||||
void ensureValidSizeForTexturing(GLint maxTextureSize);
|
||||
|
||||
/** Dirty the image, which increments the modified flag, to force osg::Texture to reload the image.*/
|
||||
/** Dirty the image, which increments the modified flag, to force osg::Texture to reload the image. */
|
||||
inline void dirty() { ++_modifiedTag; }
|
||||
|
||||
/** Set the modified tag value, only used by osg::Texture when using texture subloading. */
|
||||
/** Set the modified tag value. Only used by osg::Texture when using texture subloading. */
|
||||
inline void setModifiedTag(unsigned int value) { _modifiedTag=value; }
|
||||
|
||||
/** Get modified tag value, only used by osg::Texture when using texture subloading. */
|
||||
/** Get modified tag value. Only used by osg::Texture when using texture subloading. */
|
||||
inline unsigned int getModifiedTag() const { return _modifiedTag; }
|
||||
|
||||
|
||||
@ -209,7 +213,7 @@ class SG_EXPORT Image : public Object
|
||||
static unsigned int computeRowWidthInBytes(int width,GLenum pixelFormat,GLenum type,int packing);
|
||||
static int computeNearestPowerOfTwo(int s,float bias=0.5f);
|
||||
|
||||
// precomputed mipmaps stuff;
|
||||
/** Precomputed mipmaps stuff. */
|
||||
typedef std::vector< unsigned int > MipmapDataType;
|
||||
|
||||
inline bool isMipmap() const {return !_mipmapData.empty();};
|
||||
@ -219,8 +223,7 @@ class SG_EXPORT Image : public Object
|
||||
return _mipmapData.size()+1;
|
||||
};
|
||||
|
||||
// send offsets into data
|
||||
// It is assumed that first mipmap offset (index 0) is 0
|
||||
/** Send offsets into data. It is assumed that first mipmap offset (index 0) is 0.*/
|
||||
inline void setMipmapData(const MipmapDataType& mipmapDataVector)
|
||||
{
|
||||
_mipmapData = mipmapDataVector;
|
||||
@ -236,7 +239,7 @@ class SG_EXPORT Image : public Object
|
||||
};
|
||||
|
||||
|
||||
/** return true of this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized).*/
|
||||
/** Return true if this image is translucent - i.e. it has alpha values that are less 1.0 (when normalized). */
|
||||
bool isImageTranslucent() const;
|
||||
|
||||
protected :
|
||||
@ -267,15 +270,15 @@ class SG_EXPORT Image : public Object
|
||||
|
||||
class Geode;
|
||||
|
||||
/** Convenience function to be used by images loaders to generate a valid geode
|
||||
* to return for readNode().
|
||||
* Use the images s and t values scale the dimensions of the image.
|
||||
*/
|
||||
/** Convenience function to be used by image loaders to generate a valid geode
|
||||
* to return for readNode().
|
||||
* Use the image's s and t values to scale the dimensions of the image.
|
||||
*/
|
||||
extern SG_EXPORT Geode* createGeodeForImage(Image* image);
|
||||
/** Convenience function to be used by images loaders to generate a valid geode
|
||||
* to return for readNode().
|
||||
* Use the specified s and t values scale the dimensions of the image.
|
||||
*/
|
||||
/** Convenience function to be used by image loaders to generate a valid geode
|
||||
* to return for readNode().
|
||||
* Use the specified s and t values to scale the dimensions of the image.
|
||||
*/
|
||||
extern SG_EXPORT Geode* createGeodeForImage(Image* image,float s,float t);
|
||||
|
||||
}
|
||||
|
@ -19,14 +19,14 @@
|
||||
namespace osg {
|
||||
|
||||
/**
|
||||
* Image Stream class.
|
||||
*/
|
||||
* Image Stream class.
|
||||
*/
|
||||
class SG_EXPORT ImageStream : public Image
|
||||
{
|
||||
public:
|
||||
ImageStream();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual Object* cloneType() const { return new ImageStream(); }
|
||||
@ -35,7 +35,7 @@ class SG_EXPORT ImageStream : public Image
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "ImageStream"; }
|
||||
|
||||
/** 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 Image& rhs) const;
|
||||
|
||||
enum StreamStatus
|
||||
@ -51,7 +51,7 @@ class SG_EXPORT ImageStream : public Image
|
||||
|
||||
virtual void rewind() { _status=REWINDING; }
|
||||
|
||||
virtual void quit(bool /*wiatForThreadToExit*/ = true) {}
|
||||
virtual void quit(bool /*waitForThreadToExit*/ = true) {}
|
||||
|
||||
StreamStatus getStatus() { return _status; }
|
||||
|
||||
|
@ -24,8 +24,8 @@ namespace osg {
|
||||
* between children depending on distance from eye point and image caching.
|
||||
*
|
||||
* The principle behind Imposters is that they cache an image of real geometry and then the image is drawn
|
||||
* in subsequent frames instead of the real geometry. Its a bit like a
|
||||
* Billboard *but* is updated at runtime and w.r.t view point. By drawing
|
||||
* in subsequent frames instead of the real geometry. It's a bit like a
|
||||
* Billboard *but* is updated at runtime and w.r.t view point. By drawing
|
||||
* just the texture mapped quad you can cut down scene complexity and
|
||||
* improve performance.
|
||||
*
|
||||
@ -34,7 +34,7 @@ namespace osg {
|
||||
* http://grail.cs.washington.edu/projects/hic/
|
||||
*
|
||||
* The OSG doesn't implement exactly the same technique as above, but its
|
||||
* should be a good starting place. The OSG's impostors are much less
|
||||
* should be a good starting place. The OSG's impostors are much less
|
||||
* intrusive since you don't need to restructure your whole scene to use
|
||||
* them.
|
||||
*
|
||||
@ -73,29 +73,31 @@ class SG_EXPORT Impostor : public LOD
|
||||
|
||||
/** Set the Impostor threshold distance.
|
||||
* For eye points further than this threshold the Imposter is used if appropriate,
|
||||
* otherwise the LOD children as chosen as per a standard LOD node.*/
|
||||
* otherwise the LOD children as chosen as per a standard LOD node.
|
||||
*/
|
||||
inline void setImpostorThreshold(float distance) { _impostorThreshold = distance; }
|
||||
|
||||
/** Set the Impostor threshold distance relative to the node's bounding
|
||||
* sphere's radius.*/
|
||||
* sphere's radius.
|
||||
*/
|
||||
inline void setImpostorThresholdToBound(float ratio=1.0f) { _impostorThreshold = getBound().radius()*ratio; }
|
||||
|
||||
/* Get the Impostor threshold distance.*/
|
||||
/* Get the Impostor threshold distance. */
|
||||
inline float getImpostorThreshold() const { return _impostorThreshold; }
|
||||
|
||||
/* Get the Impostor threshold distance squared.*/
|
||||
/* Get the Impostor threshold distance squared. */
|
||||
inline float getImpostorThreshold2() const { return _impostorThreshold*_impostorThreshold; }
|
||||
|
||||
/** Find the ImposterSprite which fits the current eye point best.*/
|
||||
/** Find the ImposterSprite which fits the current eye point best. */
|
||||
ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const;
|
||||
|
||||
/** Add an ImpostorSprite to the Impostor.*/
|
||||
/** Add an ImpostorSprite to the Impostor. */
|
||||
void addImpostorSprite(unsigned int contextID, ImpostorSprite* is);
|
||||
|
||||
/** Get the list of ImpostorSprites attached to this Impostor.*/
|
||||
/** Get the list of ImpostorSprites attached to this Impostor. */
|
||||
inline ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) { return _impostorSpriteListBuffer[contexID]; }
|
||||
|
||||
/** Get a const list of ImpostorSprites attached to this const Impostor.*/
|
||||
/** Get a const list of ImpostorSprites attached to this const Impostor. */
|
||||
inline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const { return _impostorSpriteListBuffer[contexID]; }
|
||||
|
||||
protected :
|
||||
|
@ -27,32 +27,33 @@ class Texture2D;
|
||||
class Impostor;
|
||||
class ImpostorSpriteManager;
|
||||
|
||||
/** An ImposterSprite is a textured quad which is rendered in place a
|
||||
* 3D geometry. The ImposterSprite is generated by rendering the original
|
||||
/** An ImposterSprite is a textured quad which is rendered in place of
|
||||
* 3D geometry. The ImposterSprite is generated by rendering the original
|
||||
* 3D geometry to a texture as an image cache. The ImpostorSprite is
|
||||
* automatically generated by the osgUtil::CullVisitor so it not
|
||||
* necessary to deal with it directly.
|
||||
*/
|
||||
*/
|
||||
class SG_EXPORT ImpostorSprite : public Drawable
|
||||
{
|
||||
public:
|
||||
|
||||
ImpostorSprite();
|
||||
|
||||
/** Clone an object of the same type as an ImpostorSprite.*/
|
||||
/** Clone an object of the same type as an ImpostorSprite. */
|
||||
virtual Object* cloneType() const { return new ImpostorSprite(); }
|
||||
|
||||
/** Clone on ImpostorSprite just returns a clone of type,
|
||||
* since it is not appropriate to share data of an ImpostorSprite.*/
|
||||
* since it is not appropriate to share data of an ImpostorSprite.
|
||||
*/
|
||||
virtual Object* clone(const CopyOp&) const { return new ImpostorSprite(); }
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImpostorSprite*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "ImpostorSprite"; }
|
||||
|
||||
/** Set the parent, which must be an Impostor.
|
||||
* Unlike conventional Drawables, ImpostorSprite's can only ever have
|
||||
* Unlike conventional Drawables, ImpostorSprites can only ever have
|
||||
* one parent.
|
||||
*/
|
||||
*/
|
||||
void setParent(Impostor* parent) { _parent = parent; }
|
||||
|
||||
/** Get the parent, which is an Impostor. */
|
||||
@ -61,36 +62,35 @@ class SG_EXPORT ImpostorSprite : public Drawable
|
||||
/** Get the const parent, which is an Impostor. */
|
||||
const Impostor* getParent() const { return _parent; }
|
||||
|
||||
/** Set the eye point for when the ImpsotorSprite was snapped.*/
|
||||
/** Set the eye point for when the ImpostorSprite was snapped. */
|
||||
inline void setStoredLocalEyePoint(const Vec3& v) { _storedLocalEyePoint=v; }
|
||||
|
||||
/** Get the eye point for when the ImpsotorSprite was snapped.*/
|
||||
/** Get the eye point for when the ImpostorSprite was snapped. */
|
||||
inline const Vec3& getStoredLocalEyePoint() const { return _storedLocalEyePoint; }
|
||||
|
||||
/** Set the frame number for when the ImpostorSprite was last used in rendering.*/
|
||||
/** Set the frame number for when the ImpostorSprite was last used in rendering. */
|
||||
inline void setLastFrameUsed(int frameNumber) { _lastFrameUsed = frameNumber; }
|
||||
|
||||
/** Get the frame number for when the ImpostorSprite was last used in rendering.*/
|
||||
/** Get the frame number for when the ImpostorSprite was last used in rendering. */
|
||||
inline int getLastFrameUsed() const { return _lastFrameUsed; }
|
||||
|
||||
|
||||
/** Get the coordinates of the corners of the quad.
|
||||
* Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.
|
||||
*/
|
||||
*/
|
||||
inline Vec3* getCoords() { return _coords; }
|
||||
|
||||
/** Get the const coordinates of the corners of the quad.
|
||||
*/
|
||||
/** Get the const coordinates of the corners of the quad. */
|
||||
inline const Vec3* getCoords() const { return _coords; }
|
||||
|
||||
|
||||
|
||||
/** Get the texture coordinates of the corners of the quad.
|
||||
* Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.
|
||||
*/
|
||||
*/
|
||||
inline Vec2* getTexCoords() { return _texcoords; }
|
||||
|
||||
/** Get the const texture coordinates of the corners of the quad.*/
|
||||
/** Get the const texture coordinates of the corners of the quad. */
|
||||
inline const Vec2* getTexCoords() const { return _texcoords; }
|
||||
|
||||
/** Get the control coordinates of the corners of the quad.
|
||||
@ -99,20 +99,21 @@ class SG_EXPORT ImpostorSprite : public Drawable
|
||||
* geometry when it was pre-rendered into the impostor sprite's texture.
|
||||
* At the point of creation/or update of the impostor sprite the control
|
||||
* coords will lie on top of the corners of the quad in screen space - with a pixel error
|
||||
* or zero. Once the camera moves relative to the impostor sprite the
|
||||
* of zero. Once the camera moves relative to the impostor sprite the
|
||||
* control coords will no longer lie on top of the corners of the quad in
|
||||
* screen space - a pixel error will have accumulated. This pixel error
|
||||
* can then be used to determine whether the impostor needs to be updated.
|
||||
* Stored in the order, [0] - top_left, [1] - bottom_left, [2] - bottom_right, [3] - top_left.
|
||||
*/
|
||||
*/
|
||||
inline Vec3* getControlCoords() { return _controlcoords; }
|
||||
|
||||
/** Get the const control coordinates of the corners of the quad.*/
|
||||
/** Get the const control coordinates of the corners of the quad. */
|
||||
inline const Vec3* getControlCoords() const { return _controlcoords; }
|
||||
|
||||
|
||||
/** calculate the pixel error value for passing in the ModelViewProjectionWindow transform,
|
||||
* which transform local coords into screen space.*/
|
||||
/** Calculate the pixel error value for passing in the ModelViewProjectionWindow transform,
|
||||
* which transform local coords into screen space.
|
||||
*/
|
||||
float calcPixelError(const Matrix& MVPW) const;
|
||||
|
||||
void setTexture(Texture2D* tex,int s,int t);
|
||||
@ -122,25 +123,25 @@ class SG_EXPORT ImpostorSprite : public Drawable
|
||||
int s() const { return _s; }
|
||||
int t() const { return _t; }
|
||||
|
||||
/** draw ImpostorSprite directly. */
|
||||
/** Draw ImpostorSprite directly. */
|
||||
virtual void drawImplementation(State& state) const;
|
||||
|
||||
/** return true, osg::ImpostorSprite does support accept(AttributeFunctor&).*/
|
||||
/** Return true, osg::ImpostorSprite does support accept(AttributeFunctor&). */
|
||||
virtual bool supports(AttributeFunctor&) const { return true; }
|
||||
|
||||
/** accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** Accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. */
|
||||
virtual void accept(AttributeFunctor& af);
|
||||
|
||||
/** return true, osg::ImpostorSprite does support accept(ConstAttributeFunctor&).*/
|
||||
/** Return true, osg::ImpostorSprite does support accept(ConstAttributeFunctor&). */
|
||||
virtual bool supports(ConstAttributeFunctor&) const { return true; }
|
||||
|
||||
/** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
||||
/** Accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has. */
|
||||
virtual void accept(ConstAttributeFunctor& af) const;
|
||||
|
||||
/** return true, osg::ImpostorSprite does support accept(PrimitiveFunctor&) .*/
|
||||
/** Return true, osg::ImpostorSprite does support accept(PrimitiveFunctor&). */
|
||||
virtual bool supports(PrimitiveFunctor&) const { return true; }
|
||||
|
||||
/** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/
|
||||
/** Accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has. */
|
||||
virtual void accept(PrimitiveFunctor& pf) const;
|
||||
|
||||
// for debugging purposes.
|
||||
@ -180,7 +181,7 @@ class SG_EXPORT ImpostorSprite : public Drawable
|
||||
|
||||
};
|
||||
|
||||
/** Helper class for managing the reuse of ImpostorSprite resources.*/
|
||||
/** Helper class for managing the reuse of ImpostorSprite resources. */
|
||||
class SG_EXPORT ImpostorSpriteManager : public Referenced
|
||||
{
|
||||
public:
|
||||
|
@ -20,14 +20,14 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Light state class which encapsulates OpenGL glLight() functionality.*/
|
||||
/** Light state class which encapsulates OpenGL glLight() functionality. */
|
||||
class SG_EXPORT Light : public StateAttribute
|
||||
{
|
||||
public :
|
||||
|
||||
Light();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Light(const Light& light,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(light,copyop),
|
||||
_lightnum(light._lightnum),
|
||||
@ -44,7 +44,7 @@ class SG_EXPORT Light : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, Light, (Type)(LIGHT_0+_lightnum));
|
||||
|
||||
/** 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
|
||||
@ -73,86 +73,85 @@ class SG_EXPORT Light : public StateAttribute
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set which OpenGL light to operate on.*/
|
||||
/** Set which OpenGL light to operate on. */
|
||||
void setLightNum(int num) { _lightnum = num; }
|
||||
|
||||
/** Get which OpenGL light this osg::Light operates on.*/
|
||||
/** Get which OpenGL light this osg::Light operates on. */
|
||||
int getLightNum() const { return _lightnum; }
|
||||
|
||||
/** Set the ambient component of the light. */
|
||||
/** Set the ambient component of the light. */
|
||||
inline void setAmbient( const Vec4& ambient ) { _ambient = ambient; }
|
||||
|
||||
/** Get the ambient component of the light. */
|
||||
/** Get the ambient component of the light. */
|
||||
inline const Vec4& getAmbient() const { return _ambient; }
|
||||
|
||||
/** Set the diffuse component of the light. */
|
||||
/** Set the diffuse component of the light. */
|
||||
inline void setDiffuse( const Vec4& diffuse ) { _diffuse = diffuse; }
|
||||
|
||||
/** Get the diffuse component of the light. */
|
||||
/** Get the diffuse component of the light. */
|
||||
inline const Vec4& getDiffuse() const { return _diffuse; }
|
||||
|
||||
/** Set the specular component of the light. */
|
||||
/** Set the specular component of the light. */
|
||||
inline void setSpecular( const Vec4& specular ) { _specular = specular; }
|
||||
|
||||
/** Get the specular component of the light. */
|
||||
/** Get the specular component of the light. */
|
||||
inline const Vec4& getSpecular() const { return _specular; }
|
||||
|
||||
/** Set the position of the light. */
|
||||
/** Set the position of the light. */
|
||||
inline void setPosition( const Vec4& position ) { _position = position; }
|
||||
|
||||
/** Get the position of the light. */
|
||||
/** Get the position of the light. */
|
||||
inline const Vec4& getPosition() const { return _position; }
|
||||
|
||||
/** Set the direction of the light. */
|
||||
/** Set the direction of the light. */
|
||||
inline void setDirection( const Vec3& direction ) { _direction = direction; }
|
||||
|
||||
/** Get the direction of the light. */
|
||||
/** Get the direction of the light. */
|
||||
inline const Vec3& getDirection() const { return _direction; }
|
||||
|
||||
/** Set the constant attenuation of the light. */
|
||||
/** Set the constant attenuation of the light. */
|
||||
inline void setConstantAttenuation( float constant_attenuation ) { _constant_attenuation = constant_attenuation; }
|
||||
|
||||
/** Get the constant attenuation of the light. */
|
||||
/** Get the constant attenuation of the light. */
|
||||
inline float getConstantAttenuation() const { return _constant_attenuation; }
|
||||
|
||||
/** Set the linear attenuation of the light. */
|
||||
/** Set the linear attenuation of the light. */
|
||||
inline void setLinearAttenuation ( float linear_attenuation ) { _linear_attenuation = linear_attenuation; }
|
||||
|
||||
/** Get the linear attenuation of the light. */
|
||||
/** Get the linear attenuation of the light. */
|
||||
inline float getLinearAttenuation () const { return _linear_attenuation; }
|
||||
|
||||
/** Set the quadratic attenuation of the light. */
|
||||
/** Set the quadratic attenuation of the light. */
|
||||
inline void setQuadraticAttenuation ( float quadratic_attenuation ) { _quadratic_attenuation = quadratic_attenuation; }
|
||||
|
||||
/** Get the quadratic attenuation of the light. */
|
||||
/** Get the quadratic attenuation of the light. */
|
||||
inline float getQuadraticAttenuation() const { return _quadratic_attenuation; }
|
||||
|
||||
/** Set the spot exponent of the light. */
|
||||
/** Set the spot exponent of the light. */
|
||||
inline void setSpotExponent( float spot_exponent ) { _spot_exponent = spot_exponent; }
|
||||
|
||||
/** Get the spot exponent of the light. */
|
||||
/** Get the spot exponent of the light. */
|
||||
inline float getSpotExponent() const { return _spot_exponent; }
|
||||
|
||||
/** Set the spot cutoff of the light. */
|
||||
/** Set the spot cutoff of the light. */
|
||||
inline void setSpotCutoff( float spot_cutoff ) { _spot_cutoff = spot_cutoff; }
|
||||
|
||||
/** Get the spot cutoff of the light. */
|
||||
/** Get the spot cutoff of the light. */
|
||||
inline float getSpotCutoff() const { return _spot_cutoff; }
|
||||
|
||||
/**
|
||||
* Capture the lighting settings of the current OpenGL state
|
||||
* and store them in this object.
|
||||
*/
|
||||
/** Capture the lighting settings of the current OpenGL state
|
||||
* and store them in this object.
|
||||
*/
|
||||
void captureLightState();
|
||||
|
||||
/** Apply the light's state to the OpenGL state machine. */
|
||||
/** Apply the light's state to the OpenGL state machine. */
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~Light();
|
||||
|
||||
/** Initialize the light's settings with some decent defaults. */
|
||||
/** Initialize the light's settings with some decent defaults. */
|
||||
void init();
|
||||
|
||||
int _lightnum; // OpenGL light number
|
||||
|
@ -25,7 +25,7 @@ class SG_EXPORT LightModel : public StateAttribute
|
||||
|
||||
LightModel();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
LightModel(const LightModel& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(lw,copyop),
|
||||
_ambient(lw._ambient),
|
||||
@ -36,7 +36,7 @@ class SG_EXPORT LightModel : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, LightModel, LIGHTMODEL);
|
||||
|
||||
/** 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
|
||||
@ -49,7 +49,7 @@ class SG_EXPORT LightModel : public StateAttribute
|
||||
COMPARE_StateAttribute_Parameter(_localViewer)
|
||||
COMPARE_StateAttribute_Parameter(_twoSided)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // passed all the above comparison macros, must be equal.
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** TextureCubeMap state class which encapsulates OpenGl texture cubemap functionality.*/
|
||||
/** TextureCubeMap state class which encapsulates OpenGL texture cubemap functionality. */
|
||||
class SG_EXPORT TextureCubeMap : public Texture
|
||||
{
|
||||
|
||||
@ -30,12 +30,12 @@ class SG_EXPORT TextureCubeMap : public Texture
|
||||
|
||||
TextureCubeMap();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
TextureCubeMap(const TextureCubeMap& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_StateAttribute(osg, TextureCubeMap,TEXTURE);
|
||||
|
||||
/** 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& rhs) const;
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
@ -72,7 +72,8 @@ class SG_EXPORT TextureCubeMap : public Texture
|
||||
}
|
||||
|
||||
/** Set the texture width and height. If width or height are zero then
|
||||
* the repsective size value is calculated from the source image sizes. */
|
||||
* the repsective size value is calculated from the source image sizes.
|
||||
*/
|
||||
inline void setTextureSize(int width, int height) const
|
||||
{
|
||||
_textureWidth = width;
|
||||
@ -101,21 +102,24 @@ class SG_EXPORT TextureCubeMap : public Texture
|
||||
const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); }
|
||||
|
||||
|
||||
/** Set the number of mip map levels the the texture has been created with,
|
||||
should only be called within an osg::Texuture::apply() and custom OpenGL texture load.*/
|
||||
/** Set the number of mip map levels the the texture has been created with.
|
||||
* Should only be called within an osg::Texuture::apply() and custom OpenGL texture load.
|
||||
*/
|
||||
void setNumMipmapLevels(unsigned int num) const { _numMipmapLevels=num; }
|
||||
|
||||
/** Get the number of mip map levels the the texture has been created with.*/
|
||||
/** Get the number of mip map levels the the texture has been created with. */
|
||||
unsigned int getNumMipmapLevels() const { return _numMipmapLevels; }
|
||||
|
||||
/** On first apply (unless already compiled), create the minmapped
|
||||
* texture and bind it, subsequent apply will simple bind to texture.*/
|
||||
/** On first apply (unless already compiled), create the mipmapped
|
||||
* texture and bind it. Subsequent apply will simple bind to texture.
|
||||
*/
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
|
||||
/** 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.*/
|
||||
/** Extensions class which encapsulates the querying of extensions and
|
||||
* associated function pointers, and provides convinience wrappers to
|
||||
* check for the extensions or use the associated functions.
|
||||
*/
|
||||
class SG_EXPORT Extensions : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
@ -139,16 +143,18 @@ class SG_EXPORT TextureCubeMap : public Texture
|
||||
};
|
||||
|
||||
/** Function to call to get the extension of a specified context.
|
||||
* If the Exentsion object for that context has not yet been created then
|
||||
* If the Exentsion object for that context has not yet been created
|
||||
* 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..*/
|
||||
* automatically created. However, in this case the extension object will
|
||||
* only be created with the graphics context associated with ContextID.
|
||||
*/
|
||||
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.*/
|
||||
/** The setExtensions method 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);
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Texture state class which encapsulates OpenGL texture functionality.*/
|
||||
/** Texture state class which encapsulates OpenGL texture functionality. */
|
||||
class SG_EXPORT TextureRectangle : public Texture
|
||||
{
|
||||
|
||||
@ -36,12 +36,12 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
|
||||
TextureRectangle(Image* image);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
TextureRectangle(const TextureRectangle& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_StateAttribute(osg, TextureRectangle, TEXTURE);
|
||||
|
||||
/** 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& rhs) const;
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
@ -66,13 +66,13 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
}
|
||||
|
||||
|
||||
/** Set the texture image, ignoring face. as there is only one image*/
|
||||
/** Set the texture image, ignoring face value as there is only one image. */
|
||||
virtual void setImage(unsigned int, Image* image) { setImage(image); }
|
||||
|
||||
/** Get the texture image, ignoring face value as there is only one image. */
|
||||
virtual Image* getImage(unsigned int) { return _image.get(); }
|
||||
|
||||
/** Get the const texture image , ignoring face value as there is only one image. */
|
||||
/** Get the const texture image, ignoring face value as there is only one image. */
|
||||
virtual const Image* getImage(unsigned int) const { return _image.get(); }
|
||||
|
||||
/** Get the number of images that can be assigned to the Texture. */
|
||||
@ -80,7 +80,8 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
|
||||
|
||||
/** Set the texture width and height. If width or height are zero then
|
||||
* the repsective size value is calculated from the source image sizes. */
|
||||
* the repsective size value is calculated from the source image sizes.
|
||||
*/
|
||||
inline void setTextureSize(int width, int height) const
|
||||
{
|
||||
_textureWidth = width;
|
||||
@ -106,7 +107,8 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
const SubloadCallback* getSubloadCallback() const { return _subloadCallback.get(); }
|
||||
|
||||
/** On first apply (unless already compiled), create and bind the
|
||||
* texture, subsequent apply will simple bind to texture.*/
|
||||
* texture, subsequent apply will simply bind to texture.
|
||||
*/
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
protected :
|
||||
@ -120,9 +122,9 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
void applyTexImage_load(GLenum target, Image* image, State& state, GLsizei& inwidth, GLsizei& inheight) const;
|
||||
void applyTexImage_subload(GLenum target, Image* image, State& state, GLsizei& inwidth, GLsizei& inheight, GLint& inInternalFormat) const;
|
||||
|
||||
// not ideal that _image is mutable, but its required since
|
||||
// not ideal that _image is mutable, but it's required since
|
||||
// Image::ensureDimensionsArePowerOfTwo() can only be called
|
||||
// in a valid OpenGL context, a therefore within an Texture::apply
|
||||
// in a valid OpenGL context, and therefore within an Texture::apply
|
||||
// which is const...
|
||||
mutable ref_ptr<Image> _image;
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** A high resolution, low latency time stamper.*/
|
||||
/** A high resolution, low latency time stamper. */
|
||||
class SG_EXPORT Timer {
|
||||
|
||||
public:
|
||||
|
@ -25,43 +25,47 @@ namespace osg {
|
||||
|
||||
|
||||
|
||||
/** compute the matrix which transforms objects in local coords to world coords,
|
||||
* by accumulating the Transform local to world matrices along the specified node path.*/
|
||||
/** Compute the matrix which transforms objects in local coords to world coords,
|
||||
* by accumulating the Transform local to world matrices along the specified node path.
|
||||
*/
|
||||
extern SG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath);
|
||||
|
||||
/** compute the matrix which transforms objects in world coords to local coords,
|
||||
* by accumulating the Transform world to local matrices along the specified node path.*/
|
||||
/** Compute the matrix which transforms objects in world coords to local coords,
|
||||
* by accumulating the Transform world to local matrices along the specified node path.
|
||||
*/
|
||||
extern SG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath);
|
||||
|
||||
/** compute the matrix which transforms objects in local coords to world coords,
|
||||
/** Compute the matrix which transforms objects in local coords to world coords,
|
||||
* by accumulating the Transform local to world matrices along the specified node path
|
||||
* the supplied initialial camera modelview .*/
|
||||
* the supplied initial camera modelview.
|
||||
*/
|
||||
extern SG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath);
|
||||
|
||||
/** compute the matrix which transforms objects in world coords to local coords,
|
||||
/** Compute the matrix which transforms objects in world coords to local coords,
|
||||
* by accumulating the Transform world to local matrices along the specified node path
|
||||
* the inverse of the supplied initialial camera modelview.*/
|
||||
* the inverse of the supplied initialial camera modelview.
|
||||
*/
|
||||
extern SG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath);
|
||||
|
||||
|
||||
/** A Transform is a group node for which all children are transformed by
|
||||
* a 4x4 matrix. It is often used for positioning objects within a scene,
|
||||
* a 4x4 matrix. It is often used for positioning objects within a scene,
|
||||
* producing trackball functionality or for animation.
|
||||
*
|
||||
* Transform itself does not provide set/get functions, only the interface
|
||||
* for defining what the 4x4 transformation is. Subclasses, such as
|
||||
* MatrixTransform and PositionAttitudeTransform support the use of an
|
||||
* osg::Matrix or a osg::Vec3/osg::Quat resprectively.
|
||||
* osg::Matrix or a osg::Vec3/osg::Quat respectively.
|
||||
* The Transform node can be customized via the ComputeTransfromCallback
|
||||
* which can be attached to the node. This might be used to convert from
|
||||
* which can be attached to the node. This might be used to convert from
|
||||
* internal representations of the transformation into generic osg::Matrix
|
||||
* objects which are used during scene grpah traversal, such as
|
||||
* objects which are used during scene graph traversal, such as
|
||||
* CullTraversal and IntersectionTraversal.
|
||||
*
|
||||
* Note: if the transformation matrix scales the subgraph then the normals
|
||||
* Note: If the transformation matrix scales the subgraph then the normals
|
||||
* of the underlying geometry will need to be renormalized to be unit
|
||||
* vectors once more. This can be done transparently through OpenGL's
|
||||
* use of either GL_NORMALIZE and GL_SCALE_NORMALIZE modes. For further
|
||||
* use of either GL_NORMALIZE and GL_SCALE_NORMALIZE modes. For further
|
||||
* background reading see the glNormalize documentation in the OpenGL
|
||||
* Reference Guide (the blue book). To enable it in the OSG, you simply
|
||||
* need to attach a local osg::StateSet to the osg::Transform, and set
|
||||
@ -74,7 +78,7 @@ class SG_EXPORT Transform : public Group
|
||||
|
||||
Transform();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Transform(const Transform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(osg, Transform);
|
||||
@ -97,14 +101,15 @@ class SG_EXPORT Transform : public Group
|
||||
/** Set the transform's ReferenceFrame, either to be relative to its
|
||||
* parent reference frame, or relative to an absolute coordinate
|
||||
* frame. RELATIVE_TO_PARENTS is the default.
|
||||
* Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
||||
* Note: Setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
||||
* also set the CullingActive flag on the transform, and hence all
|
||||
* of its parents, to false, thereby disabling culling of it and
|
||||
* all its parents. This is neccessary to prevent inappropriate
|
||||
* culling, but may impact cull times if the absolute transform is
|
||||
* deep in the scene graph. It is therefore recommend to only use
|
||||
* deep in the scene graph. It is therefore recommended to only use
|
||||
* absolute Transforms at the top of the scene, for such things as
|
||||
* heads up displays. */
|
||||
* heads up displays.
|
||||
*/
|
||||
void setReferenceFrame(ReferenceFrame rf);
|
||||
|
||||
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
|
||||
@ -142,7 +147,8 @@ class SG_EXPORT Transform : public Group
|
||||
/** Overrides Group's computeBound.
|
||||
* There is no need to override in subclasses from osg::Transform
|
||||
* since this computeBound() uses the underlying matrix (calling
|
||||
* computeMatrix if required.) */
|
||||
* computeMatrix if required).
|
||||
*/
|
||||
virtual bool computeBound() const;
|
||||
|
||||
ReferenceFrame _referenceFrame;
|
||||
|
@ -323,10 +323,12 @@ public:
|
||||
|
||||
|
||||
|
||||
/** begin(..),vertex(..) & end() are convinience methods for adapting
|
||||
* non vertex array primitives to vertex array based primitives.
|
||||
* this is done to simplify the implementation of primtive functor
|
||||
* subclasses - users only need override drawArray and drawElements.*/
|
||||
/** Note:
|
||||
* begin(..),vertex(..) & end() are convenience methods for adapting
|
||||
* non vertex array primitives to vertex array based primitives.
|
||||
* This is done to simplify the implementation of primtive functor
|
||||
* subclasses - users only need override drawArray and drawElements.
|
||||
*/
|
||||
virtual void begin(GLenum mode)
|
||||
{
|
||||
_modeCache = mode;
|
||||
|
@ -20,11 +20,11 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** General purpose float quad, uses include representation
|
||||
of colour coordinates.
|
||||
No support yet added for float * UByte4 - is it necessary?
|
||||
Need to define a non-member non-friend operator* etc.
|
||||
UByte4 * float is okay
|
||||
/** General purpose float quad.
|
||||
* Uses include representation of color coordinates.
|
||||
* No support yet added for float * UByte4 - is it necessary?
|
||||
* Need to define a non-member non-friend operator* etc.
|
||||
* UByte4 * float is okay
|
||||
*/
|
||||
class UByte4
|
||||
{
|
||||
@ -77,7 +77,7 @@ class UByte4
|
||||
inline unsigned char b() const { return _v[2]; }
|
||||
inline unsigned char a() const { return _v[3]; }
|
||||
|
||||
/// multiply by scalar
|
||||
/** Multiply by scalar. */
|
||||
inline UByte4 operator * (float rhs) const
|
||||
{
|
||||
UByte4 col(*this);
|
||||
@ -85,7 +85,7 @@ class UByte4
|
||||
return col;
|
||||
}
|
||||
|
||||
/// unary multiply by scalar
|
||||
/** Unary multiply by scalar. */
|
||||
inline UByte4& operator *= (float rhs)
|
||||
{
|
||||
_v[0]=(unsigned char)((float)_v[0]*rhs);
|
||||
@ -95,7 +95,7 @@ class UByte4
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// divide by scalar
|
||||
/** Divide by scalar. */
|
||||
inline UByte4 operator / (float rhs) const
|
||||
{
|
||||
UByte4 col(*this);
|
||||
@ -103,7 +103,7 @@ class UByte4
|
||||
return col;
|
||||
}
|
||||
|
||||
/// unary divide by scalar
|
||||
/** Unary divide by scalar. */
|
||||
inline UByte4& operator /= (float rhs)
|
||||
{
|
||||
float div = 1.0f/rhs;
|
||||
@ -111,15 +111,16 @@ class UByte4
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// binary vector add
|
||||
/** Binary vector add. */
|
||||
inline UByte4 operator + (const UByte4& rhs) const
|
||||
{
|
||||
return UByte4(_v[0]+rhs._v[0], _v[1]+rhs._v[1],
|
||||
_v[2]+rhs._v[2], _v[3]+rhs._v[3]);
|
||||
}
|
||||
|
||||
/** unary vector add. Slightly more efficient because no temporary
|
||||
intermediate object*/
|
||||
/** Unary vector add. Slightly more efficient because no temporary
|
||||
* intermediate object.
|
||||
*/
|
||||
inline UByte4& operator += (const UByte4& rhs)
|
||||
{
|
||||
_v[0] += rhs._v[0];
|
||||
@ -129,14 +130,14 @@ class UByte4
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// binary vector subtract
|
||||
/** Binary vector subtract. */
|
||||
inline UByte4 operator - (const UByte4& rhs) const
|
||||
{
|
||||
return UByte4(_v[0]-rhs._v[0], _v[1]-rhs._v[1],
|
||||
_v[2]-rhs._v[2], _v[3]-rhs._v[3] );
|
||||
}
|
||||
|
||||
/// unary vector subtract
|
||||
/** Unary vector subtract. */
|
||||
inline UByte4& operator -= (const UByte4& rhs)
|
||||
{
|
||||
_v[0]-=rhs._v[0];
|
||||
|
@ -119,7 +119,7 @@ class TestCase;
|
||||
|
||||
/**
|
||||
Visits while maintaining the current hierarchical context. Also allows
|
||||
the traversal to be short-cicuited at any point during the visitation.
|
||||
the traversal to be short-circuited at any point during the visitation.
|
||||
*/
|
||||
class TestVisitor
|
||||
{
|
||||
@ -142,7 +142,7 @@ class TestVisitor
|
||||
};
|
||||
|
||||
/**
|
||||
TestCase, is the supplies the interface for a Composite pattern's
|
||||
TestCase, supplies the interface for a Composite pattern's
|
||||
\em leaf class, though it is not a leaf in itself.
|
||||
*/
|
||||
class TestCase : public Test
|
||||
@ -163,7 +163,7 @@ class TestCase : public Test
|
||||
};
|
||||
|
||||
/**
|
||||
Base class catchable for the exception's which may be thrown to
|
||||
Base class catchable for the exceptions which may be thrown to
|
||||
indicate problems during the run of a TestCase.
|
||||
*/
|
||||
class TestX
|
||||
@ -190,7 +190,7 @@ class TestFailureX: public TestX
|
||||
|
||||
/**
|
||||
A TestErrorX indicates an error while testing a component,
|
||||
which prevents the test from being run; it does not indicate
|
||||
which prevents the test from being run. It does not indicate
|
||||
a problem with the component, but rather a problem during the
|
||||
run which prevents the component from being tested.
|
||||
*/
|
||||
@ -204,7 +204,7 @@ class TestErrorX: public TestX
|
||||
TestCase_ is a class template for a leaf TestCase, which allows TestFixture
|
||||
classes to be easily collected into the tree of tests, and have their public
|
||||
test methods called. It is worth noting that, for a given TestCase_, an
|
||||
instance of the test fixture class will be constructed pior to the
|
||||
instance of the test fixture class will be constructed prior to the
|
||||
test method being called, and destructed afterwards. This prevents 'leakage'
|
||||
of information from one test case to the next.
|
||||
*/
|
||||
@ -280,7 +280,7 @@ class SG_EXPORT TestGraph
|
||||
TestSuite* root();
|
||||
|
||||
/**
|
||||
A utility function for accessing an arbitrary quite by pathname, relative to
|
||||
A utility function for accessing an arbitrary suite by pathname, relative to
|
||||
the suite 'tsuite' (defaults to root if null), and with the option of creating
|
||||
the \em TestSuite designated by \em path, if it does not already exist.
|
||||
|
||||
|
@ -19,10 +19,10 @@
|
||||
namespace osg {
|
||||
|
||||
/** General purpose double pair, uses include representation of
|
||||
texture coordinates.
|
||||
No support yet added for double * Vec2d - is it necessary?
|
||||
Need to define a non-member non-friend operator* etc.
|
||||
BTW: Vec2d * double is okay
|
||||
* texture coordinates.
|
||||
* No support yet added for double * Vec2d - is it necessary?
|
||||
* Need to define a non-member non-friend operator* etc.
|
||||
* BTW: Vec2d * double is okay
|
||||
*/
|
||||
|
||||
class Vec2d
|
||||
@ -69,19 +69,19 @@ class Vec2d
|
||||
inline bool valid() const { return !isNaN(); }
|
||||
inline bool isNaN() const { return osg::isNaN(_v[0]) || osg::isNaN(_v[1]); }
|
||||
|
||||
/// dot product
|
||||
/** Dot product. */
|
||||
inline value_type operator * (const Vec2d& rhs) const
|
||||
{
|
||||
return _v[0]*rhs._v[0]+_v[1]*rhs._v[1];
|
||||
}
|
||||
|
||||
/// multiply by scalar
|
||||
/** Multiply by scalar. */
|
||||
inline const Vec2d operator * (value_type rhs) const
|
||||
{
|
||||
return Vec2d(_v[0]*rhs, _v[1]*rhs);
|
||||
}
|
||||
|
||||
/// unary multiply by scalar
|
||||
/** Unary multiply by scalar. */
|
||||
inline Vec2d& operator *= (value_type rhs)
|
||||
{
|
||||
_v[0]*=rhs;
|
||||
@ -89,13 +89,13 @@ class Vec2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// divide by scalar
|
||||
/** Divide by scalar. */
|
||||
inline const Vec2d operator / (value_type rhs) const
|
||||
{
|
||||
return Vec2d(_v[0]/rhs, _v[1]/rhs);
|
||||
}
|
||||
|
||||
/// unary divide by scalar
|
||||
/** Unary divide by scalar. */
|
||||
inline Vec2d& operator /= (value_type rhs)
|
||||
{
|
||||
_v[0]/=rhs;
|
||||
@ -103,14 +103,15 @@ class Vec2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// binary vector add
|
||||
/** Binary vector add. */
|
||||
inline const Vec2d operator + (const Vec2d& rhs) const
|
||||
{
|
||||
return Vec2d(_v[0]+rhs._v[0], _v[1]+rhs._v[1]);
|
||||
}
|
||||
|
||||
/** unary vector add. Slightly more efficient because no temporary
|
||||
intermediate object.*/
|
||||
/** Unary vector add. Slightly more efficient because no temporary
|
||||
* intermediate object.
|
||||
*/
|
||||
inline Vec2d& operator += (const Vec2d& rhs)
|
||||
{
|
||||
_v[0] += rhs._v[0];
|
||||
@ -118,13 +119,13 @@ class Vec2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// binary vector subtract
|
||||
/** Binary vector subtract. */
|
||||
inline const Vec2d operator - (const Vec2d& rhs) const
|
||||
{
|
||||
return Vec2d(_v[0]-rhs._v[0], _v[1]-rhs._v[1]);
|
||||
}
|
||||
|
||||
/// unary vector subtract
|
||||
/** Unary vector subtract. */
|
||||
inline Vec2d& operator -= (const Vec2d& rhs)
|
||||
{
|
||||
_v[0]-=rhs._v[0];
|
||||
@ -132,26 +133,27 @@ class Vec2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// negation operator. Returns the negative of the Vec2d
|
||||
/** Negation operator. Returns the negative of the Vec2d. */
|
||||
inline const Vec2d operator - () const
|
||||
{
|
||||
return Vec2d (-_v[0], -_v[1]);
|
||||
}
|
||||
|
||||
/// Length of the vector = sqrt( vec . vec )
|
||||
/** Length of the vector = sqrt( vec . vec ) */
|
||||
inline value_type length() const
|
||||
{
|
||||
return sqrt( _v[0]*_v[0] + _v[1]*_v[1] );
|
||||
}
|
||||
|
||||
/// Length squared of the vector = vec . vec
|
||||
/** Length squared of the vector = vec . vec */
|
||||
inline value_type length2( void ) const
|
||||
{
|
||||
return _v[0]*_v[0] + _v[1]*_v[1];
|
||||
}
|
||||
|
||||
/** normalize the vector so that it has length unity
|
||||
returns the previous length of the vector*/
|
||||
/** Normalize the vector so that it has length unity.
|
||||
* Returns the previous length of the vector.
|
||||
*/
|
||||
inline value_type normalize()
|
||||
{
|
||||
value_type norm = Vec2d::length();
|
||||
|
Loading…
Reference in New Issue
Block a user