Panda3D
 All Classes Functions Variables Enumerations
occluderNode.I
1 // Filename: occluderNode.I
2 // Created by: jenes (11Mar11)
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: OccluderNode::set_vertices
18 // Access: Published
19 // Description: Replaces the four vertices of the occluder polygon.
20 // The vertices should be defined in a counterclockwise
21 // orientation when looking at the face of the occluder.
22 ////////////////////////////////////////////////////////////////////
23 INLINE void OccluderNode::
24 set_vertices(const LPoint3 &v0, const LPoint3 &v1,
25  const LPoint3 &v2, const LPoint3 &v3) {
26  _vertices.clear();
27  _vertices.reserve(4);
28  _vertices.push_back(v0);
29  _vertices.push_back(v1);
30  _vertices.push_back(v2);
31  _vertices.push_back(v3);
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: OccluderNode::get_num_vertices
36 // Access: Published
37 // Description: Returns the number of vertices in the occluder
38 // polygon. This should always return 4.
39 ////////////////////////////////////////////////////////////////////
40 INLINE int OccluderNode::
42  return _vertices.size();
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: OccluderNode::get_vertex
47 // Access: Published
48 // Description: Returns the nth vertex of the occluder polygon.
49 ////////////////////////////////////////////////////////////////////
50 INLINE const LPoint3 &OccluderNode::
51 get_vertex(int n) const {
52  nassertr(n >= 0 && n < (int)_vertices.size(), LPoint3::zero());
53  return _vertices[n];
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: OccluderNode::set_double_sided
58 // Access: Published
59 // Description: If true, the back-face will also be used to occlude
60 ////////////////////////////////////////////////////////////////////
61 INLINE void OccluderNode::set_double_sided(bool value) {
62  _double_sided = value;
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: OccluderNode::is_double_sided
67 // Access: Published
68 // Description: Is this occluder double-sided
69 ////////////////////////////////////////////////////////////////////
71  return _double_sided;
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: OccluderNode::set_min_coverage
76 // Access: Published
77 // Description: Minimum screen coverage needed before occluder used.
78 // Range should be 0 to 1. For example, setting to 0.2
79 // would mean that the occluder needs to cover 20% of
80 // the screen to be considered.
81 ////////////////////////////////////////////////////////////////////
82 INLINE void OccluderNode::set_min_coverage(PN_stdfloat value) {
83  _min_coverage = value;
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function: OccluderNode::get_min_coverage
88 // Access: Published
89 // Description: Returns the minimum screen coverage.
90 ////////////////////////////////////////////////////////////////////
91 INLINE PN_stdfloat OccluderNode::get_min_coverage() {
92  return _min_coverage;
93 }
void set_vertices(const LPoint3 &v0, const LPoint3 &v1, const LPoint3 &v2, const LPoint3 &v3)
Replaces the four vertices of the occluder polygon.
Definition: occluderNode.I:24
void set_min_coverage(PN_stdfloat value)
Minimum screen coverage needed before occluder used.
Definition: occluderNode.I:82
void set_double_sided(bool value)
If true, the back-face will also be used to occlude.
Definition: occluderNode.I:61
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:258
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
int get_num_vertices() const
Returns the number of vertices in the occluder polygon.
Definition: occluderNode.I:41
PN_stdfloat get_min_coverage()
Returns the minimum screen coverage.
Definition: occluderNode.I:91
const LPoint3 & get_vertex(int n) const
Returns the nth vertex of the occluder polygon.
Definition: occluderNode.I:51
bool is_double_sided()
Is this occluder double-sided.
Definition: occluderNode.I:70