ColorComponent

This class represents the concept ColorComponent.

Class

class Appearance
class ColorComponent
   property R
      range double (64 bit), cardinality [1, 1]
   property G
      range double (64 bit), cardinality [1, 1]
   property B
      range double (64 bit), cardinality [1, 1]
   property W
      range double (64 bit), cardinality [1, 1]    

Example

Here you can find code snippits that show how the API call ColorComponent can be used.

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classColor = GetClassByName(model, "Color"),
            classColorComponent = GetClassByName(model, "ColorComponent"),
            classCube = GetClassByName(model, "Cube"),
            classMaterial = GetClassByName(model, "Material");

    //
    //  Object Properties (relations)
    //
    int64_t propertyAmbient = GetPropertyByName(model, "ambient"),
            propertyColor = GetPropertyByName(model, "color"),
            propertyDiffuse = GetPropertyByName(model, "diffuse"),
            propertyEmissive = GetPropertyByName(model, "emissive"),
            propertyMaterial = GetPropertyByName(model, "material"),
            propertySpecular = GetPropertyByName(model, "specular");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyB = GetPropertyByName(model, "B"),
            propertyG = GetPropertyByName(model, "G"),
            propertyLength = GetPropertyByName(model, "length"),
            propertyR = GetPropertyByName(model, "R"),
            propertyW = GetPropertyByName(model, "W");

    //
    //  Instances (creating)
    //
    int64_t myInstanceColor = CreateInstance(classColor, nullptr),
            myInstanceColorComponent = CreateInstance(classColorComponent, nullptr),
            myInstanceCube = CreateInstance(classCube, nullptr),
            myInstanceMaterial = CreateInstance(classMaterial, nullptr);

    SetObjectProperty(myInstanceColor, propertyAmbient, &myInstanceColorComponent, 1);
    SetObjectProperty(myInstanceColor, propertyDiffuse, &myInstanceColorComponent, 1);
    SetObjectProperty(myInstanceColor, propertyEmissive, &myInstanceColorComponent, 1);
    SetObjectProperty(myInstanceColor, propertySpecular, &myInstanceColorComponent, 1);

    double  R = 0.0, G = 1.0, B = 0.0, W = 0.5;
    SetDatatypeProperty(myInstanceColorComponent, propertyR, &R, 1);
    SetDatatypeProperty(myInstanceColorComponent, propertyG, &G, 1);
    SetDatatypeProperty(myInstanceColorComponent, propertyB, &B, 1);
    SetDatatypeProperty(myInstanceColorComponent, propertyW, &W, 1);

    double  length = 1.8;       
    SetDatatypeProperty(myInstanceCube, propertyLength, &length, 1);
    SetObjectProperty(myInstanceCube, propertyMaterial, &myInstanceMaterial, 1);

    SetObjectProperty(myInstanceMaterial, propertyColor, &myInstanceColor, 1);

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModel(model, "c:\\created\\myColorComponent.bin");
    CloseModel(model);
}