~ubuntu-branches/ubuntu/natty/stormbaancoureur/natty

« back to all changes in this revision

Viewing changes to src-stormbaancoureur/carobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2007-08-22 07:53:07 UTC
  • Revision ID: james.westby@ubuntu.com-20070822075307-60hr9y5jyeeob6as
Tags: upstream-1.5.2
ImportĀ upstreamĀ versionĀ 1.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CAROBJECT_H
 
2
#define CAROBJECT_H
 
3
 
 
4
#include <string>
 
5
#include <set>
 
6
 
 
7
#include <ode/ode.h>
 
8
#include <plib/ssg.h>
 
9
 
 
10
#include "worldobject.h"
 
11
 
 
12
 
 
13
class DynamicObject;
 
14
 
 
15
class CarObject : public WorldObject
 
16
{
 
17
  public:
 
18
    CarObject(ssgEntity *bodymodel, ssgEntity *wheelmodel, ssgEntity *licplatemodel, dWorldID world, dSpaceID bigspace, sgVec3 initialpos);
 
19
    virtual ~CarObject();
 
20
    void Recover(float dt);
 
21
    void Simulate(float dt);
 
22
    void Sustain(float dt);
 
23
    void SetAccelerator(float v) { accelerator=v; }
 
24
    void SetSteer(float v) { steer = v; }
 
25
    void SetBrake(float v) { brake = v; }
 
26
    void SetEBrake(bool b) { ebrake = b; }
 
27
    float GetAccelerator(void) { return accelerator; }
 
28
    float GetBrake(void) { return brake; }
 
29
    void SetAction(bool a) { action = a; }
 
30
    bool GetAction(void) { return action; }
 
31
    ssgTransform *GetTransform(void) { return chassis_trf; }
 
32
    void GetPos(sgVec3 dst) const { sgMat4 m; chassis_trf->getTransform(m); sgCopyVec3(dst, m[3]); }
 
33
    float GetWheelVelocity(void);
 
34
    bool IsBackWheelGeometry(dGeomID id) { return id==wheel_geoms[2] || id==wheel_geoms[3]; }
 
35
    void SetGround(DynamicObject *dwo) { ground_object = dwo; }
 
36
    bool IsStationary(void) const;
 
37
    bool SnapShot(bool revert);
 
38
  protected:
 
39
    ssgSimpleState *FindState(const std::string &statename, ssgEntity *ent);
 
40
    void SetBrakeLight(void);
 
41
    ssgSimpleState *brakelightstate;
 
42
    ssgTransform *chassis_trf;
 
43
    ssgTransform *sink_trf; // for lowering center of mass
 
44
    ssgTransform *wheel_trfs[4];
 
45
    dSpaceID space;
 
46
    dBodyID  chassis_body;
 
47
    dBodyID  wheel_bodies[4];
 
48
    dGeomID  chassis_geom;
 
49
    dGeomID  transform_geom;
 
50
    dGeomID  wheel_geoms[4];
 
51
    dJointID joint[4]; // joint[0..1] are the front wheels
 
52
    float accelerator;
 
53
    float brake;
 
54
    float steer;
 
55
    float downtime;
 
56
    float stationarytime;
 
57
    bool  action;
 
58
    bool  reversegear;
 
59
    bool  ebrake;
 
60
    DynamicObject *ground_object;
 
61
    bool  snapshot_available;
 
62
};
 
63
 
 
64
#endif