1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Fix double promotion

This commit is contained in:
Filip Gawin 2017-10-20 20:28:15 +02:00 committed by Daniel Evans
parent 43047269ab
commit 512ac6f5ee
7 changed files with 11 additions and 11 deletions

View File

@ -8,7 +8,7 @@ project(OpenRW)
# Global Build Configuration
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DRW_DEBUG=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pthread -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pthread -Wextra -Wpedantic -Wdouble-promotion")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
set(RW_VERBOSE_DEBUG_MESSAGES 1 CACHE BOOL "Print verbose debugging messages")

View File

@ -217,16 +217,16 @@ bool LoaderIDE::load(const std::string &filename, const PedStatsList &stats) {
getline(buffstream, buff, ','); // "Always 0"
getline(buffstream, buff, ',');
node.position.x = atof(buff.c_str()) * 1 / 16.f;
node.position.x = strtof(buff.c_str(), nullptr) / 16.f;
getline(buffstream, buff, ',');
node.position.y = atof(buff.c_str()) * 1 / 16.f;
node.position.y = strtof(buff.c_str(), nullptr) / 16.f;
getline(buffstream, buff, ',');
node.position.z = atof(buff.c_str()) * 1 / 16.f;
node.position.z = strtof(buff.c_str(), nullptr) / 16.f;
getline(buffstream, buff, ',');
node.size = atof(buff.c_str()) * 1 / 16.f;
node.size = strtof(buff.c_str(), nullptr) / 16.f;
getline(buffstream, buff, ',');
node.other_thing = atoi(buff.c_str());

View File

@ -92,7 +92,7 @@ WeatherLoader::WeatherData WeatherLoader::getWeatherData(WeatherCondition cond,
size_t hour = floor(tod);
const WeatherData& x = weather[static_cast<size_t>(cond) + hour];
const WeatherData& y = weather[static_cast<size_t>(cond) + (hour + 1) % 24];
const float a = tod - floor(tod);
const float a = tod - std::floor(tod);
WeatherData data;
MIXPROP(ambientColor);

View File

@ -250,7 +250,7 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
glm::vec3 ambient = weather.ambientColor;
glm::vec3 dynamic = weather.directLightColor;
float theta = (tod / (60.f * 24.f) - 0.5f) * 2 * 3.14159265;
float theta = (tod / (60.f * 24.f) - 0.5f) * 2.f * glm::pi<float>();
glm::vec3 sunDirection{
sin(theta), 0.0, cos(theta),
};

View File

@ -147,7 +147,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
glm::mat4 model;
model = glm::translate(model, glm::vec3(mi.screenPosition, 0.0f));
model = glm::scale(model, glm::vec3(mi.screenSize * 1.07));
model = glm::scale(model, glm::vec3(mi.screenSize * 1.07f));
renderer->setUniform(rectProg, "model", model);
renderer->drawArrays(glm::mat4(), &rect, dp);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE,

View File

@ -12546,7 +12546,7 @@ bool opcode_0424(const ScriptArguments& args) {
@arg arg2
*/
void opcode_0425(const ScriptArguments& args, const ScriptFloat arg1, ScriptFloat& arg2) {
arg2 = arg1 * 3.333333;
arg2 = arg1 * 3.333333f;
RW_UNUSED(args);
}
@ -12640,7 +12640,7 @@ void opcode_042c(const ScriptArguments& args, const ScriptInt arg1) {
@arg arg2
*/
void opcode_042d(const ScriptArguments& args, const ScriptInt arg1, ScriptInt& arg2) {
arg2 = static_cast<ScriptInt>(std::floor(static_cast<ScriptFloat>(arg1) * 3.3333334));
arg2 = static_cast<ScriptInt>(std::floor(static_cast<ScriptFloat>(arg1) * 3.3333334f));
RW_UNUSED(args);
}

View File

@ -48,7 +48,7 @@ void drawMap(ViewCamera& currentView, PlayerController* player,
glm::vec2(ui_outerMargin + ui_mapSize, vp.y - ui_outerMargin);
map.screenPosition = (mapTop + mapBottom) / 2.f;
map.screenSize = ui_mapSize * 0.95;
map.screenSize = ui_mapSize * 0.95f;
render->map.draw(world, map);
}