26 int ScissorAttrib::_attrib_slot;
33 ScissorAttrib(
const LVecBase4 &frame) :
38 _frame[0] = max(min(_frame[0], (PN_stdfloat)1.0), (PN_stdfloat)0.0);
39 _frame[1] = max(min(_frame[1], (PN_stdfloat)1.0), _frame[0]);
40 _frame[2] = max(min(_frame[2], (PN_stdfloat)1.0), (PN_stdfloat)0.0);
41 _frame[3] = max(min(_frame[3], (PN_stdfloat)1.0), _frame[2]);
50 if (_off_attrib !=
nullptr) {
55 _off_attrib = return_new(attrib);
65 make(
const LVecBase4 &frame) {
67 return return_new(attrib);
84 output(std::ostream &out)
const {
85 out << get_type() <<
":[" << _frame <<
"]";
104 if (!_off && !ta->_off) {
108 if (_off && !ta->_off) {
112 if (!_off && ta->_off) {
116 return _frame.compare_to(ta->_frame);
125 size_t ScissorAttrib::
126 get_hash_impl()
const {
129 hash = _frame.add_hash(hash);
157 LVecBase4 new_frame(max(ta->_frame[0], _frame[0]),
158 min(ta->_frame[1], _frame[1]),
159 max(ta->_frame[2], _frame[2]),
160 min(ta->_frame[3], _frame[3]));
163 return return_new(attrib);
170 register_with_read_factory() {
182 _frame.write_datagram(dg);
200 attrib->fillin(scan, manager);
211 RenderAttrib::fillin(scan, manager);
213 _frame.read_datagram(scan);
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
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 ...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
CPT(RenderAttrib) ScissorAttrib
Constructs a new ScissorAttrib object that removes the scissor region and fills the DisplayRegion.
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_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...
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.
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.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.