Use standard library log2f.

This commit is contained in:
Par Winzell 2017-10-27 15:31:21 -07:00
parent 1829f6d6a6
commit 22354fd7ce
1 changed files with 2 additions and 6 deletions

View File

@ -10,6 +10,7 @@
#include <vector>
#include <string>
#include <unordered_map>
#include <cmath>
#include <map>
#if defined( __unix__ )
@ -21,11 +22,6 @@
#include "utils/Image_Utils.h"
#include "RawModel.h"
static float Log2f(float f)
{
return logf(f) * 1.442695041f;
}
bool RawVertex::operator==(const RawVertex &other) const
{
return (position == other.position) &&
@ -101,7 +97,7 @@ int RawModel::AddTexture(const std::string &name, const std::string &fileName, c
texture.name = name;
texture.width = properties.width;
texture.height = properties.height;
texture.mipLevels = (int) ceilf(Log2f(std::max((float) properties.width, (float) properties.height)));
texture.mipLevels = (int) ceilf(log2f(std::max((float) properties.width, (float) properties.height)));
texture.usage = usage;
texture.occlusion = (properties.occlusion == IMAGE_TRANSPARENT) ?
RAW_TEXTURE_OCCLUSION_TRANSPARENT : RAW_TEXTURE_OCCLUSION_OPAQUE;