本文整理汇总了C++中SUB_CAST函数的典型用法代码示例。如果您正苦于以下问题:C++ SUB_CAST函数的具体用法?C++ SUB_CAST怎么用?C++ SUB_CAST使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SUB_CAST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _spBoundingBoxAttachment_dispose
void _spBoundingBoxAttachment_dispose (spAttachment* attachment) {
spBoundingBoxAttachment* self = SUB_CAST(spBoundingBoxAttachment, attachment);
_spAttachment_deinit(attachment);
FREE(self->vertices);
FREE(self);
}
示例2: Skin_getAttachment
Attachment* Skin_getAttachment (const Skin* self, int slotIndex, const char* name) {
const _Entry* entry = SUB_CAST(_Internal, self) ->entries;
while (entry) {
if (entry->slotIndex == slotIndex && strcmp(entry->name, name) == 0) return entry->attachment;
entry = entry->next;
}
return 0;
}
示例3: spSkeletonBounds_dispose
void spSkeletonBounds_dispose (spSkeletonBounds* self) {
int i;
for (i = 0; i < SUB_CAST(_spSkeletonBounds, self)->capacity; ++i)
if (self->polygons[i]) spPolygon_dispose(self->polygons[i]);
FREE(self->polygons);
FREE(self->boundingBoxes);
FREE(self);
}
示例4: SkeletonBounds_dispose
void SkeletonBounds_dispose (SkeletonBounds* self) {
int i = 0;
for (; i < SUB_CAST(_Internal, self)->capacity; ++i)
if (self->polygons[i]) BoundingPolygon_dispose(self->polygons[i]);
FREE(self->polygons);
FREE(self->boundingBoxes);
FREE(self);
}
示例5: _spPathAttachment_dispose
void _spPathAttachment_dispose (spAttachment* attachment) {
spPathAttachment* self = SUB_CAST(spPathAttachment, attachment);
_spVertexAttachment_deinit(SUPER(self));
FREE(self->lengths);
FREE(self);
}
示例6: _Cocos2dxAtlasPage_dispose
void _Cocos2dxAtlasPage_dispose (AtlasPage* page) {
Cocos2dxAtlasPage* self = SUB_CAST(Cocos2dxAtlasPage, page);
_AtlasPage_deinit(SUPER(self));
CC_SAFE_RELEASE_NULL(self->texture);
CC_SAFE_RELEASE_NULL(self->atlas);
FREE(page);
}
示例7: _Cocos2dxRegionAttachment_draw
void _Cocos2dxRegionAttachment_draw (Attachment* attachment, Slot* slot) {
Cocos2dxRegionAttachment* self = SUB_CAST(Cocos2dxRegionAttachment, attachment);
Cocos2dxSkeleton* skeleton = SUB_CAST(Cocos2dxSkeleton, slot->skeleton);
GLubyte r = SUPER(skeleton)->r * slot->r * 255;
GLubyte g = SUPER(skeleton)->g * slot->g * 255;
GLubyte b = SUPER(skeleton)->b * slot->b * 255;
GLubyte a = SUPER(skeleton)->a * slot->a * 255;
ccV3F_C4B_T2F_Quad* quad = &self->quad;
quad->bl.colors.r = r;
quad->bl.colors.g = g;
quad->bl.colors.b = b;
quad->bl.colors.a = a;
quad->tl.colors.r = r;
quad->tl.colors.g = g;
quad->tl.colors.b = b;
quad->tl.colors.a = a;
quad->tr.colors.r = r;
quad->tr.colors.g = g;
quad->tr.colors.b = b;
quad->tr.colors.a = a;
quad->br.colors.r = r;
quad->br.colors.g = g;
quad->br.colors.b = b;
quad->br.colors.a = a;
float* offset = SUPER(self)->offset;
quad->bl.vertices.x = offset[0] * slot->bone->m00 + offset[1] * slot->bone->m01 + slot->bone->worldX;
quad->bl.vertices.y = offset[0] * slot->bone->m10 + offset[1] * slot->bone->m11 + slot->bone->worldY;
quad->tl.vertices.x = offset[2] * slot->bone->m00 + offset[3] * slot->bone->m01 + slot->bone->worldX;
quad->tl.vertices.y = offset[2] * slot->bone->m10 + offset[3] * slot->bone->m11 + slot->bone->worldY;
quad->tr.vertices.x = offset[4] * slot->bone->m00 + offset[5] * slot->bone->m01 + slot->bone->worldX;
quad->tr.vertices.y = offset[4] * slot->bone->m10 + offset[5] * slot->bone->m11 + slot->bone->worldY;
quad->br.vertices.x = offset[6] * slot->bone->m00 + offset[7] * slot->bone->m01 + slot->bone->worldX;
quad->br.vertices.y = offset[6] * slot->bone->m10 + offset[7] * slot->bone->m11 + slot->bone->worldY;
// cocos2dx doesn't handle batching for us, so we'll just force a single texture per skeleton.
skeleton->node->atlas = self->atlas;
if (self->atlas->getCapacity() <= skeleton->node->quadCount) {
if (!self->atlas->resizeCapacity(self->atlas->getCapacity() * 2)) return;
}
self->atlas->updateQuad(quad, skeleton->node->quadCount++);
}
示例8: _AnimationState_clearQueue
void _AnimationState_clearQueue (AnimationState* self) {
_Internal* internal = SUB_CAST(_Internal, self);
_Entry* entry = internal->queue;
while (entry) {
_Entry* nextEntry = entry->next;
FREE(entry);
entry = nextEntry;
}
internal->queue = 0;
}
示例9: _spMeshAttachment_dispose
void _spMeshAttachment_dispose (spAttachment* attachment) {
spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment);
_spAttachment_deinit(attachment);
FREE(self->path);
FREE(self->vertices);
FREE(self->regionUVs);
FREE(self->uvs);
FREE(self->triangles);
FREE(self->edges);
FREE(self);
}
示例10: spSkin_attachAll
void spSkin_attachAll (const spSkin* self, spSkeleton* skeleton, const spSkin* oldSkin) {
const _Entry *entry = SUB_CAST(_spSkin, oldSkin)->entries;
while (entry) {
spSlot *slot = skeleton->slots[entry->slotIndex];
if (slot->attachment == entry->attachment) {
spAttachment *attachment = spSkin_getAttachment(self, entry->slotIndex, entry->name);
if (attachment) spSlot_setAttachment(slot, attachment);
}
entry = entry->next;
}
}
示例11: spSkin_dispose
void spSkin_dispose (spSkin* self) {
_Entry* entry = SUB_CAST(_spSkin, self)->entries;
while (entry) {
_Entry* nextEntry = entry->next;
_Entry_dispose(entry);
entry = nextEntry;
}
FREE(self->name);
FREE(self);
}
示例12: _spSkinnedMeshAttachment_dispose
void _spSkinnedMeshAttachment_dispose (spAttachment* attachment) {
spSkinnedMeshAttachment* self = SUB_CAST(spSkinnedMeshAttachment, attachment);
_spAttachment_deinit(attachment);
FREE(self->path);
FREE(self->bones);
FREE(self->weights);
FREE(self->regionUVs);
FREE(self->uvs);
FREE(self->triangles);
FREE(self->edges);
FREE(self);
}
示例13: spSkin_getAttachmentName
const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex) {
const _Entry* entry = SUB_CAST(_spSkin, self)->entries;
int i = 0;
while (entry) {
if (entry->slotIndex == slotIndex) {
if (i == attachmentIndex) return entry->name;
i++;
}
entry = entry->next;
}
return 0;
}
示例14: _spMeshAttachment_dispose
void _spMeshAttachment_dispose (spAttachment* attachment) {
spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment);
FREE(self->path);
FREE(self->uvs);
if (!self->parentMesh) {
_spVertexAttachment_deinit(SUPER(self));
FREE(self->regionUVs);
FREE(self->triangles);
FREE(self->edges);
} else
_spAttachment_deinit(attachment);
FREE(self);
}
示例15: RegionAttachment_updateQuad
ccV3F_C4B_T2F_Quad* RegionAttachment_updateQuad (Attachment* attachment, Slot* slot) {
Cocos2dxRegionAttachment* self = SUB_CAST(Cocos2dxRegionAttachment, attachment);
Cocos2dxSkeleton* skeleton = SUB_CAST(Cocos2dxSkeleton, slot->skeleton);
GLubyte r = SUPER(skeleton)->r * slot->r * 255;
GLubyte g = SUPER(skeleton)->g * slot->g * 255;
GLubyte b = SUPER(skeleton)->b * slot->b * 255;
GLubyte a = SUPER(skeleton)->a * slot->a * 255;
ccV3F_C4B_T2F_Quad* quad = &self->quad;
quad->bl.colors.r = r;
quad->bl.colors.g = g;
quad->bl.colors.b = b;
quad->bl.colors.a = a;
quad->tl.colors.r = r;
quad->tl.colors.g = g;
quad->tl.colors.b = b;
quad->tl.colors.a = a;
quad->tr.colors.r = r;
quad->tr.colors.g = g;
quad->tr.colors.b = b;
quad->tr.colors.a = a;
quad->br.colors.r = r;
quad->br.colors.g = g;
quad->br.colors.b = b;
quad->br.colors.a = a;
float* offset = SUPER(self)->offset;
quad->bl.vertices.x = offset[0] * slot->bone->m00 + offset[1] * slot->bone->m01 + slot->bone->worldX;
quad->bl.vertices.y = offset[0] * slot->bone->m10 + offset[1] * slot->bone->m11 + slot->bone->worldY;
quad->tl.vertices.x = offset[2] * slot->bone->m00 + offset[3] * slot->bone->m01 + slot->bone->worldX;
quad->tl.vertices.y = offset[2] * slot->bone->m10 + offset[3] * slot->bone->m11 + slot->bone->worldY;
quad->tr.vertices.x = offset[4] * slot->bone->m00 + offset[5] * slot->bone->m01 + slot->bone->worldX;
quad->tr.vertices.y = offset[4] * slot->bone->m10 + offset[5] * slot->bone->m11 + slot->bone->worldY;
quad->br.vertices.x = offset[6] * slot->bone->m00 + offset[7] * slot->bone->m01 + slot->bone->worldX;
quad->br.vertices.y = offset[6] * slot->bone->m10 + offset[7] * slot->bone->m11 + slot->bone->worldY;
return quad;
}