[10206] | 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 | |
---|
[10192] | 16 | #include "shell_command.h" |
---|
| 17 | #include "cameraman.h" |
---|
[10238] | 18 | #include "game_world_data.h" |
---|
[10195] | 19 | #include "state.h" |
---|
[10238] | 20 | #include "iostream.h" |
---|
[10259] | 21 | #include "sound_engine.h" |
---|
[10192] | 22 | |
---|
[10272] | 23 | ObjectListDefinition(cameraman); |
---|
[10192] | 24 | |
---|
[10272] | 25 | |
---|
[10192] | 26 | cameraman::cameraman() |
---|
| 27 | { |
---|
[10272] | 28 | this->registerObject(this, cameraman::_objectList); |
---|
| 29 | |
---|
| 30 | this->nearClip = 1.0; |
---|
| 31 | this->farClip = 1000.0; |
---|
| 32 | |
---|
[10197] | 33 | currentCam=State::getCamera(); |
---|
[10206] | 34 | this->cameras.push_back(currentCam); |
---|
[10238] | 35 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
[10272] | 36 | // currentCam->setClipRegion(nearClip, farClip); |
---|
[10192] | 37 | } |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | void cameraman::createCam() |
---|
| 41 | { |
---|
[10238] | 42 | // Camera* newCamera=new Camera(); |
---|
| 43 | this->cameras.push_back(new Camera()); |
---|
[10254] | 44 | cameras[cameras.size()-1]->target->detach(); |
---|
[10272] | 45 | cameras[cameras.size()-1]->setClipRegion(nearClip, farClip); |
---|
[10259] | 46 | |
---|
[10192] | 47 | } |
---|
| 48 | |
---|
[10193] | 49 | void cameraman::setCam(int cameraNo) |
---|
[10192] | 50 | { |
---|
[10206] | 51 | if (cameraNo<cameras.size()) |
---|
[10197] | 52 | { |
---|
[10193] | 53 | currentCam=cameras[cameraNo]; |
---|
[10198] | 54 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
[10259] | 55 | OrxSound::SoundEngine::getInstance()->setListener(currentCam); |
---|
| 56 | |
---|
[10197] | 57 | } |
---|
[10195] | 58 | |
---|
[10192] | 59 | } |
---|
| 60 | |
---|
[10195] | 61 | |
---|
[10254] | 62 | void cameraman::testCam() |
---|
| 63 | { |
---|
| 64 | cameras[1]->lookAt(currentCam->getTarget()); |
---|
| 65 | cameras[1]->setParentSoft(currentCam->getParent()); |
---|
| 66 | } |
---|
[10204] | 67 | |
---|
[10254] | 68 | |
---|
[10204] | 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 | { |
---|
[10236] | 83 | cameras[camNo]->lookAt(target); |
---|
[10204] | 84 | } |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | void cameraman::changeCurrTarget(PNode* target) |
---|
| 88 | { |
---|
[10236] | 89 | currentCam->lookAt(target); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | void cameraman::atachCurrTarget(PNode* target) |
---|
| 93 | { |
---|
[10205] | 94 | currentCam->target->atach(target); |
---|
[10204] | 95 | } |
---|
| 96 | |
---|
| 97 | void cameraman::jumpCam(int x, int y, int z, int camNo) |
---|
| 98 | { |
---|
[10206] | 99 | cameras[camNo]->target->jump(x, y, z); |
---|
[10204] | 100 | } |
---|
| 101 | |
---|
| 102 | |
---|
[10272] | 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 | |
---|
[10206] | 114 | void cameraman::jumpCurrCam(int x, int y, int z) |
---|
[10204] | 115 | { |
---|
[10206] | 116 | currentCam->target->jump(x, y, z); |
---|
[10204] | 117 | } |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | |
---|