C++ compiler support
This commit is contained in:
parent
f0ffdb33f4
commit
c82802db56
1 changed files with 112 additions and 86 deletions
|
|
@ -5174,7 +5174,7 @@ static cgltf_result LoadFileGLTFCallback(const struct cgltf_memory_options *memo
|
|||
// Release file data callback for cgltf
|
||||
static void ReleaseFileGLTFCallback(const struct cgltf_memory_options *memoryOptions, const struct cgltf_file_options *fileOptions, void *data)
|
||||
{
|
||||
UnloadFileData(data);
|
||||
UnloadFileData((unsigned char*)data);
|
||||
}
|
||||
|
||||
// Load image from different glTF provided methods (uri, path, buffer_view)
|
||||
|
|
@ -5208,7 +5208,11 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
|||
int outSize = numberOfEncodedBits/8 ; // Actual encoded bytes
|
||||
void *data = NULL;
|
||||
|
||||
#ifdef __cplusplus
|
||||
cgltf_options options = {DEFINIT};
|
||||
#else
|
||||
cgltf_options options = { 0 };
|
||||
#endif
|
||||
options.file.read = LoadFileGLTFCallback;
|
||||
options.file.release = ReleaseFileGLTFCallback;
|
||||
cgltf_result result = cgltf_load_buffer_base64(&options, outSize, cgltfImage->uri + i + 1, &data);
|
||||
|
|
@ -5344,7 +5348,11 @@ static Model LoadGLTF(const char *fileName)
|
|||
if (fileData == NULL) return model;
|
||||
|
||||
// glTF data loading
|
||||
#ifdef __cplusplus
|
||||
cgltf_options options = {};
|
||||
#else
|
||||
cgltf_options options = { 0 };
|
||||
#endif
|
||||
options.file.read = LoadFileGLTFCallback;
|
||||
options.file.release = ReleaseFileGLTFCallback;
|
||||
cgltf_data *data = NULL;
|
||||
|
|
@ -6135,7 +6143,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
float tmp[3] = { 0.0f };
|
||||
cgltf_accessor_read_float(output, keyframe, tmp, 3);
|
||||
Vector3 v1 = {tmp[0], tmp[1], tmp[2]};
|
||||
Vector3 *r = data;
|
||||
Vector3 *r = (Vector3 *)data;
|
||||
|
||||
*r = v1;
|
||||
} break;
|
||||
|
|
@ -6146,7 +6154,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
Vector3 v1 = {tmp[0], tmp[1], tmp[2]};
|
||||
cgltf_accessor_read_float(output, keyframe+1, tmp, 3);
|
||||
Vector3 v2 = {tmp[0], tmp[1], tmp[2]};
|
||||
Vector3 *r = data;
|
||||
Vector3 *r = (Vector3*)data;
|
||||
|
||||
*r = Vector3Lerp(v1, v2, t);
|
||||
} break;
|
||||
|
|
@ -6161,7 +6169,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
Vector3 v2 = {tmp[0], tmp[1], tmp[2]};
|
||||
cgltf_accessor_read_float(output, 3*(keyframe+1), tmp, 3);
|
||||
Vector3 tangent2 = {tmp[0], tmp[1], tmp[2]};
|
||||
Vector3 *r = data;
|
||||
Vector3 *r = (Vector3 *)data;
|
||||
|
||||
*r = Vector3CubicHermite(v1, tangent1, v2, tangent2, t);
|
||||
} break;
|
||||
|
|
@ -6178,7 +6186,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
float tmp[4] = { 0.0f };
|
||||
cgltf_accessor_read_float(output, keyframe, tmp, 4);
|
||||
Vector4 v1 = {tmp[0], tmp[1], tmp[2], tmp[3]};
|
||||
Vector4 *r = data;
|
||||
Vector4 *r = (Vector4 *)data;
|
||||
|
||||
*r = v1;
|
||||
} break;
|
||||
|
|
@ -6189,7 +6197,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
Vector4 v1 = {tmp[0], tmp[1], tmp[2], tmp[3]};
|
||||
cgltf_accessor_read_float(output, keyframe+1, tmp, 4);
|
||||
Vector4 v2 = {tmp[0], tmp[1], tmp[2], tmp[3]};
|
||||
Vector4 *r = data;
|
||||
Vector4 *r = (Vector4 *)data;
|
||||
|
||||
*r = QuaternionSlerp(v1, v2, t);
|
||||
} break;
|
||||
|
|
@ -6204,7 +6212,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
Vector4 v2 = {tmp[0], tmp[1], tmp[2], tmp[3]};
|
||||
cgltf_accessor_read_float(output, 3*(keyframe+1), tmp, 4);
|
||||
Vector4 inTangent2 = {tmp[0], tmp[1], tmp[2], 0.0f};
|
||||
Vector4 *r = data;
|
||||
Vector4 *r = (Vector4 *)data;
|
||||
|
||||
v1 = QuaternionNormalize(v1);
|
||||
v2 = QuaternionNormalize(v2);
|
||||
|
|
@ -6237,7 +6245,11 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
|
|||
ModelAnimation *animations = NULL;
|
||||
|
||||
// glTF data loading
|
||||
#ifdef __cplusplus
|
||||
cgltf_options options = {DEFINIT};
|
||||
#else
|
||||
cgltf_options options = { 0 };
|
||||
#endif
|
||||
options.file.read = LoadFileGLTFCallback;
|
||||
options.file.release = ReleaseFileGLTFCallback;
|
||||
cgltf_data *data = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue