Пример #1
0
bool ExtractSingleModel(std::string& origPath, std::string& fixedName, StringSet& failedPaths, int iCoreNumber, const void *szRawVMAPMagic)
{
    string ext = GetExtension(origPath);

    // < 3.1.0 ADT MMDX section store filename.mdx filenames for corresponded .m2 file
    if ((ext == "mdx") || (ext=="mdl"))
    {
        // replace .md[l,x] -> .m2
        origPath.erase(origPath.length() - 2, 2);
        origPath.append("2");
    }
    // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file
    // nothing do

    fixedName = GetUniformName(origPath);
    std::string output(szWorkDirWmo);                       // Stores output filename
    output += "/";
    output += fixedName;

    if (FileExists(output.c_str()))
        { return true; }

    Model mdl(origPath);                                    // Possible changed fname
    if (!mdl.open(failedPaths, iCoreNumber))
        { return false; }

    return mdl.ConvertToVMAPModel(output, iCoreNumber, szRawVMAPMagic);
}
Пример #2
0
 void StandardUniforms::RegisterAll() {
     for (UInt32 i = 0; i < (UInt32)StandardUniform::_Last; i++) {
         UniformDirectory::RegisterVarID(GetUniformName((StandardUniform)i));
     }
 }
Пример #3
0
void ExtractGameobjectModels(int iCoreNumber, const void *szRawVMAPMagic)
{
    printf("\n");
    printf("Extracting GameObject models...\n");
    DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc");
    if (!dbc.open())
    {
        printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
        exit(1);
    }

    std::string basepath = szWorkDirWmo;
    basepath += "/";
    std::string path;
    StringSet failedPaths;

    FILE* model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");

    for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
    {
        path = it->getString(1);

        if (path.length() < 4)
            { continue; }

        string name;

        string ch_ext = GetExtension(path);
        if (ch_ext.empty())
            { continue; }

        bool result = false;
        if (ch_ext == "wmo")
        {
            name = GetUniformName(path);
            result = ExtractSingleWmo(path, iCoreNumber, szRawVMAPMagic);
        }
        else
        {
            result = ExtractSingleModel(path, name, failedPaths, iCoreNumber, szRawVMAPMagic);
        }

        if (result && FileExists((basepath + name).c_str()))
        {
            uint32 displayId = it->getUInt(0);
            uint32 path_length = name.length();
            fwrite(&displayId, sizeof(uint32), 1, model_list);
            fwrite(&path_length, sizeof(uint32), 1, model_list);
            fwrite(name.c_str(), sizeof(char), path_length, model_list);
        }
    }

    fclose(model_list);

    if (!failedPaths.empty())
    {
        printf("\n Warning: Some models could not be extracted, see below\n");
        for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
            { printf(" Could not find file of model %s\n", itr->c_str()); }
        printf("\n A few of these warnings are expected to happen, so be not alarmed!\n");
    }

    printf("\n Asset Extraction Complete !\n");
}