25int ColorBlendAttrib::_attrib_slot;
34 return return_new(attrib);
43make(ColorBlendAttrib::Mode mode) {
47 return return_new(attrib);
56make(ColorBlendAttrib::Mode mode,
57 ColorBlendAttrib::Operand a, ColorBlendAttrib::Operand b,
58 const LColor &color) {
60 return return_new(attrib);
69make(ColorBlendAttrib::Mode mode,
70 ColorBlendAttrib::Operand a, ColorBlendAttrib::Operand b,
71 ColorBlendAttrib::Mode alpha_mode,
72 ColorBlendAttrib::Operand alpha_a, ColorBlendAttrib::Operand alpha_b,
73 const LColor &color) {
75 alpha_mode, alpha_a, alpha_b,
77 return return_new(attrib);
92void ColorBlendAttrib::
93output(ostream &out)
const {
94 out << get_type() <<
":" <<
get_mode();
118int ColorBlendAttrib::
122 if (_mode != ta->_mode) {
123 return (
int)_mode - (int)ta->_mode;
127 return (
int)_a - (int)ta->_a;
131 return (
int)_b - (int)ta->_b;
134 return _color.compare_to(ta->_color);
143size_t ColorBlendAttrib::
144get_hash_impl()
const {
149 hash = _color.add_hash(hash);
180 _color.write_datagram(dg);
195 attrib->fillin(scan, manager);
204void ColorBlendAttrib::
206 RenderAttrib::fillin(scan, manager);
218 if (_a >= O_incoming1_color) {
219 _a = (Operand)(_a + 4);
221 if (_b >= O_incoming1_color) {
222 _b = (Operand)(_b + 4);
231 _color.read_datagram(scan);
233 _involves_constant_color =
236 _involves_color_scale =
245operator << (ostream &out, ColorBlendAttrib::Mode mode) {
247 case ColorBlendAttrib::M_none:
248 return out <<
"none";
250 case ColorBlendAttrib::M_add:
253 case ColorBlendAttrib::M_subtract:
254 return out <<
"subtract";
256 case ColorBlendAttrib::M_inv_subtract:
257 return out <<
"inv_subtract";
259 case ColorBlendAttrib::M_min:
262 case ColorBlendAttrib::M_max:
266 return out <<
"**invalid ColorBlendAttrib::Mode(" << (int)mode <<
")**";
273operator << (ostream &out, ColorBlendAttrib::Operand operand) {
275 case ColorBlendAttrib::O_zero:
276 return out <<
"zero";
278 case ColorBlendAttrib::O_one:
281 case ColorBlendAttrib::O_incoming_color:
282 return out <<
"incoming_color";
284 case ColorBlendAttrib::O_one_minus_incoming_color:
285 return out <<
"one_minus_incoming_color";
287 case ColorBlendAttrib::O_fbuffer_color:
288 return out <<
"fbuffer_color";
290 case ColorBlendAttrib::O_one_minus_fbuffer_color:
291 return out <<
"one_minus_fbuffer_color";
293 case ColorBlendAttrib::O_incoming_alpha:
294 return out <<
"incoming_alpha";
296 case ColorBlendAttrib::O_one_minus_incoming_alpha:
297 return out <<
"one_minus_incoming_alpha";
299 case ColorBlendAttrib::O_fbuffer_alpha:
300 return out <<
"fbuffer_alpha";
302 case ColorBlendAttrib::O_one_minus_fbuffer_alpha:
303 return out <<
"one_minus_fbuffer_alpha";
305 case ColorBlendAttrib::O_constant_color:
306 return out <<
"constant_color";
308 case ColorBlendAttrib::O_one_minus_constant_color:
309 return out <<
"one_minus_constant_color";
311 case ColorBlendAttrib::O_constant_alpha:
312 return out <<
"constant_alpha";
314 case ColorBlendAttrib::O_one_minus_constant_alpha:
315 return out <<
"one_minus_constant_alpha";
317 case ColorBlendAttrib::O_incoming_color_saturate:
318 return out <<
"incoming_color_saturate";
320 case ColorBlendAttrib::O_color_scale:
321 return out <<
"color_scale";
323 case ColorBlendAttrib::O_one_minus_color_scale:
324 return out <<
"one_minus_color_scale";
326 case ColorBlendAttrib::O_alpha_scale:
327 return out <<
"alpha_scale";
329 case ColorBlendAttrib::O_one_minus_alpha_scale:
330 return out <<
"one_minus_alpha_scale";
332 case ColorBlendAttrib::O_incoming1_color:
333 return out <<
"incoming1_color";
335 case ColorBlendAttrib::O_one_minus_incoming1_color:
336 return out <<
"one_minus_incoming1_color";
338 case ColorBlendAttrib::O_incoming1_alpha:
339 return out <<
"incoming1_alpha";
341 case ColorBlendAttrib::O_one_minus_incoming1_alpha:
342 return out <<
"one_minus_incoming1_alpha";
345 return out <<
"**invalid ColorBlendAttrib::Operand(" << (int)operand <<
")**";
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
This specifies how colors are blended into the frame buffer, for special effects.
get_operand_a
Returns the RGB multiplier for the first component.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ColorBlendAttrib.
bool involves_color_scale() const
Returns true if the this attrib uses the color scale attrib, false otherwise.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
get_color
Returns the constant color associated with the attrib.
bool involves_constant_color() const
Returns true if the this attrib uses the constant color, false otherwise.
get_operand_b
Returns the RGB multiplier for the second component.
get_mode
Returns the blending mode for the RGB channels.
A class to retrieve the individual data elements previously stored in a Datagram.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.