Colobot
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Gfx::CEngine Class Reference

The graphics engine. More...

#include <engine.h>

Inheritance diagram for Gfx::CEngine:
Inheritance graph
[legend]

Classes

struct  WriteScreenShotData
 

Public Member Functions

 CEngine (CApplication *app, CSystemUtils *systemUtils)
 
void SetDevice (CDevice *device)
 Sets the device to be used. More...
 
CDeviceGetDevice ()
 Returns the current device. More...
 
CTextGetText ()
 Returns the text rendering engine. More...
 
COldModelManagerGetModelManager ()
 
CPyroManagerGetPyroManager ()
 
CLightManagerGetLightManager ()
 Returns the light manager. More...
 
CParticleGetParticle ()
 Returns the particle manager. More...
 
CTerrainGetTerrain ()
 Returns the terrain manager. More...
 
CWaterGetWater ()
 Returns the water manager. More...
 
CLightningGetLightning ()
 Returns the lighting manager. More...
 
CPlanetGetPlanet ()
 Returns the planet manager. More...
 
CCloudGetCloud ()
 Returns the fog manager. More...
 
void SetTerrain (CTerrain *terrain)
 Sets the terrain object. More...
 
bool Create ()
 Performs the initialization; must be called after device was set. More...
 
void Destroy ()
 Frees all resources before exit. More...
 
void Render ()
 Called once per frame, the call is the entry point for rendering. More...
 
bool ProcessEvent (const Event &event)
 Processes incoming event. More...
 
void FrameUpdate ()
 Called once per frame, the call is the entry point for animating the scene. More...
 
void WriteScreenShot (const std::string &fileName)
 Writes a screenshot containing the current frame. More...
 
void SetRenderEnable (bool enable)
 Enables/disables rendering. More...
 
void SetRenderInterface (bool enable)
 
bool GetRenderInterface ()
 
Math::IntPoint GetWindowSize ()
 Returns current size of viewport window. More...
 
void AddStatisticTriangle (int count)
 Increments the triangle counter for the current frame. More...
 
int GetStatisticTriangle ()
 Returns the number of triangles in current frame. More...
 
void SetStatisticPos (Math::Vector pos)
 Sets the coordinates to display in stats window. More...
 
void SetTimerDisplay (const std::string &text)
 Sets text to display as mission timer. More...
 
int AddStaticMesh (const std::string &key, const Gfx::CModelMesh *mesh, const Math::Matrix &worldMatrix)
 Add new instance of static mesh. More...
 
void DeleteStaticMesh (int meshHandle)
 Removes given static mesh. More...
 
void AddStaticMeshShadowSpot (int meshHandle, const Gfx::ModelShadowSpot &shadowSpot)
 Adds a shadow spot to mesh. More...
 
const Math::MatrixGetStaticMeshWorldMatrix (int meshHandle)
 Returns static mesh world matrix. More...
 
void SetStaticMeshTransparency (int meshHandle, float value)
 Sets transparency for static mesh. More...
 
int CreateBaseObject ()
 Creates a base object and returns its rank. More...
 
void DeleteBaseObject (int baseObjRank)
 Deletes a base object. More...
 
void DeleteAllBaseObjects ()
 Deletes all base objects. More...
 
void CopyBaseObject (int sourceBaseObjRank, int destBaseObjRank)
 Copies geometry between two base objects. More...
 
void AddBaseObjTriangles (int baseObjRank, const std::vector< Gfx::ModelTriangle > &triangles)
 Adds triangles to given object with the specified params. More...
 
void AddBaseObjQuick (int baseObjRank, const EngineBaseObjDataTier &buffer, std::string tex1Name, std::string tex2Name, bool globalUpdate)
 Adds a tier 4 engine object directly. More...
 
void DebugObject (int objRank)
 Print debug info about an object. More...
 
int CreateObject ()
 Creates a new object and returns its rank. More...
 
void DeleteAllObjects ()
 Deletes all objects, shadows and ground spots. More...
 
void DeleteObject (int objRank)
 Deletes the given object. More...
 
void SetObjectDrawWorld (int objRank, bool draw)
 Sets drawWorld for given object. More...
 
void SetObjectDrawFront (int objRank, bool draw)
 Sets drawFront for given object. More...
 
void SetObjectTransparency (int objRank, float value)
 Sets the transparency level for given object. More...
 
void GetObjectBBox (int objRank, Math::Vector &min, Math::Vector &max)
 Returns the bounding box for an object. More...
 
int GetObjectTotalTriangles (int objRank)
 Returns the total number of triangles of given object. More...
 
