19 _next_implicit_sort = 0;
20 _off_all_stages =
false;
21 _sort_seq = UpdateSeq::old();
22 _filtered_seq = UpdateSeq::old();
31 _on_stages(copy._on_stages),
34 _next_implicit_sort(copy._next_implicit_sort),
35 _off_stages(copy._off_stages),
36 _off_all_stages(copy._off_all_stages),
53 return (_on_stages.
empty());
62 if (_on_stages.
empty()) {
75 return _render_stages.size();
83 nassertr(n >= 0 && n < (
int)_render_stages.size(),
nullptr);
84 return _render_stages[n]->_stage;
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");
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;
224INLINE
void TextureAttrib::
225check_sorted()
const {
234INLINE TextureAttrib::StageNode::
235StageNode(
const TextureStage *stage,
unsigned int implicit_sort,
int override) :
239 _implicit_sort(implicit_sort),
249INLINE
bool TextureAttrib::CompareTextureStagePriorities::
250operator () (
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;
265INLINE
bool TextureAttrib::CompareTextureStageSort::
266operator () (
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;
278INLINE
bool TextureAttrib::CompareTextureStagePointer::
279operator () (
const TextureAttrib::StageNode &a,
280 const TextureAttrib::StageNode &b)
const {
281 return a._stage < b._stage;
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.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
get_num_on_ff_stages
Returns the number of on-stages that are relevant to the classic fixed function pipeline.
get_num_on_stages
Returns the number of stages that are turned on by the attribute.
bool is_identity() const
Returns true if this is an identity attrib: it does not change the set of stages in use.
has_on_stage
Returns true if the indicated stage is turned on by the attrib, false otherwise.
bool has_off_stage(TextureStage *stage) const
Returns true if the indicated stage is turned off 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...
get_on_texture
Returns the texture associated with the indicated stage, or NULL if no texture is associated.
get_off_stage
Returns the nth stage turned off by the attribute, sorted in arbitrary (pointer) order.
bool is_off() const
Returns true if the TextureAttrib is an 'off' TextureAttrib, indicating that it should disable textur...
get_on_stage
Returns the nth stage turned on by the attribute, sorted in render order.
get_on_sampler
Returns the sampler associated with the indicated stage, or the one associated with its texture if no...
get_on_ff_stage
Returns the nth stage turned on by the attribute, sorted in render order, including only those releva...
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...
bool has_all_off() const
Returns true if this attrib turns off all stages (although it may also turn some on).
get_num_off_stages
Returns the number of stages that are turned off by the attribute.
int get_on_stage_override(TextureStage *stage) const
Returns the override value associated with the indicated stage.
Defines the properties of a named stage of the multitexture pipeline.
static UpdateSeq get_sort_seq()
Returns a global sequence number that is incremented any time any TextureStage in the world changes s...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
This is a sequence number that increments monotonically.
size_type_0 size() const
Returns the number of elements in the ordered vector.
bool empty() const
Returns true if the ordered vector is empty, false otherwise.
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.