GetColorOfComponent (inline)

...

Syntax

//
//   Linux, MacOS and non-Visual Studio Windows solutions (pure C++11 / C++98)
//

static  inline  uint32_t    GetColorOfComponent(
                                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  unsigned __int32    GetColorOfComponent(
                                __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);
}
    

Property owlInstanceColorComponent

Size: 64 bit / 8 byte (value)
The handle of the Color Component instance.