15 #include "depthOffsetAttrib.h" 16 #include "graphicsStateGuardianBase.h" 18 #include "bamReader.h" 19 #include "bamWriter.h" 21 #include "datagramIterator.h" 24 int DepthOffsetAttrib::_attrib_slot;
36 return return_new(attrib);
51 make(
int offset, PN_stdfloat min_value, PN_stdfloat max_value) {
52 nassertr(min_value >= 0.0f && min_value <= 1.0f, NULL);
53 nassertr(max_value >= 0.0f && max_value <= 1.0f, NULL);
55 return return_new(attrib);
75 void DepthOffsetAttrib::
76 output(ostream &out)
const {
96 int DepthOffsetAttrib::
99 DCAST_INTO_R(ta, other, 0);
100 if (_offset != ta->_offset) {
101 return _offset - ta->_offset;
103 if (_min_value != ta->_min_value) {
104 return _min_value < ta->_min_value ? -1 : 1;
106 if (_max_value != ta->_max_value) {
107 return _max_value < ta->_max_value ? -1 : 1;
122 size_t DepthOffsetAttrib::
123 get_hash_impl()
const {
151 DCAST_INTO_R(ta, other, 0);
152 int new_offset = ta->_offset + _offset;
155 return return_new(attrib);
170 DCAST_INTO_R(ta, other, 0);
171 int new_offset = ta->_offset - _offset;
174 return return_new(attrib);
183 void DepthOffsetAttrib::
184 register_with_read_factory() {
217 parse_params(params, scan, manager);
218 attrib->fillin(scan, manager);
230 void DepthOffsetAttrib::
232 RenderAttrib::fillin(scan, manager);
int get_offset() const
Returns the depth offset represented by this attrib.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
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 ...
PN_int32 get_int32()
Extracts a signed 32-bit integer.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
void add_stdfloat(PN_stdfloat value)
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
This hash_compare class hashes a float or a double.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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 register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
PN_stdfloat get_max_value() const
Returns the value for the maximum (farthest) depth value to be stored in the buffer, in the range 0
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is a special kind of attribute that instructs the graphics driver to apply an offset or bias to ...
size_t add_hash(size_t start, const Key &key) const
Adds the indicated key into a running hash.
PN_stdfloat get_min_value() const
Returns the value for the minimum (closest) depth value to be stored in the buffer, in the range 0
void add_int32(PN_int32 value)
Adds a signed 32-bit integer to the datagram.
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 ...