[cocos2dx] Fix for tint black in 3.7 branch.

This commit is contained in:
badlogic 2018-08-13 16:47:36 +02:00
parent bd778ba417
commit a6dcbc61e3

View File

@ -57,39 +57,39 @@ using std::max;
namespace spine {
void SkeletonRenderer::destroyScratchBuffers() {
void SkeletonRenderer::destroyScratchBuffers() {
if (worldVertices) {
delete[] worldVertices;
worldVertices = nullptr;
worldVerticesLength = 0;
}
}
}
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
node->autorelease();
return node;
}
}
SkeletonRenderer* SkeletonRenderer::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
SkeletonRenderer* SkeletonRenderer::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
SkeletonRenderer* node = new SkeletonRenderer(skeletonData, ownsSkeletonData);
node->autorelease();
return node;
}
}
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlas, scale);
node->autorelease();
return node;
}
}
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlasFile, scale);
node->autorelease();
return node;
}
}
void SkeletonRenderer::initialize () {
void SkeletonRenderer::initialize () {
if (!worldVertices) {
worldVertices = new float[INITIAL_WORLD_VERTICES_LENGTH];
worldVerticesLength = INITIAL_WORLD_VERTICES_LENGTH;
@ -104,9 +104,9 @@ namespace spine {
spSkeleton_setToSetupPose(_skeleton);
spSkeleton_updateWorldTransform(_skeleton);
}
}
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
if (twoColorTintEnabled) {
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
return;
@ -136,54 +136,136 @@ namespace spine {
}
}
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);
_ownsSkeletonData = ownsSkeletonData;
}
}
SkeletonRenderer::SkeletonRenderer ()
SkeletonRenderer::SkeletonRenderer ()
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _debugMeshes(false), _timeScale(1), _effect(nullptr), _startSlotIndex(-1), _endSlotIndex(-1) {
}
}
SkeletonRenderer::SkeletonRenderer(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData)
SkeletonRenderer::SkeletonRenderer(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData)
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _debugMeshes(false), _timeScale(1), _effect(nullptr), _startSlotIndex(-1), _endSlotIndex(-1) {
initWithSkeleton(skeleton, ownsSkeleton, ownsSkeletonData);
}
}
SkeletonRenderer::SkeletonRenderer (spSkeletonData *skeletonData, bool ownsSkeletonData)
SkeletonRenderer::SkeletonRenderer (spSkeletonData *skeletonData, bool ownsSkeletonData)
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _debugMeshes(false), _timeScale(1), _effect(nullptr), _startSlotIndex(-1), _endSlotIndex(-1) {
initWithData(skeletonData, ownsSkeletonData);
}
}
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _debugMeshes(false), _timeScale(1), _effect(nullptr), _startSlotIndex(-1), _endSlotIndex(-1) {
initWithJsonFile(skeletonDataFile, atlas, scale);
}
}
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _debugMeshes(false), _timeScale(1), _effect(nullptr), _startSlotIndex(-1), _endSlotIndex(-1) {
initWithJsonFile(skeletonDataFile, atlasFile, scale);
}
}
SkeletonRenderer::~SkeletonRenderer () {
SkeletonRenderer::~SkeletonRenderer () {
if (_ownsSkeletonData) spSkeletonData_dispose(_skeleton->data);
if (_ownsSkeleton) spSkeleton_dispose(_skeleton);
if (_atlas) spAtlas_dispose(_atlas);
if (_attachmentLoader) spAttachmentLoader_dispose(_attachmentLoader);
spSkeletonClipping_dispose(_clipper);
}
}
void SkeletonRenderer::initWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
void SkeletonRenderer::initWithSkeleton(spSkeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
_skeleton = skeleton;
_ownsSkeleton = ownsSkeleton;
_ownsSkeletonData = ownsSkeletonData;
initialize();
}
}
void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
_ownsSkeleton = true;
setSkeletonData(skeletonData, ownsSkeletonData);
initialize();
}
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
_atlas = atlas;
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader);
json->scale = scale;
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str());
CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data.");
spSkeletonJson_dispose(json);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
CCASSERT(_atlas, "Error reading atlas file.");
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader);
json->scale = scale;
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str());
CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data file.");
spSkeletonJson_dispose(json);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
_atlas = atlas;
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
binary->scale = scale;
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
spSkeletonBinary_dispose(binary);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
CCASSERT(_atlas, "Error reading atlas file.");
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
binary->scale = scale;
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
spSkeletonBinary_dispose(binary);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::update (float deltaTime) {
Node::update(deltaTime);
if (_ownsSkeleton) spSkeleton_update(_skeleton, deltaTime * _timeScale);
}
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
SkeletonBatch* batch = SkeletonBatch::getInstance();
SkeletonTwoColorBatch* twoColorBatch = SkeletonTwoColorBatch::getInstance();
bool isTwoColorTint = this->isTwoColorTint();
<<<<<<< HEAD
// Early exit if the skeleton is invisible
if (getDisplayedOpacity() == 0 || _skeleton->color.a == 0){
return;
@ -205,150 +287,9 @@ namespace spine {
bool inRange = _startSlotIndex != -1 || _endSlotIndex != -1 ? false : true;
for (int i = 0, n = _skeleton->slotsCount; i < n; ++i) {
spSlot* slot = _skeleton->drawOrder[i];
=======
void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
_ownsSkeleton = true;
setSkeletonData(skeletonData, ownsSkeletonData);
initialize();
}
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
_atlas = atlas;
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
>>>>>>> 3.6
spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader);
json->scale = scale;
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str());
CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data.");
spSkeletonJson_dispose(json);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
CCASSERT(_atlas, "Error reading atlas file.");
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonJson* json = spSkeletonJson_createWithLoader(_attachmentLoader);
json->scale = scale;
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, skeletonDataFile.c_str());
CCASSERT(skeletonData, json->error ? json->error : "Error reading skeleton data file.");
spSkeletonJson_dispose(json);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
_atlas = atlas;
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
binary->scale = scale;
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
spSkeletonBinary_dispose(binary);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
CCASSERT(_atlas, "Error reading atlas file.");
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
binary->scale = scale;
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
spSkeletonBinary_dispose(binary);
_ownsSkeleton = true;
setSkeletonData(skeletonData, true);
initialize();
}
void SkeletonRenderer::update (float deltaTime) {
Node::update(deltaTime);
if (_ownsSkeleton) spSkeleton_update(_skeleton, deltaTime * _timeScale);
}
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
SkeletonBatch* batch = SkeletonBatch::getInstance();
SkeletonTwoColorBatch* twoColorBatch = SkeletonTwoColorBatch::getInstance();
bool isTwoColorTint = this->isTwoColorTint();
// Early exit if the skeleton is invisible
if (getDisplayedOpacity() == 0 || _skeleton->color.a == 0){
return;
}
<<<<<<< HEAD
// Early exit if slot is invisible
if (slot->color.a == 0) {
spSkeletonClipping_clipEnd(_clipper, slot);
continue;
}
cocos2d::TrianglesCommand::Triangles triangles;
TwoColorTriangles trianglesTwoColor;
=======
if (_effect) _effect->begin(_effect, _skeleton);
>>>>>>> 3.6
Color4F nodeColor;
nodeColor.r = getDisplayedColor().r / (float)255;
nodeColor.g = getDisplayedColor().g / (float)255;
nodeColor.b = getDisplayedColor().b / (float)255;
nodeColor.a = getDisplayedOpacity() / (float)255;
Color4F color;
Color4F darkColor;
AttachmentVertices* attachmentVertices = nullptr;
TwoColorTrianglesCommand* lastTwoColorTrianglesCommand = nullptr;
bool inRange = _startSlotIndex != -1 || _endSlotIndex != -1 ? false : true;
for (int i = 0, n = _skeleton->slotsCount; i < n; ++i) {
spSlot* slot = _skeleton->drawOrder[i];
<<<<<<< HEAD
// Early exit if attachment is invisible
if (attachment->color.a == 0) {
spSkeletonClipping_clipEnd(_clipper, slot);
continue;
}
if (!isTwoColorTint) {
triangles.indices = attachmentVertices->_triangles->indices;
triangles.indexCount = attachmentVertices->_triangles->indexCount;
triangles.verts = batch->allocateVertices(attachmentVertices->_triangles->vertCount);
triangles.vertCount = attachmentVertices->_triangles->vertCount;
memcpy(triangles.verts, attachmentVertices->_triangles->verts, sizeof(cocos2d::V3F_C4B_T2F) * attachmentVertices->_triangles->vertCount);
spRegionAttachment_computeWorldVertices(attachment, slot->bone, (float*)triangles.verts, 0, 6);
} else {
trianglesTwoColor.indices = attachmentVertices->_triangles->indices;
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
trianglesTwoColor.verts = twoColorBatch->allocateVertices(attachmentVertices->_triangles->vertCount);
trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount;
for (int i = 0; i < trianglesTwoColor.vertCount; i++) {
trianglesTwoColor.verts[i].texCoords = attachmentVertices->_triangles->verts[i].texCoords;
}
spRegionAttachment_computeWorldVertices(attachment, slot->bone, (float*)trianglesTwoColor.verts, 0, 7);
=======
if (_startSlotIndex >= 0 && _startSlotIndex == slot->data->index) {
inRange = true;
>>>>>>> 3.6
}
if (!inRange) {
@ -360,36 +301,9 @@ namespace spine {
inRange = false;
}
<<<<<<< HEAD
// Early exit if attachment is invisible
if (attachment->color.a == 0) {
spSkeletonClipping_clipEnd(_clipper, slot);
continue;
}
if (!isTwoColorTint) {
triangles.indices = attachmentVertices->_triangles->indices;
triangles.indexCount = attachmentVertices->_triangles->indexCount;
triangles.verts = batch->allocateVertices(attachmentVertices->_triangles->vertCount);
triangles.vertCount = attachmentVertices->_triangles->vertCount;
memcpy(triangles.verts, attachmentVertices->_triangles->verts, sizeof(cocos2d::V3F_C4B_T2F) * attachmentVertices->_triangles->vertCount);
int vertexSizeInFloats = sizeof(cocos2d::V3F_C4B_T2F) / sizeof(float);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (float*)triangles.verts, 0, vertexSizeInFloats);
} else {
trianglesTwoColor.indices = attachmentVertices->_triangles->indices;
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
trianglesTwoColor.verts = twoColorBatch->allocateVertices(attachmentVertices->_triangles->vertCount);
trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount;
for (int i = 0; i < trianglesTwoColor.vertCount; i++) {
trianglesTwoColor.verts[i].texCoords = attachmentVertices->_triangles->verts[i].texCoords;
}
int vertexSizeInFloats = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (float*)trianglesTwoColor.verts, 0, vertexSizeInFloats);
=======
if (!slot->attachment) {
spSkeletonClipping_clipEnd(_clipper, slot);
continue;
>>>>>>> 3.6
}
// Early exit if slot is invisible
@ -510,7 +424,7 @@ namespace spine {
darkColor.g = 0;
darkColor.b = 0;
}
darkColor.a = _premultipliedAlpha ? 255 : 0;
darkColor.a = darkPremultipliedAlpha;
BlendFunc blendFunc;
switch (slot->data->blendMode) {
@ -648,7 +562,7 @@ namespace spine {
dark.r = darkColor.r / 255.0f;
dark.g = darkColor.g / 255.0f;
dark.b = darkColor.b / 255.0f;
// dark.a = darkColor.a / 255.0f;
dark.a = darkColor.a / 255.0f;
for (int v = 0, vn = batchedTriangles->getTriangles().vertCount, vv = 0; v < vn; ++v, vv += 2) {
V3F_C4B_C4B_T2F* vertex = batchedTriangles->getTriangles().verts + v;
spColor lightCopy = light;
@ -711,7 +625,7 @@ namespace spine {
vertex->color2.r = (GLubyte)(darkCopy.r * 255);
vertex->color2.g = (GLubyte)(darkCopy.g * 255);
vertex->color2.b = (GLubyte)(darkCopy.b * 255);
// vertex->color2.a = (GLubyte)darkColor.a;
vertex->color2.a = (GLubyte)darkColor.a;
}
} else {
for (int v = 0, vn = batchedTriangles->getTriangles().vertCount; v < vn; ++v) {
@ -774,9 +688,9 @@ namespace spine {
if (_debugSlots || _debugBones || _debugMeshes) {
drawDebug(renderer, transform, transformFlags);
}
}
}
void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uint32_t transformFlags) {
void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uint32_t transformFlags) {
Director* director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -843,17 +757,17 @@ namespace spine {
drawNode->draw(renderer, transform, transformFlags);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
}
AttachmentVertices* SkeletonRenderer::getAttachmentVertices (spRegionAttachment* attachment) const {
AttachmentVertices* SkeletonRenderer::getAttachmentVertices (spRegionAttachment* attachment) const {
return (AttachmentVertices*)attachment->rendererObject;
}
}
AttachmentVertices* SkeletonRenderer::getAttachmentVertices (spMeshAttachment* attachment) const {
AttachmentVertices* SkeletonRenderer::getAttachmentVertices (spMeshAttachment* attachment) const {
return (AttachmentVertices*)attachment->rendererObject;
}
}
Rect SkeletonRenderer::getBoundingBox () const {
Rect SkeletonRenderer::getBoundingBox () const {
float minX = FLT_MAX, minY = FLT_MAX, maxX = -FLT_MAX, maxY = -FLT_MAX;
float scaleX = getScaleX(), scaleY = getScaleY();
for (int i = 0; i < _skeleton->slotsCount; ++i) {
@ -882,131 +796,130 @@ namespace spine {
Vec2 position = getPosition();
if (minX == FLT_MAX) minX = minY = maxX = maxY = 0;
return Rect(position.x + minX, position.y + minY, maxX - minX, maxY - minY);
}
}
// --- Convenience methods for Skeleton_* functions.
// --- Convenience methods for Skeleton_* functions.
void SkeletonRenderer::updateWorldTransform () {
void SkeletonRenderer::updateWorldTransform () {
spSkeleton_updateWorldTransform(_skeleton);
}
}
void SkeletonRenderer::setToSetupPose () {
void SkeletonRenderer::setToSetupPose () {
spSkeleton_setToSetupPose(_skeleton);
}
void SkeletonRenderer::setBonesToSetupPose () {
}
void SkeletonRenderer::setBonesToSetupPose () {
spSkeleton_setBonesToSetupPose(_skeleton);
}
void SkeletonRenderer::setSlotsToSetupPose () {
}
void SkeletonRenderer::setSlotsToSetupPose () {
spSkeleton_setSlotsToSetupPose(_skeleton);
}
}
spBone* SkeletonRenderer::findBone (const std::string& boneName) const {
spBone* SkeletonRenderer::findBone (const std::string& boneName) const {
return spSkeleton_findBone(_skeleton, boneName.c_str());
}
}
spSlot* SkeletonRenderer::findSlot (const std::string& slotName) const {
spSlot* SkeletonRenderer::findSlot (const std::string& slotName) const {
return spSkeleton_findSlot(_skeleton, slotName.c_str());
}
}
bool SkeletonRenderer::setSkin (const std::string& skinName) {
bool SkeletonRenderer::setSkin (const std::string& skinName) {
return spSkeleton_setSkinByName(_skeleton, skinName.empty() ? 0 : skinName.c_str()) ? true : false;
}
bool SkeletonRenderer::setSkin (const char* skinName) {
}
bool SkeletonRenderer::setSkin (const char* skinName) {
return spSkeleton_setSkinByName(_skeleton, skinName) ? true : false;
}
}
spAttachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const {
spAttachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const {
return spSkeleton_getAttachmentForSlotName(_skeleton, slotName.c_str(), attachmentName.c_str());
}
bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) {
}
bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) {
return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false;
}
bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) {
}
bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) {
return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName) ? true : false;
}
}
void SkeletonRenderer::setTwoColorTint(bool enabled) {
void SkeletonRenderer::setTwoColorTint(bool enabled) {
setupGLProgramState(enabled);
}
}
bool SkeletonRenderer::isTwoColorTint() {
bool SkeletonRenderer::isTwoColorTint() {
return getGLProgramState() == SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState();
}
}
void SkeletonRenderer::setVertexEffect(spVertexEffect *effect) {
void SkeletonRenderer::setVertexEffect(spVertexEffect *effect) {
this->_effect = effect;
}
}
void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) {
void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) {
this->_startSlotIndex = startSlotIndex;
this->_endSlotIndex = endSlotIndex;
}
}
spSkeleton* SkeletonRenderer::getSkeleton () {
spSkeleton* SkeletonRenderer::getSkeleton () {
return _skeleton;
}
}
void SkeletonRenderer::setTimeScale (float scale) {
void SkeletonRenderer::setTimeScale (float scale) {
_timeScale = scale;
}
float SkeletonRenderer::getTimeScale () const {
}
float SkeletonRenderer::getTimeScale () const {
return _timeScale;
}
}
void SkeletonRenderer::setDebugSlotsEnabled (bool enabled) {
void SkeletonRenderer::setDebugSlotsEnabled (bool enabled) {
_debugSlots = enabled;
}
bool SkeletonRenderer::getDebugSlotsEnabled () const {
}
bool SkeletonRenderer::getDebugSlotsEnabled () const {
return _debugSlots;
}
}
void SkeletonRenderer::setDebugBonesEnabled (bool enabled) {
void SkeletonRenderer::setDebugBonesEnabled (bool enabled) {
_debugBones = enabled;
}
bool SkeletonRenderer::getDebugBonesEnabled () const {
}
bool SkeletonRenderer::getDebugBonesEnabled () const {
return _debugBones;
}
}
void SkeletonRenderer::setDebugMeshesEnabled (bool enabled) {
void SkeletonRenderer::setDebugMeshesEnabled (bool enabled) {
_debugMeshes = enabled;
}
bool SkeletonRenderer::getDebugMeshesEnabled () const {
}
bool SkeletonRenderer::getDebugMeshesEnabled () const {
return _debugMeshes;
}
}
void SkeletonRenderer::onEnter () {
void SkeletonRenderer::onEnter () {
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) return;
#endif
Node::onEnter();
scheduleUpdate();
}
}
void SkeletonRenderer::onExit () {
void SkeletonRenderer::onExit () {
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExit)) return;
#endif
Node::onExit();
unscheduleUpdate();
}
// --- CCBlendProtocol
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
return _blendFunc;
}
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
_blendFunc = blendFunc;
}
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
_premultipliedAlpha = value;
}
bool SkeletonRenderer::isOpacityModifyRGB () const {
return _premultipliedAlpha;
}
}
// --- CCBlendProtocol
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
return _blendFunc;
}
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
_blendFunc = blendFunc;
}
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
_premultipliedAlpha = value;
}
bool SkeletonRenderer::isOpacityModifyRGB () const {
return _premultipliedAlpha;
}
}