diff options
| author | Ray <[email protected]> | 2023-01-24 17:16:44 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-01-24 17:16:44 +0100 |
| commit | 5149da57195df8bfe9adb9717e17043623bc621f (patch) | |
| tree | be6d27968dae65f5a72271304202d855e6d7c1e6 /src | |
| parent | 5b3c5e1a16c2d0f97e407542f1a0837b9d5b7c71 (diff) | |
| parent | 542ef8904a2ce9d87ab53289026da7a715907b87 (diff) | |
| download | raylib-5149da57195df8bfe9adb9717e17043623bc621f.tar.gz raylib-5149da57195df8bfe9adb9717e17043623bc621f.zip | |
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'src')
| -rw-r--r-- | src/raylib.h | 3 | ||||
| -rw-r--r-- | src/rcore.c | 6 | ||||
| -rw-r--r-- | src/rmodels.c | 21 | ||||
| -rw-r--r-- | src/rtext.c | 2 |
4 files changed, 25 insertions, 7 deletions
diff --git a/src/raylib.h b/src/raylib.h index 1c3f7766..10e69acd 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -81,6 +81,9 @@ #include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback +#define RAYLIB_VERSION_MAJOR 4 +#define RAYLIB_VERSION_MINOR 5 +#define RAYLIB_VERSION_PATCH 0 #define RAYLIB_VERSION "4.5-dev" // Function specifiers in case library is build/used as a shared library (Windows) diff --git a/src/rcore.c b/src/rcore.c index 23a6597a..1f97edb2 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -3310,7 +3310,7 @@ unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDa compData = (unsigned char *)RL_CALLOC(bounds, 1); *compDataSize = sdeflate(&sdefl, compData, data, dataSize, COMPRESSION_QUALITY_DEFLATE); // Compression level 8, same as stbwi - TraceLog(LOG_INFO, "SYSTEM: Compress data: Original size: %i -> Comp. size: %i", dataSize, *compDataSize); + TRACELOG(LOG_INFO, "SYSTEM: Compress data: Original size: %i -> Comp. size: %i", dataSize, *compDataSize); #endif return compData; @@ -3335,7 +3335,7 @@ unsigned char *DecompressData(const unsigned char *compData, int compDataSize, i *dataSize = length; - TraceLog(LOG_INFO, "SYSTEM: Decompress data: Comp. size: %i -> Original size: %i", compDataSize, *dataSize); + TRACELOG(LOG_INFO, "SYSTEM: Decompress data: Comp. size: %i -> Original size: %i", compDataSize, *dataSize); #endif return data; @@ -6854,7 +6854,7 @@ static void LoadAutomationEvents(const char *fileName) if ((fileId[0] == 'r') && (fileId[1] == 'E') && (fileId[2] == 'P') && (fileId[1] == ' ')) { fread(&eventCount, sizeof(int), 1, repFile); - TraceLog(LOG_WARNING, "Events loaded: %i\n", eventCount); + TRACELOG(LOG_WARNING, "Events loaded: %i\n", eventCount); fread(events, sizeof(AutomationEvent), eventCount, repFile); } diff --git a/src/rmodels.c b/src/rmodels.c index b500e1e8..91ae68a3 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -3939,12 +3939,12 @@ static Model LoadOBJ(const char *fileName) { model.materialCount = materialCount; model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material)); - TraceLog(LOG_INFO, "MODEL: model has %i material meshes", materialCount); + TRACELOG(LOG_INFO, "MODEL: model has %i material meshes", materialCount); } else { model.meshCount = 1; - TraceLog(LOG_INFO, "MODEL: No materials, putting all meshes in a default material"); + TRACELOG(LOG_INFO, "MODEL: No materials, putting all meshes in a default material"); } model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh)); @@ -4452,6 +4452,12 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, unsigned int unsigned int num_extensions, ofs_extensions; } IQMHeader; + typedef struct IQMJoint { + unsigned int name; + int parent; + float translate[3], rotate[4], scale[3]; + } IQMJoint; + typedef struct IQMPose { int parent; unsigned int mask; @@ -4505,6 +4511,10 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, unsigned int //fread(framedata, iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short), 1, iqmFile); memcpy(framedata, fileDataPtr + iqmHeader->ofs_frames, iqmHeader->num_frames*iqmHeader->num_framechannels*sizeof(unsigned short)); + // joints + IQMJoint *joints = RL_MALLOC(iqmHeader->num_joints*sizeof(IQMJoint)); + memcpy(joints, fileDataPtr + iqmHeader->ofs_joints, iqmHeader->num_joints*sizeof(IQMJoint)); + for (unsigned int a = 0; a < iqmHeader->num_anims; a++) { animations[a].frameCount = anim[a].num_frames; @@ -4515,7 +4525,11 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, unsigned int for (unsigned int j = 0; j < iqmHeader->num_poses; j++) { - strcpy(animations[a].bones[j].name, "ANIMJOINTNAME"); + // If animations and skeleton are in the same file, copy bone names to anim + if (iqmHeader->num_joints > 0) + memcpy(animations[a].bones[j].name, fileDataPtr + iqmHeader->ofs_text + joints[j].name, BONE_NAME_LENGTH*sizeof(char)); + else + strcpy(animations[a].bones[j].name, "ANIMJOINTNAME"); // default bone name otherwise animations[a].bones[j].parent = poses[j].parent; } @@ -4629,6 +4643,7 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, unsigned int RL_FREE(fileData); + RL_FREE(joints); RL_FREE(framedata); RL_FREE(poses); RL_FREE(anim); diff --git a/src/rtext.c b/src/rtext.c index f9838670..718fda04 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -669,7 +669,7 @@ Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **charRecs, int glyphC if (chars == NULL) { - TraceLog(LOG_WARNING, "FONT: Provided chars info not valid, returning empty image atlas"); + TRACELOG(LOG_WARNING, "FONT: Provided chars info not valid, returning empty image atlas"); return atlas; } |
