23 int ColorAttrib::_attrib_slot;
33 if (_vertex !=
nullptr) {
37 _vertex = return_new(attrib);
46 make_flat(
const LColor &color) {
48 return return_new(attrib);
57 if (_off !=
nullptr) {
61 _off = return_new(attrib);
78 output(std::ostream &out)
const {
79 out << get_type() <<
":";
110 if (_type != ta->_type) {
111 return (
int)_type - (int)ta->_type;
113 if (_type == T_flat) {
114 return _color.compare_to(ta->_color);
126 get_hash_impl()
const {
129 if (_type == T_flat) {
130 hash = _color.add_hash(hash);
143 _color[0] = cfloor(_color[0] * 1024.0f + 0.5f) / 1024.0f;
144 _color[1] = cfloor(_color[1] * 1024.0f + 0.5f) / 1024.0f;
145 _color[2] = cfloor(_color[2] * 1024.0f + 0.5f) / 1024.0f;
146 _color[3] = cfloor(_color[3] * 1024.0f + 0.5f) / 1024.0f;
150 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
154 _color.set(0.0f, 0.0f, 0.0f, 0.0f);
176 _color.write_datagram(dg);
191 attrib->fillin(scan, manager);
202 RenderAttrib::fillin(scan, manager);
205 _color.read_datagram(scan);
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
get_color
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
void add_int8(int8_t value)
Adds a signed 8-bit integer to the datagram.
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.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
int8_t get_int8()
Extracts a signed 8-bit integer.
CPT(RenderAttrib) ColorAttrib CPT(RenderAttrib) ColorAttrib CPT(RenderAttrib) ColorAttrib
Constructs a new ColorAttrib object that indicates geometry should be rendered according to its own v...
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 ...
get_color_type
Returns the type of color specified by this ColorAttrib.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.