From 98c7d823853cc845f114cb99a40f1d0293b248fd Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 5 Jan 2006 19:55:48 +0000 Subject: [PATCH] declare methods const --- panda/src/mathutil/perlinNoise2.I | 10 +++++----- panda/src/mathutil/perlinNoise2.cxx | 2 +- panda/src/mathutil/perlinNoise2.h | 12 ++++++------ panda/src/mathutil/perlinNoise3.I | 10 +++++----- panda/src/mathutil/perlinNoise3.cxx | 2 +- panda/src/mathutil/perlinNoise3.h | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/panda/src/mathutil/perlinNoise2.I b/panda/src/mathutil/perlinNoise2.I index d2e6e2a9ea..6bc65bb439 100644 --- a/panda/src/mathutil/perlinNoise2.I +++ b/panda/src/mathutil/perlinNoise2.I @@ -123,7 +123,7 @@ set_scale(const LVecBase2d &value) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise2:: -noise(double x, double y) { +noise(double x, double y) const { return noise(LVecBase2d(x, y)); } @@ -133,7 +133,7 @@ noise(double x, double y) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE float PerlinNoise2:: -noise(const LVecBase2f &value) { +noise(const LVecBase2f &value) const { return (float)noise(value[0], value[1]); } @@ -143,7 +143,7 @@ noise(const LVecBase2f &value) { // Description: Returns the noise function of the two inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise2:: -operator ()(double x, double y) { +operator ()(double x, double y) const { return noise(x, y); } @@ -153,7 +153,7 @@ operator ()(double x, double y) { // Description: Returns the noise function of the two inputs. //////////////////////////////////////////////////////////////////// INLINE float PerlinNoise2:: -operator ()(const LVecBase2f &value) { +operator ()(const LVecBase2f &value) const { return noise(value); } @@ -163,7 +163,7 @@ operator ()(const LVecBase2f &value) { // Description: Returns the noise function of the two inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise2:: -operator ()(const LVecBase2d &value) { +operator ()(const LVecBase2d &value) const { return noise(value); } diff --git a/panda/src/mathutil/perlinNoise2.cxx b/panda/src/mathutil/perlinNoise2.cxx index 2604029938..6d68d0569f 100644 --- a/panda/src/mathutil/perlinNoise2.cxx +++ b/panda/src/mathutil/perlinNoise2.cxx @@ -25,7 +25,7 @@ // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// double PerlinNoise2:: -noise(const LVecBase2d &value) { +noise(const LVecBase2d &value) const { // Convert the vector to our local coordinate space. LVecBase2d vec = _input_xform.xform_point(value); diff --git a/panda/src/mathutil/perlinNoise2.h b/panda/src/mathutil/perlinNoise2.h index 084eb2ee2f..90193e0400 100644 --- a/panda/src/mathutil/perlinNoise2.h +++ b/panda/src/mathutil/perlinNoise2.h @@ -43,13 +43,13 @@ PUBLISHED: INLINE void set_scale(const LVecBase2f &scale); void set_scale(const LVecBase2d &scale); - INLINE double noise(double x, double y); - INLINE float noise(const LVecBase2f &value); - double noise(const LVecBase2d &value); + INLINE double noise(double x, double y) const; + INLINE float noise(const LVecBase2f &value) const; + double noise(const LVecBase2d &value) const; - INLINE double operator ()(double x, double y); - INLINE float operator ()(const LVecBase2f &value); - INLINE double operator ()(const LVecBase2d &value); + INLINE double operator ()(double x, double y) const; + INLINE float operator ()(const LVecBase2f &value) const; + INLINE double operator ()(const LVecBase2d &value) const; private: void init_unscaled_xform(); diff --git a/panda/src/mathutil/perlinNoise3.I b/panda/src/mathutil/perlinNoise3.I index 2b690d5ef9..4b4b4e0c69 100644 --- a/panda/src/mathutil/perlinNoise3.I +++ b/panda/src/mathutil/perlinNoise3.I @@ -123,7 +123,7 @@ set_scale(const LVecBase3d &value) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise3:: -noise(double x, double y, double z) { +noise(double x, double y, double z) const { return noise(LVecBase3d(x, y, z)); } @@ -133,7 +133,7 @@ noise(double x, double y, double z) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE float PerlinNoise3:: -noise(const LVecBase3f &value) { +noise(const LVecBase3f &value) const { return (float)noise(value[0], value[1], value[2]); } @@ -143,7 +143,7 @@ noise(const LVecBase3f &value) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise3:: -operator ()(double x, double y, double z) { +operator ()(double x, double y, double z) const { return noise(x, y, z); } @@ -153,7 +153,7 @@ operator ()(double x, double y, double z) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE float PerlinNoise3:: -operator ()(const LVecBase3f &value) { +operator ()(const LVecBase3f &value) const { return noise(value); } @@ -163,7 +163,7 @@ operator ()(const LVecBase3f &value) { // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// INLINE double PerlinNoise3:: -operator ()(const LVecBase3d &value) { +operator ()(const LVecBase3d &value) const { return noise(value); } diff --git a/panda/src/mathutil/perlinNoise3.cxx b/panda/src/mathutil/perlinNoise3.cxx index ed66ba2139..59c2c65375 100644 --- a/panda/src/mathutil/perlinNoise3.cxx +++ b/panda/src/mathutil/perlinNoise3.cxx @@ -25,7 +25,7 @@ // Description: Returns the noise function of the three inputs. //////////////////////////////////////////////////////////////////// double PerlinNoise3:: -noise(const LVecBase3d &value) { +noise(const LVecBase3d &value) const { // Convert the vector to our local coordinate space. LVecBase3d vec = _input_xform.xform_point(value); diff --git a/panda/src/mathutil/perlinNoise3.h b/panda/src/mathutil/perlinNoise3.h index 6f01f53b0b..d08a8489b3 100644 --- a/panda/src/mathutil/perlinNoise3.h +++ b/panda/src/mathutil/perlinNoise3.h @@ -42,13 +42,13 @@ PUBLISHED: INLINE void set_scale(const LVecBase3f &scale); INLINE void set_scale(const LVecBase3d &scale); - INLINE double noise(double x, double y, double z); - INLINE float noise(const LVecBase3f &value); - double noise(const LVecBase3d &value); + INLINE double noise(double x, double y, double z) const; + INLINE float noise(const LVecBase3f &value) const; + double noise(const LVecBase3d &value) const; - INLINE double operator ()(double x, double y, double z); - INLINE float operator ()(const LVecBase3f &value); - INLINE double operator ()(const LVecBase3d &value); + INLINE double operator ()(double x, double y, double z) const; + INLINE float operator ()(const LVecBase3f &value) const; + INLINE double operator ()(const LVecBase3d &value) const; private: void init_unscaled_xform();