26int ScissorAttrib::_attrib_slot;
33ScissorAttrib(
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) {
53 ScissorAttrib *attrib =
new ScissorAttrib(LVecBase4(0.0f, 1.0f, 0.0f, 1.0f));
55 _off_attrib = return_new(attrib);
64CPT(RenderAttrib) ScissorAttrib::
65make(
const LVecBase4 &frame) {
66 ScissorAttrib *attrib =
new ScissorAttrib(frame);
67 return return_new(attrib);
84output(std::ostream &out)
const {
85 out << get_type() <<
":[" << _frame <<
"]";
102 const ScissorAttrib *ta = (
const ScissorAttrib *)other;
104 if (_off && ta->_off) {
108 if (_off && !ta->_off) {
112 if (!_off && ta->_off) {
116 return _frame.compare_to(ta->_frame);
125size_t ScissorAttrib::
126get_hash_impl()
const {
129 hash = _frame.add_hash(hash);
151 const ScissorAttrib *ta = (
const ScissorAttrib *)other;
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]));
162 ScissorAttrib *attrib =
new ScissorAttrib(new_frame);
163 return return_new(attrib);
182 _frame.write_datagram(dg);
200 attrib->fillin(scan, manager);
211 RenderAttrib::fillin(scan, manager);
213 _frame.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...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
A class to retrieve the individual data elements previously stored in a Datagram.
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_bool(bool value)
Adds a boolean value 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.
This restricts rendering to within a rectangular region of the scene, without otherwise affecting the...
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
static void register_with_read_factory()
Tells the BamReader how to create objects of type ScissorAttrib.
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new ScissorAttrib object that removes the scissor region and fills the DisplayRegion.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.