14#ifndef CLIPPINGPLANEATTRIB_H
15#define CLIPPINGPLANEATTRIB_H
31class EXPCL_PANDA_PGRAPH ClipPlaneAttrib :
public RenderAttrib {
33 INLINE ClipPlaneAttrib();
34 INLINE ClipPlaneAttrib(
const ClipPlaneAttrib ©);
46 static CPT(RenderAttrib)
make(Operation op,
48 static CPT(RenderAttrib)
make(Operation op,
50 static CPT(RenderAttrib)
make(Operation op,
53 static CPT(RenderAttrib)
make(Operation op,
69 static CPT(RenderAttrib)
make();
90 CPT(ClipPlaneAttrib)
filter_to_max(
int max_clip_planes)
const;
93 CPT(RenderAttrib)
compose_off(
const RenderAttrib *other)
const;
94 virtual void output(std::ostream &out)
const;
97 virtual int compare_to_impl(
const RenderAttrib *other)
const;
98 virtual size_t get_hash_impl()
const;
99 virtual CPT(RenderAttrib) compose_impl(
const RenderAttrib *other)
const;
100 virtual CPT(RenderAttrib) invert_compose_impl(
const RenderAttrib *other)
const;
103 INLINE
void check_filtered()
const;
104 void sort_on_planes();
108 Planes _on_planes, _off_planes;
109 bool _off_all_planes;
111 typedef pmap< int, CPT(ClipPlaneAttrib) > Filtered;
116 static CPT(RenderAttrib) _empty_attrib;
117 static CPT(RenderAttrib) _all_off_attrib;
120 static int get_class_slot() {
123 virtual int get_slot()
const {
124 return get_class_slot();
126 MAKE_PROPERTY(class_slot, get_class_slot);
130 typedef pvector<PT(PandaNode) > NodeList;
150 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
157 static void init_type() {
158 RenderAttrib::init_type();
160 RenderAttrib::get_class_type());
163 virtual TypeHandle get_type()
const {
164 return get_class_type();
166 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
169 static TypeHandle _type_handle;
170 static int _attrib_slot;
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This functions similarly to a LightAttrib.
ConstPointerTo< RenderAttrib > remove_plane(PlaneNode *plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane removed from the list...
static ConstPointerTo< RenderAttrib > make(Operation op, PlaneNode *plane)
Constructs a new ClipPlaneAttrib object that enables (or disables, according to op) the indicated pla...
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 ClipPlaneAttrib.
get_num_off_planes
Returns the number of planes that are disabled by the attribute.
bool has_all_off() const
Returns true if this attrib disables all planes (although it may also enable some).
int get_num_planes() const
Returns the number of planes listed in the attribute.
bool has_on_plane(const NodePath &plane) const
Returns true if the indicated plane is enabled by the attrib, false otherwise.
bool has_off_plane(const NodePath &plane) const
Returns true if the indicated plane is disabled by the attrib, false otherwise.
ConstPointerTo< ClipPlaneAttrib > filter_to_max(int max_clip_planes) const
Returns a new ClipPlaneAttrib, very much like this one, but with the number of on_planes reduced to b...
ConstPointerTo< RenderAttrib > remove_on_plane(const NodePath &plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane removed from the list...
bool has_plane(PlaneNode *plane) const
Returns true if the indicated plane is listed in the attrib, false otherwise.
ConstPointerTo< RenderAttrib > add_off_plane(const NodePath &plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane added to the list of ...
ConstPointerTo< RenderAttrib > remove_off_plane(const NodePath &plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane removed from the list...
PlaneNode * get_plane(int n) const
Returns the nth plane listed in the attribute.
ConstPointerTo< RenderAttrib > add_on_plane(const NodePath &plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane added to the list of ...
ConstPointerTo< RenderAttrib > compose_off(const RenderAttrib *other) const
This is a special method which composes two ClipPlaneAttribs with regard only to their set of "off" c...
static ConstPointerTo< RenderAttrib > make_all_off()
Constructs a new ClipPlaneAttrib object that disables all planes (and hence disables clipping).
get_on_plane
Returns the nth plane enabled by the attribute, sorted in render order.
ConstPointerTo< RenderAttrib > add_plane(PlaneNode *plane) const
Returns a new ClipPlaneAttrib, just like this one, but with the indicated plane added to the list of ...
get_num_on_planes
Returns the number of planes that are enabled by the attribute.
Operation get_operation() const
Returns the basic operation type of the ClipPlaneAttrib.
bool is_identity() const
Returns true if this is an identity attrib: it does not change the set of planes in use.
get_off_plane
Returns the nth plane disabled by the attribute, sorted in arbitrary (pointer) order.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A node that contains a plane.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
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 int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
TypeHandle is the identifier used to differentiate C++ class types.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is a sequence number that increments monotonically.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
This is our own Panda specialization on the default STL list.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.