Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Billboard.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef Billboard_INCLUDE_ONCE
33 #define Billboard_INCLUDE_ONCE
34 
36 #include <vlCore/Transform.hpp>
37 
38 namespace vl
39 {
40  //-----------------------------------------------------------------------------
41  // Billboard
42  //-----------------------------------------------------------------------------
47  {
49 
50  public:
51  Billboard();
53  void setPosition(const vec3& pos);
55  void setPosition(real x, real y, real z) { setPosition( vec3(x,y,z) ); }
57  vec3 position();
59  void setAxis(const vec3& axis) { mAxis = axis; mAxis.normalize(); }
61  const vec3& axis() const { return mAxis; }
63  void setNormal(const vec3& normal) { mNormal = normal; mNormal.normalize(); }
65  const vec3& normal() const { return mNormal; }
66  virtual void computeWorldMatrix(Camera* camera=NULL);
68  EBillboardType type() const { return mType; }
70  void setType(EBillboardType type) { mType = type; }
71 
72  protected:
76  };
77  //-----------------------------------------------------------------------------
78 }
79 
80 #endif
const Vector3 & normalize(T_Scalar *len=NULL)
Definition: Vector3.hpp:227
Implements a 4x4 matrix transform used to define the position and orientation of an Actor...
Definition: Transform.hpp:72
void setPosition(real x, real y, real z)
The billboard position and rotation center.
Definition: Billboard.hpp:55
void setType(EBillboardType type)
The type of the billboard.
Definition: Billboard.hpp:70
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
void setAxis(const vec3 &axis)
The rotation axis in world coordinates. Used only for axis aligned billboards.
Definition: Billboard.hpp:59
Visualization Library main namespace.
void setNormal(const vec3 &normal)
Used only for axis aligned billboards.
Definition: Billboard.hpp:63
const vec3 & normal() const
Used only for axis aligned billboards.
Definition: Billboard.hpp:65
A Transform that aligns an Actor towards the camera.
Definition: Billboard.hpp:46
#define NULL
Definition: OpenGLDefs.hpp:81
EBillboardType
fvec3 vec3
Defined as: &#39;typedef fvec3 vec3&#39;. See also VL_PIPELINE_PRECISION.
Definition: Vector3.hpp:269
EBillboardType mType
Definition: Billboard.hpp:75
EBillboardType type() const
The type of the billboard.
Definition: Billboard.hpp:68
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:50
const vec3 & axis() const
The rotation axis in world coordinates. Used only for axis aligned billboards.
Definition: Billboard.hpp:61