Panda3D
occluderEffect.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file occluderEffect.h
10  * @author drose
11  * @date 2011-03-17
12  */
13 
14 #ifndef OCCLUDEREFFECT_H
15 #define OCCLUDEREFFECT_H
16 
17 #include "pandabase.h"
18 
19 #include "occluderNode.h"
20 #include "renderEffect.h"
21 #include "nodePath.h"
22 #include "ordered_vector.h"
23 #include "pmap.h"
24 
25 /**
26  * This functions similarly to a LightAttrib or ClipPlaneAttrib. It indicates
27  * the set of occluders that modify the geometry at this level and below.
28  * Unlike a ClipPlaneAttrib, an OccluderEffect takes effect immediately when
29  * it is encountered during traversal, and thus can only add occluders; it may
30  * not remove them.
31  */
32 class EXPCL_PANDA_PGRAPH OccluderEffect : public RenderEffect {
33 private:
34  INLINE OccluderEffect();
35  INLINE OccluderEffect(const OccluderEffect &copy);
36 
37 PUBLISHED:
38  static CPT(RenderEffect) make();
39 
40  INLINE int get_num_on_occluders() const;
41  INLINE NodePath get_on_occluder(int n) const;
42  MAKE_SEQ(get_on_occluders, get_num_on_occluders, get_on_occluder);
43  INLINE bool has_on_occluder(const NodePath &occluder) const;
44 
45  INLINE bool is_identity() const;
46 
47  CPT(RenderEffect) add_on_occluder(const NodePath &occluder) const;
48  CPT(RenderEffect) remove_on_occluder(const NodePath &occluder) const;
49 
50 public:
51  virtual void output(std::ostream &out) const;
52 
53 protected:
54  virtual int compare_to_impl(const RenderEffect *other) const;
55 
56 private:
57  void sort_on_occluders();
58 
59 private:
61  Occluders _on_occluders;
62 
63  UpdateSeq _sort_seq;
64 
65  static CPT(RenderEffect) _empty_effect;
66 
67 public:
68  static void register_with_read_factory();
69  virtual void write_datagram(BamWriter *manager, Datagram &dg);
70  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
71  virtual bool require_fully_complete() const;
72 
73 protected:
74  static TypedWritable *make_from_bam(const FactoryParams &params);
75  void fillin(DatagramIterator &scan, BamReader *manager);
76 
77 public:
78  static TypeHandle get_class_type() {
79  return _type_handle;
80  }
81  static void init_type() {
82  RenderEffect::init_type();
83  register_type(_type_handle, "OccluderEffect",
84  RenderEffect::get_class_type());
85  }
86  virtual TypeHandle get_type() const {
87  return get_class_type();
88  }
89  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
90 
91 private:
92  static TypeHandle _type_handle;
93 };
94 
95 #include "occluderEffect.I"
96 
97 #endif
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...
Definition: bamReader.h:110
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
Definition: bamWriter.h:63
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:48
This is our own Panda specialization on the default STL list.
Definition: plist.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 functions similarly to a LightAttrib or ClipPlaneAttrib.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This is a sequence number that increments monotonically.
Definition: updateSeq.h:37
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161