From 65f01fefb98efbffd23c26bf06e8471f5f039a80 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 30 Jul 2025 00:42:27 +0200 Subject: [PATCH] [cpp] Skeleton::getBounds() without scratch buffers --- spine-cpp/include/spine/Skeleton.h | 10 ++++++++-- spine-cpp/src/spine/Skeleton.cpp | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/spine-cpp/include/spine/Skeleton.h b/spine-cpp/include/spine/Skeleton.h index 302216326..baf5c15ff 100644 --- a/spine-cpp/include/spine/Skeleton.h +++ b/spine-cpp/include/spine/Skeleton.h @@ -241,14 +241,20 @@ namespace spine { return NULL; } + /// Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. + /// @param outX The horizontal distance between the skeleton origin and the left side of the AABB. + /// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB. + /// @param outWidth The width of the AABB + /// @param outHeight The height of the AABB. + void getBounds(float &outX, float &outY, float &outWidth, float &outHeight); + /// Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. /// @param outX The horizontal distance between the skeleton origin and the left side of the AABB. /// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB. /// @param outWidth The width of the AABB /// @param outHeight The height of the AABB. /// @param outVertexBuffer Reference to hold an array of floats. This method will assign it with new floats as needed. - // @param clipping Pointer to a SkeletonClipping instance or NULL. If a clipper is given, clipping attachments will be taken into account. - void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array &outVertexBuffer); + /// @param clipping Pointer to a SkeletonClipping instance or NULL. If a clipper is given, clipping attachments will be taken into account. void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array &outVertexBuffer, SkeletonClipping *clipper); Color &getColor(); diff --git a/spine-cpp/src/spine/Skeleton.cpp b/spine-cpp/src/spine/Skeleton.cpp index 6c9ecf401..c86f72ec0 100644 --- a/spine-cpp/src/spine/Skeleton.cpp +++ b/spine-cpp/src/spine/Skeleton.cpp @@ -367,7 +367,8 @@ Array &Skeleton::getPhysicsConstraints() { return _physics; } -void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array &outVertexBuffer) { +void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight) { + Array outVertexBuffer; getBounds(outX, outY, outWidth, outHeight, outVertexBuffer, NULL); }