mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
[cocos2d-objc] Fixed culling of attachments in SkeletonRenderer.m. See #1418.
This commit is contained in:
parent
3432d16374
commit
3f412f1f4d
@ -270,10 +270,22 @@ static bool handlerQueued = false;
|
||||
}
|
||||
self.texture = texture;
|
||||
CGSize size = texture.contentSize;
|
||||
GLKVector2 center = GLKVector2Make(size.width / 2.0, size.height / 2.0);
|
||||
GLKVector2 extents = GLKVector2Make(size.width / 2.0, size.height / 2.0);
|
||||
if (_skipVisibilityCheck || CCRenderCheckVisbility(transform, center, extents)) {
|
||||
|
||||
|
||||
bool isVisible = true;
|
||||
if (!_skipVisibilityCheck) {
|
||||
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
|
||||
for (int i = 0; i < verticesCount * 2; i+=2) {
|
||||
minX = MIN(vertices[i], minX);
|
||||
maxX = MAX(vertices[i], maxX);
|
||||
minY = MIN(vertices[i+1], minY);
|
||||
maxY = MAX(vertices[i+1], maxY);
|
||||
}
|
||||
GLKVector2 center = GLKVector2Make((maxX - minX) / 2, (maxY - minY) / 2);
|
||||
GLKVector2 extents = GLKVector2Make((maxX - minX), (maxY - minY));
|
||||
isVisible = CCRenderCheckVisbility(transform, center, extents);
|
||||
}
|
||||
|
||||
if (isVisible) {
|
||||
if (spSkeletonClipping_isClipping(_clipper)) {
|
||||
spSkeletonClipping_clipTriangles(_clipper, vertices, verticesCount, triangles, trianglesCount, uvs, 2);
|
||||
vertices = _clipper->clippedVertices->items;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user