From Sébastien Kuntz, spelling and typo fixes
This commit is contained in:
parent
08017daf37
commit
3b90a0e8a6
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -20,14 +20,16 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Leaf Node for defining a light in the scene.*/
|
||||
/** Leaf Node for defining a light in the scene. */
|
||||
class SG_EXPORT LightSource : public Group
|
||||
{
|
||||
public:
|
||||
|
||||
LightSource();
|
||||
|
||||
LightSource(const LightSource& ls, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
LightSource(const LightSource& ls,
|
||||
const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Group(ls,copyop),
|
||||
_value(ls._value),
|
||||
_light(dynamic_cast<osg::Light*>(copyop(ls._light.get()))) {}
|
||||
@ -46,28 +48,29 @@ class SG_EXPORT LightSource : public Group
|
||||
* Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will
|
||||
* also set the CullingActive flag on the light source, and hence all
|
||||
* of its parents, to false, thereby disabling culling of it and
|
||||
* all its parents. This is neccessary to prevent inappropriate
|
||||
* all its parents. This is necessary to prevent inappropriate
|
||||
* culling, but may impact cull times if the absolute light source is
|
||||
* deep in the scene graph. It is therefore recommend to only use
|
||||
* absolute light source at the top of the scene. */
|
||||
* deep in the scene graph. It is therefore recommended to only use
|
||||
* absolute light source at the top of the scene.
|
||||
*/
|
||||
void setReferenceFrame(ReferenceFrame rf);
|
||||
|
||||
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
|
||||
|
||||
/** Set the attached light.*/
|
||||
/** Set the attached light. */
|
||||
void setLight(Light* light);
|
||||
|
||||
/** Get the attached light.*/
|
||||
/** Get the attached light. */
|
||||
inline Light* getLight() { return _light.get(); }
|
||||
|
||||
/** Get the const attached light.*/
|
||||
/** Get the const attached light. */
|
||||
inline const Light* getLight() const { return _light.get(); }
|
||||
|
||||
/** Set the GLModes on StateSet associated with the LightSource.*/
|
||||
/** Set the GLModes on StateSet associated with the LightSource. */
|
||||
void setStateSetModes(StateSet&,StateAttribute::GLModeValue) const;
|
||||
|
||||
/** Set up the local StateSet */
|
||||
void setLocalStateSetModes(StateAttribute::GLModeValue=StateAttribute::ON);
|
||||
/** Set up the local StateSet. */
|
||||
void setLocalStateSetModes(StateAttribute::GLModeValue value = StateAttribute::ON);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** LineSegment class for representing a line segment.*/
|
||||
/** LineSegment class for representing a line segment. */
|
||||
class SG_EXPORT LineSegment : public Referenced
|
||||
{
|
||||
public:
|
||||
@ -41,19 +41,25 @@ class SG_EXPORT LineSegment : public Referenced
|
||||
|
||||
inline bool valid() const { return _s.valid() && _e.valid() && _s!=_e; }
|
||||
|
||||
/** return true if segment intersects BoundingBox.*/
|
||||
/** return true if segment intersects BoundingBox. */
|
||||
bool intersect(const BoundingBox& bb) const;
|
||||
|
||||
/** return true if segment intersects BoundingBox and return the intersection ratio's.*/
|
||||
/** return true if segment intersects BoundingBox
|
||||
* and return the intersection ratios.
|
||||
*/
|
||||
bool intersect(const BoundingBox& bb,float& r1,float& r2) const;
|
||||
|
||||
/** return true if segment intersects BoundingSphere.*/
|
||||
/** return true if segment intersects BoundingSphere. */
|
||||
bool intersect(const BoundingSphere& bs) const;
|
||||
|
||||
/** return true if segment intersects BoundingSphere and return the intersection ratio's.*/
|
||||
/** return true if segment intersects BoundingSphere and return the
|
||||
* intersection ratio.
|
||||
*/
|
||||
bool intersect(const BoundingSphere& bs,float& r1,float& r2) const;
|
||||
|
||||
/** return true if segment intersects triangle and set ratio long segment. */
|
||||
/** return true if segment intersects triangle
|
||||
* and set ratio long segment.
|
||||
*/
|
||||
bool intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r);
|
||||
|
||||
/** post multiply a segment by matrix.*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -32,18 +32,18 @@ class SG_EXPORT LineStipple : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, LineStipple, LINESTIPPLE);
|
||||
|
||||
/** 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 if the types are equal and then create the rhs variable.
|
||||
// used by the COMPARE_StateAttribute_Parameter macros below.
|
||||
COMPARE_StateAttribute_Types(LineStipple,sa)
|
||||
|
||||
// compare each paramter in turn against the rhs.
|
||||
// compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_factor)
|
||||
COMPARE_StateAttribute_Parameter(_pattern)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // passed all the above comparison macros, must be equal.
|
||||
}
|
||||
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -11,38 +11,38 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_LineWidth
|
||||
#define OSG_LineWidth 1
|
||||
#ifndef OSG_LINEWIDTH
|
||||
#define OSG_LINEWIDTH 1
|
||||
|
||||
#include <osg/StateAttribute>
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** LineWidth - encapsulates the OpenGL glLineWidth for setting the width of lines in pixels.*/
|
||||
/** LineWidth - encapsulates the OpenGL glLineWidth for setting the width of lines in pixels. */
|
||||
class SG_EXPORT LineWidth : public StateAttribute
|
||||
{
|
||||
public :
|
||||
|
||||
LineWidth(float width=1.0f);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
|
||||
StateAttribute(lw,copyop),
|
||||
_width(lw._width) {}
|
||||
|
||||
META_StateAttribute(osg, LineWidth, LINEWIDTH);
|
||||
|
||||
/** 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 if the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Parameter macros below.
|
||||
COMPARE_StateAttribute_Types(LineWidth,sa)
|
||||
|
||||
// compare each paramter in turn against the rhs.
|
||||
// compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_width)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // passed all the above comparison macros, must be equal.
|
||||
}
|
||||
|
||||
void setWidth(float width);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -21,13 +21,11 @@ namespace osg {
|
||||
/** Material - encapsulates OpenGL glMaterial state.*/
|
||||
class SG_EXPORT Material : public StateAttribute
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
|
||||
Material();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Material(const Material& mat,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(mat,copyop),
|
||||
_colorMode(mat._colorMode),
|
||||
@ -49,11 +47,11 @@ class SG_EXPORT Material : public StateAttribute
|
||||
|
||||
META_StateAttribute(osg, Material, MATERIAL);
|
||||
|
||||
/** 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.
|
||||
// used by the COMPARE_StateAttribute_Parameter macros below.
|
||||
COMPARE_StateAttribute_Types(Material,sa)
|
||||
|
||||
// compare each parameter in turn against the rhs.
|
||||
@ -74,7 +72,7 @@ class SG_EXPORT Material : public StateAttribute
|
||||
COMPARE_StateAttribute_Parameter(_shininessFront)
|
||||
COMPARE_StateAttribute_Parameter(_shininessBack)
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
return 0; // passed all the above comparison macros, must be equal.
|
||||
}
|
||||
|
||||
Material& operator = (const Material& rhs);
|
||||
@ -114,34 +112,53 @@ class SG_EXPORT Material : public StateAttribute
|
||||
inline bool getDiffuseFrontAndBack() const { return _diffuseFrontAndBack; }
|
||||
|
||||
/** Set specular value of specified face(s) of the material,
|
||||
* valid specular[0..3] range is 0.0 to 1.0.*/
|
||||
* valid specular[0..3] range is 0.0 to 1.0.
|
||||
*/
|
||||
void setSpecular( Face face, const Vec4& specular );
|
||||
/** Get the specular value for specified face.*/
|
||||
|
||||
/** Get the specular value for specified face. */
|
||||
const Vec4& getSpecular(Face face) const;
|
||||
/** Get the whether specular values are equal for front and back faces.*/
|
||||
|
||||
/** Return whether specular values are equal for front and back faces
|
||||
* or not.
|
||||
*/
|
||||
inline bool getSpecularFrontAndBack() const { return _specularFrontAndBack; }
|
||||
|
||||
/** Set emission value of specified face(s) of the material,
|
||||
* valid emmison[0..3] range is 0.0 to 1.0.*/
|
||||
* valid emission[0..3] range is 0.0 to 1.0.
|
||||
*/
|
||||
void setEmission( Face face, const Vec4& emission );
|
||||
/** Get the emmsion value for specified face.*/
|
||||
|
||||
/** Get the emission value for specified face. */
|
||||
const Vec4& getEmission(Face face) const;
|
||||
/** Get the whether emission values are equal for front and back faces.*/
|
||||
|
||||
/** Return whether emission values are equal for front and back faces
|
||||
* or not.
|
||||
*/
|
||||
inline bool getEmissionFrontAndBack() const { return _emissionFrontAndBack; }
|
||||
|
||||
/** Set shininess of specified face(s) of the material, valid shininess range is 0.0 to 128.0.*/
|
||||
/** Set shininess of specified face(s) of the material.
|
||||
* valid shininess range is 0.0 to 128.0.
|
||||
*/
|
||||
void setShininess(Face face, float shininess );
|
||||
/** Get the shininess value for specified face.*/
|
||||
|
||||
/** Get the shininess value for specified face. */
|
||||
float getShininess(Face face) const;
|
||||
/** Get the whether shininess values are equal for front and back faces.*/
|
||||
|
||||
/** Return whether shininess values are equal for front and back faces
|
||||
* or not.
|
||||
*/
|
||||
inline bool getShininessFrontAndBack() const { return _shininessFrontAndBack; }
|
||||
|
||||
/** Set the alpha value of ambient,diffuse,specular and emission colors,
|
||||
* of specified face, to 1-transparency. Valid transparency range is 0.0 to 1.0.*/
|
||||
/** Set the alpha value of ambient, diffuse, specular and emission
|
||||
* colors of specified face, to 1-transparency.
|
||||
* Valid transparency range is 0.0 to 1.0.
|
||||
*/
|
||||
void setTransparency(Face face,float trans);
|
||||
|
||||
/** Set the alpha value of ambient,diffuse,specular and emission colors.
|
||||
* Valid transparency range is 0.0 to 1.0.*/
|
||||
/** Set the alpha value of ambient, diffuse, specular and emission
|
||||
* colors. Valid transparency range is 0.0 to 1.0.
|
||||
*/
|
||||
void setAlpha(Face face,float alpha);
|
||||
|
||||
protected :
|
||||
@ -166,7 +183,7 @@ class SG_EXPORT Material : public StateAttribute
|
||||
Vec4 _emissionFront; // r, g, b, w
|
||||
Vec4 _emissionBack; // r, g, b, w
|
||||
|
||||
bool _shininessFrontAndBack;
|
||||
bool _shininessFrontAndBack;
|
||||
float _shininessFront; // values 0 - 128.0
|
||||
float _shininessBack; // values 0 - 128.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
// define the stand trig values
|
||||
// define the standard trig values
|
||||
#ifdef PI
|
||||
#undef PI
|
||||
#undef PI_2
|
||||
@ -108,29 +108,44 @@ const double PI = 3.14159265358979323846;
|
||||
const double PI_2 = 1.57079632679489661923;
|
||||
const double PI_4 = 0.78539816339744830962;
|
||||
|
||||
/** return the minimum of two values, equivilant to std::min.
|
||||
* std::min not used because of STL implementation under IRIX contains no std::min.*/
|
||||
/** return the minimum of two values, equivalent to std::min.
|
||||
* std::min not used because of STL implementation under IRIX not
|
||||
* containing std::min.
|
||||
*/
|
||||
template<typename T>
|
||||
inline T absolute(T v) { return v<(T)0?-v:v; }
|
||||
|
||||
/** return true if float lhs and rhs are equivalent, meaning that the difference between then is less than an epsilon value which default to 1e-6.*/
|
||||
inline float equivalent(float lhs,float rhs,float epsilon=1e-6) { float delta = rhs-lhs; return delta<0.0f?delta>=-epsilon:delta<=epsilon; }
|
||||
/** return true if float lhs and rhs are equivalent,
|
||||
* meaning that the difference between them is less than an epsilon value
|
||||
* which defaults to 1e-6.
|
||||
*/
|
||||
inline float equivalent(float lhs,float rhs,float epsilon=1e-6)
|
||||
{ float delta = rhs-lhs; return delta<0.0f?delta>=-epsilon:delta<=epsilon; }
|
||||
|
||||
/** return true if double lhs and rhs are equivalent, meaning that the difference between then is less than an epsilon value which default to 1e-6.*/
|
||||
inline double equivalent(double lhs,double rhs,double epsilon=1e-6) { double delta = rhs-lhs; return delta<0.0?delta>=-epsilon:delta<=epsilon; }
|
||||
/** return true if double lhs and rhs are equivalent,
|
||||
* meaning that the difference between them is less than an epsilon value
|
||||
* which defaults to 1e-6.
|
||||
*/
|
||||
inline double equivalent(double lhs,double rhs,double epsilon=1e-6)
|
||||
{ double delta = rhs-lhs; return delta<0.0?delta>=-epsilon:delta<=epsilon; }
|
||||
|
||||
/** return the minimum of two values, equivilant to std::min.
|
||||
* std::min not used because of STL implementation under IRIX contains no std::min.*/
|
||||
/** return the minimum of two values, equivilent to std::min.
|
||||
* std::min not used because of STL implementation under IRIX not containing
|
||||
* std::min.
|
||||
*/
|
||||
template<typename T>
|
||||
inline T minimum(T lhs,T rhs) { return lhs<rhs?lhs:rhs; }
|
||||
|
||||
/** return the maximum of two values, equivilant to std::max.
|
||||
* std::max not used because of STL implementation under IRIX contains no std::max.*/
|
||||
/** return the maximum of two values, equivilent to std::max.
|
||||
* std::max not used because of STL implementation under IRIX not containing
|
||||
* std::max.
|
||||
*/
|
||||
template<typename T>
|
||||
inline T maximum(T lhs,T rhs) { return lhs>rhs?lhs:rhs; }
|
||||
|
||||
template<typename T>
|
||||
inline T clampTo(T v,T minimum,T maximum) { return v<minimum?minimum:v>maximum?maximum:v; }
|
||||
inline T clampTo(T v,T minimum,T maximum)
|
||||
{ return v<minimum?minimum:v>maximum?maximum:v; }
|
||||
|
||||
template<typename T>
|
||||
inline T clampAbove(T v,T minimum) { return v<minimum?minimum:v; }
|
||||
@ -139,7 +154,8 @@ template<typename T>
|
||||
inline T clampBelow(T v,T maximum) { return v>maximum?maximum:v; }
|
||||
|
||||
template<typename T>
|
||||
inline T clampBetween(T v,T minimum, T maximum) { return clampBelow(clampAbove(v,minimum),maximum); }
|
||||
inline T clampBetween(T v,T minimum, T maximum)
|
||||
{ return clampBelow(clampAbove(v,minimum),maximum); }
|
||||
|
||||
template<typename T>
|
||||
inline T sign(T v) { return v<(T)0?(T)-1:(T)1; }
|
||||
@ -176,14 +192,14 @@ inline double RadiansToDegrees(double angle) { return angle*180.0/PI; }
|
||||
#endif
|
||||
|
||||
|
||||
/** compute the volume of tetrahedron */
|
||||
/** compute the volume of a tetrahedron. */
|
||||
template<typename T>
|
||||
inline float computeVolume(const T& a,const T& b,const T& c,const T& d)
|
||||
{
|
||||
return fabsf(((b-c)^(a-b))*(d-b));
|
||||
}
|
||||
|
||||
/** compute the volume of prism */
|
||||
/** compute the volume of a prism. */
|
||||
template<typename T>
|
||||
inline float computeVolume(const T& f1,const T& f2,const T& f3,
|
||||
const T& b1,const T& b2,const T& b3)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -32,7 +32,6 @@ class Matrixf;
|
||||
|
||||
class SG_EXPORT Matrixd
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef double value_type;
|
||||
@ -44,10 +43,10 @@ class SG_EXPORT Matrixd
|
||||
inline explicit Matrixd( double const * const ptr ) { set(ptr); }
|
||||
inline explicit Matrixd( const Quat& quat ) { set(quat); }
|
||||
|
||||
Matrixd( value_type a00, value_type a01, value_type a02, value_type a03,
|
||||
value_type a10, value_type a11, value_type a12, value_type a13,
|
||||
value_type a20, value_type a21, value_type a22, value_type a23,
|
||||
value_type a30, value_type a31, value_type a32, value_type a33);
|
||||
Matrixd(value_type a00, value_type a01, value_type a02, value_type a03,
|
||||
value_type a10, value_type a11, value_type a12, value_type a13,
|
||||
value_type a20, value_type a21, value_type a22, value_type a23,
|
||||
value_type a30, value_type a31, value_type a32, value_type a33);
|
||||
|
||||
~Matrixd() {}
|
||||
|
||||
@ -91,10 +90,10 @@ class SG_EXPORT Matrixd
|
||||
for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i];
|
||||
}
|
||||
|
||||
void set( value_type a00, value_type a01, value_type a02, value_type a03,
|
||||
value_type a10, value_type a11, value_type a12, value_type a13,
|
||||
value_type a20, value_type a21, value_type a22, value_type a23,
|
||||
value_type a30, value_type a31, value_type a32, value_type a33);
|
||||
void set(value_type a00, value_type a01, value_type a02,value_type a03,
|
||||
value_type a10, value_type a11, value_type a12,value_type a13,
|
||||
value_type a20, value_type a21, value_type a22,value_type a23,
|
||||
value_type a30, value_type a31, value_type a32,value_type a33);
|
||||
|
||||
void set(const Quat& q);
|
||||
|
||||
@ -128,57 +127,82 @@ class SG_EXPORT Matrixd
|
||||
|
||||
|
||||
|
||||
/** Set to a orthographic projection. See glOrtho for further details.*/
|
||||
void makeOrtho(double left, double right,
|
||||
/** Set to an orthographic projection.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
void makeOrtho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the othorgraphic settings of the orthographic projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
|
||||
bool getOrtho(double& left, double& right,
|
||||
/** Get the othogrraphic settings of the orthographic projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values
|
||||
* will be returned.
|
||||
*/
|
||||
bool getOrtho(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar) const;
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to a 2D orthographic projection. See glOrtho2D for further details.*/
|
||||
inline void makeOrtho2D(double left, double right,
|
||||
/** Set to a 2D orthographic projection.
|
||||
* See glOrtho2D for further details.
|
||||
*/
|
||||
inline void makeOrtho2D(double left, double right,
|
||||
double bottom, double top)
|
||||
{
|
||||
makeOrtho(left,right,bottom,top,-1.0,1.0);
|
||||
}
|
||||
|
||||
|
||||
/** Set to a perspective projection. See glFrustum for further details.*/
|
||||
void makeFrustum(double left, double right,
|
||||
/** Set to a perspective projection.
|
||||
* See glFrustum for further details.
|
||||
*/
|
||||
void makeFrustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the frustum setting of a perspective projection matrix.
|
||||
* Note, if matrix is not an perspective matrix then invalid values will be returned.*/
|
||||
bool getFrustum(double& left, double& right,
|
||||
/** Get the frustum settings of a perspective projection matrix.
|
||||
* Note, if matrix is not a perspective matrix then invalid values
|
||||
* will be returned.
|
||||
*/
|
||||
bool getFrustum(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar) const;
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to a symmetrical perspective projection, See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
void makePerspective(double fovy,double aspectRatio,
|
||||
/** Set to a symmetrical perspective projection.
|
||||
* See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.
|
||||
*/
|
||||
void makePerspective(double fovy, double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the frustum setting of a symetric perspective projection matrix.
|
||||
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
|
||||
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
|
||||
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
|
||||
* In these configuration one should use the AsFrustum method instead.*/
|
||||
bool getPerspective(double& fovy,double& aspectRatio,
|
||||
/** Get the frustum settings of a symmetric perspective projection
|
||||
* matrix.
|
||||
* Return false if matrix is not a perspective matrix,
|
||||
* where parameter values are undefined.
|
||||
* Note, if matrix is not a symmetric perspective matrix then the
|
||||
* shear will be lost.
|
||||
* Asymmetric matrices occur when stereo, power walls, caves and
|
||||
* reality center display are used.
|
||||
* In these configuration one should use the AsFrustum method instead.
|
||||
*/
|
||||
bool getPerspective(double& fovy, double& aspectRatio,
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to the position and orientation modelview matrix, using the same convention as gluLookAt. */
|
||||
/** Set the position and orientation to be a view matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up,value_type lookDistance=1.0f) const;
|
||||
/** Get to the position and orientation of a modelview matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up,
|
||||
value_type lookDistance=1.0f) const;
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up,value_type lookDistance=1.0f) const;
|
||||
/** Get to the position and orientation of a modelview matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up,
|
||||
value_type lookDistance=1.0f) const;
|
||||
|
||||
/** invert the matrix rhs. */
|
||||
bool invert( const Matrixd& rhs);
|
||||
@ -189,8 +213,8 @@ class SG_EXPORT Matrixd
|
||||
/** full 4x4 matrix invert. */
|
||||
bool invert_4x4_new( const Matrixd& );
|
||||
|
||||
//basic utility functions to create new matrices
|
||||
inline static Matrixd identity( void );
|
||||
// basic utility functions to create new matrices
|
||||
inline static Matrixd identity( void );
|
||||
inline static Matrixd scale( const Vec3f& sv);
|
||||
inline static Matrixd scale( const Vec3d& sv);
|
||||
inline static Matrixd scale( value_type sx, value_type sy, value_type sz);
|
||||
@ -211,32 +235,46 @@ class SG_EXPORT Matrixd
|
||||
inline static Matrixd rotate( const Quat& quat);
|
||||
inline static Matrixd inverse( const Matrixd& matrix);
|
||||
|
||||
/** Create a orthographic projection. See glOrtho for further details.*/
|
||||
inline static Matrixd ortho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
/** Create an orthographic projection matrix.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
inline static Matrixd ortho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a 2D orthographic projection. See glOrtho for further details.*/
|
||||
inline static Matrixd ortho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
/** Create a 2D orthographic projection.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
inline static Matrixd ortho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
|
||||
/** Create a perspective projection. See glFrustum for further details.*/
|
||||
inline static Matrixd frustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
/** Create a perspective projection.
|
||||
* See glFrustum for further details.
|
||||
*/
|
||||
inline static Matrixd frustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a symmetrical perspective projection, See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
inline static Matrixd perspective(double fovy,double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create the position and orientation as per a camera, using the same convention as gluLookAt. */
|
||||
inline static Matrixd lookAt(const Vec3f& eye,const Vec3f& center,const Vec3f& up);
|
||||
|
||||
/** Create the position and orientation as per a camera, using the same convention as gluLookAt. */
|
||||
inline static Matrixd lookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);
|
||||
/** Create a symmetrical perspective projection.
|
||||
* See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.
|
||||
*/
|
||||
inline static Matrixd perspective(double fovy, double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create the position and orientation as per a camera,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
inline static Matrixd lookAt(const Vec3f& eye,
|
||||
const Vec3f& center,
|
||||
const Vec3f& up);
|
||||
|
||||
/** Create the position and orientation as per a camera,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
inline static Matrixd lookAt(const Vec3d& eye,
|
||||
const Vec3d& center,
|
||||
const Vec3d& up);
|
||||
|
||||
inline Vec3f preMult( const Vec3f& v ) const;
|
||||
inline Vec3d preMult( const Vec3d& v ) const;
|
||||
@ -259,17 +297,17 @@ class SG_EXPORT Matrixd
|
||||
|
||||
inline Vec3d getScale() const { return Vec3d(_mat[0][0],_mat[1][1],_mat[2][2]); }
|
||||
|
||||
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
|
||||
inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m);
|
||||
/** apply a 3x3 transform of v*M[0..2,0..2]. */
|
||||
inline static Vec3f transform3x3(const Vec3f& v,const Matrixd& m);
|
||||
|
||||
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
|
||||
inline static Vec3d transform3x3(const Vec3d& v,const Matrixd& m);
|
||||
/** apply a 3x3 transform of v*M[0..2,0..2]. */
|
||||
inline static Vec3d transform3x3(const Vec3d& v,const Matrixd& m);
|
||||
|
||||
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
|
||||
inline static Vec3f transform3x3(const Matrixd& m,const Vec3f& v);
|
||||
/** apply a 3x3 transform of M[0..2,0..2]*v. */
|
||||
inline static Vec3f transform3x3(const Matrixd& m,const Vec3f& v);
|
||||
|
||||
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
|
||||
inline static Vec3d transform3x3(const Matrixd& m,const Vec3d& v);
|
||||
/** apply a 3x3 transform of M[0..2,0..2]*v. */
|
||||
inline static Vec3d transform3x3(const Matrixd& m,const Vec3d& v);
|
||||
|
||||
// basic Matrixd multiplication, our workhorse methods.
|
||||
void mult( const Matrixd&, const Matrixd& );
|
||||
@ -285,11 +323,11 @@ class SG_EXPORT Matrixd
|
||||
}
|
||||
|
||||
inline Matrixd operator * ( const Matrixd &m ) const
|
||||
{
|
||||
osg::Matrixd r;
|
||||
{
|
||||
osg::Matrixd r;
|
||||
r.mult(*this,m);
|
||||
return r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
protected:
|
||||
value_type _mat[4][4];
|
||||
@ -310,9 +348,9 @@ class RefMatrixd : public Object, public Matrixd
|
||||
Matrixd::value_type a20, Matrixd::value_type a21, Matrixd::value_type a22, Matrixd::value_type a23,
|
||||
Matrixd::value_type a30, Matrixd::value_type a31, Matrixd::value_type a32, Matrixd::value_type a33):
|
||||
Matrixd(a00, a01, a02, a03,
|
||||
a10, a11, a12, a13,
|
||||
a20, a21, a22, a23,
|
||||
a30, a31, a32, a33) {}
|
||||
a10, a11, a12, a13,
|
||||
a20, a21, a22, a23,
|
||||
a30, a31, a32, a33) {}
|
||||
|
||||
virtual Object* cloneType() const { return new RefMatrixd(); }
|
||||
virtual Object* clone(const CopyOp&) const { return new RefMatrixd(*this); }
|
||||
@ -327,7 +365,7 @@ class RefMatrixd : public Object, public Matrixd
|
||||
};
|
||||
|
||||
|
||||
//static utility methods
|
||||
// static utility methods
|
||||
inline Matrixd Matrixd::identity(void)
|
||||
{
|
||||
Matrixd m;
|
||||
@ -392,16 +430,16 @@ inline Matrixd Matrixd::rotate(value_type angle, const Vec3d& axis )
|
||||
return m;
|
||||
}
|
||||
inline Matrixd Matrixd::rotate( value_type angle1, const Vec3f& axis1,
|
||||
value_type angle2, const Vec3f& axis2,
|
||||
value_type angle3, const Vec3f& axis3)
|
||||
value_type angle2, const Vec3f& axis2,
|
||||
value_type angle3, const Vec3f& axis3)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
|
||||
return m;
|
||||
}
|
||||
inline Matrixd Matrixd::rotate( value_type angle1, const Vec3d& axis1,
|
||||
value_type angle2, const Vec3d& axis2,
|
||||
value_type angle3, const Vec3d& axis3)
|
||||
value_type angle2, const Vec3d& axis2,
|
||||
value_type angle3, const Vec3d& axis3)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
|
||||
@ -427,16 +465,16 @@ inline Matrixd Matrixd::inverse( const Matrixd& matrix)
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::ortho(double left, double right,
|
||||
inline Matrixd Matrixd::ortho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar)
|
||||
double zNear, double zFar)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeOrtho(left,right,bottom,top,zNear,zFar);
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::ortho2D(double left, double right,
|
||||
inline Matrixd Matrixd::ortho2D(double left, double right,
|
||||
double bottom, double top)
|
||||
{
|
||||
Matrixd m;
|
||||
@ -444,31 +482,35 @@ inline Matrixd Matrixd::ortho2D(double left, double right,
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::frustum(double left, double right,
|
||||
inline Matrixd Matrixd::frustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar)
|
||||
double zNear, double zFar)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeFrustum(left,right,bottom,top,zNear,zFar);
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::perspective(double fovy,double aspectRatio,
|
||||
double zNear, double zFar)
|
||||
inline Matrixd Matrixd::perspective(double fovy, double aspectRatio,
|
||||
double zNear, double zFar)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makePerspective(fovy,aspectRatio,zNear,zFar);
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::lookAt(const Vec3f& eye,const Vec3f& center,const Vec3f& up)
|
||||
inline Matrixd Matrixd::lookAt(const Vec3f& eye,
|
||||
const Vec3f& center,
|
||||
const Vec3f& up)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeLookAt(eye,center,up);
|
||||
return m;
|
||||
}
|
||||
|
||||
inline Matrixd Matrixd::lookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up)
|
||||
inline Matrixd Matrixd::lookAt(const Vec3d& eye,
|
||||
const Vec3d& center,
|
||||
const Vec3d& up)
|
||||
{
|
||||
Matrixd m;
|
||||
m.makeLookAt(eye,center,up);
|
||||
@ -482,6 +524,7 @@ inline Vec3f Matrixd::postMult( const Vec3f& v ) const
|
||||
(_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d,
|
||||
(_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ;
|
||||
}
|
||||
|
||||
inline Vec3d Matrixd::postMult( const Vec3d& v ) const
|
||||
{
|
||||
value_type d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ;
|
||||
@ -497,6 +540,7 @@ inline Vec3f Matrixd::preMult( const Vec3f& v ) const
|
||||
(_mat[0][1]*v.x() + _mat[1][1]*v.y() + _mat[2][1]*v.z() + _mat[3][1])*d,
|
||||
(_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2])*d);
|
||||
}
|
||||
|
||||
inline Vec3d Matrixd::preMult( const Vec3d& v ) const
|
||||
{
|
||||
value_type d = 1.0f/(_mat[0][3]*v.x()+_mat[1][3]*v.y()+_mat[2][3]*v.z()+_mat[3][3]) ;
|
||||
@ -527,6 +571,7 @@ inline Vec4f Matrixd::preMult( const Vec4f& v ) const
|
||||
(_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()),
|
||||
(_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w()));
|
||||
}
|
||||
|
||||
inline Vec4d Matrixd::preMult( const Vec4d& v ) const
|
||||
{
|
||||
return Vec4d( (_mat[0][0]*v.x() + _mat[1][0]*v.y() + _mat[2][0]*v.z() + _mat[3][0]*v.w()),
|
||||
@ -534,6 +579,7 @@ inline Vec4d Matrixd::preMult( const Vec4d& v ) const
|
||||
(_mat[0][2]*v.x() + _mat[1][2]*v.y() + _mat[2][2]*v.z() + _mat[3][2]*v.w()),
|
||||
(_mat[0][3]*v.x() + _mat[1][3]*v.y() + _mat[2][3]*v.z() + _mat[3][3]*v.w()));
|
||||
}
|
||||
|
||||
inline Vec3f Matrixd::transform3x3(const Vec3f& v,const Matrixd& m)
|
||||
{
|
||||
return Vec3f( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z()),
|
||||
@ -560,19 +606,21 @@ inline Vec3d Matrixd::transform3x3(const Matrixd& m,const Vec3d& v)
|
||||
(m._mat[2][0]*v.x() + m._mat[2][1]*v.y() + m._mat[2][2]*v.z()) ) ;
|
||||
}
|
||||
|
||||
|
||||
inline Vec3f operator* (const Vec3f& v, const Matrixd& m )
|
||||
{
|
||||
return m.preMult(v);
|
||||
}
|
||||
|
||||
inline Vec3d operator* (const Vec3d& v, const Matrixd& m )
|
||||
{
|
||||
return m.preMult(v);
|
||||
}
|
||||
|
||||
inline Vec4f operator* (const Vec4f& v, const Matrixd& m )
|
||||
{
|
||||
return m.preMult(v);
|
||||
}
|
||||
|
||||
inline Vec4d operator* (const Vec4d& v, const Matrixd& m )
|
||||
{
|
||||
return m.preMult(v);
|
||||
@ -582,14 +630,17 @@ inline Vec3f Matrixd::operator* (const Vec3f& v) const
|
||||
{
|
||||
return postMult(v);
|
||||
}
|
||||
|
||||
inline Vec3d Matrixd::operator* (const Vec3d& v) const
|
||||
{
|
||||
return postMult(v);
|
||||
}
|
||||
|
||||
inline Vec4f Matrixd::operator* (const Vec4f& v) const
|
||||
{
|
||||
return postMult(v);
|
||||
}
|
||||
|
||||
inline Vec4d Matrixd::operator* (const Vec4d& v) const
|
||||
{
|
||||
return postMult(v);
|
||||
@ -608,7 +659,6 @@ inline std::ostream& operator<< (std::ostream& os, const Matrixd& m )
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
} //namespace osg
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
@ -28,11 +28,10 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
class Matrixd;
|
||||
class Matrixf;
|
||||
|
||||
class SG_EXPORT Matrixf
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef float value_type;
|
||||
@ -91,10 +90,10 @@ class SG_EXPORT Matrixf
|
||||
for(int i=0;i<16;++i) local_ptr[i]=(value_type)ptr[i];
|
||||
}
|
||||
|
||||
void set( value_type a00, value_type a01, value_type a02, value_type a03,
|
||||
value_type a10, value_type a11, value_type a12, value_type a13,
|
||||
value_type a20, value_type a21, value_type a22, value_type a23,
|
||||
value_type a30, value_type a31, value_type a32, value_type a33);
|
||||
void set(value_type a00, value_type a01, value_type a02,value_type a03,
|
||||
value_type a10, value_type a11, value_type a12,value_type a13,
|
||||
value_type a20, value_type a21, value_type a22,value_type a23,
|
||||
value_type a30, value_type a31, value_type a32,value_type a33);
|
||||
|
||||
void set(const Quat& q);
|
||||
|
||||
@ -128,57 +127,82 @@ class SG_EXPORT Matrixf
|
||||
|
||||
|
||||
|
||||
/** Set to a orthographic projection. See glOrtho for further details.*/
|
||||
void makeOrtho(double left, double right,
|
||||
/** Set to an orthographic projection.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
void makeOrtho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the othorgraphic settings of the orthographic projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values will be returned.*/
|
||||
bool getOrtho(double& left, double& right,
|
||||
/** Get the othogrraphic settings of the orthographic projection matrix.
|
||||
* Note, if matrix is not an orthographic matrix then invalid values
|
||||
* will be returned.
|
||||
*/
|
||||
bool getOrtho(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar) const;
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to a 2D orthographic projection. See glOrtho2D for further details.*/
|
||||
inline void makeOrtho2D(double left, double right,
|
||||
/** Set to a 2D orthographic projection.
|
||||
* See glOrtho2D for further details.
|
||||
*/
|
||||
inline void makeOrtho2D(double left, double right,
|
||||
double bottom, double top)
|
||||
{
|
||||
makeOrtho(left,right,bottom,top,-1.0,1.0);
|
||||
}
|
||||
|
||||
|
||||
/** Set to a perspective projection. See glFrustum for further details.*/
|
||||
void makeFrustum(double left, double right,
|
||||
/** Set to a perspective projection.
|
||||
* See glFrustum for further details.
|
||||
*/
|
||||
void makeFrustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the frustum setting of a perspective projection matrix.
|
||||
* Note, if matrix is not an perspective matrix then invalid values will be returned.*/
|
||||
bool getFrustum(double& left, double& right,
|
||||
/** Get the frustum settings of a perspective projection matrix.
|
||||
* Note, if matrix is not a perspective matrix then invalid values
|
||||
* will be returned.
|
||||
*/
|
||||
bool getFrustum(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar) const;
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to a symmetrical perspective projection, See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
void makePerspective(double fovy,double aspectRatio,
|
||||
/** Set to a symmetrical perspective projection.
|
||||
* See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.
|
||||
*/
|
||||
void makePerspective(double fovy, double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the frustum setting of a symetric perspective projection matrix.
|
||||
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
|
||||
* Note, if matrix is not a symetric perspective matrix then the shear will be lost.
|
||||
* Asymetric metrices occur when stereo, power walls, caves and reality center display are used.
|
||||
* In these configuration one should use the AsFrustum method instead.*/
|
||||
bool getPerspective(double& fovy,double& aspectRatio,
|
||||
/** Get the frustum settings of a symmetric perspective projection
|
||||
* matrix.
|
||||
* Return false if matrix is not a perspective matrix,
|
||||
* where parameter values are undefined.
|
||||
* Note, if matrix is not a symmetric perspective matrix then the
|
||||
* shear will be lost.
|
||||
* Asymmetric matrices occur when stereo, power walls, caves and
|
||||
* reality center display are used.
|
||||
* In these configuration one should use the AsFrustum method instead.
|
||||
*/
|
||||
bool getPerspective(double& fovy, double& aspectRatio,
|
||||
double& zNear, double& zFar) const;
|
||||
|
||||
/** Set to the position and orientation modelview matrix, using the same convention as gluLookAt. */
|
||||
/** Set the position and orientation to be a view matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up,value_type lookDistance=1.0f) const;
|
||||
/** Get to the position and orientation of a modelview matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void getLookAt(Vec3f& eye,Vec3f& center,Vec3f& up,
|
||||
value_type lookDistance=1.0f) const;
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up,value_type lookDistance=1.0f) const;
|
||||
/** Get to the position and orientation of a modelview matrix,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
void getLookAt(Vec3d& eye,Vec3d& center,Vec3d& up,
|
||||
value_type lookDistance=1.0f) const;
|
||||
|
||||
/** invert the matrix rhs. */
|
||||
bool invert( const Matrixf& rhs);
|
||||
@ -211,32 +235,46 @@ class SG_EXPORT Matrixf
|
||||
inline static Matrixf rotate( const Quat& quat);
|
||||
inline static Matrixf inverse( const Matrixf& matrix);
|
||||
|
||||
/** Create a orthographic projection. See glOrtho for further details.*/
|
||||
inline static Matrixf ortho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
/** Create an orthographic projection matrix.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
inline static Matrixf ortho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a 2D orthographic projection. See glOrtho for further details.*/
|
||||
inline static Matrixf ortho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
/** Create a 2D orthographic projection.
|
||||
* See glOrtho for further details.
|
||||
*/
|
||||
inline static Matrixf ortho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
|
||||
/** Create a perspective projection. See glFrustum for further details.*/
|
||||
inline static Matrixf frustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
/** Create a perspective projection.
|
||||
* See glFrustum for further details.
|
||||
*/
|
||||
inline static Matrixf frustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a symmetrical perspective projection, See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
inline static Matrixf perspective(double fovy,double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create the position and orientation as per a camera, using the same convention as gluLookAt. */
|
||||
inline static Matrixf lookAt(const Vec3f& eye,const Vec3f& center,const Vec3f& up);
|
||||
|
||||
/** Create the position and orientation as per a camera, using the same convention as gluLookAt. */
|
||||
inline static Matrixf lookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);
|
||||
/** Create a symmetrical perspective projection.
|
||||
* See gluPerspective for further details.
|
||||
* Aspect ratio is defined as width/height.
|
||||
*/
|
||||
inline static Matrixf perspective(double fovy, double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create the position and orientation as per a camera,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
inline static Matrixf lookAt(const Vec3f& eye,
|
||||
const Vec3f& center,
|
||||
const Vec3f& up);
|
||||
|
||||
/** Create the position and orientation as per a camera,
|
||||
* using the same convention as gluLookAt.
|
||||
*/
|
||||
inline static Matrixf lookAt(const Vec3d& eye,
|
||||
const Vec3d& center,
|
||||
const Vec3d& up);
|
||||
|
||||
inline Vec3f preMult( const Vec3f& v ) const;
|
||||
inline Vec3d preMult( const Vec3d& v ) const;
|
||||
@ -259,17 +297,17 @@ class SG_EXPORT Matrixf
|
||||
|
||||
inline Vec3d getScale() const { return Vec3d(_mat[0][0],_mat[1][1],_mat[2][2]); }
|
||||
|
||||
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
|
||||
inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m);
|
||||
/** apply a 3x3 transform of v*M[0..2,0..2]. */
|
||||
inline static Vec3f transform3x3(const Vec3f& v,const Matrixf& m);
|
||||
|
||||
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
|
||||
inline static Vec3d transform3x3(const Vec3d& v,const Matrixf& m);
|
||||
/** apply a 3x3 transform of v*M[0..2,0..2]. */
|
||||
inline static Vec3d transform3x3(const Vec3d& v,const Matrixf& m);
|
||||
|
||||
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
|
||||
inline static Vec3f transform3x3(const Matrixf& m,const Vec3f& v);
|
||||
/** apply a 3x3 transform of M[0..2,0..2]*v. */
|
||||
inline static Vec3f transform3x3(const Matrixf& m,const Vec3f& v);
|
||||
|
||||
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
|
||||
inline static Vec3d transform3x3(const Matrixf& m,const Vec3d& v);
|
||||
/** apply a 3x3 transform of M[0..2,0..2]*v. */
|
||||
inline static Vec3d transform3x3(const Matrixf& m,const Vec3d& v);
|
||||
|
||||
// basic Matrixf multiplication, our workhorse methods.
|
||||
void mult( const Matrixf&, const Matrixf& );
|
||||
|
Loading…
Reference in New Issue
Block a user