ScummVM API documentation
ad_scene_geometry.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 /*
23  * This file is based on WME.
24  * http://dead-code.org/redir.php?target=wme
25  * Copyright (c) 2003-2013 Jan Nedoma and contributors
26  */
27 
28 #ifndef WINTERMUTE_AD_SCENE_GEOMETRY_H
29 #define WINTERMUTE_AD_SCENE_GEOMETRY_H
30 
31 #include "engines/wintermute/base/base_object.h"
32 #include "engines/wintermute/math/rect32.h"
33 #include "math/matrix4.h"
34 #include "math/vector3d.h"
35 
36 namespace Wintermute {
37 
38 class BaseSprite;
39 class Camera3D;
40 class Light3D;
41 class Block3D;
42 class AdGeneric;
43 class AdBlock;
44 class AdWalkplane;
45 class AdPath3D;
46 class AdWaypointGroup3D;
47 class AdGeomExt;
48 class AdPathPoint3D;
49 
50 class AdSceneGeometry : public BaseObject {
51 public:
52  bool _maxLightsWarning;
53  bool dropWaypoints();
54  bool setLightColor(const char *lightName, uint32 color);
55  uint32 getLightColor(const char *lightName);
56  Math::Vector3d getLightPos(const char *lightName);
57  bool enableNode(const char *nodeName, bool enable = true);
58  bool isNodeEnabled(const char *nodeName);
59  bool enableLight(const char *lightName, bool enable = true);
60  bool isLightEnabled(const char *lightName);
61  DECLARE_PERSISTENT(AdSceneGeometry, BaseObject)
62  bool correctTargetPoint(const Math::Vector3d &source, Math::Vector3d *target);
63 
64  bool _lastValuesInitialized;
65  Math::Matrix4 _lastWorldMat;
66  Math::Matrix4 _lastViewMat;
67  Math::Matrix4 _lastProjMat;
68  int _lastOffsetX;
69  int _lastOffsetY;
70  Rect32 _drawingViewport;
71  int _lastScrollX;
72  int _lastScrollY;
73 
74  bool createLights();
75  bool enableLights(Math::Vector3d Point, BaseArray<char *> &IgnoreLights);
76 
77  bool initLoop();
78  float getPointsDist(Math::Vector3d p1, Math::Vector3d p2);
79  void pathFinderStep();
80  bool getPath(Math::Vector3d source, Math::Vector3d target, AdPath3D *path, bool rerun = false);
81  bool convert2Dto3D(int x, int y, Math::Vector3d *pos);
82  bool convert2Dto3DTolerant(int x, int y, Math::Vector3d *pos);
83  bool convert3Dto2D(Math::Vector3d *pos, int32 *x, int32 *y);
84  BaseSprite *_wptMarker;
85  float _waypointHeight;
86  bool directPathExists(Math::Vector3d *p1, Math::Vector3d *p2);
87  float getHeightAt(Math::Vector3d pos, float Ttlerance = 0.0f, bool *intFound = NULL);
88 
89  bool storeDrawingParams();
90  bool render(bool render);
91  bool renderShadowGeometry();
92 
93  Math::Matrix4 *getViewMatrix();
94  Math::Matrix4 _viewMatrix;
95  bool setActiveCamera(const char *camera, float fov, float nearClipPlane, float farClipPlane);
96  bool setActiveCamera(int camera, float fow, float nearClipPlane, float farClipPlane);
97  //bool SetActiveCameraTwin(char* Camera);
98  //bool SetActiveCameraTwin(int Camera);
99  Camera3D *getActiveCamera();
100  int32 _activeCamera;
101 
102  bool setActiveLight(char *light);
103  bool setActiveLight(int light);
104  int32 _activeLight;
105 
106  void cleanup();
107  AdSceneGeometry(BaseGame *inGame);
108  virtual ~AdSceneGeometry();
109  bool loadFile(const char *filename);
110  BaseArray<AdWalkplane *> _planes;
111  BaseArray<AdBlock *> _blocks;
112  BaseArray<AdGeneric *> _generics;
113  BaseArray<Camera3D *> _cameras;
114  BaseArray<Light3D *> _lights;
115  BaseArray<AdWaypointGroup3D *> _waypointGroups;
116  uint32 _PFMaxTime;
117 
118 private:
119  AdGeomExt *getGeometryExtension(char *filename);
120  Math::Vector3d getBlockIntersection(Math::Vector3d *p1, Math::Vector3d *p2);
121  bool _PFReady;
122  Math::Vector3d _PFSource;
123  Math::Vector3d _PFTarget;
124  AdPath3D *_PFTargetPath;
125  Math::Vector3d _PFAlternateTarget;
126  float _PFAlternateDist;
127  bool _PFRerun;
129 };
130 
131 } // namespace Wintermute
132 
133 #endif
Definition: base_game.h:75
Definition: ad_path3d.h:39
Definition: display_client.h:58
Definition: rect32.h:60
Definition: ad_geom_ext.h:38
Definition: ad_scene_geometry.h:50
Definition: coll_templ.h:63
Definition: base_sprite.h:40
Definition: 3dcamera.h:40
Definition: coll_templ.h:89
Definition: base_object.h:57
Definition: achievements_tables.h:27