Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE PlaneNode::CData::
18CData() :
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 */
28INLINE PlaneNode::CData::
29CData(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 */
40INLINE void PlaneNode::
41set_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 */
53INLINE const LPlane &PlaneNode::
54get_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 */
63INLINE void PlaneNode::
64set_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 */
77INLINE PN_stdfloat PlaneNode::
78get_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 */
94INLINE void PlaneNode::
95set_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 */
106INLINE int PlaneNode::
107get_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 */
119INLINE void PlaneNode::
120set_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 */
127INLINE int PlaneNode::
128get_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 */
138get_sort_seq() {
139 return _sort_seq;
140}
get_priority
Returns the priority associated with this clip plane.
Definition planeNode.h:70
get_clip_effect
Returns the clip_effect bits for this clip plane.
Definition planeNode.h:71
set_priority
Changes the relative importance of this PlaneNode (when it is used as a clip plane) relative to the o...
Definition planeNode.h:70
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
set_viz_scale
Specifies the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition planeNode.h:69
get_viz_scale
Returns the size of the visual representation of the plane that is drawn if the PlaneNode is shown.
Definition planeNode.h:69
get_plane
Returns the plane represented by the PlaneNode.
Definition planeNode.h:68
set_clip_effect
Specifies the sort of things this plane will actually clip (when it is used as a clip plane).
Definition planeNode.h:71
set_plane
Sets the particular plane represented by the PlaneNode.
Definition planeNode.h:68
This is a sequence number that increments monotonically.
Definition updateSeq.h:37