mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
ac0968b17c
@ -63,6 +63,7 @@
|
|||||||
* Added support for clipping.
|
* Added support for clipping.
|
||||||
* SkeletonRenderer now combines the displayed color of the Node (cascaded from all parents) with the skeleton color for tinting.
|
* SkeletonRenderer now combines the displayed color of the Node (cascaded from all parents) with the skeleton color for tinting.
|
||||||
* Added support for vertex effects. See `RaptorExample.cpp`.
|
* Added support for vertex effects. See `RaptorExample.cpp`.
|
||||||
|
* Added ETC1 support, thanks @halx99!
|
||||||
|
|
||||||
### Cocos2d-Objc
|
### Cocos2d-Objc
|
||||||
* Fixed renderer to work with 3.6 changes
|
* Fixed renderer to work with 3.6 changes
|
||||||
|
|||||||
@ -71,6 +71,34 @@ void SkeletonRenderer::initialize () {
|
|||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonRenderer::setupGLProgramState () {
|
||||||
|
Texture2D *texture = nullptr;
|
||||||
|
for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
|
||||||
|
spSlot* slot = _skeleton->drawOrder[i];
|
||||||
|
if (!slot->attachment) continue;
|
||||||
|
switch (slot->attachment->type) {
|
||||||
|
case SP_ATTACHMENT_REGION: {
|
||||||
|
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
|
||||||
|
texture = static_cast<AttachmentVertices*>(attachment->rendererObject)->_texture;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_ATTACHMENT_MESH: {
|
||||||
|
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
|
||||||
|
texture = static_cast<AttachmentVertices*>(attachment->rendererObject)->_texture;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture != nullptr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
||||||
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setSkeletonData (spSkeletonData *skeletonData, bool ownsSkeletonData) {
|
void SkeletonRenderer::setSkeletonData (spSkeletonData *skeletonData, bool ownsSkeletonData) {
|
||||||
_skeleton = spSkeleton_create(skeletonData);
|
_skeleton = spSkeleton_create(skeletonData);
|
||||||
_ownsSkeletonData = ownsSkeletonData;
|
_ownsSkeletonData = ownsSkeletonData;
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
virtual void update (float deltaTime) override;
|
virtual void update (float deltaTime) override;
|
||||||
virtual void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
|
virtual void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
|
||||||
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
|
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
|
||||||
virtual cocos2d::Rect getBoundingBox () const override;
|
virtual cocos2d::Rect getBoundingBox () const override;
|
||||||
virtual void onEnter () override;
|
virtual void onEnter () override;
|
||||||
virtual void onExit () override;
|
virtual void onExit () override;
|
||||||
@ -104,10 +104,10 @@ public:
|
|||||||
void setVertexEffect(spVertexEffect* effect);
|
void setVertexEffect(spVertexEffect* effect);
|
||||||
|
|
||||||
// --- BlendProtocol
|
// --- BlendProtocol
|
||||||
virtual void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
|
virtual void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
|
||||||
virtual const cocos2d::BlendFunc& getBlendFunc () const override;
|
virtual const cocos2d::BlendFunc& getBlendFunc () const override;
|
||||||
virtual void setOpacityModifyRGB (bool value) override;
|
virtual void setOpacityModifyRGB (bool value) override;
|
||||||
virtual bool isOpacityModifyRGB () const override;
|
virtual bool isOpacityModifyRGB () const override;
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
SkeletonRenderer ();
|
SkeletonRenderer ();
|
||||||
@ -120,11 +120,11 @@ CC_CONSTRUCTOR_ACCESS:
|
|||||||
void initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
void initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
||||||
void initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
void initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
||||||
void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
void initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
void initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
||||||
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
|
||||||
virtual void initialize ();
|
virtual void initialize ();
|
||||||
|
void setupGLProgramState();
|
||||||
protected:
|
protected:
|
||||||
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
||||||
virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const;
|
virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user