Use standard library log2f.
This commit is contained in:
parent
1829f6d6a6
commit
22354fd7ce
|
@ -10,6 +10,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <cmath>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#if defined( __unix__ )
|
#if defined( __unix__ )
|
||||||
|
@ -21,11 +22,6 @@
|
||||||
#include "utils/Image_Utils.h"
|
#include "utils/Image_Utils.h"
|
||||||
#include "RawModel.h"
|
#include "RawModel.h"
|
||||||
|
|
||||||
static float Log2f(float f)
|
|
||||||
{
|
|
||||||
return logf(f) * 1.442695041f;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RawVertex::operator==(const RawVertex &other) const
|
bool RawVertex::operator==(const RawVertex &other) const
|
||||||
{
|
{
|
||||||
return (position == other.position) &&
|
return (position == other.position) &&
|
||||||
|
@ -101,7 +97,7 @@ int RawModel::AddTexture(const std::string &name, const std::string &fileName, c
|
||||||
texture.name = name;
|
texture.name = name;
|
||||||
texture.width = properties.width;
|
texture.width = properties.width;
|
||||||
texture.height = properties.height;
|
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.usage = usage;
|
||||||
texture.occlusion = (properties.occlusion == IMAGE_TRANSPARENT) ?
|
texture.occlusion = (properties.occlusion == IMAGE_TRANSPARENT) ?
|
||||||
RAW_TEXTURE_OCCLUSION_TRANSPARENT : RAW_TEXTURE_OCCLUSION_OPAQUE;
|
RAW_TEXTURE_OCCLUSION_TRANSPARENT : RAW_TEXTURE_OCCLUSION_OPAQUE;
|
||||||
|
|
Loading…
Reference in New Issue