mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-18 04:53:06 +01:00
Cleanup.
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
|
||||
namespace bx
|
||||
{
|
||||
/// Reference:
|
||||
/// http://msdn.microsoft.com/en-us/library/a1y7w461.aspx
|
||||
///
|
||||
StringView tokenizeCommandLine(const StringView& _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term = '\0');
|
||||
|
||||
///
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
|
||||
#include "math.h"
|
||||
|
||||
// Reference:
|
||||
// http://easings.net/
|
||||
// http://robertpenner.com/easing/
|
||||
|
||||
namespace bx
|
||||
{
|
||||
///
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
namespace bx
|
||||
{
|
||||
// Reference:
|
||||
// https://web.archive.org/web/20181115035420/http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/
|
||||
// Reference(S):
|
||||
// - https://web.archive.org/web/20181115035420/http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/
|
||||
//
|
||||
template<typename Ty, size_t Num>
|
||||
char(&CountOfRequireArrayArgumentT(const Ty(&)[Num]))[Num];
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
# error "Must be included from bx/easing.h!"
|
||||
#endif // BX_EASING_H_HEADER_GUARD
|
||||
|
||||
// Reference(s):
|
||||
// - https://web.archive.org/web/20181126040153/https://easings.net/
|
||||
// - https://web.archive.org/web/20181126040212/http://robertpenner.com/easing/
|
||||
//
|
||||
namespace bx
|
||||
{
|
||||
template<EaseFn ease>
|
||||
|
||||
@@ -49,8 +49,9 @@ namespace bx
|
||||
|
||||
inline BX_CONST_FUNC uint32_t floatFlip(uint32_t _value)
|
||||
{
|
||||
// Reference:
|
||||
// http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html
|
||||
// Reference(s):
|
||||
// - http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html
|
||||
//
|
||||
const uint32_t tmp0 = uint32_sra(_value, 31);
|
||||
const uint32_t tmp1 = uint32_neg(tmp0);
|
||||
const uint32_t mask = uint32_or(tmp1, 0x80000000);
|
||||
@@ -259,8 +260,9 @@ namespace bx
|
||||
|
||||
inline constexpr BX_CONST_FUNC bool equal(float _a, float _b, float _epsilon)
|
||||
{
|
||||
// Reference:
|
||||
// https://web.archive.org/web/20181103180318/http://realtimecollisiondetection.net/blog/?p=89
|
||||
// Reference(s):
|
||||
// - https://web.archive.org/web/20181103180318/http://realtimecollisiondetection.net/blog/?p=89
|
||||
//
|
||||
const float lhs = abs(_a - _b);
|
||||
const float rhs = _epsilon * max(1.0f, abs(_a), abs(_b) );
|
||||
return lhs <= rhs;
|
||||
@@ -305,6 +307,11 @@ namespace bx
|
||||
|
||||
inline constexpr BX_CONST_FUNC float gain(float _time, float _gain)
|
||||
{
|
||||
// Reference(s):
|
||||
// - Bias And Gain Are Your Friend
|
||||
// https://web.archive.org/web/20181126040535/https://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
|
||||
// https://web.archive.org/web/20181126040558/http://demofox.org/biasgain.html
|
||||
//
|
||||
if (_time < 0.5f)
|
||||
{
|
||||
return bias(_time * 2.0f, _gain) * 0.5f;
|
||||
|
||||
@@ -707,8 +707,9 @@ namespace bx
|
||||
template<int32_t MantissaBits, int32_t ExpBits>
|
||||
inline void encodeRgbE(float* _dst, const float* _src)
|
||||
{
|
||||
// Reference:
|
||||
// https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt
|
||||
// Reference(s):
|
||||
// - https://web.archive.org/web/20181126040035/https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt
|
||||
//
|
||||
const int32_t expMax = (1<<ExpBits) - 1;
|
||||
const int32_t expBias = (1<<(ExpBits - 1) ) - 1;
|
||||
const float sharedExpMax = float(expMax) / float(expMax + 1) * float(1 << (expMax - expBias) );
|
||||
|
||||
@@ -250,10 +250,6 @@ namespace bx
|
||||
///
|
||||
constexpr BX_CONST_FUNC float smoothStep(float _a);
|
||||
|
||||
// References:
|
||||
// - Bias And Gain Are Your Friend
|
||||
// http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
|
||||
// - http://demofox.org/biasgain.html
|
||||
///
|
||||
constexpr BX_CONST_FUNC float bias(float _time, float _bias);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace bx
|
||||
{
|
||||
// Reference:
|
||||
// Reference(s):
|
||||
// - https://web.archive.org/web/20180629044234/https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
|
||||
//
|
||||
StringView tokenizeCommandLine(const StringView& _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term)
|
||||
|
||||
@@ -36,8 +36,9 @@ namespace bx
|
||||
|
||||
static int32_t normalizeFilePath(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
|
||||
{
|
||||
// Reference: Lexical File Names in Plan 9 or Getting Dot-Dot Right
|
||||
// - https://web.archive.org/web/20180629044444/https://9p.io/sys/doc/lexnames.html
|
||||
// Reference(s):
|
||||
// - Lexical File Names in Plan 9 or Getting Dot-Dot Right
|
||||
// https://web.archive.org/web/20180629044444/https://9p.io/sys/doc/lexnames.html
|
||||
|
||||
const int32_t num = strLen(_src, _num);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user