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, 17 years ago

all working

File size: 2.5 KB
Line 
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
24ObjectListDefinition(cameraman);
25
26
27cameraman::cameraman()
28{
29  this->registerObject(this, cameraman::_objectList);
30
31  this->nearClip = 1.0;
32  this->farClip = 1000.0;
33
34  currentCam=State::getCamera();
35  this->cameras.push_back(currentCam);
36  State::setCamera(currentCam, currentCam->getTarget());
37  this->fadeToBlack=new blackscreen();
38}
39
40
41void cameraman::createCam()
42{
43 // Camera* newCamera=new Camera();
44  this->cameras.push_back(new Camera());
45  cameras[cameras.size()-1]->target->detach();
46  cameras[cameras.size()-1]->setClipRegion(nearClip, farClip);
47
48}
49
50void cameraman::setCam(int cameraNo)
51{
52  if (cameraNo<cameras.size())
53  {
54  currentCam=cameras[cameraNo];
55  State::setCamera(currentCam, currentCam->getTarget());
56  OrxSound::SoundEngine::getInstance()->setListener(currentCam);
57
58  }
59
60}
61
62
63void cameraman::testCam()
64{
65cameras[1]->lookAt(currentCam->getTarget());
66cameras[1]->setParentSoft(currentCam->getParent());
67}
68
69
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{
84  cameras[camNo]->lookAt(target);
85}
86
87
88void cameraman::changeCurrTarget(PNode* target)
89{
90  currentCam->lookAt(target);
91}
92
93void cameraman::atachCurrTarget(PNode* target)
94{
95  currentCam->target->atach(target);
96}
97
98void cameraman::jumpCam(int x, int y, int z, int camNo)
99{
100  cameras[camNo]->target->jump(x, y, z);
101}
102
103
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
115void cameraman::jumpCurrCam(int x, int y, int z)
116{
117  currentCam->target->jump(x, y, z);
118}
119
120
121
122
123
124
125
126void cameraman::togglFade()
127{
128  if( this->fadeToBlack)
129    fadeToBlack->toggleFade();
130}
131
132
133
134//how to get a class fkt pointer
135
136//BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Note: See TracBrowser for help on using the repository browser.