From 8b3ec4b1ba3778751fbb1dcfb01631fa6467f891 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 20 Dec 2011 00:10:11 +0000 Subject: [PATCH] pass by reference --- .../colorInterpolationManager.I | 4 ++-- .../colorInterpolationManager.cxx | 22 +++++++++---------- .../colorInterpolationManager.h | 20 ++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/panda/src/particlesystem/colorInterpolationManager.I b/panda/src/particlesystem/colorInterpolationManager.I index 4bc3b679b3..ff02a08f6d 100755 --- a/panda/src/particlesystem/colorInterpolationManager.I +++ b/panda/src/particlesystem/colorInterpolationManager.I @@ -32,7 +32,7 @@ get_color_a() const { //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionConstant:: -set_color_a(const LColor c) { +set_color_a(const LColor &c) { _c_a = c; } @@ -54,7 +54,7 @@ get_color_b() const { //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionLinear:: -set_color_b(const LColor c) { +set_color_b(const LColor &c) { _c_b = c; } diff --git a/panda/src/particlesystem/colorInterpolationManager.cxx b/panda/src/particlesystem/colorInterpolationManager.cxx index fe4b8978ce..522d6fbc63 100755 --- a/panda/src/particlesystem/colorInterpolationManager.cxx +++ b/panda/src/particlesystem/colorInterpolationManager.cxx @@ -58,7 +58,7 @@ ColorInterpolationFunctionConstant() : //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionConstant:: -ColorInterpolationFunctionConstant(const LColor color_a) : +ColorInterpolationFunctionConstant(const LColor &color_a) : _c_a(color_a) { } @@ -91,8 +91,8 @@ ColorInterpolationFunctionLinear() : //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionLinear:: -ColorInterpolationFunctionLinear(const LColor color_a, - const LColor color_b) : +ColorInterpolationFunctionLinear(const LColor &color_a, + const LColor &color_b) : ColorInterpolationFunctionConstant(color_a), _c_b(color_b) { } @@ -127,8 +127,8 @@ ColorInterpolationFunctionStepwave() : //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionStepwave:: -ColorInterpolationFunctionStepwave(const LColor color_a, - const LColor color_b, +ColorInterpolationFunctionStepwave(const LColor &color_a, + const LColor &color_b, const PN_stdfloat width_a, const PN_stdfloat width_b) : ColorInterpolationFunctionLinear(color_a,color_b), @@ -168,8 +168,8 @@ ColorInterpolationFunctionSinusoid() : //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionSinusoid:: -ColorInterpolationFunctionSinusoid(const LColor color_a, - const LColor color_b, +ColorInterpolationFunctionSinusoid(const LColor &color_a, + const LColor &color_b, const PN_stdfloat period) : ColorInterpolationFunctionLinear(color_a,color_b), _period(period) { @@ -307,7 +307,7 @@ ColorInterpolationManager:: //////////////////////////////////////////////////////////////////// int ColorInterpolationManager:: -add_constant(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor color, const bool is_modulated) { +add_constant(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor &color, const bool is_modulated) { PT(ColorInterpolationFunctionConstant) fPtr = new ColorInterpolationFunctionConstant(color); PT(ColorInterpolationSegment) sPtr = new ColorInterpolationSegment(fPtr,time_begin,time_end,is_modulated,_id_generator); @@ -324,7 +324,7 @@ add_constant(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LCo //////////////////////////////////////////////////////////////////// int ColorInterpolationManager:: -add_linear(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor color_a, const LColor color_b, const bool is_modulated) { +add_linear(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor &color_a, const LColor &color_b, const bool is_modulated) { PT(ColorInterpolationFunctionLinear) fPtr = new ColorInterpolationFunctionLinear(color_a, color_b); PT(ColorInterpolationSegment) sPtr = new ColorInterpolationSegment(fPtr,time_begin,time_end,is_modulated,_id_generator); @@ -341,7 +341,7 @@ add_linear(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColo //////////////////////////////////////////////////////////////////// int ColorInterpolationManager:: -add_stepwave(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor color_a, const LColor color_b, const PN_stdfloat width_a, const PN_stdfloat width_b,const bool is_modulated) { +add_stepwave(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor &color_a, const LColor &color_b, const PN_stdfloat width_a, const PN_stdfloat width_b,const bool is_modulated) { PT(ColorInterpolationFunctionStepwave) fPtr = new ColorInterpolationFunctionStepwave(color_a, color_b, width_a, width_b); PT(ColorInterpolationSegment) sPtr = new ColorInterpolationSegment(fPtr,time_begin,time_end,is_modulated,_id_generator); @@ -359,7 +359,7 @@ add_stepwave(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LCo //////////////////////////////////////////////////////////////////// int ColorInterpolationManager:: -add_sinusoid(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor color_a, const LColor color_b, const PN_stdfloat period,const bool is_modulated) { +add_sinusoid(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColor &color_a, const LColor &color_b, const PN_stdfloat period,const bool is_modulated) { PT(ColorInterpolationFunctionSinusoid) fPtr = new ColorInterpolationFunctionSinusoid(color_a, color_b, period); PT(ColorInterpolationSegment) sPtr = new ColorInterpolationSegment(fPtr,time_begin,time_end,is_modulated,_id_generator); diff --git a/panda/src/particlesystem/colorInterpolationManager.h b/panda/src/particlesystem/colorInterpolationManager.h index 656cba15d4..e43ecdb2f8 100755 --- a/panda/src/particlesystem/colorInterpolationManager.h +++ b/panda/src/particlesystem/colorInterpolationManager.h @@ -66,11 +66,11 @@ class ColorInterpolationFunctionConstant : public ColorInterpolationFunction { PUBLISHED: INLINE LColor get_color_a() const; - INLINE void set_color_a(const LColor c); + INLINE void set_color_a(const LColor &c); public: ColorInterpolationFunctionConstant(); - ColorInterpolationFunctionConstant(const LColor color_a); + ColorInterpolationFunctionConstant(const LColor &color_a); protected: virtual LColor interpolate(const PN_stdfloat t = 0) const; @@ -107,11 +107,11 @@ class ColorInterpolationFunctionLinear : public ColorInterpolationFunctionConsta PUBLISHED: INLINE LColor get_color_b() const; - INLINE void set_color_b(const LColor c); + INLINE void set_color_b(const LColor &c); public: ColorInterpolationFunctionLinear(); - ColorInterpolationFunctionLinear(const LColor color_a, const LColor color_b); + ColorInterpolationFunctionLinear(const LColor &color_a, const LColor &color_b); protected: LColor interpolate(const PN_stdfloat t = 0) const; @@ -157,7 +157,7 @@ PUBLISHED: public: ColorInterpolationFunctionStepwave(); - ColorInterpolationFunctionStepwave(const LColor color_a, const LColor color_b, const PN_stdfloat width_a, const PN_stdfloat width_b); + ColorInterpolationFunctionStepwave(const LColor &color_a, const LColor &color_b, const PN_stdfloat width_a, const PN_stdfloat width_b); protected: LColor interpolate(const PN_stdfloat t = 0) const; @@ -203,7 +203,7 @@ PUBLISHED: public: ColorInterpolationFunctionSinusoid(); - ColorInterpolationFunctionSinusoid(const LColor color_a, const LColor color_b, const PN_stdfloat period); + ColorInterpolationFunctionSinusoid(const LColor &color_a, const LColor &color_b, const PN_stdfloat period); protected: LColor interpolate(const PN_stdfloat t = 0) const; @@ -287,10 +287,10 @@ ColorInterpolationManager(); ColorInterpolationManager(const ColorInterpolationManager& copy); virtual ~ColorInterpolationManager(); - int add_constant(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor color = LColor(1.0f,1.0f,1.0f,1.0f), const bool is_modulated = true); - int add_linear(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor color_b = LColor(0.0f,1.0f,0.0f,1.0f), const bool is_modulated = true); - int add_stepwave(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor color_b = LColor(0.0f,1.0f,0.0f,1.0f), const PN_stdfloat width_a = 0.5f, const PN_stdfloat width_b = 0.5f, const bool is_modulated = true); - int add_sinusoid(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor color_b = LColor(0.0f,1.0f,0.0f,1.0f), const PN_stdfloat period = 1.0f, const bool is_modulated = true); + int add_constant(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor &color = LColor(1.0f,1.0f,1.0f,1.0f), const bool is_modulated = true); + int add_linear(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor &color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor &color_b = LColor(0.0f,1.0f,0.0f,1.0f), const bool is_modulated = true); + int add_stepwave(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor &color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor &color_b = LColor(0.0f,1.0f,0.0f,1.0f), const PN_stdfloat width_a = 0.5f, const PN_stdfloat width_b = 0.5f, const bool is_modulated = true); + int add_sinusoid(const PN_stdfloat time_begin = 0.0f, const PN_stdfloat time_end = 1.0f, const LColor &color_a = LColor(1.0f,0.0f,0.0f,1.0f), const LColor &color_b = LColor(0.0f,1.0f,0.0f,1.0f), const PN_stdfloat period = 1.0f, const bool is_modulated = true); INLINE void set_default_color(const LColor &c); INLINE ColorInterpolationSegment* get_segment(const int seg_id);