GetColor (inline)
Syntax
// // Linux, MacOS and non-Visual Studio Windows solutions (pure C++11 / C++98) // static inline void GetColor( int64_t owlInstanceColor, int32_t * ambient, int32_t * diffuse, int32_t * emissive, int32_t * specular ) { assert(IsInstanceOfClass(owlInstanceColor, "Color")); int64_t model = GetModel(owlInstanceColor); GetDefaultColor( model, ambient, diffuse, emissive, specular ); const char * componentNames[4] = { "ambient", "diffuse", "emissive", "specular" }; int32_t * componentColors[4] = { ambient, diffuse, emissive, specular }; for (size_t i = 0; i < 4; i++) { if (componentColors[i]) { int64_t * values = nullptr, card = 0; GetObjectProperty( owlInstanceColor, GetPropertyByName( model, componentNames[i] ), &values, &card ); int64_t owlInstanceColorComponent = (card == 1) ? values[0] : 0; if (owlInstanceColorComponent) { (*componentColors[i]) = GetColorComponent(owlInstanceColorComponent); } } } } // // Visual Studio for Windows // static inline void GetColor( __int64 owlInstanceColor, __int32 * ambient, __int32 * diffuse, __int32 * emissive, __int32 * specular ) { assert(IsInstanceOfClass(owlInstanceColor, "Color")); int64_t model = GetModel(owlInstanceColor); GetDefaultColor( model, ambient, diffuse, emissive, specular ); const char * componentNames[4] = { "ambient", "diffuse", "emissive", "specular" }; int32_t * componentColors[4] = { ambient, diffuse, emissive, specular }; for (size_t i = 0; i < 4; i++) { if (componentColors[i]) { int64_t * values = nullptr, card = 0; GetObjectProperty( owlInstanceColor, GetPropertyByName( model, componentNames[i] ), &values, &card ); int64_t owlInstanceColorComponent = (card == 1) ? values[0] : 0; if (owlInstanceColorComponent) { (*componentColors[i]) = GetColorComponent(owlInstanceColorComponent); } } } }