23 TextureStageCollection::
24 TextureStageCollection() {
30 TextureStageCollection::
32 _texture_stages(copy._texture_stages)
39 void TextureStageCollection::
41 _texture_stages = copy._texture_stages;
53 if (_texture_stages.get_ref_count() > 1) {
54 TextureStages old_texture_stages = _texture_stages;
55 _texture_stages = TextureStages::empty_array(0);
56 _texture_stages.v() = old_texture_stages.v();
59 _texture_stages.push_back(node_texture_stage);
69 int texture_stage_index = -1;
70 for (
int i = 0; texture_stage_index == -1 && i < (int)_texture_stages.size(); i++) {
71 if (_texture_stages[i] == node_texture_stage) {
72 texture_stage_index = i;
76 if (texture_stage_index == -1) {
85 if (_texture_stages.get_ref_count() > 1) {
86 TextureStages old_texture_stages = _texture_stages;
87 _texture_stages = TextureStages::empty_array(0);
88 _texture_stages.v() = old_texture_stages.v();
91 _texture_stages.erase(_texture_stages.begin() + texture_stage_index);
103 for (
int i = 0; i < other_num_texture_stages; i++) {
115 TextureStages new_texture_stages;
117 for (
int i = 0; i < num_texture_stages; i++) {
120 new_texture_stages.push_back(texture_stage);
123 _texture_stages = new_texture_stages;
133 TextureStages new_texture_stages;
136 for (
int i = 0; i < num_texture_stages; i++) {
138 bool duplicated =
false;
140 for (
int j = 0; j < i && !duplicated; j++) {
145 new_texture_stages.push_back(texture_stage);
149 _texture_stages = new_texture_stages;
171 _texture_stages.clear();
181 for (
int i = 0; i < num_texture_stages; i++) {
183 if (texture_stage->
get_name() == name) {
184 return texture_stage;
193 int TextureStageCollection::
194 get_num_texture_stages()
const {
195 return _texture_stages.size();
203 nassertr(index >= 0 && index < (
int)_texture_stages.size(),
nullptr);
205 return _texture_stages[index];
214 nassertr(index >= 0 && index < (
int)_texture_stages.size(),
nullptr);
216 return _texture_stages[index];
225 return _texture_stages.size();
234 std::sort(_texture_stages.begin(), _texture_stages.end(),
235 CompareTextureStageSort());
245 out <<
"1 TextureStage";
256 write(std::ostream &out,
int indent_level)
const {
void add_texture_stage(TextureStage *node_texture_stage)
Adds a new TextureStage to the collection.
void clear()
Removes all TextureStages from the collection.
get_name
Returns the name of this texture stage.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void remove_duplicate_texture_stages()
Removes any duplicate entries of the same TextureStages on this collection.
void add_texture_stages_from(const TextureStageCollection &other)
Adds all the TextureStages indicated in the other collection to this texture_stage.
bool remove_texture_stage(TextureStage *node_texture_stage)
Removes the indicated TextureStage from the collection.
void remove_texture_stages_from(const TextureStageCollection &other)
Removes from this collection all of the TextureStages listed in the other collection.
TextureStage * find_texture_stage(const std::string &name) const
Returns the texture_stage in the collection with the indicated name, if any, or NULL if no texture_st...
get_num_texture_stages
Returns the number of TextureStages in the collection.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void output(std::ostream &out) const
Writes a brief one-line description of the TextureStageCollection to the indicated output stream.
void write(std::ostream &out, int indent_level=0) const
Writes a complete multi-line description of the TextureStageCollection to the indicated output stream...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TextureStage * operator [](int index) const
Returns the nth TextureStage in the collection.
void sort()
Sorts the TextureStages in this collection into order by TextureStage::sort(), from lowest to highest...
bool has_texture_stage(TextureStage *texture_stage) const
Returns true if the indicated TextureStage appears in this collection, false otherwise.
get_texture_stage
Returns the nth TextureStage in the collection.
Defines the properties of a named stage of the multitexture pipeline.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int size() const
Returns the number of texture stages in the collection.