15 #include "scissorAttrib.h"
16 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
21 #include "datagramIterator.h"
24 int ScissorAttrib::_attrib_slot;
39 _frame[0] = max(min(_frame[0], (PN_stdfloat)1.0), (PN_stdfloat)0.0);
40 _frame[1] = max(min(_frame[1], (PN_stdfloat)1.0), _frame[0]);
41 _frame[2] = max(min(_frame[2], (PN_stdfloat)1.0), (PN_stdfloat)0.0);
42 _frame[3] = max(min(_frame[3], (PN_stdfloat)1.0), _frame[2]);
53 if (_off_attrib != NULL) {
58 _off_attrib = return_new(attrib);
73 return return_new(attrib);
95 output(ostream &out)
const {
96 out << get_type() <<
":[" << _frame <<
"]";
117 DCAST_INTO_R(ta, other, 0);
119 if (!_off && !ta->_off) {
123 if (_off && !ta->_off) {
127 if (!_off && ta->_off) {
144 size_t ScissorAttrib::
145 get_hash_impl()
const {
177 DCAST_INTO_R(ta, other, 0);
183 LVecBase4 new_frame(max(ta->_frame[0], _frame[0]),
184 min(ta->_frame[1], _frame[1]),
185 max(ta->_frame[2], _frame[2]),
186 min(ta->_frame[3], _frame[3]));
189 return return_new(attrib);
231 parse_params(params, scan, manager);
232 attrib->fillin(scan, manager);
246 RenderAttrib::fillin(scan, manager);
int compare_to(const LVecBase4f &other) const
This flavor of compare_to uses a default threshold value based on the numeric type.
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...
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 ...
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 void register_with_read_factory()
Tells the BamReader how to create objects of type ScissorAttrib.
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...
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.
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.
This restricts rendering to within a rectangular region of the scene, without otherwise affecting the...
A class to retrieve the individual data elements previously stored in a Datagram. ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
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.