14 #ifndef TEXTURESTAGE_H
15 #define TEXTURESTAGE_H
88 CS_constant_color_scale,
95 CO_one_minus_src_color,
97 CO_one_minus_src_alpha,
100 INLINE
void set_name(
const std::string &name);
101 INLINE
const std::string &get_name()
const;
103 INLINE
void set_sort(
int sort);
104 INLINE
int get_sort()
const;
106 INLINE
void set_priority(
int priority);
107 INLINE
int get_priority()
const;
110 INLINE
void set_texcoord_name(
const std::string &texcoord_name);
115 INLINE
void set_mode(Mode mode);
116 INLINE Mode get_mode()
const;
118 INLINE
bool is_fixed_function()
const;
120 INLINE
void set_color(
const LColor &color);
121 INLINE LColor get_color()
const;
123 INLINE
void set_rgb_scale(
int rgb_scale);
124 INLINE
int get_rgb_scale()
const;
126 INLINE
void set_alpha_scale(
int alpha_scale);
127 INLINE
int get_alpha_scale()
const;
129 INLINE
void set_saved_result(
bool saved_result);
130 INLINE
bool get_saved_result()
const;
132 INLINE
void set_tex_view_offset(
int tex_view_offset);
133 INLINE
int get_tex_view_offset()
const;
135 INLINE
void set_combine_rgb(CombineMode mode,
136 CombineSource source0, CombineOperand operand0);
137 INLINE
void set_combine_rgb(CombineMode mode,
138 CombineSource source0, CombineOperand operand0,
139 CombineSource source1, CombineOperand operand1);
140 INLINE
void set_combine_rgb(CombineMode mode,
141 CombineSource source0, CombineOperand operand0,
142 CombineSource source1, CombineOperand operand1,
143 CombineSource source2, CombineOperand operand2);
144 INLINE CombineMode get_combine_rgb_mode()
const;
145 INLINE
int get_num_combine_rgb_operands()
const;
146 INLINE CombineSource get_combine_rgb_source0()
const;
147 INLINE CombineOperand get_combine_rgb_operand0()
const;
148 INLINE CombineSource get_combine_rgb_source1()
const;
149 INLINE CombineOperand get_combine_rgb_operand1()
const;
150 INLINE CombineSource get_combine_rgb_source2()
const;
151 INLINE CombineOperand get_combine_rgb_operand2()
const;
153 INLINE
void set_combine_alpha(CombineMode mode,
154 CombineSource source0, CombineOperand operand0);
155 INLINE
void set_combine_alpha(CombineMode mode,
156 CombineSource source0, CombineOperand operand0,
157 CombineSource source1, CombineOperand operand1);
158 INLINE
void set_combine_alpha(CombineMode mode,
159 CombineSource source0, CombineOperand operand0,
160 CombineSource source1, CombineOperand operand1,
161 CombineSource source2, CombineOperand operand2);
162 INLINE CombineMode get_combine_alpha_mode()
const;
163 INLINE
int get_num_combine_alpha_operands()
const;
164 INLINE CombineSource get_combine_alpha_source0()
const;
165 INLINE CombineOperand get_combine_alpha_operand0()
const;
166 INLINE CombineSource get_combine_alpha_source1()
const;
167 INLINE CombineOperand get_combine_alpha_operand1()
const;
168 INLINE CombineSource get_combine_alpha_source2()
const;
169 INLINE CombineOperand get_combine_alpha_operand2()
const;
171 INLINE
bool involves_color_scale()
const;
172 INLINE
bool uses_color()
const;
173 INLINE
bool uses_primary_color()
const;
174 INLINE
bool uses_last_saved_result()
const;
176 INLINE
bool operator == (
const TextureStage &other)
const;
177 INLINE
bool operator != (
const TextureStage &other)
const;
178 INLINE
bool operator < (
const TextureStage &other)
const;
182 void write(std::ostream &out)
const;
183 void output(std::ostream &out)
const;
188 MAKE_PROPERTY(name, get_name, set_name);
189 MAKE_PROPERTY(sort, get_sort, set_sort);
190 MAKE_PROPERTY(priority, get_priority, set_priority);
192 MAKE_PROPERTY(texcoord_name, get_texcoord_name, set_texcoord_name);
193 MAKE_PROPERTY(tangent_name, get_tangent_name);
194 MAKE_PROPERTY(binormal_name, get_binormal_name);
196 MAKE_PROPERTY(mode, get_mode, set_mode);
198 MAKE_PROPERTY(color, get_color, set_color);
199 MAKE_PROPERTY(rgb_scale, get_rgb_scale, set_rgb_scale);
200 MAKE_PROPERTY(alpha_scale, get_alpha_scale, set_alpha_scale);
201 MAKE_PROPERTY(saved_result, get_saved_result, set_saved_result);
203 MAKE_PROPERTY(tex_view_offset, get_tex_view_offset, set_tex_view_offset);
205 MAKE_PROPERTY(
default, get_default);
210 INLINE
void mark_used_by_auto_shader()
const;
213 INLINE
void update_color_flags();
215 static int get_expected_num_combine_operands(CombineMode cm);
216 static bool operand_valid_for_rgb(CombineOperand co);
217 static bool operand_valid_for_alpha(CombineOperand co);
228 int _tex_view_offset;
229 bool _involves_color_scale;
231 bool _uses_primary_color;
232 bool _uses_last_saved_result;
234 CombineMode _combine_rgb_mode;
235 int _num_combine_rgb_operands;
236 CombineSource _combine_rgb_source0;
237 CombineOperand _combine_rgb_operand0;
238 CombineSource _combine_rgb_source1;
239 CombineOperand _combine_rgb_operand1;
240 CombineSource _combine_rgb_source2;
241 CombineOperand _combine_rgb_operand2;
243 CombineMode _combine_alpha_mode;
244 int _num_combine_alpha_operands;
245 CombineSource _combine_alpha_source0;
246 CombineOperand _combine_alpha_operand0;
247 CombineSource _combine_alpha_source1;
248 CombineOperand _combine_alpha_operand1;
249 CombineSource _combine_alpha_source2;
250 CombineOperand _combine_alpha_operand2;
255 mutable bool _used_by_auto_shader;
259 static void register_with_read_factory();
272 static void init_type() {
273 TypedWritableReferenceCount::init_type();
275 TypedWritableReferenceCount::get_class_type());
278 return get_class_type();
280 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
286 INLINE std::ostream &operator << (std::ostream &out,
const TextureStage &ts);
288 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, TextureStage::Mode mode);
289 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, TextureStage::CombineMode cm);
290 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, TextureStage::CombineSource cs);
291 EXPCL_PANDA_GOBJ std::ostream &operator << (std::ostream &out, TextureStage::CombineOperand co);