15 #include "colorBlendAttrib.h"
16 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
21 #include "datagramIterator.h"
24 int ColorBlendAttrib::_attrib_slot;
36 return return_new(attrib);
50 return return_new(attrib);
65 return return_new(attrib);
85 void ColorBlendAttrib::
86 output(ostream &out)
const {
87 out << get_type() <<
":" <<
get_mode();
114 int ColorBlendAttrib::
117 DCAST_INTO_R(ta, other, 0);
119 if (_mode != ta->_mode) {
120 return (
int)_mode - (int)ta->_mode;
124 return (
int)_a - (int)ta->_a;
128 return (
int)_b - (int)ta->_b;
144 size_t ColorBlendAttrib::
145 get_hash_impl()
const {
161 get_auto_shader_attrib_impl(const
RenderState *state)
const {
171 void ColorBlendAttrib::
172 register_with_read_factory() {
206 parse_params(params, scan, manager);
207 attrib->fillin(scan, manager);
219 void ColorBlendAttrib::
221 RenderAttrib::fillin(scan, manager);
237 operator << (ostream &out, ColorBlendAttrib::Mode mode) {
239 case ColorBlendAttrib::M_none:
240 return out <<
"none";
242 case ColorBlendAttrib::M_add:
245 case ColorBlendAttrib::M_subtract:
246 return out <<
"subtract";
248 case ColorBlendAttrib::M_inv_subtract:
249 return out <<
"inv_subtract";
251 case ColorBlendAttrib::M_min:
254 case ColorBlendAttrib::M_max:
258 return out <<
"**invalid ColorBlendAttrib::Mode(" << (int)mode <<
")**";
266 operator << (ostream &out, ColorBlendAttrib::Operand operand) {
268 case ColorBlendAttrib::O_zero:
269 return out <<
"zero";
271 case ColorBlendAttrib::O_one:
274 case ColorBlendAttrib::O_incoming_color:
275 return out <<
"incomfing_color";
277 case ColorBlendAttrib::O_one_minus_incoming_color:
278 return out <<
"one_minus_incoming_color";
280 case ColorBlendAttrib::O_fbuffer_color:
281 return out <<
"fbuffer_color";
283 case ColorBlendAttrib::O_one_minus_fbuffer_color:
284 return out <<
"one_minus_fbuffer_color";
286 case ColorBlendAttrib::O_incoming_alpha:
287 return out <<
"incoming_alpha";
289 case ColorBlendAttrib::O_one_minus_incoming_alpha:
290 return out <<
"one_minus_incoming_alpha";
292 case ColorBlendAttrib::O_fbuffer_alpha:
293 return out <<
"fbuffer_alpha";
295 case ColorBlendAttrib::O_one_minus_fbuffer_alpha:
296 return out <<
"one_minus_fbuffer_alpha";
298 case ColorBlendAttrib::O_constant_color:
299 return out <<
"constant_color";
301 case ColorBlendAttrib::O_one_minus_constant_color:
302 return out <<
"one_minus_constant_color";
304 case ColorBlendAttrib::O_constant_alpha:
305 return out <<
"constant_alpha";
307 case ColorBlendAttrib::O_one_minus_constant_alpha:
308 return out <<
"one_minus_constant_alpha";
310 case ColorBlendAttrib::O_incoming_color_saturate:
311 return out <<
"incoming_color_saturate";
313 case ColorBlendAttrib::O_color_scale:
314 return out <<
"color_scale";
316 case ColorBlendAttrib::O_one_minus_color_scale:
317 return out <<
"one_minus_color_scale";
319 case ColorBlendAttrib::O_alpha_scale:
320 return out <<
"alpha_scale";
322 case ColorBlendAttrib::O_one_minus_alpha_scale:
323 return out <<
"one_minus_alpha_scale";
326 return out <<
"**invalid ColorBlendAttrib::Operand(" << (int)operand <<
")**";
int compare_to(const LVecBase4f &other) const
This flavor of compare_to uses a default threshold value based on the numeric type.
Mode get_mode() const
Returns the colorBlend mode.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Base class for objects that can be written to and read from Bam files.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
bool involves_constant_color() const
Returns true if the this attrib uses the constant color, 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.
LColor get_color() const
Returns the constant color associated with the attrib.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void read_datagram(DatagramIterator &source)
Reads the vector from the Datagram using get_stdfloat().
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the base class for all three-component vectors and points.
void write_datagram(Datagram &destination) const
Writes the vector to the Datagram using add_stdfloat().
This specifies how colors are blended into the frame buffer, for special effects. ...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
A class to retrieve the individual data elements previously stored in a Datagram. ...
Operand get_operand_b() const
Returns the multiplier for the second component.
bool involves_color_scale() const
Returns true if the this attrib uses the color scale attrib, false otherwise.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Operand get_operand_a() const
Returns the multiplier for the first component.
size_t add_hash(size_t hash) const
Adds the vector into the running hash.
static const LVecBase4f & zero()
Returns a zero-length vector.