/*! * @file mapped_water.h * worldentity for flat, cool looking, mapped water */ /*! example input in .oxw file with the standard values 0,0,0 100,100 9 0.08 0,10,0 0 0.25 */ #ifndef _MAPPED_WATER_H #define _MAPPED_WATER_H #include "world_entity.h" #include "material.h" #include "shader.h" class MappedWater : public WorldEntity { public: MappedWater(const TiXmlElement* root = NULL); virtual ~MappedWater(); void loadParams(const TiXmlElement* root); void draw() const; void tick(float dt); // function to prepare renderpaths for creation of refleaction and reflaction textures void activateReflection(); void deactivateReflection(); void activateRefraction(); void deactivateRefraction(); // functions to set parameters for the water, usually they're called through loadparam void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); }; void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); }; void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; }; void setWaterAngle(float angle) { this->waterAngle = angle; }; void setWaterUV(float uv) { this->waterUV = uv; }; void setWaterFlow(float flow) { this->waterFlow = flow; }; void setNormalMapScale(float scale) { this->kNormalMapScale = scale; }; private: void initParams(); void initTextures(); void initShaders(); private: Vector waterPos; //!< position of the water float xWidth, zWidth; //!< size of the water quad Vector lightPos; //!< position of the light that is used to render the reflection float waterAngle; //!< defines how much the water will be turned around the point waterPos float move; //!< textures coords, speeds, positions for the shaded textures.... float move2; float waterUV; //!< size of the waves float waterFlow; //!< speed of the water float normalUV; float kNormalMapScale; int textureSize; //!< height and width of the texture Material mat; Shader* shader; Shader::Uniform* cam_uni; //!< uniform that is used for the camera position }; #endif