Direct3D (DirectX 9.0) Code Samples - Page 11

How to use the Tokamak SDK to Create a Stack of Blocks
 

This sample demonstrates how to use the Tokamak Physics SDK to create a stack of blocks which can be knocked over. For demonstration purposes, you can use the F1 key to lift up and drop the bottom block, which will obviously disturb the stack. You can also use the F2 key to tilt the blue platform and dump the blocks over the side. Check out the OpenGL source code page for the OpenGL equivalent of this sample.

Relevant Keywords: neSimulator, neRigidBody, neAnimatedBody, neSimulatorSizeInfo, neBoxInertiaTensor,  neJoint, neGeometry, CreateSimulator, CreateRigidBody, AddGeometry, SetBoxSize, UpdateBoundingInfo, SetInertiaTensor, SetMass, Enable, SetRotation and GetTransform.

How to use Tokamak's Different Geometry Types or Collision Primitives
 

This sample demonstrates how to use the box, sphere, and cylinder geometry types of the Tokamak Physics SDK. The sample is basically a variation of the stacking sample above.

Relevant Keywords: neRigidBody, neAnimatedBody, SetBoxSize, neBoxInertiaTensor, SetCylinder, neCylinderInertiaTensor, SetSphereDiameter, and neSphereInertiaTensor.

 

Manually Loading a D3DXMesh object
 

This sample demonstrates how to manually load the vertex buffer of a D3DXMesh object.

Relevant Keywords: LPD3DXMESH, D3DXCreateMeshFVF, D3DXMESH_MANAGED, LockVertexBuffer, UnlockVertexBuffer, LockIndexBuffer, UnlockIndexBuffer, and DrawSubset.

 

Using the Attributes Table of D3DXMesh to Render Sub-sets
 

This sample demonstrates how to manually load the vertex buffer of a single ID3DXMesh object with three separate colored quads. We then use an attribute table to ID these three quads so we can render them separately as subsets of  the mesh using DrawSubset.

The sample also demonstrates how to use the ID3DXMesh methods GenerateAdjacency and OptimizeInplace to optimize our test mesh.

Relevant Keywords: LPD3DXMESH, D3DXCreateMeshFVF, D3DXMESH_MANAGED, LockVertexBuffer, UnlockVertexBuffer, LockIndexBuffer, UnlockIndexBuffer, LockAttributeBuffer, UnlockAttributeBuffer, D3DXCreateBuffer, LPD3DXBUFFER, GetNumFaces, GenerateAdjacency, GetBufferPointer, OptimizeInplace, D3DXMESHOPT_VERTEXCACHE, D3DXMESHOPT_IGNOREVERTS, and DrawSubset.