ScummVM API documentation
scene.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 STARK_SCENE_H
23#define STARK_SCENE_H
24
25#include "common/rect.h"
26
27#include "math/matrix4.h"
28#include "math/ray.h"
29#include "math/vector3d.h"
30
31namespace Stark {
32
33namespace Gfx {
34class Driver;
35class RenderEntry;
36}
37
41class Scene {
42public:
43 Scene(Gfx::Driver *gfx);
44 ~Scene();
45
46 void initCamera(const Math::Vector3d &position, const Math::Vector3d &lookAt,
47 float fov, Common::Rect viewSize, float nearClipPlane, float farClipPlane);
48
50 void scrollCamera(const Common::Rect &viewport);
51
53 Math::Matrix4 getProjectionMatrix() const { return _projectionMatrix; }
54
56 Math::Matrix4 getViewMatrix() const { return _viewMatrix; }
57
65 Math::Ray makeRayFromMouse(const Common::Point &mouse) const;
66
72 Common::Point convertPosition3DToGameScreenOriginal(const Math::Vector3d &obj) const;
73
75 void setFadeLevel(float fadeLevel);
76 float getFadeLevel() const;
77
79 void setSwayAngle(const Math::Angle &angle);
80 Math::Angle getSwayAngle() const;
81
83 Math::Vector3d getSwayDirection() const;
84
86 void setFloatOffset(float floatOffset);
87 float getFloatOffset() const;
88
90 void setupShadows(bool enabled, float length);
91 bool shouldRenderShadows() const { return _shouldRenderShadows; }
92 float getMaxShadowLength() const { return _maxShadowLength; }
93
94private:
95 void computeClippingRect(float *xmin, float *xmax, float *ymin, float *ymax);
96
97 Gfx::Driver *_gfx;
98
99 Math::Vector3d _cameraPosition;
100 Math::Vector3d _cameraLookDirection;
101 float _fov;
102 Common::Rect _viewSize;
103 Common::Rect _viewport;
104 float _nearClipPlane;
105 float _farClipPlane;
106
107 Math::Matrix4 _projectionMatrix;
108 Math::Matrix4 _viewMatrix;
109
110 float _fadeLevel;
111 Math::Angle _swayAngle;
112 float _floatOffset;
113
114 bool _shouldRenderShadows;
115 float _maxShadowLength;
116};
117
118} // End of namespace Stark
119
120#endif // STARK_SCENE_H
Definition: driver.h:44
Definition: scene.h:41
void setSwayAngle(const Math::Angle &angle)
void setFloatOffset(float floatOffset)
Math::Ray makeRayFromMouse(const Common::Point &mouse) const
Math::Matrix4 getProjectionMatrix() const
Definition: scene.h:53
void setFadeLevel(float fadeLevel)
Math::Matrix4 getViewMatrix() const
Definition: scene.h:56
Math::Vector3d getSwayDirection() const
Common::Point convertPosition3DToGameScreenOriginal(const Math::Vector3d &obj) const
void setupShadows(bool enabled, float length)
void scrollCamera(const Common::Rect &viewport)
Definition: rect.h:144
Definition: rect.h:536