Main Index : Reference :
[BaseMaterial] AllocMaterial([int] type);
class BaseMaterial : BaseList2D
{
public:
BaseMaterial();
[BaseDocument] GetDocument();
[string] GetName();
[bool] SetName([string] name);
[BaseContainer] GetMainData();
[bool] SetMainData([BaseContainer] data);
[BaseChannel] GetChannel([int] channel);
[bool] GetChannelState();
[bool] SetChannelState([bool] on);
[bool] Update();
[bool] CopyTo([BaseMaterial] dest);
[BaseMaterial] GetClone();
}
[BaseMaterial] AllocMaterial([int] type);
Allocates a BaseMaterial of the specified type:
| Type | Description |
|---|---|
|
|
Base material. |
|
|
Standard material. |
|
|
Plugin material. |
|
|
Fog. |
|
|
Terrain. |
|
|
Danel. |
|
|
Banji. |
|
|
Banzi. |
|
|
Cheen. |
|
|
Mabel. |
|
|
Nukei. |
[BaseDocument] GetDocument();
Returns the document that the material belongs to, or NULL if the material is loose.
[string] GetName();
Returns the name of the material.
[bool] SetName([string] name);
Sets the name of the material to name. Returns TRUE if successful.
[BaseContainer] GetMainData();
Returns a container containing various settings for the material. It contains the following container values:
| Container ID | Type | Explanation |
DIFFUSION_AFFECT_SPECULAR |
[bool] |
Affect specular |
DIFFUSION_AFFECT_REFLECTION |
[bool] |
Affect reflection |
DIFFUSION_AFFECT_LUMINANCE |
[bool] |
Affect luminance |
TRANSPARENCY_FRESNEL |
[bool] |
Fresnel |
TRANSPARENCY_ADDITIVE |
[bool] |
Additive transparency |
TRANSPARENCY_N |
[float] |
Refraction index |
ENVIRONMENT_TILESX |
[float] |
Environment tiles X |
ENVIRONMENT_TILESY |
[float] |
Environment tiles Y |
FOG_DISTANCE |
[float] |
Fog distance |
BUMP_STRENGTH |
[float] |
Bump strength |
BUMP_MIPFALLOFF |
[bool] |
MIP Falloff |
ALPHA_DELTA |
[vector] |
Delta color |
ALPHA_SOFT |
[bool] |
Soft alpha |
ALPHA_IMAGEALPHA |
[bool] |
Image alpha |
ALPHA_INVERT |
[bool] |
Invert alpha |
SPECULAR_WIDTH |
[float] |
Highlight width |
SPECULAR_HEIGHT |
[float] |
Highlight height |
SPECULAR_MODE |
[int] |
Highlight mode (see dialog) |
GLOW_INNER |
[float] |
Inner strength |
GLOW_OUTER |
[float] |
Outer strength |
GLOW_RADIUS |
[float] |
Radius |
GLOW_RANDOM |
[float] |
Randomness |
GLOW_FREQUENCY |
[float] |
Frequency |
GLOW_USEMATERIAL |
[bool] |
Use material color |
DISPLACEMENT_STRENGTH |
[float] |
Displacement strength |
DISPLACEMENT_HEIGHT |
[float] |
Displacement height |
[bool] SetMainData([BaseContainer] data);
Sets various settings of the material according to the container data. For a list of the container values that it contains, please see GetMainData().
[BaseChannel] GetChannel([int] channel);
Returns the specified channel. Possible values for channel are:
| Channel | Explanation |
CHANNEL_COLOR |
Color channel |
CHANNEL_LUMINANCE |
Luminance channel |
CHANNEL_TRANSPARENCY |
Transparency channel |
CHANNEL_REFLECTION |
Reflection channel |
CHANNEL_ENVIRONMENT |
Environment channel |
CHANNEL_FOG |
Fog channel |
CHANNEL_BUMP |
Bump channel |
CHANNEL_ALPHA |
Alpha channel |
CHANNEL_SPECULAR |
Highlight channel |
CHANNEL_SPECULARCOLOR |
Highlight color channel |
CHANNEL_GLOW |
Glow channel |
CHANNEL_DISPLACEMENT |
Displacement channel |
CHANNEL_DIFFUSION |
Diffusion channel |
[bool] GetChannelState([int] channel);
Returns the state of the specified channel. For a list of channel values, please see GetChannel().
[bool] SetChannelState([int] channel, [bool] on);
Sets the state of the specified channel to on. For a list of channel values, please see GetChannel().
[bool] Update();
Recalculates the material's thumbnail and updates internal values. Returns TRUE if successful.
[bool] CopyTo([BaseMaterial] dest);
Copies the material to dest. Returns TRUE if successful.
[BaseMaterial] GetClone();
Returns a copy of the material.
// Activates the bump channel for a material
var mat = doc->GetFirstMaterial();
mat->SetChannelState(CHANNEL_BUMP, TRUE);
// Sets a texture for it
var bump = doc->GetChannel(CHANNEL_BUMP);
var bumpBc = bump->GetContainer();
bumpBc->SetData(CH_TEXTURE, "foo.tif");
bump->SetContainer(bumpBc);