Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/chris/src/track.cc @ 2080

Last change on this file since 2080 was 2080, checked in by chris, 20 years ago

orxonox/branches/chris: Implemented basic track and spawning functionality. Added a function to convert a Rotation into a glmatrix. Implemented operator* in Rotation. Refined World, made World friend class of world_entity. Implemented camera functionality (can now be bound to the worldentity it should focus on).

File size: 1.4 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Christian Meyer
15   co-programmer: ...
16*/
17
18#include "track.h"
19
20
21using namespace std;
22
23Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
24{
25        ID = number;
26        offset = start;
27        end = finish;
28        nextID = next;
29}
30
31Track::~Track ()
32{
33}
34
35void Track::map_camera (Location* lookat, Placement* camplc)
36{
37        Line trace(*offset, *end - *offset);
38        float l = trace.len ();
39       
40        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
41        camplc->w = Rotation( (trace.r + (trace.a * ((lookat->dist) / l))) - camplc->r);
42}
43
44bool Track::map_coords (Location* loc, Placement* plc)
45{
46        Line trace(*offset, *end - *offset);
47        float l = trace.len ();
48       
49        if( loc->dist > l)
50        {
51                loc->dist -= l;
52                loc->part = nextID;
53                return true;
54        }
55       
56        Rotation dir(trace.a);
57       
58        plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir);
59        plc->w = dir * loc->rot;
60       
61        return false;
62}
63
64void Track::post_enter (WorldEntity* entity)
65{
66}
67
68void Track::post_leave (WorldEntity* entity)
69{
70}
71
72void Track::tick (float deltaT)
73{
74}
75
76
77
78
79
Note: See TracBrowser for help on using the repository browser.