ScummVM API documentation
omni3d.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef CRYOMNI3D_OMNI3D_H
23 #define CRYOMNI3D_OMNI3D_H
24 
25 #include "graphics/surface.h"
26 
27 namespace CryOmni3D {
28 
30 public:
31  Omni3DManager() : _vfov(0), _alpha(0), _beta(0), _xSpeed(0), _ySpeed(0), _alphaMin(0), _alphaMax(0),
32  _betaMin(0), _betaMax(0), _helperValue(0), _dirty(true), _dirtyCoords(true),
33  _sourceSurface(nullptr) {}
34  virtual ~Omni3DManager();
35 
36  void init(double hfov);
37 
38  void setSourceSurface(const Graphics::Surface *surface) { _sourceSurface = surface; _dirty = true; }
39 
40  void clearConstraints();
41  void setAlphaConstraints(double alphaMin, double alphaMax) { _alphaMin = alphaMin; _alphaMax = alphaMax; }
42  void setBetaMinConstraint(double betaMin) { _betaMin = betaMin; }
43  void setBetaMaxConstraint(double betaMax) { _betaMax = betaMax; }
44 
45  void setAlpha(double alpha) { _alpha = alpha; _dirtyCoords = true; }
46  void setBeta(double beta) { _beta = beta; _dirtyCoords = true; }
47  void updateCoords(int xDelta, int yDelta, bool useOldSpeed);
48 
49  double getAlpha() const { return _alpha; }
50  double getBeta() const { return _beta; }
51 
52  Common::Point mapMouseCoords(const Common::Point &mouse);
53 
54  bool hasSpeed() { return _xSpeed != 0. || _ySpeed != 0.; }
55  bool needsUpdate() { return _dirty || _dirtyCoords; }
56  const Graphics::Surface *getSurface();
57 
58 private:
59  void updateImageCoords();
60 
61  double _vfov;
62 
63  double _alpha, _beta;
64  double _xSpeed, _ySpeed;
65 
66  double _alphaMin, _alphaMax;
67  double _betaMin, _betaMax;
68 
69  int _imageCoords[2544];
70  double _squaresCoords[31][21];
71  double _hypothenusesH[31];
72  double _anglesH[31];
73  double _oppositeV[21];
74  double _helperValue;
75 
76  bool _dirty;
77  bool _dirtyCoords;
78  const Graphics::Surface *_sourceSurface;
79  Graphics::Surface _surface;
80 };
81 
82 } // End of namespace CryOmni3D
83 
84 #endif
Definition: cryomni3d.h:62
Definition: surface.h:67
Definition: rect.h:45
Definition: omni3d.h:29