ImportModelW

This function imports a design tree on location file name.
The design tree will be added to the given existing model.
The return value contains the first instance not referenced by any other instance or zero if it does not exist. In case the imported model is created with SaveInstanceTree() this instance is unique and equal to the instance used within the call SaveInstanceTree().

Syntax

//
//   Strong typing definition
//
OwlInstance     ImportModelW(
                        OwlModel                model,
                        const wchar_t           * fileName
                    );

static  inline  OwlInstance ImportModelW(
                                    OwlModel                model,
                                    wchar_t                 * fileName
                                )
{
    return  ImportModelW(
                    model,
                    (const wchar_t*) fileName
                );
}


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall ImportModelW(
                                                int64_t                 model,
                                                const wchar_t           * fileName
                                            );

static  inline  int64_t ImportModelW(
                                int64_t                 model,
                                wchar_t                 * fileName
                            )
{
    return  ImportModelW(
                    model,
                    (const wchar_t*) fileName
                );
}
    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property fileName

Size: 32 bit / 4 byte (reference)
The file name of the file as available in the file system in Unicode (wchar_t *). The given wchar_t array will not be adjusted. The size of each wchar_t element is depending on the OS, both 16 bit / 2 bytes wchar_t elements as well as 32 bit / 4 byte wchar_t elements are recognized and supported.

Example (based on pure API calls)

Here you can find code snippits that show how the API call ImportModelW can be used.

#include    "./include/engine.h"
#include    <assert.h>

void    MergeModel(int64_t model, wchar_t * fileNameIN, wchar_t * fileNameOUT)
{
    //
    //  Add content from file into current model 
    //
    ImportModelW(model, fileNameIN);

    //
    //  Save original and added content into a new file
    //
    SaveModelW(model, fileNameOUT);
}

int main()
{
    int64_t model = OpenModelW(L"c:\\created\\myFileFirstPart.bin");

    if (model) {
        MergeModel(model, L"c:\\created\\myFileSecondPart.bin", L"c:\\created\\myMergedFile.bin");

        CloseModel(model);
    }
    else {
        assert(false);
    }
}