GetColor (inline)

...

Syntax

//
//   Strong typing definition
//

static  inline  void    GetColor(
                                OwlInstance             owlInstanceColor,
                                uint32_t                * ambient,
                                uint32_t                * diffuse,
                                uint32_t                * emissive,
                                uint32_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" };
    uint32_t    * componentColors[4] = { ambient, diffuse, emissive, specular };

    for (size_t i = 0; i < 4; i++) {
        if (componentColors[i]) {
            OwlInstance * values = nullptr;
            int64_t     card = 0;
            GetObjectProperty(
                    owlInstanceColor,
                    GetPropertyByName(
                            model,
                            componentNames[i]
                        ),
                    (const OwlInstance**) &values,
                    &card
                );

            int64_t owlInstanceColorComponent = (card == 1) ? values[0] : 0;
            if (owlInstanceColorComponent) {
                (*componentColors[i]) = GetColorOfComponent(owlInstanceColorComponent);
            }
        }
    }
}


//
//   Weak typing definition
//

static  inline  void    GetColor(
                                int64_t                 owlInstanceColor,
                                uint32_t                * ambient,
                                uint32_t                * diffuse,
                                uint32_t                * emissive,
                                uint32_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" };
    uint32_t    * componentColors[4] = { ambient, diffuse, emissive, specular };

    for (size_t i = 0; i < 4; i++) {
        if (componentColors[i]) {
            OwlInstance * values = nullptr;
            int64_t     card = 0;
            GetObjectProperty(
                    owlInstanceColor,
                    GetPropertyByName(
                            model,
                            componentNames[i]
                        ),
                    (const OwlInstance**) &values,
                    &card
                );

            int64_t owlInstanceColorComponent = (card == 1) ? values[0] : 0;
            if (owlInstanceColorComponent) {
                (*componentColors[i]) = GetColorOfComponent(owlInstanceColorComponent);
            }
        }
    }
}
    

Property owlInstanceColor

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

Property ambient

Size: 64 bit / 8 byte (reference)
Defines a pointer to the ambient color as a 32 bit value that will be filled by this call; the 32 bit value is build up as 8 : 8 : 8 : 8 bits representing RGBA (or sometimes called RGBW), i.e. Red, Green, Blue, Alpha (transparency) each defined as a unsigned char value 0 .. 255.

Property diffuse

Size: 64 bit / 8 byte (reference)
Defines a pointer to the diffuse color as a 32 bit value that will be filled by this call; the 32 bit value is build up as 8 : 8 : 8 : 8 bits representing RGBA (or sometimes called RGBW), i.e. Red, Green, Blue, Alpha (transparency) each defined as a unsigned char value 0 .. 255.

Property emissive

Size: 64 bit / 8 byte (reference)
Defines a pointer to the emissive color as a 32 bit value that will be filled by this call; the 32 bit value is build up as 8 : 8 : 8 : 8 bits representing RGBA (or sometimes called RGBW), i.e. Red, Green, Blue, Alpha (transparency) each defined as a unsigned char value 0 .. 255.

Property specular

Size: 64 bit / 8 byte (reference)
Defines a pointer to the specular color as a 32 bit value that will be filled by this call; the 32 bit value is build up as 8 : 8 : 8 : 8 bits representing RGBA (or sometimes called RGBW), i.e. Red, Green, Blue, Alpha (transparency) each defined as a unsigned char value 0 .. 255.