SaveModelA

This function saves the current model in an array. It is allowed to use a class, property or instance handle instead of the model handle. If save operation finished succesfully the return value will be 0, in case of non-zero value: 1 - owlInstance is NULL or not recognized as an instance handle 2 - content or size is zero

Syntax

//
//   Strong typing definition
//
int64_t                     SaveModelA(
                                    OwlModel                model,
                                    unsigned char           * content,
                                    int64_t                 * size
                                );


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall SaveModelA(
                                                int64_t                 model,
                                                unsigned char           * content,
                                                int64_t                 * size
                                            );
    

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 content

Size: 32 bit / 4 byte (reference)
The content of this IO call, the size of the content is defined by attribute size.

Property size

Size: 32 bit / 4 byte (reference)
The size of the content as defined in number of bytes.

Example (based on pure API calls)

Here you can find code snippets that show how the API call SaveModelA can be used.

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

void    SaveModelByArray(int64_t model, wchar_t * fileName)
{
    FILE    * myFileWrite = nullptr;

    _wfopen_s(&myFileWrite, fileName, L"wb");
    if (&myFileWrite) {
        int64_t size = 0;

        SaveModelA(model, 0, &size);

        unsigned char   * content = new unsigned char[(int_t) size];
        SaveModelA(model, content, &size);

        fwrite(content, 1, (size_t) size, myFileWrite);
        delete[] content;

        fclose(myFileWrite);
    }
    else {
        assert(false);
    }
}