本文整理汇总了C++中SkeletonRenderer::getGLTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ SkeletonRenderer::getGLTexture方法的具体用法?C++ SkeletonRenderer::getGLTexture怎么用?C++ SkeletonRenderer::getGLTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkeletonRenderer
的用法示例。
在下文中一共展示了SkeletonRenderer::getGLTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderToCache
void SkeletonAnimationFbo::renderToCache(Renderer* renderer, RenderCmdsCache* cache)
{
if (!cache)
return;
cache->clear();
if (!renderer)
return;
SkeletonRenderer* skeletonRenderer = (SkeletonRenderer*)renderer;
if (mShouldRelaseCacheTexture){
mShouldRelaseCacheTexture = false;
skeletonRenderer->releaseTextures();
}
const QRectF rect = calculateSkeletonRect();
if (!isSkeletonValid())
return;
cache->setSkeletonRect(rect);
cache->bindShader(RenderCmdsCache::ShaderTexture);
int additive = -1;
Color color;
const float* uvs = 0;
int verticesCount = 0;
const int* triangles = 0;
int trianglesCount = 0;
float r = 0, g = 0, b = 0, a = 0;
for (int i = 0, n = mspSkeleton->slotsCount; i < n; i++) {
spSlot* slot = mspSkeleton->drawOrder[i];
if (!slot->attachment)
continue;
Texture *texture = 0;
switch (slot->attachment->type) {
case SP_ATTACHMENT_REGION: {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->bone, mWorldVertices);
texture = getTexture(attachment);
uvs = attachment->uvs;
verticesCount = 8;
triangles = quadTriangles;
trianglesCount = 6;
r = attachment->r;
g = attachment->g;
b = attachment->b;
a = attachment->a;
break;
}
case SP_ATTACHMENT_MESH: {
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(attachment, slot, mWorldVertices);
texture = getTexture(attachment);
uvs = attachment->uvs;
verticesCount = attachment->verticesCount;
triangles = attachment->triangles;
trianglesCount = attachment->trianglesCount;
r = attachment->r;
g = attachment->g;
b = attachment->b;
a = attachment->a;
break;
}
case SP_ATTACHMENT_SKINNED_MESH: {
spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(attachment, slot, mWorldVertices);
texture = getTexture(attachment);
uvs = attachment->uvs;
verticesCount = attachment->uvsCount;
triangles = attachment->triangles;
trianglesCount = attachment->trianglesCount;
r = attachment->r;
g = attachment->g;
b = attachment->b;
a = attachment->a;
break;
}
default:
break;
}// END switch (slot->attachment->type)
if (texture) {
if (slot->data->additiveBlending != additive) {
cache->cacheTriangleDrawCall();
cache->blendFunc(GL_ONE, slot->data->additiveBlending ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA);
additive = slot->data->additiveBlending;
}
color.a = mspSkeleton->a * slot->a * a * 255;
float multiplier = mPremultipliedAlapha ? color.a : 255;
color.r = mspSkeleton->r * slot->r * r * multiplier;
color.g = mspSkeleton->g * slot->g * g * multiplier;
color.b = mspSkeleton->b * slot->b * b * multiplier;
cache->drawTriangles(skeletonRenderer->getGLTexture(texture, window()), mWorldVertices, uvs, verticesCount, triangles, trianglesCount, color);
}// END if (texture)
}// END for (int i = 0, n = skeleton->slotsCount; i < n; i++)
cache->cacheTriangleDrawCall();
if (mDebugSlots || mDebugBones) {
//.........这里部分代码省略.........