Panda3D
portalNode.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 portalNode.I
10  * @author masad
11  * @date 2004-05-13
12  */
13 
14 /**
15  * Simultaneously sets both the "from" and "into" PortalMask values to the
16  * same thing.
17  */
18 INLINE void PortalNode::
22 }
23 
24 /**
25  * Sets the "from" PortalMask. In order for a portal to be detected from this
26  * object into another object, the intersection of this object's "from" mask
27  * and the other object's "into" mask must be nonzero.
28  */
29 INLINE void PortalNode::
31  _from_portal_mask = mask;
32 }
33 
34 /**
35  * Sets the "into" PortalMask. In order for a portal to be detected from
36  * another object into this object, the intersection of the other object's
37  * "from" mask and this object's "into" mask must be nonzero.
38  */
39 INLINE void PortalNode::
41  _into_portal_mask = mask;
42 
43  // We mark the bound stale when this changes, not because the actual
44  // bounding volume changes, but rather because we piggyback the computing of
45  // the _net_portal_mask on the bounding volume.
46  mark_bounds_stale();
47 }
48 
49 /**
50  * Returns the current "from" PortalMask. In order for a portal to be
51  * detected from this object into another object, the intersection of this
52  * object's "from" mask and the other object's "into" mask must be nonzero.
53  */
54 INLINE PortalMask PortalNode::
55 get_from_portal_mask() const {
56  return _from_portal_mask;
57 }
58 
59 /**
60  * Returns the current "into" PortalMask. In order for a portal to be
61  * detected from another object into this object, the intersection of the
62  * other object's "from" mask and this object's "into" mask must be nonzero.
63  */
64 INLINE PortalMask PortalNode::
65 get_into_portal_mask() const {
66  return _into_portal_mask;
67 }
68 
69 /**
70  * Sets the state of the "portal geom" flag for this PortalNode. Normally,
71  * this is false; when this is set true, the PortalSolids in this node will
72  * test for portals with actual renderable geometry, in addition to whatever
73  * PortalSolids may be indicated by the from_portal_mask.
74  *
75  * Setting this to true causes this to test *all* GeomNodes for portals. It
76  * is an all-or-none thing; there is no way to portal with only some
77  * GeomNodes, as GeomNodes have no into_portal_mask.
78  */
79 INLINE void PortalNode::
80 set_portal_geom(bool flag) {
81  if (flag) {
82  _flags |= F_portal_geom;
83  } else {
84  _flags &= ~F_portal_geom;
85  }
86 }
87 
88 /**
89  * Returns the current state of the portal_geom flag. See set_portal_geom().
90  */
91 INLINE bool PortalNode::
92 get_portal_geom() const {
93  return (_flags & F_portal_geom) != 0;
94 }
95 
96 /**
97  * Resets the vertices of the portal to the empty list.
98  */
99 INLINE void PortalNode::
101  _vertices.clear();
102 }
103 
104 /**
105  * Adds a new vertex to the portal polygon. The vertices should be defined in
106  * a counterclockwise orientation when viewing through the portal.
107  */
108 INLINE void PortalNode::
109 add_vertex(const LPoint3 &vertex) {
110  _vertices.push_back(vertex);
111 }
112 
113 /**
114  * Returns the number of vertices in the portal polygon.
115  */
116 INLINE int PortalNode::
117 get_num_vertices() const {
118  return _vertices.size();
119 }
120 
121 /**
122  * Returns the nth vertex of the portal polygon.
123  */
124 INLINE const LPoint3 &PortalNode::
125 get_vertex(int n) const {
126  nassertr(n >= 0 && n < (int)_vertices.size(), LPoint3::zero());
127  return _vertices[n];
128 }
129 
130 /**
131  * Sets the cell that this portal belongs to
132  */
133 INLINE void PortalNode::set_cell_in(const NodePath &cell) {
134  _cell_in = cell;
135 }
136 
137 /**
138  * Sets the cell that this portal belongs to
139  */
140 INLINE NodePath PortalNode::get_cell_in() const {
141  return _cell_in;
142 }
143 /**
144  * Sets the cell that this portal leads out to
145  */
146 INLINE void PortalNode::set_cell_out(const NodePath &cell) {
147  _cell_out = cell;
148 }
149 
150 /**
151  * Sets the cell that this portal leads out to
152  */
153 INLINE NodePath PortalNode::get_cell_out() const {
154  return _cell_out;
155 }
156 
157 /**
158  * this is set if the portal will clip against its left and right planes
159  */
160 INLINE void PortalNode::set_clip_plane(bool value) {
161  _clip_plane = value;
162  if (_clip_plane) {
164  }
165 }
166 
167 /**
168  * Is this portal clipping against its left-right planes
169  */
170 INLINE bool PortalNode::is_clip_plane() {
171  return _clip_plane;
172 }
173 
174 
175 /**
176  * this is set if the portal is facing camera
177  */
178 INLINE void PortalNode::set_visible(bool value) {
179  _visible = value;
180 }
181 
182 /**
183  * Is this portal facing the camera
184  */
185 INLINE bool PortalNode::is_visible() {
186  return _visible;
187 }
188 
189 /**
190  * Python sets this based on curent camera zone
191  */
192 INLINE void PortalNode::set_open(bool value) {
193  _open = value;
194 }
195 
196 /**
197  * Is this portal open from current camera zone
198  */
199 INLINE bool PortalNode::is_open() {
200  return _open;
201 }
202 
203 /**
204  * Set the maximum depth this portal will be visible at
205  */
206 INLINE void PortalNode::set_max_depth(int value) {
207  _max_depth = value;
208 }
209 
210 /**
211  * Returns the maximum depth this portal will be visible at
212  */
213 INLINE int PortalNode::get_max_depth() {
214  return _max_depth;
215 }
set_from_portal_mask
Sets the "from" PortalMask.
Definition: portalNode.h:90
void set_portal_mask(PortalMask mask)
Simultaneously sets both the "from" and "into" PortalMask values to the same thing.
Definition: portalNode.I:19
set_open
Python sets this based on curent camera zone.
Definition: portalNode.h:98
set_into_portal_mask
Sets the "into" PortalMask.
Definition: portalNode.h:89
get_cell_in
Sets the cell that this portal belongs to.
Definition: portalNode.h:93
set_clip_plane
this is set if the portal will clip against its left and right planes
Definition: portalNode.h:95
is_open
Is this portal open from current camera zone.
Definition: portalNode.h:98
set_visible
this is set if the portal is facing camera
Definition: portalNode.h:96
is_visible
Is this portal facing the camera.
Definition: portalNode.h:96
get_cell_out
Sets the cell that this portal leads out to.
Definition: portalNode.h:94
set_max_depth
Set the maximum depth this portal will be visible at.
Definition: portalNode.h:97
get_vertex
Returns the nth vertex of the portal polygon.
Definition: portalNode.h:67
void clear_vertices()
Resets the vertices of the portal to the empty list.
Definition: portalNode.I:100
is_clip_plane
Is this portal clipping against its left-right planes.
Definition: portalNode.h:95
virtual void enable_clipping_planes()
initialize the clipping planes and renderstate
Definition: portalNode.cxx:131
set_cell_out
Sets the cell that this portal leads out to.
Definition: portalNode.h:94
void add_vertex(const LPoint3 &vertex)
Adds a new vertex to the portal polygon.
Definition: portalNode.I:109
set_portal_geom
Sets the state of the "portal geom" flag for this PortalNode.
Definition: portalNode.h:91
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
get_max_depth
Returns the maximum depth this portal will be visible at.
Definition: portalNode.h:97
set_cell_in
Sets the cell that this portal belongs to.
Definition: portalNode.h:93