[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 | |
---|
[10330] | 23 | |
---|
[10272] | 24 | ObjectListDefinition(cameraman); |
---|
[10192] | 25 | |
---|
[10272] | 26 | |
---|
[10192] | 27 | cameraman::cameraman() |
---|
| 28 | { |
---|
[10272] | 29 | this->registerObject(this, cameraman::_objectList); |
---|
| 30 | |
---|
| 31 | this->nearClip = 1.0; |
---|
| 32 | this->farClip = 1000.0; |
---|
| 33 | |
---|
[10197] | 34 | currentCam=State::getCamera(); |
---|
[10206] | 35 | this->cameras.push_back(currentCam); |
---|
[10238] | 36 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
[10330] | 37 | this->fadeToBlack=new blackscreen(); |
---|
[10192] | 38 | } |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | void cameraman::createCam() |
---|
| 42 | { |
---|
[10238] | 43 | // Camera* newCamera=new Camera(); |
---|
| 44 | this->cameras.push_back(new Camera()); |
---|
[10254] | 45 | cameras[cameras.size()-1]->target->detach(); |
---|
[10272] | 46 | cameras[cameras.size()-1]->setClipRegion(nearClip, farClip); |
---|
[10259] | 47 | |
---|
[10192] | 48 | } |
---|
| 49 | |
---|
[10193] | 50 | void cameraman::setCam(int cameraNo) |
---|
[10192] | 51 | { |
---|
[10206] | 52 | if (cameraNo<cameras.size()) |
---|
[10197] | 53 | { |
---|
[10193] | 54 | currentCam=cameras[cameraNo]; |
---|
[10198] | 55 | State::setCamera(currentCam, currentCam->getTarget()); |
---|
[10259] | 56 | OrxSound::SoundEngine::getInstance()->setListener(currentCam); |
---|
| 57 | |
---|
[10197] | 58 | } |
---|
[10195] | 59 | |
---|
[10192] | 60 | } |
---|
| 61 | |
---|
[10195] | 62 | |
---|
[10254] | 63 | void cameraman::testCam() |
---|
| 64 | { |
---|
| 65 | cameras[1]->lookAt(currentCam->getTarget()); |
---|
| 66 | cameras[1]->setParentSoft(currentCam->getParent()); |
---|
| 67 | } |
---|
[10204] | 68 | |
---|
[10254] | 69 | |
---|
[10204] | 70 | void cameraman::moveCurrCam(int x, int y, int z) |
---|
| 71 | { |
---|
| 72 | currentCam->target->trans(x,y,z); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | void cameraman::moveCam(int x, int y, int z, int camNo) |
---|
| 77 | { |
---|
| 78 | cameras[camNo]->target->trans(x,y,z); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | void cameraman::changeTarget(int camNo, PNode* target) |
---|
| 83 | { |
---|
[10236] | 84 | cameras[camNo]->lookAt(target); |
---|
[10204] | 85 | } |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | void cameraman::changeCurrTarget(PNode* target) |
---|
| 89 | { |
---|
[10236] | 90 | currentCam->lookAt(target); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | void cameraman::atachCurrTarget(PNode* target) |
---|
| 94 | { |
---|
[10205] | 95 | currentCam->target->atach(target); |
---|
[10204] | 96 | } |
---|
| 97 | |
---|
| 98 | void cameraman::jumpCam(int x, int y, int z, int camNo) |
---|
| 99 | { |
---|
[10206] | 100 | cameras[camNo]->target->jump(x, y, z); |
---|
[10204] | 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
[10272] | 104 | |
---|
| 105 | void cameraman::setClipRegion(float nearCli, float farCli) |
---|
| 106 | { |
---|
| 107 | this->nearClip=nearCli; |
---|
| 108 | this->farClip=farCli; |
---|
| 109 | |
---|
| 110 | for(int i = 0; i < this->cameras.size(); i++) |
---|
| 111 | cameras[i]->setClipRegion(nearCli, farCli); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
[10206] | 115 | void cameraman::jumpCurrCam(int x, int y, int z) |
---|
[10204] | 116 | { |
---|
[10206] | 117 | currentCam->target->jump(x, y, z); |
---|
[10204] | 118 | } |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | |
---|
[10330] | 126 | void cameraman::togglFade() |
---|
| 127 | { |
---|
| 128 | if( this->fadeToBlack) |
---|
| 129 | fadeToBlack->toggleFade(); |
---|
| 130 | } |
---|
[10204] | 131 | |
---|
| 132 | |
---|
| 133 | |
---|
[10330] | 134 | //how to get a class fkt pointer |
---|
[10204] | 135 | |
---|
[10330] | 136 | //BaseObject* object = ObjectListBase::getBaseObject(className, objectName); |
---|
[10204] | 137 | |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | |
---|
[10330] | 149 | |
---|
| 150 | |
---|