45 #include <unordered_map> 64 class COldModelManager;
75 struct ModelShadowSpot;
200 std::vector<VertexTex2> vertices;
201 unsigned int staticBufferId;
202 bool updateStaticBuffer;
211 , updateStaticBuffer(
false)
225 std::vector<EngineBaseObjDataTier> next;
228 const std::string& tex2Name =
"")
245 int totalTriangles = 0;
253 std::vector<EngineBaseObjTexTier>
next;
255 inline void LoadDefault()
270 int baseObjRank = -1;
272 bool visible =
false;
274 bool drawWorld =
false;
276 bool drawFront =
false;
282 float distance = 0.0f;
286 float transparency = 0.0f;
330 float intensity = 0.0f;
363 float drawRadius = 0.0f;
406 float intensity = 0.0f;
410 float drawRadius = 0.0f;
412 float drawIntensity = 0.0f;
418 char* table =
nullptr;
432 ENG_TEX_MAPPING_X = 1,
433 ENG_TEX_MAPPING_Y = 2,
434 ENG_TEX_MAPPING_Z = 3,
435 ENG_TEX_MAPPING_1X = 4,
436 ENG_TEX_MAPPING_1Y = 5,
437 ENG_TEX_MAPPING_1Z = 6
513 , iconShadow(iconShadow)
627 void SetDevice(
CDevice* device);
662 void ResetAfterDeviceChanged();
670 bool ProcessEvent(
const Event& event);
677 void WriteScreenShot(
const std::string& fileName);
681 TEST_VIRTUAL
bool GetPause();
684 void SetShowStats(
bool show);
690 void SetRenderEnable(
bool enable);
692 void SetRenderInterface(
bool enable);
693 bool GetRenderInterface();
697 void SetScreenshotMode(
bool screenshotMode);
698 bool GetScreenshotMode();
720 void AddStatisticTriangle(
int nb);
722 int GetStatisticTriangle();
728 void SetTimerDisplay(
const std::string& text);
744 void DeleteStaticMesh(
int meshHandle);
750 const Math::Matrix& GetStaticMeshWorldMatrix(
int meshHandle);
753 void SetStaticMeshTransparency(
int meshHandle,
float value);
761 int CreateBaseObject();
763 void DeleteBaseObject(
int baseObjRank);
765 void DeleteAllBaseObjects();
768 void CopyBaseObject(
int sourceBaseObjRank,
int destBaseObjRank);
771 void AddBaseObjTriangles(
int baseObjRank,
const std::vector<Gfx::ModelTriangle>& triangles);
781 void DebugObject(
int rank);
786 void DeleteAllObjects();
788 void DeleteObject(
int objRank);
791 void SetObjectBaseRank(
int objRank,
int baseObjRank);
793 int GetObjectBaseRank(
int objRank);
803 void SetObjectTransform(
int objRank,
const Math::Matrix& transform);
805 void GetObjectTransform(
int objRank,
Math::Matrix& transform);
809 void SetObjectDrawWorld(
int objRank,
bool draw);
811 void SetObjectDrawFront(
int objRank,
bool draw);
814 void SetObjectTransparency(
int objRank,
float value);
820 int GetObjectTotalTriangles(
int objRank);
824 int state, std::string tex1Name, std::string tex2Name);
827 int GetPartialTriangles(
int objRank,
float percent,
int maxCount,
828 std::vector<EngineTriangle>& triangles);
831 void ChangeSecondTexture(
int objRank,
const std::string& tex2Name);
834 void ChangeTextureMapping(
int objRank,
const Material& mat,
int state,
835 const std::string& tex1Name,
const std::string& tex2Name,
837 float au,
float bu,
float av,
float bv);
840 void TrackTextureMapping(
int objRank,
const Material& mat,
int state,
841 const std::string& tex1Name,
const std::string& tex2Name,
843 float pos,
float factor,
float tl,
float ts,
float tt);
850 void CreateShadowSpot(
int objRank);
852 void DeleteShadowSpot(
int objRank);
855 void SetObjectShadowSpotHide(
int objRank,
bool hide);
858 void SetObjectShadowSpotPos(
int objRank,
const Math::Vector& pos);
859 void SetObjectShadowSpotAngle(
int objRank,
float angle);
860 void SetObjectShadowSpotRadius(
int objRank,
float radius);
861 void SetObjectShadowSpotIntensity(
int objRank,
float intensity);
862 void SetObjectShadowSpotHeight(
int objRank,
float height);
863 void UpdateObjectShadowSpotNormal(
int objRank);
867 void SetHighlightRank(
int* rankList);
872 void DeleteAllGroundSpots();
874 int CreateGroundSpot();
876 void DeleteGroundSpot(
int rank);
879 void SetObjectGroundSpotPos(
int rank,
const Math::Vector& pos);
881 void SetObjectGroundSpotRadius(
int rank,
float radius);
882 void SetObjectGroundSpotColor(
int rank,
const Color& color);
883 void SetObjectGroundSpotMinMax(
int rank,
float min,
float max);
884 void SetObjectGroundSpotSmooth(
int rank,
float smooth);
889 float delay1,
float delay2,
float delay3,
890 int dx,
int dy,
char* table);
892 void DeleteGroundMark(
int rank);
901 void SetState(
int state,
const Color& color =
Color(1.0f, 1.0f, 1.0f, 1.0f));
904 void SetMaterial(
const Material& mat);
911 Texture LoadTexture(
const std::string& name);
917 bool LoadAllTextures();
921 bool ChangeTextureColor(
const std::string& texName,
922 const std::string& srcName,
925 float tolerance1,
float tolerance2,
928 float shift = 0.0f,
bool hsv =
false);
929 bool ChangeTextureColor(
const std::string& texName,
932 float tolerance1,
float tolerance2,
935 float shift = 0.0f,
bool hsv =
false);
940 bool SetTexture(
const std::string& name,
int stage = 0);
942 void SetTexture(
const Texture& tex,
int stage = 0);
945 void DeleteTexture(
const std::string& name);
947 void DeleteTexture(
const Texture& tex);
950 void FlushTextureCache();
953 void SetTerrainVision(
float vision);
960 void SetFocus(
float focus);
967 void SetDirty(
bool mode);
974 void SetFog(
bool mode);
979 void SetSecondTexture(
const std::string& texNum);
981 const std::string& GetSecondTexture();
985 void SetRankView(
int rank);
991 void SetDrawWorld(
bool draw);
994 void SetDrawFront(
bool draw);
997 void SetAmbientColor(
const Color& color,
int rank = 0);
999 Color GetAmbientColor(
int rank = 0);
1003 void SetWaterAddColor(
const Color& color);
1005 Color GetWaterAddColor();
1009 void SetFogColor(
const Color& color,
int rank = 0);
1011 Color GetFogColor(
int rank = 0);
1018 void SetDeepView(
float length,
int rank = 0,
bool ref=
false);
1019 float GetDeepView(
int rank = 0);
1027 void SetFogStart(
float start,
int rank = 0);
1028 float GetFogStart(
int rank = 0);
1035 bool full =
false,
bool scale =
false);
1036 void GetBackground(std::string& name,
Color& up,
Color& down,
1038 bool& full,
bool& scale);
1042 void SetForegroundName(
const std::string& name);
1044 void SetOverFront(
bool front);
1051 void SetParticleDensity(
float value);
1052 float GetParticleDensity();
1056 float ParticleAdapt(
float factor);
1061 void SetClippingDistance(
float value);
1062 float GetClippingDistance();
1068 void SetTextureFilterMode(
TexFilter value);
1075 void SetTextureMipmapLevel(
int value);
1076 int GetTextureMipmapLevel();
1082 void SetTextureAnisotropyLevel(
int value);
1083 int GetTextureAnisotropyLevel();
1089 bool IsShadowMappingSupported();
1090 void SetShadowMapping(
bool value);
1091 bool GetShadowMapping();
1092 void SetShadowMappingOffscreen(
bool value);
1093 bool GetShadowMappingOffscreen();
1094 void SetShadowMappingOffscreenResolution(
int resolution);
1095 int GetShadowMappingOffscreenResolution();
1096 bool IsShadowMappingQualitySupported();
1097 void SetShadowMappingQuality(
bool value);
1098 bool GetShadowMappingQuality();
1104 void SetShadowColor(
float value);
1105 float GetShadowColor();
1111 void SetShadowRange(
float value);
1112 float GetShadowRange();
1118 void SetMultiSample(
int value);
1119 int GetMultiSample();
1123 void SetBackForce(
bool present);
1125 bool GetBackForce();
1131 void SetLightMode(
bool present);
1132 bool GetLightMode();
1139 void SetEditIndentMode(
bool autoIndent);
1140 bool GetEditIndentMode();
1147 void SetEditIndentValue(
int value);
1148 int GetEditIndentValue();
1152 void SetTracePrecision(
float factor);
1154 float GetTracePrecision();
1177 void UpdateMatProj();
1186 void RenderShadowMap();
1188 void UseShadowMapping(
bool enable);
1190 void UseMSAA(
bool enable);
1194 void DrawInterface();
1197 void UpdateGroundSpotTextures();
1200 void DrawShadowSpots();
1202 void DrawBackground();
1204 void DrawBackgroundGradient(
const Color& up,
const Color& down);
1206 void DrawBackgroundImage();
1210 void DrawForegroundImage();
1212 void DrawOverColor();
1214 void DrawHighlight();
1234 bool IsVisible(
int objRank);
1250 void ComputeDistance();
1253 void UpdateGeometry();
1259 void UpdateStaticBuffers();
1261 void AddBaseObjTriangles(
int baseObjRank,
const std::vector<VertexTex2>& vertices,
1262 const Material& material,
int state,
1263 std::string tex1Name, std::string tex2Name);
1269 std::unique_ptr<CImage> img;
1270 std::string fileName;
1272 static void WriteScreenShotThread(std::unique_ptr<WriteScreenShotData> data);
1280 std::unique_ptr<COldModelManager> m_modelManager;
1281 std::unique_ptr<CText> m_text;
1282 std::unique_ptr<CLightManager> m_lightMan;
1283 std::unique_ptr<CParticle> m_particle;
1284 std::unique_ptr<CWater> m_water;
1285 std::unique_ptr<CCloud> m_cloud;
1286 std::unique_ptr<CLightning> m_lightning;
1287 std::unique_ptr<CPlanet> m_planet;
1288 std::unique_ptr<CPauseManager> m_pause;
1289 std::unique_ptr<CPyroManager> m_pyroManager;
1353 Color m_ambientColor[2];
1354 Color m_backColor[2];
1355 Color m_fogColor[2];
1356 float m_deepView[2];
1357 float m_fogStart[2];
1358 Color m_waterAddColor;
1359 int m_statisticTriangle;
1361 bool m_updateGeometry;
1362 bool m_updateStaticBuffers;
1363 bool m_firstGroundSpot;
1364 std::string m_secondTex;
1365 bool m_backgroundFull;
1366 bool m_backgroundScale;
1367 std::string m_backgroundName;
1369 Color m_backgroundColorUp;
1370 Color m_backgroundColorDown;
1371 Color m_backgroundCloudUp;
1372 Color m_backgroundCloudDown;
1376 std::string m_foregroundName;
1380 float m_terrainVision;
1382 float m_tracePrecision;
1386 float m_particleDensity;
1387 float m_clippingDistance;
1388 float m_lastClippingDistance;
1390 bool m_editIndentMode;
1391 int m_editIndentValue;
1396 int m_highlightRank[100];
1453 std::string m_lastTexture[2];
1461 bool m_debugDumpLights;
1463 std::string m_timerText;
1465 std::unordered_map<std::string, int> m_staticMeshBaseObjects;
bool m_highlight
Highlight visible?
Definition: engine.h:1398
std::string tex1Name
1st texture
Definition: engine.h:164
Edit (I-beam)
Definition: engine.h:452
Normal shadow.
Definition: engine.h:302
Resize horizontally.
Definition: engine.h:464
CSingleton base class for singletons.
Math::Matrix m_matProj
Projection matrix for 3D scene.
Definition: engine.h:1310
Light texture (ambient max)
Definition: engine.h:101
Small cross.
Definition: engine.h:456
Fixed.
Definition: engine.h:382
Busy.
Definition: engine.h:450
Math::Matrix m_matProjInterface
Projection matrix for 2D interface.
Definition: engine.h:1328
Terrain.
Definition: engine.h:177
Math::Point hotPoint
Hot point.
Definition: engine.h:503
Math::Vector pos
Position for the shadow.
Definition: engine.h:357
Scroll down.
Definition: engine.h:478
EngineRenderState mode2
Mode to render 2nd image in.
Definition: engine.h:501
int m_multisample
Number of samples for multisample rendering.
Definition: engine.h:1428
Vertex with secondary texture coordinates.
Definition: vertex.h:113
void LoadDefault()
Loads default values.
Definition: engine.h:289
Material m_lastMaterial
Last material.
Definition: engine.h:1455
float m_shadowRange
Shadow range.
Definition: engine.h:1426
std::vector< EngineBaseObjTexTier > next
Next tier (Tex)
Definition: engine.h:253
Object doesn't exist.
Definition: engine.h:175
Tier 2 of base object tree (textures)
Definition: engine.h:219
Texture using alpha channel.
Definition: engine.h:133
Crossed out sign.
Definition: engine.h:460
int m_textureMipmapLevel
Requested texture mipmap level.
Definition: engine.h:1412
Double-sided face.
Definition: engine.h:115
Math::Vector m_lookatPt
Camera target.
Definition: engine.h:1349
TextureCreateParams m_terrainTexParams
Create params for terrain textures.
Definition: engine.h:1410
Math::Vector drawPos
Position of the shadow drawn.
Definition: engine.h:361
float m_highlightTime
Time counter for highlight animation.
Definition: engine.h:1400
EngineObjectType
Class of graphics engine object.
Definition: engine.h:172
bool m_qualityShadows
true enables higher quality shadows
Definition: engine.h:1422
Definition: engine.h:1267
Number of items in enum.
Definition: engine.h:483
Point struct and related functions.
4x4 matrix
Definition: matrix.h:65
Larger crosshair.
Definition: engine.h:480
Math::Vector bboxMin
Bounding box min (origin 0,0,0 always included)
Definition: engine.h:247
Part 4.
Definition: engine.h:113
std::string m_error
Last encountered error.
Definition: engine.h:1292
TextureCreateParams m_defaultTexParams
Default texture create params.
Definition: engine.h:1408
Math::Matrix m_shadowBias
Texture bias for sampling shadow maps.
Definition: engine.h:1323
std::vector< EngineShadow > m_shadowSpots
Shadow list.
Definition: engine.h:1340
Always use 2nd floor texturing.
Definition: engine.h:119
bool m_renderInterface
Render / hide the UI?
Definition: engine.h:1304
Definition: singleton.h:30
Increase.
Definition: engine.h:380
Manager for static models.
Definition: oldmodelmanager.h:55
Fixed object type metal.
Definition: engine.h:187
Texture m_miceTexture
Texture with mouse cursors.
Definition: engine.h:1442
Math::Vector m_eyePt
Location of camera.
Definition: engine.h:1347
Texture struct and related enums.
EngineRenderState
Render state of graphics engine.
Definition: engine.h:86
Math::Point m_mouseSize
Size of mouse cursor.
Definition: engine.h:1444
int icon1
Index of texture element for 1st image.
Definition: engine.h:493
Normal opaque materials.
Definition: engine.h:89
std::set< std::string > m_texBlacklist
Blacklist map of textures.
Definition: engine.h:1437
Scroll to the left.
Definition: engine.h:472
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
bool m_render
Rendering enabled?
Definition: engine.h:1302
Material of a surface.
Definition: material.h:45
bool m_shadowMapping
true if shadow mapping enabled
Definition: engine.h:1416
Mode for rendering text.
Definition: engine.h:127
Resize vertically.
Definition: engine.h:466
A triangle drawn by the graphics engine.
Definition: engine.h:155
float m_shadowColor
Shadow color.
Definition: engine.h:1424
Fixed object.
Definition: engine.h:179
Color color
Color of the shadow.
Definition: engine.h:349
Math::Vector pos
Position of the shadow.
Definition: engine.h:322
Mesh data saved in model file.
Definition: model_mesh.h:37
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Fixed object type quartz.
Definition: engine.h:185
float m_focus
Camera angle for 3D scene.
Definition: engine.h:1314
Particle engine.
Definition: particle.h:223
Math::Vector drawPos
Draw position for marks.
Definition: engine.h:408
Color m_lastColor
Last color set with render state.
Definition: engine.h:1451
The transparent texture (black = no)
Definition: engine.h:91
Type of shadow drawn by the graphics engine.
A spot (large shadow) drawn on the ground by the graphics engine.
Definition: engine.h:344
The transparent color (white = no)
Definition: engine.h:125
Math::Vector pos
Position for marks.
Definition: engine.h:402
Definition: pyro_manager.h:41
Color structs and related functions.
TODO: ?
Definition: engine.h:304
Decrease.
Definition: engine.h:384
Planet manager.
Definition: planet.h:49
Resize diagonally bottom-left to top-right.
Definition: engine.h:468
Scroll to the right.
Definition: engine.h:474
The transparent color (black = no)
Definition: engine.h:123
Part 2.
Definition: engine.h:109
Only opaque color, no texture, blending, etc.
Definition: engine.h:131
Parameters for texture creation.
Definition: texture.h:155
Material material
Material.
Definition: engine.h:160
std::string tex2Name
2nd texture
Definition: engine.h:166
Hand.
Definition: engine.h:454
Matrix struct and related functions.
int state
Render state.
Definition: engine.h:162
VertexTex2 triangle[3]
Triangle vertices.
Definition: engine.h:158
2D point
Definition: point.h:50
int icon2
Index of texture element for 2nd image.
Definition: engine.h:495
Image loaded from file.
Definition: image.h:54
bool m_offscreenShadowRendering
true enables offscreen shadow rendering
Definition: engine.h:1418
Main application.
Definition: app.h:191
Math::Matrix m_matViewInterface
View matrix for 2D interface.
Definition: engine.h:1330
Shadow drawn by the graphics engine.
Definition: engine.h:311
Math::Vector bboxMax
bounding box max (origin 0,0,0 always included)
Definition: engine.h:249
Null phase.
Definition: engine.h:378
EngineGroundMark m_groundMark
Ground mark.
Definition: engine.h:1344
Math::IntPoint m_size
Current size of viewport window.
Definition: engine.h:1333
Part 3.
Definition: engine.h:111
Terrain loader/generator and manager.
Definition: terrain.h:145
std::vector< EngineObject > m_objects
Object parameters.
Definition: engine.h:1338
Resize diagonally top-left to bottom-right.
Definition: engine.h:470
The transparent diffuse color.
Definition: engine.h:95
EngineMouseType
Type of mouse cursor displayed in-game.
Definition: engine.h:445
Namespace for (new) graphics code.
Definition: app.h:49
EngineRenderState mode1
Mode to render 1st image in.
Definition: engine.h:499
Vector struct and related functions.
The graphics engine.
Definition: engine.h:620
Normal cursor (arrow)
Definition: engine.h:448
Math::Matrix m_shadowViewMat
View matrix for rendering shadow maps.
Definition: engine.h:1319
Double white texturing.
Definition: engine.h:105
Object drawn by the graphics engine.
Definition: engine.h:265
Math::Matrix m_shadowTextureMat
Texture matrix for rendering shadow maps.
Definition: engine.h:1321
EngineMouseType m_mouseType
Type of mouse cursor.
Definition: engine.h:1446
EngineTriangleType
Type of triangles drawn for engine objects.
Definition: engine.h:143
Info about a texture.
Definition: texture.h:256
bool m_screenshotMode
Screenshot mode?
Definition: engine.h:1307
Math::Vector normal
Normal to the terrain.
Definition: engine.h:324
Math::Matrix m_shadowProjMat
Projection matrix for rendering shadow maps.
Definition: engine.h:1317
Math::Matrix m_matWorldInterface
World matrix for 2D interface.
Definition: engine.h:1326
int m_lastState
Last engine render state (-1 at the beginning of frame)
Definition: engine.h:1449
Information about mouse cursor.
Definition: engine.h:490
A single triangle in mesh as saved in model file.
Definition: model_triangle.h:60
Math::Matrix transform
Transformation matrix.
Definition: engine.h:280
bool m_interfaceMode
True when drawing 2D UI.
Definition: engine.h:1458
Moving object.
Definition: engine.h:181
Image using alpha channel.
Definition: engine.h:117
Water manager/renderer.
Definition: water.h:74
Only opaque texture, no blending, etc.
Definition: engine.h:129
TexFilter
General texture filtering mode.
Definition: texture.h:62
std::map< std::string, Texture > m_texNameMap
Map of loaded textures (by name)
Definition: engine.h:1431
Resize.
Definition: engine.h:462
EngineTextureMapping
Type of texture mapping.
Definition: engine.h:430
Text rendering engine.
Definition: text.h:230
3D (3x1) vector
Definition: vector.h:53
int iconShadow
Shadow texture part.
Definition: engine.h:497
Tier 3 of object tree (data)
Definition: engine.h:195
Math::Matrix m_matView
View matrix for 3D scene.
Definition: engine.h:1312
Platform-specific utils.
Definition: system.h:91
std::vector< EngineGroundSpot > m_groundSpots
Ground spot list.
Definition: engine.h:1342
Definition: system_linux.h:30
Part of a moving object.
Definition: engine.h:183
Surfaces.
Definition: engine.h:148
A mark on ground drawn by the graphics engine.
Definition: engine.h:391
2D Point with integer coords
Definition: intpoint.h:39
Color with transparency.
Definition: engine.h:135
std::map< Texture, std::string > m_revTexNameMap
Reverse map of loaded textures (by texture)
Definition: engine.h:1433
RGBA color.
Definition: color.h:39
Triangles.
Definition: engine.h:146
bool m_showStats
Whether to show stats (FPS, etc)
Definition: engine.h:1300
std::vector< EngineBaseObject > m_baseObjects
Base objects (also level 1 tier list)
Definition: engine.h:1336
Scroll up.
Definition: engine.h:476
Shadow spot data as saved in model file.
Definition: model_shadow_spot.h:29
Event sent by system, interface or game.
Definition: event.h:709
Definition: pausemanager.h:60
int m_textureAnisotropy
Requested texture anisotropy level.
Definition: engine.h:1414
Base class for all 3D in-game objects.
Definition: object.h:59
Texture borders with solid color.
Definition: engine.h:99
The transparent texture (white = no)
Definition: engine.h:93
TODO: ?
Definition: engine.h:458
EngineGroundMarkPhase
Phase of life of an EngineGroundMark.
Definition: engine.h:375
Sound plugin interface.
Definition: sound.h:57
Causes the fog.
Definition: engine.h:121
Part 1 (no change in. MOD!)
Definition: engine.h:107
Abstract interface of graphics device.
Definition: device.h:268
Double black texturing.
Definition: engine.h:103
Texture wrap.
Definition: engine.h:97
int m_offscreenShadowRenderingResolution
Offscreen shadow rendering resolution.
Definition: engine.h:1420