FBGeometry
 
 
 

FBGeometry regroups all geometry-related elements across several the subclasses FBMesh, FBSurface, FBNurbs and FBPatch. The property MaterialMappingMode can be one of three values. Depending on which is the current values there are different ways of getting the current material.

kFBMappingModeUnique

There is only one material used for the whole model. The material used is the last one in the list of FBGeometry::Materials.

kFBMappingModeVertex

Each vertex has its own material. Calling FBGeometry::VertexMaterialIdGet() gives the index of the material used from the list FBGeometry::Materials.

kFBMappingModeSurface

Each polygon of the model has its own material. Calling FBMesh::PolygonMaterialIdGet() gives the index of the material used from the list FBGeometry::Materials.

By default, models created with the GUI or the SDK use the mapping mode kFBMappingModeUnique. Calling FBGeometry::VertexMaterialIdSet() (with valid vertex Id and material Id) changse the mapping mode to kFBMappingModeVertex. The equivalent is true when calling the method FBMesh::PolygonMaterialIdSet().

From a handle to the model, it is possible to get a mesh object to manipulate the way the model is displayed. This is shown in the following snippet. By creating a mesh object with its constructor, the actual object is then associated to a model. From there, it is possible to add and remove materials and textures, change colors, etc.

HFBModel lModel = new
FBModel(“Model”);
FBMesh lMesh ( lModel );
HFBMaterial lMat = new
FBMaterial(“Material”);
// Setup lMat ...
lMesh.Materials.Add( lMat );