00001 // Filename: sparkleParticleRenderer.I 00002 // Created by: charles (27Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function : set_center_color 00017 // Access : public 00018 //////////////////////////////////////////////////////////////////// 00019 INLINE void SparkleParticleRenderer:: 00020 set_center_color(const LColor& c) { 00021 _center_color = c; 00022 } 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function : set_edge_color 00026 // Access : public 00027 //////////////////////////////////////////////////////////////////// 00028 INLINE void SparkleParticleRenderer:: 00029 set_edge_color(const LColor& c) { 00030 _edge_color = c; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function : set_life_scale 00035 // Access : public 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE void SparkleParticleRenderer:: 00038 set_life_scale(SparkleParticleRenderer::SparkleParticleLifeScale ls) { 00039 _life_scale = ls; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function : set_birth_radius 00044 // Access : public 00045 //////////////////////////////////////////////////////////////////// 00046 INLINE void SparkleParticleRenderer:: 00047 set_birth_radius(PN_stdfloat radius) { 00048 _birth_radius = radius; 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function : set_death_radius 00053 // Access : public 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE void SparkleParticleRenderer:: 00056 set_death_radius(PN_stdfloat radius) { 00057 _death_radius = radius; 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function : get_center_color 00062 // Access : public 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE const LColor& SparkleParticleRenderer:: 00065 get_center_color() const { 00066 return _center_color; 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function : get_edge_color 00071 // Access : public 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE const LColor& SparkleParticleRenderer:: 00074 get_edge_color() const { 00075 return _edge_color; 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function : get_life_scale 00080 // Access : public 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE SparkleParticleRenderer::SparkleParticleLifeScale SparkleParticleRenderer:: 00083 get_life_scale() const { 00084 return _life_scale; 00085 } 00086 00087 //////////////////////////////////////////////////////////////////// 00088 // Function : get_birth_radius 00089 // Access : public 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE PN_stdfloat SparkleParticleRenderer:: 00092 get_birth_radius() const { 00093 return _birth_radius; 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function : get_death_radius 00098 // Access : public 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE PN_stdfloat SparkleParticleRenderer:: 00101 get_death_radius() const { 00102 return _death_radius; 00103 } 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function : get_radius 00107 // Access : public 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE PN_stdfloat SparkleParticleRenderer:: 00110 get_radius(BaseParticle *bp) { 00111 if (_life_scale == SP_NO_SCALE) 00112 return _birth_radius; 00113 else { 00114 PN_stdfloat s_x = CUBIC_T(bp->get_parameterized_age()); 00115 return LERP(s_x, _birth_radius, _death_radius); 00116 } 00117 }