summaryrefslogtreecommitdiffstats
path: root/src/water.h
diff options
context:
space:
mode:
authoradiblol <adiblol@1tbps.org>2012-03-08 19:32:05 +0100
committeradiblol <adiblol@1tbps.org>2012-03-08 19:32:05 +0100
commita4c804b49ec872b71bd5a0167c3ad45704a3cc30 (patch)
tree8c931235247d662ca46a99695beb328fdfc8e8a8 /src/water.h
downloadcolobot-a4c804b49ec872b71bd5a0167c3ad45704a3cc30.tar.gz
colobot-a4c804b49ec872b71bd5a0167c3ad45704a3cc30.tar.bz2
colobot-a4c804b49ec872b71bd5a0167c3ad45704a3cc30.zip
Initial commit, Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
Diffstat (limited to 'src/water.h')
-rw-r--r--src/water.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/water.h b/src/water.h
new file mode 100644
index 0000000..f5751ae
--- /dev/null
+++ b/src/water.h
@@ -0,0 +1,118 @@
+// water.h
+
+#ifndef _WATER_H_
+#define _WATER_H_
+
+
+class CInstanceManager;
+class CD3DEngine;
+class CTerrain;
+class CParticule;
+class CSound;
+
+enum ParticuleType;
+
+
+
+#define MAXWATERLINE 500
+
+typedef struct
+{
+ short x, y; // début
+ short len; // longueur en x
+ float px1, px2, pz;
+}
+WaterLine;
+
+
+#define MAXWATVAPOR 10
+
+typedef struct
+{
+ BOOL bUsed;
+ ParticuleType type;
+ D3DVECTOR pos;
+ float delay;
+ float time;
+ float last;
+}
+WaterVapor;
+
+
+enum WaterType
+{
+ WATER_NULL = 0, // pas d'eau
+ WATER_TT = 1, // texture transparente
+ WATER_TO = 2, // texture opaque
+ WATER_CT = 3, // couleur transparente
+ WATER_CO = 4, // couleur opaque
+};
+
+
+class CWater
+{
+public:
+ CWater(CInstanceManager* iMan, CD3DEngine* engine);
+ ~CWater();
+
+ void SetD3DDevice(LPDIRECT3DDEVICE7 device);
+ BOOL EventProcess(const Event &event);
+ void Flush();
+ BOOL Create(WaterType type1, WaterType type2, const char *filename, D3DCOLORVALUE diffuse, D3DCOLORVALUE ambient, float level, float glint, D3DVECTOR eddy);
+ void DrawBack();
+ void DrawSurf();
+
+ BOOL SetLevel(float level);
+ float RetLevel();
+ float RetLevel(CObject* object);
+
+ void SetLava(BOOL bLava);
+ BOOL RetLava();
+
+ void AdjustEye(D3DVECTOR &eye);
+
+protected:
+ BOOL EventFrame(const Event &event);
+ void LavaFrame(float rTime);
+ void AdjustLevel(D3DVECTOR &pos, D3DVECTOR &norm, FPOINT &uv1, FPOINT &uv2);
+ BOOL RetWater(int x, int y);
+ BOOL CreateLine(int x, int y, int len);
+
+ void VaporFlush();
+ BOOL VaporCreate(ParticuleType type, D3DVECTOR pos, float delay);
+ void VaporFrame(int i, float rTime);
+
+protected:
+ CInstanceManager* m_iMan;
+ CD3DEngine* m_engine;
+ LPDIRECT3DDEVICE7 m_pD3DDevice;
+ CTerrain* m_terrain;
+ CParticule* m_particule;
+ CSound* m_sound;
+
+ WaterType m_type[2];
+ char m_filename[100];
+ float m_level; // niveau global
+ float m_glint; // amplitude des reflets
+ D3DVECTOR m_eddy; // amplitude des remous
+ D3DCOLORVALUE m_diffuse; // couleur diffuse
+ D3DCOLORVALUE m_ambient; // couleur ambiante
+ float m_time;
+ float m_lastLava;
+ int m_subdiv;
+
+ int m_brick; // nb de briques*mosaïque
+ float m_size; // taille d'un élément dans une brique
+
+ int m_lineUsed;
+ WaterLine m_line[MAXWATERLINE];
+
+ WaterVapor m_vapor[MAXWATVAPOR];
+
+ BOOL m_bDraw;
+ BOOL m_bLava;
+ D3DCOLOR m_color;
+};
+
+
+#endif //_WATER_H_