upgrade to GIMPACT 0.2

This commit is contained in:
ejcoumans
2007-06-22 17:32:28 +00:00
parent 55258a8a72
commit 980f03dc3d
282 changed files with 47221 additions and 54 deletions

View File

@@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>GIMPACT: PROGRAMMERS GUIDE</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.2 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="nav">
<a class="el" href="index.html">GIMPACT</a></div>
<h1><a class="anchor" name="PROGRAMMERS_GUIDE">PROGRAMMERS GUIDE</a></h1>This guide will show how to incorpore the GIMPACt functionality on the Bullet Engine: <h2><a class="anchor" name="REG">
Registering the Algorithm</a></h2>
For register this algorithm in Bullet, proceed as following: <div class="fragment"><pre class="fragment">btCollisionDispatcher * dispatcher = <span class="keyword">static_cast&lt;</span>btCollisionDispatcher *<span class="keyword">&gt;</span>(m_dynamicsWorld -&gt;getDispatcher());
<a class="code" href="classbt_g_impact_collision_algorithm.html#378bceae2110e29618abf9264a9510e0" title="Use this function for register the algorithm externally.">btGImpactCollisionAlgorithm::registerAlgorithm</a>(dispatcher);
</pre></div> With the instructon above, <a class="el" href="classbt_g_impact_collision_algorithm.html" title="Collision Algorithm for GImpact Shapes.">btGImpactCollisionAlgorithm</a> will handle:<ul>
<li>Convex shapes vs GImpact shapes.</li><li>Concave shapes vs GImpact shapes.</li><li>Compoind shapes vs GImpact shapes.</li></ul>
<h2><a class="anchor" name="CREATING_SHAPES">
Creating Shapes.</a></h2>
<h3><a class="anchor" name="TRIMESH">
Creating trimeshes.</a></h3>
For creating trimeshes you must provide an interface for your model data. You could use btTriangleIndexVertexArray class for providing the indices and the vertices from your triangle models. <p>
For example, you could create a trimesh from memory as following: <div class="fragment"><pre class="fragment">btTriangleIndexVertexArray* indexVertexArrays = <span class="keyword">new</span> btTriangleIndexVertexArray(NUM_TRIANGLES,
&amp;gIndices[0][0],
3*<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>),
NUM_VERTICES,(REAL*) &amp;gVertices[0],<span class="keyword">sizeof</span>(REAL)*3);
</pre></div> <p>
Where gIndices is an array of integers and gVertices is an array of float with 3 components. Then you must create the Trimesh shape as following: <div class="fragment"><pre class="fragment"><a class="code" href="classbt_g_impact_mesh_shape.html" title="This class manages a mesh supplied by the btStridingMeshInterface interface.">btGImpactMeshShape</a> * trimesh = <span class="keyword">new</span> <a class="code" href="classbt_g_impact_mesh_shape.html" title="This class manages a mesh supplied by the btStridingMeshInterface interface.">btGImpactMeshShape</a>(indexVertexArrays);
</pre></div> The next step is configuring the trimesh, for example changing the scale: <div class="fragment"><pre class="fragment">trimesh-&gt;<a class="code" href="classbt_g_impact_mesh_shape.html#ed8d5e4b2e75538109909d44b244bc35">setLocalScaling</a>(btVector3(4.f,4.f,4.f));
</pre></div> At end, you must call <a class="el" href="classbt_g_impact_shape_interface.html#cb26c2d7a2aecabd06b996b72b848492" title="performs refit operation">btGImpactMeshShape.updateBound</a> for ensure that the shape will build its internal Box set structure: <div class="fragment"><pre class="fragment">trimesh-&gt;<a class="code" href="classbt_g_impact_shape_interface.html#cb26c2d7a2aecabd06b996b72b848492" title="performs refit operation">updateBound</a>();<span class="comment">// Call this method once before doing collisions</span>
</pre></div> Also you must call <a class="el" href="classbt_g_impact_mesh_shape.html#fbf7ae3408bc0ab975c46ed65820a4b2" title="Tells to this object that is needed to refit all the meshes.">btGImpactMeshShape.postUpdate()</a> each time when changing the trimesh data ( For deformable meshes), this will enable a flag to the trimesh shape which tells that the trimesh data has been changed and <a class="el" href="classbt_g_impact_shape_interface.html#cb26c2d7a2aecabd06b996b72b848492" title="performs refit operation">btGImpactMeshShape.updateBound</a> will be called in collision routines. &lt;<h3><a class="anchor" name="COMPOUND">
Compound Shapes.</a></h3>
For compound shapes, you must create <a class="el" href="classbt_g_impact_compound_shape.html" title="btGIMPACTCompoundShape allows to handle multiple btCollisionShape objects at once...">btGImpactCompoundShape</a> objects. Then you could add sub shapes as following; <div class="fragment"><pre class="fragment"><a class="code" href="classbt_g_impact_compound_shape.html" title="btGIMPACTCompoundShape allows to handle multiple btCollisionShape objects at once...">btGImpactCompoundShape</a> * mycompound = <span class="keyword">new</span> <a class="code" href="classbt_g_impact_compound_shape.html" title="btGIMPACTCompoundShape allows to handle multiple btCollisionShape objects at once...">btGImpactCompoundShape</a>();
btTransform localtransform;
.... Setting transformation
<span class="comment">//add shapes with transformation</span>
btCollisionShape * subshape = creatingShape(0);
mycompound-&gt;<a class="code" href="classbt_g_impact_compound_shape.html#3c97aab1f6511033df73007096ed4c8a" title="Use this method for adding children.">addChildShape</a>(localtransform,subshape);
.... Setting transformation
btCollisionShape * subshape2 = creatingShape(1);
mycompound-&gt;<a class="code" href="classbt_g_impact_compound_shape.html#3c97aab1f6511033df73007096ed4c8a" title="Use this method for adding children.">addChildShape</a>(localtransform,subshape);
.... <span class="keyword">add</span> more shapes
</pre></div> At end, you must call <a class="el" href="classbt_g_impact_shape_interface.html#cb26c2d7a2aecabd06b996b72b848492" title="performs refit operation">btGImpactCompoundShape.updateBound</a> for ensure that the shape will build its internal Box set structure: <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 13 16:58:21 2007 for GIMPACT by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
</body>
</html>