My Project
Loading...
Searching...
No Matches
CGELWorld.h
Go to the documentation of this file.
1//===========================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, 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 1.0.0
41*/
42//===========================================================================
43
44//---------------------------------------------------------------------------
45#ifndef CGELWorldH
46#define CGELWorldH
47//---------------------------------------------------------------------------
48#include "chai3d.h"
49#include "CGELMesh.h"
50//---------------------------------------------------------------------------
51
52//===========================================================================
59//===========================================================================
60
61//===========================================================================
72//===========================================================================
74{
75 //-----------------------------------------------------------------------
76 // CONSTRUCTOR & DESTRUCTOR:
77 //-----------------------------------------------------------------------
78
79public:
80
82 cGELWorld();
83
85 virtual ~cGELWorld();
86
87
88 //-----------------------------------------------------------------------
89 // PUBLIC METHODS:
90 //-----------------------------------------------------------------------
91
92public:
93
95 void updateDynamics(double a_timeInterval);
96
99
101 void updateSkins(bool a_updateNormals = true);
102
103
104 //-----------------------------------------------------------------------
105 // PUBLIC MEMBERS:
106 //-----------------------------------------------------------------------
107
108public:
109
111 std::list<cGELMesh*> m_gelMeshes;
112
115
118
119
120 //-----------------------------------------------------------------------
121 // PRIVATE METHODS:
122 //-----------------------------------------------------------------------
123
124private:
125
127 virtual void render(chai3d::cRenderOptions& a_options);
128};
129
130
131//===========================================================================
143//===========================================================================
145{
146 //-----------------------------------------------------------------------
147 // CONSTRUCTOR & DESTRUCTOR:
148 //-----------------------------------------------------------------------
149
150public:
151
153 cGELWorldCollision(cGELWorld* a_gelWorld) {m_gelWorld = a_gelWorld;}
154
157
158
159 //-----------------------------------------------------------------------
160 // PUBLIC METHODS:
161 //-----------------------------------------------------------------------
162
163public:
164
166 virtual void initialize() {};
167
169 virtual void render() {};
170
172 virtual bool computeCollision(chai3d::cVector3d& a_segmentPointA,
173 chai3d::cVector3d& a_segmentPointB,
174 chai3d::cCollisionRecorder& a_recorder,
175 chai3d::cCollisionSettings& a_settings);
176
177
178 //-----------------------------------------------------------------------
179 // PRIVATE MEMBERS:
180 //-----------------------------------------------------------------------
181
182private:
183
185 cGELWorld* m_gelWorld;
186};
187
188//---------------------------------------------------------------------------
189#endif
190//---------------------------------------------------------------------------
191
192
Implementation of a deformable mesh.
This class implements a collision detector for class cGELWorld.
Definition CGELWorld.h:145
cGELWorldCollision(cGELWorld *a_gelWorld)
Constructor of cGELWorldCollision.
Definition CGELWorld.h:153
virtual void render()
This method renders the collision detector graphically.
Definition CGELWorld.h:169
virtual void initialize()
This method initialized the collision detector.
Definition CGELWorld.h:166
virtual bool computeCollision(chai3d::cVector3d &a_segmentPointA, chai3d::cVector3d &a_segmentPointB, chai3d::cCollisionRecorder &a_recorder, chai3d::cCollisionSettings &a_settings)
This method computes all collisions between a segment passed as argument and the objects in this worl...
Definition CGELWorld.cpp:64
virtual ~cGELWorldCollision()
Destructor of cGELWorldCollision.
Definition CGELWorld.h:156
This class implements a virtual world that manages deformable objects.
Definition CGELWorld.h:74
void updateSkins(bool a_updateNormals=true)
This method updates the mesh of all deformable objects.
Definition CGELWorld.cpp:198
chai3d::cVector3d m_gravity
Gravity constant.
Definition CGELWorld.h:117
void clearExternalForces()
This method clears all external forces applied on all deformable objects.
Definition CGELWorld.cpp:133
void updateDynamics(double a_timeInterval)
This method integrates the dynamic simulation over a time period passed as argument.
Definition CGELWorld.cpp:153
virtual ~cGELWorld()
Destructor of cGELWorld.
Definition CGELWorld.cpp:102
cGELWorld()
Constructor of cGELWorld.
Definition CGELWorld.cpp:87
std::list< cGELMesh * > m_gelMeshes
List of deformable solids.
Definition CGELWorld.h:111
double m_simulationTime
Current time of simulation.
Definition CGELWorld.h:114