Panda3D
Loading...
Searching...
No Matches
transformBlendTable.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 transformBlendTable.I
10 * @author drose
11 * @date 2005-03-24
12 */
13
14/**
15 * Returns the total number of different blend combinations in the table.
16 */
17INLINE size_t TransformBlendTable::
18get_num_blends() const {
19 return _blends.size();
20}
21
22/**
23 * Returns the nth blend in the table.
24 */
26get_blend(size_t n) const {
27 nassertr(n < _blends.size(), _blends[0]);
28 return _blends[n];
29}
30
31/**
32 * Returns a counter which is guaranteed to increment at least when any
33 * TransformBlends within the table have changed.
34 */
36get_modified(Thread *current_thread) const {
37 CDLockedReader cdata(_cycler);
38 if (cdata->_global_modified != VertexTransform::get_global_modified(current_thread)) {
39 CDWriter cdataw(((TransformBlendTable *)this)->_cycler, cdata, false);
40 ((TransformBlendTable *)this)->recompute_modified(cdataw, current_thread);
41 return cdataw->_modified;
42 } else {
43 return cdata->_modified;
44 }
45}
46
47/**
48 * Returns the number of unique VertexTransform objects represented in the
49 * table. This will correspond to the size of the TransformTable object that
50 * would represent the same table. This is also the same limit reflected by
51 * GraphicsStateGuardian::get_max_vertex_transform_indices().
52 */
53INLINE int TransformBlendTable::
54get_num_transforms() const {
55 consider_rebuild_index();
56
57 if (_num_transforms < 0) {
58 // Even if our index is otherwise accurate, we might have recently added a
59 // blend or two, which would necessitate recomputing this value--which
60 // means we need to rebuild the index.
61 ((TransformBlendTable *)this)->rebuild_index();
62 }
63
64 return _num_transforms;
65}
66
67/**
68 * Returns the maximum number of unique VertexTransform objects that are
69 * applied to any one vertex simultaneously. This is the same limit reflected
70 * by GraphicsStateGuardian::get_max_vertex_transforms().
71 */
72INLINE int TransformBlendTable::
74 consider_rebuild_index();
75 return _max_simultaneous_transforms;
76}
77
78/**
79 * Specifies the subset of rows (vertices) in the associated GeomVertexData
80 * that this TransformBlendTable actually affects.
81 */
82INLINE void TransformBlendTable::
83set_rows(const SparseArray &rows) {
84 _rows = rows;
85}
86
87/**
88 * Returns the subset of rows (vertices) in the associated GeomVertexData that
89 * this TransformBlendTable actually affects.
90 */
92get_rows() const {
93 return _rows;
94}
95
96/**
97 * Returns a modifiable reference to the SparseArray that specifies the subset
98 * of rows (vertices) in the associated GeomVertexData that this
99 * TransformBlendTable actually affects.
100 */
102modify_rows() {
103 return _rows;
104}
105
106/**
107 * Calls rebuild_index() if the index needs to be rebuilt.
108 */
109INLINE void TransformBlendTable::
110consider_rebuild_index() const {
111 if (_blend_index.empty()) {
112 ((TransformBlendTable *)this)->rebuild_index();
113 }
114}
115
116/**
117 *
118 */
119INLINE TransformBlendTable::CData::
120CData() {
121}
122
123/**
124 *
125 */
126INLINE TransformBlendTable::CData::
127CData(const TransformBlendTable::CData &copy) :
128 _modified(copy._modified),
129 _global_modified(copy._global_modified)
130{
131}
This class records a set of integers, where each integer is either present or not present in the set.
Definition sparseArray.h:43
A thread; that is, a lightweight process.
Definition thread.h:46
This structure collects together the different combinations of transforms and blend amounts used by a...
get_max_simultaneous_transforms
Returns the maximum number of unique VertexTransform objects that are applied to any one vertex simul...
get_rows
Returns the subset of rows (vertices) in the associated GeomVertexData that this TransformBlendTable ...
set_rows
Specifies the subset of rows (vertices) in the associated GeomVertexData that this TransformBlendTabl...
get_num_blends
Returns the total number of different blend combinations in the table.
get_modified
Returns a counter which is guaranteed to increment at least when any TransformBlends within the table...
get_blend
Returns the nth blend in the table.
SparseArray & modify_rows()
Returns a modifiable reference to the SparseArray that specifies the subset of rows (vertices) in the...
get_num_transforms
Returns the number of unique VertexTransform objects represented in the table.
This defines a single entry in a TransformBlendTable.
This is a sequence number that increments monotonically.
Definition updateSeq.h:37
static UpdateSeq get_global_modified(Thread *current_thread)
Returns the currently highest VertexTransform::get_modified() value in the world.