Sfoglia il codice sorgente

fixed 8 files out of 2617:

- removed 0 CR characters
 - removed 0 trailing whitespaces
 - replaced 88 tabs with spaces
 - fixed 3 svn:eol-style properties
undefined
Lolbot Sam Hocevar <sam@hocevar.net> 11 anni fa
parent
commit
4e0a9c93db
2 ha cambiato i file con 26 aggiunte e 26 eliminazioni
  1. +3
    -3
      src/lol/gpu/shader.h
  2. +23
    -23
      src/numeric.h

+ 3
- 3
src/lol/gpu/shader.h Vedi File

@@ -125,9 +125,9 @@ struct ShaderAttrib

public:
inline ShaderAttrib() : m_flags((uint64_t)0 - 1) {}
inline bool IsValid() { return m_flags != (uint64_t)0 - 1; }
inline VertexUsage GetUsage() { return VertexUsage((int)(m_flags >> 16) & 0xffff); }
inline int GetIndex() { return (int)(m_flags & 0xffff); }
inline bool IsValid() { return m_flags != (uint64_t)0 - 1; }
inline VertexUsage GetUsage() { return VertexUsage((int)(m_flags >> 16) & 0xffff); }
inline int GetIndex() { return (int)(m_flags & 0xffff); }

private:
uint64_t m_flags;


+ 23
- 23
src/numeric.h Vedi File

@@ -45,41 +45,41 @@ template <typename T1, typename T2, typename Tf> static inline T1 damp(const T1

template< class T > inline void Swap( T& A, T& B )
{
const T Temp = A;
A = B;
B = Temp;
const T Temp = A;
A = B;
B = Temp;
}

//SmoothClamp clamps x in [a - sd, b + sd] and returns a value in [a, b] that is smoothed at the borders.
static inline float SmoothClamp(float &x, float a, float b, float sd)
{
if (b < a)
Swap(a, b);
if (b < a)
Swap(a, b);

float tx = x;
float ta = a - sd;
float tb = b + sd;
if (sd > 0.f)
{
if ((b - a) < 2.f * sd)
sd = .5f * (b - a);
if (sd > 0.f)
{
if ((b - a) < 2.f * sd)
sd = .5f * (b - a);

if (tx < a + sd && tx > a - sd)
{
float t = (tx - a) / sd;
t = 0.25f * (t + 1.0f) * (t + 1.0f);
tx = a + t * sd;
}
else if (tx < b + sd && tx > b - sd)
{
float t = -(tx - b) / sd;
t = 0.25f * (t + 1.0f) * (t + 1.0f);
tx = b - t * sd;
}
}
if (tx < a + sd && tx > a - sd)
{
float t = (tx - a) / sd;
t = 0.25f * (t + 1.0f) * (t + 1.0f);
tx = a + t * sd;
}
else if (tx < b + sd && tx > b - sd)
{
float t = -(tx - b) / sd;
t = 0.25f * (t + 1.0f) * (t + 1.0f);
tx = b - t * sd;
}
}

x = lol::clamp(x, ta, tb);
return lol::clamp(tx, a, b);
return lol::clamp(tx, a, b);
}

} /* namespace lol */


Caricamento…
Annulla
Salva