23 int RenderModeAttrib::_attrib_slot;
44 make(RenderModeAttrib::Mode mode, PN_stdfloat thickness,
45 bool perspective,
const LColor &wireframe_color) {
47 return return_new(attrib);
62 void RenderModeAttrib::
63 output(std::ostream &out)
const {
64 out << get_type() <<
":";
86 case M_filled_wireframe:
96 out <<
", perspective";
112 int RenderModeAttrib::
116 if (_mode != ta->_mode) {
117 return (
int)_mode - (int)ta->_mode;
119 if (_thickness != ta->_thickness) {
120 return _thickness < ta->_thickness ? -1 : 1;
122 if (_perspective != ta->_perspective) {
123 return (
int)_perspective - (int)ta->_perspective;
125 if (_mode == M_filled_wireframe && _wireframe_color != ta->_wireframe_color) {
126 return _wireframe_color.compare_to(ta->_wireframe_color);
137 size_t RenderModeAttrib::
138 get_hash_impl()
const {
143 if (_mode == M_filled_wireframe) {
144 hash = _wireframe_color.add_hash(hash);
166 if (mode == M_unchanged) {
177 void RenderModeAttrib::
178 register_with_read_factory() {
194 if (_mode == M_filled_wireframe) {
195 _wireframe_color.write_datagram(dg);
211 attrib->fillin(scan, manager);
220 void RenderModeAttrib::
222 RenderAttrib::fillin(scan, manager);
228 if (_mode == M_filled_wireframe) {
229 _wireframe_color.read_datagram(scan);
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...
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 ...
A class to retrieve the individual data elements previously stored in a Datagram.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
int8_t get_int8()
Extracts a signed 8-bit integer.
bool get_bool()
Extracts a boolean value.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
void add_bool(bool value)
Adds a boolean value to the datagram.
void add_int8(int8_t value)
Adds a signed 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.
Specifies how polygons are to be drawn.
get_perspective
Returns the perspective flag.
get_thickness
Returns the line width or point thickness.
get_wireframe_color
Returns the color that is used in M_filled_wireframe mode to distinguish the wireframe from the rest ...
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_mode
Returns the render mode.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
This hash_compare class hashes a float or a double.
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
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.
CPT(RenderAttrib) RenderModeAttrib
Constructs a new RenderModeAttrib object that specifies whether to draw polygons in the normal,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.