00001 // Filename: billboardEffect.I 00002 // Created by: drose (14Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: BillboardEffect::Constructor 00022 // Access: Private 00023 // Description: Use BillboardEffect::make() to construct a new 00024 // BillboardEffect object. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE BillboardEffect:: 00027 BillboardEffect() { 00028 _off = true; 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: BillboardEffect::make_axis 00033 // Access: Published, Static 00034 // Description: A convenience function to make a typical 00035 // axis-rotating billboard. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE CPT(RenderEffect) BillboardEffect:: 00038 make_axis() { 00039 return make(LVector3f::up(), false, true, 00040 0.0f, NodePath(), LPoint3f(0.0f, 0.0f, 0.0f)); 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: BillboardEffect::make_point_eye 00045 // Access: Published, Static 00046 // Description: A convenience function to make a typical 00047 // eye-relative point-rotating billboard. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE CPT(RenderEffect) BillboardEffect:: 00050 make_point_eye() { 00051 return make(LVector3f::up(), true, false, 00052 0.0f, NodePath(), LPoint3f(0.0f, 0.0f, 0.0f)); 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: BillboardEffect::make_point_world 00057 // Access: Published, Static 00058 // Description: A convenience function to make a typical 00059 // world-relative point-rotating billboard. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE CPT(RenderEffect) BillboardEffect:: 00062 make_point_world() { 00063 return make(LVector3f::up(), false, false, 00064 0.0f, NodePath(), LPoint3f(0.0f, 0.0f, 0.0f)); 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: BillboardEffect::is_off 00069 // Access: Published 00070 // Description: Returns true if the BillboardEffect is an 'off' 00071 // BillboardEffect, indicating that it does not enable 00072 // billboarding. This kind of BillboardEffect isn't 00073 // particularly useful and isn't normally created or 00074 // stored in the graph; it might be implicitly 00075 // discovered as the result of a 00076 // NodePath::get_rel_state(). 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE bool BillboardEffect:: 00079 is_off() const { 00080 return _off; 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: BillboardEffect::get_up_vector 00085 // Access: Published 00086 // Description: Returns the up vector in effect for this billboard. 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE const LVector3f &BillboardEffect:: 00089 get_up_vector() const { 00090 return _up_vector; 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: BillboardEffect::get_eye_relative 00095 // Access: Published 00096 // Description: Returns true if this billboard interprets the up 00097 // vector relative to the camera, or false if it is 00098 // relative to the world. 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE bool BillboardEffect:: 00101 get_eye_relative() const { 00102 return _eye_relative; 00103 } 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: BillboardEffect::get_axial_rotate 00107 // Access: Published 00108 // Description: Returns true if this billboard rotates only around 00109 // the axis of the up vector, or false if it rotates 00110 // freely in three dimensions. 00111 //////////////////////////////////////////////////////////////////// 00112 INLINE bool BillboardEffect:: 00113 get_axial_rotate() const { 00114 return _axial_rotate; 00115 } 00116 00117 //////////////////////////////////////////////////////////////////// 00118 // Function: BillboardEffect::get_offset 00119 // Access: Published 00120 // Description: Returns the distance toward the camera (or the 00121 // look_at_point) the billboard is moved towards, after 00122 // rotating. This can be used to ensure the billboard 00123 // is not obscured by nearby geometry. 00124 //////////////////////////////////////////////////////////////////// 00125 INLINE float BillboardEffect:: 00126 get_offset() const { 00127 return _offset; 00128 } 00129 00130 //////////////////////////////////////////////////////////////////// 00131 // Function: BillboardEffect::get_look_at 00132 // Access: Published 00133 // Description: Returns the node this billboard will rotate to look 00134 // towards. If this is empty, it means the billboard 00135 // will rotate towards the current camera node, wherever 00136 // that might be. 00137 //////////////////////////////////////////////////////////////////// 00138 INLINE const NodePath &BillboardEffect:: 00139 get_look_at() const { 00140 return _look_at; 00141 } 00142 00143 //////////////////////////////////////////////////////////////////// 00144 // Function: BillboardEffect::get_look_at_point 00145 // Access: Published 00146 // Description: Returns the point, relative to the look_at node, 00147 // towards which the billboard will rotate. Normally 00148 // this is (0, 0, 0). 00149 //////////////////////////////////////////////////////////////////// 00150 INLINE const LPoint3f &BillboardEffect:: 00151 get_look_at_point() const { 00152 return _look_at_point; 00153 }