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