CGenericWidget.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.1.1 $Rev: 1869 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CGenericWidgetH
46 #define CGenericWidgetH
47 //------------------------------------------------------------------------------
48 #include "world/CMesh.h"
49 //------------------------------------------------------------------------------
50 
51 //------------------------------------------------------------------------------
52 namespace chai3d {
53 //------------------------------------------------------------------------------
54 
55 //==============================================================================
62 //==============================================================================
63 
64 //==============================================================================
76 //==============================================================================
77 class cGenericWidget : public cMesh
78 {
79  //--------------------------------------------------------------------------
80  // CONSTRUCTOR & DESTRUCTOR:
81  //--------------------------------------------------------------------------
82 
83 public:
84 
87 
89  virtual ~cGenericWidget() {};
90 
91 
92  //--------------------------------------------------------------------------
93  // VIRTUAL PUBLIC METHODS:
94  //--------------------------------------------------------------------------
95 
96 public:
97 
99  virtual cGenericWidget* copy(const bool a_duplicateMaterialData = false,
100  const bool a_duplicateTextureData = false,
101  const bool a_duplicateMeshData = false,
102  const bool a_buildCollisionDetector = false);
103 
105  virtual double getWidth() const { return (m_width); }
106 
108  virtual double getHeight() const { return (m_height); }
109 
111  virtual void rotateWidgetDeg(double a_angleDeg) { rotateAboutLocalAxisDeg(cVector3d(0,0,1), a_angleDeg); }
112 
114  virtual void rotateWidgetRad(double a_angleRad) { rotateAboutLocalAxisRad(cVector3d(0,0,1), a_angleRad); }
115 
117  virtual void updateBoundaryBox()
118  {
119  m_boundaryBoxMin.set(0.0, 0.0, 0.0);
121  }
122 
123 
124  //--------------------------------------------------------------------------
125  // PROTECTED METHODS:
126  //--------------------------------------------------------------------------
127 
128 protected:
129 
132  const bool a_duplicateMaterialData,
133  const bool a_duplicateTextureData,
134  const bool a_duplicateMeshData,
135  const bool a_buildCollisionDetector);
136 
137 
138  //--------------------------------------------------------------------------
139  // PROTECTED MEMBERS:
140  //--------------------------------------------------------------------------
141 
142 protected:
143 
145  double m_width;
146 
148  double m_height;
149 };
150 
151 //------------------------------------------------------------------------------
152 } // namespace chai3d
153 //------------------------------------------------------------------------------
154 
155 //------------------------------------------------------------------------------
156 #endif
157 //------------------------------------------------------------------------------
This class implements a 3D vector.
Definition: CVector3d.h:88
virtual double getWidth() const
This method returns the width of the widget.
Definition: CGenericWidget.h:105
Implements a class to model polygonal meshes.
virtual void rotateWidgetRad(double a_angleRad)
This method rotates the widget around the z-axis with an angle defined in radians.
Definition: CGenericWidget.h:114
virtual cGenericWidget * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition: CGenericWidget.cpp:85
void set(const double &a_x, const double &a_y, const double &a_z)
This method initializes this vector with components x, y, and z passed as arguments.
Definition: CVector3d.h:298
void copyGenericWidgetProperties(cGenericWidget *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this object to another.
Definition: CGenericWidget.cpp:116
virtual void updateBoundaryBox()
This method updates the bounding box of the widget.
Definition: CGenericWidget.h:117
virtual void rotateWidgetDeg(double a_angleDeg)
This method rotates the widget around the z-axis with an angle defined in degrees.
Definition: CGenericWidget.h:111
cVector3d m_boundaryBoxMax
Maximum position of boundary box.
Definition: CGenericObject.h:776
cGenericWidget()
Constructor of cGenericWidget.
Definition: CGenericWidget.cpp:57
This class implements a base class for widgets.
Definition: CGenericWidget.h:77
cVector3d m_boundaryBoxMin
Minimum position of boundary box.
Definition: CGenericObject.h:773
This class implements a 3D polygonal mesh.
Definition: CMesh.h:108
double m_width
Width of this widget.
Definition: CGenericWidget.h:145
Definition: CAudioBuffer.cpp:56
virtual ~cGenericWidget()
Destructor of cGenericWidget.
Definition: CGenericWidget.h:89
void rotateAboutLocalAxisDeg(const cVector3d &a_axis, const double a_angleDeg)
This method rotates this object around a local axis. Angle magnitude is defined in degrees...
Definition: CGenericObject.h:236
void rotateAboutLocalAxisRad(const cVector3d &a_axis, const double a_angleRad)
This method rotates this object around a local axis. Angle magnitude is defined in radians...
Definition: CGenericObject.cpp:266
virtual double getHeight() const
This method returns the height of the widget.
Definition: CGenericWidget.h:108
double m_height
Height of this widget.
Definition: CGenericWidget.h:148