Panda3D

planeNode.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 planeNode.I
10 * @author drose
11 * @date 2002-07-11
12 */
13
14 /**
15 *
16 */
17 INLINE PlaneNode::CData::
18 CData() :
19 _viz_scale(100.0f)
20 {
21 // The default plane (perpendicular to the Z-axis) is used until another one
22 // is specified explicitly.
23 }
24
25 /**
26 *
27 */
28 INLINE PlaneNode::CData::
29 CData(const PlaneNode::CData &copy) :
30 _plane(copy._plane),
31 _front_viz(copy._front_viz),
32 _back_viz(copy._back_viz),
33 _viz_scale(copy._viz_scale)
34 {
35 }
36
37 /**
38 * Sets the particular plane represented by the PlaneNode.
39 */
40 INLINE void PlaneNode::
41 set_plane(const LPlane &plane) {
42 CDWriter cdata(_cycler);
43 if (cdata->_plane != plane) {
44 cdata->_plane = plane;
45 cdata->_front_viz = nullptr;
46 cdata->_back_viz = nullptr;
47 }
48 }
49
50 /**
51 * Returns the plane represented by the PlaneNode.
52 */
53 INLINE const LPlane &PlaneNode::
54 get_plane() const {
55 CDReader cdata(_cycler);
56 return cdata->_plane;
57 }
58
59 /**
60 * Specifies the size of the visual representation of the plane that is drawn
61 * if the PlaneNode is shown.
62 */
63 INLINE void PlaneNode::
64 set_viz_scale(PN_stdfloat viz_scale) {
65 CDWriter cdata(_cycler);
66 if (cdata->_viz_scale != viz_scale) {
67 cdata->_viz_scale = viz_scale;
68 cdata->_front_viz = nullptr;
69 cdata->_back_viz = nullptr;
70 }
71 }
72
73 /**
74 * Returns the size of the visual representation of the plane that is drawn if
75 * the PlaneNode is shown.
76 */
77 INLINE PN_stdfloat PlaneNode::
78 get_viz_scale() const {
79 CDReader cdata(_cycler);
80 return cdata->_viz_scale;
81 }
82
83 /**
84 * Changes the relative importance of this PlaneNode (when it is used as a
85 * clip plane) relative to the other clip planes that are applied
86 * simultaneously.
87 *
88 * The priority number is used to decide which of the requested clip planes
89 * are to be activated when more clip planes are requested than the hardware
90 * will support. The highest-priority n planes are selected for rendering.
91 *
92 * This is similar to TextureStage::set_priority().
93 */
94 INLINE void PlaneNode::
95 set_priority(int priority) {
96 _priority = priority;
97
98 // Update the global flag to indicate that all ClipPlaneAttribs in the world
99 // must now re-sort their lists.
100 _sort_seq++;
101 }
102
103 /**
104 * Returns the priority associated with this clip plane. See set_priority().
105 */
106 INLINE int PlaneNode::
107 get_priority() const {
108 return _priority;
109 }
110
111 /**
112 * Specifies the sort of things this plane will actually clip (when it is used
113 * as a clip plane). This is a bitmask union of ClipEffect values. If it
114 * includes CE_visible, then it will clip visible geometry; if it includes
115 * CE_collision, then it will clip collision polygons. If it includes neither
116 * bit, it will still affect culling, but objects will either be wholly behind
117 * the clipping plane, or wholly present.
118 */
119 INLINE void PlaneNode::
120 set_clip_effect(int clip_effect) {
121 _clip_effect = clip_effect;
122 }
123
124 /**
125 * Returns the clip_effect bits for this clip plane. See set_clip_effect().
126 */
127 INLINE int PlaneNode::
128 get_clip_effect() const {
129 return _clip_effect;
130 }
131
132 /**
133 * Returns a global sequence number that is incremented any time any PlaneNode
134 * in the world changes sort or priority. This is used by ClipPlaneAttrib to
135 * determine when it is necessary to re-sort its internal array of stages.
136 */
137 INLINE UpdateSeq PlaneNode::
138 get_sort_seq() {
139 return _sort_seq;
140 }
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition: cycleDataReader.h:35
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
PlaneNode::set_priority
void set_priority(int priority)
Changes the relative importance of this PlaneNode (when it is used as a clip plane) relative to the o...
Definition: planeNode.I:95
PlaneNode::set_clip_effect
void set_clip_effect(int clip_effect)
Specifies the sort of things this plane will actually clip (when it is used as a clip plane).
Definition: planeNode.I:120
PlaneNode::get_plane
const LPlane & get_plane() const
Returns the plane represented by the PlaneNode.
Definition: planeNode.I:54
PlaneNode::set_viz_scale
void set_viz_scale(PN_stdfloat viz_scale)
Specifies the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition: planeNode.I:64
PlaneNode::get_sort_seq
static UpdateSeq get_sort_seq()
Returns a global sequence number that is incremented any time any PlaneNode in the world changes sort...
Definition: planeNode.I:138
PlaneNode::set_plane
void set_plane(const LPlane &plane)
Sets the particular plane represented by the PlaneNode.
Definition: planeNode.I:41
PlaneNode::get_priority
int get_priority() const
Returns the priority associated with this clip plane.
Definition: planeNode.I:107
PlaneNode::get_clip_effect
int get_clip_effect() const
Returns the clip_effect bits for this clip plane.
Definition: planeNode.I:128
PlaneNode::get_viz_scale
PN_stdfloat get_viz_scale() const
Returns the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition: planeNode.I:78
UpdateSeq
This is a sequence number that increments monotonically.
Definition: updateSeq.h:37