00001 /* ResidualVM - A 3D game interpreter 00002 * 00003 * ResidualVM is the legal property of its developers, whose names 00004 * are too numerous to list here. Please refer to the AUTHORS 00005 * file distributed with this source distribution. 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef STARK_SCENE_H 00024 #define STARK_SCENE_H 00025 00026 #include "common/rect.h" 00027 00028 #include "math/matrix4.h" 00029 #include "math/ray.h" 00030 #include "math/vector3d.h" 00031 00032 namespace Stark { 00033 00034 namespace Gfx { 00035 class Driver; 00036 class RenderEntry; 00037 } 00038 00042 class Scene { 00043 public: 00044 Scene(Gfx::Driver *gfx); 00045 ~Scene(); 00046 00047 void initCamera(const Math::Vector3d &position, const Math::Vector3d &lookAt, 00048 float fov, Common::Rect viewSize, float nearClipPlane, float farClipPlane); 00049 00051 void scrollCamera(const Common::Rect &viewport); 00052 00054 Math::Matrix4 getProjectionMatrix() const { return _projectionMatrix; } 00055 00057 Math::Matrix4 getViewMatrix() const { return _viewMatrix; } 00058 00066 Math::Ray makeRayFromMouse(const Common::Point &mouse) const; 00067 00073 Common::Point convertPosition3DToGameScreenOriginal(const Math::Vector3d &obj) const; 00074 00076 void setFadeLevel(float fadeLevel); 00077 float getFadeLevel() const; 00078 00080 void setSwayAngle(const Math::Angle &angle); 00081 Math::Angle getSwayAngle() const; 00082 00084 Math::Vector3d getSwayDirection() const; 00085 00087 void setFloatOffset(float floatOffset); 00088 float getFloatOffset() const; 00089 00091 void setMaxShadowLength(float length) { _maxShadowLength = length; } 00092 float getMaxShadowLength() const { return _maxShadowLength; } 00093 00094 private: 00095 void computeClippingRect(float *xmin, float *xmax, float *ymin, float *ymax); 00096 00097 Gfx::Driver *_gfx; 00098 00099 Math::Vector3d _cameraPosition; 00100 Math::Vector3d _cameraLookDirection; 00101 float _fov; 00102 Common::Rect _viewSize; 00103 Common::Rect _viewport; 00104 float _nearClipPlane; 00105 float _farClipPlane; 00106 00107 Math::Matrix4 _projectionMatrix; 00108 Math::Matrix4 _viewMatrix; 00109 00110 float _fadeLevel; 00111 Math::Angle _swayAngle; 00112 float _floatOffset; 00113 00114 float _maxShadowLength; 00115 }; 00116 00117 } // End of namespace Stark 00118 00119 #endif // STARK_SCENE_H