mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated cgltf.
This commit is contained in:
15
3rdparty/cgltf/cgltf_write.h
vendored
15
3rdparty/cgltf/cgltf_write.h
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* cgltf_write - a single-file glTF 2.0 writer written in C99.
|
||||
*
|
||||
* Version: 1.7
|
||||
* Version: 1.8
|
||||
*
|
||||
* Website: https://github.com/jkuhlmann/cgltf
|
||||
*
|
||||
@@ -96,6 +96,13 @@ typedef struct {
|
||||
|
||||
#define CGLTF_MIN(a, b) (a < b ? a : b)
|
||||
|
||||
#ifdef FLT_DECIMAL_DIG
|
||||
// FLT_DECIMAL_DIG is C11
|
||||
#define CGLTF_DECIMAL_DIG (FLT_DECIMAL_DIG)
|
||||
#else
|
||||
#define CGLTF_DECIMAL_DIG 9
|
||||
#endif
|
||||
|
||||
#define CGLTF_SPRINTF(...) { \
|
||||
context->tmp = snprintf ( context->cursor, context->remaining, __VA_ARGS__ ); \
|
||||
context->chars_written += context->tmp; \
|
||||
@@ -224,7 +231,7 @@ static void cgltf_write_floatprop(cgltf_write_context* context, const char* labe
|
||||
{
|
||||
cgltf_write_indent(context);
|
||||
CGLTF_SPRINTF("\"%s\": ", label);
|
||||
CGLTF_SPRINTF("%g", val);
|
||||
CGLTF_SPRINTF("%.*g", CGLTF_DECIMAL_DIG, val);
|
||||
context->needs_comma = 1;
|
||||
|
||||
if (context->cursor)
|
||||
@@ -256,11 +263,11 @@ static void cgltf_write_floatarrayprop(cgltf_write_context* context, const char*
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
CGLTF_SPRINTF(", %g", vals[i]);
|
||||
CGLTF_SPRINTF(", %.*g", CGLTF_DECIMAL_DIG, vals[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGLTF_SPRINTF("%g", vals[i]);
|
||||
CGLTF_SPRINTF("%.*g", CGLTF_DECIMAL_DIG, vals[i]);
|
||||
}
|
||||
}
|
||||
CGLTF_SPRINTF("]");
|
||||
|
||||
Reference in New Issue
Block a user