home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- //////////////////////////////////////////////////////////////////////
- // Car.h - definition of the car class
- //////////////////////////////////////////////////////////////////////
-
- #ifndef CAR_H
- #define CAR_H
-
- #include "Defines.h"
- #include "Driver.h"
- #include <Inventor/SbString.h>
-
- // types of cars
- // XXX should subclass these
- #define LOCAL_CAR 0
- #define ROBOT_CAR 1
- #define NETWORK_CAR 2
-
- class Simulation;
- class Engine;
- class Driver;
- class Road;
- class Dynamics;
- class Stretch;
-
- class SoNode;
- class SoGroup;
- class SoSeparator;
- class SoDrawStyle;
- class SoGLRenderAction;
-
-
- class Car {
-
- public:
-
- // XXX get the road from the simulation
- Car(Simulation *s, SbString carfile, Road *, int type);
- ~Car();
-
- Simulation * get_simulation() const { return _simulation; };
- Road * const get_road() const { return _road; };
- Engine * const get_engine() const { return _engine; };
- Dynamics * const get_dynamics() const { return _dynamics; };
- Driver * const get_driver() const { return _driver; };
- int const get_type() const { return _type; };
-
- Boolean done() const { return _driver->done(); };
-
- const SbVec3f get_driver_position() const { return _driver_position; };
- float get_wheelbase() const { return _wheelbase; };
- float get_width() const { return _width; };
- float get_height() const { return _height; };
-
- void draw(int mode);
- void update(Boolean ok_to_sleep);
- void setDrawStyle(int);
-
- protected:
-
- // components of the car
- Simulation * _simulation;
- Road * _road;
- Driver * _driver;
- Engine * _engine;
- Dynamics * _dynamics;
-
- // Only one of the drivers is on this workstation
- static Driver * _local_driver;
-
- // LOCAL_CAR, ROBOT_CAR, or NETWORK_CAR
- int _type;
-
- // characteristics of the car
-
- // position of driver within car
- // relative to car coords:
- // right handed, neg-z is forward, pos-y is up
- SbVec3f _driver_position;
-
- // wheel separation
- float _wheelbase, _width, _height;
-
- // drawing representation of the car
- SoSeparator * _car_root;
- SoDrawStyle * _style;
- SoGroup * _car_body;
-
- // action used to draw the car
- SoGLRenderAction * _render_action;
-
- // color of the car (index of the material)
- int _color;
- int _material;
- };
-
- #endif
-