CreateInstanceEx
Syntax
// // Strong typing definition // OwlInstance CreateInstanceEx( OwlModel model, OwlClass owlClass, const char * name ); static inline OwlInstance CreateInstanceEx( OwlModel model, OwlClass owlClass, char * name ) { return CreateInstanceEx( model, owlClass, (const char*) name ); } static inline OwlInstance CreateInstanceEx( OwlModel model, OwlClass owlClass ) { const char * name = nullptr; return CreateInstanceEx( model, owlClass, (const char*) name ); } // // Weak typing definition // int64_t __declspec(dllexport) __stdcall CreateInstanceEx( int64_t model, int64_t owlClass, const char * name ); static inline int64_t CreateInstanceEx( int64_t model, int64_t owlClass, char * name ) { return CreateInstanceEx( model, owlClass, (const char*) name ); } static inline int64_t CreateInstanceEx( int64_t model, int64_t owlClass ) { const char * name = nullptr; return CreateInstanceEx( model, owlClass, (const char*) name ); }
Property model
Size: 64 bit / 8 byte (value)Property owlClass
Size: 64 bit / 8 byte (value)Property name
Size: 64 bit / 8 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call CreateInstanceEx can be used.
#include "./include/engine.h" #include <cmath> int64_t model = CreateModel(); if (model) { // // The following setting makes sure all class handled are in an ordered list // In certain cases where several models are open or in case of conversion // between formats this can be handy and / or time efficient. // int64_t classCnt = 0; OrderedHandles(model, &classCnt, nullptr, nullptr, 1, 1); // // Classes // int64_t myClass = CreateClass(model, "MyCreatedClass"); assert(myClass == classCnt + 1); // // Datatype Properties (attributes) // int64_t propertyLength = GetPropertyByName(model, "length"); // // Instances (creating) // int64_t myInstance = CreateInstanceEx(model, myClass, nullptr); double length = 2.; SetDatatypeProperty(myInstance, propertyLength, &length, 1); assert(GetVolume(myInstance, 0, 0) == 0.); char * classNameI = nullptr; GetNameOfClassEx(model, myClass, &classNameI); SetNameOfClassEx(model, myClass, "OtherClassName"); char * classNameII = nullptr; GetNameOfClassEx(model, myClass, &classNameII); SetClassParentEx(model, myClass, GetClassByName(model, "Cube"), 1); assert(GetVolume(myInstance, 0, 0) == 8.); SetNameOfClassEx(model, myClass, "OutOfIdeasForClassName"); char * classNameIII = nullptr; GetNameOfClassEx(model, myClass, &classNameIII); // // The retrieved class names have the following values // classNameI : 'MyCreatedClass' // classNameII : 'OtherClassName' // classNameIII : 'OutOfIdeasForClassName' // // // The resulting model can be viewed in 3D-Editor.exe // SaveModel(model, "c:\\created\\myFile.bin"); CloseModel(model); }