Panda3D
 All Classes Functions Variables Enumerations
billboardEffect.I
00001 // Filename: billboardEffect.I
00002 // Created by:  drose (14Mar02)
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: BillboardEffect::Constructor
00018 //       Access: Private
00019 //  Description: Use BillboardEffect::make() to construct a new
00020 //               BillboardEffect object.
00021 ////////////////////////////////////////////////////////////////////
00022 INLINE BillboardEffect::
00023 BillboardEffect() {
00024   _off = true;
00025 }
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //     Function: BillboardEffect::make_axis
00029 //       Access: Published, Static
00030 //  Description: A convenience function to make a typical
00031 //               axis-rotating billboard.
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE CPT(RenderEffect) BillboardEffect::
00034 make_axis() {
00035   return make(LVector3::up(), false, true, 
00036               0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: BillboardEffect::make_point_eye
00041 //       Access: Published, Static
00042 //  Description: A convenience function to make a typical
00043 //               eye-relative point-rotating billboard.
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE CPT(RenderEffect) BillboardEffect::
00046 make_point_eye() {
00047   return make(LVector3::up(), true, false,
00048               0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: BillboardEffect::make_point_world
00053 //       Access: Published, Static
00054 //  Description: A convenience function to make a typical
00055 //               world-relative point-rotating billboard.
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE CPT(RenderEffect) BillboardEffect::
00058 make_point_world() {
00059   return make(LVector3::up(), false, false,
00060               0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: BillboardEffect::is_off
00065 //       Access: Published
00066 //  Description: Returns true if the BillboardEffect is an 'off'
00067 //               BillboardEffect, indicating that it does not enable
00068 //               billboarding.  This kind of BillboardEffect isn't
00069 //               particularly useful and isn't normally created or
00070 //               stored in the graph; it might be implicitly
00071 //               discovered as the result of a
00072 //               NodePath::get_rel_state().
00073 ////////////////////////////////////////////////////////////////////
00074 INLINE bool BillboardEffect::
00075 is_off() const {
00076   return _off;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: BillboardEffect::get_up_vector
00081 //       Access: Published
00082 //  Description: Returns the up vector in effect for this billboard.
00083 ////////////////////////////////////////////////////////////////////
00084 INLINE const LVector3 &BillboardEffect::
00085 get_up_vector() const {
00086   return _up_vector;
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: BillboardEffect::get_eye_relative
00091 //       Access: Published
00092 //  Description: Returns true if this billboard interprets the up
00093 //               vector relative to the camera, or false if it is
00094 //               relative to the world.
00095 ////////////////////////////////////////////////////////////////////
00096 INLINE bool BillboardEffect::
00097 get_eye_relative() const {
00098   return _eye_relative;
00099 }
00100 
00101 ////////////////////////////////////////////////////////////////////
00102 //     Function: BillboardEffect::get_axial_rotate
00103 //       Access: Published
00104 //  Description: Returns true if this billboard rotates only around
00105 //               the axis of the up vector, or false if it rotates
00106 //               freely in three dimensions.
00107 ////////////////////////////////////////////////////////////////////
00108 INLINE bool BillboardEffect::
00109 get_axial_rotate() const {
00110   return _axial_rotate;
00111 }
00112 
00113 ////////////////////////////////////////////////////////////////////
00114 //     Function: BillboardEffect::get_offset
00115 //       Access: Published
00116 //  Description: Returns the distance toward the camera (or the
00117 //               look_at_point) the billboard is moved towards, after
00118 //               rotating.  This can be used to ensure the billboard
00119 //               is not obscured by nearby geometry.
00120 ////////////////////////////////////////////////////////////////////
00121 INLINE PN_stdfloat BillboardEffect::
00122 get_offset() const {
00123   return _offset;
00124 }
00125 
00126 ////////////////////////////////////////////////////////////////////
00127 //     Function: BillboardEffect::get_look_at
00128 //       Access: Published
00129 //  Description: Returns the node this billboard will rotate to look
00130 //               towards.  If this is empty, it means the billboard
00131 //               will rotate towards the current camera node, wherever
00132 //               that might be.
00133 ////////////////////////////////////////////////////////////////////
00134 INLINE const NodePath &BillboardEffect::
00135 get_look_at() const {
00136   return _look_at;
00137 }
00138 
00139 ////////////////////////////////////////////////////////////////////
00140 //     Function: BillboardEffect::get_look_at_point
00141 //       Access: Published
00142 //  Description: Returns the point, relative to the look_at node,
00143 //               towards which the billboard will rotate.  Normally
00144 //               this is (0, 0, 0).
00145 ////////////////////////////////////////////////////////////////////
00146 INLINE const LPoint3 &BillboardEffect::
00147 get_look_at_point() const {
00148   return _look_at_point;
00149 }
 All Classes Functions Variables Enumerations