15 #include "renderModeAttrib.h"
16 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
21 #include "datagramIterator.h"
24 int RenderModeAttrib::_attrib_slot;
54 bool perspective, const
LColor &wireframe_color) {
56 return return_new(attrib);
76 void RenderModeAttrib::
77 output(ostream &out)
const {
78 out << get_type() <<
":";
100 case M_filled_wireframe:
110 out <<
", perspective";
129 int RenderModeAttrib::
132 DCAST_INTO_R(ta, other, 0);
133 if (_mode != ta->_mode) {
134 return (
int)_mode - (int)ta->_mode;
136 if (_thickness != ta->_thickness) {
137 return _thickness < ta->_thickness ? -1 : 1;
139 if (_perspective != ta->_perspective) {
140 return (
int)_perspective - (int)ta->_perspective;
142 if (_mode == M_filled_wireframe && _wireframe_color != ta->_wireframe_color) {
143 return _wireframe_color.
compare_to(ta->_wireframe_color);
158 size_t RenderModeAttrib::
159 get_hash_impl()
const {
164 if (_mode == M_filled_wireframe) {
165 hash = _wireframe_color.
add_hash(hash);
190 DCAST_INTO_R(ta, other, 0);
194 if (mode == M_unchanged) {
227 if (_mode == M_filled_wireframe) {
246 parse_params(params, scan, manager);
247 attrib->fillin(scan, manager);
259 void RenderModeAttrib::
261 RenderAttrib::fillin(scan, manager);
267 if (_mode == M_filled_wireframe) {
int compare_to(const LVecBase4f &other) const
This flavor of compare_to uses a default threshold value based on the numeric type.
PN_int8 get_int8()
Extracts a signed 8-bit integer.
bool get_bool()
Extracts a boolean value.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
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...
void add_int8(PN_int8 value)
Adds a signed 8-bit integer to the datagram.
Base class for objects that can be written to and read from Bam files.
bool get_perspective() const
Returns the perspective flag.
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 fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
This hash_compare class hashes a float or a double.
void add_bool(bool value)
Adds a boolean value 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.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
const LColor & get_wireframe_color() const
Returns the color that is used in M_filled_wireframe mode to distinguish the wireframe from the rest ...
void read_datagram(DatagramIterator &source)
Reads the vector from the Datagram using get_stdfloat().
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
Mode get_mode() const
Returns the render mode.
This is the base class for all three-component vectors and points.
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
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 RenderModeAttrib.
Specifies how polygons are to be drawn.
PN_stdfloat get_thickness() const
Returns the line width or point thickness.
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 ...
size_t add_hash(size_t hash) const
Adds the vector into the running hash.