void    sgC3DObject::SetMaterial(const SG_MATERIAL& newMat) const

 

Description:

Sets a new material to the object.

 

Arguments:

newMat - material for the object - is an SG_MATERIAL structure object.

 

The description of this structure:

typedef  struct

{

 int                                       MaterialIndex;

 double                               TextureScaleU;

 double                               TextureScaleV;

 double                               TextureShiftU;

 double                               TextureShiftV;

 double                               TextureAngle;

 bool                                   TextureSmooth;

 bool                                   TextureMult;

 SG_MIX_COLOR_TYPE     MixColorType;

 SG_UV_TYPE                TextureUVType;

} SG_MATERIAL;

 

MaterialIndex - the number of the material in the library defined by the user.

TextureScaleU - texture coefficient of stretch along the U coordinate. Is considered when calculating texture coordinates for each triangle.

TextureScaleV - texture coefficient of stretch along the V coordinate. Is considered when calculating texture coordinates for each triangle.

TextureShiftU - texture shift along the U coordinate. Is considered when calculating texture coordinates for each triangle.

TextureShiftV - texture shift along the V coordinate. Is considered when calculating texture coordinates for each triangle.

TextureAngle - texture rotation angle when overlapping on the object. Is considered when calculating texture coordinates for each triangle.

TextureSmooth - whether to smooth the texture when displaying. This flag is necessary only for saving the object properties from the application using sgCore.

TextureMult - whether to multiply the texture when overlapping on the object. This flag is necessary only for saving the object properties from the application using sgCore.

MixColorType - color mixing type of the material and of the object. Can have the following values: SG_MODULATE_MIX_TYPE (modulate the colors), SG_BLEND_MIX_TYPE (blend the colors) or SG_REPLACE_MIX_TYPE (replace the object color with the color of the material or the texture). This structure field is necessary only for saving the object properties from the application using sgCore.

TextureUVType - type of overlapping texture on the object. Can have the following values: SG_CUBE_UV_TYPE (texture overlapping along the axes), SG_SPHERIC_UV_TYPE (spherical type of the texture overlapping) or SG_CYLINDER_UV_TYPE (cylindrical type of the texture overlapping).

This structure field is necessary to calculate texture coordinates for each object triangle.

This function changes the texture coordinates array for each object triangle - allUV (read the SG_ALL_TRIANGLES structure description at GetTriangles())

 

Returned value:

No values.

 

 

See also:

GetTriangles   GetMaterial