Ejemplo n.º 1
0
BodyPart * MDLReader::processBodyPart(std::istream * str, int offset)
{
    int              i;
    MDLBodyPart *    part;
    BodyPart *       partNode;
    Model *          modelNode;

    // Seek to the body part
    str->seekg(offset);

    // Read it
    part = new MDLBodyPart;
    str->read((char *) part, sizeof(MDLBodyPart));

    // Create the body part node
    partNode = new BodyPart(part);

    // Process the models
    for (i = 0; i < part->num_models; i++)
    {
        // Process the model
        modelNode = processModel(str, offset + part->model_offset +
                                      (i * sizeof(MDLModel)));

        // Add the model to the body part
        partNode->addModel(modelNode);
    }

    // Return the new node
    return partNode;
}