THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/10/2005 at 16:22, xxxxxxxx wrote:
For materials, you need at least two things:
2. Texture Tag
Optionally, you may need polygon/point selections to which to restrict the Texture Tag's material application (Selection setting of the Texture tag in the A.M.).
The Texture Tag points to the Material, thus providing a link between the Object and the Material. The Material is used for specifying texturing properties. These are broken into Channels (such as Color, Diffusion, Bump, Luminance etc.).
First thing you'll need to do is create a Material and a Texture Tag, insert the Texture Tag into the Object, insert the Material into the Document, and make reference to the Material from the Texture Tag. Then you can set channels and their containers (something like this - untested) :
// obj is BaseObject to receive Texture Tag
if (!(document = obj->GetDocument())) return FALSE;
if (!(material = AllocMaterial(Mmaterial))) return FALSE;
if (!(texturetag = AllocTag(Ttexture))) return FALSE;
if (!obj->InsertTag(texturetag)) return FALSE;
if (!document->InsertMaterial(material)) return FALSE;
if (!(channel = material->GetChannel(CHANNEL_COLOR))) return FALSE;
if (!(container = channel->GetContainer())) return FALSE;
container->SetData(CH_COLOR, vector(1.0, 0.0, 0.0)); // Make the Color red