Panda3D
 All Classes Functions Variables Enumerations
billboardEffect.I
1 // Filename: billboardEffect.I
2 // Created by: drose (14Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: BillboardEffect::Constructor
18 // Access: Private
19 // Description: Use BillboardEffect::make() to construct a new
20 // BillboardEffect object.
21 ////////////////////////////////////////////////////////////////////
22 INLINE BillboardEffect::
23 BillboardEffect() {
24  _off = true;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: BillboardEffect::make_axis
29 // Access: Published, Static
30 // Description: A convenience function to make a typical
31 // axis-rotating billboard.
32 ////////////////////////////////////////////////////////////////////
33 INLINE CPT(RenderEffect) BillboardEffect::
34 make_axis() {
35  return make(LVector3::up(), false, true,
36  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: BillboardEffect::make_point_eye
41 // Access: Published, Static
42 // Description: A convenience function to make a typical
43 // eye-relative point-rotating billboard.
44 ////////////////////////////////////////////////////////////////////
45 INLINE CPT(RenderEffect) BillboardEffect::
46 make_point_eye() {
47  return make(LVector3::up(), true, false,
48  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: BillboardEffect::make_point_world
53 // Access: Published, Static
54 // Description: A convenience function to make a typical
55 // world-relative point-rotating billboard.
56 ////////////////////////////////////////////////////////////////////
57 INLINE CPT(RenderEffect) BillboardEffect::
58 make_point_world() {
59  return make(LVector3::up(), false, false,
60  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: BillboardEffect::is_off
65 // Access: Published
66 // Description: Returns true if the BillboardEffect is an 'off'
67 // BillboardEffect, indicating that it does not enable
68 // billboarding. This kind of BillboardEffect isn't
69 // particularly useful and isn't normally created or
70 // stored in the graph; it might be implicitly
71 // discovered as the result of a
72 // NodePath::get_rel_state().
73 ////////////////////////////////////////////////////////////////////
74 INLINE bool BillboardEffect::
75 is_off() const {
76  return _off;
77 }
78 
79 ////////////////////////////////////////////////////////////////////
80 // Function: BillboardEffect::get_up_vector
81 // Access: Published
82 // Description: Returns the up vector in effect for this billboard.
83 ////////////////////////////////////////////////////////////////////
84 INLINE const LVector3 &BillboardEffect::
85 get_up_vector() const {
86  return _up_vector;
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: BillboardEffect::get_eye_relative
91 // Access: Published
92 // Description: Returns true if this billboard interprets the up
93 // vector relative to the camera, or false if it is
94 // relative to the world.
95 ////////////////////////////////////////////////////////////////////
96 INLINE bool BillboardEffect::
98  return _eye_relative;
99 }
100 
101 ////////////////////////////////////////////////////////////////////
102 // Function: BillboardEffect::get_axial_rotate
103 // Access: Published
104 // Description: Returns true if this billboard rotates only around
105 // the axis of the up vector, or false if it rotates
106 // freely in three dimensions.
107 ////////////////////////////////////////////////////////////////////
108 INLINE bool BillboardEffect::
110  return _axial_rotate;
111 }
112 
113 ////////////////////////////////////////////////////////////////////
114 // Function: BillboardEffect::get_offset
115 // Access: Published
116 // Description: Returns the distance toward the camera (or the
117 // look_at_point) the billboard is moved towards, after
118 // rotating. This can be used to ensure the billboard
119 // is not obscured by nearby geometry.
120 ////////////////////////////////////////////////////////////////////
121 INLINE PN_stdfloat BillboardEffect::
122 get_offset() const {
123  return _offset;
124 }
125 
126 ////////////////////////////////////////////////////////////////////
127 // Function: BillboardEffect::get_look_at
128 // Access: Published
129 // Description: Returns the node this billboard will rotate to look
130 // towards. If this is empty, it means the billboard
131 // will rotate towards the current camera node, wherever
132 // that might be.
133 ////////////////////////////////////////////////////////////////////
134 INLINE const NodePath &BillboardEffect::
135 get_look_at() const {
136  return _look_at;
137 }
138 
139 ////////////////////////////////////////////////////////////////////
140 // Function: BillboardEffect::get_look_at_point
141 // Access: Published
142 // Description: Returns the point, relative to the look_at node,
143 // towards which the billboard will rotate. Normally
144 // this is (0, 0, 0).
145 ////////////////////////////////////////////////////////////////////
146 INLINE const LPoint3 &BillboardEffect::
148  return _look_at_point;
149 }
PN_stdfloat get_offset() const
Returns the distance toward the camera (or the look_at_point) the billboard is moved towards...
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:56
Indicates that geometry at this node should automatically rotate to face the camera, or any other arbitrary node.
bool get_eye_relative() const
Returns true if this billboard interprets the up vector relative to the camera, or false if it is rel...
bool get_axial_rotate() const
Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates ...
const NodePath & get_look_at() const
Returns the node this billboard will rotate to look towards.
bool is_off() const
Returns true if the BillboardEffect is an 'off' BillboardEffect, indicating that it does not enable b...
const LPoint3 & get_look_at_point() const
Returns the point, relative to the look_at node, towards which the billboard will rotate...
const LVector3 & get_up_vector() const
Returns the up vector in effect for this billboard.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
static LVector3f up(CoordinateSystem cs=CS_default)
Returns the up vector for the given coordinate system.
Definition: lvector3.h:527