37 #include "math/sphere.h" 46 #include <unordered_map> 63 class COldModelManager;
74 struct ModelShadowSpot;
199 std::vector<VertexTex2> vertices;
200 unsigned int staticBufferId;
201 bool updateStaticBuffer;
210 , updateStaticBuffer(
false)
224 std::vector<EngineBaseObjDataTier> next;
227 const std::string& tex2Name =
"")
244 int totalTriangles = 0;
252 std::vector<EngineBaseObjTexTier>
next;
254 inline void LoadDefault()
269 int baseObjRank = -1;
271 bool visible =
false;
273 bool drawWorld =
false;
275 bool drawFront =
false;
281 float distance = 0.0f;
285 float transparency = 0.0f;
329 float intensity = 0.0f;
362 float drawRadius = 0.0f;
405 float intensity = 0.0f;
409 float drawRadius = 0.0f;
411 float drawIntensity = 0.0f;
417 char* table =
nullptr;
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
592 void SetDevice(
CDevice* device);
630 bool ProcessEvent(
const Event& event);
637 void WriteScreenShot(
const std::string& fileName);
641 void SetPause(
bool pause);
647 void SetShowStats(
bool show);
653 void SetRenderEnable(
bool enable);
655 void SetRenderInterface(
bool enable);
656 bool GetRenderInterface();
660 void SetScreenshotMode(
bool screenshotMode);
661 bool GetScreenshotMode();
683 void AddStatisticTriangle(
int count);
685 int GetStatisticTriangle();
691 void SetTimerDisplay(
const std::string& text);
707 void DeleteStaticMesh(
int meshHandle);
713 const Math::Matrix& GetStaticMeshWorldMatrix(
int meshHandle);
716 void SetStaticMeshTransparency(
int meshHandle,
float value);
724 int CreateBaseObject();
726 void DeleteBaseObject(
int baseObjRank);
728 void DeleteAllBaseObjects();
731 void CopyBaseObject(
int sourceBaseObjRank,
int destBaseObjRank);
734 void AddBaseObjTriangles(
int baseObjRank,
const std::vector<Gfx::ModelTriangle>& triangles);
744 void DebugObject(
int objRank);
749 void DeleteAllObjects();
751 void DeleteObject(
int objRank);
754 void SetObjectBaseRank(
int objRank,
int baseObjRank);
756 int GetObjectBaseRank(
int objRank);
766 void SetObjectTransform(
int objRank,
const Math::Matrix& transform);
768 void GetObjectTransform(
int objRank,
Math::Matrix& transform);
772 void SetObjectDrawWorld(
int objRank,
bool draw);
774 void SetObjectDrawFront(
int objRank,
bool draw);
777 void SetObjectTransparency(
int objRank,
float value);
783 int GetObjectTotalTriangles(
int objRank);
787 int state, std::string tex1Name, std::string tex2Name);
790 int GetPartialTriangles(
int objRank,
float percent,
int maxCount,
791 std::vector<EngineTriangle>& triangles);
794 void ChangeSecondTexture(
int objRank,
const std::string& tex2Name);
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);
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);
813 void CreateShadowSpot(
int objRank);
815 void DeleteShadowSpot(
int objRank);
818 void SetObjectShadowSpotHide(
int objRank,
bool hide);
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);
830 void SetHighlightRank(
int* rankList);
835 void DeleteAllGroundSpots();
837 int CreateGroundSpot();
839 void DeleteGroundSpot(
int rank);
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);
852 float delay1,
float delay2,
float delay3,
853 int dx,
int dy,
char* table);
855 void DeleteGroundMark(
int rank);
864 void SetState(
int state,
const Color& color =
Color(1.0f, 1.0f, 1.0f, 1.0f));
867 void SetMaterial(
const Material& mat);
873 Texture LoadTexture(
const std::string& name);
879 bool LoadAllTextures();
883 bool ChangeTextureColor(
const std::string& texName,
884 const std::string& srcName,
887 float tolerance1,
float tolerance2,
890 float shift = 0.0f,
bool hsv =
false);
891 bool ChangeTextureColor(
const std::string& texName,
894 float tolerance1,
float tolerance2,
897 float shift = 0.0f,
bool hsv =
false);
902 bool SetTexture(
const std::string& name,
int stage = 0);
904 void SetTexture(
const Texture& tex,
int stage = 0);
907 void DeleteTexture(
const std::string& texName);
909 void DeleteTexture(
const Texture& tex);
912 void CreateOrUpdateTexture(
const std::string& texName,
CImage* img);
915 void FlushTextureCache();
918 void SetTerrainVision(
float vision);
925 void SetFocus(
float focus);
932 void SetDirty(
bool mode);
939 void SetFog(
bool mode);
944 void SetSecondTexture(
const std::string& texNum);
946 const std::string& GetSecondTexture();
950 void SetRankView(
int rank);
956 void SetDrawWorld(
bool draw);
959 void SetDrawFront(
bool draw);
962 void SetAmbientColor(
const Color& color,
int rank = 0);
964 Color GetAmbientColor(
int rank = 0);
968 void SetWaterAddColor(
const Color& color);
970 Color GetWaterAddColor();
974 void SetFogColor(
const Color& color,
int rank = 0);
976 Color GetFogColor(
int rank = 0);
983 void SetDeepView(
float length,
int rank = 0,
bool ref=
false);
984 float GetDeepView(
int rank = 0);
992 void SetFogStart(
float start,
int rank = 0);
993 float GetFogStart(
int rank = 0);
1000 bool full =
false,
bool scale =
false);
1001 void GetBackground(std::string& name,
Color& up,
Color& down,
1003 bool& full,
bool& scale);
1007 void SetForegroundName(
const std::string& name);
1009 void SetOverFront(
bool front);
1016 void SetParticleDensity(
float value);
1017 float GetParticleDensity();
1021 float ParticleAdapt(
float factor);
1026 void SetClippingDistance(
float value);
1027 float GetClippingDistance();
1033 void SetTextureFilterMode(
TexFilter value);
1040 void SetTextureMipmapLevel(
int value);
1041 int GetTextureMipmapLevel();
1047 void SetTextureAnisotropyLevel(
int value);
1048 int GetTextureAnisotropyLevel();
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();
1071 void SetShadowColor(
float value);
1072 float GetShadowColor();
1078 void SetShadowRange(
float value);
1079 float GetShadowRange();
1085 void SetMultiSample(
int value);
1086 int GetMultiSample();
1090 void SetBackForce(
bool present);
1092 bool GetBackForce();
1098 void SetLightMode(
bool present);
1099 bool GetLightMode();
1106 void SetEditIndentMode(
bool autoIndent);
1107 bool GetEditIndentMode();
1114 void SetEditIndentValue(
int value);
1115 int GetEditIndentValue();
1119 void SetTracePrecision(
float factor);
1121 float GetTracePrecision();
1131 void SetPauseBlurEnabled(
bool enable);
1133 bool GetPauseBlurEnabled();
1150 void UpdateMatProj();
1155 void ClearDisplayCrashSpheres();
1156 void AddDisplayCrashSpheres(
const std::vector<Math::Sphere>& crashSpheres);
1158 void SetDebugLights(
bool debugLights);
1159 bool GetDebugLights();
1160 void DebugDumpLights();
1162 void SetDebugResources(
bool debugResources);
1163 bool GetDebugResources();
1165 void SetDebugGoto(
bool debugGoto);
1166 bool GetDebugGoto();
1167 void AddDebugGotoLine(std::vector<Gfx::VertexCol> line);
1168 void SetDebugGotoBitmap(std::unique_ptr<CImage> debugImage);
1170 void SetWindowCoordinates();
1171 void SetInterfaceCoordinates();
1173 void EnablePauseBlur();
1174 void DisablePauseBlur();
1179 void ResetAfterVideoConfigChanged();
1184 void Capture3DScene();
1186 void DrawCaptured3DScene();
1188 void RenderShadowMap();
1190 void UseShadowMapping(
bool enable);
1192 void UseMSAA(
bool enable);
1196 void DrawInterface();
1199 void UpdateGroundSpotTextures();
1202 void DrawShadowSpots();
1204 void DrawBackground();
1206 void DrawBackgroundGradient(
const Color& up,
const Color& down);
1208 void DrawBackgroundImage();
1212 void DrawForegroundImage();
1214 void DrawOverColor();
1216 void DrawHighlight();
1225 void DrawCrashSpheres();
1231 const Material& material,
int state);
1237 bool IsVisible(
int objRank);
1253 void ComputeDistance();
1256 void UpdateGeometry();
1262 void UpdateStaticBuffers();
1264 void AddBaseObjTriangles(
int baseObjRank,
const std::vector<VertexTex2>& vertices,
1265 const Material& material,
int state,
1266 std::string tex1Name, std::string tex2Name);
1272 std::unique_ptr<CImage> img;
1273 std::string fileName;
1275 static void WriteScreenShotThread(std::unique_ptr<WriteScreenShotData> data);
1279 void ReloadAllTextures();
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;
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;
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;
1375 Color m_backgroundColorUp;
1376 Color m_backgroundColorDown;
1377 Color m_backgroundCloudUp;
1378 Color m_backgroundCloudDown;
1382 std::string m_foregroundName;
1386 float m_terrainVision;
1388 float m_tracePrecision;
1389 bool m_pauseBlurEnabled;
1393 float m_particleDensity;
1394 float m_clippingDistance;
1396 bool m_editIndentMode;
1397 int m_editIndentValue;
1402 int m_highlightRank[100];
1457 std::string m_lastTexture[2];
1465 bool m_debugDumpLights;
1466 bool m_debugCrashSpheres =
false;
1467 bool m_debugResources =
false;
1468 bool m_debugGoto =
false;
1470 std::string m_timerText;
1472 std::unordered_map<std::string, int> m_staticMeshBaseObjects;
1474 std::vector<Math::Sphere> m_displayCrashSpheres;
1475 std::vector<std::vector<VertexCol>> m_displayGoto;
1476 std::unique_ptr<CImage> m_displayGotoImage;
1479 bool m_pause =
false;
1482 bool m_worldCaptured =
false;
1484 bool m_captureWorld =
false;
bool m_highlight
Highlight visible?
Definition: engine.h:1404
std::string tex1Name
1st texture
Definition: engine.h:163
Edit (I-beam)
Definition: engine.h:451
Normal shadow.
Definition: engine.h:301
Resize horizontally.
Definition: engine.h:463
CSingleton base class for singletons.
Math::Matrix m_matProj
Projection matrix for 3D scene.
Definition: engine.h:1316
Light texture (ambient max)
Definition: engine.h:100
Small cross.
Definition: engine.h:455
Fixed.
Definition: engine.h:381
Busy.
Definition: engine.h:449
Math::Matrix m_matProjInterface
Projection matrix for 2D interface.
Definition: engine.h:1334
Terrain.
Definition: engine.h:176
Math::Vector pos
Position for the shadow.
Definition: engine.h:356
Scroll down.
Definition: engine.h:477
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
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
Tier 2 of base object tree (textures)
Definition: engine.h:218
Texture using alpha channel.
Definition: engine.h:132
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
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
EngineObjectType
Class of graphics engine object.
Definition: engine.h:171
bool m_qualityShadows
true enables higher quality shadows
Definition: engine.h:1428
Definition: engine.h:1270
Number of items in enum.
Definition: engine.h:482
Point struct and related functions.
4x4 matrix
Definition: matrix.h:65
Larger crosshair.
Definition: engine.h:479
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
TextureCreateParams m_defaultTexParams
Default texture create params.
Definition: engine.h:1414
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
Always use 2nd floor texturing.
Definition: engine.h:118
bool m_renderInterface
Render / hide the UI?
Definition: engine.h:1310
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
Texture m_miceTexture
Texture with mouse cursors.
Definition: engine.h:1448
Math::Vector m_eyePt
Location of camera.
Definition: engine.h:1353
Texture struct and related enums.
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
Scroll to the left.
Definition: engine.h:471
Manager for dynamic lights in 3D scene.
Definition: lightman.h:146
bool m_render
Rendering enabled?
Definition: engine.h:1308
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
Resize vertically.
Definition: engine.h:465
A triangle drawn by the graphics engine.
Definition: engine.h:154
float m_shadowColor
Shadow color.
Definition: engine.h:1432
Fixed object.
Definition: engine.h:178
Color color
Color of the shadow.
Definition: engine.h:348
Math::Vector pos
Position of the shadow.
Definition: engine.h:321
Mesh data saved in model file.
Definition: model_mesh.h:35
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Fixed object type quartz.
Definition: engine.h:184
float m_focus
Camera angle for 3D scene.
Definition: engine.h:1320
Particle engine.
Definition: particle.h:223
Math::Vector drawPos
Draw position for marks.
Definition: engine.h:407
Color m_lastColor
Last color set with render state.
Definition: engine.h:1455
The transparent texture (black = no)
Definition: engine.h:90
Type of shadow drawn by the graphics engine.
A spot (large shadow) drawn on the ground by the graphics engine.
Definition: engine.h:343
The transparent color (white = no)
Definition: engine.h:124
Math::Vector pos
Position for marks.
Definition: engine.h:401
Definition: pyro_manager.h:41
Color structs and related functions.
TODO: ?
Definition: engine.h:303
Decrease.
Definition: engine.h:383
Planet manager.
Definition: planet.h:49
Resize diagonally bottom-left to top-right.
Definition: engine.h:467
Scroll to the right.
Definition: engine.h:473
The transparent color (black = no)
Definition: engine.h:122
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
Material material
Material.
Definition: engine.h:159
std::string tex2Name
2nd texture
Definition: engine.h:165
Hand.
Definition: engine.h:453
Matrix struct and related functions.
int state
Render state.
Definition: engine.h:161
VertexTex2 triangle[3]
Triangle vertices.
Definition: engine.h:157
2D point
Definition: point.h:50
Image loaded from file.
Definition: image.h:54
bool m_offscreenShadowRendering
true enables offscreen shadow rendering
Definition: engine.h:1424
Main application.
Definition: app.h:180
Math::Matrix m_matViewInterface
View matrix for 2D interface.
Definition: engine.h:1336
Shadow drawn by the graphics engine.
Definition: engine.h:310
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
Null phase.
Definition: engine.h:377
EngineGroundMark m_groundMark
Ground mark.
Definition: engine.h:1350
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
Resize diagonally top-left to bottom-right.
Definition: engine.h:469
The transparent diffuse color.
Definition: engine.h:94
EngineMouseType
Type of mouse cursor displayed in-game.
Definition: engine.h:444
Namespace for (new) graphics code.
Definition: app.h:49
Vector struct and related functions.
The graphics engine.
Definition: engine.h:585
Normal cursor (arrow)
Definition: engine.h:447
Math::Matrix m_shadowViewMat
View matrix for rendering shadow maps.
Definition: engine.h:1325
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
EngineMouseType m_mouseType
Type of mouse cursor.
Definition: engine.h:1450
EngineTriangleType
Type of triangles drawn for engine objects.
Definition: engine.h:142
Info about a texture.
Definition: texture.h:256
bool m_screenshotMode
Screenshot mode?
Definition: engine.h:1313
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
int m_lastState
Last engine render state (-1 at the beginning of frame)
Definition: engine.h:1453
A single triangle in mesh as saved in model file.
Definition: model_triangle.h:60
Math::Matrix transform
Transformation matrix.
Definition: engine.h:279
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
Water manager/renderer.
Definition: water.h:72
Only opaque texture, no blending, etc.
Definition: engine.h:128
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:1439
Resize.
Definition: engine.h:461
EngineTextureMapping
Type of texture mapping.
Definition: engine.h:429
Text rendering engine.
Definition: text.h:233
3D (3x1) vector
Definition: vector.h:53
Tier 3 of object tree (data)
Definition: engine.h:194
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
Surfaces.
Definition: engine.h:147
A mark on ground drawn by the graphics engine.
Definition: engine.h:390
2D Point with integer coords
Definition: intpoint.h:41
Color with transparency.
Definition: engine.h:134
std::map< Texture, std::string > m_revTexNameMap
Reverse map of loaded textures (by texture)
Definition: engine.h:1441
RGBA color.
Definition: color.h:39
Triangles.
Definition: engine.h:145
bool m_showStats
Whether to show stats (FPS, etc)
Definition: engine.h:1306
std::vector< EngineBaseObject > m_baseObjects
Base objects (also level 1 tier list)
Definition: engine.h:1342
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
int m_textureAnisotropy
Requested texture anisotropy level.
Definition: engine.h:1420
Texture borders with solid color.
Definition: engine.h:98
The transparent texture (white = no)
Definition: engine.h:92
TODO: ?
Definition: engine.h:457
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
Abstract interface of graphics device.
Definition: device.h:323
Double black texturing.
Definition: engine.h:102
Texture wrap.
Definition: engine.h:96
int m_offscreenShadowRenderingResolution
Offscreen shadow rendering resolution.
Definition: engine.h:1426