Class IReshadeFragment

3DS Max Plug-In SDK

Class IReshadeFragment

See Also: Class InterfaceServer, Class IReshading, Class Point2, Class Point3

class IReshadeFragment : public InterfaceServer

Description:

This class is available in release 4.0 and later only.

The Reshade Fragment interface is the materials/shaders/textures interface to reshading fragments. This interface is only concerned with saving and retrieving values in the fragments variable sized cache. Values are always saved in multiples of 32 bit words, and they can be a variety of types, colors, float’s, int’s, etc. Unit vectors are compressed to a single 32 bit word. Point2 and Point3 data types save multiple floats.

Color channels will be compressed to a 32 bit rgba color and saved in the cache.

Color32 channels are only used internally. This is the ‘raw’ form of what’s stored, other forms may be accessed from this class.

Float and integer channels are stored uncompressed, they are stored directly in the 32 bits.

The Point2 & Point3 channels are shells that store multiple float channels so these values will be uncompressed. These should be used with great caution, as this memory is stored per fragment, in a scene with 100,000 fragments of a given material, a point3 channel will add 1.2 megabytes to the storage for the reshading buffer.

Methods:

public:

Prototype:

virtual int NChannels()=0;

Remarks:

This method returns the number of textures for the fragment.

Prototype:

virtual int NFirstChannel()=0;

Remarks:

This method returns the index of the first channel.

Prototype:

virtual int NTextures()=0;

Remarks:

This method returns the number of textures.

Prototype:

virtual Color32 Channel(int nChan)=0;

Remarks:

This method returns the specified channel.

Parameters:

int nChan

The channel you wish to return.

Prototype:

virtual void SetChannel(int nChan, Color32 c)=0;

Remarks:

This method allows you to set a channel in raw mode to a new value.

Parameters:

int nChan

The channel you wish to set.

Color32 c

The new value to set.

Prototype:

virtual void AddChannel(Color32 c)=0;

Remarks:

This method allows you to add a new color channel in raw mode to the end of the cache.

Parameters:

Color32 c

The channel value you wish to set.

Prototype:

virtual void AddColorChannel(RGBA tex)=0;

Remarks:

This method allows you to add a new color channel to the end of the cache. The color will be compressed to 32bits.

Parameters:

RGBA tex

The color channel value you wish to add.

 

Prototype:

virtual void AddFloatChannel(float f)=0;

Remarks:

This method allows you to add a float channel in the fragment cache.

Parameters:

float f

The channel value to add.

Prototype:

virtual void AddIntChannel(int i)=0;

Remarks:

This method allows you to add an integer channel in the fragment cache.

Parameters:

int i

The integer value to add.

Prototype:

virtual void AddUnitVecChannel(Point3 v)=0;

Remarks:

This method allows you to add a unit vector channel in the fragment cache, compressed to 32-bits.

Parameters:

Point3 v

The unit vector to add.

Prototype:

virtual void AddPoint2Channel(Point2 p)=0;

Remarks:

This method allows you to add a Point2 channel in the fragment cache, uncompressed.

Parameters:

Point2 p

The Point2 to add.

Prototype:

virtual void AddPoint3Channel(Point3 p)=0;

Remarks:

This method allows you to add a Point3 channel in the fragment cache, uncompressed.

Parameters:

Point3 p

The Point3 to add.

Prototype:

virtual void SetColorChannel(int nChan, RGBA tex)=0;

Remarks:

This method sets the existing color channel number nChan to the new value.

Parameters:

int nChan

The color channel number.

RGBA text

The new color value.

Prototype:

virtual void SetFloatChannel(int nChan, float f)=0;

Remarks:

This method allows you to set a float channel in the fragment cache to a new value.

Parameters:

int nChan

The float channel number.

float f

The new value to set.

Prototype:

virtual void SetIntChannel(int nChan, int i)=0;

Remarks:

This method allows you to set an int channel in the fragment cache to a new value.

Parameters:

int nChan

The int channel number.

int i

The new value to set.

Prototype:

virtual void SetUnitVecChannel(int nChan, Point3 v)=0;

Remarks:

This method allows you to set a unit vector channel in the fragment cache to a new value.

Parameters:

int nChan

The unit vector channel number.

Point3 v

The new value to set.

Prototype:

virtual void SetPoint2Channel(int nChan, Point2 p)=0;

Remarks:

This method allows you to set a Point2 channel in the fragment cache to a new value.

Parameters:

int nChan

The Point2 channel number.

Point2 p

The new value to set.

Prototype:

virtual void SetPoint3Channel(int nChan, Point3 p)=0;

Remarks:

This method allows you to set a Point3 channel in the fragment cache to a new value.

Parameters:

int nChan

The Point3 channel number.

Point3 p

The new value to set.

Prototype:

virtual RGBA GetColorChannel(int nChan)=0;

Remarks:

This method will return an existing color channel, expanded to float RGBA.

Parameters:

int nChan

The color channel you wish to return.

Prototype:

virtual float GetFloatChannel(int nChan)=0;

Remarks:

This method will return an existing float channel.

Parameters:

int nChan

The float channel you wish to return.

Prototype:

virtual int GetIntChannel(int nChan)=0;

Remarks:

This method will return an existing int channel.

Parameters:

int nChan

The int channel you wish to return.

Prototype:

virtual Point3 GetUnitVecChannel(int nChan)=0;

Remarks:

This method will return an existing unit vector channel.

Parameters:

int nChan

The unit vector channel you wish to return.

Prototype:

virtual Point2 GetPoint2Channel(int nChan)=0;

Remarks:

This method will return an existing Point2 channel.

Parameters:

int nChan

The Point2 channel you wish to return.

Prototype:

virtual Point3 GetPoint3Channel(int nChan)=0;

Remarks:

This method will return an existing Point3 channel.

Parameters:

int nChan

The Point3 channel you wish to return.