Panda3D
baseParticle.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file baseParticle.I
10  * @author charles
11  * @date 2000-06-16
12  */
13 
14 INLINE void BaseParticle::set_age(PN_stdfloat age) {
15  _age = age;
16 }
17 
18 INLINE void BaseParticle::set_lifespan(PN_stdfloat lifespan) {
19  _lifespan = lifespan;
20 }
21 
22 INLINE void BaseParticle::set_alive(bool alive) {
23  _alive = alive;
24 }
25 
26 INLINE void BaseParticle::set_index(int index) {
27  _index = index;
28 }
29 
30 INLINE PN_stdfloat BaseParticle::get_age() const {
31  return _age;
32 }
33 
34 INLINE PN_stdfloat BaseParticle::get_lifespan() const {
35  return _lifespan;
36 }
37 
38 INLINE bool BaseParticle::get_alive() const {
39  return _alive;
40 }
41 
42 INLINE int BaseParticle::get_index() const {
43  return _index;
44 }
45 
46 INLINE PN_stdfloat BaseParticle::get_parameterized_age() const {
47  if (_lifespan <= 0) return 1.0;
48  return _age / _lifespan;
49 }
50 
51 INLINE PN_stdfloat BaseParticle::get_parameterized_vel() const {
52  if (IS_NEARLY_ZERO(get_terminal_velocity())) return 0.0;
53  return (get_velocity().length()) / get_terminal_velocity();
54 }
PN_stdfloat get_terminal_velocity() const
tv query
LVector3 get_velocity() const
Velocity Query per second.