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