| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <title>gameplay: Main Page</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <script type="text/javascript">
- $(document).ready(function() { searchBox.OnSelectItem(0); });
- </script>
- </head>
- <body>
- <div id="top"><!-- do not remove this div! -->
- <!-- Generated by Doxygen 1.8.0 -->
- <script type="text/javascript">
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- </script>
- <div id="navrow1" class="tabs">
- <ul class="tablist">
- <li><a href="index.html"><span>Main Page</span></a></li>
- <li><a href="annotated.html"><span>Classes</span></a></li>
- <li class="current"><a href="files.html"><span>Files</span></a></li>
- <li>
- <div id="MSearchBox" class="MSearchBoxInactive">
- <span class="left">
- <img id="MSearchSelect" src="search/mag_sel.png"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- alt=""/>
- <input type="text" id="MSearchField" value="Search" accesskey="S"
- onfocus="searchBox.OnSearchFieldFocus(true)"
- onblur="searchBox.OnSearchFieldFocus(false)"
- onkeyup="searchBox.OnSearchFieldChange(event)"/>
- </span><span class="right">
- <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
- </span>
- </div>
- </li>
- </ul>
- </div>
- <div id="navrow2" class="tabs2">
- <ul class="tablist">
- <li><a href="files.html"><span>File List</span></a></li>
- </ul>
- </div>
- </div>
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a></div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- <div class="header">
- <div class="headertitle">
- <div class="title">gameplay/src/PhysicsController.h</div> </div>
- </div><!--header-->
- <div class="contents">
- <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef PHYSICSCONTROLLER_H_</span>
- <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define PHYSICSCONTROLLER_H_</span>
- <a name="l00003"></a>00003 <span class="preprocessor"></span>
- <a name="l00004"></a>00004 <span class="preprocessor">#include "PhysicsConstraint.h"</span>
- <a name="l00005"></a>00005 <span class="preprocessor">#include "PhysicsFixedConstraint.h"</span>
- <a name="l00006"></a>00006 <span class="preprocessor">#include "PhysicsGenericConstraint.h"</span>
- <a name="l00007"></a>00007 <span class="preprocessor">#include "PhysicsHingeConstraint.h"</span>
- <a name="l00008"></a>00008 <span class="preprocessor">#include "PhysicsSocketConstraint.h"</span>
- <a name="l00009"></a>00009 <span class="preprocessor">#include "PhysicsSpringConstraint.h"</span>
- <a name="l00010"></a>00010 <span class="preprocessor">#include "PhysicsCollisionObject.h"</span>
- <a name="l00011"></a>00011 <span class="preprocessor">#include "MeshBatch.h"</span>
- <a name="l00012"></a>00012
- <a name="l00013"></a>00013 <span class="keyword">namespace </span>gameplay
- <a name="l00014"></a>00014 {
- <a name="l00015"></a>00015
- <a name="l00019"></a><a class="code" href="classgameplay_1_1_physics_controller.html">00019</a> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_controller.html">PhysicsController</a> : <span class="keyword">public</span> btCollisionWorld::ContactResultCallback
- <a name="l00020"></a>00020 {
- <a name="l00021"></a>00021 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_game.html">Game</a>;
- <a name="l00022"></a>00022 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_constraint.html">PhysicsConstraint</a>;
- <a name="l00023"></a>00023 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>;
- <a name="l00024"></a>00024 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_character.html">PhysicsCharacter</a>;
- <a name="l00025"></a>00025 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_collision_object.html">PhysicsCollisionObject</a>;
- <a name="l00026"></a>00026 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_ghost_object.html">PhysicsGhostObject</a>;
- <a name="l00027"></a>00027
- <a name="l00028"></a>00028 <span class="keyword">public</span>:
- <a name="l00029"></a>00029
- <a name="l00033"></a><a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html">00033</a> <span class="keyword">class </span><a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html">Listener</a>
- <a name="l00034"></a>00034 {
- <a name="l00035"></a>00035 <span class="keyword">public</span>:
- <a name="l00036"></a>00036
- <a name="l00040"></a><a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463">00040</a> <span class="keyword">enum</span> <a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463">EventType</a>
- <a name="l00041"></a>00041 {
- <a name="l00045"></a><a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463a317ed2f938ab1439d3a9cf75bdd00477">00045</a> <a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463a317ed2f938ab1439d3a9cf75bdd00477">ACTIVATED</a>,
- <a name="l00046"></a>00046
- <a name="l00050"></a><a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463afb412674f4b580a41c309eafc444a757">00050</a> <a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463afb412674f4b580a41c309eafc444a757">DEACTIVATED</a>
- <a name="l00051"></a>00051 };
- <a name="l00052"></a>00052
- <a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a5f10aadcd31d526306c0089fa0a7c48b">statusEvent</a>(<a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463">EventType</a> type) = 0;
- <a name="l00057"></a>00057 };
- <a name="l00058"></a>00058
- <a name="l00062"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html">00062</a> <span class="keyword">struct </span><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html">HitResult</a>
- <a name="l00063"></a>00063 {
- <a name="l00067"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aa7989e81df9ade10424ae7a0a2a6dd54">00067</a> <a class="code" href="classgameplay_1_1_physics_collision_object.html">PhysicsCollisionObject</a>* <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aa7989e81df9ade10424ae7a0a2a6dd54">object</a>;
- <a name="l00068"></a>00068
- <a name="l00072"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#a5c2d1e7fc5d361345b14164293dbaa7d">00072</a> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a> <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#a5c2d1e7fc5d361345b14164293dbaa7d">point</a>;
- <a name="l00073"></a>00073
- <a name="l00077"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aeb60dd2b2787a74837dcb4f21bda2fa8">00077</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aeb60dd2b2787a74837dcb4f21bda2fa8">fraction</a>;
- <a name="l00078"></a>00078
- <a name="l00082"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aee488c3dc5ab66375f5fdc1c3e7f9478">00082</a> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a> <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html#aee488c3dc5ab66375f5fdc1c3e7f9478">normal</a>;
- <a name="l00083"></a>00083 };
- <a name="l00084"></a>00084
- <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="classgameplay_1_1_physics_controller.html#a9c9c7800807569809a677be38873170a">addStatusListener</a>(<a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html">PhysicsController::Listener</a>* listener);
- <a name="l00091"></a>00091
- <a name="l00100"></a>00100 <a class="code" href="classgameplay_1_1_physics_fixed_constraint.html">PhysicsFixedConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#a547b335f3814fb6c124e2470393812e2">createFixedConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL);
- <a name="l00101"></a>00101
- <a name="l00111"></a>00111 <a class="code" href="classgameplay_1_1_physics_generic_constraint.html">PhysicsGenericConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#ad7ae74b385f8e9718cc37d57a3423583">createGenericConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL);
- <a name="l00112"></a>00112
- <a name="l00129"></a>00129 <a class="code" href="classgameplay_1_1_physics_generic_constraint.html">PhysicsGenericConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#ad7ae74b385f8e9718cc37d57a3423583">createGenericConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetA, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetA,
- <a name="l00130"></a>00130 <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetB = <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>(), <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetB = <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>());
- <a name="l00131"></a>00131
- <a name="l00148"></a>00148 <a class="code" href="classgameplay_1_1_physics_hinge_constraint.html">PhysicsHingeConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#aea8f1cc3f27d12c6c1cd954eb81c9cdc">createHingeConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetA, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetA,
- <a name="l00149"></a>00149 <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetB = <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>(), <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetB = <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>());
- <a name="l00150"></a>00150
- <a name="l00161"></a>00161 <a class="code" href="classgameplay_1_1_physics_socket_constraint.html">PhysicsSocketConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#a8c1c19e84a2a21f9aa4f6e275cc22057">createSocketConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL);
- <a name="l00162"></a>00162
- <a name="l00175"></a>00175 <a class="code" href="classgameplay_1_1_physics_socket_constraint.html">PhysicsSocketConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#a8c1c19e84a2a21f9aa4f6e275cc22057">createSocketConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetA,
- <a name="l00176"></a>00176 <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b = NULL, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetB = <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>());
- <a name="l00177"></a>00177
- <a name="l00188"></a>00188 <a class="code" href="classgameplay_1_1_physics_spring_constraint.html">PhysicsSpringConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#a098c2ece05ee787648c15eb8098dde51">createSpringConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b);
- <a name="l00189"></a>00189
- <a name="l00206"></a>00206 <a class="code" href="classgameplay_1_1_physics_spring_constraint.html">PhysicsSpringConstraint</a>* <a class="code" href="classgameplay_1_1_physics_controller.html#a098c2ece05ee787648c15eb8098dde51">createSpringConstraint</a>(<a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* a, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetA, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetA,
- <a name="l00207"></a>00207 <a class="code" href="classgameplay_1_1_physics_rigid_body.html">PhysicsRigidBody</a>* b, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_quaternion.html">Quaternion</a>& rotationOffsetB, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& translationOffsetB);
- <a name="l00208"></a>00208
- <a name="l00214"></a>00214 <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& <a class="code" href="classgameplay_1_1_physics_controller.html#a9d38b041f052706cb0ac8b39e5283d2f">getGravity</a>() <span class="keyword">const</span>;
- <a name="l00215"></a>00215
- <a name="l00221"></a>00221 <span class="keywordtype">void</span> <a class="code" href="classgameplay_1_1_physics_controller.html#ab085ecda3423f445960150208e5ba1c9">setGravity</a>(<span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& gravity);
- <a name="l00222"></a>00222
- <a name="l00228"></a>00228 <span class="keywordtype">void</span> <a class="code" href="classgameplay_1_1_physics_controller.html#ae2089a6dababa097ef955d1105c4bd6d">drawDebug</a>(<span class="keyword">const</span> <a class="code" href="classgameplay_1_1_matrix.html">Matrix</a>& viewProjection);
- <a name="l00229"></a>00229
- <a name="l00238"></a>00238 <span class="keywordtype">bool</span> <a class="code" href="classgameplay_1_1_physics_controller.html#aecbb567040146ce4003d3c3ab1ad6a0c">rayTest</a>(<span class="keyword">const</span> <a class="code" href="classgameplay_1_1_ray.html">Ray</a>& ray, <span class="keywordtype">float</span> distance, <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html">PhysicsController::HitResult</a>* result = NULL);
- <a name="l00239"></a>00239
- <a name="l00251"></a>00251 <span class="keywordtype">bool</span> <a class="code" href="classgameplay_1_1_physics_controller.html#ae0ef6e11ae93e4cbc871f7a9bd0eee10">sweepTest</a>(<a class="code" href="classgameplay_1_1_physics_collision_object.html">PhysicsCollisionObject</a>* <span class="keywordtype">object</span>, <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a>& endPosition, <a class="code" href="structgameplay_1_1_physics_controller_1_1_hit_result.html">PhysicsController::HitResult</a>* result = NULL);
- <a name="l00252"></a>00252
- <a name="l00253"></a>00253 <span class="keyword">protected</span>:
- <a name="l00254"></a>00254
- <a name="l00258"></a>00258 btScalar <a class="code" href="classgameplay_1_1_physics_controller.html#a44243d5391f18bc002ed35a9dade2544">addSingleResult</a>(btManifoldPoint& cp, <span class="keyword">const</span> btCollisionObject* a, <span class="keywordtype">int</span> partIdA, <span class="keywordtype">int</span> indexA, <span class="keyword">const</span> btCollisionObject* b, <span class="keywordtype">int</span> partIdB, <span class="keywordtype">int</span> indexB);
- <a name="l00259"></a>00259
- <a name="l00260"></a>00260 <span class="keyword">private</span>:
- <a name="l00261"></a>00261
- <a name="l00262"></a>00262 <span class="comment">// Internal constants for the collision status cache.</span>
- <a name="l00263"></a>00263 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> DIRTY;
- <a name="l00264"></a>00264 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> COLLISION;
- <a name="l00265"></a>00265 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> REGISTERED;
- <a name="l00266"></a>00266 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> REMOVE;
- <a name="l00267"></a>00267
- <a name="l00268"></a>00268 <span class="comment">// Represents the collision listeners and status for a given collision pair (used by the collision status cache).</span>
- <a name="l00269"></a>00269 <span class="keyword">struct </span>CollisionInfo
- <a name="l00270"></a>00270 {
- <a name="l00271"></a>00271 CollisionInfo() : _status(0) { }
- <a name="l00272"></a>00272
- <a name="l00273"></a>00273 std::vector<PhysicsCollisionObject::CollisionListener*> _listeners;
- <a name="l00274"></a>00274 <span class="keywordtype">int</span> _status;
- <a name="l00275"></a>00275 };
- <a name="l00276"></a>00276
- <a name="l00280"></a>00280 PhysicsController();
- <a name="l00281"></a>00281
- <a name="l00285"></a>00285 ~PhysicsController();
- <a name="l00286"></a>00286
- <a name="l00290"></a>00290 <span class="keywordtype">void</span> initialize();
- <a name="l00291"></a>00291
- <a name="l00295"></a>00295 <span class="keywordtype">void</span> finalize();
- <a name="l00296"></a>00296
- <a name="l00300"></a>00300 <span class="keywordtype">void</span> pause();
- <a name="l00301"></a>00301
- <a name="l00305"></a>00305 <span class="keywordtype">void</span> resume();
- <a name="l00306"></a>00306
- <a name="l00310"></a>00310 <span class="keywordtype">void</span> update(<span class="keywordtype">long</span> elapsedTime);
- <a name="l00311"></a>00311
- <a name="l00312"></a>00312 <span class="comment">// Adds the given collision listener for the two given collision objects.</span>
- <a name="l00313"></a>00313 <span class="keywordtype">void</span> addCollisionListener(PhysicsCollisionObject::CollisionListener* listener, PhysicsCollisionObject* objectA, PhysicsCollisionObject* objectB);
- <a name="l00314"></a>00314
- <a name="l00315"></a>00315 <span class="comment">// Removes the given collision listener.</span>
- <a name="l00316"></a>00316 <span class="keywordtype">void</span> removeCollisionListener(PhysicsCollisionObject::CollisionListener* listener, PhysicsCollisionObject* objectA, PhysicsCollisionObject* objectB);
- <a name="l00317"></a>00317
- <a name="l00318"></a>00318 <span class="comment">// Adds the given collision object to the world.</span>
- <a name="l00319"></a>00319 <span class="keywordtype">void</span> addCollisionObject(PhysicsCollisionObject* <span class="keywordtype">object</span>);
- <a name="l00320"></a>00320
- <a name="l00321"></a>00321 <span class="comment">// Removes the given collision object from the simulated physics world.</span>
- <a name="l00322"></a>00322 <span class="keywordtype">void</span> removeCollisionObject(PhysicsCollisionObject* <span class="keywordtype">object</span>);
- <a name="l00323"></a>00323
- <a name="l00324"></a>00324 <span class="comment">// Gets the corresponding GamePlay object for the given Bullet object.</span>
- <a name="l00325"></a>00325 PhysicsCollisionObject* getCollisionObject(<span class="keyword">const</span> btCollisionObject* collisionObject) <span class="keyword">const</span>;
- <a name="l00326"></a>00326
- <a name="l00327"></a>00327 <span class="comment">// Creates a collision shape for the given node and gameplay shape definition.</span>
- <a name="l00328"></a>00328 <span class="comment">// Populates 'centerOfMassOffset' with the correct calculated center of mass offset.</span>
- <a name="l00329"></a>00329 PhysicsCollisionShape* createShape(Node* node, <span class="keyword">const</span> PhysicsCollisionShape::Definition& shape, Vector3* centerOfMassOffset);
- <a name="l00330"></a>00330
- <a name="l00331"></a>00331 <span class="comment">// Creates a box collision shape.</span>
- <a name="l00332"></a>00332 PhysicsCollisionShape* createBox(<span class="keyword">const</span> Vector3& extents, <span class="keyword">const</span> Vector3& scale);
- <a name="l00333"></a>00333
- <a name="l00334"></a>00334 <span class="comment">// Creates a sphere collision shape.</span>
- <a name="l00335"></a>00335 PhysicsCollisionShape* createSphere(<span class="keywordtype">float</span> radius, <span class="keyword">const</span> Vector3& scale);
- <a name="l00336"></a>00336
- <a name="l00337"></a>00337 <span class="comment">// Creates a capsule collision shape.</span>
- <a name="l00338"></a>00338 PhysicsCollisionShape* createCapsule(<span class="keywordtype">float</span> radius, <span class="keywordtype">float</span> height, <span class="keyword">const</span> Vector3& scale);
- <a name="l00339"></a>00339
- <a name="l00340"></a>00340 <span class="comment">// Creates a heightfield collision shape.</span>
- <a name="l00341"></a>00341 PhysicsCollisionShape* createHeightfield(Node* node, Image* image, Vector3* centerOfMassOffset);
- <a name="l00342"></a>00342
- <a name="l00343"></a>00343 <span class="comment">// Creates a triangle mesh collision shape.</span>
- <a name="l00344"></a>00344 PhysicsCollisionShape* createMesh(Mesh* mesh, <span class="keyword">const</span> Vector3& scale);
- <a name="l00345"></a>00345
- <a name="l00346"></a>00346 <span class="comment">// Destroys a collision shape created through PhysicsController</span>
- <a name="l00347"></a>00347 <span class="keywordtype">void</span> destroyShape(PhysicsCollisionShape* shape);
- <a name="l00348"></a>00348
- <a name="l00349"></a>00349 <span class="comment">// Helper function for calculating heights from heightmap (image) or heightfield data.</span>
- <a name="l00350"></a>00350 <span class="keyword">static</span> <span class="keywordtype">float</span> calculateHeight(<span class="keywordtype">float</span>* data, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> height, <span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y);
- <a name="l00351"></a>00351
- <a name="l00352"></a>00352 <span class="comment">// Sets up the given constraint for the given two rigid bodies.</span>
- <a name="l00353"></a>00353 <span class="keywordtype">void</span> addConstraint(PhysicsRigidBody* a, PhysicsRigidBody* b, PhysicsConstraint* constraint);
- <a name="l00354"></a>00354
- <a name="l00355"></a>00355 <span class="comment">// Checks whether constraints are supported for the given rigid bodies and emits a warning if they are not.</span>
- <a name="l00356"></a>00356 <span class="keywordtype">bool</span> checkConstraintRigidBodies(PhysicsRigidBody* a, PhysicsRigidBody* b);
- <a name="l00357"></a>00357
- <a name="l00358"></a>00358 <span class="comment">// Removes the given constraint from the simulated physics world.</span>
- <a name="l00359"></a>00359 <span class="keywordtype">void</span> removeConstraint(PhysicsConstraint* constraint);
- <a name="l00360"></a>00360
- <a name="l00361"></a>00361 <span class="comment">// Draws Bullet debug information.</span>
- <a name="l00362"></a>00362 <span class="keyword">class </span>DebugDrawer : <span class="keyword">public</span> btIDebugDraw
- <a name="l00363"></a>00363 {
- <a name="l00364"></a>00364 <span class="keyword">public</span>:
- <a name="l00365"></a>00365
- <a name="l00369"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html">00369</a> <span class="keyword">struct </span><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html">DebugVertex</a>
- <a name="l00370"></a>00370 {
- <a name="l00374"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a968be415f56ff18991749d7561d6bbc1">00374</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a968be415f56ff18991749d7561d6bbc1">x</a>;
- <a name="l00375"></a>00375
- <a name="l00379"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a0c48d8f78b370249169ff4e397c79ba7">00379</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a0c48d8f78b370249169ff4e397c79ba7">y</a>;
- <a name="l00380"></a>00380
- <a name="l00384"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a5a23e5aa2ffd66417b961995cba48f47">00384</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a5a23e5aa2ffd66417b961995cba48f47">z</a>;
- <a name="l00385"></a>00385
- <a name="l00389"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a47df31c095ed857c29bf9d6ea88c7765">00389</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a47df31c095ed857c29bf9d6ea88c7765">r</a>;
- <a name="l00390"></a>00390
- <a name="l00394"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#acbc3a844f45670e7a9d1bfcfdc84e6e0">00394</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#acbc3a844f45670e7a9d1bfcfdc84e6e0">g</a>;
- <a name="l00395"></a>00395
- <a name="l00399"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a2689be05ac4b5a5faddaa097510e75da">00399</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a2689be05ac4b5a5faddaa097510e75da">b</a>;
- <a name="l00400"></a>00400
- <a name="l00404"></a><a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a764182ac9b3e7db246dd1d0d8eeda046">00404</a> <span class="keywordtype">float</span> <a class="code" href="structgameplay_1_1_physics_controller_1_1_debug_drawer_1_1_debug_vertex.html#a764182ac9b3e7db246dd1d0d8eeda046">a</a>;
- <a name="l00405"></a>00405 };
- <a name="l00406"></a>00406
- <a name="l00410"></a>00410 DebugDrawer();
- <a name="l00411"></a>00411
- <a name="l00415"></a>00415 ~DebugDrawer();
- <a name="l00416"></a>00416
- <a name="l00417"></a>00417 <span class="keywordtype">void</span> begin(<span class="keyword">const</span> <a class="code" href="classgameplay_1_1_matrix.html">Matrix</a>& viewProjection);
- <a name="l00418"></a>00418 <span class="keywordtype">void</span> end();
- <a name="l00419"></a>00419
- <a name="l00420"></a>00420 <span class="comment">// Overridden Bullet functions from btIDebugDraw.</span>
- <a name="l00421"></a>00421 <span class="keywordtype">void</span> drawLine(<span class="keyword">const</span> btVector3& from, <span class="keyword">const</span> btVector3& to, <span class="keyword">const</span> btVector3& fromColor, <span class="keyword">const</span> btVector3& toColor);
- <a name="l00422"></a>00422 <span class="keywordtype">void</span> drawLine(<span class="keyword">const</span> btVector3& from, <span class="keyword">const</span> btVector3& to, <span class="keyword">const</span> btVector3& color);
- <a name="l00423"></a>00423 <span class="keywordtype">void</span> drawContactPoint(<span class="keyword">const</span> btVector3& pointOnB, <span class="keyword">const</span> btVector3& normalOnB, btScalar distance, <span class="keywordtype">int</span> lifeTime, <span class="keyword">const</span> btVector3& color);
- <a name="l00424"></a>00424 <span class="keywordtype">void</span> reportErrorWarning(<span class="keyword">const</span> <span class="keywordtype">char</span>* warningString);
- <a name="l00425"></a>00425 <span class="keywordtype">void</span> draw3dText(<span class="keyword">const</span> btVector3& location, <span class="keyword">const</span> <span class="keywordtype">char</span>* textString);
- <a name="l00426"></a>00426 <span class="keywordtype">void</span> setDebugMode(<span class="keywordtype">int</span> mode);
- <a name="l00427"></a>00427 <span class="keywordtype">int</span> getDebugMode() <span class="keyword">const</span>;
- <a name="l00428"></a>00428
- <a name="l00429"></a>00429 <span class="keyword">private</span>:
- <a name="l00430"></a>00430
- <a name="l00431"></a>00431 <span class="keywordtype">int</span> _mode;
- <a name="l00432"></a>00432 <span class="keyword">const</span> <a class="code" href="classgameplay_1_1_matrix.html">Matrix</a>* _viewProjection;
- <a name="l00433"></a>00433 <a class="code" href="classgameplay_1_1_mesh_batch.html">MeshBatch</a>* _meshBatch;
- <a name="l00434"></a>00434 };
- <a name="l00435"></a>00435
- <a name="l00436"></a>00436 btDefaultCollisionConfiguration* _collisionConfiguration;
- <a name="l00437"></a>00437 btCollisionDispatcher* _dispatcher;
- <a name="l00438"></a>00438 btBroadphaseInterface* _overlappingPairCache;
- <a name="l00439"></a>00439 btSequentialImpulseConstraintSolver* _solver;
- <a name="l00440"></a>00440 btDynamicsWorld* _world;
- <a name="l00441"></a>00441 btGhostPairCallback* _ghostPairCallback;
- <a name="l00442"></a>00442 std::vector<PhysicsCollisionShape*> _shapes;
- <a name="l00443"></a>00443 DebugDrawer* _debugDrawer;
- <a name="l00444"></a>00444 <a class="code" href="classgameplay_1_1_physics_controller_1_1_listener.html#a18b7daeec71d801c54838d967312a463">Listener::EventType</a> _status;
- <a name="l00445"></a>00445 std::vector<Listener*>* _listeners;
- <a name="l00446"></a>00446 <a class="code" href="classgameplay_1_1_vector3.html">Vector3</a> _gravity;
- <a name="l00447"></a>00447 std::map<PhysicsCollisionObject::CollisionPair, CollisionInfo> _collisionStatus;
- <a name="l00448"></a>00448
- <a name="l00449"></a>00449 };
- <a name="l00450"></a>00450
- <a name="l00451"></a>00451 }
- <a name="l00452"></a>00452
- <a name="l00453"></a>00453 <span class="preprocessor">#endif</span>
- </pre></div></div><!-- contents -->
- <hr class="footer"/><address class="footer"><small>
- Generated on Fri May 18 2012 12:10:37 for gameplay by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.0
- </small></address>
- </body>
- </html>
|