Color

This class represents the concept Color.

Class

class Appearance
class Color
   relation ambient
      range ColorComponent, cardinality [0, 1]
   relation diffuse
      range ColorComponent, cardinality [0, 1]
   relation specular
      range ColorComponent, cardinality [0, 1]
   relation emissive
      range ColorComponent, cardinality [0, 1]    

Example

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

__int64 rdfModel = CreateModel();

if (rdfModel) {
    __int64 classColor = GetClassByName(rdfModel, "Color"),
            classColorComponent = GetClassByName(rdfModel, "ColorComponent"),
            classCube = GetClassByName(rdfModel, "Cube"),
            classMaterial = GetClassByName(rdfModel, "Material");

    __int64 propertyAmbient = GetPropertyByName(rdfModel, "ambient"),
            propertyB = GetPropertyByName(rdfModel, "B"),
            propertyColor = GetPropertyByName(rdfModel, "color"),
            propertyDiffuse = GetPropertyByName(rdfModel, "diffuse"),
            propertyEmissive = GetPropertyByName(rdfModel, "emissive"),
            propertyG = GetPropertyByName(rdfModel, "G"),
            propertyLength = GetPropertyByName(rdfModel, "length"),
            propertyMaterial = GetPropertyByName(rdfModel, "material"),
            propertyR = GetPropertyByName(rdfModel, "R"),
            propertySpecular = GetPropertyByName(rdfModel, "specular"),
            propertyW = GetPropertyByName(rdfModel, "W");

    __int64 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(rdfModel, "c:\\myFile.bin");
    CloseModel(rdfModel);
}