17 INLINE TextureAttrib::
19 _next_implicit_sort = 0;
20 _off_all_stages =
false;
21 _sort_seq = UpdateSeq::old();
22 _filtered_seq = UpdateSeq::old();
29 INLINE TextureAttrib::
31 _on_stages(copy._on_stages),
32 _render_stages(copy._render_stages),
33 _render_ff_stages(copy._render_ff_stages),
34 _next_implicit_sort(copy._next_implicit_sort),
35 _off_stages(copy._off_stages),
36 _off_all_stages(copy._off_all_stages),
37 _sort_seq(copy._sort_seq),
53 return (_on_stages.
empty());
62 if (_on_stages.
empty()) {
72 INLINE
int TextureAttrib::
73 get_num_on_stages()
const {
75 return _render_stages.size();
83 nassertr(n >= 0 && n < (
int)_render_stages.size(),
nullptr);
84 return _render_stages[n]->_stage;
91 INLINE
int TextureAttrib::
92 get_num_on_ff_stages()
const {
94 return _render_ff_stages.size();
104 nassertr(n >= 0 && n < (
int)_render_ff_stages.size(),
nullptr);
105 return _render_ff_stages[n]->_stage;
116 nassertr(n >= 0 && n < (
int)_render_ff_stages.size(), -1);
117 return _render_ff_stages[n]->_ff_tc_index;
126 return _on_stages.find(StageNode(stage)) != _on_stages.
end();
135 Stages::const_iterator si;
136 si = _on_stages.find(StageNode(stage));
137 if (si != _on_stages.
end()) {
138 return (*si)._texture;
150 Stages::const_iterator si;
151 si = _on_stages.find(StageNode(stage));
154 return si->_has_sampler ? si->_sampler
155 : si->_texture->get_default_sampler();
163 Stages::const_iterator si;
164 si = _on_stages.find(StageNode(stage));
165 if (si != _on_stages.
end()) {
166 return (*si)._override;
168 nassert_raise(
"Specified TextureStage not included in attrib");
175 INLINE
int TextureAttrib::
176 get_num_off_stages()
const {
177 return _off_stages.
size();
186 nassertr(n >= 0 && n < (
int)_off_stages.
size(),
nullptr);
187 return _off_stages[n]._stage;
196 return _off_stages.find(StageNode(stage)) != _off_stages.
end() ||
206 return _off_all_stages;
215 return _on_stages.
empty() && _off_stages.
empty() && !_off_all_stages;
224 INLINE
void TextureAttrib::
225 check_sorted()
const {
234 INLINE TextureAttrib::StageNode::
235 StageNode(
const TextureStage *stage,
unsigned int implicit_sort,
int override) :
239 _implicit_sort(implicit_sort),
249 INLINE
bool TextureAttrib::CompareTextureStagePriorities::
250 operator () (
const TextureAttrib::StageNode *a,
251 const TextureAttrib::StageNode *b)
const {
252 if (a->_stage->get_priority() != b->_stage->get_priority()) {
253 return a->_stage->get_priority() > b->_stage->get_priority();
255 if (a->_stage->get_sort() != b->_stage->get_sort()) {
256 return a->_stage->get_sort() < b->_stage->get_sort();
258 return a->_implicit_sort < b->_implicit_sort;
265 INLINE
bool TextureAttrib::CompareTextureStageSort::
266 operator () (
const TextureAttrib::StageNode *a,
267 const TextureAttrib::StageNode *b)
const {
268 if (a->_stage->get_sort() != b->_stage->get_sort()) {
269 return a->_stage->get_sort() < b->_stage->get_sort();
271 return a->_implicit_sort < b->_implicit_sort;
278 INLINE
bool TextureAttrib::CompareTextureStagePointer::
279 operator () (
const TextureAttrib::StageNode &a,
280 const TextureAttrib::StageNode &b)
const {
281 return a._stage < b._stage;
bool is_identity() const
Returns true if this is an identity attrib: it does not change the set of stages in use.
static UpdateSeq get_sort_seq()
Returns a global sequence number that is incremented any time any TextureStage in the world changes s...
int get_ff_tc_index(int n) const
For each TextureStage listed in get_on_ff_stage(), this returns a unique index number for the texture...
size_type_0 size() const
Returns the number of elements in the ordered vector.
get_on_stage
Returns the nth stage turned on by the attribute, sorted in render order.
get_off_stage
Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
get_on_sampler
Returns the sampler associated with the indicated stage, or the one associated with its texture if no...
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.
bool empty() const
Returns true if the ordered vector is empty, false otherwise.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
has_on_stage
Returns true if the indicated stage is turned on by the attrib, false otherwise.
Texture * get_texture() const
If the TextureAttrib is not an 'off' TextureAttrib, returns the base-level texture that is associated...
bool has_all_off() const
Returns true if this attrib turns off all stages (although it may also turn some on).
get_on_ff_stage
Returns the nth stage turned on by the attribute, sorted in render order, including only those releva...
bool is_off() const
Returns true if the TextureAttrib is an 'off' TextureAttrib, indicating that it should disable textur...
Represents a set of settings that indicate how a texture is sampled.
static const SamplerState & get_default()
Returns a reference to the global default immutable SamplerState object.
bool has_off_stage(TextureStage *stage) const
Returns true if the indicated stage is turned off by the attrib, false otherwise.
This is a sequence number that increments monotonically.
Defines the properties of a named stage of the multitexture pipeline.
get_on_texture
Returns the texture associated with the indicated stage, or NULL if no texture is associated.
int get_on_stage_override(TextureStage *stage) const
Returns the override value associated with the indicated stage.