Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
engine.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
27 #include "common/singleton.h"
28 
29 #include "graphics/core/color.h"
30 #include "graphics/core/material.h"
31 #include "graphics/core/texture.h"
32 #include "graphics/core/vertex.h"
33 
34 #include "math/intpoint.h"
35 #include "math/matrix.h"
36 #include "math/point.h"
37 #include "math/sphere.h"
38 #include "math/vector.h"
39 
40 
41 #include <string>
42 #include <vector>
43 #include <map>
44 #include <set>
45 #include <memory>
46 #include <unordered_map>
47 
48 
49 class CApplication;
50 class CSoundInterface;
51 class CImage;
52 class CSystemUtils;
53 struct SystemTimeStamp;
54 struct Event;
55 
56 
57 // Graphics module namespace
58 namespace Gfx
59 {
60 
61 
62 class CDevice;
63 class COldModelManager;
64 class CLightManager;
65 class CText;
66 class CParticle;
67 class CWater;
68 class CCloud;
69 class CLightning;
70 class CPlanet;
71 class CTerrain;
72 class CPyroManager;
73 class CModelMesh;
74 struct ModelShadowSpot;
75 struct ModelTriangle;
76 
77 
86 {
96  ENG_RSTATE_WRAP = (1<<3),
98  ENG_RSTATE_CLAMP = (1<<4),
110  ENG_RSTATE_PART3 = (1<<10),
112  ENG_RSTATE_PART4 = (1<<11),
114  ENG_RSTATE_2FACE = (1<<12),
116  ENG_RSTATE_ALPHA = (1<<13),
118  ENG_RSTATE_SECOND = (1<<14),
120  ENG_RSTATE_FOG = (1<<15),
126  ENG_RSTATE_TEXT = (1<<18),
135 };
136 
137 
143 {
148 };
149 
155 {
163  std::string tex1Name;
165  std::string tex2Name;
166 };
167 
172 {
187 };
188 
189 
195 {
196  EngineTriangleType type;
197  Material material;
198  int state;
199  std::vector<VertexTex2> vertices;
200  unsigned int staticBufferId;
201  bool updateStaticBuffer;
202 
204  const Material& material = Material(),
205  int state = ENG_RSTATE_NORMAL)
206  : type(type)
207  , material(material)
208  , state(state)
209  , staticBufferId(0)
210  , updateStaticBuffer(false)
211  {}
212 };
213 
219 {
220  std::string tex1Name;
221  Texture tex1;
222  std::string tex2Name;
223  Texture tex2;
224  std::vector<EngineBaseObjDataTier> next;
225 
226  inline EngineBaseObjTexTier(const std::string& tex1Name = "",
227  const std::string& tex2Name = "")
228  : tex1Name(tex1Name)
229  , tex2Name(tex2Name)
230  {}
231 };
232 
240 {
242  bool used = false;
244  int totalTriangles = 0;
250  float radius = 0.0f;
252  std::vector<EngineBaseObjTexTier> next;
253 
254  inline void LoadDefault()
255  {
256  *this = EngineBaseObject();
257  }
258 };
259 
265 {
267  bool used = false;
269  int baseObjRank = -1;
271  bool visible = false;
273  bool drawWorld = false;
275  bool drawFront = false;
281  float distance = 0.0f;
283  int shadowRank = -1;
285  float transparency = 0.0f;
286 
288  inline void LoadDefault()
289  {
290  *this = EngineObject();
291  }
292 };
293 
299 {
304 };
305 
311 {
313  bool used = false;
315  bool hide = false;
317  int objRank = -1;
325  float angle = 0.0f;
327  float radius = 0.0f;
329  float intensity = 0.0f;
331  float height = 0.0f;
332 
333  void LoadDefault()
334  {
335  *this = EngineShadow();
336  }
337 };
338 
344 {
346  bool used = false;
350  float min = 0.0f;
352  float max = 0.0f;
354  float smooth = 0.0f;
358  float radius = 0.0f;
362  float drawRadius = 0.0f;
363 
364  void LoadDefault()
365  {
366  *this = EngineGroundSpot();
367  }
368 };
369 
375 {
384 };
385 
391 {
393  bool draw = false;
397  float delay[3] = {};
399  float fix = 0.0f;
403  float radius = 0.0f;
405  float intensity = 0.0f;
409  float drawRadius = 0.0f;
411  float drawIntensity = 0.0f;
413  int dx = 0;
415  int dy = 0;
417  char* table = nullptr;
418 
419  void LoadDefault()
420  {
421  *this = EngineGroundMark();
422  }
423 };
424 
430 {
431  ENG_TEX_MAPPING_X = 1,
432  ENG_TEX_MAPPING_Y = 2,
433  ENG_TEX_MAPPING_Z = 3,
434  ENG_TEX_MAPPING_1X = 4,
435  ENG_TEX_MAPPING_1Y = 5,
436  ENG_TEX_MAPPING_1Z = 6
437 };
438 
439 
445 {
480 
483 };
484 
485 
585 class CEngine : public CSingleton<CEngine>
586 {
587 public:
588  CEngine(CApplication* app, CSystemUtils* systemUtils);
589  ~CEngine();
590 
592  void SetDevice(CDevice* device);
594  CDevice* GetDevice();
595 
597  CText* GetText();
598  COldModelManager* GetModelManager();
599  CPyroManager* GetPyroManager();
605  CTerrain* GetTerrain();
607  CWater* GetWater();
611  CPlanet* GetPlanet();
613  CCloud* GetCloud();
614 
616  void SetTerrain(CTerrain* terrain);
617 
618 
620  bool Create();
622  void Destroy();
623 
624 
626  void Render();
627 
628 
630  bool ProcessEvent(const Event& event);
631 
633  void FrameUpdate();
634 
635 
637  void WriteScreenShot(const std::string& fileName);
638 
639 
641  void SetPause(bool pause);
643  bool GetPause();
645 
647  void SetShowStats(bool show);
649  bool GetShowStats();
651 
653  void SetRenderEnable(bool enable);
654 
655  void SetRenderInterface(bool enable);
656  bool GetRenderInterface();
657 
659 
660  void SetScreenshotMode(bool screenshotMode);
661  bool GetScreenshotMode();
663 
666 
668 
672  Math::IntPoint InterfaceToWindowCoords(Math::Point pos);
674 
676 
679  Math::IntPoint InterfaceToWindowSize(Math::Point size);
681 
683  void AddStatisticTriangle(int count);
685  int GetStatisticTriangle();
686 
688  void SetStatisticPos(Math::Vector pos);
689 
691  void SetTimerDisplay(const std::string& text);
692 
693 
694  /* *************** New mesh interface *************** */
696 
704  int AddStaticMesh(const std::string& key, const Gfx::CModelMesh* mesh, const Math::Matrix& worldMatrix);
705 
707  void DeleteStaticMesh(int meshHandle);
708 
710  void AddStaticMeshShadowSpot(int meshHandle, const Gfx::ModelShadowSpot& shadowSpot);
711 
713  const Math::Matrix& GetStaticMeshWorldMatrix(int meshHandle);
714 
716  void SetStaticMeshTransparency(int meshHandle, float value);
717 
718 
719  /* *************** Object management *************** */
720 
721  // Base objects
722 
724  int CreateBaseObject();
726  void DeleteBaseObject(int baseObjRank);
728  void DeleteAllBaseObjects();
729 
731  void CopyBaseObject(int sourceBaseObjRank, int destBaseObjRank);
732 
734  void AddBaseObjTriangles(int baseObjRank, const std::vector<Gfx::ModelTriangle>& triangles);
735 
737  void AddBaseObjQuick(int baseObjRank, const EngineBaseObjDataTier& buffer,
738  std::string tex1Name, std::string tex2Name,
739  bool globalUpdate);
740 
741  // Objects
742 
744  void DebugObject(int objRank);
745 
747  int CreateObject();
749  void DeleteAllObjects();
751  void DeleteObject(int objRank);
752 
754  void SetObjectBaseRank(int objRank, int baseObjRank);
756  int GetObjectBaseRank(int objRank);
758 
760  void SetObjectType(int objRank, EngineObjectType type);
762  EngineObjectType GetObjectType(int objRank);
764 
766  void SetObjectTransform(int objRank, const Math::Matrix& transform);
768  void GetObjectTransform(int objRank, Math::Matrix& transform);
770 
772  void SetObjectDrawWorld(int objRank, bool draw);
774  void SetObjectDrawFront(int objRank, bool draw);
775 
777  void SetObjectTransparency(int objRank, float value);
778 
780  void GetObjectBBox(int objRank, Math::Vector& min, Math::Vector& max);
781 
783  int GetObjectTotalTriangles(int objRank);
784 
786  EngineBaseObjDataTier* FindTriangles(int objRank, const Material& material,
787  int state, std::string tex1Name, std::string tex2Name);
788 
790  int GetPartialTriangles(int objRank, float percent, int maxCount,
791  std::vector<EngineTriangle>& triangles);
792 
794  void ChangeSecondTexture(int objRank, const std::string& tex2Name);
795 
797  void ChangeTextureMapping(int objRank, const Material& mat, int state,
798  const std::string& tex1Name, const std::string& tex2Name,
800  float au, float bu, float av, float bv);
801 
803  void TrackTextureMapping(int objRank, const Material& mat, int state,
804  const std::string& tex1Name, const std::string& tex2Name,
806  float pos, float factor, float tl, float ts, float tt);
807 
809 
810  int DetectObject(Math::Point mouse, Math::Vector& targetPos, bool terrain = false);
811 
813  void CreateShadowSpot(int objRank);
815  void DeleteShadowSpot(int objRank);
816 
818  void SetObjectShadowSpotHide(int objRank, bool hide);
820  void SetObjectShadowSpotType(int objRank, EngineShadowType type);
821  void SetObjectShadowSpotPos(int objRank, const Math::Vector& pos);
822  void SetObjectShadowSpotAngle(int objRank, float angle);
823  void SetObjectShadowSpotRadius(int objRank, float radius);
824  void SetObjectShadowSpotIntensity(int objRank, float intensity);
825  void SetObjectShadowSpotHeight(int objRank, float height);
826  void UpdateObjectShadowSpotNormal(int objRank);
828 
830  void SetHighlightRank(int* rankList);
832  bool GetHighlight(Math::Point& p1, Math::Point& p2);
833 
835  void DeleteAllGroundSpots();
837  int CreateGroundSpot();
839  void DeleteGroundSpot(int rank);
840 
842  void SetObjectGroundSpotPos(int rank, const Math::Vector& pos);
844  void SetObjectGroundSpotRadius(int rank, float radius);
845  void SetObjectGroundSpotColor(int rank, const Color& color);
846  void SetObjectGroundSpotMinMax(int rank, float min, float max);
847  void SetObjectGroundSpotSmooth(int rank, float smooth);
849 
851  void CreateGroundMark(Math::Vector pos, float radius,
852  float delay1, float delay2, float delay3,
853  int dx, int dy, char* table);
855  void DeleteGroundMark(int rank);
856 
858  void Update();
859 
860 
861  /* *************** Mode setting *************** */
862 
864  void SetState(int state, const Color& color = Color(1.0f, 1.0f, 1.0f, 1.0f));
865 
867  void SetMaterial(const Material& mat);
868 
870  void SetViewParams(const Math::Vector &eyePt, const Math::Vector &lookatPt, const Math::Vector &upVec);
871 
873  Texture LoadTexture(const std::string& name);
875  Texture LoadTexture(const std::string& name, CImage* image);
877  Texture LoadTexture(const std::string& name, const TextureCreateParams& params);
879  bool LoadAllTextures();
880 
882 
883  bool ChangeTextureColor(const std::string& texName,
884  const std::string& srcName,
885  Color colorRef1, Color colorNew1,
886  Color colorRef2, Color colorNew2,
887  float tolerance1, float tolerance2,
888  Math::Point ts, Math::Point ti,
889  Math::Point *exclude = nullptr,
890  float shift = 0.0f, bool hsv = false);
891  bool ChangeTextureColor(const std::string& texName,
892  Color colorRef1, Color colorNew1,
893  Color colorRef2, Color colorNew2,
894  float tolerance1, float tolerance2,
895  Math::Point ts, Math::Point ti,
896  Math::Point *exclude = nullptr,
897  float shift = 0.0f, bool hsv = false);
899 
901 
902  bool SetTexture(const std::string& name, int stage = 0);
904  void SetTexture(const Texture& tex, int stage = 0);
905 
907  void DeleteTexture(const std::string& texName);
909  void DeleteTexture(const Texture& tex);
910 
912  void CreateOrUpdateTexture(const std::string& texName, CImage* img);
913 
915  void FlushTextureCache();
916 
918  void SetTerrainVision(float vision);
919 
921 
925  void SetFocus(float focus);
926  float GetFocus();
928 
930  // NOTE: This is an user configuration setting
932  void SetDirty(bool mode);
933  bool GetDirty();
935 
937  // NOTE: This is an user configuration setting
939  void SetFog(bool mode);
940  bool GetFog();
942 
944  void SetSecondTexture(const std::string& texNum);
946  const std::string& GetSecondTexture();
948 
950  void SetRankView(int rank);
952  int GetRankView();
954 
956  void SetDrawWorld(bool draw);
957 
959  void SetDrawFront(bool draw);
960 
962  void SetAmbientColor(const Color& color, int rank = 0);
964  Color GetAmbientColor(int rank = 0);
966 
968  void SetWaterAddColor(const Color& color);
970  Color GetWaterAddColor();
972 
974  void SetFogColor(const Color& color, int rank = 0);
976  Color GetFogColor(int rank = 0);
978 
980 
983  void SetDeepView(float length, int rank = 0, bool ref=false);
984  float GetDeepView(int rank = 0);
986 
987 
989 
992  void SetFogStart(float start, int rank = 0);
993  float GetFogStart(int rank = 0);
995 
997  void SetBackground(const std::string& name, Color up = Color(), Color down = Color(),
999  Color cloudUp = Color(), Color cloudDown = Color(),
1000  bool full = false, bool scale = false);
1001  void GetBackground(std::string& name, Color& up, Color& down,
1002  Color& cloudUp, Color& cloudDown,
1003  bool& full, bool& scale);
1005 
1007  void SetForegroundName(const std::string& name);
1009  void SetOverFront(bool front);
1011  void SetOverColor(const Color& color = Color(), int mode = ENG_RSTATE_TCOLOR_BLACK);
1012 
1014  // NOTE: This is an user configuration setting
1016  void SetParticleDensity(float value);
1017  float GetParticleDensity();
1019 
1021  float ParticleAdapt(float factor);
1022 
1024  // NOTE: This is an user configuration setting
1026  void SetClippingDistance(float value);
1027  float GetClippingDistance();
1029 
1031  // NOTE: This is an user configuration setting
1033  void SetTextureFilterMode(TexFilter value);
1034  TexFilter GetTextureFilterMode();
1036 
1038  // NOTE: This is an user configuration setting
1040  void SetTextureMipmapLevel(int value);
1041  int GetTextureMipmapLevel();
1043 
1045  // NOTE: This is an user configuration setting
1047  void SetTextureAnisotropyLevel(int value);
1048  int GetTextureAnisotropyLevel();
1050 
1052  // NOTE: These are user configuration settings
1054  bool IsShadowMappingSupported();
1055  void SetShadowMapping(bool value);
1056  bool GetShadowMapping();
1057  void SetShadowMappingOffscreen(bool value);
1058  bool GetShadowMappingOffscreen();
1059  void SetShadowMappingOffscreenResolution(int resolution);
1060  int GetShadowMappingOffscreenResolution();
1061  bool IsShadowMappingQualitySupported();
1062  void SetShadowMappingQuality(bool value);
1063  bool GetShadowMappingQuality();
1064  void SetTerrainShadows(bool value);
1065  bool GetTerrainShadows();
1067 
1069  // NOTE: This is a setting configurable only in INI file
1071  void SetShadowColor(float value);
1072  float GetShadowColor();
1074 
1076  // NOTE: This is a setting configurable only in INI file
1078  void SetShadowRange(float value);
1079  float GetShadowRange();
1081 
1083  // NOTE: This is an user configuration setting
1085  void SetMultiSample(int value);
1086  int GetMultiSample();
1088 
1090  void SetBackForce(bool present);
1092  bool GetBackForce();
1094 
1096  // NOTE: This is an user configuration setting
1098  void SetLightMode(bool present);
1099  bool GetLightMode();
1101 
1103  // NOTE: This is an user configuration setting
1105  // TODO: Move to CSettings
1106  void SetEditIndentMode(bool autoIndent);
1107  bool GetEditIndentMode();
1109 
1111  // NOTE: This is an user configuration setting
1113  // TODO: Move to CSettings
1114  void SetEditIndentValue(int value);
1115  int GetEditIndentValue();
1117 
1119  void SetTracePrecision(float factor);
1121  float GetTracePrecision();
1123 
1125  void SetMouseType(EngineMouseType type);
1127  EngineMouseType GetMouseType();
1129 
1131  void SetPauseBlurEnabled(bool enable);
1133  bool GetPauseBlurEnabled();
1135 
1137  const Math::Matrix& GetMatView();
1139  TEST_VIRTUAL Math::Vector GetEyePt();
1141  TEST_VIRTUAL Math::Vector GetLookatPt();
1143  float GetEyeDirH();
1145  float GetEyeDirV();
1147  bool IsVisiblePoint(const Math::Vector& pos);
1148 
1150  void UpdateMatProj();
1151 
1153  void ApplyChange();
1154 
1155  void ClearDisplayCrashSpheres();
1156  void AddDisplayCrashSpheres(const std::vector<Math::Sphere>& crashSpheres);
1157 
1158  void SetDebugLights(bool debugLights);
1159  bool GetDebugLights();
1160  void DebugDumpLights();
1161 
1162  void SetDebugResources(bool debugResources);
1163  bool GetDebugResources();
1164 
1165  void SetDebugGoto(bool debugGoto);
1166  bool GetDebugGoto();
1167  void AddDebugGotoLine(std::vector<Gfx::VertexCol> line);
1168  void SetDebugGotoBitmap(std::unique_ptr<CImage> debugImage);
1169 
1170  void SetWindowCoordinates();
1171  void SetInterfaceCoordinates();
1172 
1173  void EnablePauseBlur();
1174  void DisablePauseBlur();
1175 
1176 protected:
1178 
1180 
1182  void Draw3DScene();
1184  void Capture3DScene();
1186  void DrawCaptured3DScene();
1188  void RenderShadowMap();
1190  void UseShadowMapping(bool enable);
1192  void UseMSAA(bool enable);
1194  void DrawObject(const EngineBaseObjDataTier& p4);
1196  void DrawInterface();
1197 
1199  void UpdateGroundSpotTextures();
1200 
1202  void DrawShadowSpots();
1204  void DrawBackground();
1206  void DrawBackgroundGradient(const Color& up, const Color& down);
1208  void DrawBackgroundImage();
1210  void DrawPlanet();
1212  void DrawForegroundImage();
1214  void DrawOverColor();
1216  void DrawHighlight();
1218  void DrawMouse();
1220  void DrawMouseSprite(Math::IntPoint pos, Math::IntPoint size, int icon);
1222  void DrawStats();
1224  void DrawTimer();
1225  void DrawCrashSpheres();
1226 
1228  EngineBaseObjTexTier& AddLevel2(EngineBaseObject& p1, const std::string& tex1Name, const std::string& tex2Name);
1231  const Material& material, int state);
1232 
1234  Texture CreateTexture(const std::string &texName, const TextureCreateParams &params, CImage* image = nullptr);
1235 
1237  bool IsVisible(int objRank);
1238 
1240  bool DetectBBox(int objRank, Math::Point mouse);
1241 
1243  bool GetBBox2D(int objRank, Math::Point& min, Math::Point& max);
1244 
1246  bool DetectTriangle(Math::Point mouse, VertexTex2* triangle, int objRank, float& dist, Math::Vector& pos);
1247 
1249 
1250  bool TransformPoint(Math::Vector& p2D, int objRank, Math::Vector p3D);
1251 
1253  void ComputeDistance();
1254 
1256  void UpdateGeometry();
1257 
1260 
1262  void UpdateStaticBuffers();
1263 
1264  void AddBaseObjTriangles(int baseObjRank, const std::vector<VertexTex2>& vertices,
1265  const Material& material, int state,
1266  std::string tex1Name, std::string tex2Name);
1267 
1268  int GetEngineState(const ModelTriangle& triangle);
1269 
1271  {
1272  std::unique_ptr<CImage> img;
1273  std::string fileName;
1274  };
1275  static void WriteScreenShotThread(std::unique_ptr<WriteScreenShotData> data);
1276 
1278 
1279  void ReloadAllTextures();
1280 
1281 protected:
1282  CApplication* m_app;
1283  CSystemUtils* m_systemUtils;
1284  CSoundInterface* m_sound;
1285  CDevice* m_device;
1286  CTerrain* m_terrain;
1287  std::unique_ptr<COldModelManager> m_modelManager;
1288  std::unique_ptr<CText> m_text;
1289  std::unique_ptr<CLightManager> m_lightMan;
1290  std::unique_ptr<CParticle> m_particle;
1291  std::unique_ptr<CWater> m_water;
1292  std::unique_ptr<CCloud> m_cloud;
1293  std::unique_ptr<CLightning> m_lightning;
1294  std::unique_ptr<CPlanet> m_planet;
1295  std::unique_ptr<CPyroManager> m_pyroManager;
1296 
1298  std::string m_error;
1299 
1300  SystemTimeStamp* m_lastFrameTime;
1301  SystemTimeStamp* m_currentFrameTime;
1302  int m_fpsCounter;
1303  float m_fps;
1304 
1308  bool m_render;
1311 
1314 
1320  float m_focus;
1321 
1330 
1337 
1340 
1342  std::vector<EngineBaseObject> m_baseObjects;
1344  std::vector<EngineObject> m_objects;
1346  std::vector<EngineShadow> m_shadowSpots;
1348  std::vector<EngineGroundSpot> m_groundSpots;
1351 
1356  float m_eyeDirH;
1357  float m_eyeDirV;
1358  int m_rankView;
1359  Color m_ambientColor[2];
1360  Color m_backColor[2];
1361  Color m_fogColor[2];
1362  float m_deepView[2];
1363  float m_fogStart[2];
1364  Color m_waterAddColor;
1365  int m_statisticTriangle;
1366  Math::Vector m_statisticPos;
1367  bool m_updateGeometry;
1368  bool m_updateStaticBuffers;
1369  bool m_firstGroundSpot;
1370  std::string m_secondTex;
1371  bool m_backgroundFull;
1372  bool m_backgroundScale;
1373  std::string m_backgroundName;
1374  Texture m_backgroundTex;
1375  Color m_backgroundColorUp;
1376  Color m_backgroundColorDown;
1377  Color m_backgroundCloudUp;
1378  Color m_backgroundCloudDown;
1379  bool m_overFront;
1380  Color m_overColor;
1381  int m_overMode;
1382  std::string m_foregroundName;
1383  Texture m_foregroundTex;
1384  bool m_drawWorld;
1385  bool m_drawFront;
1386  float m_terrainVision;
1387  bool m_backForce;
1388  float m_tracePrecision;
1389  bool m_pauseBlurEnabled;
1390 
1391  bool m_dirty;
1392  bool m_fog;
1393  float m_particleDensity;
1394  float m_clippingDistance;
1395  bool m_lightMode;
1396  bool m_editIndentMode;
1397  int m_editIndentValue;
1398 
1399  Texture m_shadowMap;
1400 
1410  Math::Point m_highlightP2;
1412 
1437 
1439  std::map<std::string, Texture> m_texNameMap;
1441  std::map<Texture, std::string> m_revTexNameMap;
1443 
1445  std::set<std::string> m_texBlacklist;
1446 
1451 
1457  std::string m_lastTexture[2];
1460 
1463 
1464  bool m_debugLights;
1465  bool m_debugDumpLights;
1466  bool m_debugCrashSpheres = false;
1467  bool m_debugResources = false;
1468  bool m_debugGoto = false;
1469 
1470  std::string m_timerText;
1471 
1472  std::unordered_map<std::string, int> m_staticMeshBaseObjects;
1473 
1474  std::vector<Math::Sphere> m_displayCrashSpheres;
1475  std::vector<std::vector<VertexCol>> m_displayGoto;
1476  std::unique_ptr<CImage> m_displayGotoImage;
1477 
1479  bool m_pause = false;
1480 
1482  bool m_worldCaptured = false;
1484  bool m_captureWorld = false;
1487 };
1488 
1489 
1490 } // namespace Gfx
bool m_highlight
Highlight visible?
Definition: engine.h:1404
void SetFog(bool mode)
Management of the global mode of horizontal fog patches.
Definition: engine.cpp:2686
std::string tex1Name
1st texture
Definition: engine.h:163
void GetObjectBBox(int objRank, Math::Vector &min, Math::Vector &max)
Returns the bounding box for an object.
Definition: engine.cpp:996
Edit (I-beam)
Definition: engine.h:451
Normal shadow.
Definition: engine.h:301
void SetTimerDisplay(const std::string &text)
Sets text to display as mission timer.
Definition: engine.cpp:611
float drawIntensity
Draw intensity for marks.
Definition: engine.h:411
float intensity
Color intensity.
Definition: engine.h:405
void SetTextureAnisotropyLevel(int value)
Management the anisotropy level for textures.
Definition: engine.cpp:2914
bool GetHighlight(Math::Point &p1, Math::Point &p2)
Returns the highlighted rectangle.
Definition: engine.cpp:1465
bool used
If true, ground spot is valid.
Definition: engine.h:346
Resize horizontally.
Definition: engine.h:463
void DrawShadowSpots()
Draws old-style shadow spots.
Definition: engine.cpp:4438
void AddStatisticTriangle(int count)
Increments the triangle counter for the current frame.
Definition: engine.cpp:596
CSingleton base class for singletons.
void SetTextureMipmapLevel(int value)
Management the mipmap level for textures.
Definition: engine.cpp:2899
Math::Matrix m_matProj
Projection matrix for 3D scene.
Definition: engine.h:1316
bool SetTexture(const std::string &name, int stage=0)
Sets texture for given stage; if not present in cache, the texture is loaded.
Definition: engine.cpp:2592
Light texture (ambient max)
Definition: engine.h:100
void SetBackForce(bool present)
Management the mode of background.
Definition: engine.cpp:3015
bool IsShadowMappingSupported()
Management of shadow mapping.
Definition: engine.cpp:2930
float transparency
Transparency of the object [0, 1].
Definition: engine.h:285
float delay[3]
Times for 3 life phases.
Definition: engine.h:397
Small cross.
Definition: engine.h:455
Fixed.
Definition: engine.h:381
float ParticleAdapt(float factor)
Adapts particle factor according to particle density.
Definition: engine.cpp:2865
Busy.
Definition: engine.h:449
void ChangeSecondTexture(int objRank, const std::string &tex2Name)
Changes the 2nd texure for given object.
Definition: engine.cpp:1141
void SetRankView(int rank)
Management of view mode.
Definition: engine.cpp:2706
EngineObjectType type
Type of object.
Definition: engine.h:277
Material struct.
Math::Point WindowToInterfaceCoords(Math::IntPoint pos)
Conversion functions between window and interface coordinates.
Definition: engine.cpp:572
Math::Matrix m_matProjInterface
Projection matrix for 2D interface.
Definition: engine.h:1334
void SetStaticMeshTransparency(int meshHandle, float value)
Sets transparency for static mesh.
Definition: engine.cpp:5359
Terrain.
Definition: engine.h:176
int AddStaticMesh(const std::string &key, const Gfx::CModelMesh *mesh, const Math::Matrix &worldMatrix)
Add new instance of static mesh.
Definition: engine.cpp:5308
int totalTriangles
Number of triangles.
Definition: engine.h:244
void DeleteObject(int objRank)
Deletes the given object.
Definition: engine.cpp:921
Math::Vector pos
Position for the shadow.
Definition: engine.h:356
Scroll down.
Definition: engine.h:477
void DeleteBaseObject(int baseObjRank)
Deletes a base object.
Definition: engine.cpp:670
void SetObjectType(int objRank, EngineObjectType type)
Management of engine object type.
Definition: engine.cpp:946
int m_multisample
Number of samples for multisample rendering.
Definition: engine.h:1436
Vertex with secondary texture coordinates.
Definition: vertex.h:113
void LoadDefault()
Loads default values.
Definition: engine.h:288
void SetObjectShadowSpotHide(int objRank, bool hide)
Management of different shadow params.
Definition: engine.cpp:1374
void DeleteTexture(const std::string &texName)
Deletes the given texture, unloading it and removing from cache.
Definition: engine.cpp:2534
void TrackTextureMapping(int objRank, const Material &mat, int state, const std::string &tex1Name, const std::string &tex2Name, EngineTextureMapping mode, float pos, float factor, float tl, float ts, float tt)
Changes texture mapping for robot tracks.
Definition: engine.cpp:1233
Material m_lastMaterial
Last material.
Definition: engine.h:1459
float m_shadowRange
Shadow range.
Definition: engine.h:1434
std::vector< EngineBaseObjTexTier > next
Next tier (Tex)
Definition: engine.h:252
Object doesn't exist.
Definition: engine.h:174
void SetObjectTransparency(int objRank, float value)
Sets the transparency level for given object.
Definition: engine.cpp:989
Tier 2 of base object tree (textures)
Definition: engine.h:218
Texture using alpha channel.
Definition: engine.h:132
void DrawHighlight()
Draws the rectangle of the object highlighted.
Definition: engine.cpp:4871
void CopyBaseObject(int sourceBaseObjRank, int destBaseObjRank)
Copies geometry between two base objects.
Definition: engine.cpp:720
void DrawBackground()
Draws the gradient background.
Definition: engine.cpp:4639
void SetObjectGroundSpotPos(int rank, const Math::Vector &pos)
Management of different ground spot params.
Definition: engine.cpp:1575
Crossed out sign.
Definition: engine.h:459
int m_textureMipmapLevel
Requested texture mipmap level.
Definition: engine.h:1418
Texture m_capturedWorldTexture
Texture with captured 3D world.
Definition: engine.h:1486
void SetTracePrecision(float factor)
Management of precision of robot tracks.
Definition: engine.cpp:3055
bool used
If true, shadow is valid.
Definition: engine.h:313
Double-sided face.
Definition: engine.h:114
Math::Vector m_lookatPt
Camera target.
Definition: engine.h:1355
TextureCreateParams m_terrainTexParams
Create params for terrain textures.
Definition: engine.h:1416
Math::Vector drawPos
Position of the shadow drawn.
Definition: engine.h:360
float m_highlightTime
Time counter for highlight animation.
Definition: engine.h:1406
void SetParticleDensity(float value)
Management of the particle density.
Definition: engine.cpp:2853
EngineObjectType
Class of graphics engine object.
Definition: engine.h:171
bool m_qualityShadows
true enables higher quality shadows
Definition: engine.h:1428
void SetScreenshotMode(bool screenshotMode)
Management of "screenshot mode" (disables interface particle rendering)
Definition: engine.cpp:557
Definition: engine.h:1270
float radius
Radius of marks.
Definition: engine.h:403
Number of items in enum.
Definition: engine.h:482
void CreateShadowSpot(int objRank)
Creates a shadow for the given object.
Definition: engine.cpp:1330
void DrawMouse()
Draws the mouse cursor.
Definition: engine.cpp:4962
int m_highlightRank[100]
Ranks of highlighted objects.
Definition: engine.h:1402
Point struct and related functions.
4x4 matrix
Definition: matrix.h:65
bool ChangeTextureColor(const std::string &texName, const std::string &srcName, Color colorRef1, Color colorNew1, Color colorRef2, Color colorNew2, float tolerance1, float tolerance2, Math::Point ts, Math::Point ti, Math::Point *exclude=nullptr, float shift=0.0f, bool hsv=false)
Changes colors in a texture.
Definition: engine.cpp:2406
void DrawOverColor()
Draws the foreground color.
Definition: engine.cpp:4832
void DeleteAllGroundSpots()
Deletes all ground spots.
Definition: engine.cpp:1529
Larger crosshair.
Definition: engine.h:479
void SetRenderEnable(bool enable)
Enables/disables rendering.
Definition: engine.cpp:542
Math::Vector bboxMin
Bounding box min (origin 0,0,0 always included)
Definition: engine.h:246
Part 4.
Definition: engine.h:112
std::string m_error
Last encountered error.
Definition: engine.h:1298
void SetState(int state, const Color &color=Color(1.0f, 1.0f, 1.0f, 1.0f))
Sets the current rendering state.
Definition: engine.cpp:1969
TextureCreateParams m_defaultTexParams
Default texture create params.
Definition: engine.h:1414
float min
Min altitude.
Definition: engine.h:350
int shadowRank
Rank of the associated shadow.
Definition: engine.h:283
std::string m_lastTexture[2]
Last texture names for 2 used texture stages.
Definition: engine.h:1457
void DrawInterface()
Draws the user interface over the scene.
Definition: engine.cpp:4009
int GetStatisticTriangle()
Returns the number of triangles in current frame.
Definition: engine.cpp:601
float GetEyeDirV()
Returns the vertical direction angle of view.
Definition: engine.cpp:3105
Math::Matrix m_shadowBias
Texture bias for sampling shadow maps.
Definition: engine.h:1329
std::vector< EngineShadow > m_shadowSpots
Shadow list.
Definition: engine.h:1346
Texture LoadTexture(const std::string &name)
Loads texture, creating it if not already present.
Definition: engine.cpp:2285
Always use 2nd floor texturing.
Definition: engine.h:118
bool m_renderInterface
Render / hide the UI?
Definition: engine.h:1310
float max
Max altitude.
Definition: engine.h:352
void SetFogStart(float start, int rank=0)
Management the start of fog.
Definition: engine.cpp:2778
Definition: singleton.h:30
Increase.
Definition: engine.h:379
Manager for static models.
Definition: oldmodelmanager.h:54
Fixed object type metal.
Definition: engine.h:186
int CreateGroundSpot()
Creates a new ground spot and returns its rank.
Definition: engine.cpp:1547
void AddBaseObjQuick(int baseObjRank, const EngineBaseObjDataTier &buffer, std::string tex1Name, std::string tex2Name, bool globalUpdate)
Adds a tier 4 engine object directly.
Definition: engine.cpp:774
Texture m_miceTexture
Texture with mouse cursors.
Definition: engine.h:1448
Math::Vector m_eyePt
Location of camera.
Definition: engine.h:1353
void SetViewParams(const Math::Vector &eyePt, const Math::Vector &lookatPt, const Math::Vector &upVec)
Specifies the location and direction of view.
Definition: engine.cpp:2230
Texture struct and related enums.
void SetPauseBlurEnabled(bool enable)
Management of pause blur.
Definition: engine.cpp:3075
EngineRenderState
Render state of graphics engine.
Definition: engine.h:85
Normal opaque materials.
Definition: engine.h:88
std::set< std::string > m_texBlacklist
Blacklist map of textures.
Definition: engine.h:1445
void SetLightMode(bool present)
Managing the mode of dynamic lights.
Definition: engine.cpp:3025
TEST_VIRTUAL Math::Vector GetLookatPt()
Returns the camera target point.
Definition: engine.cpp:3095
float radius
Radius of the shadow.
Definition: engine.h:358
void ApplyChange()
Updates the scene after a change of parameters.
Definition: engine.cpp:3120
const Math::Matrix & GetMatView()
Returns the view matrix.
Definition: engine.cpp:3085
bool LoadAllTextures()
Loads all necessary textures.
Definition: engine.cpp:2308
Scroll to the left.
Definition: engine.h:471
void SetFogColor(const Color &color, int rank=0)
Management of the fog color.
Definition: engine.cpp:2755
void DrawCaptured3DScene()
Draw the 3D scene capured for pause blur.
Definition: engine.cpp:3607
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
bool m_render
Rendering enabled?
Definition: engine.h:1308
float height
Height from the ground.
Definition: engine.h:331
Material of a surface.
Definition: material.h:45
bool m_shadowMapping
true if shadow mapping enabled
Definition: engine.h:1422
Mode for rendering text.
Definition: engine.h:126
float drawRadius
Radius of the shadow drawn.
Definition: engine.h:362
Resize vertically.
Definition: engine.h:465
void RenderShadowMap()
Renders shadow map.
Definition: engine.cpp:3704
A triangle drawn by the graphics engine.
Definition: engine.h:154
int DetectObject(Math::Point mouse, Math::Vector &targetPos, bool terrain=false)
Detects the target object that is selected with the mouse.
Definition: engine.cpp:1789
bool Create()
Performs the initialization; must be called after device was set.
Definition: engine.cpp:317
bool DetectBBox(int objRank, Math::Point mouse)
Detects whether an object is affected by the mouse.
Definition: engine.cpp:1744
float m_shadowColor
Shadow color.
Definition: engine.h:1432
Fixed object.
Definition: engine.h:178
void AddStaticMeshShadowSpot(int meshHandle, const Gfx::ModelShadowSpot &shadowSpot)
Adds a shadow spot to mesh.
Definition: engine.cpp:5332
bool drawFront
If true, the shape is before the 2D interface.
Definition: engine.h:275
Color color
Color of the shadow.
Definition: engine.h:348
void SetOverFront(bool front)
Specifies whether to draw the foreground.
Definition: engine.cpp:2842
CLightning * GetLightning()
Returns the lighting manager.
Definition: engine.cpp:297
Math::Vector pos
Position of the shadow.
Definition: engine.h:321
EngineGroundMarkPhase phase
Phase of life.
Definition: engine.h:395
Mesh data saved in model file.
Definition: model_mesh.h:35
void SetTerrainVision(float vision)
Defines of the distance field of vision.
Definition: engine.cpp:2623
Cloud layer renderer.
Definition: cloud.h:54
void DeleteAllBaseObjects()
Deletes all base objects.
Definition: engine.cpp:696
Lightning effect renderer.
Definition: lightning.h:55
void SetPause(bool pause)
Management of animation pause mode.
Definition: engine.cpp:522
Fixed object type quartz.
Definition: engine.h:184
float m_focus
Camera angle for 3D scene.
Definition: engine.h:1320
void SetMouseType(EngineMouseType type)
Management of mouse cursor type.
Definition: engine.cpp:3065
Particle engine.
Definition: particle.h:223
Math::Vector drawPos
Draw position for marks.
Definition: engine.h:407
float radius
Radius of the sphere at the origin.
Definition: engine.h:250
Color m_lastColor
Last color set with render state.
Definition: engine.h:1455
void SetShadowColor(float value)
Management of shadow color.
Definition: engine.cpp:2644
void FrameUpdate()
Called once per frame, the call is the entry point for animating the scene.
Definition: engine.cpp:446
The transparent texture (black = no)
Definition: engine.h:90
Type of shadow drawn by the graphics engine.
Math::Point WindowToInterfaceSize(Math::IntPoint size)
Conversion functions between window and interface sizes.
Definition: engine.cpp:584
A spot (large shadow) drawn on the ground by the graphics engine.
Definition: engine.h:343
void DeleteStaticMesh(int meshHandle)
Removes given static mesh.
Definition: engine.cpp:5345
The transparent color (white = no)
Definition: engine.h:124
bool m_captureWorld
true means that currently rendered world is to be captured
Definition: engine.h:1484
Math::Vector pos
Position for marks.
Definition: engine.h:401
Definition: pyro_manager.h:41
Color structs and related functions.
float fix
Fixed time.
Definition: engine.h:399
TODO: ?
Definition: engine.h:303
Decrease.
Definition: engine.h:383
Planet manager.
Definition: planet.h:49
bool TransformPoint(Math::Vector &p2D, int objRank, Math::Vector p3D)
Transforms a 3D point (x, y, z) in 2D space (x, y, -) of the window.
Definition: engine.cpp:1941
Resize diagonally bottom-left to top-right.
Definition: engine.h:467
Scroll to the right.
Definition: engine.h:473
void SetShadowRange(float value)
Management of shadow range.
Definition: engine.cpp:2654
void SetAmbientColor(const Color &color, int rank=0)
Ambient color management.
Definition: engine.cpp:2735
The transparent color (black = no)
Definition: engine.h:122
void Destroy()
Frees all resources before exit.
Definition: engine.cpp:372
float angle
Angle of the shadow.
Definition: engine.h:325
Part 2.
Definition: engine.h:108
Only opaque color, no texture, blending, etc.
Definition: engine.h:130
Parameters for texture creation.
Definition: texture.h:155
void SetDeepView(float length, int rank=0, bool ref=false)
Management of the depth of field.
Definition: engine.cpp:2765
void DebugObject(int objRank)
Print debug info about an object.
Definition: engine.cpp:814
void Draw3DScene()
Prepares the interface for 3D scene.
Definition: engine.cpp:3233
Material material
Material.
Definition: engine.h:159
std::string tex2Name
2nd texture
Definition: engine.h:165
Vertex structs.
void SetWaterAddColor(const Color &color)
Color management under water.
Definition: engine.cpp:2745
Hand.
Definition: engine.h:453
Matrix struct and related functions.
int state
Render state.
Definition: engine.h:161
void SetMaterial(const Material &mat)
Sets the current material.
Definition: engine.cpp:2224
Math::Point m_highlightP1
Highlight rectangle points.
Definition: engine.h:1409
EngineShadowType type
Type of shadow.
Definition: engine.h:319
void SetShowStats(bool show)
Management of displaying statistic information.
Definition: engine.cpp:532
void SetDrawFront(bool draw)
Whether to draw the world on the interface.
Definition: engine.cpp:2730
EngineBaseObjDataTier & AddLevel3(EngineBaseObjTexTier &p3, EngineTriangleType type, const Material &material, int state)
Creates a new tier 3 object (data)
Definition: engine.cpp:634
void SetEditIndentMode(bool autoIndent)
Management of the indentation mode while editing (CEdit)
Definition: engine.cpp:3035
VertexTex2 triangle[3]
Triangle vertices.
Definition: engine.h:157
2D point
Definition: point.h:50
bool used
If true, object is valid in objects vector.
Definition: engine.h:267
void SetStatisticPos(Math::Vector pos)
Sets the coordinates to display in stats window.
Definition: engine.cpp:606
Image loaded from file.
Definition: image.h:54
bool hide
If true, shadow is invisible (object being carried for example)
Definition: engine.h:315
bool m_offscreenShadowRendering
true enables offscreen shadow rendering
Definition: engine.h:1424
Main application.
Definition: app.h:152
void DrawMouseSprite(Math::IntPoint pos, Math::IntPoint size, int icon)
Draw part of mouse cursor sprite.
Definition: engine.cpp:4998
void DeleteShadowSpot(int objRank)
Deletes the shadow for given object.
Definition: engine.cpp:1358
void Render()
Called once per frame, the call is the entry point for rendering.
Definition: engine.cpp:3159
EngineBaseObjTexTier & AddLevel2(EngineBaseObject &p1, const std::string &tex1Name, const std::string &tex2Name)
Creates a new tier 2 object (texture)
Definition: engine.cpp:622
void DrawForegroundImage()
Draws the image foreground.
Definition: engine.cpp:4792
Math::Matrix m_matViewInterface
View matrix for 2D interface.
Definition: engine.h:1336
CTerrain * GetTerrain()
Returns the terrain manager.
Definition: engine.cpp:287
Shadow drawn by the graphics engine.
Definition: engine.h:310
void SetEditIndentValue(int value)
Management of tab indent when editing (CEdit)
Definition: engine.cpp:3045
void SetObjectBaseRank(int objRank, int baseObjRank)
Management of the base object rank for engine object.
Definition: engine.cpp:932
bool m_terrainShadows
true enables casting shadows by terrain
Definition: engine.h:1430
Math::Vector bboxMax
bounding box max (origin 0,0,0 always included)
Definition: engine.h:248
TEST_VIRTUAL Math::Vector GetEyePt()
Returns the camera center point.
Definition: engine.cpp:3090
CWater * GetWater()
Returns the water manager.
Definition: engine.cpp:292
float smooth
Transition area.
Definition: engine.h:354
Null phase.
Definition: engine.h:377
Texture CreateTexture(const std::string &texName, const TextureCreateParams &params, CImage *image=nullptr)
Create texture and add it to cache.
Definition: engine.cpp:2246
EngineGroundMark m_groundMark
Ground mark.
Definition: engine.h:1350
void ChangeTextureMapping(int objRank, const Material &mat, int state, const std::string &tex1Name, const std::string &tex2Name, EngineTextureMapping mode, float au, float bu, float av, float bv)
Changes (recalculates) texture mapping for given object.
Definition: engine.cpp:1171
CText * GetText()
Returns the text rendering engine.
Definition: engine.cpp:272
Math::IntPoint m_size
Current size of viewport window.
Definition: engine.h:1339
Part 3.
Definition: engine.h:110
Terrain loader/generator and manager.
Definition: terrain.h:147
std::vector< EngineObject > m_objects
Object parameters.
Definition: engine.h:1344
void SetObjectDrawFront(int objRank, bool draw)
Sets drawFront for given object.
Definition: engine.cpp:982
Resize diagonally top-left to bottom-right.
Definition: engine.h:469
bool visible
If true, the object is drawn.
Definition: engine.h:271
The transparent diffuse color.
Definition: engine.h:94
EngineMouseType
Type of mouse cursor displayed in-game.
Definition: engine.h:444
void DrawPlanet()
Draws all the planets.
Definition: engine.cpp:4776
EngineBaseObjDataTier * FindTriangles(int objRank, const Material &material, int state, std::string tex1Name, std::string tex2Name)
Returns the first found tier 4 engine object for the given params or nullptr if not found...
Definition: engine.cpp:1024
Namespace for (new) graphics code.
Definition: app.h:49
int CreateObject()
Creates a new object and returns its rank.
Definition: engine.cpp:883
void SetTerrain(CTerrain *terrain)
Sets the terrain object.
Definition: engine.cpp:312
void SetForegroundName(const std::string &name)
Specifies the name of foreground texture.
Definition: engine.cpp:2828
float drawRadius
Radius for marks.
Definition: engine.h:409
float radius
Radius of the shadow.
Definition: engine.h:327
Vector struct and related functions.
The graphics engine.
Definition: engine.h:585
int dx
X dimension of table.
Definition: engine.h:413
void SetObjectTransform(int objRank, const Math::Matrix &transform)
Management of object transform.
Definition: engine.cpp:961
Normal cursor (arrow)
Definition: engine.h:447
Math::Matrix m_shadowViewMat
View matrix for rendering shadow maps.
Definition: engine.h:1325
void ResetAfterVideoConfigChanged()
Resets some states and flushes textures after device was changed (e.g. resoulution changed) ...
Definition: engine.cpp:395
Double white texturing.
Definition: engine.h:104
Object drawn by the graphics engine.
Definition: engine.h:264
Math::Matrix m_shadowTextureMat
Texture matrix for rendering shadow maps.
Definition: engine.h:1327
float GetEyeDirH()
Returns the horizontal direction angle of view.
Definition: engine.cpp:3100
void UseMSAA(bool enable)
Enables or disables MSAA.
Definition: engine.cpp:3928
bool DetectTriangle(Math::Point mouse, VertexTex2 *triangle, int objRank, float &dist, Math::Vector &pos)
Detects whether the mouse is in a triangle.
Definition: engine.cpp:1857
EngineMouseType m_mouseType
Type of mouse cursor.
Definition: engine.h:1450
void Update()
Updates the state after creating objects.
Definition: engine.cpp:1737
void UpdateGroundSpotTextures()
Updates the textures used for drawing ground spot.
Definition: engine.cpp:4138
EngineTriangleType
Type of triangles drawn for engine objects.
Definition: engine.h:142
int GetPartialTriangles(int objRank, float percent, int maxCount, std::vector< EngineTriangle > &triangles)
Returns a partial list of triangles for given object.
Definition: engine.cpp:1060
void DeleteGroundSpot(int rank)
Deletes the given ground spot.
Definition: engine.cpp:1567
void SetMultiSample(int value)
Management of shadow range.
Definition: engine.cpp:2664
void WriteScreenShot(const std::string &fileName)
Writes a screenshot containing the current frame.
Definition: engine.cpp:493
int dy
Y dimension of table.
Definition: engine.h:415
Info about a texture.
Definition: texture.h:256
bool m_screenshotMode
Screenshot mode?
Definition: engine.h:1313
void SetHighlightRank(int *rankList)
Lists the ranks of objects and subobjects selected.
Definition: engine.cpp:1472
Math::Vector normal
Normal to the terrain.
Definition: engine.h:323
Math::Matrix m_shadowProjMat
Projection matrix for rendering shadow maps.
Definition: engine.h:1323
Math::Matrix m_matWorldInterface
World matrix for 2D interface.
Definition: engine.h:1332
void ComputeDistance()
Calculates the distances between the viewpoint and the origin of different objects.
Definition: engine.cpp:1635
int m_lastState
Last engine render state (-1 at the beginning of frame)
Definition: engine.h:1453
void SetOverColor(const Color &color=Color(), int mode=ENG_RSTATE_TCOLOR_BLACK)
Sets the foreground overlay color.
Definition: engine.cpp:2847
void SetDirty(bool mode)
Management of the global mode of contamination.
Definition: engine.cpp:2676
A single triangle in mesh as saved in model file.
Definition: model_triangle.h:60
Math::Matrix transform
Transformation matrix.
Definition: engine.h:279
void DrawBackgroundImage()
Draws the image background.
Definition: engine.cpp:4692
bool m_interfaceMode
True when drawing 2D UI.
Definition: engine.h:1462
Moving object.
Definition: engine.h:180
Image using alpha channel.
Definition: engine.h:116
bool draw
If true, draw mark.
Definition: engine.h:393
Water manager/renderer.
Definition: water.h:72
Only opaque texture, no blending, etc.
Definition: engine.h:128
bool IsVisiblePoint(const Math::Vector &pos)
Indicates whether a point is visible.
Definition: engine.cpp:3110
TexFilter
General texture filtering mode.
Definition: texture.h:62
void SetClippingDistance(float value)
Management of the distance of clipping.
Definition: engine.cpp:2873
std::map< std::string, Texture > m_texNameMap
Map of loaded textures (by name)
Definition: engine.h:1439
Resize.
Definition: engine.h:461
EngineTextureMapping
Type of texture mapping.
Definition: engine.h:429
Text rendering engine.
Definition: text.h:233
void UseShadowMapping(bool enable)
Enables or disables shadow mapping.
Definition: engine.cpp:3908
void SetTextureFilterMode(TexFilter value)
Management the texture filter mode.
Definition: engine.cpp:2885
3D (3x1) vector
Definition: vector.h:53
bool drawWorld
If true, object is behind the 2D interface.
Definition: engine.h:273
Tier 3 of object tree (data)
Definition: engine.h:194
void CreateGroundMark(Math::Vector pos, float radius, float delay1, float delay2, float delay3, int dx, int dy, char *table)
Creates the ground mark with the given params.
Definition: engine.cpp:1611
Math::Matrix m_matView
View matrix for 3D scene.
Definition: engine.h:1318
Platform-specific utils.
Definition: system.h:91
std::vector< EngineGroundSpot > m_groundSpots
Ground spot list.
Definition: engine.h:1348
Definition: system_linux.h:31
Part of a moving object.
Definition: engine.h:182
bool m_worldCaptured
true means that current 3D scene was captured and is not to be rendered again
Definition: engine.h:1482
Surfaces.
Definition: engine.h:147
int CreateBaseObject()
Creates a base object and returns its rank.
Definition: engine.cpp:647
A mark on ground drawn by the graphics engine.
Definition: engine.h:390
2D Point with integer coords
Definition: intpoint.h:41
bool GetBBox2D(int objRank, Math::Point &min, Math::Point &max)
Compute and return the 2D box on screen of any object.
Definition: engine.cpp:1482
void UpdateStaticBuffer(EngineBaseObjDataTier &p4)
Updates a given static buffer.
Definition: engine.cpp:1691
void Capture3DScene()
Capture the 3D scene for pause blur.
Definition: engine.cpp:3497
CLightManager * GetLightManager()
Returns the light manager.
Definition: engine.cpp:277
Color with transparency.
Definition: engine.h:134
void SetSecondTexture(const std::string &texNum)
Management of the global mode of secondary texturing.
Definition: engine.cpp:2696
CParticle * GetParticle()
Returns the particle manager.
Definition: engine.cpp:282
std::map< Texture, std::string > m_revTexNameMap
Reverse map of loaded textures (by texture)
Definition: engine.h:1441
RGBA color.
Definition: color.h:39
void UpdateStaticBuffers()
Updates static buffers of changed objects.
Definition: engine.cpp:1707
Triangles.
Definition: engine.h:145
void DrawStats()
Draw statistic texts.
Definition: engine.cpp:5031
void DrawObject(const EngineBaseObjDataTier &p4)
Draw 3D object.
Definition: engine.cpp:3983
bool m_showStats
Whether to show stats (FPS, etc)
Definition: engine.h:1306
void UpdateGeometry()
Updates geometric parameters of objects (bounding box and radius)
Definition: engine.cpp:1650
void SetDevice(CDevice *device)
Sets the device to be used.
Definition: engine.cpp:252
std::vector< EngineBaseObject > m_baseObjects
Base objects (also level 1 tier list)
Definition: engine.h:1342
float distance
Distance to object from eye point.
Definition: engine.h:281
Scroll up.
Definition: engine.h:475
Shadow spot data as saved in model file.
Definition: model_shadow_spot.h:29
Event sent by system, interface or game.
Definition: event.h:735
float intensity
Intensity of the shadow.
Definition: engine.h:329
IntPoint struct.
void AddBaseObjTriangles(int baseObjRank, const std::vector< Gfx::ModelTriangle > &triangles)
Adds triangles to given object with the specified params.
Definition: engine.cpp:5141
CPlanet * GetPlanet()
Returns the planet manager.
Definition: engine.cpp:302
void CreateOrUpdateTexture(const std::string &texName, CImage *img)
Creates or updates the given texture with given image data.
Definition: engine.cpp:2565
void DrawTimer()
Draw mission timer.
Definition: engine.cpp:5133
void DeleteGroundMark(int rank)
Deletes the ground mark.
Definition: engine.cpp:1630
void ReloadAllTextures()
Reloads all textures.
Definition: engine.cpp:406
void SetObjectDrawWorld(int objRank, bool draw)
Sets drawWorld for given object.
Definition: engine.cpp:975
int baseObjRank
Rank of associated base engine object.
Definition: engine.h:269
char * table
Pointer to the table.
Definition: engine.h:417
bool m_pause
Pause the animation updates.
Definition: engine.h:1479
int m_textureAnisotropy
Requested texture anisotropy level.
Definition: engine.h:1420
Math::IntPoint GetWindowSize()
Returns current size of viewport window.
Definition: engine.cpp:567
Texture borders with solid color.
Definition: engine.h:98
void SetBackground(const std::string &name, Color up=Color(), Color down=Color(), Color cloudUp=Color(), Color cloudDown=Color(), bool full=false, bool scale=false)
Management of the background image to use.
Definition: engine.cpp:2791
The transparent texture (white = no)
Definition: engine.h:92
void SetDrawWorld(bool draw)
Whether to draw the world.
Definition: engine.cpp:2725
CDevice * GetDevice()
Returns the current device.
Definition: engine.cpp:257
int GetObjectTotalTriangles(int objRank)
Returns the total number of triangles of given object.
Definition: engine.cpp:1011
TODO: ?
Definition: engine.h:457
bool used
If true, base object is valid in objects vector.
Definition: engine.h:242
EngineGroundMarkPhase
Phase of life of an EngineGroundMark.
Definition: engine.h:374
Sound plugin interface.
Definition: sound.h:60
Causes the fog.
Definition: engine.h:120
Part 1 (no change in. MOD!)
Definition: engine.h:106
void DeleteAllObjects()
Deletes all objects, shadows and ground spots.
Definition: engine.cpp:913
void UpdateMatProj()
Resets the projection matrix after changes.
Definition: engine.cpp:3115
Abstract interface of graphics device.
Definition: device.h:323
bool IsVisible(int objRank)
Tests whether the given object is visible.
Definition: engine.cpp:1919
Double black texturing.
Definition: engine.h:102
int objRank
Rank of the associated object.
Definition: engine.h:317
const Math::Matrix & GetStaticMeshWorldMatrix(int meshHandle)
Returns static mesh world matrix.
Definition: engine.cpp:5353
bool ProcessEvent(const Event &event)
Processes incoming event.
Definition: engine.cpp:424
Texture wrap.
Definition: engine.h:96
Definition: engine.h:239
void DrawBackgroundGradient(const Color &up, const Color &down)
Draws the gradient background.
Definition: engine.cpp:4662
void FlushTextureCache()
Empties the texture cache.
Definition: engine.cpp:2578
int m_offscreenShadowRenderingResolution
Offscreen shadow rendering resolution.
Definition: engine.h:1426
void SetFocus(float focus)
Management of camera angle.
Definition: engine.cpp:2628
CCloud * GetCloud()
Returns the fog manager.
Definition: engine.cpp:307