mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[cocos2d-x] Added ETC1 support, thanks @halx99. Closes #989
This commit is contained in:
parent
a8f50bdecc
commit
c1538b113b
@ -62,6 +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!
|
||||
|
||||
### Cocos2d-Objc
|
||||
* 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));
|
||||
}
|
||||
|
||||
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) {
|
||||
_skeleton = spSkeleton_create(skeletonData);
|
||||
_ownsSkeletonData = ownsSkeletonData;
|
||||
|
||||
@ -124,7 +124,7 @@ 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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user