00001 // Filename: baseParticleRenderer.I 00002 // Created by: charles (20Jun00) 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 : get_render_node 00021 // Class : Public 00022 // Description : Query the geomnode pointer 00023 //////////////////////////////////////////////////////////////////// 00024 INLINE GeomNode *BaseParticleRenderer:: 00025 get_render_node(void) const { 00026 return _render_node; 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function : set_alpha_mode 00031 // Access : public 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE void BaseParticleRenderer:: 00034 set_alpha_mode(BaseParticleRenderer::ParticleRendererAlphaMode am) { 00035 update_alpha_mode(am); 00036 init_geoms(); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function : get_alpha_mode 00041 // Access : public 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE BaseParticleRenderer::ParticleRendererAlphaMode BaseParticleRenderer:: 00044 get_alpha_mode(void) const { 00045 return _alpha_mode; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function : set_user_alpha 00050 // Access : public 00051 // Description : sets alpha for "user" alpha mode 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE void BaseParticleRenderer:: 00054 set_user_alpha(float ua) { 00055 _user_alpha = ua; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function : get_user_alpha 00060 // Access : public 00061 // Description : gets alpha for "user" alpha mode 00062 //////////////////////////////////////////////////////////////////// 00063 INLINE float BaseParticleRenderer:: 00064 get_user_alpha(void) const { 00065 return _user_alpha; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function : get_cur_alpha 00070 // Access : public 00071 // Description : gets current alpha for a particle 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE float BaseParticleRenderer:: 00074 get_cur_alpha(BaseParticle* bp) { 00075 switch(_alpha_mode) { 00076 case PR_ALPHA_OUT: 00077 return 1.0f - bp->get_parameterized_age(); 00078 00079 case PR_ALPHA_IN: 00080 return bp->get_parameterized_age(); 00081 00082 case PR_ALPHA_USER: 00083 return _user_alpha; 00084 00085 default: 00086 return 1.0; // should not get here 00087 } 00088 }