mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cocos2dx] Tint black did not work, didn't multiple dark color with skeleton/attachment color. Closes #1158.
This commit is contained in:
parent
a578be88e0
commit
ce536558e5
@ -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 @@ void SkeletonRenderer::initialize () {
|
||||
|
||||
spSkeleton_setToSetupPose(_skeleton);
|
||||
spSkeleton_updateWorldTransform(_skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||
if (twoColorTintEnabled) {
|
||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||
return;
|
||||
@ -136,60 +136,60 @@ void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
||||
_ownsSkeleton = true;
|
||||
setSkeletonData(skeletonData, ownsSkeletonData);
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||
_atlas = atlas;
|
||||
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
||||
|
||||
@ -203,9 +203,9 @@ void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, sp
|
||||
setSkeletonData(skeletonData, true);
|
||||
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||
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.");
|
||||
|
||||
@ -221,9 +221,9 @@ void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, co
|
||||
setSkeletonData(skeletonData, true);
|
||||
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||
_atlas = atlas;
|
||||
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
||||
|
||||
@ -236,9 +236,9 @@ void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile,
|
||||
setSkeletonData(skeletonData, true);
|
||||
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||
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.");
|
||||
|
||||
@ -253,19 +253,24 @@ void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile,
|
||||
setSkeletonData(skeletonData, true);
|
||||
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SkeletonRenderer::update (float deltaTime) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (_effect) _effect->begin(_effect, _skeleton);
|
||||
|
||||
Color4F nodeColor;
|
||||
@ -276,7 +281,6 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
|
||||
Color4F color;
|
||||
Color4F darkColor;
|
||||
float darkPremultipliedAlpha = _premultipliedAlpha ? 255 : 0;
|
||||
AttachmentVertices* attachmentVertices = nullptr;
|
||||
TwoColorTrianglesCommand* lastTwoColorTrianglesCommand = nullptr;
|
||||
bool inRange = _startSlotIndex != -1 || _endSlotIndex != -1 ? false : true;
|
||||
@ -301,6 +305,12 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
continue;
|
||||
}
|
||||
|
||||
// Early exit if slot is invisible
|
||||
if (slot->color.a == 0) {
|
||||
spSkeletonClipping_clipEnd(_clipper, slot);
|
||||
continue;
|
||||
}
|
||||
|
||||
cocos2d::TrianglesCommand::Triangles triangles;
|
||||
TwoColorTriangles trianglesTwoColor;
|
||||
|
||||
@ -309,6 +319,12 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
|
||||
attachmentVertices = getAttachmentVertices(attachment);
|
||||
|
||||
// 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;
|
||||
@ -338,6 +354,12 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
|
||||
attachmentVertices = getAttachmentVertices(attachment);
|
||||
|
||||
// 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;
|
||||
@ -375,27 +397,33 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
continue;
|
||||
}
|
||||
|
||||
float alpha = nodeColor.a * _skeleton->color.a * slot->color.a * color.a * 255;
|
||||
// skip rendering if the color of this attachment is 0
|
||||
if (alpha == 0){
|
||||
spSkeletonClipping_clipEnd(_clipper, slot);
|
||||
continue;
|
||||
}
|
||||
float multiplier = _premultipliedAlpha ? alpha : 255;
|
||||
|
||||
float red = nodeColor.r * _skeleton->color.r * slot->color.r * multiplier;
|
||||
float green = nodeColor.g * _skeleton->color.g * slot->color.g * multiplier;
|
||||
float blue = nodeColor.b * _skeleton->color.b * slot->color.b * multiplier;
|
||||
|
||||
color.r = red * color.r;
|
||||
color.g = green * color.g;
|
||||
color.b = blue * color.b;
|
||||
color.a = alpha;
|
||||
|
||||
if (slot->darkColor) {
|
||||
darkColor.r = slot->darkColor->r * 255;
|
||||
darkColor.g = slot->darkColor->g * 255;
|
||||
darkColor.b = slot->darkColor->b * 255;
|
||||
darkColor.r = red * slot->darkColor->r;
|
||||
darkColor.g = green * slot->darkColor->g;
|
||||
darkColor.b = blue * slot->darkColor->b;
|
||||
} else {
|
||||
darkColor.r = 0;
|
||||
darkColor.g = 0;
|
||||
darkColor.b = 0;
|
||||
}
|
||||
darkColor.a = darkPremultipliedAlpha;
|
||||
|
||||
color.a *= nodeColor.a * _skeleton->color.a * slot->color.a * 255;
|
||||
// skip rendering if the color of this attachment is 0
|
||||
if (color.a == 0){
|
||||
spSkeletonClipping_clipEnd(_clipper, slot);
|
||||
continue;
|
||||
}
|
||||
float multiplier = _premultipliedAlpha ? color.a : 255;
|
||||
color.r *= nodeColor.r * _skeleton->color.r * slot->color.r * multiplier;
|
||||
color.g *= nodeColor.g * _skeleton->color.g * slot->color.g * multiplier;
|
||||
color.b *= nodeColor.b * _skeleton->color.b * slot->color.b * multiplier;
|
||||
darkColor.a = _premultipliedAlpha ? 255 : 0;
|
||||
|
||||
BlendFunc blendFunc;
|
||||
switch (slot->data->blendMode) {
|
||||
@ -533,7 +561,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
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;
|
||||
@ -596,7 +624,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
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) {
|
||||
@ -659,9 +687,9 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
|
||||
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);
|
||||
@ -728,17 +756,17 @@ void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uin
|
||||
|
||||
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) {
|
||||
@ -767,130 +795,131 @@ Rect SkeletonRenderer::getBoundingBox () const {
|
||||
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
|
||||
// --- CCBlendProtocol
|
||||
|
||||
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
|
||||
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
|
||||
return _blendFunc;
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
|
||||
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
|
||||
_blendFunc = blendFunc;
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
|
||||
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
|
||||
_premultipliedAlpha = value;
|
||||
}
|
||||
}
|
||||
|
||||
bool SkeletonRenderer::isOpacityModifyRGB () const {
|
||||
bool SkeletonRenderer::isOpacityModifyRGB () const {
|
||||
return _premultipliedAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user