Exemple #1
0
static void drawDebugNode(MeshBatch* batch, Node* node, unsigned int debugFlags)
{
    GP_ASSERT(node);
    Model* model = node->getModel();

    if ((debugFlags & Scene::DEBUG_BOXES) && model)
    {
        GP_ASSERT(model->getMesh());

        MeshSkin* skin = model->getSkin();
        if (skin && skin->getRootJoint() && skin->getRootJoint()->getParent())
        {
            // For skinned meshes that have a parent node to the skin's root joint,
            // we need to transform the bounding volume by that parent node's transform
            // as well to get the full skinned bounding volume.
            drawDebugBox(batch, model->getMesh()->getBoundingBox(), node->getWorldMatrix() * skin->getRootJoint()->getParent()->getWorldMatrix());
        }
        else
        {
            drawDebugBox(batch, model->getMesh()->getBoundingBox(), node->getWorldMatrix());
        }
    }

    if ((debugFlags & Scene::DEBUG_SPHERES) && model)
    {
        drawDebugSphere(batch, node->getBoundingSphere());
    }

    for (Node* child = node->getFirstChild(); child != NULL; child = child->getNextSibling())
    {
        drawDebugNode(batch, child, debugFlags);
    }
}
void ofxLayerMask::drawOverlay() {
    if(overlayOn) {
        overlayHeight = thumbSize * (layers.size() + 1) + (overlayPadding * layers.size());

        //Draw overlay panel
        x = ofGetWidth() - tripleThumbWidth - textAreaWidth - quadruplePadding - overlayMargin;
        y = ofGetHeight() - overlayHeight - doublePadding - overlayMargin;
        drawDebugBox(x, y, tripleThumbWidth + textAreaWidth + quadruplePadding, overlayHeight + doublePadding);
        
        //Draw layers
        x += overlayPadding;
        y += overlayPadding;
        for(int i = 0; i < layers.size(); i++) {
            ofDrawBitmapString("Layer " + ofToString(i + 1), x, y + halfThumbHeight + 4);
            drawDebugBox(x - 1 + textAreaWidth, y - 1, thumbWidth + 2, thumbHeight + 2, ofColor(255, 255, 255, 150));
            drawLayer(i, x + textAreaWidth, y, thumbWidth, thumbHeight, false);
            drawDebugBox(x - 1 + textAreaWidth + thumbWidth + overlayPadding, y - 1, thumbWidth + 2, thumbHeight + 2, ofColor(255, 255, 255, 150));
            drawMask(i, x + textAreaWidth + thumbWidth + overlayPadding, y, thumbWidth, thumbHeight);
            drawDebugBox(x - 1 + textAreaWidth + doubleThumbWidth + doublePadding, y - 1, thumbWidth + 2, thumbHeight + 2, ofColor(255, 255, 255, 150));
            drawLayer(i, x + textAreaWidth + doubleThumbWidth + doublePadding, y, thumbWidth, thumbHeight);
            y += thumbHeight + overlayPadding;
        }

        //Draw composite thumbnail
        ofDrawBitmapString("Composite", x, y + halfThumbHeight + 4);
        drawDebugBox(x - 1 + textAreaWidth + doubleThumbWidth + doublePadding, y - 1, thumbWidth + 2, thumbHeight + 2, ofColor(255, 255, 255, 150));
        draw(x + textAreaWidth + doubleThumbWidth + doublePadding, y, thumbWidth, thumbHeight);
    }
}