CGenericCollision.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 Chris Sewell
40  \author Francois Conti
41  \version 3.2.0 $Rev: 2173 $
42 */
43 //==============================================================================
44 
45 //------------------------------------------------------------------------------
46 #ifndef CGenericCollisionH
47 #define CGenericCollisionH
48 //------------------------------------------------------------------------------
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 namespace chai3d {
54 //------------------------------------------------------------------------------
55 
56 //==============================================================================
64 //==============================================================================
65 
66 //==============================================================================
100 //==============================================================================
102 {
103 
104  //--------------------------------------------------------------------------
105  // CONSTRUCTOR & DESTRUCTOR:
106  //--------------------------------------------------------------------------
107 
108 public:
109 
112 
114  virtual ~cGenericCollision() {};
115 
116 
117  //--------------------------------------------------------------------------
118  // PUBLIC METHODS:
119  //--------------------------------------------------------------------------
120 
121 public:
122 
124  virtual void update() {}
125 
127  virtual bool computeCollision(cGenericObject* a_object,
128  cVector3d& a_segmentPointA,
129  cVector3d& a_segmentPointB,
130  cCollisionRecorder& a_recorder,
131  cCollisionSettings& a_settings)
132  { return (false); }
133 
135  virtual void render(cRenderOptions& a_options) {};
136 
138  double getBoundaryRadius() const { return (m_radiusAroundElements); }
139 
141  void setDisplayDepth(const int a_depth) { m_displayDepth = a_depth; }
142 
144  double getDisplayDepth() const { return (m_displayDepth); }
145 
146 
147  //--------------------------------------------------------------------------
148  // PUBLIC MEMBERS:
149  //--------------------------------------------------------------------------
150 
153 
154 
155  //--------------------------------------------------------------------------
156  // PROTECTED MEMBERS:
157  //--------------------------------------------------------------------------
158 
159 protected:
160 
166 
172 };
173 
174 //------------------------------------------------------------------------------
175 } // namespace chai3d
176 //------------------------------------------------------------------------------
177 
178 //------------------------------------------------------------------------------
179 #endif
180 //------------------------------------------------------------------------------
This class implements a 3D vector.
Definition: CVector3d.h:88
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
int m_displayDepth
Definition: CGenericCollision.h:165
virtual ~cGenericCollision()
Destructor of cGenericCollision.
Definition: CGenericCollision.h:114
virtual bool computeCollision(cGenericObject *a_object, cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
This method computes all collisions between a segment passed as argument and the attributed 3D object...
Definition: CGenericCollision.h:127
This class implements a base class for collision detection.
Definition: CGenericCollision.h:101
double m_radiusAroundElements
Definition: CGenericCollision.h:171
double getDisplayDepth() const
This method returns the level inside the collision tree being displayed. (root = 0).
Definition: CGenericCollision.h:144
virtual void render(cRenderOptions &a_options)
This method renders a visual representation of the collision tree.
Definition: CGenericCollision.h:135
double getBoundaryRadius() const
This method returns the radius of the boundary shell that covers every triangles. ...
Definition: CGenericCollision.h:138
cColorf m_color
Color property used to render the collision detector graphically.
Definition: CGenericCollision.h:152
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition: CGenericObject.h:112
This class implements a collision detection recorder that stores all collision events that are report...
Definition: CCollisionBasics.h:185
void setDisplayDepth(const int a_depth)
This method sets the level of the collision tree to display.
Definition: CGenericCollision.h:141
This structure stores the collision settings that are passed to a collision detector when querying fo...
Definition: CCollisionBasics.h:242
Implements basic data structures for storing collision events.
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
cGenericCollision()
Constructor of cGenericCollision.
Definition: CGenericCollision.cpp:58
Definition: CAudioBuffer.cpp:56
virtual void update()
This methods updates the collision detector and should be called if the 3D model it represents is mod...
Definition: CGenericCollision.h:124