GetColorComponent (inline)
Syntax
// // Linux, MacOS and non-Visual Studio Windows solutions (pure C++11 / C++98) // static inline int32_t GetColorComponent( int64_t owlInstanceColorComponent ) { assert(IsInstanceOfClass(owlInstanceColorComponent, "ColorComponent")); int64_t model = GetModel(owlInstanceColorComponent); const char * rgbwNames[4] = { "R", "G", "B", "W" }; double rgbwValues[4] = { 0., 0., 0., 0. }; for (size_t i = 0; i < 4; i++) { double * values = nullptr; int64_t card = 0; GetDatatypeProperty( owlInstanceColorComponent, GetPropertyByName( model, rgbwNames[i] ), (void**) &values, &card ); assert(card == 1); rgbwValues[i] = (card == 1) ? values[0] : 0.; } return COLOR_ARR_RGBW(rgbwValues); } // // Visual Studio for Windows // static inline __int32 GetColorComponent( __int64 owlInstanceColorComponent ) { assert(IsInstanceOfClass(owlInstanceColorComponent, "ColorComponent")); int64_t model = GetModel(owlInstanceColorComponent); const char * rgbwNames[4] = { "R", "G", "B", "W" }; double rgbwValues[4] = { 0., 0., 0., 0. }; for (size_t i = 0; i < 4; i++) { double * values = nullptr; int64_t card = 0; GetDatatypeProperty( owlInstanceColorComponent, GetPropertyByName( model, rgbwNames[i] ), (void**) &values, &card ); assert(card == 1); rgbwValues[i] = (card == 1) ? values[0] : 0.; } return COLOR_ARR_RGBW(rgbwValues); }