22 INLINE TextureAttrib::
24 _next_implicit_sort = 0;
25 _off_all_stages =
false;
37 INLINE TextureAttrib::
39 _on_stages(copy._on_stages),
40 _render_stages(copy._render_stages),
41 _render_ff_stages(copy._render_ff_stages),
42 _next_implicit_sort(copy._next_implicit_sort),
43 _off_stages(copy._off_stages),
44 _off_all_stages(copy._off_all_stages),
45 _sort_seq(copy._sort_seq),
65 return (_on_stages.
empty());
77 if (_on_stages.
empty()) {
93 return _render_stages.size();
104 nassertr(n >= 0 && n < (
int)_render_stages.size(), (
TextureStage *)NULL);
105 return _render_stages[n]->_stage;
118 return _render_ff_stages.size();
131 nassertr(n >= 0 && n < (
int)_render_ff_stages.size(), (
TextureStage *)NULL);
132 return _render_ff_stages[n]->_stage;
147 nassertr(n >= 0 && n < (
int)_render_ff_stages.size(), -1);
148 return _render_ff_stages[n]->_ff_tc_index;
159 return _on_stages.find(StageNode(stage)) != _on_stages.
end();
170 Stages::const_iterator si;
171 si = _on_stages.find(StageNode(stage));
172 if (si != _on_stages.
end()) {
173 return (*si)._texture;
188 Stages::const_iterator si;
189 si = _on_stages.find(StageNode(stage));
192 return si->_has_sampler ? si->_sampler
193 : si->_texture->get_default_sampler();
204 Stages::const_iterator si;
205 si = _on_stages.find(StageNode(stage));
206 if (si != _on_stages.
end()) {
207 return (*si)._override;
209 nassert_raise(
"Specified TextureStage not included in attrib");
221 return _off_stages.
size();
233 return _off_stages[n]._stage;
244 return _off_stages.find(StageNode(stage)) != _off_stages.
end() ||
256 return _off_all_stages;
267 return _on_stages.
empty() && _off_stages.
empty() && !_off_all_stages;
280 INLINE
void TextureAttrib::
281 check_sorted()
const {
292 INLINE TextureAttrib::StageNode::
293 StageNode(
const TextureStage *stage,
unsigned int implicit_sort,
int override) :
297 _implicit_sort(implicit_sort),
310 INLINE
bool TextureAttrib::CompareTextureStagePriorities::
311 operator () (
const TextureAttrib::StageNode *a,
312 const TextureAttrib::StageNode *b)
const {
313 if (a->_stage->get_priority() != b->_stage->get_priority()) {
314 return a->_stage->get_priority() > b->_stage->get_priority();
316 if (a->_stage->get_sort() != b->_stage->get_sort()) {
317 return a->_stage->get_sort() < b->_stage->get_sort();
319 return a->_implicit_sort < b->_implicit_sort;
328 INLINE
bool TextureAttrib::CompareTextureStageSort::
329 operator () (
const TextureAttrib::StageNode *a,
330 const TextureAttrib::StageNode *b)
const {
331 if (a->_stage->get_sort() != b->_stage->get_sort()) {
332 return a->_stage->get_sort() < b->_stage->get_sort();
334 return a->_implicit_sort < b->_implicit_sort;
343 INLINE
bool TextureAttrib::CompareTextureStagePointer::
344 operator () (
const TextureAttrib::StageNode &a,
345 const TextureAttrib::StageNode &b)
const {
346 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...
TextureStage * get_off_stage(int n) const
Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.
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.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
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...
const SamplerState & get_on_sampler(TextureStage *stage) const
Returns the sampler associated with the indicated stage, or the one associated with its texture if no...
Texture * get_on_texture(TextureStage *stage) const
Returns the texture associated with the indicated stage, or NULL if no texture is associated...
int get_num_on_ff_stages() const
Returns the number of on-stages that are relevant to the classic fixed function pipeline.
int get_num_off_stages() const
Returns the number of stages that are turned off by the attribute.
bool has_on_stage(TextureStage *stage) const
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...
TextureStage * get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
bool has_all_off() const
Returns true if this attrib turns off all stages (although it may also turn some on).
bool is_off() const
Returns true if the TextureAttrib is an 'off' TextureAttrib, indicating that it should disable textur...
static UpdateSeq old()
Returns an UpdateSeq in the 'old' state.
Represents a set of settings that indicate how a texture is sampled.
TextureStage * get_on_ff_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order, including only those releva...
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. ...
int get_num_on_stages() const
Returns the number of stages that are turned on by the attribute.
This is a sequence number that increments monotonically.
Defines the properties of a named stage of the multitexture pipeline.
int get_on_stage_override(TextureStage *stage) const
Returns the override value associated with the indicated stage.