Panda3D
billboardEffect.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 billboardEffect.I
10  * @author drose
11  * @date 2002-03-14
12  */
13 
14 /**
15  * Use BillboardEffect::make() to construct a new BillboardEffect object.
16  */
17 INLINE BillboardEffect::
18 BillboardEffect() {
19  _off = true;
20 }
21 
22 /**
23  * A convenience function to make a typical axis-rotating billboard.
24  */
25 INLINE CPT(RenderEffect) BillboardEffect::
26 make_axis() {
27  return make(LVector3::up(), false, true,
28  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
29 }
30 
31 /**
32  * A convenience function to make a typical eye-relative point-rotating
33  * billboard.
34  */
35 INLINE CPT(RenderEffect) BillboardEffect::
36 make_point_eye() {
37  return make(LVector3::up(), true, false,
38  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
39 }
40 
41 /**
42  * A convenience function to make a typical world-relative point-rotating
43  * billboard.
44  */
45 INLINE CPT(RenderEffect) BillboardEffect::
46 make_point_world() {
47  return make(LVector3::up(), false, false,
48  0.0f, NodePath(), LPoint3(0.0f, 0.0f, 0.0f));
49 }
50 
51 /**
52  * Returns true if the BillboardEffect is an 'off' BillboardEffect, indicating
53  * that it does not enable billboarding. This kind of BillboardEffect isn't
54  * particularly useful and isn't normally created or stored in the graph; it
55  * might be implicitly discovered as the result of a
56  * NodePath::get_rel_state().
57  */
58 INLINE bool BillboardEffect::
59 is_off() const {
60  return _off;
61 }
62 
63 /**
64  * Returns the up vector in effect for this billboard.
65  */
66 INLINE const LVector3 &BillboardEffect::
67 get_up_vector() const {
68  return _up_vector;
69 }
70 
71 /**
72  * Returns true if this billboard interprets the up vector relative to the
73  * camera, or false if it is relative to the world.
74  */
75 INLINE bool BillboardEffect::
77  return _eye_relative;
78 }
79 
80 /**
81  * Returns true if this billboard rotates only around the axis of the up
82  * vector, or false if it rotates freely in three dimensions.
83  */
84 INLINE bool BillboardEffect::
86  return _axial_rotate;
87 }
88 
89 /**
90  * Returns true if this billboard always appears at a fixed distance from the
91  * camera.
92  */
93 INLINE bool BillboardEffect::
94 get_fixed_depth() const {
95  return _fixed_depth;
96 }
97 
98 /**
99  * Returns the distance toward the camera (or the look_at_point) the billboard
100  * is moved towards, after rotating. This can be used to ensure the billboard
101  * is not obscured by nearby geometry.
102  */
103 INLINE PN_stdfloat BillboardEffect::
104 get_offset() const {
105  return _offset;
106 }
107 
108 /**
109  * Returns the node this billboard will rotate to look towards. If this is
110  * empty, it means the billboard will rotate towards the current camera node,
111  * wherever that might be.
112  */
113 INLINE const NodePath &BillboardEffect::
114 get_look_at() const {
115  return _look_at;
116 }
117 
118 /**
119  * Returns the point, relative to the look_at node, towards which the
120  * billboard will rotate. Normally this is (0, 0, 0).
121  */
122 INLINE const LPoint3 &BillboardEffect::
124  return _look_at_point;
125 }
const LVector3 & get_up_vector() const
Returns the up vector in effect for this billboard.
bool get_axial_rotate() const
Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates ...
bool is_off() const
Returns true if the BillboardEffect is an 'off' BillboardEffect, indicating that it does not enable b...
PN_stdfloat get_offset() const
Returns the distance toward the camera (or the look_at_point) the billboard is moved towards,...
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:48
bool get_fixed_depth() const
Returns true if this billboard always appears at a fixed distance from the camera.
CPT(RenderEffect) BillboardEffect
A convenience function to make a typical axis-rotating billboard.
const LPoint3 & get_look_at_point() const
Returns the point, relative to the look_at node, towards which the billboard will rotate.
const NodePath & get_look_at() const
Returns the node this billboard will rotate to look towards.
bool get_eye_relative() const
Returns true if this billboard interprets the up vector relative to the camera, or false if it is rel...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161