Panda3D
occluderEffect.I
1 // Filename: occluderEffect.I
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: OccluderEffect::Constructor
18 // Access: Protected
19 // Description: Use OccluderEffect::make() to construct a new
20 // OccluderEffect object.
21 ////////////////////////////////////////////////////////////////////
22 INLINE OccluderEffect::
23 OccluderEffect() {
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: OccluderEffect::Copy Constructor
28 // Access: Protected
29 // Description: Use OccluderEffect::make() to construct a new
30 // OccluderEffect object. The copy constructor is only
31 // defined to facilitate methods like add_on_occluder().
32 ////////////////////////////////////////////////////////////////////
33 INLINE OccluderEffect::
34 OccluderEffect(const OccluderEffect &copy) :
35  _on_occluders(copy._on_occluders)
36 {
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: OccluderEffect::get_num_on_occluders
41 // Access: Published
42 // Description: Returns the number of occluders that are enabled by
43 // the effectute.
44 ////////////////////////////////////////////////////////////////////
45 INLINE int OccluderEffect::
47  return _on_occluders.size();
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: OccluderEffect::get_on_occluder
52 // Access: Published
53 // Description: Returns the nth occluder enabled by the effectute,
54 // sorted in render order.
55 ////////////////////////////////////////////////////////////////////
57 get_on_occluder(int n) const {
58  nassertr(n >= 0 && n < (int)_on_occluders.size(), NodePath::fail());
59  return _on_occluders[n];
60 }
61 
62 ////////////////////////////////////////////////////////////////////
63 // Function: OccluderEffect::has_on_occluder
64 // Access: Published
65 // Description: Returns true if the indicated occluder is enabled by
66 // the effect, false otherwise.
67 ////////////////////////////////////////////////////////////////////
68 INLINE bool OccluderEffect::
69 has_on_occluder(const NodePath &occluder) const {
70  return _on_occluders.find(occluder) != _on_occluders.end();
71 }
72 
73 ////////////////////////////////////////////////////////////////////
74 // Function: OccluderEffect::is_identity
75 // Access: Published
76 // Description: Returns true if this is an identity effect: it does
77 // not change the set of occluders in use.
78 ////////////////////////////////////////////////////////////////////
79 INLINE bool OccluderEffect::
80 is_identity() const {
81  return _on_occluders.empty();
82 }
size_type_0 size() const
Returns the number of elements in the ordered vector.
bool has_on_occluder(const NodePath &occluder) const
Returns true if the indicated occluder is enabled by the effect, false otherwise. ...
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.
bool empty() const
Returns true if the ordered vector is empty, false otherwise.
bool is_identity() const
Returns true if this is an identity effect: it does not change the set of occluders in use...
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
Definition: nodePath.I:185
This functions similarly to a LightAttrib or ClipPlaneAttrib.
NodePath get_on_occluder(int n) const
Returns the nth occluder enabled by the effectute, sorted in render order.
int get_num_on_occluders() const
Returns the number of occluders that are enabled by the effectute.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165