1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Filip Gospodinov |
---|
13 | co-programmer: |
---|
14 | */ |
---|
15 | |
---|
16 | #include "shell_command.h" |
---|
17 | #include "cameraman.h" |
---|
18 | #include "game_world_data.h" |
---|
19 | #include "state.h" |
---|
20 | #include "iostream.h" |
---|
21 | #include "sound_engine.h" |
---|
22 | |
---|
23 | ObjectListDefinition(cameraman); |
---|
24 | |
---|
25 | |
---|
26 | cameraman::cameraman() |
---|
27 | { |
---|
28 | this->registerObject(this, cameraman::_objectList); |
---|
29 | |
---|
30 | this->nearClip = 1.0; |
---|
31 | this->farClip = 1000.0; |
---|
32 | |
---|
33 | currentCam=State::getCamera(); |
---|
34 | this->cameras.push_back(currentCam); |
---|
35 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
36 | // currentCam->setClipRegion(nearClip, farClip); |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | void cameraman::createCam() |
---|
41 | { |
---|
42 | // Camera* newCamera=new Camera(); |
---|
43 | this->cameras.push_back(new Camera()); |
---|
44 | cameras[cameras.size()-1]->target->detach(); |
---|
45 | cameras[cameras.size()-1]->setClipRegion(nearClip, farClip); |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | void cameraman::setCam(int cameraNo) |
---|
50 | { |
---|
51 | if (cameraNo<cameras.size()) |
---|
52 | { |
---|
53 | currentCam=cameras[cameraNo]; |
---|
54 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
55 | OrxSound::SoundEngine::getInstance()->setListener(currentCam); |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | void cameraman::testCam() |
---|
63 | { |
---|
64 | cameras[1]->lookAt(currentCam->getTarget()); |
---|
65 | cameras[1]->setParentSoft(currentCam->getParent()); |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | void cameraman::moveCurrCam(int x, int y, int z) |
---|
70 | { |
---|
71 | currentCam->target->trans(x,y,z); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | void cameraman::moveCam(int x, int y, int z, int camNo) |
---|
76 | { |
---|
77 | cameras[camNo]->target->trans(x,y,z); |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | void cameraman::changeTarget(int camNo, PNode* target) |
---|
82 | { |
---|
83 | cameras[camNo]->lookAt(target); |
---|
84 | } |
---|
85 | |
---|
86 | |
---|
87 | void cameraman::changeCurrTarget(PNode* target) |
---|
88 | { |
---|
89 | currentCam->lookAt(target); |
---|
90 | } |
---|
91 | |
---|
92 | void cameraman::atachCurrTarget(PNode* target) |
---|
93 | { |
---|
94 | currentCam->target->atach(target); |
---|
95 | } |
---|
96 | |
---|
97 | void cameraman::jumpCam(int x, int y, int z, int camNo) |
---|
98 | { |
---|
99 | cameras[camNo]->target->jump(x, y, z); |
---|
100 | } |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | void cameraman::setClipRegion(float nearCli, float farCli) |
---|
105 | { |
---|
106 | this->nearClip=nearCli; |
---|
107 | this->farClip=farCli; |
---|
108 | |
---|
109 | for(int i = 0; i < this->cameras.size(); i++) |
---|
110 | cameras[i]->setClipRegion(nearCli, farCli); |
---|
111 | } |
---|
112 | |
---|
113 | |
---|
114 | void cameraman::jumpCurrCam(int x, int y, int z) |
---|
115 | { |
---|
116 | currentCam->target->jump(x, y, z); |
---|
117 | } |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | |
---|
128 | |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | |
---|