SaveModelW

This function saves the current model on location file name.

Syntax

//
//   Strong typing definition
//
int64_t         SaveModelW(
                        OwlModel                model,
                        const wchar_t           * fileName
                    );

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


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

static  inline  int64_t SaveModelW(
                                int64_t                 model,
                                wchar_t                 * fileName
                            )
{
    return  SaveModelW(
                    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: 64 bit / 8 byte (reference)
The file name of the file as available in the file system in ASCII (char *). The given char array will not be adjusted, on each OS the size of a char element is 8 bit / 1 byte.

Example (based on pure API calls)

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

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

void    CreateContent()
{
    int64_t model = CreateModel();

    if (model) {
        //
        //  Classes
        //
        int64_t classCone = GetClassByName(model, "Cone");

        //
        //  Datatype Properties (attributes)
        //
        int64_t propertyHeight = GetPropertyByName(model, "height"),
                propertyRadius = GetPropertyByName(model, "radius"),
                propertySegmentationParts = GetPropertyByName(model, "segmentationParts");

        //
        //  Instances
        //
        int64_t instanceCone = CreateInstance(classCone, nullptr);

        double  height = 2.8,
                radius = 1.3;
        int64_t segmentationParts = 36;
        
        SetDatatypeProperty(instanceCone, propertyHeight, &height, 1);
        SetDatatypeProperty(instanceCone, propertyRadius, &radius, 1);
        SetDatatypeProperty(instanceCone, propertySegmentationParts, &segmentationParts, 1);

        //
        //  The resulting model can be viewed in 3D-Editor.exe
        //
        SaveModelW(model, L"c:\\created\\myFile.bin");

        CloseModel(model);
    }
}