本文整理汇总了C++中DrawNode::drawPoly方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawNode::drawPoly方法的具体用法?C++ DrawNode::drawPoly怎么用?C++ DrawNode::drawPoly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawNode
的用法示例。
在下文中一共展示了DrawNode::drawPoly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawDebug
void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uint32_t transformFlags) {
Director* director = Director::getInstance();
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
DrawNode* drawNode = DrawNode::create();
if (_debugSlots) {
// Slots.
// DrawPrimitives::setDrawColor4B(0, 0, 255, 255);
glLineWidth(1);
Vec2 points[4];
V3F_C4B_T2F_Quad quad;
for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
spSlot* slot = _skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->bone, _worldVertices);
points[0] = Vec2(_worldVertices[0], _worldVertices[1]);
points[1] = Vec2(_worldVertices[2], _worldVertices[3]);
points[2] = Vec2(_worldVertices[4], _worldVertices[5]);
points[3] = Vec2(_worldVertices[6], _worldVertices[7]);
drawNode->drawPoly(points, 4, true, Color4F::BLUE);
}
}
if (_debugBones) {
// Bone lengths.
glLineWidth(2);
for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i];
float x = bone->data->length * bone->a + bone->worldX;
float y = bone->data->length * bone->c + bone->worldY;
drawNode->drawLine(Vec2(bone->worldX, bone->worldY), Vec2(x, y), Color4F::RED);
}
// Bone origins.
auto color = Color4F::BLUE; // Root bone is blue.
for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i];
drawNode->drawPoint(Vec2(bone->worldX, bone->worldY), 4, color);
if (i == 0) color = Color4F::GREEN;
}
}
drawNode->draw(renderer, transform, transformFlags);
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}