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