Panda3D

Loading...
Searching...
No Matches
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 */
19INLINE 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 */
34INLINE 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 */
42INLINE 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 */
51INLINE 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 */
60INLINE void OccluderNode::set_double_sided(bool value) {
61 _double_sided = value;
62}
63
64/**
65 * Is this occluder double-sided
66 */
67INLINE 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 */
76INLINE void OccluderNode::set_min_coverage(PN_stdfloat value) {
77 _min_coverage = value;
78}
79
80/**
81 * Returns the minimum screen coverage.
82 */
83INLINE PN_stdfloat OccluderNode::get_min_coverage() {
84 return _min_coverage;
85}
OccluderNode::set_double_sided
set_double_sided
If true, the back-face will also be used to occlude.
Definition occluderNode.h:61
OccluderNode::set_min_coverage
set_min_coverage
Minimum screen coverage needed before occluder used.
Definition occluderNode.h:62
OccluderNode::get_num_vertices
get_num_vertices
Returns the number of vertices in the occluder polygon.
Definition occluderNode.h:59
OccluderNode::set_vertex
set_vertex
Sets the nth vertex of the occluder polygon.
Definition occluderNode.h:63
OccluderNode::get_min_coverage
get_min_coverage
Returns the minimum screen coverage.
Definition occluderNode.h:62
OccluderNode::is_double_sided
is_double_sided
Is this occluder double-sided.
Definition occluderNode.h:61
OccluderNode::get_vertex
get_vertex
Returns the nth vertex of the occluder polygon.
Definition occluderNode.h:59
OccluderNode::set_vertices
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