Class StdMat2

3DS Max Plug-In SDK

Class StdMat2

See Also: Class StdMat, Class Shader, Class Sampler, Class Class_ID.

class StdMat2 : public StdMat

Description:

This class is available in release 3.0 and later only.

This is the base class for all materials supporting the plug-in shader mechanism. The 3ds max Standard material is derived from this class.

Methods:

public:

Prototype:

virtual BOOL KeyAtTime(int id, TimeValue t)=0;

Remarks:

Returns TRUE if the specified parameter whose ID is passed has a key at the time passed; otherwise FALSE.

Parameters:

int id

The ID of the parameter to check.

TimeValue t

The time to check.

Prototype:

virtual int GetMapState(int indx)=0;

Remarks:

Returns a value to indicate the state of the specified map. One of the following values:

0: No map present.

1: Map present but disabled.

2: Map present and on.

Parameters:

int indx

The index of the map to check. See List of Texture Map Indices.

Prototype:

virtual TSTR GetMapName(int indx)=0;

Remarks:

Returns the name of the map whose index is passed.

Parameters:

int indx

The index of the map to check. See List of Texture Map Indices.

Prototype:

virtual void SyncADTexLock(BOOL lockOn)=0;

Remarks:

This method is called when the state of the Ambient/Diffuse Texture lock is toggled. The material should store the setting and update the UI as required.

Parameters:

BOOL lockOn

TRUE for on; FALSE for off.

Prototype:

virtual BOOL SwitchShader(Class_ID id)=0;

Remarks:

This method is called when a new Shader has been selected.

Parameters:

Class_ID id

The Class_ID of the new shader to switch to.

Prototype:

virtual Shader* GetShader()=0;

Remarks:

Returns a pointer to the Shader in use. See Class Shader for details on this plug-in type.

Prototype:

virtual BOOL IsFaceted()=0;

Remarks:

Returns TRUE if the shader is faceted; otherwise FALSE. The pre-R3 Constant shader is faceted. The other shaders are not.

Prototype:

virtual void SetFaceted(BOOL on)=0;

Remarks:

Sets the faceted setting of the Shader.

Parameters:

BOOL on

TRUE if it is faceted; FALSE if not.

Prototype:

virtual long StdIDToChannel(long id)=0;

Remarks:

Returns the index of the mapping channels which corresponds to the specified Standard materials texture map ID.

Parameters:

long id

The ID whose corresponding channel to return. See List of Texture Map Indices.

Return Value:

The zero based index of the channel. If there is not a corresponding channel return -1.

Prototype:

virtual void SetShading(int s);

Remarks:

Sets the active shader to the one specified. The supported types are the pre-R3 shaders.

Parameters:

int s

One of the following values (all other values are a NOOP):

SHADE_CONST (Phong, faceted).

SHADE_PHONG

SHADE_METAL

SHADE_BLINN

Default Implementation:

{}

Prototype:

virtual int GetShading();

Remarks:

Returns one of the pre-R3 shader types. If an R3 shader type is active, SHADE_BLINN is returned.

Return Value:

One of the following values:

SHADE_CONST (Phong, faceted).

SHADE_PHONG

SHADE_METAL

SHADE_BLINN

Default Implementation:

{ return -1; }

Prototype:

virtual BOOL SwitchSampler(Class_ID id)=0;

Remarks:

This method is called when the active Sampler is switched.

Parameters:

Class_ID id

The Class_ID of the new Sampler.

Prototype:

virtual Sampler *GetPixelSampler()=0;

Remarks:

Returns a pointer to the sampler used.

Prototype:

virtual BOOL GetSelfIllumColorOn(int mtlNum=0, BOOL backFace=FALSE)=0;

Remarks:

Returns the Self Illumination Color On setting. TRUE if on; FALSE if off.

Parameters:

These parameters are not used and may be ignored.

Prototype:

virtual Color GetSelfIllumColor(int mtlNum, BOOL backFace)=0;

Remarks:

Returns the Self Illumination Color setting.

Parameters:

These parameters are not used and may be ignored.

Prototype:

virtual Color GetSelfIllumColor(TimeValue t)=0;

Remarks:

Returns the Self Illumination Color setting at the specified time.

Parameters:

TimeValue t

The time at which to get the color.

Prototype:

virtual void SetSelfIllumColorOn(BOOL on)=0;

Remarks:

Sets the Self Illumination Color On setting

Parameters:

BOOL on

TRUE for on; FALSE for off.

Prototype:

virtual void SetSelfIllumColor(Color c, TimeValue t)=0;

Remarks:

Sets the Self Illumination Color setting at the specified time.

Parameters:

Color c

The color to set.

TimeValue t

The time at which to set the color.