The kFaceLightingModel property provides the ability to disable faces visualization (Invisible value), fill faces using constant color (Constant value), or choose one of the complex lighting models (Phong or Gooch values).
Phong is a classic photorealistic lighting model. Gooch is a non-photorealistic lighting model, which provides more geometric information of the same richness as human-drawn technical illustrations. Images below show how a drawing is changed according to value of the kFaceLightingModel property.
Invisible
Constant
Phong
Gooch
To change the face's lighting model the setTrait() method can be used. For example,
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingModel, (OdInt32)OdGiVisualStyleProperties::kGooch);
The kFaceLightingQuality property can be set in one of the following values:
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerFaceLighting);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerVertexLighting);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceLightingQuality, (OdInt32)OdGiVisualStyleProperties::kPerPixelLighting);
The kFaceColorMode property allows to choose which color modification will be applied to final faces.
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kObjectColor);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kBackgroundColor);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kMono);
// Set a color
OdCmColor cmColor(OdCmEntityColor::kByColor);
cmColor.setRGB(0, 255, 0);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceMonoColor, &cmColor);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kTint);
// Set a face tint color
OdCmColor tintColor(OdCmEntityColor::kByColor);
tintColor.setRGB(255, 255, 165);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceMonoColor, &tintColor);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceColorMode, (OdInt32)OdGiVisualStyleProperties::kDesaturate);
Opacity override can be helpful to review details of large geometry models, where front objects overlay back objects. To show the changes of the kFaceOpacity property, the kFaceOpacity flag should be set in the kFaceModifiers property.
bool faceOpacityFlag = pVStyle->traitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kFaceOpacityFlag);
if (!faceOpacityFlag)
pVStyle->setTraitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kFaceOpacityFlag);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceOpacity, 0.5);
The kFaceSpecular property is used to control the size of light glare on a shiny surface. Glare is a reflected light source, illuminating a surface. For a more realistic effect it is recommended to set a value of the kFaceSpecular property as small as possible. To show the changes of the kFaceSpecular property, the kSpecular flag should be set in the kFaceModifiers property.
bool faceSpecularFlag = pVStyle->traitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kSpecularFlag);
if (!faceSpecularFlag)
pVStyle->setTraitFlag(OdGiVisualStyleProperties::kFaceModifiers, OdGiVisualStyleProperties::kSpecularFlag);
pVStyle->setTrait(OdGiVisualStyleProperties::kFaceSpecular, 3.0);
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|