@@ -35,11 +35,11 @@ class DebugRecordData | |||
friend class DebugRecord; | |||
private: | |||
char const *path; | |||
ivec2 size; | |||
int fps; | |||
String m_path; | |||
ivec2 m_size; | |||
int m_fps; | |||
#if defined USE_PIPI | |||
pipi_sequence_t *sequence; | |||
pipi_sequence_t *m_sequence; | |||
#endif | |||
}; | |||
@@ -47,16 +47,16 @@ private: | |||
* Public DebugRecord class | |||
*/ | |||
DebugRecord::DebugRecord(char const *path, float fps) | |||
: data(new DebugRecordData()) | |||
DebugRecord::DebugRecord(String const &path, float fps) | |||
: m_data(new DebugRecordData()) | |||
{ | |||
Ticker::StartRecording(); | |||
data->path = strdup(path); | |||
data->size = ivec2::zero; | |||
data->fps = (int)(fps + 0.5f); | |||
m_data->m_path = path; | |||
m_data->m_size = ivec2::zero; | |||
m_data->m_fps = (int)(fps + 0.5f); | |||
#if defined USE_PIPI | |||
data->sequence = nullptr; | |||
m_data->m_sequence = nullptr; | |||
#endif | |||
m_drawgroup = DRAWGROUP_CAPTURE; | |||
@@ -73,26 +73,27 @@ void DebugRecord::TickDraw(float seconds) | |||
ivec2 size = Video::GetSize(); | |||
if (data->size != size) | |||
if (m_data->m_size != size) | |||
{ | |||
data->size = size; | |||
m_data->m_size = size; | |||
#if defined USE_PIPI | |||
if (data->sequence) | |||
pipi_close_sequence(data->sequence); | |||
if (m_data->m_sequence) | |||
pipi_close_sequence(m_data->m_sequence); | |||
data->sequence = pipi_open_sequence(data->path, size.x, size.y, | |||
1 /* RGB */, data->fps, | |||
1, 1, 60 * 1024 * 1024); | |||
m_data->m_sequence = pipi_open_sequence(m_data->m_path, size.x, size.y, | |||
1 /* RGB */, m_data->m_fps, | |||
1, 1, 60 * 1024 * 1024); | |||
#endif | |||
} | |||
#if defined USE_PIPI | |||
if (data->sequence) | |||
if (m_data->m_sequence) | |||
{ | |||
uint32_t *buffer = new uint32_t[size.x * size.y]; | |||
Video::Capture(buffer); | |||
pipi_feed_sequence(data->sequence, (uint8_t *)buffer, size.x, size.y); | |||
pipi_feed_sequence(m_data->m_sequence, (uint8_t *)buffer, | |||
size.x, size.y); | |||
delete[] buffer; | |||
} | |||
#endif | |||
@@ -102,7 +103,7 @@ DebugRecord::~DebugRecord() | |||
{ | |||
Ticker::StopRecording(); | |||
delete data; | |||
delete m_data; | |||
} | |||
} /* namespace lol */ | |||
@@ -26,7 +26,7 @@ class DebugRecordData; | |||
class DebugRecord : public Entity | |||
{ | |||
public: | |||
DebugRecord(char const *path, float fps); | |||
DebugRecord(String const &path, float fps); | |||
virtual ~DebugRecord(); | |||
protected: | |||
@@ -34,7 +34,7 @@ protected: | |||
virtual void TickDraw(float seconds); | |||
private: | |||
DebugRecordData *data; | |||
DebugRecordData *m_data; | |||
}; | |||
} /* namespace lol */ | |||
@@ -584,10 +584,10 @@ vec3 Color::WavelengthToCIExyY(float nm) | |||
if (i < 0 || i > 830 - 360) | |||
return vec3::zero; | |||
float t = nm - i, s = 1.0 - t; | |||
float x = s * cie_1931_xyz[i * 3 + 0] + t * cie_1931_xyz[i * 3 + 3]; | |||
float y = s * cie_1931_xyz[i * 3 + 1] + t * cie_1931_xyz[i * 3 + 4]; | |||
float z = s * cie_1931_xyz[i * 3 + 2] + t * cie_1931_xyz[i * 3 + 5]; | |||
float t = nm - i; | |||
float x = lol::lerp(cie_1931_xyz[i * 3 + 0], cie_1931_xyz[i * 3 + 3], t); | |||
float y = lol::lerp(cie_1931_xyz[i * 3 + 1], cie_1931_xyz[i * 3 + 4], t); | |||
float z = lol::lerp(cie_1931_xyz[i * 3 + 2], cie_1931_xyz[i * 3 + 5], t); | |||
float normalize = 1.f / (x + y + z); | |||
return vec3(x * normalize, y * normalize, 100.0f); | |||
@@ -133,21 +133,36 @@ static inline uint32_t radians(uint32_t x) { return (uint32_t)radians((double)x | |||
static inline int64_t radians(int64_t x) { return (int64_t) radians((ldouble)x); } | |||
static inline uint64_t radians(uint64_t x) { return (uint64_t)radians((ldouble)x); } | |||
static inline float lerp(float const &a, float const &b, float const &x) | |||
static inline float mix(float const &a, float const &b, float const &x) | |||
{ | |||
return a + (b - a) * x; | |||
} | |||
static inline double lerp(double const &a, double const &b, double const &x) | |||
static inline double mix(double const &a, double const &b, double const &x) | |||
{ | |||
return a + (b - a) * x; | |||
} | |||
static inline ldouble lerp(ldouble const &a, ldouble const &b, ldouble const &x) | |||
static inline ldouble mix(ldouble const &a, ldouble const &b, ldouble const &x) | |||
{ | |||
return a + (b - a) * x; | |||
} | |||
/* Inherited from HLSL */ | |||
static inline float lerp(float const &a, float const &b, float const &x) | |||
{ | |||
return mix(a, b, x); | |||
} | |||
static inline double lerp(double const &a, double const &b, double const &x) | |||
{ | |||
return mix(a, b, x); | |||
} | |||
static inline ldouble lerp(ldouble const &a, ldouble const &b, ldouble const &x) | |||
{ | |||
return mix(a, b, x); | |||
} | |||
/* These accelerated functions will be merged into the above, one day */ | |||
double lol_sin(double); | |||
@@ -783,7 +783,8 @@ template<> real gamma(real const &x) | |||
* precision values in order to attain the desired accuracy. It might | |||
* also be useful to sort the ck values by decreasing absolute value | |||
* and do the addition in this order. */ | |||
int a = ceilf(logf(2) / logf(2 * F_PI) * real::BIGITS * real::BIGIT_BITS); | |||
int a = (int)ceilf(logf(2) / logf(2 * F_PI) | |||
* real::BIGITS * real::BIGIT_BITS); | |||
real ret = sqrt(real::R_PI() * 2); | |||
real fact_k_1 = real::R_1(); | |||