Last change
on this file since 2105 was
2101,
checked in by chris, 20 years ago
|
orxonox/branches/chris: Finished the "GETITTOCOMPILE" project… compiling should work now, but linking is a different story
|
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 | using namespace std; |
---|
21 | |
---|
22 | Track::Track () |
---|
23 | { |
---|
24 | ID = 0; |
---|
25 | offset = NULL; |
---|
26 | end = NULL; |
---|
27 | nextID = 0; |
---|
28 | } |
---|
29 | |
---|
30 | Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish) |
---|
31 | { |
---|
32 | ID = number; |
---|
33 | offset = start; |
---|
34 | end = finish; |
---|
35 | nextID = next; |
---|
36 | } |
---|
37 | |
---|
38 | Track::~Track () |
---|
39 | { |
---|
40 | } |
---|
41 | |
---|
42 | void Track::map_camera (Location* lookat, Placement* camplc) |
---|
43 | { |
---|
44 | Line trace(*offset, *end - *offset); |
---|
45 | float l = trace.len (); |
---|
46 | |
---|
47 | camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0); |
---|
48 | camplc->w = Rotation( (trace.r + (trace.a * ((lookat->dist) / l))) - camplc->r); |
---|
49 | } |
---|
50 | |
---|
51 | bool Track::map_coords (Location* loc, Placement* plc) |
---|
52 | { |
---|
53 | Line trace(*offset, *end - *offset); |
---|
54 | float l = trace.len (); |
---|
55 | |
---|
56 | if( loc->dist > l) |
---|
57 | { |
---|
58 | loc->dist -= l; |
---|
59 | loc->part = nextID; |
---|
60 | return true; |
---|
61 | } |
---|
62 | |
---|
63 | Rotation dir(trace.a); |
---|
64 | |
---|
65 | plc->r = trace.r + (trace.a * ((loc->dist) / l)) + rotate_vector( loc->pos, dir); |
---|
66 | plc->w = dir * loc->rot; |
---|
67 | |
---|
68 | return false; |
---|
69 | } |
---|
70 | |
---|
71 | void Track::post_enter (WorldEntity* entity) |
---|
72 | { |
---|
73 | } |
---|
74 | |
---|
75 | void Track::post_leave (WorldEntity* entity) |
---|
76 | { |
---|
77 | } |
---|
78 | |
---|
79 | void Track::tick (float deltaT) |
---|
80 | { |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | |
---|
Note: See
TracBrowser
for help on using the repository browser.