CWaterSurfaceSceneNode.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __C_WATER_SURFACE_SCENE_NODE_H_INCLUDED__
  5. #define __C_WATER_SURFACE_SCENE_NODE_H_INCLUDED__
  6. #include "CMeshSceneNode.h"
  7. namespace irr
  8. {
  9. namespace scene
  10. {
  11. class CWaterSurfaceSceneNode : public CMeshSceneNode
  12. {
  13. public:
  14. //! constructor
  15. CWaterSurfaceSceneNode(f32 waveHeight, f32 waveSpeed, f32 waveLength,
  16. IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id,
  17. const core::vector3df& position = core::vector3df(0,0,0),
  18. const core::vector3df& rotation = core::vector3df(0,0,0),
  19. const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f));
  20. //! destructor
  21. virtual ~CWaterSurfaceSceneNode();
  22. //! frame registration
  23. virtual void OnRegisterSceneNode();
  24. //! animated update
  25. virtual void OnAnimate(u32 timeMs);
  26. //! Update mesh
  27. virtual void setMesh(IMesh* mesh);
  28. //! Returns type of the scene node
  29. virtual ESCENE_NODE_TYPE getType() const { return ESNT_WATER_SURFACE; }
  30. //! Writes attributes of the scene node.
  31. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
  32. //! Reads attributes of the scene node.
  33. virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
  34. private:
  35. inline f32 addWave(const core::vector3df &source, f32 time) const;
  36. f32 WaveLength;
  37. f32 WaveSpeed;
  38. f32 WaveHeight;
  39. IMesh* OriginalMesh;
  40. };
  41. } // end namespace scene
  42. } // end namespace irr
  43. #endif