15 #include "colorAttrib.h" 16 #include "graphicsStateGuardianBase.h" 18 #include "bamReader.h" 19 #include "bamWriter.h" 21 #include "datagramIterator.h" 24 int ColorAttrib::_attrib_slot;
41 _vertex = return_new(attrib);
54 return return_new(attrib);
69 _off = return_new(attrib);
91 output(ostream &out)
const {
92 out << get_type() <<
":";
126 DCAST_INTO_R(ta, other, 0);
127 if (_type != ta->_type) {
128 return (
int)_type - (int)ta->_type;
130 if (_type == T_flat) {
147 get_hash_impl()
const {
150 if (_type == T_flat) {
162 get_auto_shader_attrib_impl(
const RenderState *state)
const {
168 return return_new(attrib);
182 _color[0] = cfloor(_color[0] * 1000.0f + 0.5f) * 0.001f;
183 _color[1] = cfloor(_color[1] * 1000.0f + 0.5f) * 0.001f;
184 _color[2] = cfloor(_color[2] * 1000.0f + 0.5f) * 0.001f;
185 _color[3] = cfloor(_color[3] * 1000.0f + 0.5f) * 0.001f;
189 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
193 _color.set(0.0f, 0.0f, 0.0f, 0.0f);
237 parse_params(params, scan, manager);
238 attrib->fillin(scan, manager);
252 RenderAttrib::fillin(scan, manager);
PN_int8 get_int8()
Extracts a signed 8-bit integer.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
const LColor & get_color() const
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void add_int8(PN_int8 value)
Adds a signed 8-bit integer to the datagram.
size_t add_hash(size_t hash) const
Adds the vector into the running hash.
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 ...
Type get_color_type() const
Returns the type of color specified by this ColorAttrib.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
int compare_to(const LVecBase4f &other) const
This flavor of compare_to uses a default threshold value based on the numeric type.
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.
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().
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ColorAttrib.
Indicates what color should be applied to renderable geometry.
A class to retrieve the individual data elements previously stored in a Datagram. ...
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 ...
static const LVecBase4f & zero()
Returns a zero-length vector.