瀏覽代碼

pass by reference

David Rose 14 年之前
父節點
當前提交
8b3ec4b1ba

+ 2 - 2
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;
 }
 

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

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