1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/u_water.h"
20 #include "nel/3d/water_pool_manager.h"
21 #include "nel/3d/water_height_map.h"
22 #include "nel/3d/water_model.h"
23 #include "nel/3d/driver_user.h"
32 //===========================================================================
33 UWaterHeightMap
&UWaterHeightMapManager::getWaterHeightMapFromID(uint32 ID
)
35 nlassert(GetWaterPoolManager().hasPool(ID
)); // unknown pool ID!
36 return GetWaterPoolManager().getPoolByID(ID
);
40 //===========================================================================
41 void UWaterHeightMapManager::setBlendFactor(UDriver
*drv
, float value
)
43 NLMISC::clamp(value
, 0.f
, 1.f
);
44 GetWaterPoolManager().setBlendFactor(NLMISC::safe_cast
<CDriverUser
*>(drv
)->getDriver(), value
);
47 //===========================================================================
48 void UWaterHeightMapManager::releaseBlendTextures()
50 GetWaterPoolManager().releaseBlendTextures();
53 //===========================================================================
54 uint32
UWaterInstance::getWaterHeightMapID() const
56 CWaterModel
*object
= getObjectPtr();
57 return object
->getWaterHeightMapID();
61 //===========================================================================
62 float UWaterInstance::getHeightFactor() const
64 CWaterModel
*object
= getObjectPtr();
65 return object
->getHeightFactor();
68 //===========================================================================
69 float UWaterInstance::getHeight(const NLMISC::CVector2f
&pos
)
71 CWaterModel
*object
= getObjectPtr();
72 return object
->getHeight(pos
);
75 //===========================================================================
76 float UWaterInstance::getAttenuatedHeight(const NLMISC::CVector2f
&pos
, const NLMISC::CVector
&viewer
)
78 CWaterModel
*object
= getObjectPtr();
79 return object
->getAttenuatedHeight(pos
, viewer
);