From Gideon May, fixes to remain const base type instances in headers.

This commit is contained in:
Robert Osfield
2002-10-25 12:29:03 +00:00
parent 18d99c06e4
commit 55b2a5ff30
7 changed files with 21 additions and 17 deletions

View File

@@ -56,13 +56,13 @@ class SG_EXPORT AlphaFunc : public StateAttribute
ALWAYS = GL_ALWAYS
};
inline void setFunction(const ComparisonFunction func,float ref)
inline void setFunction(ComparisonFunction func,float ref)
{
_comparisonFunc = func;
_referenceValue = ref;
}
inline const ComparisonFunction getFunction() const { return _comparisonFunc; }
inline ComparisonFunction getFunction() const { return _comparisonFunc; }
inline float getReferenceValue() const { return _referenceValue; }

View File

@@ -47,7 +47,7 @@ class SG_EXPORT Camera: public osg::Referenced
/** Get the projection type set by setOtho,setOtho2D,setFrustum,
* and set perspective methods.*/
const ProjectionType getProjectionType() const { return _projectionType; }
ProjectionType getProjectionType() const { return _projectionType; }
/** Set a orthographic projection. See glOrtho for further details.*/
void setOrtho(double left, double right,
@@ -87,11 +87,11 @@ class SG_EXPORT Camera: public osg::Referenced
/** Set the way that the vertical or horizontal dimensions of the window
* are adjusted on a resize. */
void setAdjustAspectRatioMode(const AdjustAspectRatioMode aam) { _adjustAspectRatioMode = aam; }
void setAdjustAspectRatioMode(AdjustAspectRatioMode aam) { _adjustAspectRatioMode = aam; }
/** Get the way that the vertical or horizontal dimensions of the window
* are adjusted on a resize. */
const AdjustAspectRatioMode getAdjustAspectRatioMode() const { return _adjustAspectRatioMode; }
AdjustAspectRatioMode getAdjustAspectRatioMode() const { return _adjustAspectRatioMode; }
/** Adjust the clipping planes to account for a new window aspect ratio.
* Typically used after resizing a window. Aspect ratio is defined as
@@ -104,7 +104,7 @@ class SG_EXPORT Camera: public osg::Referenced
/** Adjust the clipping planes to account for a new window aspect ratio.
* Typicall used after resizeing a window. Aspect ratio is defined as
* width/height.*/
void adjustAspectRatio(double newAspectRatio, const AdjustAspectRatioMode aa);
void adjustAspectRatio(double newAspectRatio, AdjustAspectRatioMode aa);
double left() const { return _left; }
double right() const { return _right; }
@@ -139,7 +139,7 @@ class SG_EXPORT Camera: public osg::Referenced
USE_EYE_CENTER_AND_UP
};
const LookAtType getLookAtType() const { return _lookAtType; }
LookAtType getLookAtType() const { return _lookAtType; }
/**
* hardwired home view for now, looking straight down the
@@ -217,11 +217,11 @@ class SG_EXPORT Camera: public osg::Referenced
* basic LookAt values.
* note: Camera internals maintains the both EYE_TO_MODEL and MODEL_TO_EYE
* internally and ensures that they are the inverse of one another.*/
void attachTransform(const TransformMode mode, Matrix* modelTransform=0);
void attachTransform(TransformMode mode, Matrix* modelTransform=0);
Matrix* getTransform(const TransformMode mode);
Matrix* getTransform(TransformMode mode);
const Matrix* getTransform(const TransformMode mode) const;
const Matrix* getTransform(TransformMode mode) const;

View File

@@ -18,7 +18,7 @@ class SG_EXPORT ClipPlane : public StateAttribute
ClipPlane();
inline ClipPlane(unsigned int no,const Vec4& plane) { setClipPlaneNum(no); setClipPlane(plane); }
inline ClipPlane(unsigned int no,const Plane& plane) { setClipPlaneNum(no); setClipPlane(plane); }
inline ClipPlane(unsigned int no,const double a,const double b,const double c,const double d) { setClipPlaneNum(no); setClipPlane(a,b,c,d); }
inline ClipPlane(unsigned int no,double a,double b,double c,double d) { setClipPlaneNum(no); setClipPlane(a,b,c,d); }
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ClipPlane(const ClipPlane& cp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
@@ -66,7 +66,7 @@ class SG_EXPORT ClipPlane : public StateAttribute
void setClipPlane(const double* plane);
/** Set the clip plane, using a a to define plane. */
void setClipPlane(const double a,const double b,const double c,const double d)
void setClipPlane(double a,double b,double c,double d)
{
_clipPlane[0]=a;_clipPlane[1]=b;_clipPlane[2]=c;_clipPlane[3]=d;
}

View File

@@ -43,7 +43,7 @@ class SG_EXPORT FrontFace : public StateAttribute
COUNTER_CLOCKWISE = GL_CCW
};
inline void setMode(const Mode mode) { _mode = mode; }
inline void setMode(Mode mode) { _mode = mode; }
inline const Mode getMode() const { return _mode; }
virtual void apply(State& state) const;

View File

@@ -86,6 +86,10 @@ class SG_EXPORT Quat
inline float z() const { return _fv[2]; }
inline float w() const { return _fv[3]; }
/** return true if the Quat represents a zero rotation, and therefore can be ignored in computations.*/
bool zeroRotation() const { return _fv[0]==0.0f && _fv[1]==0.0f && _fv[2]==0.0f && _fv[3]==1.0f; }
/* -------------------------------------------------------------
BASIC ARITHMETIC METHODS
Implemented in terms of Vec4s. Some Vec4 operators, e.g.

View File

@@ -97,8 +97,8 @@ class OSGTEXT_EXPORT Text : public osg::Drawable
Font* getFont() { return _font.get(); }
const Font* getFont() const { return _font.get(); }
void setText(const char* text) { _text=text; }
void setText(const std::string& text) { _text=text; }
void setText(const char* text) { _text=text; _initAlignment=false; }
void setText(const std::string& text) { _text=text; _initAlignment=false; }
const std::string& getText() const { return _text; }
virtual void drawImmediateMode(osg::State& state);

View File

@@ -208,7 +208,7 @@ void Camera::setNearFar(double zNear, double zFar)
/** Adjust the clipping planes to account for a new window aspcect ratio.
* Typicall used after resizeing a window.*/
void Camera::adjustAspectRatio(double newAspectRatio, const AdjustAspectRatioMode aa)
void Camera::adjustAspectRatio(double newAspectRatio, AdjustAspectRatioMode aa)
{
if (newAspectRatio<0.01f || newAspectRatio>100.0f)
{
@@ -424,7 +424,7 @@ Matrix* Camera::getTransform(TransformMode mode)
}
}
const Matrix* Camera::getTransform(const TransformMode mode) const
const Matrix* Camera::getTransform(TransformMode mode) const
{
switch(mode)
{