Panda3D
|
00001 // Filename: planeNode.I 00002 // Created by: drose (11Jul02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PlaneNode::CData::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE PlaneNode::CData:: 00022 CData() : 00023 _viz_scale(100.0f) 00024 { 00025 // The default plane (perpendicular to the Z-axis) is used until 00026 // another one is specified explicitly. 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: PlaneNode::CData::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE PlaneNode::CData:: 00035 CData(const PlaneNode::CData ©) : 00036 _plane(copy._plane), 00037 _front_viz(copy._front_viz), 00038 _back_viz(copy._back_viz), 00039 _viz_scale(copy._viz_scale) 00040 { 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: PlaneNode::set_plane 00045 // Access: Public 00046 // Description: Sets the particular plane represented by the 00047 // PlaneNode. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE void PlaneNode:: 00050 set_plane(const LPlane &plane) { 00051 CDWriter cdata(_cycler); 00052 if (cdata->_plane != plane) { 00053 cdata->_plane = plane; 00054 cdata->_front_viz = NULL; 00055 cdata->_back_viz = NULL; 00056 } 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: PlaneNode::get_plane 00061 // Access: Public 00062 // Description: Returns the plane represented by the PlaneNode. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE const LPlane &PlaneNode:: 00065 get_plane() const { 00066 CDReader cdata(_cycler); 00067 return cdata->_plane; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: PlaneNode::set_viz_scale 00072 // Access: Public 00073 // Description: Specifies the size of the visual representation of 00074 // the plane that is drawn if the PlaneNode is shown. 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE void PlaneNode:: 00077 set_viz_scale(PN_stdfloat viz_scale) { 00078 CDWriter cdata(_cycler); 00079 if (cdata->_viz_scale != viz_scale) { 00080 cdata->_viz_scale = viz_scale; 00081 cdata->_front_viz = NULL; 00082 cdata->_back_viz = NULL; 00083 } 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function: PlaneNode::get_viz_scale 00088 // Access: Public 00089 // Description: Returns the size of the visual representation of 00090 // the plane that is drawn if the PlaneNode is shown. 00091 //////////////////////////////////////////////////////////////////// 00092 INLINE PN_stdfloat PlaneNode:: 00093 get_viz_scale() const { 00094 CDReader cdata(_cycler); 00095 return cdata->_viz_scale; 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: PlaneNode::set_priority 00100 // Access: Published 00101 // Description: Changes the relative importance of this PlaneNode 00102 // (when it is used as a clip plane) relative to the 00103 // other clip planes that are applied simultaneously. 00104 // 00105 // The priority number is used to decide which of the 00106 // requested clip planes are to be activated when more 00107 // clip planes are requested than the hardware will 00108 // support. The highest-priority n planes are selected 00109 // for rendering. 00110 // 00111 // This is similar to TextureStage::set_priority(). 00112 //////////////////////////////////////////////////////////////////// 00113 INLINE void PlaneNode:: 00114 set_priority(int priority) { 00115 _priority = priority; 00116 00117 // Update the global flag to indicate that all ClipPlaneAttribs in 00118 // the world must now re-sort their lists. 00119 _sort_seq++; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: PlaneNode::get_priority 00124 // Access: Published 00125 // Description: Returns the priority associated with this clip 00126 // plane. See set_priority(). 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE int PlaneNode:: 00129 get_priority() const { 00130 return _priority; 00131 } 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: PlaneNode::set_clip_effect 00135 // Access: Published 00136 // Description: Specifies the sort of things this plane will actually 00137 // clip (when it is used as a clip plane). This is a 00138 // bitmask union of ClipEffect values. If it includes 00139 // CE_visible, then it will clip visible geometry; if it 00140 // includes CE_collision, then it will clip collision 00141 // polygons. If it includes neither bit, it will still 00142 // affect culling, but objects will either be wholly 00143 // behind the clipping plane, or wholly present. 00144 //////////////////////////////////////////////////////////////////// 00145 INLINE void PlaneNode:: 00146 set_clip_effect(int clip_effect) { 00147 _clip_effect = clip_effect; 00148 } 00149 00150 //////////////////////////////////////////////////////////////////// 00151 // Function: PlaneNode::get_clip_effect 00152 // Access: Published 00153 // Description: Returns the clip_effect bits for this clip plane. 00154 // See set_clip_effect(). 00155 //////////////////////////////////////////////////////////////////// 00156 INLINE int PlaneNode:: 00157 get_clip_effect() const { 00158 return _clip_effect; 00159 } 00160 00161 //////////////////////////////////////////////////////////////////// 00162 // Function: PlaneNode::get_sort_seq 00163 // Access: Public, Static 00164 // Description: Returns a global sequence number that is incremented 00165 // any time any PlaneNode in the world changes sort 00166 // or priority. This is used by ClipPlaneAttrib to 00167 // determine when it is necessary to re-sort its 00168 // internal array of stages. 00169 //////////////////////////////////////////////////////////////////// 00170 INLINE UpdateSeq PlaneNode:: 00171 get_sort_seq() { 00172 return _sort_seq; 00173 } 00174