Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/camera/src/world_entities/cameraman.cc @ 10330

Last change on this file since 10330 was 10330, checked in by gfilip, 19 years ago

all working

File size: 2.5 KB
RevLine 
[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]24ObjectListDefinition(cameraman);
[10192]25
[10272]26
[10192]27cameraman::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
41void 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]50void 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]63void cameraman::testCam()
64{
65cameras[1]->lookAt(currentCam->getTarget());
66cameras[1]->setParentSoft(currentCam->getParent());
67}
[10204]68
[10254]69
[10204]70void cameraman::moveCurrCam(int x, int y, int z)
71{
72currentCam->target->trans(x,y,z);
73}
74
75
76void cameraman::moveCam(int x, int y, int z, int camNo)
77{
78cameras[camNo]->target->trans(x,y,z);
79}
80
81
82void cameraman::changeTarget(int camNo, PNode* target)
83{
[10236]84  cameras[camNo]->lookAt(target);
[10204]85}
86
87
88void cameraman::changeCurrTarget(PNode* target)
89{
[10236]90  currentCam->lookAt(target);
91}
92
93void cameraman::atachCurrTarget(PNode* target)
94{
[10205]95  currentCam->target->atach(target);
[10204]96}
97
98void 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
105void 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]115void 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]126void 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
Note: See TracBrowser for help on using the repository browser.