2006-01-07 02:04:26 +01:00
|
|
|
/**
|
|
|
|
* =========================================================================
|
|
|
|
* File : WaterManager.h
|
|
|
|
* Project : Pyrogenesis
|
|
|
|
* Description : Water settings (speed, height) and texture management
|
|
|
|
*
|
2006-07-26 16:04:52 +02:00
|
|
|
* @author Nicolai Haehnle <nicolai@wildfiregames.com>
|
2006-01-07 02:04:26 +01:00
|
|
|
* =========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WATERMANAGER_H
|
|
|
|
#define WATERMANAGER_H
|
|
|
|
|
|
|
|
#include "ps/Overlay.h"
|
2006-05-28 04:13:32 +02:00
|
|
|
#include "maths/Matrix3D.h"
|
2006-06-11 09:03:59 +02:00
|
|
|
#include "lib/ogl.h"
|
2006-01-07 02:04:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WaterManager: Maintain water settings and textures.
|
|
|
|
*
|
|
|
|
* This could be extended to provide more advanced water rendering effects
|
|
|
|
* (refractive/reflective water) in the future.
|
|
|
|
*/
|
|
|
|
class WaterManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Handle m_WaterTexture[60];
|
2006-05-25 07:46:17 +02:00
|
|
|
Handle m_NormalMap[60];
|
2006-05-28 04:13:32 +02:00
|
|
|
|
2006-01-07 02:04:26 +01:00
|
|
|
int m_WaterCurrentTex;
|
|
|
|
CColor m_WaterColor;
|
|
|
|
bool m_RenderWater;
|
|
|
|
bool m_WaterScroll;
|
|
|
|
float m_WaterHeight;
|
|
|
|
float m_WaterMaxAlpha;
|
|
|
|
float m_WaterFullDepth;
|
|
|
|
float m_WaterAlphaOffset;
|
|
|
|
|
|
|
|
float m_SWaterSpeed;
|
|
|
|
float m_TWaterSpeed;
|
|
|
|
float m_SWaterTrans;
|
|
|
|
float m_TWaterTrans;
|
|
|
|
float m_SWaterScrollCounter;
|
|
|
|
float m_TWaterScrollCounter;
|
2006-03-14 22:29:19 +01:00
|
|
|
double m_WaterTexTimer;
|
2006-01-07 02:04:26 +01:00
|
|
|
|
2006-05-28 23:58:56 +02:00
|
|
|
// Reflection and refraction textures for fancy water
|
|
|
|
GLuint m_ReflectionTexture;
|
|
|
|
GLuint m_RefractionTexture;
|
|
|
|
uint m_ReflectionTextureSize;
|
|
|
|
uint m_RefractionTextureSize;
|
|
|
|
|
|
|
|
// Model-view-projection matrices for reflected & refracted cameras
|
|
|
|
// (used to let the vertex shader do projective texturing)
|
|
|
|
CMatrix3D m_ReflectionMatrix;
|
|
|
|
CMatrix3D m_RefractionMatrix;
|
|
|
|
|
|
|
|
// Shader parameters for fancy water
|
2006-06-22 23:11:18 +02:00
|
|
|
CColor m_WaterTint;
|
2006-05-28 23:58:56 +02:00
|
|
|
float m_RepeatPeriod;
|
|
|
|
float m_Shininess;
|
2006-09-10 07:31:41 +02:00
|
|
|
float m_SpecularStrength;
|
2006-05-28 23:58:56 +02:00
|
|
|
float m_Waviness;
|
2006-06-22 23:11:18 +02:00
|
|
|
float m_Murkiness;
|
2006-09-10 07:31:41 +02:00
|
|
|
CColor m_ReflectionTint;
|
|
|
|
float m_ReflectionTintStrength;
|
2006-05-28 23:58:56 +02:00
|
|
|
|
2006-01-07 02:04:26 +01:00
|
|
|
public:
|
|
|
|
WaterManager();
|
|
|
|
~WaterManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LoadWaterTextures: Load water textures from within the
|
|
|
|
* progressive load framework.
|
|
|
|
*
|
|
|
|
* @return 0 if loading has completed, a value from 1 to 100 (in percent of completion)
|
|
|
|
* if more textures need to be loaded and a negative error value on failure.
|
|
|
|
*/
|
|
|
|
int LoadWaterTextures();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* UnloadWaterTextures: Free any loaded water textures and reset the internal state
|
|
|
|
* so that another call to LoadWaterTextures will begin progressive loading.
|
|
|
|
*/
|
|
|
|
void UnloadWaterTextures();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// State of progressive loading (in # of loaded textures)
|
|
|
|
uint cur_loading_water_tex;
|
2006-05-25 07:46:17 +02:00
|
|
|
uint cur_loading_normal_map;
|
2006-01-07 02:04:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WATERMANAGER_H
|