PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: World.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLPHYSICS_WORLD_H__ 00024 #define __PLPHYSICS_WORLD_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Object.h> 00032 #include <PLCore/Base/Event/Event.h> 00033 #include <PLCore/Container/Pool.h> 00034 #include <PLCore/Container/ElementManager.h> 00035 #include <PLMath/Vector3.h> 00036 #include "PLPhysics/Element.h" 00037 #include "PLPhysics/ElementHandler.h" 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declarations ] 00042 //[-------------------------------------------------------] 00043 namespace PLMesh { 00044 class MeshManager; 00045 } 00046 namespace PLPhysics { 00047 class Body; 00048 class Joint; 00049 class Sensor; 00050 class ContactInformation; 00051 } 00052 00053 00054 //[-------------------------------------------------------] 00055 //[ Namespace ] 00056 //[-------------------------------------------------------] 00057 namespace PLPhysics { 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Classes ] 00062 //[-------------------------------------------------------] 00063 /** 00064 * @brief 00065 * Abstract PL physics world (also called 'simulator') base class 00066 * 00067 * @remarks 00068 * Because it's possible that the physics runs in an own thread, it's recommended to deactivate the simulation 00069 * by using SetSimulationActive(false) during scene creation. 00070 * Note that the behavior of the functions may differ a bit between the different physics implementations. For 00071 * instance, some physics implementations will ignore completely the linear velocity if the body is static. In general 00072 * you can't expect the same values as the ones set by yourself. For instance Body::GetLinearVelocity() 00073 * must not be vMyVelocity you set using Body::SetLinearVelocity(vMyVelocity)! 00074 */ 00075 class World : public PLCore::Object, public PLCore::ElementManager<Element> { 00076 00077 00078 //[-------------------------------------------------------] 00079 //[ Friends ] 00080 //[-------------------------------------------------------] 00081 friend class Sensor; 00082 00083 00084 //[-------------------------------------------------------] 00085 //[ Public definitions ] 00086 //[-------------------------------------------------------] 00087 public: 00088 /** 00089 * @brief 00090 * Body pair flags 00091 */ 00092 enum EBodyPairFlags { 00093 Ignore = 1<<0 /**< Do NOT create contacts for this pair */ 00094 }; 00095 00096 00097 //[-------------------------------------------------------] 00098 //[ RTTI interface ] 00099 //[-------------------------------------------------------] 00100 pl_class(PLPHYSICS_RTTI_EXPORT, World, "PLPhysics", PLCore::Object, "Abstract PL physics world (also called 'simulator') base class") 00101 // Signals 00102 pl_signal_1(SignalContact, ContactInformation&, "A contact between two bodies was detected by the physics. Contact information as parameter.", "") 00103 pl_class_end 00104 00105 00106 //[-------------------------------------------------------] 00107 //[ Public functions ] 00108 //[-------------------------------------------------------] 00109 public: 00110 /** 00111 * @brief 00112 * Destructor 00113 */ 00114 PLPHYSICS_API virtual ~World(); 00115 00116 00117 //[-------------------------------------------------------] 00118 //[ Public virtual World functions ] 00119 //[-------------------------------------------------------] 00120 public: 00121 //[-------------------------------------------------------] 00122 //[ Physics body creation ] 00123 //[-------------------------------------------------------] 00124 /** 00125 * @brief 00126 * Creates a physics box body 00127 * 00128 * @param[in] vDimension 00129 * Box dimension 00130 * @param[in] bStatic 00131 * Is this physics body static? 00132 * 00133 * @return 00134 * The created physics body, a null pointer on error (body type not supported?) 00135 */ 00136 virtual Body *CreateBodyBox(const PLMath::Vector3 &vDimension, bool bStatic = false) = 0; 00137 00138 /** 00139 * @brief 00140 * Creates a physics sphere body 00141 * 00142 * @param[in] fRadius 00143 * Sphere radius 00144 * @param[in] bStatic 00145 * Is this physics body static? 00146 * 00147 * @return 00148 * The created physics body, a null pointer on error (body type not supported?) 00149 */ 00150 virtual Body *CreateBodySphere(float fRadius, bool bStatic = false) = 0; 00151 00152 /** 00153 * @brief 00154 * Creates a physics ellipsoid body 00155 * 00156 * @param[in] vRadius 00157 * Ellipsoid radius along each axis 00158 * @param[in] bStatic 00159 * Is this physics body static? 00160 * 00161 * @return 00162 * The created physics body, a null pointer on error (body type not supported?) 00163 */ 00164 virtual Body *CreateBodyEllipsoid(const PLMath::Vector3 &vRadius, bool bStatic = false) = 0; 00165 00166 /** 00167 * @brief 00168 * Creates a physics convex hull body 00169 * 00170 * @param[in] cMeshManager 00171 * Mesh manager to use 00172 * @param[in] sMesh 00173 * Collision mesh 00174 * @param[in] vMeshScale 00175 * Mesh scale 00176 * @param[in] bStatic 00177 * Is this physics body static? 00178 * 00179 * @return 00180 * The created physics body, a null pointer on error (body type not supported? invalid mesh?) 00181 * 00182 * @remarks 00183 * The physics implementation is free to don't use the mesh at all. For example if no support or when 00184 * using 'cached data'. Therefore this function is using a mesh manager and mesh name instead of a direct 00185 * mesh instance to just load/use the mesh 'on demand'. 00186 */ 00187 virtual Body *CreateBodyConvexHull(PLMesh::MeshManager &cMeshManager, const PLCore::String &sMesh, const PLMath::Vector3 &vMeshScale = PLMath::Vector3::One, bool bStatic = false) = 0; 00188 00189 /** 00190 * @brief 00191 * Creates a physics mesh body 00192 * 00193 * @param[in] cMeshManager 00194 * Mesh manager to use 00195 * @param[in] sMesh 00196 * Collision mesh 00197 * @param[in] vMeshScale 00198 * Mesh scale 00199 * @param[in] bOptimize 00200 * Allow the physics API to optimize the mesh? (if supported) 00201 * 00202 * @return 00203 * The created physics body, a null pointer on error (body type not supported? invalid mesh?) 00204 * 00205 * @remarks 00206 * The physics implementation is free to don't use the mesh at all. For example if no support or when 00207 * using 'cached data'. Therefore this function is using a mesh manager and mesh name instead of a direct 00208 * mesh instance to just load/use the mesh 'on demand'. 00209 */ 00210 virtual Body *CreateBodyMesh(PLMesh::MeshManager &cMeshManager, const PLCore::String &sMesh, const PLMath::Vector3 &vMeshScale = PLMath::Vector3::One, bool bOptimize = false) = 0; 00211 00212 /** 00213 * @brief 00214 * Creates a physics terrain body 00215 * 00216 * @param[in] nWidth 00217 * Terrain data width 00218 * @param[in] nHeight 00219 * Terrain data height 00220 * @param[in] fTerrain 00221 * Terrain data 00222 * @param[in] vBoxMin 00223 * Bounding box minimum 00224 * @param[in] vBoxMax 00225 * Bounding box maximum 00226 * @param[in] vScale 00227 * Scale 00228 * 00229 * @return 00230 * The created physics body, a null pointer on error (body type not supported?) 00231 */ 00232 virtual Body *CreateBodyTerrain(PLCore::uint32 nWidth, PLCore::uint32 nHeight, const float fTerrain[], const PLMath::Vector3 &vBoxMin, const PLMath::Vector3 &vBoxMax, const PLMath::Vector3 &vScale) = 0; 00233 00234 /** 00235 * @brief 00236 * Creates a physics cylinder body 00237 * 00238 * @param[in] fRadius 00239 * Cylinder radius at the base 00240 * @param[in] fHeight 00241 * Cylinder height along the x local axis from base to top 00242 * @param[in] bStatic 00243 * Is this physics body static? 00244 * 00245 * @return 00246 * The created physics body, a null pointer on error (body type not supported?) 00247 */ 00248 virtual Body *CreateBodyCylinder(float fRadius, float fHeight, bool bStatic = false) = 0; 00249 00250 /** 00251 * @brief 00252 * Creates a physics cone body 00253 * 00254 * @param[in] fRadius 00255 * Cone radius at the base 00256 * @param[in] fHeight 00257 * Cone height along the x local axis from base to top 00258 * @param[in] bStatic 00259 * Is this physics body static? 00260 * 00261 * @return 00262 * The created physics body, a null pointer on error (body type not supported?) 00263 */ 00264 virtual Body *CreateBodyCone(float fRadius, float fHeight, bool bStatic = false) = 0; 00265 00266 /** 00267 * @brief 00268 * Creates a physics capsule body 00269 * 00270 * @param[in] fRadius 00271 * Capsule radius at the base 00272 * @param[in] fHeight 00273 * Capsule height along the x local axis from base to top 00274 * @param[in] bStatic 00275 * Is this physics body static? 00276 * 00277 * @return 00278 * The created physics body, a null pointer on error (body type not supported?) 00279 */ 00280 virtual Body *CreateBodyCapsule(float fRadius, float fHeight, bool bStatic = false) = 0; 00281 00282 /** 00283 * @brief 00284 * Creates a physics chamfer cylinder body 00285 * 00286 * @param[in] fRadius 00287 * Chamfer cylinder radius at the base 00288 * @param[in] fHeight 00289 * Chamfer cylinder height along the x local axis from base to top 00290 * @param[in] bStatic 00291 * Is this physics body static? 00292 * 00293 * @return 00294 * The created physics body, a null pointer on error (body type not supported?) 00295 */ 00296 virtual Body *CreateBodyChamferCylinder(float fRadius, float fHeight, bool bStatic = false) = 0; 00297 00298 //[-------------------------------------------------------] 00299 //[ Physics joint creation ] 00300 //[-------------------------------------------------------] 00301 /** 00302 * @brief 00303 * Creates a physics ball and socket joint 00304 * 00305 * @param[in] pParentBody 00306 * Pointer to the parent rigid body, can be a null pointer 00307 * @param[in] pChildBody 00308 * Pointer to the attached rigid body, can be a null pointer 00309 * @param[in] vPivotPoint 00310 * Origin of the ball and socket in world space 00311 * @param[in] vPinDir 00312 * Vector defining the cone axis in world space 00313 * 00314 * @return 00315 * The created physics joint, a null pointer on error (joint type not supported?) 00316 * 00317 * @note 00318 * - If 'pParentBody' or 'pChildBody' is a null pointer, the joint is attached to the world (static joint) 00319 * - ONLY 'pParentBody' OR 'pChildBody' can be a null pointer, if both are a null pointer this function will return a null pointer 00320 * - If 'pParentBody' is the same as 'pChildBody' this function will return a null pointer 00321 */ 00322 virtual Joint *CreateJointBall(Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir) = 0; 00323 00324 /** 00325 * @brief 00326 * Creates a physics slider joint 00327 * 00328 * @param[in] pParentBody 00329 * Pointer to the parent rigid body, can be a null pointer 00330 * @param[in] pChildBody 00331 * Pointer to the attached rigid body, can be a null pointer 00332 * @param[in] vPivotPoint 00333 * Origin of the slider in world space 00334 * @param[in] vPinDir 00335 * The line of action of the slider in world space 00336 * 00337 * @return 00338 * The created physics joint, a null pointer on error (joint type not supported?) 00339 * 00340 * @see 00341 * - CreateJointBall() 00342 */ 00343 virtual Joint *CreateJointSlider(Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir) = 0; 00344 00345 /** 00346 * @brief 00347 * Creates a physics hinge joint 00348 * 00349 * @param[in] pParentBody 00350 * Pointer to the parent rigid body, can be a null pointer 00351 * @param[in] pChildBody 00352 * Pointer to the attached rigid body, can be a null pointer 00353 * @param[in] vPivotPoint 00354 * Origin of the hinge in world space 00355 * @param[in] vPinDir 00356 * The line of action of the hinge in world space 00357 * 00358 * @return 00359 * The created physics joint, a null pointer on error (joint type not supported?) 00360 * 00361 * @see 00362 * - CreateJointBall() 00363 */ 00364 virtual Joint *CreateJointHinge(Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir) = 0; 00365 00366 /** 00367 * @brief 00368 * Creates a physics universal joint 00369 * 00370 * @param[in] pParentBody 00371 * Pointer to the parent rigid body, can be a null pointer 00372 * @param[in] pChildBody 00373 * Pointer to the attached rigid body, can be a null pointer 00374 * @param[in] vPivotPoint 00375 * Origin of the universal in world space 00376 * @param[in] vPinDir1 00377 * First axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in world space 00378 * @param[in] vPinDir2 00379 * Second axis of rotation fixed on 'Parent' body and perpendicular to 'PinDir1' in world space 00380 * 00381 * @return 00382 * The created physics joint, a null pointer on error (joint type not supported?) 00383 * 00384 * @see 00385 * - CreateJointBall() 00386 */ 00387 virtual Joint *CreateJointUniversal(Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir1, const PLMath::Vector3 &vPinDir2) = 0; 00388 00389 /** 00390 * @brief 00391 * Creates a physics corkscrew joint 00392 * 00393 * @param[in] pParentBody 00394 * Pointer to the parent rigid body, can be a null pointer 00395 * @param[in] pChildBody 00396 * Pointer to the attached rigid body, can be a null pointer 00397 * @param[in] vPivotPoint 00398 * Origin of the corkscrew in world space 00399 * @param[in] vPinDir 00400 * The line of action of the corkscrew in world space 00401 * 00402 * @return 00403 * The created physics joint, a null pointer on error (joint type not supported?) 00404 * 00405 * @see 00406 * - CreateJointBall() 00407 */ 00408 virtual Joint *CreateJointCorkscrew(Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint, const PLMath::Vector3 &vPinDir) = 0; 00409 00410 /** 00411 * @brief 00412 * Creates a physics up vector joint 00413 * 00414 * @param[in] cParentBody 00415 * Reference to the parent rigid body 00416 * @param[in] vPinDir 00417 * The aligning vector in world space 00418 * 00419 * @return 00420 * The created physics joint, a null pointer on error (joint type not supported?) 00421 */ 00422 virtual Joint *CreateJointUpVector(Body &cParentBody, const PLMath::Vector3 &vPinDir) = 0; 00423 00424 //[-------------------------------------------------------] 00425 //[ Physics sensor creation ] 00426 //[-------------------------------------------------------] 00427 /** 00428 * @brief 00429 * Creates a physics ray cast sensor 00430 * 00431 * @param[in] vStart 00432 * Beginning of the ray in global space 00433 * @param[in] vEnd 00434 * End of the ray in global space 00435 * @param[in] nFlags 00436 * Flags (see Sensor::EFlags) 00437 * 00438 * @return 00439 * The created physics sensor, a null pointer on error (sensor type not supported?) 00440 */ 00441 virtual Sensor *CreateSensorRaycast(const PLMath::Vector3 &vStart = PLMath::Vector3::Zero, const PLMath::Vector3 &vEnd = PLMath::Vector3::Zero, PLCore::uint32 nFlags = 0) = 0; 00442 00443 /** 00444 * @brief 00445 * Creates a physics axis aligned bounding box sensor 00446 * 00447 * @param[in] vMin 00448 * Minimum of the axis aligned bounding box in global space 00449 * @param[in] vMax 00450 * Maximum of the axis aligned bounding box in global space 00451 * @param[in] nFlags 00452 * Flags (see Sensor::EFlags) 00453 * 00454 * @return 00455 * The created physics sensor, a null pointer on error (sensor type not supported?) 00456 */ 00457 virtual Sensor *CreateSensorAABoundingBox(const PLMath::Vector3 &vMin = PLMath::Vector3::Zero, const PLMath::Vector3 &vMax = PLMath::Vector3::Zero, PLCore::uint32 nFlags = 0) = 0; 00458 00459 //[-------------------------------------------------------] 00460 //[ Misc ] 00461 //[-------------------------------------------------------] 00462 /** 00463 * @brief 00464 * Returns the world size 00465 * 00466 * @param[out] vMin 00467 * Receives the minimum world position 00468 * @param[out] vMax 00469 * Receives the maximum world position 00470 * 00471 * @remarks 00472 * Some physics API's may need a given world size in order to work correct. So, set one 00473 * for sure. 00474 */ 00475 virtual void GetWorldSize(PLMath::Vector3 &vMin, PLMath::Vector3 &vMax) const = 0; 00476 00477 /** 00478 * @brief 00479 * Sets the world size 00480 * 00481 * @param[in] vMin 00482 * Minimum world position 00483 * @param[in] vMax 00484 * Maximum world position 00485 * 00486 * @see 00487 * - GetWorldSize() 00488 */ 00489 virtual void SetWorldSize(const PLMath::Vector3 &vMin = PLMath::Vector3(-10000.0f, -10000.0f, -10000.0f), 00490 const PLMath::Vector3 &vMax = PLMath::Vector3( 10000.0f, 10000.0f, 10000.0f)) = 0; 00491 00492 /** 00493 * @brief 00494 * Returns whether the simulation is currently active or not 00495 * 00496 * @return 00497 * 'true' if the simulation is currently active, else 'false' 00498 * 00499 * @remarks 00500 * If the physics simulation should be 'frozen', it's no good idea to skip just the 00501 * UpdateSimulation() function because it's possible that the main physics processing is 00502 * performed in another thread and this update function only performs state synchronization. 00503 * So, in the case of just skipping this update function, the states visible to the user are not 00504 * updated, but the physics itself is still running... 00505 */ 00506 virtual bool IsSimulationActive() const = 0; 00507 00508 /** 00509 * @brief 00510 * Sets whether the simulation is currently active or not 00511 * 00512 * @param[in] bActive 00513 * 'true' if the simulation is currently active, else 'false' 00514 * 00515 * @see 00516 * - IsSimulationActive() 00517 */ 00518 virtual void SetSimulationActive(bool bActive = true) = 0; 00519 00520 /** 00521 * @brief 00522 * Returns the simulation speed 00523 * 00524 * @return 00525 * The simulation speed 00526 */ 00527 virtual float GetSimulationSpeed() const = 0; 00528 00529 /** 00530 * @brief 00531 * Sets the simulation speed 00532 * 00533 * @param[in] fSpeed 00534 * The simulation speed, a speed of <= 0 is NOT allowed! 00535 * 00536 * @return 00537 * 'true' if all went fine, else 'false' (maybe the given factor is <= 0?) 00538 * 00539 * @note 00540 * - A speed of <= 0 is NOT allowed because this may cause problems in certain 00541 * situations, deactivate the simulation instead by hand! 00542 * - Do NOT make the speed 'too' (for example > 4) extreme, this may cause 00543 * problems in certain situations! 00544 */ 00545 virtual bool SetSimulationSpeed(float fSpeed = 1.0f) = 0; 00546 00547 /** 00548 * @brief 00549 * Returns the simulation quality 00550 * 00551 * @return 00552 * The simulation quality, 1 means best realistic behavior, 0 for the fastest possible configuration 00553 */ 00554 virtual float GetSimulationQuality() const = 0; 00555 00556 /** 00557 * @brief 00558 * Sets the simulation quality 00559 * 00560 * @param[in] fQuality 00561 * The simulation quality, 1 means best realistic behavior, 0 for the fastest possible configuration 00562 * 00563 * @return 00564 * 'true' if all went fine, else 'false' (maybe the quality factor is not within 0-1?) 00565 */ 00566 virtual bool SetSimulationQuality(float fQuality = 1.0f) = 0; 00567 00568 /** 00569 * @brief 00570 * Returns the frame rate the simulation runs on 00571 * 00572 * @return 00573 * The frame rate the simulation runs on (>=60.0 and <=1000.0) 00574 */ 00575 virtual float GetFrameRate() const = 0; 00576 00577 /** 00578 * @brief 00579 * Sets the frame rate the simulation runs on 00580 * 00581 * @param[in] fFrameRate 00582 * The frame rate the simulation runs on (>=60.0 and <=1000.0) 00583 * (smaller=more performance, larger=more accurate simulation) 00584 * 00585 * @return 00586 * 'true' if all went fine, else 'false' 00587 * (maybe the given value is NOT between >=60.0 and <=1000.0 ?) 00588 */ 00589 virtual bool SetFrameRate(float fFrameRate = 60.0f) = 0; 00590 00591 /** 00592 * @brief 00593 * Returns the gravity vector 00594 * 00595 * @param[out] vGravity 00596 * Will receive the current gravity vector 00597 */ 00598 virtual void GetGravity(PLMath::Vector3 &vGravity) const = 0; 00599 00600 /** 00601 * @brief 00602 * Sets the gravity vector 00603 * 00604 * @param[in] vGravity 00605 * New gravity vector 00606 */ 00607 virtual void SetGravity(const PLMath::Vector3 &vGravity = PLMath::Vector3(0.0f, -9.81f, 0.0f)) = 0; 00608 00609 /** 00610 * @brief 00611 * Returns whether collision is active between the two given collision groups or not 00612 * 00613 * @param[in] nGroup1 00614 * First collision group(0-31) 00615 * @param[in] nGroup2 00616 * Second collision group(0-31) 00617 * 00618 * @return 00619 * 'true' if the collision between the two given collision groups is active, else 'false' 00620 * 00621 * @note 00622 * - nGroup1 and nGroup2 are commutative 00623 * - By default, collision between objects within the same group is disabled - except for the first group 00624 */ 00625 virtual bool GetGroupCollision(PLCore::uint8 nGroup1, PLCore::uint8 nGroup2) const = 0; 00626 00627 /** 00628 * @brief 00629 * Sets whether collision is active between the two given collision groups or not 00630 * 00631 * @param[in] nGroup1 00632 * First collision group(0-31) 00633 * @param[in] nGroup2 00634 * Second collision group(0-31) 00635 * @param[in] bActive 00636 * 'true' if the collision between the two given collision groups is active, else 'false' 00637 * 00638 * @see 00639 * - GetGroupCollision() 00640 */ 00641 virtual void SetGroupCollision(PLCore::uint8 nGroup1, PLCore::uint8 nGroup2, bool bActive = true) = 0; 00642 00643 /** 00644 * @brief 00645 * Returns body pair flags 00646 * 00647 * @param[in] cBody1 00648 * The first body 00649 * @param[in] cBody2 00650 * The second body 00651 * 00652 * @return 00653 * Body pair flags (see EBodyPairFlags) 00654 * 00655 * @note 00656 * - GetBodyPairFlags() must NOT return the same flags set by SetBodyPairFlags()! 00657 * - cBody1 and cBody2 are commutative 00658 */ 00659 virtual PLCore::uint8 GetBodyPairFlags(const Body &cBody1, const Body &cBody2) const = 0; 00660 00661 /** 00662 * @brief 00663 * Sets the body pair flags 00664 * 00665 * @param[in] cBody1 00666 * The first body 00667 * @param[in] cBody2 00668 * The second body 00669 * @param[in] nFlags 00670 * Body pair flags (see EBodyPairFlags) 00671 * 00672 * @see 00673 * - SetBodyPairFlags() 00674 */ 00675 virtual void SetBodyPairFlags(const Body &cBody1, const Body &cBody2, PLCore::uint8 nFlags = 0) = 0; 00676 00677 /** 00678 * @brief 00679 * Returns whether buoyancy force is used 00680 * 00681 * @return 00682 * 'true' if buoyancy force is used, else 'false' 00683 */ 00684 virtual bool IsBuoyancyActive() const = 0; 00685 00686 /** 00687 * @brief 00688 * Sets whether buoyancy force is used 00689 * 00690 * @param[in] bActive 00691 * 'true' if buoyancy force is used, else 'false' 00692 */ 00693 virtual void SetBuoyancyActive(bool bActive = false) = 0; 00694 00695 /** 00696 * @brief 00697 * Returns the y position of the buoyancy plane 00698 * 00699 * @return 00700 * The y position of the buoyancy plane 00701 */ 00702 virtual float GetBuoyancyPlaneY() const = 0; 00703 00704 /** 00705 * @brief 00706 * Sets the y position of the buoyancy plane 00707 * 00708 * @param[in] fY 00709 * New y position of the buoyancy plane 00710 */ 00711 virtual void SetBuoyancyPlaneY(float fY = 0.0f) = 0; 00712 00713 /** 00714 * @brief 00715 * Updates the simulation 00716 * 00717 * @remarks 00718 * If the simulation should be 'frozen', do NOT just skip this function, use 00719 * SetSimulationActive(false) instead! 00720 * 00721 * @see 00722 * - SetSimulationActive() 00723 */ 00724 virtual void UpdateSimulation() = 0; 00725 00726 /** 00727 * @brief 00728 * Returns whether the bodies are always static or not 00729 * 00730 * @return 00731 * 'true' if bodies are always static, else 'false' 00732 * 00733 * @remarks 00734 * During the creation of a body using for instance World::CreateBodyBox() you can give the used physics API a hint whether 00735 * this body is always static or not. Some physics API's will use this information, while other not. The Newton and ODE physics 00736 * plugins for instance will ignore this information, you can change the static state by setting a mass directly while 0 means 00737 * static, while >0 indicates a dynamic body. The PhysX physics plugin for instance will use this information. If a body is 00738 * created this static set to true, this body is always static within the API even if you set a mass! 00739 */ 00740 virtual bool IsAlwaysStatic() const = 0; 00741 00742 00743 //[-------------------------------------------------------] 00744 //[ Protected functions ] 00745 //[-------------------------------------------------------] 00746 protected: 00747 /** 00748 * @brief 00749 * Constructor 00750 */ 00751 PLPHYSICS_API World(); 00752 00753 00754 //[-------------------------------------------------------] 00755 //[ Private data ] 00756 //[-------------------------------------------------------] 00757 private: 00758 PLCore::Pool<void*> m_lstFreeBodyInformation; /**< List of currently free body information */ 00759 00760 00761 }; 00762 00763 00764 //[-------------------------------------------------------] 00765 //[ Namespace ] 00766 //[-------------------------------------------------------] 00767 } // PLPhysics 00768 00769 00770 #endif // __PLPHYSICS_WORLD_H__
|