15 #include "cullFaceAttrib.h"
16 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
21 #include "datagramIterator.h"
24 int CullFaceAttrib::_attrib_slot;
43 return return_new(attrib);
58 return return_new(attrib);
85 case M_cull_clockwise:
86 case M_cull_unchanged:
87 return M_cull_counter_clockwise;
89 case M_cull_counter_clockwise:
90 return M_cull_clockwise;
98 case M_cull_clockwise:
99 case M_cull_unchanged:
100 return M_cull_clockwise;
102 case M_cull_counter_clockwise:
103 return M_cull_counter_clockwise;
118 void CullFaceAttrib::
119 output(ostream &out)
const {
120 out << get_type() <<
":";
125 case M_cull_clockwise:
126 out <<
"cull_clockwise";
128 case M_cull_counter_clockwise:
129 out <<
"cull_counter_clockwise";
131 case M_cull_unchanged:
132 out <<
"cull_unchanged";
158 DCAST_INTO_R(ta, other, 0);
159 if (_mode != ta->_mode) {
160 return (
int)_mode - (int)ta->_mode;
162 return (
int)_reverse - (int)ta->_reverse;
175 size_t CullFaceAttrib::
176 get_hash_impl()
const {
203 DCAST_INTO_R(ta, other, 0);
205 if (!_reverse && ta->_mode != M_cull_unchanged) {
214 if (ta->_mode != M_cull_unchanged) {
217 bool reverse = (_reverse && !ta->_reverse) || (!_reverse && ta->_reverse);
220 return return_new(attrib);
235 DCAST_INTO_R(ta, other, 0);
240 if (_reverse && ta->_mode != M_cull_unchanged) {
245 if (ta->_mode != M_cull_unchanged) {
248 bool reverse = (!_reverse && !ta->_reverse) || (_reverse && ta->_reverse);
251 return return_new(attrib);
293 parse_params(params, scan, manager);
294 attrib->fillin(scan, manager);
306 void CullFaceAttrib::
308 RenderAttrib::fillin(scan, manager);
PN_int8 get_int8()
Extracts a signed 8-bit integer.
bool get_bool()
Extracts a boolean value.
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.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Indicates which faces should be culled based on their vertex ordering.
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
Mode get_effective_mode() const
Returns the effective culling mode.
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.
bool get_reverse() const
Returns the 'reverse' flag.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CullFaceAttrib.
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)
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.
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. ...
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 ...
Mode get_actual_mode() const
Returns the actual culling mode, without considering the effects of the reverse flag.