From ebed57aa22b772211387a5561f995eee8f5faed1 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 26 Jun 2012 22:23:05 +0200 Subject: Whitespace and language change - changed tabs to spaces and DOS line endings to Unix (except in CBot and metafile) - changed language to English - fixed #include in d3dengine.h --- src/graphics/common/camera.h | 378 ++++++------- src/graphics/common/cloud.h | 74 +-- src/graphics/common/color.h | 12 +- src/graphics/common/device.cpp | 16 +- src/graphics/common/device.h | 36 +- src/graphics/common/engine.cpp | 52 +- src/graphics/common/engine.h | 1122 +++++++++++++++++++-------------------- src/graphics/common/light.h | 104 ++-- src/graphics/common/lightning.h | 60 +-- src/graphics/common/material.h | 12 +- src/graphics/common/model.h | 198 +++---- src/graphics/common/modfile.h | 114 ++-- src/graphics/common/particle.h | 506 +++++++++--------- src/graphics/common/planet.h | 54 +- src/graphics/common/pyro.h | 202 +++---- src/graphics/common/terrain.h | 270 +++++----- src/graphics/common/text.h | 82 +-- src/graphics/common/vertex.h | 26 +- src/graphics/common/water.h | 130 ++--- 19 files changed, 1724 insertions(+), 1724 deletions(-) (limited to 'src/graphics/common') diff --git a/src/graphics/common/camera.h b/src/graphics/common/camera.h index 28397b9..f17ecef 100644 --- a/src/graphics/common/camera.h +++ b/src/graphics/common/camera.h @@ -34,238 +34,238 @@ namespace Gfx { enum CameraType { - CAMERA_NULL = 0, // camera undefined - CAMERA_FREE = 1, // camera free (never in principle) - CAMERA_EDIT = 2, // camera while editing a program - CAMERA_ONBOARD = 3, // camera on board a robot - CAMERA_BACK = 4, // camera behind a robot - CAMERA_FIX = 5, // static camera following robot - CAMERA_EXPLO = 6, // camera steady after explosion - CAMERA_SCRIPT = 7, // camera during a film script - CAMERA_INFO = 8, // camera for displaying information - CAMERA_VISIT = 9, // visit instead of an error - CAMERA_DIALOG = 10, // camera for dialogue - CAMERA_PLANE = 11, // static camera height + CAMERA_NULL = 0, // camera undefined + CAMERA_FREE = 1, // camera free (never in principle) + CAMERA_EDIT = 2, // camera while editing a program + CAMERA_ONBOARD = 3, // camera on board a robot + CAMERA_BACK = 4, // camera behind a robot + CAMERA_FIX = 5, // static camera following robot + CAMERA_EXPLO = 6, // camera steady after explosion + CAMERA_SCRIPT = 7, // camera during a film script + CAMERA_INFO = 8, // camera for displaying information + CAMERA_VISIT = 9, // visit instead of an error + CAMERA_DIALOG = 10, // camera for dialogue + CAMERA_PLANE = 11, // static camera height }; enum CameraSmooth { - CS_NONE = 0, // sharp - CS_NORM = 1, // normal - CS_HARD = 2, // hard - CS_SPEC = 3, // special + CS_NONE = 0, // sharp + CS_NORM = 1, // normal + CS_HARD = 2, // hard + CS_SPEC = 3, // special }; enum CenteringPhase { - CP_NULL = 0, - CP_START = 1, - CP_WAIT = 2, - CP_STOP = 3, + CP_NULL = 0, + CP_START = 1, + CP_WAIT = 2, + CP_STOP = 3, }; enum CameraEffect { - CE_NULL = 0, // no effect - CE_TERRAFORM = 1, // digging in - CE_CRASH = 2, // Vehicle driving is severely - CE_EXPLO = 3, // explosion - CE_SHOT = 4, // not mortal shot - CE_VIBRATION = 5, // vibration during construction - CE_PET = 6, // spleen reactor + CE_NULL = 0, // no effect + CE_TERRAFORM = 1, // digging in + CE_CRASH = 2, // Vehicle driving is severely + CE_EXPLO = 3, // explosion + CE_SHOT = 4, // not mortal shot + CE_VIBRATION = 5, // vibration during construction + CE_PET = 6, // spleen reactor }; enum OverEffect { - OE_NULL = 0, // no effect - OE_BLOOD = 1, // flash red - OE_FADEINw = 2, // white -> nothing - OE_FADEOUTw = 3, // nothing -> white - OE_FADEOUTb = 4, // nothing -> blue - OE_BLITZ = 5, // lightning + OE_NULL = 0, // no effect + OE_BLOOD = 1, // flash red + OE_FADEINw = 2, // white -> nothing + OE_FADEOUTw = 3, // nothing -> white + OE_FADEOUTb = 4, // nothing -> blue + OE_BLITZ = 5, // lightning }; class CCamera { - public: - CCamera(CInstanceManager* iMan); - ~CCamera(); + public: + CCamera(CInstanceManager* iMan); + ~CCamera(); - bool EventProcess(const Event &event); + bool EventProcess(const Event &event); - void Init(Math::Vector eye, Math::Vector lookat, float delay); + void Init(Math::Vector eye, Math::Vector lookat, float delay); - void SetObject(CObject* object); - CObject* RetObject(); + void SetObject(CObject* object); + CObject* RetObject(); - void SetType(CameraType type); - CameraType RetType(); + void SetType(CameraType type); + CameraType RetType(); - void SetSmooth(CameraSmooth type); - CameraSmooth RetSmoth(); + void SetSmooth(CameraSmooth type); + CameraSmooth RetSmoth(); - void SetDist(float dist); - float RetDist(); + void SetDist(float dist); + float RetDist(); - void SetFixDirection(float angle); - float RetFixDirection(); + void SetFixDirection(float angle); + float RetFixDirection(); - void SetRemotePan(float value); - float RetRemotePan(); + void SetRemotePan(float value); + float RetRemotePan(); - void SetRemoteZoom(float value); - float RetRemoteZoom(); + void SetRemoteZoom(float value); + float RetRemoteZoom(); - void StartVisit(Math::Vector goal, float dist); - void StopVisit(); + void StartVisit(Math::Vector goal, float dist); + void StopVisit(); - void RetCamera(Math::Vector &eye, Math::Vector &lookat); + void RetCamera(Math::Vector &eye, Math::Vector &lookat); - bool StartCentering(CObject *object, float angleH, float angleV, float dist, float time); - bool StopCentering(CObject *object, float time); - void AbortCentering(); + bool StartCentering(CObject *object, float angleH, float angleV, float dist, float time); + bool StopCentering(CObject *object, float time); + void AbortCentering(); - void FlushEffect(); - void StartEffect(CameraEffect effect, Math::Vector pos, float force); + void FlushEffect(); + void StartEffect(CameraEffect effect, Math::Vector pos, float force); - void FlushOver(); - void SetOverBaseColor(Gfx::Color color); - void StartOver(OverEffect effect, Math::Vector pos, float force); + void FlushOver(); + void SetOverBaseColor(Gfx::Color color); + void StartOver(OverEffect effect, Math::Vector pos, float force); - void FixCamera(); - void SetScriptEye(Math::Vector eye); - void SetScriptLookat(Math::Vector lookat); + void FixCamera(); + void SetScriptEye(Math::Vector eye); + void SetScriptLookat(Math::Vector lookat); - void SetEffect(bool bEnable); - void SetCameraScroll(bool bScroll); - void SetCameraInvertX(bool bInvert); - void SetCameraInvertY(bool bInvert); + void SetEffect(bool bEnable); + void SetCameraScroll(bool bScroll); + void SetCameraInvertX(bool bInvert); + void SetCameraInvertY(bool bInvert); - float RetMotorTurn(); - Gfx::MouseType RetMouseDef(Math::Point pos); + float RetMotorTurn(); + Gfx::MouseType RetMouseDef(Math::Point pos); protected: - bool EventMouseMove(const Event &event); - void EventMouseWheel(int dir); - bool EventFrame(const Event &event); - bool EventFrameFree(const Event &event); - bool EventFrameEdit(const Event &event); - bool EventFrameDialog(const Event &event); - bool EventFrameBack(const Event &event); - bool EventFrameFix(const Event &event); - bool EventFrameExplo(const Event &event); - bool EventFrameOnBoard(const Event &event); - bool EventFrameInfo(const Event &event); - bool EventFrameVisit(const Event &event); - bool EventFrameScript(const Event &event); - - void SetViewTime(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, float rTime); - bool IsCollision(Math::Vector &eye, Math::Vector lookat); - bool IsCollisionBack(Math::Vector &eye, Math::Vector lookat); - bool IsCollisionFix(Math::Vector &eye, Math::Vector lookat); - - Math::Vector ExcludeTerrain(Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV); - Math::Vector ExcludeObject(Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV); - - void SetViewParams(const Math::Vector &eye, const Math::Vector &lookat, const Math::Vector &up); - void EffectFrame(const Event &event); - void OverFrame(const Event &event); + bool EventMouseMove(const Event &event); + void EventMouseWheel(int dir); + bool EventFrame(const Event &event); + bool EventFrameFree(const Event &event); + bool EventFrameEdit(const Event &event); + bool EventFrameDialog(const Event &event); + bool EventFrameBack(const Event &event); + bool EventFrameFix(const Event &event); + bool EventFrameExplo(const Event &event); + bool EventFrameOnBoard(const Event &event); + bool EventFrameInfo(const Event &event); + bool EventFrameVisit(const Event &event); + bool EventFrameScript(const Event &event); + + void SetViewTime(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, float rTime); + bool IsCollision(Math::Vector &eye, Math::Vector lookat); + bool IsCollisionBack(Math::Vector &eye, Math::Vector lookat); + bool IsCollisionFix(Math::Vector &eye, Math::Vector lookat); + + Math::Vector ExcludeTerrain(Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV); + Math::Vector ExcludeObject(Math::Vector eye, Math::Vector lookat, float &angleH, float &angleV); + + void SetViewParams(const Math::Vector &eye, const Math::Vector &lookat, const Math::Vector &up); + void EffectFrame(const Event &event); + void OverFrame(const Event &event); protected: - CInstanceManager* m_iMan; - Gfx::CEngine* m_engine; - CTerrain* m_terrain; - CWater* m_water; - - CameraType m_type; // the type of camera (CAMERA *) - CameraSmooth m_smooth; // type of smoothing - CObject* m_cameraObj; // object linked to the camera - - float m_eyeDistance; // distance between the eyes - float m_initDelay; // time of initial centering - - Math::Vector m_actualEye; // current eye - Math::Vector m_actualLookat; // aim current - Math::Vector m_finalEye; // final eye - Math::Vector m_finalLookat; // aim final - Math::Vector m_normEye; // normal eye - Math::Vector m_normLookat; // aim normal - float m_focus; - - bool m_bRightDown; - Math::Point m_rightPosInit; - Math::Point m_rightPosCenter; - Math::Point m_rightPosMove; - - Math::Vector m_eyePt; // CAMERA_FREE: eye - float m_directionH; // CAMERA_FREE: horizontal direction - float m_directionV; // CAMERA_FREE: vertical direction - float m_heightEye; // CAMERA_FREE: height above the ground - float m_heightLookat; // CAMERA_FREE: height above the ground - float m_speed; // CAMERA_FREE: speed of movement - - float m_backDist; // CAMERA_BACK: distance - float m_backMin; // CAMERA_BACK: distance minimal - float m_addDirectionH; // CAMERA_BACK: additional direction - float m_addDirectionV; // CAMERA_BACK: additional direction - bool m_bTransparency; - - float m_fixDist; // CAMERA_FIX: distance - float m_fixDirectionH; // CAMERA_FIX: direction - float m_fixDirectionV; // CAMERA_FIX: direction - - Math::Vector m_visitGoal; // CAMERA_VISIT: target position - float m_visitDist; // CAMERA_VISIT: distance - float m_visitTime; // CAMERA_VISIT: relative time - CameraType m_visitType; // CAMERA_VISIT: initial type - float m_visitDirectionH; // CAMERA_VISIT: direction - float m_visitDirectionV; // CAMERA_VISIT: direction - - float m_editHeight; // CAMERA_EDIT: height - - float m_remotePan; - float m_remoteZoom; - - Math::Point m_mousePos; - float m_mouseDirH; - float m_mouseDirV; - float m_mouseMarging; - - float m_motorTurn; - - CenteringPhase m_centeringPhase; - float m_centeringAngleH; - float m_centeringAngleV; - float m_centeringDist; - float m_centeringCurrentH; - float m_centeringCurrentV; - float m_centeringTime; - float m_centeringProgress; - - CameraEffect m_effectType; - Math::Vector m_effectPos; - float m_effectForce; - float m_effectProgress; - Math::Vector m_effectOffset; - - OverEffect m_overType; - float m_overForce; - float m_overTime; - Gfx::Color m_overColorBase; - Gfx::Color m_overColor; - int m_overMode; - float m_overFadeIn; - float m_overFadeOut; - - Math::Vector m_scriptEye; - Math::Vector m_scriptLookat; - - bool m_bEffect; // shocks if explosion? - bool m_bCameraScroll; // scroll in the edges? - bool m_bCameraInvertX; // X inversion in the edges? - bool m_bCameraInvertY; // Y inversion in the edges? + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + CTerrain* m_terrain; + CWater* m_water; + + CameraType m_type; // the type of camera (CAMERA *) + CameraSmooth m_smooth; // type of smoothing + CObject* m_cameraObj; // object linked to the camera + + float m_eyeDistance; // distance between the eyes + float m_initDelay; // time of initial centering + + Math::Vector m_actualEye; // current eye + Math::Vector m_actualLookat; // aim current + Math::Vector m_finalEye; // final eye + Math::Vector m_finalLookat; // aim final + Math::Vector m_normEye; // normal eye + Math::Vector m_normLookat; // aim normal + float m_focus; + + bool m_bRightDown; + Math::Point m_rightPosInit; + Math::Point m_rightPosCenter; + Math::Point m_rightPosMove; + + Math::Vector m_eyePt; // CAMERA_FREE: eye + float m_directionH; // CAMERA_FREE: horizontal direction + float m_directionV; // CAMERA_FREE: vertical direction + float m_heightEye; // CAMERA_FREE: height above the ground + float m_heightLookat; // CAMERA_FREE: height above the ground + float m_speed; // CAMERA_FREE: speed of movement + + float m_backDist; // CAMERA_BACK: distance + float m_backMin; // CAMERA_BACK: distance minimal + float m_addDirectionH; // CAMERA_BACK: additional direction + float m_addDirectionV; // CAMERA_BACK: additional direction + bool m_bTransparency; + + float m_fixDist; // CAMERA_FIX: distance + float m_fixDirectionH; // CAMERA_FIX: direction + float m_fixDirectionV; // CAMERA_FIX: direction + + Math::Vector m_visitGoal; // CAMERA_VISIT: target position + float m_visitDist; // CAMERA_VISIT: distance + float m_visitTime; // CAMERA_VISIT: relative time + CameraType m_visitType; // CAMERA_VISIT: initial type + float m_visitDirectionH; // CAMERA_VISIT: direction + float m_visitDirectionV; // CAMERA_VISIT: direction + + float m_editHeight; // CAMERA_EDIT: height + + float m_remotePan; + float m_remoteZoom; + + Math::Point m_mousePos; + float m_mouseDirH; + float m_mouseDirV; + float m_mouseMarging; + + float m_motorTurn; + + CenteringPhase m_centeringPhase; + float m_centeringAngleH; + float m_centeringAngleV; + float m_centeringDist; + float m_centeringCurrentH; + float m_centeringCurrentV; + float m_centeringTime; + float m_centeringProgress; + + CameraEffect m_effectType; + Math::Vector m_effectPos; + float m_effectForce; + float m_effectProgress; + Math::Vector m_effectOffset; + + OverEffect m_overType; + float m_overForce; + float m_overTime; + Gfx::Color m_overColorBase; + Gfx::Color m_overColor; + int m_overMode; + float m_overFadeIn; + float m_overFadeOut; + + Math::Vector m_scriptEye; + Math::Vector m_scriptLookat; + + bool m_bEffect; // shocks if explosion? + bool m_bCameraScroll; // scroll in the edges? + bool m_bCameraInvertX; // X inversion in the edges? + bool m_bCameraInvertY; // Y inversion in the edges? }; diff --git a/src/graphics/common/cloud.h b/src/graphics/common/cloud.h index 9ca8c11..19b689f 100644 --- a/src/graphics/common/cloud.h +++ b/src/graphics/common/cloud.h @@ -38,56 +38,56 @@ const short MAXCLOUDLINE = 100; struct CloudLine { - short x, y; // beginning - short len; // in length x - float px1, px2, pz; + short x, y; // beginning + short len; // in length x + float px1, px2, pz; }; class CCloud { public: - CCloud(CInstanceManager* iMan, CEngine* engine); - ~CCloud(); + CCloud(CInstanceManager* iMan, CEngine* engine); + ~CCloud(); - bool EventProcess(const Event &event); - void Flush(); - bool Create(const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level); - void Draw(); + bool EventProcess(const Event &event); + void Flush(); + bool Create(const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level); + void Draw(); - bool SetLevel(float level); - float RetLevel(); + bool SetLevel(float level); + float RetLevel(); - void SetEnable(bool bEnable); - bool RetEnable(); + void SetEnable(bool bEnable); + bool RetEnable(); protected: - bool EventFrame(const Event &event); - void AdjustLevel(Math::Vector &pos, Math::Vector &eye, float deep, Math::Point &uv1, Math::Point &uv2); - bool CreateLine(int x, int y, int len); + bool EventFrame(const Event &event); + void AdjustLevel(Math::Vector &pos, Math::Vector &eye, float deep, Math::Point &uv1, Math::Point &uv2); + bool CreateLine(int x, int y, int len); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CTerrain* m_terrain; - - char m_filename[100]; - float m_level; // overall level - Math::Point m_speed; // feedrate (wind) - Gfx::Color m_diffuse; // diffuse color - Gfx::Color m_ambient; // ambient color - float m_time; - float m_lastTest; - int m_subdiv; - - Math::Vector m_wind; // wind speed - int m_brick; // brick mosaic - float m_size; // size of a brick element - - int m_lineUsed; - CloudLine m_line[MAXCLOUDLINE]; - - bool m_bEnable; + CInstanceManager* m_iMan; + CEngine* m_engine; + CTerrain* m_terrain; + + char m_filename[100]; + float m_level; // overall level + Math::Point m_speed; // feedrate (wind) + Gfx::Color m_diffuse; // diffuse color + Gfx::Color m_ambient; // ambient color + float m_time; + float m_lastTest; + int m_subdiv; + + Math::Vector m_wind; // wind speed + int m_brick; // brick mosaic + float m_size; // size of a brick element + + int m_lineUsed; + CloudLine m_line[MAXCLOUDLINE]; + + bool m_bEnable; }; diff --git a/src/graphics/common/color.h b/src/graphics/common/color.h index 146e515..12f008f 100644 --- a/src/graphics/common/color.h +++ b/src/graphics/common/color.h @@ -23,19 +23,19 @@ namespace Gfx { struct Color { - float r, g, b, a; + float r, g, b, a; - Color(float aR = 0.0f, float aG = 0.0f, float aB = 0.0f, float aA = 0.0f) - : r(aR), g(aG), b(aB), a(aA) {} + Color(float aR = 0.0f, float aG = 0.0f, float aB = 0.0f, float aA = 0.0f) + : r(aR), g(aG), b(aB), a(aA) {} }; struct ColorHSV { - float h, s, v; + float h, s, v; - ColorHSV(float aH = 0.0f, float aS = 0.0f, float aV = 0.0f) - : h(aH), s(aS), v(aV) {} + ColorHSV(float aH = 0.0f, float aS = 0.0f, float aV = 0.0f) + : h(aH), s(aS), v(aV) {} }; diff --git a/src/graphics/common/device.cpp b/src/graphics/common/device.cpp index 2e3db61..53274b3 100644 --- a/src/graphics/common/device.cpp +++ b/src/graphics/common/device.cpp @@ -3,12 +3,12 @@ //! Sets the default values Gfx::DeviceConfig::DeviceConfig() { - width = 800; - height = 600; - bpp = 16; - fullScreen = false; - resizeable = false; - hardwareAccel = true; - doubleBuf = true; - noFrame = false; + width = 800; + height = 600; + bpp = 16; + fullScreen = false; + resizeable = false; + hardwareAccel = true; + doubleBuf = true; + noFrame = false; } \ No newline at end of file diff --git a/src/graphics/common/device.h b/src/graphics/common/device.h index cd52fa5..5900570 100644 --- a/src/graphics/common/device.h +++ b/src/graphics/common/device.h @@ -24,24 +24,24 @@ namespace Gfx { struct DeviceConfig { - //! Screen width - int width; - //! Screen height - int height; - //! Bits per pixel - int bpp; - //! Full screen - bool fullScreen; - //! Resizeable window - bool resizeable; - //! Hardware acceleration - bool hardwareAccel; - //! Double buffering - bool doubleBuf; - //! No window frame (also set with full screen) - bool noFrame; - - DeviceConfig(); + //! Screen width + int width; + //! Screen height + int height; + //! Bits per pixel + int bpp; + //! Full screen + bool fullScreen; + //! Resizeable window + bool resizeable; + //! Hardware acceleration + bool hardwareAccel; + //! Double buffering + bool doubleBuf; + //! No window frame (also set with full screen) + bool noFrame; + + DeviceConfig(); }; class CDevice diff --git a/src/graphics/common/engine.cpp b/src/graphics/common/engine.cpp index 29857ce..3b9a89d 100644 --- a/src/graphics/common/engine.cpp +++ b/src/graphics/common/engine.cpp @@ -27,47 +27,47 @@ Gfx::CEngine::CEngine(CInstanceManager *iMan, CApplication *app) { - // TODO + // TODO } Gfx::CEngine::~CEngine() { - // TODO + // TODO } int Gfx::CEngine::Render() { - /* Just a hello world for now */ + /* Just a hello world for now */ - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glShadeModel(GL_SMOOTH); - glDisable(GL_DEPTH_TEST); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluOrtho2D(-10.0f, 10.0f, -10.0f, 10.0f); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D(-10.0f, 10.0f, -10.0f, 10.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - //glTranslatef(0.0f, 0.0f, -6.0f); + //glTranslatef(0.0f, 0.0f, -6.0f); - glBegin(GL_TRIANGLES); - { - glColor3f(1.0f, 0.0f, 0.0f); - glVertex2f(-2.0f, -1.0f); - glColor3f(0.0f, 1.0f, 0.0f); - glVertex2f(2.0f, -1.0f); - glColor3f(0.0f, 0.0f, 1.0f); - glVertex2f(0.0f, 1.5f); - } - glEnd(); + glBegin(GL_TRIANGLES); + { + glColor3f(1.0f, 0.0f, 0.0f); + glVertex2f(-2.0f, -1.0f); + glColor3f(0.0f, 1.0f, 0.0f); + glVertex2f(2.0f, -1.0f); + glColor3f(0.0f, 0.0f, 1.0f); + glVertex2f(0.0f, 1.5f); + } + glEnd(); - glFlush(); + glFlush(); - return 1; + return 1; } diff --git a/src/graphics/common/engine.h b/src/graphics/common/engine.h index fd99399..6d2937c 100644 --- a/src/graphics/common/engine.h +++ b/src/graphics/common/engine.h @@ -48,237 +48,237 @@ class CPlanet; class CTerrain; -//const int MAXOBJECT = 1200; -//const int MAXSHADOW = 500; -//const int MAXGROUNDSPOT = 100; +//const int MAXOBJECT = 1200; +//const int MAXSHADOW = 500; +//const int MAXGROUNDSPOT = 100; enum ObjectType { - //! Object doesn't exist - OBJTYPE_NULL = 0, - //! Terrain - OBJTYPE_TERRAIN = 1, - //! Fixed object - OBJTYPE_FIX = 2, - //! Moving object - OBJTYPE_VEHICULE = 3, - //! Part of a moving object - OBJTYPE_DESCENDANT = 4, - //! Fixed object type quartz - OBJTYPE_QUARTZ = 5, - //! Fixed object type metal - OBJTYPE_METAL = 6 + //! Object doesn't exist + OBJTYPE_NULL = 0, + //! Terrain + OBJTYPE_TERRAIN = 1, + //! Fixed object + OBJTYPE_FIX = 2, + //! Moving object + OBJTYPE_VEHICULE = 3, + //! Part of a moving object + OBJTYPE_DESCENDANT = 4, + //! Fixed object type quartz + OBJTYPE_QUARTZ = 5, + //! Fixed object type metal + OBJTYPE_METAL = 6 }; enum TriangleType { - //! triangles - TRIANGLE_TYPE_6T = 1, - //! surfaces - TRIANGLE_TYPE_6S = 2 + //! triangles + TRIANGLE_TYPE_6T = 1, + //! surfaces + TRIANGLE_TYPE_6S = 2 }; enum Mapping { - MAPPING_X = 1, - MAPPING_Y = 2, - MAPPING_Z = 3, - MAPPING_1X = 4, - MAPPING_1Y = 5, - MAPPING_1Z = 6 + MAPPING_X = 1, + MAPPING_Y = 2, + MAPPING_Z = 3, + MAPPING_1X = 4, + MAPPING_1Y = 5, + MAPPING_1Z = 6 }; enum MouseType { - MOUSE_HIDE = 0, // no mouse - MOUSE_NORM = 1, - MOUSE_WAIT = 2, - MOUSE_EDIT = 3, - MOUSE_HAND = 4, - MOUSE_CROSS = 5, - MOUSE_SHOW = 6, - MOUSE_NO = 7, - MOUSE_MOVE = 8, // + - MOUSE_MOVEH = 9, // - - MOUSE_MOVEV = 10, // | - MOUSE_MOVED = 11, // / - MOUSE_MOVEI = 12, // \ // - MOUSE_SCROLLL = 13, // << - MOUSE_SCROLLR = 14, // >> - MOUSE_SCROLLU = 15, // ^ - MOUSE_SCROLLD = 16, // v - MOUSE_TARGET = 17 + MOUSE_HIDE = 0, // no mouse + MOUSE_NORM = 1, + MOUSE_WAIT = 2, + MOUSE_EDIT = 3, + MOUSE_HAND = 4, + MOUSE_CROSS = 5, + MOUSE_SHOW = 6, + MOUSE_NO = 7, + MOUSE_MOVE = 8, // + + MOUSE_MOVEH = 9, // - + MOUSE_MOVEV = 10, // | + MOUSE_MOVED = 11, // / + MOUSE_MOVEI = 12, // \ // + MOUSE_SCROLLL = 13, // << + MOUSE_SCROLLR = 14, // >> + MOUSE_SCROLLU = 15, // ^ + MOUSE_SCROLLD = 16, // v + MOUSE_TARGET = 17 }; enum ShadowType { - SHADOW_NORM = 0, - SHADOW_WORM = 1 + SHADOW_NORM = 0, + SHADOW_WORM = 1 }; enum RenderState { - //! Normal opaque materials - RSTATE_NORMAL = 0, - //! The transparent texture (black = no) - RSTATE_TTEXTURE_BLACK = (1<<0), - //! The transparent texture (white = no) - RSTATE_TTEXTURE_WHITE = (1<<1), - //! The transparent diffuse color - RSTATE_TDIFFUSE = (1<<2), - //! Texture wrap - RSTATE_WRAP = (1<<3), - //! Texture borders with solid color - RSTATE_CLAMP = (1<<4), - //! Light texture (ambient max) - RSTATE_LIGHT = (1<<5), - //! Double black texturing - RSTATE_DUAL_BLACK = (1<<6), - //! Double white texturing - RSTATE_DUAL_WHITE = (1<<7), - //! Part 1 (no change in. MOD!) - RSTATE_PART1 = (1<<8), - //! Part 2 - RSTATE_PART2 = (1<<9), - //! Part 3 - RSTATE_PART3 = (1<<10), - //! Part 4 - RSTATE_PART4 = (1<<11), - //! Double-sided face - RSTATE_2FACE = (1<<12), - //! Image using alpha channel - RSTATE_ALPHA = (1<<13), - //! Always use 2nd floor texturing - RSTATE_SECOND = (1<<14), - //! Causes the fog - RSTATE_FOG = (1<<15), - //! The transparent color (black = no) - RSTATE_TCOLOR_BLACK = (1<<16), - //! The transparent color (white = no) - RSTATE_TCOLOR_WHITE = (1<<17) + //! Normal opaque materials + RSTATE_NORMAL = 0, + //! The transparent texture (black = no) + RSTATE_TTEXTURE_BLACK = (1<<0), + //! The transparent texture (white = no) + RSTATE_TTEXTURE_WHITE = (1<<1), + //! The transparent diffuse color + RSTATE_TDIFFUSE = (1<<2), + //! Texture wrap + RSTATE_WRAP = (1<<3), + //! Texture borders with solid color + RSTATE_CLAMP = (1<<4), + //! Light texture (ambient max) + RSTATE_LIGHT = (1<<5), + //! Double black texturing + RSTATE_DUAL_BLACK = (1<<6), + //! Double white texturing + RSTATE_DUAL_WHITE = (1<<7), + //! Part 1 (no change in. MOD!) + RSTATE_PART1 = (1<<8), + //! Part 2 + RSTATE_PART2 = (1<<9), + //! Part 3 + RSTATE_PART3 = (1<<10), + //! Part 4 + RSTATE_PART4 = (1<<11), + //! Double-sided face + RSTATE_2FACE = (1<<12), + //! Image using alpha channel + RSTATE_ALPHA = (1<<13), + //! Always use 2nd floor texturing + RSTATE_SECOND = (1<<14), + //! Causes the fog + RSTATE_FOG = (1<<15), + //! The transparent color (black = no) + RSTATE_TCOLOR_BLACK = (1<<16), + //! The transparent color (white = no) + RSTATE_TCOLOR_WHITE = (1<<17) }; struct Triangle { - Gfx::VertexTex2 triangle[3]; - Gfx::Material material; - int state; - char texName1[20]; - char texName2[20]; + Gfx::VertexTex2 triangle[3]; + Gfx::Material material; + int state; + char texName1[20]; + char texName2[20]; }; struct ObjLevel6 { - int totalPossible; - int totalUsed; - Gfx::Material material; - int state; - Gfx::TriangleType type; - Gfx::VertexTex2 vertex[1]; + int totalPossible; + int totalUsed; + Gfx::Material material; + int state; + Gfx::TriangleType type; + Gfx::VertexTex2 vertex[1]; }; struct ObjLevel5 { - int totalPossible; - int totalUsed; - int reserve; - Gfx::ObjLevel6* table[1]; + int totalPossible; + int totalUsed; + int reserve; + Gfx::ObjLevel6* table[1]; }; struct ObjLevel4 { - int totalPossible; - int totalUsed; - float min, max; - Gfx::ObjLevel5* table[1]; + int totalPossible; + int totalUsed; + float min, max; + Gfx::ObjLevel5* table[1]; }; struct ObjLevel3 { - int totalPossible; - int totalUsed; - int objRank; - Gfx::ObjLevel4* table[1]; + int totalPossible; + int totalUsed; + int objRank; + Gfx::ObjLevel4* table[1]; }; struct ObjLevel2 { - int totalPossible; - int totalUsed; - char texName1[20]; - char texName2[20]; - Gfx::ObjLevel3* table[1]; + int totalPossible; + int totalUsed; + char texName1[20]; + char texName2[20]; + Gfx::ObjLevel3* table[1]; }; struct ObjLevel1 { - int totalPossible; - int totalUsed; - Gfx::ObjLevel2* table[1]; + int totalPossible; + int totalUsed; + Gfx::ObjLevel2* table[1]; }; struct Object { - bool used; // true -> object exists - bool visible; // true -> visible object - bool drawWorld; // true -> shape behind the interface - bool drawFront; // true -> shape before the interface - int totalTriangle; // number of triangles used - Gfx::ObjectType type; // type of the object (TYPE*) - Math::Matrix transform; // transformation matrix - float distance; // distance point of view - original - Math::Vector bboxMin; // bounding box of the object - Math::Vector bboxMax; // (the origin 0, 0, 0 is always included) - float radius; // radius of the sphere at the origin - int shadowRank; // rank of the associated shadow - float transparency; // transparency of the object (0 .. 1) + bool used; // true -> object exists + bool visible; // true -> visible object + bool drawWorld; // true -> shape behind the interface + bool drawFront; // true -> shape before the interface + int totalTriangle; // number of triangles used + Gfx::ObjectType type; // type of the object (TYPE*) + Math::Matrix transform; // transformation matrix + float distance; // distance point of view - original + Math::Vector bboxMin; // bounding box of the object + Math::Vector bboxMax; // (the origin 0, 0, 0 is always included) + float radius; // radius of the sphere at the origin + int shadowRank; // rank of the associated shadow + float transparency; // transparency of the object (0 .. 1) }; struct Shadow { - bool used; // true -> object exists - bool hide; // true -> invisible shadow (object carried by ex.) - int objRank; // rank of the object - Gfx::ShadowType type; // type of shadow - Math::Vector pos; // position for the shadow - Math::Vector normal; // normal terrain - float angle; // angle of the shadow - float radius; // radius of the shadow - float intensity; // intensity of the shadow - float height; // height from the ground + bool used; // true -> object exists + bool hide; // true -> invisible shadow (object carried by ex.) + int objRank; // rank of the object + Gfx::ShadowType type; // type of shadow + Math::Vector pos; // position for the shadow + Math::Vector normal; // normal terrain + float angle; // angle of the shadow + float radius; // radius of the shadow + float intensity; // intensity of the shadow + float height; // height from the ground }; struct GroundSpot { - bool used; // true -> object exists - Gfx::Color color; // color of the shadow - float min, max; // altitudes min / max - float smooth; // transition area - Math::Vector pos; // position for the shadow - float radius; // radius of the shadow - Math::Vector drawPos; // drawn to position the shade - float drawRadius; // radius of the shadow drawn + bool used; // true -> object exists + Gfx::Color color; // color of the shadow + float min, max; // altitudes min / max + float smooth; // transition area + Math::Vector pos; // position for the shadow + float radius; // radius of the shadow + Math::Vector drawPos; // drawn to position the shade + float drawRadius; // radius of the shadow drawn }; struct GroundMark { - bool used; // true -> object exists - bool draw; // true -> drawn mark - int phase; // 1 = increase, 2 = fixed, 3 = decrease - float delay[3]; // time for 3 phases - float fix; // fixed time - Math::Vector pos; // position for marks - float radius; // radius of marks - float intensity; // color intensity - Math::Vector drawPos; // drawn in position marks - float drawRadius; // radius marks drawn - float drawIntensity; // current drawn - int dx, dy; // dimensions table - char* table; // pointer to the table + bool used; // true -> object exists + bool draw; // true -> drawn mark + int phase; // 1 = increase, 2 = fixed, 3 = decrease + float delay[3]; // time for 3 phases + float fix; // fixed time + Math::Vector pos; // position for marks + float radius; // radius of marks + float intensity; // color intensity + Math::Vector drawPos; // drawn in position marks + float drawRadius; // radius marks drawn + float drawIntensity; // current drawn + int dx, dy; // dimensions table + char* table; // pointer to the table }; @@ -286,430 +286,430 @@ struct GroundMark class CEngine { public: - CEngine(CInstanceManager *iMan, CApplication *app); - ~CEngine(); - - void SetDevice(Gfx::CDevice *device); - Gfx::CDevice* RetDevice(); - - void SetTerrain(Gfx::CTerrain* terrain); - - bool WriteProfile(); - - void SetPause(bool pause); - bool RetPause(); - - void SetMovieLock(bool lock); - bool RetMovieLock(); - - void SetShowStat(bool show); - bool RetShowStat(); - - void SetRenderEnable(bool enable); - - int OneTimeSceneInit(); - int InitDeviceObjects(); - int DeleteDeviceObjects(); - int RestoreSurfaces(); - int Render(); - int FrameMove(float rTime); - void StepSimul(float rTime); - int FinalCleanup(); - void AddStatisticTriangle(int nb); - int RetStatisticTriangle(); - void SetHiliteRank(int *rankList); - bool GetHilite(Math::Point &p1, Math::Point &p2); - bool GetSpriteCoord(int &x, int &y); - void SetInfoText(int line, char* text); - char * RetInfoText(int line); - //LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - void FirstExecuteAdapt(bool first); - //int GetVidMemTotal(); - //bool IsVideo8MB(); - //bool IsVideo32MB(); - - bool EnumDevices(char *bufDevices, int lenDevices, char *bufModes, int lenModes, int &totalDevices, int &selectDevices, int &totalModes, int &selectModes); - bool RetFullScreen(); - bool ChangeDevice(char *device, char *mode, bool full); - - Math::Matrix* RetMatView(); - Math::Matrix* RetMatLeftView(); - Math::Matrix* RetMatRightView(); - - void TimeInit(); - void TimeEnterGel(); - void TimeExitGel(); - float TimeGet(); - - int RetRestCreate(); - int CreateObject(); - void FlushObject(); - bool DeleteObject(int objRank); - bool SetDrawWorld(int objRank, bool draw); - bool SetDrawFront(int objRank, bool draw); - bool AddTriangle(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, bool globalUpdate); - bool AddSurface(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, bool globalUpdate); - bool AddQuick(int objRank, Gfx::ObjLevel6* buffer, char* texName1, char* texName2, float min, float max, bool globalUpdate); - Gfx::ObjLevel6* SearchTriangle(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max); - void ChangeLOD(); - bool ChangeSecondTexture(int objRank, char* texName2); - int RetTotalTriangles(int objRank); - int GetTriangles(int objRank, float min, float max, Gfx::Triangle* buffer, int size, float percent); - bool GetBBox(int objRank, Math::Vector &min, Math::Vector &max); - bool ChangeTextureMapping(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, Gfx::Mapping mode, float au, float bu, float av, float bv); - bool TrackTextureMapping(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, Gfx::Mapping mode, float pos, float factor, float tl, float ts, float tt); - bool SetObjectTransform(int objRank, const Math::Matrix &transform); - bool GetObjectTransform(int objRank, Math::Matrix &transform); - bool SetObjectType(int objRank, Gfx::ObjectType type); - Gfx::ObjectType RetObjectType(int objRank); - bool SetObjectTransparency(int objRank, float value); - - bool ShadowCreate(int objRank); - void ShadowDelete(int objRank); - bool SetObjectShadowHide(int objRank, bool hide); - bool SetObjectShadowType(int objRank, Gfx::ShadowType type); - bool SetObjectShadowPos(int objRank, const Math::Vector &pos); - bool SetObjectShadowNormal(int objRank, const Math::Vector &n); - bool SetObjectShadowAngle(int objRank, float angle); - bool SetObjectShadowRadius(int objRank, float radius); - bool SetObjectShadowIntensity(int objRank, float intensity); - bool SetObjectShadowHeight(int objRank, float h); - float RetObjectShadowRadius(int objRank); - - void GroundSpotFlush(); - int GroundSpotCreate(); - void GroundSpotDelete(int rank); - bool SetObjectGroundSpotPos(int rank, const Math::Vector &pos); - bool SetObjectGroundSpotRadius(int rank, float radius); - bool SetObjectGroundSpotColor(int rank, const Gfx::Color &color); - bool SetObjectGroundSpotMinMax(int rank, float min, float max); - bool SetObjectGroundSpotSmooth(int rank, float smooth); - - int GroundMarkCreate(Math::Vector pos, float radius, float delay1, float delay2, float delay3, int dx, int dy, char* table); - bool GroundMarkDelete(int rank); - - void Update(); - - void SetViewParams(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, const Math::Vector &vUpVec, float fEyeDistance); - - bool FreeTexture(char* name); - bool LoadTexture(char* name, int stage=0); - bool LoadAllTexture(); - - void SetLimitLOD(int rank, float limit); - float RetLimitLOD(int rank, bool last=false); - - void SetTerrainVision(float vision); - - void SetGroundSpot(bool mode); - bool RetGroundSpot(); - void SetShadow(bool mode); - bool RetShadow(); - void SetDirty(bool mode); - bool RetDirty(); - void SetFog(bool mode); - bool RetFog(); - bool RetStateColor(); - - void SetSecondTexture(int texNum); - int RetSecondTexture(); - - void SetRankView(int rank); - int RetRankView(); - - void SetDrawWorld(bool draw); - void SetDrawFront(bool draw); - - void SetAmbiantColor(const Gfx::Color &color, int rank=0); - Gfx::Color RetAmbiantColor(int rank=0); - - void SetWaterAddColor(const Gfx::Color &color); - Gfx::Color RetWaterAddColor(); - - void SetFogColor(const Gfx::Color &color, int rank=0); - Gfx::Color RetFogColor(int rank=0); - - void SetDeepView(float length, int rank=0, bool ref=false); - float RetDeepView(int rank=0); - - void SetFogStart(float start, int rank=0); - float RetFogStart(int rank=0); - - void SetBackground(char *name, Gfx::Color up=Gfx::Color(), Gfx::Color down=Gfx::Color(), Gfx::Color cloudUp=Gfx::Color(), Gfx::Color cloudDown=Gfx::Color(), bool full=false, bool quarter=false); - void RetBackground(char *name, Gfx::Color &up, Gfx::Color &down, Gfx::Color &cloudUp, Gfx::Color &cloudDown, bool &full, bool &quarter); - void SetFrontsizeName(char *name); - void SetOverFront(bool front); - void SetOverColor(const Gfx::Color &color=Gfx::Color(), int mode=RSTATE_TCOLOR_BLACK); - - void SetParticuleDensity(float value); - float RetParticuleDensity(); - float ParticuleAdapt(float factor); - - void SetClippingDistance(float value); - float RetClippingDistance(); - - void SetObjectDetail(float value); - float RetObjectDetail(); - - void SetGadgetQuantity(float value); - float RetGadgetQuantity(); - - void SetTextureQuality(int value); - int RetTextureQuality(); - - void SetTotoMode(bool present); - bool RetTotoMode(); - - void SetLensMode(bool present); - bool RetLensMode(); + CEngine(CInstanceManager *iMan, CApplication *app); + ~CEngine(); + + void SetDevice(Gfx::CDevice *device); + Gfx::CDevice* RetDevice(); + + void SetTerrain(Gfx::CTerrain* terrain); + + bool WriteProfile(); + + void SetPause(bool pause); + bool RetPause(); + + void SetMovieLock(bool lock); + bool RetMovieLock(); + + void SetShowStat(bool show); + bool RetShowStat(); + + void SetRenderEnable(bool enable); + + int OneTimeSceneInit(); + int InitDeviceObjects(); + int DeleteDeviceObjects(); + int RestoreSurfaces(); + int Render(); + int FrameMove(float rTime); + void StepSimul(float rTime); + int FinalCleanup(); + void AddStatisticTriangle(int nb); + int RetStatisticTriangle(); + void SetHiliteRank(int *rankList); + bool GetHilite(Math::Point &p1, Math::Point &p2); + bool GetSpriteCoord(int &x, int &y); + void SetInfoText(int line, char* text); + char * RetInfoText(int line); + //LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + void FirstExecuteAdapt(bool first); + //int GetVidMemTotal(); + //bool IsVideo8MB(); + //bool IsVideo32MB(); + + bool EnumDevices(char *bufDevices, int lenDevices, char *bufModes, int lenModes, int &totalDevices, int &selectDevices, int &totalModes, int &selectModes); + bool RetFullScreen(); + bool ChangeDevice(char *device, char *mode, bool full); + + Math::Matrix* RetMatView(); + Math::Matrix* RetMatLeftView(); + Math::Matrix* RetMatRightView(); + + void TimeInit(); + void TimeEnterGel(); + void TimeExitGel(); + float TimeGet(); + + int RetRestCreate(); + int CreateObject(); + void FlushObject(); + bool DeleteObject(int objRank); + bool SetDrawWorld(int objRank, bool draw); + bool SetDrawFront(int objRank, bool draw); + bool AddTriangle(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, bool globalUpdate); + bool AddSurface(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, bool globalUpdate); + bool AddQuick(int objRank, Gfx::ObjLevel6* buffer, char* texName1, char* texName2, float min, float max, bool globalUpdate); + Gfx::ObjLevel6* SearchTriangle(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max); + void ChangeLOD(); + bool ChangeSecondTexture(int objRank, char* texName2); + int RetTotalTriangles(int objRank); + int GetTriangles(int objRank, float min, float max, Gfx::Triangle* buffer, int size, float percent); + bool GetBBox(int objRank, Math::Vector &min, Math::Vector &max); + bool ChangeTextureMapping(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, Gfx::Mapping mode, float au, float bu, float av, float bv); + bool TrackTextureMapping(int objRank, const Gfx::Material &mat, int state, char* texName1, char* texName2, float min, float max, Gfx::Mapping mode, float pos, float factor, float tl, float ts, float tt); + bool SetObjectTransform(int objRank, const Math::Matrix &transform); + bool GetObjectTransform(int objRank, Math::Matrix &transform); + bool SetObjectType(int objRank, Gfx::ObjectType type); + Gfx::ObjectType RetObjectType(int objRank); + bool SetObjectTransparency(int objRank, float value); + + bool ShadowCreate(int objRank); + void ShadowDelete(int objRank); + bool SetObjectShadowHide(int objRank, bool hide); + bool SetObjectShadowType(int objRank, Gfx::ShadowType type); + bool SetObjectShadowPos(int objRank, const Math::Vector &pos); + bool SetObjectShadowNormal(int objRank, const Math::Vector &n); + bool SetObjectShadowAngle(int objRank, float angle); + bool SetObjectShadowRadius(int objRank, float radius); + bool SetObjectShadowIntensity(int objRank, float intensity); + bool SetObjectShadowHeight(int objRank, float h); + float RetObjectShadowRadius(int objRank); + + void GroundSpotFlush(); + int GroundSpotCreate(); + void GroundSpotDelete(int rank); + bool SetObjectGroundSpotPos(int rank, const Math::Vector &pos); + bool SetObjectGroundSpotRadius(int rank, float radius); + bool SetObjectGroundSpotColor(int rank, const Gfx::Color &color); + bool SetObjectGroundSpotMinMax(int rank, float min, float max); + bool SetObjectGroundSpotSmooth(int rank, float smooth); + + int GroundMarkCreate(Math::Vector pos, float radius, float delay1, float delay2, float delay3, int dx, int dy, char* table); + bool GroundMarkDelete(int rank); + + void Update(); + + void SetViewParams(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, const Math::Vector &vUpVec, float fEyeDistance); + + bool FreeTexture(char* name); + bool LoadTexture(char* name, int stage=0); + bool LoadAllTexture(); + + void SetLimitLOD(int rank, float limit); + float RetLimitLOD(int rank, bool last=false); + + void SetTerrainVision(float vision); + + void SetGroundSpot(bool mode); + bool RetGroundSpot(); + void SetShadow(bool mode); + bool RetShadow(); + void SetDirty(bool mode); + bool RetDirty(); + void SetFog(bool mode); + bool RetFog(); + bool RetStateColor(); + + void SetSecondTexture(int texNum); + int RetSecondTexture(); + + void SetRankView(int rank); + int RetRankView(); + + void SetDrawWorld(bool draw); + void SetDrawFront(bool draw); + + void SetAmbiantColor(const Gfx::Color &color, int rank=0); + Gfx::Color RetAmbiantColor(int rank=0); + + void SetWaterAddColor(const Gfx::Color &color); + Gfx::Color RetWaterAddColor(); + + void SetFogColor(const Gfx::Color &color, int rank=0); + Gfx::Color RetFogColor(int rank=0); + + void SetDeepView(float length, int rank=0, bool ref=false); + float RetDeepView(int rank=0); + + void SetFogStart(float start, int rank=0); + float RetFogStart(int rank=0); + + void SetBackground(char *name, Gfx::Color up=Gfx::Color(), Gfx::Color down=Gfx::Color(), Gfx::Color cloudUp=Gfx::Color(), Gfx::Color cloudDown=Gfx::Color(), bool full=false, bool quarter=false); + void RetBackground(char *name, Gfx::Color &up, Gfx::Color &down, Gfx::Color &cloudUp, Gfx::Color &cloudDown, bool &full, bool &quarter); + void SetFrontsizeName(char *name); + void SetOverFront(bool front); + void SetOverColor(const Gfx::Color &color=Gfx::Color(), int mode=RSTATE_TCOLOR_BLACK); + + void SetParticuleDensity(float value); + float RetParticuleDensity(); + float ParticuleAdapt(float factor); + + void SetClippingDistance(float value); + float RetClippingDistance(); + + void SetObjectDetail(float value); + float RetObjectDetail(); + + void SetGadgetQuantity(float value); + float RetGadgetQuantity(); + + void SetTextureQuality(int value); + int RetTextureQuality(); + + void SetTotoMode(bool present); + bool RetTotoMode(); + + void SetLensMode(bool present); + bool RetLensMode(); - void SetWaterMode(bool present); - bool RetWaterMode(); - - void SetBlitzMode(bool present); - bool RetBlitzMode(); + void SetWaterMode(bool present); + bool RetWaterMode(); + + void SetBlitzMode(bool present); + bool RetBlitzMode(); - void SetSkyMode(bool present); - bool RetSkyMode(); + void SetSkyMode(bool present); + bool RetSkyMode(); - void SetBackForce(bool present); - bool RetBackForce(); + void SetBackForce(bool present); + bool RetBackForce(); - void SetPlanetMode(bool present); - bool RetPlanetMode(); + void SetPlanetMode(bool present); + bool RetPlanetMode(); - void SetLightMode(bool present); - bool RetLightMode(); + void SetLightMode(bool present); + bool RetLightMode(); - void SetEditIndentMode(bool auto); - bool RetEditIndentMode(); + void SetEditIndentMode(bool auto); + bool RetEditIndentMode(); - void SetEditIndentValue(int value); - int RetEditIndentValue(); + void SetEditIndentValue(int value); + int RetEditIndentValue(); - void SetSpeed(float speed); - float RetSpeed(); + void SetSpeed(float speed); + float RetSpeed(); - void SetTracePrecision(float factor); - float RetTracePrecision(); + void SetTracePrecision(float factor); + float RetTracePrecision(); - void SetFocus(float focus); - float RetFocus(); - Math::Vector RetEyePt(); - Math::Vector RetLookatPt(); - float RetEyeDirH(); - float RetEyeDirV(); - Math::Point RetDim(); - void UpdateMatProj(); + void SetFocus(float focus); + float RetFocus(); + Math::Vector RetEyePt(); + Math::Vector RetLookatPt(); + float RetEyeDirH(); + float RetEyeDirV(); + Math::Point RetDim(); + void UpdateMatProj(); - void ApplyChange(); + void ApplyChange(); - void FlushPressKey(); - void ResetKey(); - void SetKey(int keyRank, int option, int key); - int RetKey(int keyRank, int option); + void FlushPressKey(); + void ResetKey(); + void SetKey(int keyRank, int option, int key); + int RetKey(int keyRank, int option); - void SetJoystick(bool enable); - bool RetJoystick(); + void SetJoystick(bool enable); + bool RetJoystick(); - void SetDebugMode(bool mode); - bool RetDebugMode(); - bool RetSetupMode(); + void SetDebugMode(bool mode); + bool RetDebugMode(); + bool RetSetupMode(); - bool IsVisiblePoint(const Math::Vector &pos); + bool IsVisiblePoint(const Math::Vector &pos); - int DetectObject(Math::Point mouse); - void SetState(int state, Gfx::Color color=Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)); - void SetTexture(char *name, int stage=0); - void SetMaterial(const Gfx::Material &mat); + int DetectObject(Math::Point mouse); + void SetState(int state, Gfx::Color color=Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)); + void SetTexture(char *name, int stage=0); + void SetMaterial(const Gfx::Material &mat); - void MoveMousePos(Math::Point pos); - void SetMousePos(Math::Point pos); - Math::Point RetMousePos(); - void SetMouseType(Gfx::MouseType type); - Gfx::MouseType RetMouseType(); - void SetMouseHide(bool hide); - bool RetMouseHide(); - void SetNiceMouse(bool nice); - bool RetNiceMouse(); - bool RetNiceMouseCap(); + void MoveMousePos(Math::Point pos); + void SetMousePos(Math::Point pos); + Math::Point RetMousePos(); + void SetMouseType(Gfx::MouseType type); + Gfx::MouseType RetMouseType(); + void SetMouseHide(bool hide); + bool RetMouseHide(); + void SetNiceMouse(bool nice); + bool RetNiceMouse(); + bool RetNiceMouseCap(); - CText* RetText(); + CText* RetText(); - bool ChangeColor(char *name, Gfx::Color colorRef1, Gfx::Color colorNew1, Gfx::Color colorRef2, Gfx::Color colorNew2, float tolerance1, float tolerance2, Math::Point ts, Math::Point ti, Math::Point *pExclu=0, float shift=0.0f, bool hSV=false); - bool OpenImage(char *name); - bool CopyImage(); - bool LoadImage(); - bool ScrollImage(int dx, int dy); - bool SetDot(int x, int y, Gfx::Color color); - bool CloseImage(); - bool WriteScreenShot(char *filename, int width, int height); - //bool GetRenderDC(HDC &hDC); - //bool ReleaseRenderDC(HDC &hDC); - //PBITMAPINFO CreateBitmapInfoStruct(HBITMAP hBmp); - //bool CreateBMPFile(LPTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP, HDC hDC); + bool ChangeColor(char *name, Gfx::Color colorRef1, Gfx::Color colorNew1, Gfx::Color colorRef2, Gfx::Color colorNew2, float tolerance1, float tolerance2, Math::Point ts, Math::Point ti, Math::Point *pExclu=0, float shift=0.0f, bool hSV=false); + bool OpenImage(char *name); + bool CopyImage(); + bool LoadImage(); + bool ScrollImage(int dx, int dy); + bool SetDot(int x, int y, Gfx::Color color); + bool CloseImage(); + bool WriteScreenShot(char *filename, int width, int height); + //bool GetRenderDC(HDC &hDC); + //bool ReleaseRenderDC(HDC &hDC); + //PBITMAPINFO CreateBitmapInfoStruct(HBITMAP hBmp); + //bool CreateBMPFile(LPTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP, HDC hDC); protected: - void MemSpace1(Gfx::ObjLevel1 *&p, int nb); - void MemSpace2(Gfx::ObjLevel2 *&p, int nb); - void MemSpace3(Gfx::ObjLevel3 *&p, int nb); - void MemSpace4(Gfx::ObjLevel4 *&p, int nb); - void MemSpace5(Gfx::ObjLevel5 *&p, int nb); - void MemSpace6(Gfx::ObjLevel6 *&p, int nb); - - Gfx::ObjLevel2* AddLevel1(Gfx::ObjLevel1 *&p1, char* texName1, char* texName2); - Gfx::ObjLevel3* AddLevel2(Gfx::ObjLevel2 *&p2, int objRank); - Gfx::ObjLevel4* AddLevel3(Gfx::ObjLevel3 *&p3, float min, float max); - Gfx::ObjLevel5* AddLevel4(Gfx::ObjLevel4 *&p4, int reserve); - Gfx::ObjLevel6* AddLevel5(Gfx::ObjLevel5 *&p5, Gfx::TriangleType type, const Gfx::Material &mat, int state, int nb); - - bool IsVisible(int objRank); - bool DetectBBox(int objRank, Math::Point mouse); - bool DetectTriangle(Math::Point mouse, Gfx::VertexTex2 *triangle, int objRank, float &dist); - bool TransformPoint(Math::Vector &p2D, int objRank, Math::Vector p3D); - void ComputeDistance(); - void UpdateGeometry(); - void RenderGroundSpot(); - void DrawShadow(); - void DrawBackground(); - void DrawBackgroundGradient(Gfx::Color up, Gfx::Color down); - void DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, char *name); - void DrawBackgroundImage(); - void DrawPlanet(); - void DrawFrontsize(); - void DrawOverColor(); - bool GetBBox2D(int objRank, Math::Point &min, Math::Point &max); - void DrawHilite(); - void DrawMouse(); - void DrawSprite(Math::Point pos, Math::Point dim, int icon); + void MemSpace1(Gfx::ObjLevel1 *&p, int nb); + void MemSpace2(Gfx::ObjLevel2 *&p, int nb); + void MemSpace3(Gfx::ObjLevel3 *&p, int nb); + void MemSpace4(Gfx::ObjLevel4 *&p, int nb); + void MemSpace5(Gfx::ObjLevel5 *&p, int nb); + void MemSpace6(Gfx::ObjLevel6 *&p, int nb); + + Gfx::ObjLevel2* AddLevel1(Gfx::ObjLevel1 *&p1, char* texName1, char* texName2); + Gfx::ObjLevel3* AddLevel2(Gfx::ObjLevel2 *&p2, int objRank); + Gfx::ObjLevel4* AddLevel3(Gfx::ObjLevel3 *&p3, float min, float max); + Gfx::ObjLevel5* AddLevel4(Gfx::ObjLevel4 *&p4, int reserve); + Gfx::ObjLevel6* AddLevel5(Gfx::ObjLevel5 *&p5, Gfx::TriangleType type, const Gfx::Material &mat, int state, int nb); + + bool IsVisible(int objRank); + bool DetectBBox(int objRank, Math::Point mouse); + bool DetectTriangle(Math::Point mouse, Gfx::VertexTex2 *triangle, int objRank, float &dist); + bool TransformPoint(Math::Vector &p2D, int objRank, Math::Vector p3D); + void ComputeDistance(); + void UpdateGeometry(); + void RenderGroundSpot(); + void DrawShadow(); + void DrawBackground(); + void DrawBackgroundGradient(Gfx::Color up, Gfx::Color down); + void DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, char *name); + void DrawBackgroundImage(); + void DrawPlanet(); + void DrawFrontsize(); + void DrawOverColor(); + bool GetBBox2D(int objRank, Math::Point &min, Math::Point &max); + void DrawHilite(); + void DrawMouse(); + void DrawSprite(Math::Point pos, Math::Point dim, int icon); protected: - CInstanceManager* m_iMan; - CApplication* m_app; - Gfx::CDevice* m_device; - Gfx::CText* m_text; - Gfx::CLight* m_light; - Gfx::CParticle* m_particule; - Gfx::CWater* m_water; - Gfx::CCloud* m_cloud; - Gfx::CLightning* m_blitz; - Gfx::CPlanet* m_planet; - Gfx::CTerrain* m_terrain; - CSound* m_sound; - - int m_blackSrcBlend[2]; - int m_blackDestBlend[2]; - int m_whiteSrcBlend[2]; - int m_whiteDestBlend[2]; - int m_diffuseSrcBlend[2]; - int m_diffuseDestBlend[2]; - int m_alphaSrcBlend[2]; - int m_alphaDestBlend[2]; - - Math::Matrix m_matProj; - Math::Matrix m_matLeftView; - Math::Matrix m_matRightView; - Math::Matrix m_matView; - float m_focus; - - Math::Matrix m_matWorldInterface; - Math::Matrix m_matProjInterface; - Math::Matrix m_matViewInterface; - - long m_baseTime; - long m_stopTime; - float m_absTime; - float m_lastTime; - float m_speed; - bool m_pause; - bool m_render; - bool m_movieLock; - - Math::IntPoint m_dim; - Math::IntPoint m_lastDim; - Gfx::ObjLevel1* m_objectPointer; - int m_objectParamTotal; - Gfx::Object* m_objectParam; - int m_shadowTotal; - Gfx::Shadow* m_shadow; - Gfx::GroundSpot* m_groundSpot; - Gfx::GroundMark m_groundMark; - Math::Vector m_eyePt; - Math::Vector m_lookatPt; - float m_eyeDirH; - float m_eyeDirV; - int m_rankView; - Gfx::Color m_ambiantColor[2]; - Gfx::Color m_backColor[2]; - Gfx::Color m_fogColor[2]; - float m_deepView[2]; - float m_fogStart[2]; - Gfx::Color m_waterAddColor; - int m_statisticTriangle; - bool m_updateGeometry; - char m_infoText[10][200]; - int m_alphaMode; - bool m_stateColor; - bool m_forceStateColor; - bool m_groundSpotVisible; - bool m_shadowVisible; - bool m_dirty; - bool m_fog; - bool m_firstGroundSpot; - int m_secondTexNum; - char m_backgroundName[50]; - Gfx::Color m_backgroundColorUp; - Gfx::Color m_backgroundColorDown; - Gfx::Color m_backgroundCloudUp; - Gfx::Color m_backgroundCloudDown; - bool m_backgroundFull; - bool m_backgroundQuarter; - bool m_overFront; - Gfx::Color m_overColor; - int m_overMode; - char m_frontsizeName[50]; - bool m_drawWorld; - bool m_drawFront; - float m_limitLOD[2]; - float m_particuleDensity; - float m_clippingDistance; - float m_lastClippingDistance; - float m_objectDetail; - float m_lastObjectDetail; - float m_terrainVision; - float m_gadgetQuantity; - int m_textureQuality; - bool m_totoMode; - bool m_lensMode; - bool m_waterMode; - bool m_skyMode; - bool m_backForce; - bool m_planetMode; - bool m_lightMode; - bool m_editIndentMode; - int m_editIndentValue; - float m_tracePrecision; - - int m_hiliteRank[100]; - bool m_hilite; - Math::Point m_hiliteP1; - Math::Point m_hiliteP2; - - int m_lastState; - Gfx::Color m_lastColor; - char m_lastTexture[2][50]; - Gfx::Material m_lastMaterial; - - Math::Point m_mousePos; - Gfx::MouseType m_mouseType; - bool m_mouseHide; - bool m_niceMouse; - - //LPDIRECTDRAWSURFACE7 m_imageSurface; - //DDSURFACEDESC2 m_imageDDSD; - //WORD* m_imageCopy; - //int m_imageDX; - //int m_imageDY; + CInstanceManager* m_iMan; + CApplication* m_app; + Gfx::CDevice* m_device; + Gfx::CText* m_text; + Gfx::CLight* m_light; + Gfx::CParticle* m_particule; + Gfx::CWater* m_water; + Gfx::CCloud* m_cloud; + Gfx::CLightning* m_blitz; + Gfx::CPlanet* m_planet; + Gfx::CTerrain* m_terrain; + CSound* m_sound; + + int m_blackSrcBlend[2]; + int m_blackDestBlend[2]; + int m_whiteSrcBlend[2]; + int m_whiteDestBlend[2]; + int m_diffuseSrcBlend[2]; + int m_diffuseDestBlend[2]; + int m_alphaSrcBlend[2]; + int m_alphaDestBlend[2]; + + Math::Matrix m_matProj; + Math::Matrix m_matLeftView; + Math::Matrix m_matRightView; + Math::Matrix m_matView; + float m_focus; + + Math::Matrix m_matWorldInterface; + Math::Matrix m_matProjInterface; + Math::Matrix m_matViewInterface; + + long m_baseTime; + long m_stopTime; + float m_absTime; + float m_lastTime; + float m_speed; + bool m_pause; + bool m_render; + bool m_movieLock; + + Math::IntPoint m_dim; + Math::IntPoint m_lastDim; + Gfx::ObjLevel1* m_objectPointer; + int m_objectParamTotal; + Gfx::Object* m_objectParam; + int m_shadowTotal; + Gfx::Shadow* m_shadow; + Gfx::GroundSpot* m_groundSpot; + Gfx::GroundMark m_groundMark; + Math::Vector m_eyePt; + Math::Vector m_lookatPt; + float m_eyeDirH; + float m_eyeDirV; + int m_rankView; + Gfx::Color m_ambiantColor[2]; + Gfx::Color m_backColor[2]; + Gfx::Color m_fogColor[2]; + float m_deepView[2]; + float m_fogStart[2]; + Gfx::Color m_waterAddColor; + int m_statisticTriangle; + bool m_updateGeometry; + char m_infoText[10][200]; + int m_alphaMode; + bool m_stateColor; + bool m_forceStateColor; + bool m_groundSpotVisible; + bool m_shadowVisible; + bool m_dirty; + bool m_fog; + bool m_firstGroundSpot; + int m_secondTexNum; + char m_backgroundName[50]; + Gfx::Color m_backgroundColorUp; + Gfx::Color m_backgroundColorDown; + Gfx::Color m_backgroundCloudUp; + Gfx::Color m_backgroundCloudDown; + bool m_backgroundFull; + bool m_backgroundQuarter; + bool m_overFront; + Gfx::Color m_overColor; + int m_overMode; + char m_frontsizeName[50]; + bool m_drawWorld; + bool m_drawFront; + float m_limitLOD[2]; + float m_particuleDensity; + float m_clippingDistance; + float m_lastClippingDistance; + float m_objectDetail; + float m_lastObjectDetail; + float m_terrainVision; + float m_gadgetQuantity; + int m_textureQuality; + bool m_totoMode; + bool m_lensMode; + bool m_waterMode; + bool m_skyMode; + bool m_backForce; + bool m_planetMode; + bool m_lightMode; + bool m_editIndentMode; + int m_editIndentValue; + float m_tracePrecision; + + int m_hiliteRank[100]; + bool m_hilite; + Math::Point m_hiliteP1; + Math::Point m_hiliteP2; + + int m_lastState; + Gfx::Color m_lastColor; + char m_lastTexture[2][50]; + Gfx::Material m_lastMaterial; + + Math::Point m_mousePos; + Gfx::MouseType m_mouseType; + bool m_mouseHide; + bool m_niceMouse; + + //LPDIRECTDRAWSURFACE7 m_imageSurface; + //DDSURFACEDESC2 m_imageDDSD; + //WORD* m_imageCopy; + //int m_imageDX; + //int m_imageDY; }; }; // namespace Gfx diff --git a/src/graphics/common/light.h b/src/graphics/common/light.h index 0ad32a8..1d14c5b 100644 --- a/src/graphics/common/light.h +++ b/src/graphics/common/light.h @@ -29,9 +29,9 @@ namespace Gfx { /** \enum LightType Type of light */ enum LightType { - LT_Point, - LT_Spot, - LT_Directional + LT_Point, + LT_Spot, + LT_Directional }; /** @@ -43,41 +43,41 @@ enum LightType */ struct Light { - //! Type of light source - Gfx::LightType type; - //! Color of light - Gfx::Color color; - //! Position in world space - Math::Vector position; - //! Direction in world space - Math::Vector direction; - //! Cutoff range - float range; - //! Falloff - float falloff; - //! Constant attenuation - float attenuation0; - //! Linear attenuation - float attenuation1; - //! Quadratic attenuation - float attenuation2; - //! Inner angle of spotlight cone - float theta; - //! Outer angle of spotlight cone - float phi; - - Light() : type(LT_Point), range(0.0f), falloff(0.0f), - attenuation0(0.0f), attenuation1(0.0f), attenuation2(0.0f), - theta(0.0f), phi(0.0f) {} + //! Type of light source + Gfx::LightType type; + //! Color of light + Gfx::Color color; + //! Position in world space + Math::Vector position; + //! Direction in world space + Math::Vector direction; + //! Cutoff range + float range; + //! Falloff + float falloff; + //! Constant attenuation + float attenuation0; + //! Linear attenuation + float attenuation1; + //! Quadratic attenuation + float attenuation2; + //! Inner angle of spotlight cone + float theta; + //! Outer angle of spotlight cone + float phi; + + Light() : type(LT_Point), range(0.0f), falloff(0.0f), + attenuation0(0.0f), attenuation1(0.0f), attenuation2(0.0f), + theta(0.0f), phi(0.0f) {} }; struct LightProg { - float starting; - float ending; - float current; - float progress; - float speed; + float starting; + float ending; + float current; + float progress; + float speed; }; /** @@ -87,24 +87,24 @@ struct LightProg */ struct SceneLight { - //! true -> light exists - bool used; - //! true -> light turned on - bool enable; - - //! Type of all objects included - //D3DTypeObj incluType; - //! Type of all objects excluded - //D3DTypeObj excluType; - - //! Configuration of the light - Gfx::Light light; - - //! intensity (0 .. 1) - Gfx::LightProg intensity; - Gfx::LightProg colorRed; - Gfx::LightProg colorGreen; - Gfx::LightProg colorBlue; + //! true -> light exists + bool used; + //! true -> light turned on + bool enable; + + //! Type of all objects included + //D3DTypeObj incluType; + //! Type of all objects excluded + //D3DTypeObj excluType; + + //! Configuration of the light + Gfx::Light light; + + //! intensity (0 .. 1) + Gfx::LightProg intensity; + Gfx::LightProg colorRed; + Gfx::LightProg colorGreen; + Gfx::LightProg colorBlue; }; // TODO CLight diff --git a/src/graphics/common/lightning.h b/src/graphics/common/lightning.h index 8edf9e5..957344c 100644 --- a/src/graphics/common/lightning.h +++ b/src/graphics/common/lightning.h @@ -35,51 +35,51 @@ class CTerrain; class CCamera; -const float BLITZPARA = 200.0f; // radius of lightning protection +const float BLITZPARA = 200.0f; // radius of lightning protection const short BLITZMAX = 50; enum BlitzPhase { - BPH_WAIT, - BPH_BLITZ, + BPH_WAIT, + BPH_BLITZ, }; class CLightning { public: - CLightning(CInstanceManager* iMan, CEngine* engine); - ~CLightning(); + CLightning(CInstanceManager* iMan, CEngine* engine); + ~CLightning(); - void Flush(); - bool EventProcess(const Event &event); - bool Create(float sleep, float delay, float magnetic); - bool GetStatus(float &sleep, float &delay, float &magnetic, float &progress); - bool SetStatus(float sleep, float delay, float magnetic, float progress); - void Draw(); + void Flush(); + bool EventProcess(const Event &event); + bool Create(float sleep, float delay, float magnetic); + bool GetStatus(float &sleep, float &delay, float &magnetic, float &progress); + bool SetStatus(float sleep, float delay, float magnetic, float progress); + void Draw(); protected: - bool EventFrame(const Event &event); - CObject* SearchObject(Math::Vector pos); + bool EventFrame(const Event &event); + CObject* SearchObject(Math::Vector pos); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CTerrain* m_terrain; - CCamera* m_camera; - CSound* m_sound; - - bool m_bBlitzExist; - float m_sleep; - float m_delay; - float m_magnetic; - BlitzPhase m_phase; - float m_time; - float m_speed; - float m_progress; - Math::Vector m_pos; - Math::Point m_shift[BLITZMAX]; - float m_width[BLITZMAX]; + CInstanceManager* m_iMan; + CEngine* m_engine; + CTerrain* m_terrain; + CCamera* m_camera; + CSound* m_sound; + + bool m_bBlitzExist; + float m_sleep; + float m_delay; + float m_magnetic; + BlitzPhase m_phase; + float m_time; + float m_speed; + float m_progress; + Math::Vector m_pos; + Math::Point m_shift[BLITZMAX]; + float m_width[BLITZMAX]; }; }; // namespace Gfx diff --git a/src/graphics/common/material.h b/src/graphics/common/material.h index 47f1a0d..2ec2e1b 100644 --- a/src/graphics/common/material.h +++ b/src/graphics/common/material.h @@ -32,12 +32,12 @@ namespace Gfx { */ struct Material { - //! Diffuse color - Gfx::Color diffuse; - //! Ambient color - Gfx::Color ambient; - //! Specular color - Gfx::Color specular; + //! Diffuse color + Gfx::Color diffuse; + //! Ambient color + Gfx::Color ambient; + //! Specular color + Gfx::Color specular; }; }; // namespace Gfx diff --git a/src/graphics/common/model.h b/src/graphics/common/model.h index 349c15c..e8a5f19 100644 --- a/src/graphics/common/model.h +++ b/src/graphics/common/model.h @@ -37,105 +37,105 @@ class CEngine; class CModel { - public: - CModel(CInstanceManager* iMan); - ~CModel(); - - void StartUserAction(); - void StopUserAction(); - - bool EventProcess(const Event &event); - - void InitView(); - void InitViewFromSelect(); - void UpdateView(); - void ViewMove(const Event &event, float speed); - - protected: - bool EventFrame(const Event &event); - bool GetVertex(int rank, Gfx::VertexTex2 &vertex); - bool SetVertex(int rank, Gfx::VertexTex2 &vertex); - Math::Vector RetSelectCDG(); - Math::Vector RetSelectNormal(); - void SmoothSelect(); - void PlaneSelect(); - void ColorSelect(); - void StateSelect(); - void MoveSelect(Math::Vector move); - void OperSelect(Math::Vector move, char oper); - void ReadScript(char *filename); - void BBoxCompute(Math::Vector &min, Math::Vector &max); - bool IsMappingSelectPlausible(Gfx::Mapping D3Dmode); - void MappingSelect(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); - void MappingSelectSpherical(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); - Math::Vector RetMappingCenter(Math::Vector pos, Math::Vector min); - void MappingSelectCylindrical(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); - void MappingSelectFace(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); - void MappingSelect2(int texNum2, int subdiv, int offsetU, int offsetV, bool bMirrorX, bool bMirrorY); - void MappingSelectPlane2(int mode, bool bMirrorX, bool bMirrorY); - void MappingSelectSpherical2(bool bMirrorX, bool bMirrorY); - void MappingSelectMagic2(bool bMirrorX, bool bMirrorY); - int SearchNext(int rank, int step); - int SearchSamePlane(int first, int step); - void CurrentSearchNext(int step, bool bControl); - void CurrentInit(); - void CurrentSelect(bool bSelect); - void DeselectAll(); - void SelectAll(); - void SelectZone(int first, int last); - void SelectTerm(); - void DefaultSelect(); - void SelectDelete(); - void Compress(); - void MinMaxSelect(); - void MinMaxChange(); - void UpdateInfoText(); - int* RetTextureTable(); - void TexturePartUpdate(); - void TextureRankChange(int step); - void TexturePartChange(int step); - void PutTextureValues(); - void GetTextureValues(); - void GetModelName(char *buffer); - void GetDXFName(char *buffer); - void GetScriptName(char *buffer); - bool IsEditFocus(); - - protected: - CInstanceManager* m_iMan; - Gfx::CEngine* m_engine; - CModFile* m_modFile; - CInterface* m_interface; - - float m_time; - ModelTriangle* m_triangleTable; - int m_triangleSel1; - int m_triangleSel2; - int m_mode; - int m_textureMode; - int m_textureRotate; - bool m_bTextureMirrorX; - bool m_bTextureMirrorY; - Math::Point m_textureInf; - Math::Point m_textureSup; - int m_texturePart; - int m_textureRank; - char m_textureName[20]; - bool m_bDisplayTransparent; - bool m_bDisplayOnlySelection; - float m_viewHeight; - float m_viewDist; - float m_viewAngleH; - float m_viewAngleV; - int m_color; - int m_state; - int m_secondTexNum; - int m_secondSubdiv; - int m_secondOffsetU; - int m_secondOffsetV; - char m_oper; - float m_min; - float m_max; + public: + CModel(CInstanceManager* iMan); + ~CModel(); + + void StartUserAction(); + void StopUserAction(); + + bool EventProcess(const Event &event); + + void InitView(); + void InitViewFromSelect(); + void UpdateView(); + void ViewMove(const Event &event, float speed); + + protected: + bool EventFrame(const Event &event); + bool GetVertex(int rank, Gfx::VertexTex2 &vertex); + bool SetVertex(int rank, Gfx::VertexTex2 &vertex); + Math::Vector RetSelectCDG(); + Math::Vector RetSelectNormal(); + void SmoothSelect(); + void PlaneSelect(); + void ColorSelect(); + void StateSelect(); + void MoveSelect(Math::Vector move); + void OperSelect(Math::Vector move, char oper); + void ReadScript(char *filename); + void BBoxCompute(Math::Vector &min, Math::Vector &max); + bool IsMappingSelectPlausible(Gfx::Mapping D3Dmode); + void MappingSelect(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); + void MappingSelectSpherical(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); + Math::Vector RetMappingCenter(Math::Vector pos, Math::Vector min); + void MappingSelectCylindrical(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); + void MappingSelectFace(int mode, int rotate, bool bMirrorX, bool bMirrorY, Math::Point ti, Math::Point ts, char *texName); + void MappingSelect2(int texNum2, int subdiv, int offsetU, int offsetV, bool bMirrorX, bool bMirrorY); + void MappingSelectPlane2(int mode, bool bMirrorX, bool bMirrorY); + void MappingSelectSpherical2(bool bMirrorX, bool bMirrorY); + void MappingSelectMagic2(bool bMirrorX, bool bMirrorY); + int SearchNext(int rank, int step); + int SearchSamePlane(int first, int step); + void CurrentSearchNext(int step, bool bControl); + void CurrentInit(); + void CurrentSelect(bool bSelect); + void DeselectAll(); + void SelectAll(); + void SelectZone(int first, int last); + void SelectTerm(); + void DefaultSelect(); + void SelectDelete(); + void Compress(); + void MinMaxSelect(); + void MinMaxChange(); + void UpdateInfoText(); + int* RetTextureTable(); + void TexturePartUpdate(); + void TextureRankChange(int step); + void TexturePartChange(int step); + void PutTextureValues(); + void GetTextureValues(); + void GetModelName(char *buffer); + void GetDXFName(char *buffer); + void GetScriptName(char *buffer); + bool IsEditFocus(); + + protected: + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + CModFile* m_modFile; + CInterface* m_interface; + + float m_time; + ModelTriangle* m_triangleTable; + int m_triangleSel1; + int m_triangleSel2; + int m_mode; + int m_textureMode; + int m_textureRotate; + bool m_bTextureMirrorX; + bool m_bTextureMirrorY; + Math::Point m_textureInf; + Math::Point m_textureSup; + int m_texturePart; + int m_textureRank; + char m_textureName[20]; + bool m_bDisplayTransparent; + bool m_bDisplayOnlySelection; + float m_viewHeight; + float m_viewDist; + float m_viewAngleH; + float m_viewAngleV; + int m_color; + int m_state; + int m_secondTexNum; + int m_secondSubdiv; + int m_secondOffsetU; + int m_secondOffsetV; + char m_oper; + float m_min; + float m_max; }; }; // namespace Gfx diff --git a/src/graphics/common/modfile.h b/src/graphics/common/modfile.h index 84b5456..c81739b 100644 --- a/src/graphics/common/modfile.h +++ b/src/graphics/common/modfile.h @@ -30,85 +30,85 @@ namespace Gfx { struct OldModelTriangle1 { - char bUsed; // TRUE -> using - char bSelect; // TRUE -> selected - Vertex p1; - Vertex p2; - Vertex p3; - Material material; - char texName[20]; - float min; - float max; -}; // length = 196 bytes + char bUsed; // TRUE -> using + char bSelect; // TRUE -> selected + Vertex p1; + Vertex p2; + Vertex p3; + Material material; + char texName[20]; + float min; + float max; +}; // length = 196 bytes struct OldModelTriangle2 { - char bUsed; // TRUE -> used - char bSelect; // TRUE -> selected - Vertex p1; - Vertex p2; - Vertex p3; - Material material; - char texName[20]; - float min; - float max; - long state; - short reserve1; - short reserve2; - short reserve3; - short reserve4; + char bUsed; // TRUE -> used + char bSelect; // TRUE -> selected + Vertex p1; + Vertex p2; + Vertex p3; + Material material; + char texName[20]; + float min; + float max; + long state; + short reserve1; + short reserve2; + short reserve3; + short reserve4; }; struct ModelTriangle { - char bUsed; // TRUE -> used - char bSelect; // TRUE -> selected - VertexTex2 p1; - VertexTex2 p2; - VertexTex2 p3; - Material material; - char texName[20]; - float min; - float max; - long state; - short texNum2; - short reserve2; - short reserve3; - short reserve4; -}; // length = 208 bytes + char bUsed; // TRUE -> used + char bSelect; // TRUE -> selected + VertexTex2 p1; + VertexTex2 p2; + VertexTex2 p3; + Material material; + char texName[20]; + float min; + float max; + long state; + short texNum2; + short reserve2; + short reserve3; + short reserve4; +}; // length = 208 bytes class CModFile { public: - CModFile(CInstanceManager* iMan); - ~CModFile(); + CModFile(CInstanceManager* iMan); + ~CModFile(); - bool ReadDXF(char *filename, float min, float max); - bool AddModel(char *filename, int first, bool bEdit=false, bool bMeta=true); - bool ReadModel(char *filename, bool bEdit=false, bool bMeta=true); - bool WriteModel(char *filename); + bool ReadDXF(char *filename, float min, float max); + bool AddModel(char *filename, int first, bool bEdit=false, bool bMeta=true); + bool ReadModel(char *filename, bool bEdit=false, bool bMeta=true); + bool WriteModel(char *filename); - bool CreateEngineObject(int objRank, int addState=0); - void Mirror(); + bool CreateEngineObject(int objRank, int addState=0); + void Mirror(); - void SetTriangleUsed(int total); - int RetTriangleUsed(); - int RetTriangleMax(); - ModelTriangle* RetTriangleList(); + void SetTriangleUsed(int total); + int RetTriangleUsed(); + int RetTriangleMax(); + ModelTriangle* RetTriangleList(); - float RetHeight(Math::Vector pos); + float RetHeight(Math::Vector pos); protected: - bool CreateTriangle(Math::Vector p1, Math::Vector p2, Math::Vector p3, float min, float max); + bool CreateTriangle(Math::Vector p1, Math::Vector p2, Math::Vector p3, float min, float max); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; + CInstanceManager* m_iMan; + CEngine* m_engine; - ModelTriangle* m_triangleTable; - int m_triangleUsed; + ModelTriangle* m_triangleTable; + int m_triangleUsed; }; }; diff --git a/src/graphics/common/particle.h b/src/graphics/common/particle.h index 4047cb5..e430e2a 100644 --- a/src/graphics/common/particle.h +++ b/src/graphics/common/particle.h @@ -40,217 +40,217 @@ const short MAXTRACKLEN = 10; const short MAXPARTIFOG = 100; const short MAXWHEELTRACE = 1000; -const short SH_WORLD = 0; // particle in the world in the interface -const short SH_FRONT = 1; // particle in the world on the interface -const short SH_INTERFACE = 2; // particle in the interface +const short SH_WORLD = 0; // particle in the world in the interface +const short SH_FRONT = 1; // particle in the world on the interface +const short SH_INTERFACE = 2; // particle in the interface const short SH_MAX = 3; -// type == 0 -> triangles -// type == 1 -> effect00 (black background) -// type == 2 -> effect01 (black background) -// type == 3 -> effect02 (black background) -// type == 4 -> text (white background) +// type == 0 -> triangles +// type == 1 -> effect00 (black background) +// type == 2 -> effect01 (black background) +// type == 3 -> effect02 (black background) +// type == 4 -> text (white background) enum ParticuleType { - PARTIEXPLOT = 1, // technology explosion - PARTIEXPLOO = 2, // organic explosion - PARTIMOTOR = 3, // the engine exhaust gas - PARTIGLINT = 4, // reflection - PARTIBLITZ = 5, // lightning recharging battery - PARTICRASH = 6, // dust after fall - PARTIGAS = 7, // gas from the reactor - PARTIFIRE = 9, // fireball shrinks - PARTIFIREZ = 10, // fireball grows - PARTIBLUE = 11, // blue ball - PARTISELY = 12, // yellow selection - PARTISELR = 13, // red selection - PARTIGUN1 = 18, // a bullet (fireball) - PARTIGUN2 = 19, // bullet 2 (ant) - PARTIGUN3 = 20, // bullet 3 (spider) - PARTIGUN4 = 21, // bullet 4 (orgaball) - PARTIFRAG = 22, // triangular fragment - PARTIQUEUE = 23, // inflamed tail - PARTIORGANIC1 = 24, // organic ball mother - PARTIORGANIC2 = 25, // organic ball daughter - PARTISMOKE1 = 26, // black smoke - PARTISMOKE2 = 27, // black smoke - PARTISMOKE3 = 28, // black smoke - PARTISMOKE4 = 29, // black smoke - PARTIBLOOD = 30, // human blood - PARTIBLOODM = 31, // blood laying - PARTIVAPOR = 32, // steam - PARTIVIRUS1 = 33, // virus 1 - PARTIVIRUS2 = 34, // virus 2 - PARTIVIRUS3 = 35, // virus 3 - PARTIVIRUS4 = 36, // virus 4 - PARTIVIRUS5 = 37, // virus 5 - PARTIVIRUS6 = 38, // virus 6 - PARTIVIRUS7 = 39, // virus 7 - PARTIVIRUS8 = 40, // virus 8 - PARTIVIRUS9 = 41, // virus 9 - PARTIVIRUS10 = 42, // virus 10 - PARTIRAY1 = 43, // ray 1 (turn) - PARTIRAY2 = 44, // ray 2 (electric arc) - PARTIRAY3 = 45, // ray 3 - PARTIRAY4 = 46, // ray 4 - PARTIFLAME = 47, // flame - PARTIBUBBLE = 48, // bubble - PARTIFLIC = 49, // circles in the water - PARTIEJECT = 50, // ejection from the reactor - PARTISCRAPS = 51, // waste from the reactor - PARTITOTO = 52, // reactor of tot - PARTIERROR = 53, // toto says no - PARTIWARNING = 54, // foo says blah - PARTIINFO = 54, // toto says yes - PARTIQUARTZ = 55, // reflection crystal - PARTISPHERE0 = 56, // explosion sphere - PARTISPHERE1 = 57, // energy sphere - PARTISPHERE2 = 58, // analysis sphere - PARTISPHERE3 = 59, // shield sphere - PARTISPHERE4 = 60, // information sphere (emit) - PARTISPHERE5 = 61, // botanical sphere (gravity root) - PARTISPHERE6 = 62, // information sphere (receive) - PARTISPHERE7 = 63, // sphere - PARTISPHERE8 = 64, // sphere - PARTISPHERE9 = 65, // sphere - PARTIGUNDEL = 66, // bullet destroyed by shield - PARTIPART = 67, // object part - PARTITRACK1 = 68, // drag 1 - PARTITRACK2 = 69, // drag 2 - PARTITRACK3 = 70, // drag 3 - PARTITRACK4 = 71, // drag 4 - PARTITRACK5 = 72, // drag 5 - PARTITRACK6 = 73, // drag 6 - PARTITRACK7 = 74, // drag 7 - PARTITRACK8 = 75, // drag 8 - PARTITRACK9 = 76, // drag 9 - PARTITRACK10 = 77, // drag 10 - PARTITRACK11 = 78, // drag 11 - PARTITRACK12 = 79, // drag 12 - PARTITRACK13 = 80, // drag 13 - PARTITRACK14 = 81, // drag 14 - PARTITRACK15 = 82, // drag 15 - PARTITRACK16 = 83, // drag 16 - PARTITRACK17 = 84, // drag 17 - PARTITRACK18 = 85, // drag 18 - PARTITRACK19 = 86, // drag 19 - PARTITRACK20 = 87, // drag 20 - PARTIGLINTb = 88, // blue reflection - PARTIGLINTr = 89, // red reflection - PARTILENS1 = 90, // brilliance 1 (orange) - PARTILENS2 = 91, // brilliance 2 (yellow) - PARTILENS3 = 92, // brilliance 3 (red) - PARTILENS4 = 93, // brilliance 4 (violet) - PARTICONTROL = 94, // reflection on button - PARTISHOW = 95, // shows a place - PARTICHOC = 96, // shock wave - PARTIGFLAT = 97, // shows if the ground is flat - PARTIRECOVER = 98, // blue ball recycler - PARTIROOT = 100, // gravity root smoke - PARTIPLOUF0 = 101, // splash - PARTIPLOUF1 = 102, // splash - PARTIPLOUF2 = 103, // splash - PARTIPLOUF3 = 104, // splash - PARTIPLOUF4 = 105, // splash - PARTIDROP = 106, // drop - PARTIFOG0 = 107, // fog 0 - PARTIFOG1 = 108, // fog 1 - PARTIFOG2 = 109, // fog 2 - PARTIFOG3 = 110, // fog 3 - PARTIFOG4 = 111, // fog 4 - PARTIFOG5 = 112, // fog 5 - PARTIFOG6 = 113, // fog 6 - PARTIFOG7 = 114, // fog 7 - PARTIFOG8 = 115, // fog 8 - PARTIFOG9 = 116, // fog 9 - PARTILIMIT1 = 117, // shows the limits 1 - PARTILIMIT2 = 118, // shows the limits 2 - PARTILIMIT3 = 119, // shows the limits 3 - PARTILIMIT4 = 120, // shows the limits 4 - PARTIWATER = 121, // drop of water - PARTIEXPLOG1 = 122, // ball explosion 1 - PARTIEXPLOG2 = 123, // ball explosion 2 - PARTIBASE = 124, // gases of spaceship - PARTITRACE0 = 140, // trace - PARTITRACE1 = 141, // trace - PARTITRACE2 = 142, // trace - PARTITRACE3 = 143, // trace - PARTITRACE4 = 144, // trace - PARTITRACE5 = 145, // trace - PARTITRACE6 = 146, // trace - PARTITRACE7 = 147, // trace - PARTITRACE8 = 148, // trace - PARTITRACE9 = 149, // trace - PARTITRACE10 = 150, // trace - PARTITRACE11 = 151, // trace - PARTITRACE12 = 152, // trace - PARTITRACE13 = 153, // trace - PARTITRACE14 = 154, // trace - PARTITRACE15 = 155, // trace - PARTITRACE16 = 156, // trace - PARTITRACE17 = 157, // trace - PARTITRACE18 = 158, // trace - PARTITRACE19 = 159, // trace + PARTIEXPLOT = 1, // technology explosion + PARTIEXPLOO = 2, // organic explosion + PARTIMOTOR = 3, // the engine exhaust gas + PARTIGLINT = 4, // reflection + PARTIBLITZ = 5, // lightning recharging battery + PARTICRASH = 6, // dust after fall + PARTIGAS = 7, // gas from the reactor + PARTIFIRE = 9, // fireball shrinks + PARTIFIREZ = 10, // fireball grows + PARTIBLUE = 11, // blue ball + PARTISELY = 12, // yellow selection + PARTISELR = 13, // red selection + PARTIGUN1 = 18, // a bullet (fireball) + PARTIGUN2 = 19, // bullet 2 (ant) + PARTIGUN3 = 20, // bullet 3 (spider) + PARTIGUN4 = 21, // bullet 4 (orgaball) + PARTIFRAG = 22, // triangular fragment + PARTIQUEUE = 23, // inflamed tail + PARTIORGANIC1 = 24, // organic ball mother + PARTIORGANIC2 = 25, // organic ball daughter + PARTISMOKE1 = 26, // black smoke + PARTISMOKE2 = 27, // black smoke + PARTISMOKE3 = 28, // black smoke + PARTISMOKE4 = 29, // black smoke + PARTIBLOOD = 30, // human blood + PARTIBLOODM = 31, // blood laying + PARTIVAPOR = 32, // steam + PARTIVIRUS1 = 33, // virus 1 + PARTIVIRUS2 = 34, // virus 2 + PARTIVIRUS3 = 35, // virus 3 + PARTIVIRUS4 = 36, // virus 4 + PARTIVIRUS5 = 37, // virus 5 + PARTIVIRUS6 = 38, // virus 6 + PARTIVIRUS7 = 39, // virus 7 + PARTIVIRUS8 = 40, // virus 8 + PARTIVIRUS9 = 41, // virus 9 + PARTIVIRUS10 = 42, // virus 10 + PARTIRAY1 = 43, // ray 1 (turn) + PARTIRAY2 = 44, // ray 2 (electric arc) + PARTIRAY3 = 45, // ray 3 + PARTIRAY4 = 46, // ray 4 + PARTIFLAME = 47, // flame + PARTIBUBBLE = 48, // bubble + PARTIFLIC = 49, // circles in the water + PARTIEJECT = 50, // ejection from the reactor + PARTISCRAPS = 51, // waste from the reactor + PARTITOTO = 52, // reactor of tot + PARTIERROR = 53, // toto says no + PARTIWARNING = 54, // foo says blah + PARTIINFO = 54, // toto says yes + PARTIQUARTZ = 55, // reflection crystal + PARTISPHERE0 = 56, // explosion sphere + PARTISPHERE1 = 57, // energy sphere + PARTISPHERE2 = 58, // analysis sphere + PARTISPHERE3 = 59, // shield sphere + PARTISPHERE4 = 60, // information sphere (emit) + PARTISPHERE5 = 61, // botanical sphere (gravity root) + PARTISPHERE6 = 62, // information sphere (receive) + PARTISPHERE7 = 63, // sphere + PARTISPHERE8 = 64, // sphere + PARTISPHERE9 = 65, // sphere + PARTIGUNDEL = 66, // bullet destroyed by shield + PARTIPART = 67, // object part + PARTITRACK1 = 68, // drag 1 + PARTITRACK2 = 69, // drag 2 + PARTITRACK3 = 70, // drag 3 + PARTITRACK4 = 71, // drag 4 + PARTITRACK5 = 72, // drag 5 + PARTITRACK6 = 73, // drag 6 + PARTITRACK7 = 74, // drag 7 + PARTITRACK8 = 75, // drag 8 + PARTITRACK9 = 76, // drag 9 + PARTITRACK10 = 77, // drag 10 + PARTITRACK11 = 78, // drag 11 + PARTITRACK12 = 79, // drag 12 + PARTITRACK13 = 80, // drag 13 + PARTITRACK14 = 81, // drag 14 + PARTITRACK15 = 82, // drag 15 + PARTITRACK16 = 83, // drag 16 + PARTITRACK17 = 84, // drag 17 + PARTITRACK18 = 85, // drag 18 + PARTITRACK19 = 86, // drag 19 + PARTITRACK20 = 87, // drag 20 + PARTIGLINTb = 88, // blue reflection + PARTIGLINTr = 89, // red reflection + PARTILENS1 = 90, // brilliance 1 (orange) + PARTILENS2 = 91, // brilliance 2 (yellow) + PARTILENS3 = 92, // brilliance 3 (red) + PARTILENS4 = 93, // brilliance 4 (violet) + PARTICONTROL = 94, // reflection on button + PARTISHOW = 95, // shows a place + PARTICHOC = 96, // shock wave + PARTIGFLAT = 97, // shows if the ground is flat + PARTIRECOVER = 98, // blue ball recycler + PARTIROOT = 100, // gravity root smoke + PARTIPLOUF0 = 101, // splash + PARTIPLOUF1 = 102, // splash + PARTIPLOUF2 = 103, // splash + PARTIPLOUF3 = 104, // splash + PARTIPLOUF4 = 105, // splash + PARTIDROP = 106, // drop + PARTIFOG0 = 107, // fog 0 + PARTIFOG1 = 108, // fog 1 + PARTIFOG2 = 109, // fog 2 + PARTIFOG3 = 110, // fog 3 + PARTIFOG4 = 111, // fog 4 + PARTIFOG5 = 112, // fog 5 + PARTIFOG6 = 113, // fog 6 + PARTIFOG7 = 114, // fog 7 + PARTIFOG8 = 115, // fog 8 + PARTIFOG9 = 116, // fog 9 + PARTILIMIT1 = 117, // shows the limits 1 + PARTILIMIT2 = 118, // shows the limits 2 + PARTILIMIT3 = 119, // shows the limits 3 + PARTILIMIT4 = 120, // shows the limits 4 + PARTIWATER = 121, // drop of water + PARTIEXPLOG1 = 122, // ball explosion 1 + PARTIEXPLOG2 = 123, // ball explosion 2 + PARTIBASE = 124, // gases of spaceship + PARTITRACE0 = 140, // trace + PARTITRACE1 = 141, // trace + PARTITRACE2 = 142, // trace + PARTITRACE3 = 143, // trace + PARTITRACE4 = 144, // trace + PARTITRACE5 = 145, // trace + PARTITRACE6 = 146, // trace + PARTITRACE7 = 147, // trace + PARTITRACE8 = 148, // trace + PARTITRACE9 = 149, // trace + PARTITRACE10 = 150, // trace + PARTITRACE11 = 151, // trace + PARTITRACE12 = 152, // trace + PARTITRACE13 = 153, // trace + PARTITRACE14 = 154, // trace + PARTITRACE15 = 155, // trace + PARTITRACE16 = 156, // trace + PARTITRACE17 = 157, // trace + PARTITRACE18 = 158, // trace + PARTITRACE19 = 159, // trace }; enum ParticulePhase { - PARPHSTART = 0, - PARPHEND = 1, + PARPHSTART = 0, + PARPHEND = 1, }; struct Particule { - char bUsed; // TRUE -> particle used - char bRay; // TRUE -> ray with goal - unsigned short uniqueStamp; // unique mark - short sheet; // sheet (0..n) - ParticuleType type; // type PARTI* - ParticulePhase phase; // phase PARPH* - float mass; // mass of the particle (in rebounding) - float weight; // weight of the particle (for noise) - float duration; // length of life - Math::Vector pos; // absolute position (relative if object links) - Math::Vector goal; // goal position (if bRay) - Math::Vector speed; // speed of displacement - float windSensitivity; - short bounce; // number of rebounds - Math::Point dim; // dimensions of the rectangle - float zoom; // zoom (0..1) - float angle; // angle of rotation - float intensity; // intensity - Math::Point texSup; // coordinated upper texture - Math::Point texInf; // coordinated lower texture - float time; // age of the particle (0..n) - float phaseTime; // age at the beginning of phase - float testTime; // time since last test - CObject* objLink; // father object (for example reactor) - CObject* objFather; // father object (for example reactor) - short objRank; // rank of the object, or -1 - short trackRank; // rank of the drag + char bUsed; // TRUE -> particle used + char bRay; // TRUE -> ray with goal + unsigned short uniqueStamp; // unique mark + short sheet; // sheet (0..n) + ParticuleType type; // type PARTI* + ParticulePhase phase; // phase PARPH* + float mass; // mass of the particle (in rebounding) + float weight; // weight of the particle (for noise) + float duration; // length of life + Math::Vector pos; // absolute position (relative if object links) + Math::Vector goal; // goal position (if bRay) + Math::Vector speed; // speed of displacement + float windSensitivity; + short bounce; // number of rebounds + Math::Point dim; // dimensions of the rectangle + float zoom; // zoom (0..1) + float angle; // angle of rotation + float intensity; // intensity + Math::Point texSup; // coordinated upper texture + Math::Point texInf; // coordinated lower texture + float time; // age of the particle (0..n) + float phaseTime; // age at the beginning of phase + float testTime; // time since last test + CObject* objLink; // father object (for example reactor) + CObject* objFather; // father object (for example reactor) + short objRank; // rank of the object, or -1 + short trackRank; // rank of the drag }; struct Track { - char bUsed; // TRUE -> drag used - char bDrawParticule; - float step; // duration of not - float last; // increase last not memorized - float intensity; // intensity at starting (0..1) - float width; // tail width - int used; // number of positions in "pos" - int head; // head to write index - Math::Vector pos[MAXTRACKLEN]; - float len[MAXTRACKLEN]; + char bUsed; // TRUE -> drag used + char bDrawParticule; + float step; // duration of not + float last; // increase last not memorized + float intensity; // intensity at starting (0..1) + float width; // tail width + int used; // number of positions in "pos" + int head; // head to write index + Math::Vector pos[MAXTRACKLEN]; + float len[MAXTRACKLEN]; }; struct WheelTrace { - ParticuleType type; // type PARTI* - Math::Vector pos[4]; // rectangle positions - float startTime; // beginning of life + ParticuleType type; // type PARTI* + Math::Vector pos[4]; // rectangle positions + float startTime; // beginning of life }; @@ -258,80 +258,80 @@ struct WheelTrace class CParticle { public: - CParticle(CInstanceManager* iMan, CEngine* engine); - ~CParticle(); + CParticle(CInstanceManager* iMan, CEngine* engine); + ~CParticle(); - void SetGLDevice(CDevice device); + void SetGLDevice(CDevice device); - void FlushParticule(); - void FlushParticule(int sheet); - int CreateParticule(Math::Vector pos, Math::Vector speed, Math::Point dim, ParticuleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0); - int CreateFrag(Math::Vector pos, Math::Vector speed, Triangle *triangle, ParticuleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0); - int CreatePart(Math::Vector pos, Math::Vector speed, ParticuleType type, float duration=1.0f, float mass=0.0f, float weight=0.0f, float windSensitivity=1.0f, int sheet=0); - int CreateRay(Math::Vector pos, Math::Vector goal, ParticuleType type, Math::Point dim, float duration=1.0f, int sheet=0); - int CreateTrack(Math::Vector pos, Math::Vector speed, Math::Point dim, ParticuleType type, float duration=1.0f, float mass=0.0f, float length=10.0f, float width=1.0f); - void CreateWheelTrace(const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3, const Math::Vector &p4, ParticuleType type); - void DeleteParticule(ParticuleType type); - void DeleteParticule(int channel); - void SetObjectLink(int channel, CObject *object); - void SetObjectFather(int channel, CObject *object); - void SetPosition(int channel, Math::Vector pos); - void SetDimension(int channel, Math::Point dim); - void SetZoom(int channel, float zoom); - void SetAngle(int channel, float angle); - void SetIntensity(int channel, float intensity); - void SetParam(int channel, Math::Vector pos, Math::Point dim, float zoom, float angle, float intensity); - void SetPhase(int channel, ParticulePhase phase, float duration); - bool GetPosition(int channel, Math::Vector &pos); + void FlushParticule(); + void FlushParticule(int sheet); + int CreateParticule(Math::Vector pos, Math::Vector speed, Math::Point dim, ParticuleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0); + int CreateFrag(Math::Vector pos, Math::Vector speed, Triangle *triangle, ParticuleType type, float duration=1.0f, float mass=0.0f, float windSensitivity=1.0f, int sheet=0); + int CreatePart(Math::Vector pos, Math::Vector speed, ParticuleType type, float duration=1.0f, float mass=0.0f, float weight=0.0f, float windSensitivity=1.0f, int sheet=0); + int CreateRay(Math::Vector pos, Math::Vector goal, ParticuleType type, Math::Point dim, float duration=1.0f, int sheet=0); + int CreateTrack(Math::Vector pos, Math::Vector speed, Math::Point dim, ParticuleType type, float duration=1.0f, float mass=0.0f, float length=10.0f, float width=1.0f); + void CreateWheelTrace(const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3, const Math::Vector &p4, ParticuleType type); + void DeleteParticule(ParticuleType type); + void DeleteParticule(int channel); + void SetObjectLink(int channel, CObject *object); + void SetObjectFather(int channel, CObject *object); + void SetPosition(int channel, Math::Vector pos); + void SetDimension(int channel, Math::Point dim); + void SetZoom(int channel, float zoom); + void SetAngle(int channel, float angle); + void SetIntensity(int channel, float intensity); + void SetParam(int channel, Math::Vector pos, Math::Point dim, float zoom, float angle, float intensity); + void SetPhase(int channel, ParticulePhase phase, float duration); + bool GetPosition(int channel, Math::Vector &pos); - Gfx::Color RetFogColor(Math::Vector pos); + Gfx::Color RetFogColor(Math::Vector pos); - void SetFrameUpdate(int sheet, bool bUpdate); - void FrameParticule(float rTime); - void DrawParticule(int sheet); + void SetFrameUpdate(int sheet, bool bUpdate); + void FrameParticule(float rTime); + void DrawParticule(int sheet); - bool WriteWheelTrace(char *filename, int width, int height, Math::Vector dl, Math::Vector ur); + bool WriteWheelTrace(char *filename, int width, int height, Math::Vector dl, Math::Vector ur); protected: - void DeleteRank(int rank); - bool CheckChannel(int &channel); - void DrawParticuleTriangle(int i); - void DrawParticuleNorm(int i); - void DrawParticuleFlat(int i); - void DrawParticuleFog(int i); - void DrawParticuleRay(int i); - void DrawParticuleSphere(int i); - void DrawParticuleCylinder(int i); - void DrawParticuleWheel(int i); - CObject* SearchObjectGun(Math::Vector old, Math::Vector pos, ParticuleType type, CObject *father); - CObject* SearchObjectRay(Math::Vector pos, Math::Vector goal, ParticuleType type, CObject *father); - void Play(Snd::Sound sound, Math::Vector pos, float amplitude); - bool TrackMove(int i, Math::Vector pos, float progress); - void TrackDraw(int i, ParticuleType type); + void DeleteRank(int rank); + bool CheckChannel(int &channel); + void DrawParticuleTriangle(int i); + void DrawParticuleNorm(int i); + void DrawParticuleFlat(int i); + void DrawParticuleFog(int i); + void DrawParticuleRay(int i); + void DrawParticuleSphere(int i); + void DrawParticuleCylinder(int i); + void DrawParticuleWheel(int i); + CObject* SearchObjectGun(Math::Vector old, Math::Vector pos, ParticuleType type, CObject *father); + CObject* SearchObjectRay(Math::Vector pos, Math::Vector goal, ParticuleType type, CObject *father); + void Play(Snd::Sound sound, Math::Vector pos, float amplitude); + bool TrackMove(int i, Math::Vector pos, float progress); + void TrackDraw(int i, ParticuleType type); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CDevice* m_pDevice; - CRobotMain* m_main; - CTerrain* m_terrain; - CWater* m_water; - CSound* m_sound; + CInstanceManager* m_iMan; + CEngine* m_engine; + CDevice* m_pDevice; + CRobotMain* m_main; + CTerrain* m_terrain; + CWater* m_water; + CSound* m_sound; - Particule m_particule[MAXPARTICULE*MAXPARTITYPE]; - Gfx::Triangle m_triangle[MAXPARTICULE]; // triangle if PartiType == 0 - Track m_track[MAXTRACK]; - int m_wheelTraceTotal; - int m_wheelTraceIndex; - WheelTrace m_wheelTrace[MAXWHEELTRACE]; - int m_totalInterface[MAXPARTITYPE][SH_MAX]; - bool m_bFrameUpdate[SH_MAX]; - int m_fogTotal; - int m_fog[MAXPARTIFOG]; - int m_uniqueStamp; - int m_exploGunCounter; - float m_lastTimeGunDel; - float m_absTime; + Particule m_particule[MAXPARTICULE*MAXPARTITYPE]; + Gfx::Triangle m_triangle[MAXPARTICULE]; // triangle if PartiType == 0 + Track m_track[MAXTRACK]; + int m_wheelTraceTotal; + int m_wheelTraceIndex; + WheelTrace m_wheelTrace[MAXWHEELTRACE]; + int m_totalInterface[MAXPARTITYPE][SH_MAX]; + bool m_bFrameUpdate[SH_MAX]; + int m_fogTotal; + int m_fog[MAXPARTIFOG]; + int m_uniqueStamp; + int m_exploGunCounter; + float m_lastTimeGunDel; + float m_absTime; }; diff --git a/src/graphics/common/planet.h b/src/graphics/common/planet.h index 4ffccfc..264d05c 100644 --- a/src/graphics/common/planet.h +++ b/src/graphics/common/planet.h @@ -35,15 +35,15 @@ const short MAXPLANET = 10; struct Planet { - char bUsed; // TRUE -> planet exists - Math::Point start; // initial position in degrees - Math::Point angle; // current position in degrees - float dim; // dimensions (0..1) - float speed; // speed - float dir; // direction in the sky - char name[20]; // name of the texture - Math::Point uv1, uv2; // texture mapping - char bTGA; // texture .TGA + char bUsed; // TRUE -> planet exists + Math::Point start; // initial position in degrees + Math::Point angle; // current position in degrees + float dim; // dimensions (0..1) + float speed; // speed + float dir; // direction in the sky + char name[20]; // name of the texture + Math::Point uv1, uv2; // texture mapping + char bTGA; // texture .TGA }; @@ -51,29 +51,29 @@ struct Planet class CPlanet { public: - CPlanet(CInstanceManager* iMan, CEngine* engine); - ~CPlanet(); - - void Flush(); - bool EventProcess(const Event &event); - bool Create(int mode, Math::Point start, float dim, float speed, float dir, char *name, Math::Point uv1, Math::Point uv2); - bool PlanetExist(); - void LoadTexture(); - void Draw(); - void SetMode(int mode); - int RetMode(); + CPlanet(CInstanceManager* iMan, CEngine* engine); + ~CPlanet(); + + void Flush(); + bool EventProcess(const Event &event); + bool Create(int mode, Math::Point start, float dim, float speed, float dir, char *name, Math::Point uv1, Math::Point uv2); + bool PlanetExist(); + void LoadTexture(); + void Draw(); + void SetMode(int mode); + int RetMode(); protected: - bool EventFrame(const Event &event); + bool EventFrame(const Event &event); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; + CInstanceManager* m_iMan; + CEngine* m_engine; - float m_time; - int m_mode; - Planet m_planet[2][MAXPLANET]; - bool m_bPlanetExist; + float m_time; + int m_mode; + Planet m_planet[2][MAXPLANET]; + bool m_bPlanetExist; }; diff --git a/src/graphics/common/pyro.h b/src/graphics/common/pyro.h index e6b5844..fda74b3 100644 --- a/src/graphics/common/pyro.h +++ b/src/graphics/common/pyro.h @@ -44,132 +44,132 @@ class CLight; enum PyroType { - PT_NULL = 0, - PT_FRAGT = 1, // fragmentation of technical object - PT_FRAGO = 2, // fragmentation of organic object - PT_FRAGW = 4, // fragmentation of object under water - PT_EXPLOT = 5, // explosion of technical object - PT_EXPLOO = 6, // explosion of organic object - PT_EXPLOW = 8, // explosion of object under water - PT_SHOTT = 9, // hit technical object - PT_SHOTH = 10, // hit human - PT_SHOTM = 11, // hit queen - PT_SHOTW = 12, // hit under water - PT_EGG = 13, // break the egg - PT_BURNT = 14, // burning of technical object - PT_BURNO = 15, // burning of organic object - PT_SPIDER = 16, // spider explosion - PT_FALL = 17, // cargo falling - PT_WPCHECK = 18, // indicator reaches - PT_FLCREATE = 19, // flag create - PT_FLDELETE = 20, // flag destroy - PT_RESET = 21, // reset position of the object - PT_WIN = 22, // fireworks - PT_LOST = 23, // black smoke - PT_DEADG = 24, // shooting death - PT_DEADW = 25, // drowning death - PT_FINDING = 26, // object discovered + PT_NULL = 0, + PT_FRAGT = 1, // fragmentation of technical object + PT_FRAGO = 2, // fragmentation of organic object + PT_FRAGW = 4, // fragmentation of object under water + PT_EXPLOT = 5, // explosion of technical object + PT_EXPLOO = 6, // explosion of organic object + PT_EXPLOW = 8, // explosion of object under water + PT_SHOTT = 9, // hit technical object + PT_SHOTH = 10, // hit human + PT_SHOTM = 11, // hit queen + PT_SHOTW = 12, // hit under water + PT_EGG = 13, // break the egg + PT_BURNT = 14, // burning of technical object + PT_BURNO = 15, // burning of organic object + PT_SPIDER = 16, // spider explosion + PT_FALL = 17, // cargo falling + PT_WPCHECK = 18, // indicator reaches + PT_FLCREATE = 19, // flag create + PT_FLDELETE = 20, // flag destroy + PT_RESET = 21, // reset position of the object + PT_WIN = 22, // fireworks + PT_LOST = 23, // black smoke + PT_DEADG = 24, // shooting death + PT_DEADW = 25, // drowning death + PT_FINDING = 26, // object discovered }; struct PyroBurnPart { - int part; - Math::Vector initialPos; - Math::Vector finalPos; - Math::Vector initialAngle; - Math::Vector finalAngle; + int part; + Math::Vector initialPos; + Math::Vector finalPos; + Math::Vector initialAngle; + Math::Vector finalAngle; }; struct PyroLightOper { - float progress; - float intensity; - Gfx::Color color; + float progress; + float intensity; + Gfx::Color color; }; class CPyro { public: - CPyro(CInstanceManager* iMan); - ~CPyro(); + CPyro(CInstanceManager* iMan); + ~CPyro(); - void DeleteObject(bool bAll=false); - bool Create(PyroType type, CObject* pObj, float force=1.0f); - bool EventProcess(const Event &event); - Error IsEnded(); - void CutObjectLink(CObject* pObj); + void DeleteObject(bool bAll=false); + bool Create(PyroType type, CObject* pObj, float force=1.0f); + bool EventProcess(const Event &event); + Error IsEnded(); + void CutObjectLink(CObject* pObj); protected: - void DisplayError(PyroType type, CObject* pObj); - bool CreateLight(Math::Vector pos, float height); - void DeleteObject(bool bPrimary, bool bSecondary); + void DisplayError(PyroType type, CObject* pObj); + bool CreateLight(Math::Vector pos, float height); + void DeleteObject(bool bPrimary, bool bSecondary); - void CreateTriangle(CObject* pObj, ObjectType oType, int part); + void CreateTriangle(CObject* pObj, ObjectType oType, int part); - void ExploStart(); - void ExploTerminate(); + void ExploStart(); + void ExploTerminate(); - void BurnStart(); - void BurnAddPart(int part, Math::Vector pos, Math::Vector angle); - void BurnProgress(); - bool BurnIsKeepPart(int part); - void BurnTerminate(); + void BurnStart(); + void BurnAddPart(int part, Math::Vector pos, Math::Vector angle); + void BurnProgress(); + bool BurnIsKeepPart(int part); + void BurnTerminate(); - void FallStart(); - CObject* FallSearchBeeExplo(); - void FallProgress(float rTime); - Error FallIsEnded(); + void FallStart(); + CObject* FallSearchBeeExplo(); + void FallProgress(float rTime); + Error FallIsEnded(); - void LightOperFlush(); - void LightOperAdd(float progress, float intensity, float r, float g, float b); - void LightOperFrame(float rTime); + void LightOperFlush(); + void LightOperAdd(float progress, float intensity, float r, float g, float b); + void LightOperFrame(float rTime); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CTerrain* m_terrain; - CCamera* m_camera; - CParticle* m_particule; - CLight* m_light; - CObject* m_object; - CDisplayText* m_displayText; - CRobotMain* m_main; - CSound* m_sound; - - Math::Vector m_pos; // center of the effect - Math::Vector m_posPower; // center of the battery - bool m_bPower; // battery exists? - PyroType m_type; - float m_force; - float m_size; - float m_progress; - float m_speed; - float m_time; - float m_lastParticule; - float m_lastParticuleSmoke; - int m_soundChannel; - - int m_lightRank; - int m_lightOperTotal; - PyroLightOper m_lightOper[10]; - float m_lightHeight; - - ObjectType m_burnType; - int m_burnPartTotal; - PyroBurnPart m_burnPart[10]; - int m_burnKeepPart[10]; - float m_burnFall; - - float m_fallFloor; - float m_fallSpeed; - float m_fallBulletTime; - bool m_bFallEnding; - - int m_crashSphereUsed; // number of spheres used - Math::Vector m_crashSpherePos[50]; - float m_crashSphereRadius[50]; + CInstanceManager* m_iMan; + CEngine* m_engine; + CTerrain* m_terrain; + CCamera* m_camera; + CParticle* m_particule; + CLight* m_light; + CObject* m_object; + CDisplayText* m_displayText; + CRobotMain* m_main; + CSound* m_sound; + + Math::Vector m_pos; // center of the effect + Math::Vector m_posPower; // center of the battery + bool m_bPower; // battery exists? + PyroType m_type; + float m_force; + float m_size; + float m_progress; + float m_speed; + float m_time; + float m_lastParticule; + float m_lastParticuleSmoke; + int m_soundChannel; + + int m_lightRank; + int m_lightOperTotal; + PyroLightOper m_lightOper[10]; + float m_lightHeight; + + ObjectType m_burnType; + int m_burnPartTotal; + PyroBurnPart m_burnPart[10]; + int m_burnKeepPart[10]; + float m_burnFall; + + float m_fallFloor; + float m_fallSpeed; + float m_fallBulletTime; + bool m_bFallEnding; + + int m_crashSphereUsed; // number of spheres used + Math::Vector m_crashSpherePos[50]; + float m_crashSphereRadius[50]; }; }; // namespace Gfx diff --git a/src/graphics/common/terrain.h b/src/graphics/common/terrain.h index 5ccc992..fd9a1a6 100644 --- a/src/graphics/common/terrain.h +++ b/src/graphics/common/terrain.h @@ -31,19 +31,19 @@ class CEngine; class CWater; -const short FLATLIMIT = (5.0f*Math::PI/180.0f); +const short FLATLIMIT = (5.0f*Math::PI/180.0f); enum TerrainRes { - TR_NULL = 0, - TR_STONE = 1, - TR_URANIUM = 2, - TR_POWER = 3, - TR_KEYa = 4, - TR_KEYb = 5, - TR_KEYc = 6, - TR_KEYd = 7, + TR_NULL = 0, + TR_STONE = 1, + TR_URANIUM = 2, + TR_POWER = 3, + TR_KEYa = 4, + TR_KEYb = 5, + TR_KEYc = 6, + TR_KEYd = 7, }; @@ -51,16 +51,16 @@ const short MAXBUILDINGLEVEL = 100; struct BuildingLevel { - Math::Vector center; - float factor; - float min; - float max; - float level; - float height; - float bboxMinX; - float bboxMaxX; - float bboxMinZ; - float bboxMaxZ; + Math::Vector center; + float factor; + float min; + float max; + float level; + float height; + float bboxMinX; + float bboxMaxX; + float bboxMinZ; + float bboxMaxZ; }; @@ -68,17 +68,17 @@ const short MAXMATTERRAIN = 100; struct TerrainMaterial { - short id; - char texName[20]; - float u,v; - float hardness; - char mat[4]; // up, right, down, left + short id; + char texName[20]; + float u,v; + float hardness; + char mat[4]; // up, right, down, left }; struct DotLevel { - short id; - char mat[4]; // up, right, down, left + short id; + char mat[4]; // up, right, down, left }; @@ -86,10 +86,10 @@ const short MAXFLYINGLIMIT = 10; struct FlyingLimit { - Math::Vector center; - float extRadius; - float intRadius; - float maxHeight; + Math::Vector center; + float extRadius; + float intRadius; + float maxHeight; }; @@ -97,115 +97,115 @@ struct FlyingLimit class CTerrain { public: - CTerrain(CInstanceManager* iMan); - ~CTerrain(); - - bool Generate(int mosaic, int brickP2, float size, float vision, int depth, float hardness); - bool InitTextures(char* baseName, int* table, int dx, int dy); - void LevelFlush(); - bool LevelMaterial(int id, char* baseName, float u, float v, int up, int right, int down, int left, float hardness); - bool LevelInit(int id); - bool LevelGenerate(int *id, float min, float max, float slope, float freq, Math::Vector center, float radius); - void FlushRelief(); - bool ReliefFromBMP(const char* filename, float scaleRelief, bool adjustBorder); - bool ReliefFromDXF(const char* filename, float scaleRelief); - bool ResFromBMP(const char* filename); - bool CreateObjects(bool bMultiRes); - bool Terraform(const Math::Vector &p1, const Math::Vector &p2, float height); - - void SetWind(Math::Vector speed); - Math::Vector RetWind(); - - float RetFineSlope(const Math::Vector &pos); - float RetCoarseSlope(const Math::Vector &pos); - bool GetNormal(Math::Vector &n, const Math::Vector &p); - float RetFloorLevel(const Math::Vector &p, bool bBrut=false, bool bWater=false); - float RetFloorHeight(const Math::Vector &p, bool bBrut=false, bool bWater=false); - bool MoveOnFloor(Math::Vector &p, bool bBrut=false, bool bWater=false); - bool ValidPosition(Math::Vector &p, float marging); - TerrainRes RetResource(const Math::Vector &p); - void LimitPos(Math::Vector &pos); - - void FlushBuildingLevel(); - bool AddBuildingLevel(Math::Vector center, float min, float max, float height, float factor); - bool UpdateBuildingLevel(Math::Vector center); - bool DeleteBuildingLevel(Math::Vector center); - float RetBuildingFactor(const Math::Vector &p); - float RetHardness(const Math::Vector &p); - - int RetMosaic(); - int RetBrick(); - float RetSize(); - float RetScaleRelief(); - - void GroundFlat(Math::Vector pos); - float RetFlatZoneRadius(Math::Vector center, float max); - - void SetFlyingMaxHeight(float height); - float RetFlyingMaxHeight(); - void FlushFlyingLimit(); - bool AddFlyingLimit(Math::Vector center, float extRadius, float intRadius, float maxHeight); - float RetFlyingLimit(Math::Vector pos, bool bNoLimit); + CTerrain(CInstanceManager* iMan); + ~CTerrain(); + + bool Generate(int mosaic, int brickP2, float size, float vision, int depth, float hardness); + bool InitTextures(char* baseName, int* table, int dx, int dy); + void LevelFlush(); + bool LevelMaterial(int id, char* baseName, float u, float v, int up, int right, int down, int left, float hardness); + bool LevelInit(int id); + bool LevelGenerate(int *id, float min, float max, float slope, float freq, Math::Vector center, float radius); + void FlushRelief(); + bool ReliefFromBMP(const char* filename, float scaleRelief, bool adjustBorder); + bool ReliefFromDXF(const char* filename, float scaleRelief); + bool ResFromBMP(const char* filename); + bool CreateObjects(bool bMultiRes); + bool Terraform(const Math::Vector &p1, const Math::Vector &p2, float height); + + void SetWind(Math::Vector speed); + Math::Vector RetWind(); + + float RetFineSlope(const Math::Vector &pos); + float RetCoarseSlope(const Math::Vector &pos); + bool GetNormal(Math::Vector &n, const Math::Vector &p); + float RetFloorLevel(const Math::Vector &p, bool bBrut=false, bool bWater=false); + float RetFloorHeight(const Math::Vector &p, bool bBrut=false, bool bWater=false); + bool MoveOnFloor(Math::Vector &p, bool bBrut=false, bool bWater=false); + bool ValidPosition(Math::Vector &p, float marging); + TerrainRes RetResource(const Math::Vector &p); + void LimitPos(Math::Vector &pos); + + void FlushBuildingLevel(); + bool AddBuildingLevel(Math::Vector center, float min, float max, float height, float factor); + bool UpdateBuildingLevel(Math::Vector center); + bool DeleteBuildingLevel(Math::Vector center); + float RetBuildingFactor(const Math::Vector &p); + float RetHardness(const Math::Vector &p); + + int RetMosaic(); + int RetBrick(); + float RetSize(); + float RetScaleRelief(); + + void GroundFlat(Math::Vector pos); + float RetFlatZoneRadius(Math::Vector center, float max); + + void SetFlyingMaxHeight(float height); + float RetFlyingMaxHeight(); + void FlushFlyingLimit(); + bool AddFlyingLimit(Math::Vector center, float extRadius, float intRadius, float maxHeight); + float RetFlyingLimit(Math::Vector pos, bool bNoLimit); protected: - bool ReliefAddDot(Math::Vector pos, float scaleRelief); - void AdjustRelief(); - Math::Vector RetVector(int x, int y); - Gfx::VertexTex2 RetVertex(int x, int y, int step); - bool CreateMosaic(int ox, int oy, int step, int objRank, const Gfx::Material &mat, float min, float max); - bool CreateSquare(bool bMultiRes, int x, int y); - - TerrainMaterial* LevelSearchMat(int id); - void LevelTextureName(int x, int y, char *name, Math::Point &uv); - float LevelRetHeight(int x, int y); - bool LevelGetDot(int x, int y, float min, float max, float slope); - int LevelTestMat(char *mat); - void LevelSetDot(int x, int y, int id, char *mat); - bool LevelIfDot(int x, int y, int id, char *mat); - bool LevelPutDot(int x, int y, int id); - void LevelOpenTable(); - void LevelCloseTable(); - - void AdjustBuildingLevel(Math::Vector &p); + bool ReliefAddDot(Math::Vector pos, float scaleRelief); + void AdjustRelief(); + Math::Vector RetVector(int x, int y); + Gfx::VertexTex2 RetVertex(int x, int y, int step); + bool CreateMosaic(int ox, int oy, int step, int objRank, const Gfx::Material &mat, float min, float max); + bool CreateSquare(bool bMultiRes, int x, int y); + + TerrainMaterial* LevelSearchMat(int id); + void LevelTextureName(int x, int y, char *name, Math::Point &uv); + float LevelRetHeight(int x, int y); + bool LevelGetDot(int x, int y, float min, float max, float slope); + int LevelTestMat(char *mat); + void LevelSetDot(int x, int y, int id, char *mat); + bool LevelIfDot(int x, int y, int id, char *mat); + bool LevelPutDot(int x, int y, int id); + void LevelOpenTable(); + void LevelCloseTable(); + + void AdjustBuildingLevel(Math::Vector &p); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CWater* m_water; - - int m_mosaic; // number of mosaics - int m_brick; // number of bricks per mosaics - float m_size; // size of an item in an brick - float m_vision; // vision before a change of resolution - float* m_relief; // table of the relief - int* m_texture; // table of textures - int* m_objRank; // table of rows of objects - bool m_bMultiText; - bool m_bLevelText; - float m_scaleMapping; // scale of the mapping - float m_scaleRelief; - int m_subdivMapping; - int m_depth; // number of different resolutions (1,2,3,4) - char m_texBaseName[20]; - char m_texBaseExt[10]; - float m_defHardness; - - TerrainMaterial m_levelMat[MAXMATTERRAIN+1]; - int m_levelMatTotal; - int m_levelMatMax; - int m_levelDotSize; - DotLevel* m_levelDot; - int m_levelID; - - int m_buildingUsed; - BuildingLevel m_buildingTable[MAXBUILDINGLEVEL]; - - unsigned char* m_resources; - Math::Vector m_wind; // wind speed - - float m_flyingMaxHeight; - int m_flyingLimitTotal; - FlyingLimit m_flyingLimit[MAXFLYINGLIMIT]; + CInstanceManager* m_iMan; + CEngine* m_engine; + CWater* m_water; + + int m_mosaic; // number of mosaics + int m_brick; // number of bricks per mosaics + float m_size; // size of an item in an brick + float m_vision; // vision before a change of resolution + float* m_relief; // table of the relief + int* m_texture; // table of textures + int* m_objRank; // table of rows of objects + bool m_bMultiText; + bool m_bLevelText; + float m_scaleMapping; // scale of the mapping + float m_scaleRelief; + int m_subdivMapping; + int m_depth; // number of different resolutions (1,2,3,4) + char m_texBaseName[20]; + char m_texBaseExt[10]; + float m_defHardness; + + TerrainMaterial m_levelMat[MAXMATTERRAIN+1]; + int m_levelMatTotal; + int m_levelMatMax; + int m_levelDotSize; + DotLevel* m_levelDot; + int m_levelID; + + int m_buildingUsed; + BuildingLevel m_buildingTable[MAXBUILDINGLEVEL]; + + unsigned char* m_resources; + Math::Vector m_wind; // wind speed + + float m_flyingMaxHeight; + int m_flyingLimitTotal; + FlyingLimit m_flyingLimit[MAXFLYINGLIMIT]; }; }; // namespace Gfx diff --git a/src/graphics/common/text.h b/src/graphics/common/text.h index 65b6772..00b73f2 100644 --- a/src/graphics/common/text.h +++ b/src/graphics/common/text.h @@ -38,27 +38,27 @@ const float NORMSTRETCH = 0.8f; enum FontType { - FONT_COLOBOT = 0, - FONT_COURIER = 1, - FONT_BUTTON = 2, + FONT_COLOBOT = 0, + FONT_COURIER = 1, + FONT_BUTTON = 2, }; enum FontTitle { - TITLE_BIG = 0x04, - TITLE_NORM = 0x08, - TITLE_LITTLE = 0x0c, + TITLE_BIG = 0x04, + TITLE_NORM = 0x08, + TITLE_LITTLE = 0x0c, }; enum FontColor { - COLOR_LINK = 0x10, - COLOR_TOKEN = 0x20, - COLOR_TYPE = 0x30, - COLOR_CONST = 0x40, - COLOR_REM = 0x50, - COLOR_KEY = 0x60, - COLOR_TABLE = 0x70, + COLOR_LINK = 0x10, + COLOR_TOKEN = 0x20, + COLOR_TYPE = 0x30, + COLOR_CONST = 0x40, + COLOR_REM = 0x50, + COLOR_KEY = 0x60, + COLOR_TABLE = 0x70, }; const short FONT_MASK = 0x03; @@ -70,43 +70,43 @@ const short IMAGE_MASK = 0x80; class CText { public: - CText(CInstanceManager *iMan, Gfx::CEngine* engine); - ~CText(); + CText(CInstanceManager *iMan, Gfx::CEngine* engine); + ~CText(); - void SetGLDevice(Gfx::CDevice device); + void SetGLDevice(Gfx::CDevice device); - void DrawText(char *string, char *format, int len, Math::Point pos, float width, int justif, float size, float stretch, int eol); - void DrawText(char *string, char *format, Math::Point pos, float width, int justif, float size, float stretch, int eol); - void DrawText(char *string, int len, Math::Point pos, float width, int justif, float size, float stretch, FontType font, int eol); - void DrawText(char *string, Math::Point pos, float width, int justif, float size, float stretch, FontType font, int eol); - void DimText(char *string, char *format, int len, Math::Point pos, int justif, float size, float stretch, Math::Point &start, Math::Point &end); - void DimText(char *string, char *format, Math::Point pos, int justif, float size, float stretch, Math::Point &start, Math::Point &end); - void DimText(char *string, int len, Math::Point pos, int justif, float size, float stretch, FontType font, Math::Point &start, Math::Point &end); - void DimText(char *string, Math::Point pos, int justif, float size, float stretch, FontType font, Math::Point &start, Math::Point &end); + void DrawText(char *string, char *format, int len, Math::Point pos, float width, int justif, float size, float stretch, int eol); + void DrawText(char *string, char *format, Math::Point pos, float width, int justif, float size, float stretch, int eol); + void DrawText(char *string, int len, Math::Point pos, float width, int justif, float size, float stretch, FontType font, int eol); + void DrawText(char *string, Math::Point pos, float width, int justif, float size, float stretch, FontType font, int eol); + void DimText(char *string, char *format, int len, Math::Point pos, int justif, float size, float stretch, Math::Point &start, Math::Point &end); + void DimText(char *string, char *format, Math::Point pos, int justif, float size, float stretch, Math::Point &start, Math::Point &end); + void DimText(char *string, int len, Math::Point pos, int justif, float size, float stretch, FontType font, Math::Point &start, Math::Point &end); + void DimText(char *string, Math::Point pos, int justif, float size, float stretch, FontType font, Math::Point &start, Math::Point &end); - float RetAscent(float size, FontType font); - float RetDescent(float size, FontType font); - float RetHeight(float size, FontType font); + float RetAscent(float size, FontType font); + float RetDescent(float size, FontType font); + float RetHeight(float size, FontType font); - float RetStringWidth(char *string, char *format, int len, float size, float stretch); - float RetStringWidth(char *string, int len, float size, float stretch, FontType font); - float RetCharWidth(int character, float offset, float size, float stretch, FontType font); + float RetStringWidth(char *string, char *format, int len, float size, float stretch); + float RetStringWidth(char *string, int len, float size, float stretch, FontType font); + float RetCharWidth(int character, float offset, float size, float stretch, FontType font); - int Justif(char *string, char *format, int len, float width, float size, float stretch); - int Justif(char *string, int len, float width, float size, float stretch, FontType font); - int Detect(char *string, char *format, int len, float offset, float size, float stretch); - int Detect(char *string, int len, float offset, float size, float stretch, FontType font); + int Justif(char *string, char *format, int len, float width, float size, float stretch); + int Justif(char *string, int len, float width, float size, float stretch, FontType font); + int Detect(char *string, char *format, int len, float offset, float size, float stretch); + int Detect(char *string, int len, float offset, float size, float stretch, FontType font); protected: - void DrawString(char *string, char *format, int len, Math::Point pos, float width, float size, float stretch, int eol); - void DrawString(char *string, int len, Math::Point pos, float width, float size, float stretch, FontType font, int eol); - void DrawColor(Math::Point pos, float size, float width, int color); - void DrawChar(int character, Math::Point pos, float size, float stretch, FontType font); + void DrawString(char *string, char *format, int len, Math::Point pos, float width, float size, float stretch, int eol); + void DrawString(char *string, int len, Math::Point pos, float width, float size, float stretch, FontType font, int eol); + void DrawColor(Math::Point pos, float size, float width, int color); + void DrawChar(int character, Math::Point pos, float size, float stretch, FontType font); protected: - CInstanceManager* m_iMan; - Gfx::CEngine* m_engine; - Gfx::CDevice m_pDevice; + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + Gfx::CDevice m_pDevice; }; diff --git a/src/graphics/common/vertex.h b/src/graphics/common/vertex.h index 9368b4b..b620413 100644 --- a/src/graphics/common/vertex.h +++ b/src/graphics/common/vertex.h @@ -36,14 +36,14 @@ namespace Gfx { */ struct Vertex { - Math::Vector coord; - Math::Vector normal; - Math::Point texCoord; + Math::Vector coord; + Math::Vector normal; + Math::Point texCoord; - Vertex(Math::Vector aCoord = Math::Vector(), - Math::Vector aNormal = Math::Vector(), - Math::Point aTexCoord = Math::Point()) - : coord(aCoord), normal(aNormal), texCoord(aTexCoord) {} + Vertex(Math::Vector aCoord = Math::Vector(), + Math::Vector aNormal = Math::Vector(), + Math::Point aTexCoord = Math::Point()) + : coord(aCoord), normal(aNormal), texCoord(aTexCoord) {} }; /** @@ -54,13 +54,13 @@ struct Vertex */ struct VertexTex2 : public Gfx::Vertex { - Math::Point texCoord2; + Math::Point texCoord2; - VertexTex2(Math::Vector aCoord = Math::Vector(), - Math::Vector aNormal = Math::Vector(), - Math::Point aTexCoord = Math::Point(), - Math::Point aTexCoord2 = Math::Point()) - : Vertex(aCoord, aNormal, aTexCoord), texCoord2(aTexCoord2) {} + VertexTex2(Math::Vector aCoord = Math::Vector(), + Math::Vector aNormal = Math::Vector(), + Math::Point aTexCoord = Math::Point(), + Math::Point aTexCoord2 = Math::Point()) + : Vertex(aCoord, aNormal, aTexCoord), texCoord2(aTexCoord2) {} }; }; // namespace Gfx diff --git a/src/graphics/common/water.h b/src/graphics/common/water.h index aaf5ec9..5999eac 100644 --- a/src/graphics/common/water.h +++ b/src/graphics/common/water.h @@ -37,9 +37,9 @@ const short MAXWATERLINE = 500; struct WaterLine { - short x, y; // beginning - short len; // length by x - float px1, px2, pz; + short x, y; // beginning + short len; // length by x + float px1, px2, pz; }; @@ -47,88 +47,88 @@ const short MAXWATVAPOR = 10; struct WaterVapor { - bool bUsed; - ParticuleType type; - Math::Vector pos; - float delay; - float time; - float last; + bool bUsed; + ParticuleType type; + Math::Vector pos; + float delay; + float time; + float last; }; enum WaterType { - WATER_NULL = 0, // no water - WATER_TT = 1, // transparent texture - WATER_TO = 2, // opaque texture - WATER_CT = 3, // transparent color - WATER_CO = 4, // opaque color + WATER_NULL = 0, // no water + WATER_TT = 1, // transparent texture + WATER_TO = 2, // opaque texture + WATER_CT = 3, // transparent color + WATER_CO = 4, // opaque color }; class CWater { public: - CWater(CInstanceManager* iMan, Gfx::CEngine* engine); - ~CWater(); + CWater(CInstanceManager* iMan, Gfx::CEngine* engine); + ~CWater(); - void SetGLDevice(Gfx::CDevice device); - bool EventProcess(const Event &event); - void Flush(); - bool Create(WaterType type1, WaterType type2, const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level, float glint, Math::Vector eddy); - void DrawBack(); - void DrawSurf(); + void SetGLDevice(Gfx::CDevice device); + bool EventProcess(const Event &event); + void Flush(); + bool Create(WaterType type1, WaterType type2, const char *filename, Gfx::Color diffuse, Gfx::Color ambient, float level, float glint, Math::Vector eddy); + void DrawBack(); + void DrawSurf(); - bool SetLevel(float level); - float RetLevel(); - float RetLevel(CObject* object); + bool SetLevel(float level); + float RetLevel(); + float RetLevel(CObject* object); - void SetLava(bool bLava); - bool RetLava(); + void SetLava(bool bLava); + bool RetLava(); - void AdjustEye(Math::Vector &eye); + void AdjustEye(Math::Vector &eye); protected: - bool EventFrame(const Event &event); - void LavaFrame(float rTime); - void AdjustLevel(Math::Vector &pos, Math::Vector &norm, Math::Point &uv1, Math::Point &uv2); - bool RetWater(int x, int y); - bool CreateLine(int x, int y, int len); + bool EventFrame(const Event &event); + void LavaFrame(float rTime); + void AdjustLevel(Math::Vector &pos, Math::Vector &norm, Math::Point &uv1, Math::Point &uv2); + bool RetWater(int x, int y); + bool CreateLine(int x, int y, int len); - void VaporFlush(); - bool VaporCreate(ParticuleType type, Math::Vector pos, float delay); - void VaporFrame(int i, float rTime); + void VaporFlush(); + bool VaporCreate(ParticuleType type, Math::Vector pos, float delay); + void VaporFrame(int i, float rTime); protected: - CInstanceManager* m_iMan; - CEngine* m_engine; - CDevice* m_pDevice; - CTerrain* m_terrain; - CParticle* m_particule; - CSound* m_sound; - - WaterType m_type[2]; - char m_filename[100]; - float m_level; // overall level - float m_glint; // amplitude of reflections - Math::Vector m_eddy; // amplitude of swirls - Gfx::Color m_diffuse; // diffuse color - Gfx::Color m_ambient; // ambient color - float m_time; - float m_lastLava; - int m_subdiv; - - int m_brick; // number of brick*mosaics - float m_size; // size of a item in an brick - - int m_lineUsed; - WaterLine m_line[MAXWATERLINE]; - - WaterVapor m_vapor[MAXWATVAPOR]; - - bool m_bDraw; - bool m_bLava; - long m_color; + CInstanceManager* m_iMan; + CEngine* m_engine; + CDevice* m_pDevice; + CTerrain* m_terrain; + CParticle* m_particule; + CSound* m_sound; + + WaterType m_type[2]; + char m_filename[100]; + float m_level; // overall level + float m_glint; // amplitude of reflections + Math::Vector m_eddy; // amplitude of swirls + Gfx::Color m_diffuse; // diffuse color + Gfx::Color m_ambient; // ambient color + float m_time; + float m_lastLava; + int m_subdiv; + + int m_brick; // number of brick*mosaics + float m_size; // size of a item in an brick + + int m_lineUsed; + WaterLine m_line[MAXWATERLINE]; + + WaterVapor m_vapor[MAXWATVAPOR]; + + bool m_bDraw; + bool m_bLava; + long m_color; }; }; // namespace Gfx -- cgit v1.2.3-1-g7c22