home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / audio / drive / Car.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.9 KB  |  113 lines

  1. /*
  2.  * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. //////////////////////////////////////////////////////////////////////
  18. // Car.h - definition of the car class
  19. //////////////////////////////////////////////////////////////////////
  20.  
  21. #ifndef CAR_H
  22. #define CAR_H
  23.  
  24. #include "Defines.h"
  25. #include "Driver.h"
  26. #include <Inventor/SbString.h>
  27.  
  28. // types of cars
  29. // XXX should subclass these
  30. #define LOCAL_CAR 0
  31. #define ROBOT_CAR 1
  32. #define NETWORK_CAR 2
  33.  
  34. class Simulation;
  35. class Engine;
  36. class Driver;
  37. class Road;
  38. class Dynamics;
  39. class Stretch;
  40.  
  41. class SoNode;
  42. class SoGroup;
  43. class SoSeparator;
  44. class SoDrawStyle;
  45. class SoGLRenderAction;
  46.  
  47.  
  48. class Car {
  49.  
  50. public:
  51.  
  52.     // XXX get the road from the simulation
  53.     Car(Simulation *s, SbString carfile, Road *, int type);
  54.     ~Car();
  55.  
  56.     Simulation * get_simulation() const { return _simulation; };
  57.     Road * const get_road() const { return _road; };
  58.     Engine * const get_engine() const { return _engine; };
  59.     Dynamics * const get_dynamics() const { return _dynamics; };
  60.     Driver * const get_driver() const { return _driver; };
  61.     int const get_type() const { return _type; };
  62.  
  63.     Boolean done() const { return _driver->done(); };
  64.  
  65.     const SbVec3f get_driver_position() const { return _driver_position; };
  66.     float get_wheelbase() const { return _wheelbase; };
  67.     float get_width() const { return _width; };
  68.     float get_height() const { return _height; };
  69.  
  70.     void draw(int mode);
  71.     void update(Boolean ok_to_sleep);
  72.     void setDrawStyle(int);
  73.  
  74. protected:
  75.  
  76.     // components of the car
  77.     Simulation * _simulation;
  78.     Road * _road;
  79.     Driver * _driver;
  80.     Engine * _engine;
  81.     Dynamics * _dynamics;
  82.  
  83.     // Only one of the drivers is on this workstation
  84.     static Driver * _local_driver;
  85.     
  86.     // LOCAL_CAR, ROBOT_CAR, or NETWORK_CAR
  87.     int _type;
  88.  
  89.     // characteristics of the car
  90.     
  91.     // position of driver within car
  92.     // relative to car coords:
  93.     //  right handed, neg-z is forward, pos-y is up
  94.     SbVec3f _driver_position;
  95.     
  96.     // wheel separation
  97.     float _wheelbase, _width, _height;
  98.  
  99.     // drawing representation of the car
  100.     SoSeparator * _car_root;
  101.     SoDrawStyle * _style;
  102.     SoGroup * _car_body;
  103.  
  104.     // action used to draw the car
  105.     SoGLRenderAction * _render_action;
  106.  
  107.     // color of the car (index of the material)
  108.     int _color;
  109.     int _material;
  110. };
  111.  
  112. #endif
  113.