From e45cb88eadae8027c51c9415a365fbdddbc57af5 Mon Sep 17 00:00:00 2001 From: Kameiha <2370690566@qq.com> Date: Thu, 27 Apr 2017 10:04:59 +0800 Subject: [PATCH] Support ETC1 Alpha Channel in the Spine Library (#17692) * Update SkeletonBatch.cpp * Update SkeletonBatch.h * Update SkeletonRenderer.cpp --- cocos/editor-support/spine/SkeletonBatch.cpp | 4 ++-- cocos/editor-support/spine/SkeletonBatch.h | 2 +- cocos/editor-support/spine/SkeletonRenderer.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos/editor-support/spine/SkeletonBatch.cpp b/cocos/editor-support/spine/SkeletonBatch.cpp index 42fb983b3a..f635b1059c 100644 --- a/cocos/editor-support/spine/SkeletonBatch.cpp +++ b/cocos/editor-support/spine/SkeletonBatch.cpp @@ -77,7 +77,7 @@ namespace spine { _command = _firstCommand; } - void SkeletonBatch::addCommand (cocos2d::Renderer* renderer, float globalZOrder, GLuint textureID, GLProgramState* glProgramState, + void SkeletonBatch::addCommand (cocos2d::Renderer* renderer, float globalZOrder, Texture2D* texture, GLProgramState* glProgramState, BlendFunc blendFunc, const TrianglesCommand::Triangles& triangles, const Mat4& transform, uint32_t transformFlags ) { if (_command->triangles->verts) { @@ -92,7 +92,7 @@ namespace spine { _command->triangles->indexCount = triangles.indexCount; _command->triangles->indices = triangles.indices; - _command->trianglesCommand->init(globalZOrder, textureID, glProgramState, blendFunc, *_command->triangles, transform); + _command->trianglesCommand->init(globalZOrder, texture, glProgramState, blendFunc, *_command->triangles, transform, transformFlags); renderer->addCommand(_command->trianglesCommand); if (!_command->next) _command->next = new Command(); diff --git a/cocos/editor-support/spine/SkeletonBatch.h b/cocos/editor-support/spine/SkeletonBatch.h index bcdb2c3c75..5995f0f235 100644 --- a/cocos/editor-support/spine/SkeletonBatch.h +++ b/cocos/editor-support/spine/SkeletonBatch.h @@ -44,7 +44,7 @@ namespace spine { void update (float delta); - void addCommand (cocos2d::Renderer* renderer, float globalOrder, GLuint textureID, cocos2d::GLProgramState* glProgramState, + void addCommand (cocos2d::Renderer* renderer, float globalOrder, cocos2d::Texture2D* texture, cocos2d::GLProgramState* glProgramState, cocos2d::BlendFunc blendType, const cocos2d::TrianglesCommand:: Triangles& triangles, const cocos2d::Mat4& mv, uint32_t flags); protected: diff --git a/cocos/editor-support/spine/SkeletonRenderer.cpp b/cocos/editor-support/spine/SkeletonRenderer.cpp index e85cbf3a3b..9e88c14063 100644 --- a/cocos/editor-support/spine/SkeletonRenderer.cpp +++ b/cocos/editor-support/spine/SkeletonRenderer.cpp @@ -252,7 +252,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; } - batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture->getName(), _glProgramState, blendFunc, + batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, *attachmentVertices->_triangles, transform, transformFlags); }