home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / Demos / DMBoids / boids.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  1.8 KB  |  80 lines

  1. //-----------------------------------------------------------------------------
  2. // File: Boids.h
  3. //
  4. // Desc: 
  5. //       
  6. // Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef BOIDS_H
  9. #define BOIDS_H
  10.  
  11.  
  12.  
  13.  
  14. //-----------------------------------------------------------------------------
  15. // Name: 
  16. // Desc: 
  17. //-----------------------------------------------------------------------------
  18. class Boid 
  19. {
  20. public:
  21.     D3DXMATRIX     matWorld;        // matrix representing the boids location/orientation
  22.     D3DXVECTOR3    vPos;            // location
  23.     D3DXVECTOR3    vDir;            // cur direction
  24.     D3DXVECTOR3    vSeparationForce;
  25.     D3DXVECTOR3    vAlignmentForce;
  26.     D3DXVECTOR3    vCohesionForce;
  27.     D3DXVECTOR3    vMigratoryForce;
  28.     D3DXVECTOR3    vObstacleForce;
  29.     DWORD       dwNumNeighbors;
  30.  
  31.     D3DXVECTOR3    vDeltaPos;    // change in position from flock centering
  32.     D3DXVECTOR3    vDeltaDir;    // change in direction
  33.     int            iDeltaCnt;    // number of boids that influence this delta_dir
  34.     FLOAT        speed;
  35.     FLOAT        yaw, pitch, roll, dyaw;
  36.     D3DXVECTOR3    color;
  37. };
  38.  
  39.  
  40.  
  41.  
  42. //-----------------------------------------------------------------------------
  43. // Name: 
  44. // Desc: 
  45. //-----------------------------------------------------------------------------
  46. struct Obstacle
  47. {
  48.     D3DXVECTOR3 vPos;
  49.     FLOAT       fRadius;
  50. };
  51.  
  52.  
  53.  
  54.  
  55. //-----------------------------------------------------------------------------
  56. // Name: 
  57. // Desc: 
  58. //-----------------------------------------------------------------------------
  59. class CFlock
  60. {
  61. public:
  62.     DWORD        m_dwNumBoids;
  63.     Boid*       m_Boids;
  64.     DWORD        m_dwNumObstacles;
  65.     Obstacle*   m_Obstacles;
  66.     FLOAT**     m_afDist;    // 2-d array of boid distances, yuk what a waste
  67.     D3DXVECTOR3    m_vGoal;
  68.  
  69.     // Functions
  70.     VOID Update( FLOAT fElapsedTime );
  71. };
  72.  
  73.  
  74.  
  75.  
  76.  
  77. #endif
  78.  
  79.  
  80.