Class Tex3D

3DS Max Plug-In SDK

Class Tex3D

See Also: Class Texmap, Working with Materials and Textures.

class Tex3D : public Texmap

Description:

Developers that have created a 3D Studio/DOS SXP and a corresponding 3ds max texture plug-in may want to subclass from this class. It provides a way to have an instance of your 3ds max texture plug-in created automatically when the corresponding SXP is found in a 3DS file being imported.

This works as follows:

In the 3ds max texture plug-in's implementation of DllMain() the following function is called:

void RegisterSXPReader(TCHAR *sxpName, Class_ID cid);

The plug-in passes its own SXP name (i.e. "MARBLE_I.SXP") and its own Class_ID.

The system then remembers this. When the 3DStudio import plug-ins is loading a .3DS file and it encounters an SXP with this name, it will create an instance of the plug-in class (using the Class_ID) and call the method of this class ReadSXPData(). The plug-in can then initialize itself with proper values by reading the old SXP data.

A sample plug-in that uses this technique is the 3ds max Marble texture. It imports the settings from the 3D Studio Marble SXP. See the sample code in \MAXSDK\SAMPLES\MATERIALS\MARBLE.CPP.

Methods:

Prototype:

virtual void ReadSXPData(TCHAR *name, void *sxpdata)=0;

Remarks:

This method is called when the 3D Studio/DOS import plug-in encounters an SXP with the name registered by RegisterSXPReader().

Parameters:

TCHAR *name

The name of the SXP.

void *sxpdata

This is the SXP's initialization data. The plug-in can look at this data to see what numbers it was initialized to in the .3DS file being imported. It can then set its initial value to match the SXP settings.