mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cocos2dx] Didn't invoke GL program state setup in initialize and setTwoColorTint. See #989
This commit is contained in:
parent
4b2fb3eedf
commit
cdc335d41b
@ -62,7 +62,7 @@
|
||||
* Added support for clipping.
|
||||
* 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 ETC1 support, thanks @halx99!
|
||||
* Added ETC1 alpha support, thanks @halx99! Does not work when two color tint is enabled.
|
||||
|
||||
### Cocos2d-Objc
|
||||
* Fixed renderer to work with 3.6 changes
|
||||
|
||||
@ -68,10 +68,15 @@ void SkeletonRenderer::initialize () {
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
setOpacityModifyRGB(true);
|
||||
|
||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
||||
setupGLProgramState(false);
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setupGLProgramState () {
|
||||
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||
if (twoColorTintEnabled) {
|
||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||
return;
|
||||
}
|
||||
|
||||
Texture2D *texture = nullptr;
|
||||
for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
|
||||
spSlot* slot = _skeleton->drawOrder[i];
|
||||
@ -95,7 +100,6 @@ void SkeletonRenderer::setupGLProgramState () {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
||||
}
|
||||
|
||||
@ -737,10 +741,7 @@ bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* a
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setTwoColorTint(bool enabled) {
|
||||
if (enabled)
|
||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||
else
|
||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));
|
||||
setupGLProgramState(enabled);
|
||||
}
|
||||
|
||||
bool SkeletonRenderer::isTwoColorTint() {
|
||||
|
||||
@ -124,11 +124,12 @@ CC_CONSTRUCTOR_ACCESS:
|
||||
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||
|
||||
virtual void initialize ();
|
||||
void setupGLProgramState();
|
||||
|
||||
protected:
|
||||
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
||||
virtual AttachmentVertices* getAttachmentVertices (spRegionAttachment* attachment) const;
|
||||
virtual AttachmentVertices* getAttachmentVertices (spMeshAttachment* attachment) const;
|
||||
virtual AttachmentVertices* getAttachmentVertices (spMeshAttachment* attachment) const;
|
||||
void setupGLProgramState(bool twoColorTintEnabled);
|
||||
|
||||
bool _ownsSkeletonData;
|
||||
spAtlas* _atlas;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user