Panda3D
occluderNode.I
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 occluderNode.I
10  * @author jenes
11  * @date 2011-03-11
12  */
13 
14 /**
15  * Replaces the four vertices of the occluder polygon. The vertices should be
16  * defined in a counterclockwise orientation when looking at the face of the
17  * occluder.
18  */
19 INLINE void OccluderNode::
20 set_vertices(const LPoint3 &v0, const LPoint3 &v1,
21  const LPoint3 &v2, const LPoint3 &v3) {
22  _vertices.clear();
23  _vertices.reserve(4);
24  _vertices.push_back(v0);
25  _vertices.push_back(v1);
26  _vertices.push_back(v2);
27  _vertices.push_back(v3);
28 }
29 
30 /**
31  * Returns the number of vertices in the occluder polygon. This should always
32  * return 4.
33  */
34 INLINE size_t OccluderNode::
35 get_num_vertices() const {
36  return _vertices.size();
37 }
38 
39 /**
40  * Returns the nth vertex of the occluder polygon.
41  */
42 INLINE const LPoint3 &OccluderNode::
43 get_vertex(size_t n) const {
44  nassertr(n < _vertices.size(), LPoint3::zero());
45  return _vertices[n];
46 }
47 
48 /**
49  * Sets the nth vertex of the occluder polygon.
50  */
51 INLINE void OccluderNode::
52 set_vertex(size_t n, const LPoint3 &v) {
53  nassertv(n < _vertices.size());
54  _vertices[n] = v;
55 }
56 
57 /**
58  * If true, the back-face will also be used to occlude
59  */
60 INLINE void OccluderNode::set_double_sided(bool value) {
61  _double_sided = value;
62 }
63 
64 /**
65  * Is this occluder double-sided
66  */
67 INLINE bool OccluderNode::is_double_sided() {
68  return _double_sided;
69 }
70 
71 /**
72  * Minimum screen coverage needed before occluder used. Range should be 0 to
73  * 1. For example, setting to 0.2 would mean that the occluder needs to cover
74  * 20% of the screen to be considered.
75  */
76 INLINE void OccluderNode::set_min_coverage(PN_stdfloat value) {
77  _min_coverage = value;
78 }
79 
80 /**
81  * Returns the minimum screen coverage.
82  */
83 INLINE PN_stdfloat OccluderNode::get_min_coverage() {
84  return _min_coverage;
85 }
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:20
get_vertex
Returns the nth vertex of the occluder polygon.
Definition: occluderNode.h:59
set_min_coverage
Minimum screen coverage needed before occluder used.
Definition: occluderNode.h:62
is_double_sided
Is this occluder double-sided.
Definition: occluderNode.h:61
get_min_coverage
Returns the minimum screen coverage.
Definition: occluderNode.h:62
set_double_sided
If true, the back-face will also be used to occlude.
Definition: occluderNode.h:61
set_vertex
Sets the nth vertex of the occluder polygon.
Definition: occluderNode.h:63