Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/renderer/WaterManager.cpp
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2017 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 1,015 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < m_MapSize; ++i) | ||||
{ | { | ||||
Temp[j*m_MapSize + i] = 0.3f; // blurs too strong otherwise | Temp[j*m_MapSize + i] = 0.3f; // blurs too strong otherwise | ||||
continue; | continue; | ||||
} | } | ||||
if (terrain->GetVertexGroundLevel(i + ceil(windDir.X),j + ceil(windDir.Y)) < waterLevel) | if (terrain->GetVertexGroundLevel(i + ceil(windDir.X),j + ceil(windDir.Y)) < waterLevel) | ||||
continue; | continue; | ||||
// Calculate how dampened our waves should be. | // Calculate how dampened our waves should be. | ||||
float tendency = 0.0f; | |||||
float oldHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[4][0],j+kernel[4][1])); | float oldHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[4][0],j+kernel[4][1])); | ||||
float currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[3][0],j+kernel[3][1])); | float currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[3][0],j+kernel[3][1])); | ||||
float avgheight = oldHeight + currentHeight; | float avgheight = oldHeight + currentHeight; | ||||
tendency = currentHeight - oldHeight; | float tendency = currentHeight - oldHeight; | ||||
oldHeight = currentHeight; | oldHeight = currentHeight; | ||||
currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[2][0],j+kernel[2][1])); | currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[2][0],j+kernel[2][1])); | ||||
avgheight += currentHeight; | avgheight += currentHeight; | ||||
tendency += currentHeight - oldHeight; | tendency += currentHeight - oldHeight; | ||||
oldHeight = currentHeight; | oldHeight = currentHeight; | ||||
currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[1][0],j+kernel[1][1])); | currentHeight = std::max(waterLevel,terrain->GetVertexGroundLevel(i+kernel[1][0],j+kernel[1][1])); | ||||
avgheight += currentHeight; | avgheight += currentHeight; | ||||
tendency += currentHeight - oldHeight; | tendency += currentHeight - oldHeight; | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator