Browse Source

declare methods const

David Rose 20 years ago
parent
commit
98c7d82385

+ 5 - 5
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);
 }
 

+ 1 - 1
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);
 

+ 6 - 6
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();

+ 5 - 5
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);
 }
 

+ 1 - 1
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);
 

+ 6 - 6
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();