EngineBaseObjDataTierFindTriangles (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. More...
 
int GetPartialTriangles (int objRank, float percent, int maxCount, std::vector< EngineTriangle > &triangles)
 Returns a partial list of triangles for given object. More...
 
void ChangeSecondTexture (int objRank, const std::string &tex2Name)
 Changes the 2nd texure for given object. More...
 
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. More...
 
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. More...
 
int DetectObject (Math::Point mouse, Math::Vector &targetPos, bool terrain=false)
 Detects the target object that is selected with the mouse. More...
 
void CreateShadowSpot (int objRank)
 Creates a shadow for the given object. More...
 
void DeleteShadowSpot (int objRank)
 Deletes the shadow for given object. More...
 
void SetHighlightRank (int *rankList)
 Lists the ranks of objects and subobjects selected. More...
 
bool GetHighlight (Math::Point &p1, Math::Point &p2)
 Returns the highlighted rectangle. More...
 
void DeleteAllGroundSpots ()
 Deletes all ground spots. More...
 
int CreateGroundSpot ()
 Creates a new ground spot and returns its rank. More...
 
void DeleteGroundSpot (int rank)
 Deletes the given ground spot. More...
 
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. More...
 
void DeleteGroundMark (int rank)
 Deletes the ground mark. More...
 
void Update ()
 Updates the state after creating objects. More...
 
void SetState (int state, const Color &color=Color(1.0f, 1.0f, 1.0f, 1.0f))
 Sets the current rendering state. More...
 
void SetMaterial (const Material &mat)
 Sets the current material. More...
 
void SetViewParams (const Math::Vector &eyePt, const Math::Vector &lookatPt, const Math::Vector &upVec)
 Specifies the location and direction of view. More...
 
Texture LoadTexture (const std::string &name)
 Loads texture, creating it if not already present. More...
 
Texture LoadTexture (const std::string &name, CImage *image)
 Loads texture from existing image. More...
 
Texture LoadTexture (const std::string &name, const TextureCreateParams &params)
 Loads texture, creating it with given params if not already present. More...
 
bool LoadAllTextures ()
 Loads all necessary textures. More...
 
bool SetTexture (const std::string &name, int stage=0)
 Sets texture for given stage; if not present in cache, the texture is loaded. More...
 
void SetTexture (const Texture &tex, int stage=0)
 Sets texture for given stage. More...
 
void DeleteTexture (const std::string &texName)
 Deletes the given texture, unloading it and removing from cache. More...
 
void DeleteTexture (const Texture &tex)
 Deletes the given texture, unloading it and removing from cache. More...
 
void CreateOrUpdateTexture (const std::string &texName, CImage *img)
 Creates or updates the given texture with given image data. More...
 
void FlushTextureCache ()
 Empties the texture cache. More...
 
void SetTerrainVision (float vision)
 Defines of the distance field of vision. More...
 
void SetDrawWorld (bool draw)
 Whether to draw the world. More...
 
void SetDrawFront (bool draw)
 Whether to draw the world on the interface. More...
 
void SetForegroundName (const std::string &name)
 Specifies the name of foreground texture. More...
 
void SetOverFront (bool front)
 Specifies whether to draw the foreground. More...
 
void SetOverColor (const Color &color=Color(), int mode=ENG_RSTATE_TCOLOR_BLACK)
 Sets the foreground overlay color. More...
 
float ParticleAdapt (float factor)
 Adapts particle factor according to particle density. More...
 
const Math::MatrixGetMatView ()
 Returns the view matrix. More...
 
TEST_VIRTUAL Math::Vector GetEyePt ()
 Returns the camera center point. More...
 
TEST_VIRTUAL Math::Vector GetLookatPt ()
 Returns the camera target point. More...
 
float GetEyeDirH ()
 Returns the horizontal direction angle of view. More...
 
float GetEyeDirV ()
 Returns the vertical direction angle of view. More...
 
bool IsVisiblePoint (const Math::Vector &pos)
 Indicates whether a point is visible. More...
 
void UpdateMatProj ()
 Resets the projection matrix after changes. More...
 
void ApplyChange ()
 Updates the scene after a change of parameters. More...
 
void ClearDisplayCrashSpheres ()
 
void AddDisplayCrashSpheres (const std::vector< Math::Sphere > &crashSpheres)
 
void SetDebugLights (bool debugLights)
 
bool GetDebugLights ()
 
void DebugDumpLights ()
 
void SetDebugResources (bool debugResources)
 
bool GetDebugResources ()
 
void SetDebugGoto (bool debugGoto)
 
bool GetDebugGoto ()
 
void AddDebugGotoLine (std::vector< Gfx::VertexCol > line)
 
void SetDebugGotoBitmap (std::unique_ptr< CImage > debugImage)
 
void SetWindowCoordinates ()
 
void SetInterfaceCoordinates ()
 
void EnablePauseBlur ()
 
void DisablePauseBlur ()
 
void SetPause (bool pause)
 Management of animation pause mode. More...
 
bool GetPause ()
 
void SetShowStats (bool show)
 Management of displaying statistic information. More...
 
bool GetShowStats ()
 
void SetScreenshotMode (bool screenshotMode)
 Management of "screenshot mode" (disables interface particle rendering) More...
 
bool GetScreenshotMode ()
 
Math::Point WindowToInterfaceCoords (Math::IntPoint pos)
 Conversion functions between window and interface coordinates. More...
 
Math::IntPoint InterfaceToWindowCoords (Math::Point pos)
 
Math::Point WindowToInterfaceSize (Math::IntPoint size)
 Conversion functions between window and interface sizes. More...
 
Math::IntPoint InterfaceToWindowSize (Math::Point size)
 
void SetObjectBaseRank (int objRank, int baseObjRank)
 Management of the base object rank for engine object. More...
 
int GetObjectBaseRank (int objRank)
 
void SetObjectType (int objRank, EngineObjectType type)
 Management of engine object type. More...
 
EngineObjectType GetObjectType (int objRank)
 
void SetObjectTransform (int objRank, const Math::Matrix &transform)
 Management of object transform. More...
 
void GetObjectTransform (int objRank, Math::Matrix &transform)
 
void SetObjectShadowSpotHide (int objRank, bool hide)
 Management of different shadow params. More...
 
void SetObjectShadowSpotType (int objRank, EngineShadowType type)
 
void SetObjectShadowSpotPos (int objRank, const Math::Vector &pos)
 
void SetObjectShadowSpotAngle (int objRank, float angle)
 
void SetObjectShadowSpotRadius (int objRank, float radius)
 
void SetObjectShadowSpotIntensity (int objRank, float intensity)
 
void SetObjectShadowSpotHeight (int objRank, float height)
 
void UpdateObjectShadowSpotNormal (int objRank)
 
void SetObjectGroundSpotPos (int rank, const Math::Vector &pos)
 Management of different ground spot params. More...
 
void SetObjectGroundSpotRadius (int rank, float radius)
 
void SetObjectGroundSpotColor (int rank, const Color &color)
 
void SetObjectGroundSpotMinMax (int rank, float min, float max)
 
void SetObjectGroundSpotSmooth (int rank, float smooth)
 
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. More...
 
bool ChangeTextureColor (const std::string &texName, 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)
 
void SetFocus (float focus)
 Management of camera angle. More...
 
float GetFocus ()
 
void SetDirty (bool mode)
 Management of the global mode of contamination. More...
 
bool GetDirty ()
 
void SetFog (bool mode)
 Management of the global mode of horizontal fog patches. More...
 
bool GetFog ()
 
void SetSecondTexture (const std::string &texNum)
 Management of the global mode of secondary texturing. More...
 
const std::string & GetSecondTexture ()
 
void SetRankView (int rank)
 Management of view mode. More...
 
int GetRankView ()
 
void SetAmbientColor (const Color &color, int rank=0)
 Ambient color management. More...
 
Color GetAmbientColor (int rank=0)
 
void SetWaterAddColor (const Color &color)
 Color management under water. More...
 
Color GetWaterAddColor ()
 
void SetFogColor (const Color &color, int rank=0)
 Management of the fog color. More...
 
Color GetFogColor (int rank=0)
 
void SetDeepView (float length, int rank=0, bool ref=false)
 Management of the depth of field. More...
 
float GetDeepView (int rank=0)
 
void SetFogStart (float start, int rank=0)
 Management the start of fog. More...
 
float GetFogStart (int rank=0)
 
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. More...
 
void GetBackground (std::string &name, Color &up, Color &down, Color &cloudUp, Color &cloudDown, bool &full, bool &scale)
 
void SetParticleDensity (float value)
 Management of the particle density. More...
 
float GetParticleDensity ()
 
void SetClippingDistance (float value)
 Management of the distance of clipping. More...
 
float GetClippingDistance ()
 
void SetTextureFilterMode (TexFilter value)
 Management the texture filter mode. More...
 
TexFilter GetTextureFilterMode ()
 
void SetTextureMipmapLevel (int value)
 Management the mipmap level for textures. More...
 
int GetTextureMipmapLevel ()
 
void SetTextureAnisotropyLevel (int value)
 Management the anisotropy level for textures. More...
 
int GetTextureAnisotropyLevel ()
 
bool IsShadowMappingSupported ()
 Management of shadow mapping. More...
 
void SetShadowMapping (bool value)
 
bool GetShadowMapping ()
 
void SetShadowMappingOffscreen (bool value)
 
bool GetShadowMappingOffscreen ()
 
void SetShadowMappingOffscreenResolution (int resolution)
 
int GetShadowMappingOffscreenResolution ()
 
bool IsShadowMappingQualitySupported ()
 
void SetShadowMappingQuality (bool value)
 
bool GetShadowMappingQuality ()
 
void SetTerrainShadows (bool value)
 
bool GetTerrainShadows ()
 
void SetShadowColor (float value)
 Management of shadow color. More...
 
float GetShadowColor ()
 
void SetShadowRange (float value)
 Management of shadow range. More...
 
float GetShadowRange ()
 
void SetMultiSample (int value)
 Management of shadow range. More...
 
int GetMultiSample ()
 
void SetBackForce (bool present)
 Management the mode of background. More...
 
bool GetBackForce ()
 
void SetLightMode (bool present)
 Managing the mode of dynamic lights. More...
 
bool GetLightMode ()
 
void SetEditIndentMode (bool autoIndent)
 Management of the indentation mode while editing (CEdit) More...
 
bool GetEditIndentMode ()
 
void SetEditIndentValue (int value)
 Management of tab indent when editing (CEdit) More...
 
int GetEditIndentValue ()
 
void SetTracePrecision (float factor)
 Management of precision of robot tracks. More...
 
float GetTracePrecision ()
 
void SetMouseType (EngineMouseType type)
 Management of mouse cursor type. More...
 
EngineMouseType GetMouseType ()
 
void SetPauseBlurEnabled (bool enable)
 Management of pause blur. More...
 
bool GetPauseBlurEnabled ()
 

Protected Member Functions

void ResetAfterVideoConfigChanged ()
 Resets some states and flushes textures after device was changed (e.g. resoulution changed) More...
 
void Draw3DScene ()
 Prepares the interface for 3D scene. More...
 
void Capture3DScene ()
 Capture the 3D scene for pause blur. More...
 
void DrawCaptured3DScene ()
 Draw the 3D scene capured for pause blur. More...
 
void RenderShadowMap ()
 Renders shadow map. More...
 
void UseShadowMapping (bool enable)
 Enables or disables shadow mapping. More...
 
void UseMSAA (bool enable)
 Enables or disables MSAA. More...
 
void DrawObject (const EngineBaseObjDataTier &p4)
 Draw 3D object. More...
 
void DrawInterface ()
 Draws the user interface over the scene. More...
 
void UpdateGroundSpotTextures ()
 Updates the textures used for drawing ground spot. More...
 
void DrawShadowSpots ()
 Draws old-style shadow spots. More...
 
void DrawBackground ()
 Draws the gradient background. More...
 
void DrawBackgroundGradient (const Color &up, const Color &down)
 Draws the gradient background. More...
 
void DrawBackgroundImage ()
 Draws the image background. More...
 
void DrawPlanet ()
 Draws all the planets. More...
 
void DrawForegroundImage ()
 Draws the image foreground. More...
 
void DrawOverColor ()
 Draws the foreground color. More...
 
void DrawHighlight ()
 Draws the rectangle of the object highlighted. More...
 
void DrawMouse ()
 Draws the mouse cursor. More...
 
void DrawMouseSprite (Math::IntPoint pos, Math::IntPoint size, int icon)
 Draw part of mouse cursor sprite. More...
 
void DrawStats ()
 Draw statistic texts. More...
 
void DrawTimer ()
 Draw mission timer. More...
 
void DrawCrashSpheres ()
 
EngineBaseObjTexTierAddLevel2 (EngineBaseObject &p1, const std::string &tex1Name, const std::string &tex2Name)
 Creates a new tier 2 object (texture) More...
 
EngineBaseObjDataTierAddLevel3 (EngineBaseObjTexTier &p3, EngineTriangleType type, const Material &material, int state)
 Creates a new tier 3 object (data) More...
 
Texture CreateTexture (const std::string &texName, const TextureCreateParams &params, CImage *image=nullptr)
 Create texture and add it to cache. More...
 
bool IsVisible (int objRank)
 Tests whether the given object is visible. More...
 
bool DetectBBox (int objRank, Math::Point mouse)
 Detects whether an object is affected by the mouse. More...
 
bool GetBBox2D (int objRank, Math::Point &min, Math::Point &max)
 Compute and return the 2D box on screen of any object. More...
 
bool DetectTriangle (Math::Point mouse, VertexTex2 *triangle, int objRank, float &dist, Math::Vector &pos)
 Detects whether the mouse is in a triangle. More...
 
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. More...
 
void ComputeDistance ()
 Calculates the distances between the viewpoint and the origin of different objects. More...
 
void UpdateGeometry ()
 Updates geometric parameters of objects (bounding box and radius) More...
 
void UpdateStaticBuffer (EngineBaseObjDataTier &p4)
 Updates a given static buffer. More...
 
void UpdateStaticBuffers ()
 Updates static buffers of changed objects. More...
 
void AddBaseObjTriangles (int baseObjRank, const std::vector< VertexTex2 > &vertices, const Material &material, int state, std::string tex1Name, std::string tex2Name)
 
int GetEngineState (const ModelTriangle &triangle)
 
void ReloadAllTextures ()
 Reloads all textures. More...
 

Static Protected Member Functions

static void WriteScreenShotThread (std::unique_ptr< WriteScreenShotData > data)
 

Protected Attributes

CApplicationm_app
 
CSystemUtilsm_systemUtils
 
CSoundInterfacem_sound
 
CDevicem_device
 
CTerrainm_terrain
 
std::unique_ptr< COldModelManagerm_modelManager
 
std::unique_ptr< CTextm_text
 
std::unique_ptr< CLightManagerm_lightMan
 
std::unique_ptr< CParticlem_particle
 
std::unique_ptr< CWaterm_water
 
std::unique_ptr< CCloudm_cloud
 
std::unique_ptr< CLightningm_lightning
 
std::unique_ptr< CPlanetm_planet
 
std::unique_ptr< CPyroManagerm_pyroManager
 
std::string m_error
 Last encountered error. More...
 
SystemTimeStampm_lastFrameTime
 
SystemTimeStampm_currentFrameTime
 
int m_fpsCounter
 
float m_fps
 
bool m_showStats
 Whether to show stats (FPS, etc) More...
 
bool m_render
 Rendering enabled? More...
 
bool m_renderInterface
 Render / hide the UI? More...
 
bool m_screenshotMode
 Screenshot mode? More...
 
Math::Matrix m_matProj
 Projection matrix for 3D scene. More...
 
Math::Matrix m_matView
 View matrix for 3D scene. More...
 
float m_focus
 Camera angle for 3D scene. More...
 
Math::Matrix m_shadowProjMat
 Projection matrix for rendering shadow maps. More...
 
Math::Matrix m_shadowViewMat
 View matrix for rendering shadow maps. More...
 
Math::Matrix m_shadowTextureMat
 Texture matrix for rendering shadow maps. More...
 
Math::Matrix m_shadowBias
 Texture bias for sampling shadow maps. More...
 
Math::Matrix m_matWorldInterface
 World matrix for 2D interface. More...
 
Math::Matrix m_matProjInterface
 Projection matrix for 2D interface. More...
 
Math::Matrix m_matViewInterface
 View matrix for 2D interface. More...
 
Math::IntPoint m_size
 Current size of viewport window. More...
 
std::vector< EngineBaseObjectm_baseObjects
 Base objects (also level 1 tier list) More...
 
std::vector< EngineObjectm_objects
 Object parameters. More...
 
std::vector< EngineShadowm_shadowSpots
 Shadow list. More...
 
std::vector< EngineGroundSpotm_groundSpots
 Ground spot list. More...
 
EngineGroundMark m_groundMark
 Ground mark. More...
 
Math::Vector m_eyePt
 Location of camera. More...
 
Math::Vector m_lookatPt
 Camera target. More...
 
float m_eyeDirH
 
float m_eyeDirV
 
int m_rankView
 
Color m_ambientColor [2]
 
Color m_backColor [2]
 
Color m_fogColor [2]
 
float m_deepView [2]
 
float m_fogStart [2]
 
Color m_waterAddColor
 
int m_statisticTriangle
 
Math::Vector m_statisticPos
 
bool m_updateGeometry
 
bool m_updateStaticBuffers
 
bool m_firstGroundSpot
 
std::string m_secondTex
 
bool m_backgroundFull
 
bool m_backgroundScale
 
std::string m_backgroundName
 
Texture m_backgroundTex
 
Color m_backgroundColorUp
 
Color m_backgroundColorDown
 
Color m_backgroundCloudUp
 
Color m_backgroundCloudDown
 
bool m_overFront
 
Color m_overColor
 
int m_overMode
 
std::string m_foregroundName
 
Texture m_foregroundTex
 
bool m_drawWorld
 
bool m_drawFront
 
float m_terrainVision
 
bool m_backForce
 
float m_tracePrecision
 
bool m_pauseBlurEnabled
 
bool m_dirty
 
bool m_fog
 
float m_particleDensity
 
float m_clippingDistance
 
bool m_lightMode
 
bool m_editIndentMode
 
int m_editIndentValue
 
Texture m_shadowMap
 
int m_highlightRank [100]
 Ranks of highlighted objects. More...
 
bool m_highlight
 Highlight visible? More...
 
float m_highlightTime
 Time counter for highlight animation. More...
 
TextureCreateParams m_defaultTexParams
 Default texture create params. More...
 
TextureCreateParams m_terrainTexParams
 Create params for terrain textures. More...
 
int m_textureMipmapLevel
 Requested texture mipmap level. More...
 
int m_textureAnisotropy
 Requested texture anisotropy level. More...
 
bool m_shadowMapping
 true if shadow mapping enabled More...
 
bool m_offscreenShadowRendering
 true enables offscreen shadow rendering More...
 
int m_offscreenShadowRenderingResolution
 Offscreen shadow rendering resolution. More...
 
bool m_qualityShadows
 true enables higher quality shadows More...
 
bool m_terrainShadows
 true enables casting shadows by terrain More...
 
float m_shadowColor
 Shadow color. More...
 
float m_shadowRange
 Shadow range. More...
 
int m_multisample
 Number of samples for multisample rendering. More...
 
std::map< std::string, Texturem_texNameMap
 Map of loaded textures (by name) More...
 
std::map< Texture, std::string > m_revTexNameMap
 Reverse map of loaded textures (by texture) More...
 
std::set< std::string > m_texBlacklist
 Blacklist map of textures. More...
 
Texture m_miceTexture
 Texture with mouse cursors. More...
 
EngineMouseType m_mouseType
 Type of mouse cursor. More...
 
int m_lastState
 Last engine render state (-1 at the beginning of frame) More...
 
Color m_lastColor
 Last color set with render state. More...
 
std::string m_lastTexture [2]
 Last texture names for 2 used texture stages. More...
 
Material m_lastMaterial
 Last material. More...
 
bool m_interfaceMode
 True when drawing 2D UI. More...
 
bool m_debugLights
 
bool m_debugDumpLights
 
bool m_debugCrashSpheres = false
 
bool m_debugResources = false
 
bool m_debugGoto = false
 
std::string m_timerText
 
std::unordered_map< std::string, int > m_staticMeshBaseObjects
 
std::vector< Math::Spherem_displayCrashSpheres
 
std::vector< std::vector< VertexCol > > m_displayGoto
 
std::unique_ptr< CImagem_displayGotoImage
 
bool m_pause = false
 Pause the animation updates. More...
 
bool m_worldCaptured = false
 true means that current 3D scene was captured and is not to be rendered again More...
 
bool m_captureWorld = false
 true means that currently rendered world is to be captured More...
 
Texture m_capturedWorldTexture
 Texture with captured 3D world. More...
 
Math::Point m_highlightP1
 Highlight rectangle points. More...
 
Math::Point m_highlightP2
 

Additional Inherited Members

- Static Public Member Functions inherited from CSingleton< CEngine >
static CEngine & GetInstance ()
 
static CEngine * GetInstancePointer ()
 
static bool IsCreated ()
 
- Static Protected Attributes inherited from CSingleton< CEngine >
static CEngine * m_instance
 

Detailed Description

The graphics engine.

This is the main class for graphics engine. It is responsible for drawing the 3D scene, setting various render states, and facilitating the drawing of 2D interface.

It uses a lower-level CDevice object which is implementation-independent core engine.

3D Scene

The 3D scene is drawn with view coordinates set from camera position in 3D space and a perspective projection matrix. The world matrix depends on the object drawn. The coordinate system is left-handed: X axis is to the right, Y axis to the top and Z axis is into the screen (Z = 0 is the sceen surface).

In general, the 3D scene is composed of the following things:

2D Interface

The 2D interface is drawn in fixed XY coordinates, independent from window size. Lower-left corner of the screen is (0,0) and upper-right corner is (1,1). Matrices for world, view and projection are therefore fixed and never change.

The class tracks the change of window coordinates and conversion functions between the window and interface coordinates are provided.

Interface drawing is delegated to CInterface class and particular controls are instances of CControl class. The source code for these classes is in src/ui directory.

Engine Objects

The 3D scene is composed of objects which are basically collections of triangles forming a surface or simply independent triangles in space.

Objects are uniquely identified by object rank obtained at object creation. Creating an object equals to allocating space for EngineObject structure which holds object parameters.

Object's geometric data is stored as a separate object – base engine object. Each object must reference a valid base engine object or an empty base engine object (with rank = -1). This many-to-one association allows to share same geometric data (e.g. from same model) across objects.

Base engine object data is stored in a 4-tier tree which splits the data describing triangles.

The 4 tiers contain the following information:

*NOTE: type of object in this context means only the internal type in 3D engine. It is not related to CObject types.

Last tier containing vertex data contains also an ID of static buffer holding the data. The static buffer is created and updated with new data as needed.

Such tiered structure complicates loops over all object data, but saves a lot of memory and optimizes the rendering process.

Shadows

Each engine object can be associated with a shadow (EngineShadow). Like objects, shadows are identified by their rank obtained upon creation.

Shadows are drawn as circular spots on the ground, except for shadows for worms, which have special mode for them.

Render States

Almost every primitive drawn on screen is drawn in state set through EngineRenderState enum. In some functions, custom modes are still set, using CDevice's SetRenderState. However, it will be subject to removal in the future. Generally, setting render states should be minimized to avoid unnecessary overhead.

Some states are clearly the result of legacy drawing and texturing methods. For example, TTEXTURE states should really be removed and the textures changed to ones with alpha channel. In the future, the whole modesetting code will probably be refactored to something more maintainable.

Textures

Textures are loaded from a texture subdir in data directory. In the old code, textures were identified by file name and loaded using some D3D util code. With new code and OpenGL backend, this approach is not efficient - name comparison, etc. takes a lot of time. In the future, textures should be loaded once at object creation time, and then referenced to as Texture structs, or even as unsigned int ID's which is what OpenGL actually wants. The old method is kept for now, with mapping between texture names and texture structs but it will also be subject to refactoring in the future.

Member Function Documentation

void Gfx::CEngine::SetDevice ( CDevice device)

Sets the device to be used.

CDevice * Gfx::CEngine::GetDevice ( )

Returns the current device.

CText * Gfx::CEngine::GetText ( )

Returns the text rendering engine.

CLightManager * Gfx::CEngine::GetLightManager ( )

Returns the light manager.

CParticle * Gfx::CEngine::GetParticle ( )

Returns the particle manager.

CTerrain * Gfx::CEngine::GetTerrain ( )

Returns the terrain manager.

CWater * Gfx::CEngine::GetWater ( )

Returns the water manager.

CLightning * Gfx::CEngine::GetLightning ( )

Returns the lighting manager.

CPlanet * Gfx::CEngine::GetPlanet ( )

Returns the planet manager.

CCloud * Gfx::CEngine::GetCloud ( )

Returns the fog manager.

void Gfx::CEngine::SetTerrain ( CTerrain terrain)

Sets the terrain object.

bool Gfx::CEngine::Create ( )

Performs the initialization; must be called after device was set.

void Gfx::CEngine::Destroy ( )

Frees all resources before exit.

void Gfx::CEngine::Render ( )

Called once per frame, the call is the entry point for rendering.

This function sets up render states, clears the viewport, and renders the scene.

bool Gfx::CEngine::ProcessEvent ( const Event event)

Processes incoming event.

void Gfx::CEngine::FrameUpdate ( )

Called once per frame, the call is the entry point for animating the scene.

void Gfx::CEngine::WriteScreenShot ( const std::string &  fileName)

Writes a screenshot containing the current frame.

void Gfx::CEngine::SetPause ( bool  pause)

Management of animation pause mode.

void Gfx::CEngine::SetShowStats ( bool  show)

Management of displaying statistic information.

void Gfx::CEngine::SetRenderEnable ( bool  enable)

Enables/disables rendering.

void Gfx::CEngine::SetScreenshotMode ( bool  screenshotMode)

Management of "screenshot mode" (disables interface particle rendering)

Math::IntPoint Gfx::CEngine::GetWindowSize ( )

Returns current size of viewport window.

Math::Point Gfx::CEngine::WindowToInterfaceCoords ( Math::IntPoint  pos)

Conversion functions between window and interface coordinates.

Window coordinates are from top-left (0,0) to bottom-right (w,h) - size of window Interface cords are from bottom-left (0,0) to top-right (1,1) - and do not depend on window size

Math::Point Gfx::CEngine::WindowToInterfaceSize ( Math::IntPoint  size)

Conversion functions between window and interface sizes.

Unlike coordinate conversions, this is only scale conversion, not translation and scale.

void Gfx::CEngine::AddStatisticTriangle ( int  count)

Increments the triangle counter for the current frame.

int Gfx::CEngine::GetStatisticTriangle ( )

Returns the number of triangles in current frame.

void Gfx::CEngine::SetStatisticPos ( Math::Vector  pos)

Sets the coordinates to display in stats window.

void Gfx::CEngine::SetTimerDisplay ( const std::string &  text)

Sets text to display as mission timer.

int Gfx::CEngine::AddStaticMesh ( const std::string &  key,
const Gfx::CModelMesh mesh,
const Math::Matrix worldMatrix 
)

Add new instance of static mesh.

Static meshes never change their geometry or texture mapping, so specific instances can share mesh data.

Parameters
meshmesh data
keykey unique per object class
Returns
mesh instance handle
void Gfx::CEngine::DeleteStaticMesh ( int  meshHandle)

Removes given static mesh.

void Gfx::CEngine::AddStaticMeshShadowSpot ( int  meshHandle,
const Gfx::ModelShadowSpot shadowSpot 
)

Adds a shadow spot to mesh.

const Math::Matrix & Gfx::CEngine::GetStaticMeshWorldMatrix ( int  meshHandle)

Returns static mesh world matrix.

void Gfx::CEngine::SetStaticMeshTransparency ( int  meshHandle,
float  value 
)

Sets transparency for static mesh.

int Gfx::CEngine::CreateBaseObject ( )

Creates a base object and returns its rank.

void Gfx::CEngine::DeleteBaseObject ( int  baseObjRank)

Deletes a base object.

void Gfx::CEngine::DeleteAllBaseObjects ( )

Deletes all base objects.

void Gfx::CEngine::CopyBaseObject ( int  sourceBaseObjRank,
int  destBaseObjRank 
)

Copies geometry between two base objects.

void Gfx::CEngine::AddBaseObjTriangles ( int  baseObjRank,
const std::vector< Gfx::ModelTriangle > &  triangles 
)

Adds triangles to given object with the specified params.

void Gfx::CEngine::AddBaseObjQuick ( int  baseObjRank,
const EngineBaseObjDataTier buffer,
std::string  tex1Name,
std::string  tex2Name,
bool  globalUpdate 
)

Adds a tier 4 engine object directly.

void Gfx::CEngine::DebugObject ( int  objRank)

Print debug info about an object.

int Gfx::CEngine::CreateObject ( )

Creates a new object and returns its rank.

void Gfx::CEngine::DeleteAllObjects ( )

Deletes all objects, shadows and ground spots.

void Gfx::CEngine::DeleteObject ( int  objRank)

Deletes the given object.

void Gfx::CEngine::SetObjectBaseRank ( int  objRank,
int  baseObjRank 
)

Management of the base object rank for engine object.

void Gfx::CEngine::SetObjectType ( int  objRank,
EngineObjectType  type 
)

Management of engine object type.

void Gfx::CEngine::SetObjectTransform ( int  objRank,
const Math::Matrix transform 
)

Management of object transform.

void Gfx::CEngine::SetObjectDrawWorld ( int  objRank,
bool  draw 
)

Sets drawWorld for given object.

void Gfx::CEngine::SetObjectDrawFront ( int  objRank,
bool  draw 
)

Sets drawFront for given object.

void Gfx::CEngine::SetObjectTransparency ( int  objRank,
float  value 
)

Sets the transparency level for given object.

void Gfx::CEngine::GetObjectBBox ( int  objRank,
Math::Vector min,
Math::Vector max 
)

Returns the bounding box for an object.

int Gfx::CEngine::GetObjectTotalTriangles ( int  objRank)

Returns the total number of triangles of given object.

EngineBaseObjDataTier * Gfx::CEngine::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.

int Gfx::CEngine::GetPartialTriangles ( int  objRank,
float  percent,
int  maxCount,
std::vector< EngineTriangle > &  triangles 
)

Returns a partial list of triangles for given object.

void Gfx::CEngine::ChangeSecondTexture ( int  objRank,
const std::string &  tex2Name 
)

Changes the 2nd texure for given object.

void Gfx::CEngine::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.

void Gfx::CEngine::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.

int Gfx::CEngine::DetectObject ( Math::Point  mouse,
Math::Vector targetPos,
bool  terrain = false 
)

Detects the target object that is selected with the mouse.

Returns the rank of the object or -1.

void Gfx::CEngine::CreateShadowSpot ( int  objRank)

Creates a shadow for the given object.

void Gfx::CEngine::DeleteShadowSpot ( int  objRank)

Deletes the shadow for given object.

void Gfx::CEngine::SetObjectShadowSpotHide ( int  objRank,
bool  hide 
)

Management of different shadow params.

void Gfx::CEngine::SetHighlightRank ( int *  rankList)

Lists the ranks of objects and subobjects selected.

bool Gfx::CEngine::GetHighlight ( Math::Point p1,
Math::Point p2 
)

Returns the highlighted rectangle.

void Gfx::CEngine::DeleteAllGroundSpots ( )

Deletes all ground spots.

int Gfx::CEngine::CreateGroundSpot ( )

Creates a new ground spot and returns its rank.

void Gfx::CEngine::DeleteGroundSpot ( int  rank)

Deletes the given ground spot.

void Gfx::CEngine::SetObjectGroundSpotPos ( int  rank,
const Math::Vector pos 
)

Management of different ground spot params.

void Gfx::CEngine::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.

void Gfx::CEngine::DeleteGroundMark ( int  rank)

Deletes the ground mark.

void Gfx::CEngine::Update ( )

Updates the state after creating objects.

void Gfx::CEngine::SetState ( int  state,
const Color color = Color(1.0f, 1.0f, 1.0f, 1.0f) 
)

Sets the current rendering state.

void Gfx::CEngine::SetMaterial ( const Material mat)

Sets the current material.

void Gfx::CEngine::SetViewParams ( const Math::Vector eyePt,
const Math::Vector lookatPt,
const Math::Vector upVec 
)

Specifies the location and direction of view.

Texture Gfx::CEngine::LoadTexture ( const std::string &  name)

Loads texture, creating it if not already present.

Texture Gfx::CEngine::LoadTexture ( const std::string &  name,
CImage image 
)

Loads texture from existing image.

Texture Gfx::CEngine::LoadTexture ( const std::string &  name,
const TextureCreateParams params 
)

Loads texture, creating it with given params if not already present.

bool Gfx::CEngine::LoadAllTextures ( )

Loads all necessary textures.

bool Gfx::CEngine::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.

bool Gfx::CEngine::SetTexture ( const std::string &  name,
int  stage = 0 
)

Sets texture for given stage; if not present in cache, the texture is loaded.

If loading fails, returns false.

void Gfx::CEngine::SetTexture ( const Texture tex,
int  stage = 0 
)

Sets texture for given stage.

void Gfx::CEngine::DeleteTexture ( const std::string &  texName)

Deletes the given texture, unloading it and removing from cache.

void Gfx::CEngine::DeleteTexture ( const Texture tex)

Deletes the given texture, unloading it and removing from cache.

void Gfx::CEngine::CreateOrUpdateTexture ( const std::string &  texName,
CImage img 
)

Creates or updates the given texture with given image data.

void Gfx::CEngine::FlushTextureCache ( )

Empties the texture cache.

void Gfx::CEngine::SetTerrainVision ( float  vision)

Defines of the distance field of vision.

void Gfx::CEngine::SetFocus ( float  focus)

Management of camera angle.

0.75 = normal 1.50 = wide-angle

void Gfx::CEngine::SetDirty ( bool  mode)

Management of the global mode of contamination.

void Gfx::CEngine::SetFog ( bool  mode)

Management of the global mode of horizontal fog patches.

void Gfx::CEngine::SetSecondTexture ( const std::string &  texNum)

Management of the global mode of secondary texturing.

void Gfx::CEngine::SetRankView ( int  rank)

Management of view mode.

void Gfx::CEngine::SetDrawWorld ( bool  draw)

Whether to draw the world.

void Gfx::CEngine::SetDrawFront ( bool  draw)

Whether to draw the world on the interface.

void Gfx::CEngine::SetAmbientColor ( const Color color,
int  rank = 0 
)

Ambient color management.

void Gfx::CEngine::SetWaterAddColor ( const Color color)

Color management under water.

void Gfx::CEngine::SetFogColor ( const Color color,
int  rank = 0 
)

Management of the fog color.

void Gfx::CEngine::SetDeepView ( float  length,
int  rank = 0,
bool  ref = false 
)

Management of the depth of field.

Beyond this distance, nothing is visible. Shortly (according SetFogStart), one enters the fog.

void Gfx::CEngine::SetFogStart ( float  start,
int  rank = 0 
)

Management the start of fog.

With 0.0, the fog from the point of view (fog max). With 1.0, the fog from the depth of field (no fog).

void Gfx::CEngine::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.

void Gfx::CEngine::SetForegroundName ( const std::string &  name)

Specifies the name of foreground texture.

void Gfx::CEngine::SetOverFront ( bool  front)

Specifies whether to draw the foreground.

void Gfx::CEngine::SetOverColor ( const Color color = Color(),
int  mode = ENG_RSTATE_TCOLOR_BLACK 
)

Sets the foreground overlay color.

void Gfx::CEngine::SetParticleDensity ( float  value)

Management of the particle density.

float Gfx::CEngine::ParticleAdapt ( float  factor)

Adapts particle factor according to particle density.

void Gfx::CEngine::SetClippingDistance ( float  value)

Management of the distance of clipping.

void Gfx::CEngine::SetTextureFilterMode ( TexFilter  value)

Management the texture filter mode.

void Gfx::CEngine::SetTextureMipmapLevel ( int  value)

Management the mipmap level for textures.

void Gfx::CEngine::SetTextureAnisotropyLevel ( int  value)

Management the anisotropy level for textures.

bool Gfx::CEngine::IsShadowMappingSupported ( )

Management of shadow mapping.

void Gfx::CEngine::SetShadowColor ( float  value)

Management of shadow color.

void Gfx::CEngine::SetShadowRange ( float  value)

Management of shadow range.

void Gfx::CEngine::SetMultiSample ( int  value)

Management of shadow range.

void Gfx::CEngine::SetBackForce ( bool  present)

Management the mode of background.

void Gfx::CEngine::SetLightMode ( bool  present)

Managing the mode of dynamic lights.

void Gfx::CEngine::SetEditIndentMode ( bool  autoIndent)

Management of the indentation mode while editing (CEdit)

void Gfx::CEngine::SetEditIndentValue ( int  value)

Management of tab indent when editing (CEdit)

void Gfx::CEngine::SetTracePrecision ( float  factor)

Management of precision of robot tracks.

void Gfx::CEngine::SetMouseType ( EngineMouseType  type)

Management of mouse cursor type.

void Gfx::CEngine::SetPauseBlurEnabled ( bool  enable)

Management of pause blur.

const Math::Matrix & Gfx::CEngine::GetMatView ( )

Returns the view matrix.

Math::Vector Gfx::CEngine::GetEyePt ( )

Returns the camera center point.

Math::Vector Gfx::CEngine::GetLookatPt ( )

Returns the camera target point.

float Gfx::CEngine::GetEyeDirH ( )

Returns the horizontal direction angle of view.

float Gfx::CEngine::GetEyeDirV ( )

Returns the vertical direction angle of view.

bool Gfx::CEngine::IsVisiblePoint ( const Math::Vector pos)

Indicates whether a point is visible.

void Gfx::CEngine::UpdateMatProj ( )

Resets the projection matrix after changes.

void Gfx::CEngine::ApplyChange ( )

Updates the scene after a change of parameters.

void Gfx::CEngine::ResetAfterVideoConfigChanged ( )
protected

Resets some states and flushes textures after device was changed (e.g. resoulution changed)

Instead of calling this directly, send EVENT_RESOLUTION_CHANGED event

void Gfx::CEngine::Draw3DScene ( )
protected

Prepares the interface for 3D scene.

void Gfx::CEngine::Capture3DScene ( )
protected

Capture the 3D scene for pause blur.

void Gfx::CEngine::DrawCaptured3DScene ( )
protected

Draw the 3D scene capured for pause blur.

void Gfx::CEngine::RenderShadowMap ( )
protected

Renders shadow map.

void Gfx::CEngine::UseShadowMapping ( bool  enable)
protected

Enables or disables shadow mapping.

void Gfx::CEngine::UseMSAA ( bool  enable)
protected

Enables or disables MSAA.

void Gfx::CEngine::DrawObject ( const EngineBaseObjDataTier p4)
protected

Draw 3D object.

void Gfx::CEngine::DrawInterface ( )
protected

Draws the user interface over the scene.

void Gfx::CEngine::UpdateGroundSpotTextures ( )
protected

Updates the textures used for drawing ground spot.

void Gfx::CEngine::DrawShadowSpots ( )
protected

Draws old-style shadow spots.

void Gfx::CEngine::DrawBackground ( )
protected

Draws the gradient background.

void Gfx::CEngine::DrawBackgroundGradient ( const Color up,
const Color down 
)
protected

Draws the gradient background.

void Gfx::CEngine::DrawBackgroundImage ( )
protected

Draws the image background.

void Gfx::CEngine::DrawPlanet ( )
protected

Draws all the planets.

void Gfx::CEngine::DrawForegroundImage ( )
protected

Draws the image foreground.

void Gfx::CEngine::DrawOverColor ( )
protected

Draws the foreground color.

void Gfx::CEngine::DrawHighlight ( )
protected

Draws the rectangle of the object highlighted.

void Gfx::CEngine::DrawMouse ( )
protected

Draws the mouse cursor.

void Gfx::CEngine::DrawMouseSprite ( Math::IntPoint  pos,
Math::IntPoint  size,
int  icon 
)
protected

Draw part of mouse cursor sprite.

void Gfx::CEngine::DrawStats ( )
protected

Draw statistic texts.

void Gfx::CEngine::DrawTimer ( )
protected

Draw mission timer.

EngineBaseObjTexTier & Gfx::CEngine::AddLevel2 ( EngineBaseObject p1,
const std::string &  tex1Name,
const std::string &  tex2Name 
)
protected

Creates a new tier 2 object (texture)

EngineBaseObjDataTier & Gfx::CEngine::AddLevel3 ( EngineBaseObjTexTier p3,
EngineTriangleType  type,
const Material material,
int  state 
)
protected

Creates a new tier 3 object (data)

Texture Gfx::CEngine::CreateTexture ( const std::string &  texName,
const TextureCreateParams params,
CImage image = nullptr 
)
protected

Create texture and add it to cache.

bool Gfx::CEngine::IsVisible ( int  objRank)
protected

Tests whether the given object is visible.

Use only after world transform already set.

bool Gfx::CEngine::DetectBBox ( int  objRank,
Math::Point  mouse 
)
protected

Detects whether an object is affected by the mouse.

bool Gfx::CEngine::GetBBox2D ( int  objRank,
Math::Point min,
Math::Point max 
)
protected

Compute and return the 2D box on screen of any object.

bool Gfx::CEngine::DetectTriangle ( Math::Point  mouse,
VertexTex2 triangle,
int  objRank,
float &  dist,
Math::Vector pos 
)
protected

Detects whether the mouse is in a triangle.

bool Gfx::CEngine::TransformPoint ( Math::Vector p2D,
int  objRank,
Math::Vector  p3D 
)
protected

Transforms a 3D point (x, y, z) in 2D space (x, y, -) of the window.

The coordinated p2D.z gives the distance.

void Gfx::CEngine::ComputeDistance ( )
protected

Calculates the distances between the viewpoint and the origin of different objects.

void Gfx::CEngine::UpdateGeometry ( )
protected

Updates geometric parameters of objects (bounding box and radius)

void Gfx::CEngine::UpdateStaticBuffer ( EngineBaseObjDataTier p4)
protected

Updates a given static buffer.

void Gfx::CEngine::UpdateStaticBuffers ( )
protected

Updates static buffers of changed objects.

void Gfx::CEngine::ReloadAllTextures ( )
protected

Reloads all textures.

This additionally sends EVENT_RELOAD_TEXTURES to reload all textures not maintained by CEngine

Member Data Documentation

std::string Gfx::CEngine::m_error
protected

Last encountered error.

bool Gfx::CEngine::m_showStats
protected

Whether to show stats (FPS, etc)

bool Gfx::CEngine::m_render
protected

Rendering enabled?

bool Gfx::CEngine::m_renderInterface
protected

Render / hide the UI?

bool Gfx::CEngine::m_screenshotMode
protected

Screenshot mode?

Math::Matrix Gfx::CEngine::m_matProj
protected

Projection matrix for 3D scene.

Math::Matrix Gfx::CEngine::m_matView
protected

View matrix for 3D scene.

float Gfx::CEngine::m_focus
protected

Camera angle for 3D scene.

Math::Matrix Gfx::CEngine::m_shadowProjMat
protected

Projection matrix for rendering shadow maps.

Math::Matrix Gfx::CEngine::m_shadowViewMat
protected

View matrix for rendering shadow maps.

Math::Matrix Gfx::CEngine::m_shadowTextureMat
protected

Texture matrix for rendering shadow maps.

Math::Matrix Gfx::CEngine::m_shadowBias
protected

Texture bias for sampling shadow maps.

Math::Matrix Gfx::CEngine::m_matWorldInterface
protected

World matrix for 2D interface.

Math::Matrix Gfx::CEngine::m_matProjInterface
protected

Projection matrix for 2D interface.

Math::Matrix Gfx::CEngine::m_matViewInterface
protected

View matrix for 2D interface.

Math::IntPoint Gfx::CEngine::m_size
protected

Current size of viewport window.

std::vector<EngineBaseObject> Gfx::CEngine::m_baseObjects
protected

Base objects (also level 1 tier list)

std::vector<EngineObject> Gfx::CEngine::m_objects
protected

Object parameters.

std::vector<EngineShadow> Gfx::CEngine::m_shadowSpots
protected

Shadow list.

std::vector<EngineGroundSpot> Gfx::CEngine::m_groundSpots
protected

Ground spot list.

EngineGroundMark Gfx::CEngine::m_groundMark
protected

Ground mark.

Math::Vector Gfx::CEngine::m_eyePt
protected

Location of camera.

Math::Vector Gfx::CEngine::m_lookatPt
protected

Camera target.

int Gfx::CEngine::m_highlightRank[100]
protected

Ranks of highlighted objects.

bool Gfx::CEngine::m_highlight
protected

Highlight visible?

float Gfx::CEngine::m_highlightTime
protected

Time counter for highlight animation.

Math::Point Gfx::CEngine::m_highlightP1
protected

Highlight rectangle points.

TextureCreateParams Gfx::CEngine::m_defaultTexParams
protected

Default texture create params.

TextureCreateParams Gfx::CEngine::m_terrainTexParams
protected

Create params for terrain textures.

int Gfx::CEngine::m_textureMipmapLevel
protected

Requested texture mipmap level.

int Gfx::CEngine::m_textureAnisotropy
protected

Requested texture anisotropy level.

bool Gfx::CEngine::m_shadowMapping
protected

true if shadow mapping enabled

bool Gfx::CEngine::m_offscreenShadowRendering
protected

true enables offscreen shadow rendering

int Gfx::CEngine::m_offscreenShadowRenderingResolution
protected

Offscreen shadow rendering resolution.

bool Gfx::CEngine::m_qualityShadows
protected

true enables higher quality shadows

bool Gfx::CEngine::m_terrainShadows
protected

true enables casting shadows by terrain

float Gfx::CEngine::m_shadowColor
protected

Shadow color.

float Gfx::CEngine::m_shadowRange
protected

Shadow range.

int Gfx::CEngine::m_multisample
protected

Number of samples for multisample rendering.

std::map<std::string, Texture> Gfx::CEngine::m_texNameMap
protected

Map of loaded textures (by name)

std::map<Texture, std::string> Gfx::CEngine::m_revTexNameMap
protected

Reverse map of loaded textures (by texture)

std::set<std::string> Gfx::CEngine::m_texBlacklist
protected

Blacklist map of textures.

Textures on this list were not successful in first loading, so are disabled for subsequent load calls.

Texture Gfx::CEngine::m_miceTexture
protected

Texture with mouse cursors.

EngineMouseType Gfx::CEngine::m_mouseType
protected

Type of mouse cursor.

int Gfx::CEngine::m_lastState
protected

Last engine render state (-1 at the beginning of frame)

Color Gfx::CEngine::m_lastColor
protected

Last color set with render state.

std::string Gfx::CEngine::m_lastTexture[2]
protected

Last texture names for 2 used texture stages.

Material Gfx::CEngine::m_lastMaterial
protected

Last material.

bool Gfx::CEngine::m_interfaceMode
protected

True when drawing 2D UI.

bool Gfx::CEngine::m_pause = false
protected

Pause the animation updates.

bool Gfx::CEngine::m_worldCaptured = false
protected

true means that current 3D scene was captured and is not to be rendered again

bool Gfx::CEngine::m_captureWorld = false
protected

true means that currently rendered world is to be captured

Texture Gfx::CEngine::m_capturedWorldTexture
protected

Texture with captured 3D world.


The documentation for this class was generated from the following files: