Panda3D

baseParticle.I

00001 // Filename: baseParticle.I
00002 // Created by:  charles (16Jun00)
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 INLINE void BaseParticle::set_age(PN_stdfloat age) {
00016   _age = age;
00017 }
00018 
00019 INLINE void BaseParticle::set_lifespan(PN_stdfloat lifespan) {
00020   _lifespan = lifespan;
00021 }
00022 
00023 INLINE void BaseParticle::set_alive(bool alive) {
00024   _alive = alive;
00025 }
00026 
00027 INLINE void BaseParticle::set_index(int index) {
00028   _index = index;
00029 }
00030 
00031 INLINE PN_stdfloat BaseParticle::get_age() const {
00032   return _age;
00033 }
00034 
00035 INLINE PN_stdfloat BaseParticle::get_lifespan() const {
00036   return _lifespan;
00037 }
00038 
00039 INLINE bool BaseParticle::get_alive() const {
00040   return _alive;
00041 }
00042 
00043 INLINE int BaseParticle::get_index() const {
00044   return _index;
00045 }
00046 
00047 INLINE PN_stdfloat BaseParticle::get_parameterized_age() const {
00048   if (_lifespan <= 0) return 1.0;
00049   return _age / _lifespan;
00050 }
00051 
00052 INLINE PN_stdfloat BaseParticle::get_parameterized_vel() const {
00053   if (IS_NEARLY_ZERO(get_terminal_velocity())) return 0.0;
00054   return (get_velocity().length()) / get_terminal_velocity();
00055 }
 All Classes Functions Variables Enumerations