Merge branch '4.1' into 4.2-beta

This commit is contained in:
Mario Zechner 2023-02-20 11:32:43 +01:00
commit fc2354dede
3 changed files with 25 additions and 0 deletions

View File

@ -88,6 +88,7 @@
* Support for `shortestRotation` in animation state. See https://github.com/esotericsoftware/spine-runtimes/issues/2027.
* Added CMake parameter `SPINE_SANITIZE` which will enable sanitizers on macOS and Linux.
* Added `SPINE_MAJOR_VERSION`, `SPINE_MINOR_VERSION`, and `SPINE_VERSION_STRING`. Parsing skeleton .JSON and .skel files will report an error if the skeleton version does not match the runtime version.
* Added `SkeletonBounds::getBoundingBox()`, `SkeletonBounds::getPolygons()`, and `SkeletonBounds::getBoundingBoxes()`.
* **Breaking changes**
* `RegionAttachment` and `MeshAttachment` no longer implement `HasRendererObject`.
* `RegionAttachment` and `MeshAttachment` now contain a `TextureRegion*` instead of encoding region fields directly.

View File

@ -81,8 +81,19 @@ namespace spine {
/// Returns true if the polygon contains the line segment.
bool intersectsSegment(Polygon *polygon, float x1, float y1, float x2, float y2);
/// Returns the polygon for the given bounding box attachment or null if no
/// polygon can be found for the attachment. Requires a call to update() first.
Polygon *getPolygon(BoundingBoxAttachment *attachment);
/// Returns the bounding box for the given polygon or null. Requires a call to update() first.
BoundingBoxAttachment * getBoundingBox(Polygon *polygon);
/// Returns all polygons or an empty vector. Requires a call to update() first.
Vector<Polygon *> &getPolygons();
/// Returns all bounding boxes. Requires a call to update() first.
Vector<BoundingBoxAttachment *> &getBoundingBoxes();
float getWidth();
float getHeight();

View File

@ -185,6 +185,19 @@ spine::Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) {
return index == -1 ? NULL : _polygons[index];
}
BoundingBoxAttachment *SkeletonBounds::getBoundingBox(Polygon *polygon) {
int index = _polygons.indexOf(polygon);
return index == -1 ? NULL : _boundingBoxes[index];
}
Vector<Polygon *> &SkeletonBounds::getPolygons() {
return _polygons;
}
Vector<BoundingBoxAttachment *> &SkeletonBounds::getBoundingBoxes() {
return _boundingBoxes;
}
float SkeletonBounds::getWidth() {
return _maxX - _minX;
}