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