GetColorOfComponent (inline)

...

Syntax

//
//   Strong typing definition
//

static  inline  uint32_t    GetColorOfComponent(
                                    OwlInstance             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]
                    ),
                (const void**) &values,
                &card
            );
        assert(card == 1);
        rgbwValues[i] = (card == 1) ? values[0] : 0.;
    }

    return  COLOR_ARR_RGBW(rgbwValues);
}


//
//   Weak typing definition
//

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]
                    ),
                (const 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.