Material
Class
Example
Here you can find code snippits that show how the API call Material can be used.
using Engine; public void CreateMaterial() { Int64 model = Engine.x86_64.CreateModel(); if (model != 0) { // // Classes // Int64 classColor = Engine.x86_64.GetClassByName(model, "Color"), classColorComponent = Engine.x86_64.GetClassByName(model, "ColorComponent"), classCube = Engine.x86_64.GetClassByName(model, "Cube"), classMaterial = Engine.x86_64.GetClassByName(model, "Material"); // // Object Properties (relations) // Int64 propertyAmbient = Engine.x86_64.GetPropertyByName(model, "ambient"), propertyColor = Engine.x86_64.GetPropertyByName(model, "color"), propertyDiffuse = Engine.x86_64.GetPropertyByName(model, "diffuse"), propertyEmissive = Engine.x86_64.GetPropertyByName(model, "emissive"), propertyMaterial = Engine.x86_64.GetPropertyByName(model, "material"), propertySpecular = Engine.x86_64.GetPropertyByName(model, "specular"); // // Datatype Properties (attributes) // Int64 propertyB = Engine.x86_64.GetPropertyByName(model, "B"), propertyG = Engine.x86_64.GetPropertyByName(model, "G"), propertyLength = Engine.x86_64.GetPropertyByName(model, "length"), propertyR = Engine.x86_64.GetPropertyByName(model, "R"), propertyW = Engine.x86_64.GetPropertyByName(model, "W"); // // Instances (creating) // Int64 myInstanceColor = Engine.x86_64.CreateInstance(classColor, (string) null), myInstanceColorComponent = Engine.x86_64.CreateInstance(classColorComponent, (string) null), myInstanceCube = Engine.x86_64.CreateInstance(classCube, (string) null), myInstanceMaterial = Engine.x86_64.CreateInstance(classMaterial, (string) null); Engine.x86_64.SetObjectProperty(myInstanceColor, propertyAmbient, ref myInstanceColorComponent, 1); Engine.x86_64.SetObjectProperty(myInstanceColor, propertyDiffuse, ref myInstanceColorComponent, 1); Engine.x86_64.SetObjectProperty(myInstanceColor, propertyEmissive, ref myInstanceColorComponent, 1); Engine.x86_64.SetObjectProperty(myInstanceColor, propertySpecular, ref myInstanceColorComponent, 1); double R = 0.0, G = 1.0, B = 0.0, W = 0.5; Engine.x86_64.SetDatatypeProperty(myInstanceColorComponent, propertyR, ref R, 1); Engine.x86_64.SetDatatypeProperty(myInstanceColorComponent, propertyG, ref G, 1); Engine.x86_64.SetDatatypeProperty(myInstanceColorComponent, propertyB, ref B, 1); Engine.x86_64.SetDatatypeProperty(myInstanceColorComponent, propertyW, ref W, 1); double length = 1.8; Engine.x86_64.SetDatatypeProperty(myInstanceCube, propertyLength, ref length, 1); Engine.x86_64.SetObjectProperty(myInstanceCube, propertyMaterial, ref myInstanceMaterial, 1); Engine.x86_64.SetObjectProperty(myInstanceMaterial, propertyColor, ref myInstanceColor, 1); // // The resulting model can be viewed in 3D-Editor.exe // Engine.x86_64.SaveModel(model, "c:\\created\\myMaterial.bin"); Engine.x86_64.CloseModel(model); } }