Panda3D
animPreloadTable.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 animPreloadTable.I
10  * @author drose
11  * @date 2008-08-05
12  */
13 
14 /**
15  *
16  */
17 INLINE AnimPreloadTable::AnimRecord::
18 AnimRecord() {
19 }
20 
21 /**
22  *
23  */
24 INLINE bool AnimPreloadTable::AnimRecord::
25 operator < (const AnimRecord &other) const {
26  return _basename < other._basename;
27 }
28 
29 /**
30  * Returns the basename stored for the nth animation record. See find_anim().
31  */
32 INLINE std::string AnimPreloadTable::
33 get_basename(int n) const {
34  nassertr(n >= 0 && n < (int)_anims.size(), std::string());
35  consider_sort();
36  return _anims[n]._basename;
37 }
38 
39 /**
40  * Returns the frame rate stored for the nth animation record.
41  */
42 INLINE PN_stdfloat AnimPreloadTable::
43 get_base_frame_rate(int n) const {
44  nassertr(n >= 0 && n < (int)_anims.size(), 0.0f);
45  consider_sort();
46  return _anims[n]._base_frame_rate;
47 }
48 
49 /**
50  * Returns the number of frames stored for the nth animation record.
51  */
52 INLINE int AnimPreloadTable::
53 get_num_frames(int n) const {
54  nassertr(n >= 0 && n < (int)_anims.size(), 0);
55  consider_sort();
56  return _anims[n]._num_frames;
57 }
58 
59 /**
60  * Ensures the table is kept in alphabetical order by basename.
61  */
62 INLINE void AnimPreloadTable::
63 consider_sort() const {
64  if (_needs_sort) {
65  ((AnimPreloadTable *)this)->_anims.sort();
66  ((AnimPreloadTable *)this)->_needs_sort = false;
67  }
68 }
This table records data about a list of animations for a particular model, such as number of frames a...
size_type_0 size() const
Returns the number of elements in the ordered vector.
std::string get_basename(int n) const
Returns the basename stored for the nth animation record.
PN_stdfloat get_base_frame_rate(int n) const
Returns the frame rate stored for the nth animation record.
int get_num_frames(int n) const
Returns the number of frames stored for the nth animation record.