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