3ds Max C++ API Reference
Loading...
Searching...
No Matches
IllumParams Class Reference

#include <C:/adskgit/3dsmax/3dsmax/3dswin/src/maxsdk/include/Materials/IllumParams.h>

Inheritance diagram for IllumParams:

Public Member Functions

CoreExport IllumParams (int nUserOut=0, const MCHAR **pUserNames=NULL)
CoreExport ~IllumParams ()
int nUserIllumChannels ()
const MCHARGetUserIllumName (int n)
CoreExport int FindUserIllumName (const MCHAR *name)
void SetUserIllumOutput (int n, Color &out)
CoreExport void SetUserIllumOutput (const MCHAR *name, Color &out)
Color GetUserIllumOutput (int n)
CoreExport Color GetUserIllumOutput (const MCHAR *name, int n)
void ClearOutputs ()
void ClearInputs ()
Public Member Functions inherited from BaseInterfaceServer
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
virtual UtilExport int NumInterfaces () const
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
virtual UtilExport ~BaseInterfaceServer ()
Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
template<class InterfaceType>
InterfaceType * GetTypedInterface ()

Public Attributes

ShaderpShader
MtlpMtl
Color channels [STD2_NMAX_TEXMAPS]
float finalOpac
float reflectAmt
float refractAmt
ULONG hasComponents
ULONG stdParams
intstdIDToChannel
Color ambIllumOut
Color diffIllumOut
Color transIllumOut
Color selfIllumOut
Color specIllumOut
Color reflIllumOut
int nUserIllumOut
const MCHAR ** userIllumNames
Color * userIllumOut
float diffIllumIntens
float finalAttenuation
Color finalC
Color finalT

Additional Inherited Members

Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces

Detailed Description

See also
Class Shader, Class Point3, Class Color.

Description:
This class allows the Standard material to get the parameters from a Shader plug-in. It also allows the Shader to supply its computed color data back to the Standard material. The Standard material will handle the texturing but it needs to know the color before the texturing is done.

The shader object holds some raw parameters. But these parameters may be textured. So for each pixel that will be shaded, the 3ds Max shade routine asks the shader to fill in the raw values. Then it applies the texture over the top of any of the values which are textured.
Data Members:
Shader* pShader;

This parameter is available in release 4.0 and later only.

A pointer to the shader.

Mtl* pMtl;

This parameter is available in release 4.0 and later only.

A pointer to the material being shaded or NULL if it's a background.

Color channels[32];

A color channel for each of the possible parameters that may be textured. Note that these channels don't have specific meanings. They are defined by each Shader. The Shader tells the Standard material what data is in these channels using its ChannelType() and StdIDToChannel() methods.

float falloffOpac;

Shaders using standard opacity can ignore this data member. This is available for certain Shaders which don't use the standard 3ds Max transparency equation. This allows these Shaders to simulate the 3ds Max version. This is the pre-computed textured opacity with standard falloff applied. The value here is pre-computed to consider all the standard opacity settings of falloff direction, etc. The standard transparency computation then uses this after shading. So a shader could modify this value if it wanted to to affect the transparency.

Note: The regular opacity can be obtained from the channel data.

float kR;

This value is used when there is a reflection and an atmosphere present. Normally if there is no atmosphere (for instance no Fog in the scene) then the transparency of the reflection is 100% (it is unaffected). However, if there is an atmosphere present it will impart some level of opacity. This opacity (alpha value) is not available via the reflection color. Thus this data member is here to provide this opacity information to the Shader.

This value is the alpha which is returned by the reflection query that has the transparency of the atmosphere contained within it, which is then multiplied by the Amount spinner. This can then be used either by the Shader or by the standard handling for reflection maps.

ULONG hasComponents;

These are the bits for the active components of bump, reflection, refraction and opacity mapping. If the bit is set that component is active. This provides a quick way for a Shader to check if they're used (as opposed to looking through the channels array searching for these channel types).

HAS_BUMPS – If bump mapping is present this is set.

HAS_REFLECT – If there is any kind of reflection (raytraced, etc) then this is set.

HAS_REFRACT – If there is any kind of refraction then this is set..

HAS_OPACITY – If opacity mapping is used this is set.

HAS_REFLECT_MAP – If there is a reflection map only this is set. This is used by the Strauss shader for example. If it sees a reflection map present it dims the diffuse channel.

HAS_REFRACT_MAP – If there is a refraction map only then this is set.

ULONG stdParams;

The standard parameter bits. See Standard Parameter flags. This is filled in by the Standard material.

Color ambIllumOut;

This is the ambient output from the Illum() method.

Color diffIllumOut;

This is the diffuse output from the Illum() method.

Color transIllumOut;

This is the transparency output from the Illum() method.

Color selfIllumOut;

This is the self illumination output from the Illum() method.

Color specIllumOut;

This is the specular illumination output from the Illum() method.

Color reflIllumOut;

This is the reflection output from the Illum() method. Certain shaders may wish to store the reflection output here (as opposed to providing it in the channels array). This is the '"raw " color from the direction of reflection (unattenuated). Some combiner implementations (Shader::CombineComponents())can get the reflection data here, others may get it from the channels.

float diffIllumIntens;

Used only by reflection dimming, intensity of diffIllum prior to color multiply.

float finalAttenuation;

The final attenuation for combining components.

float finalOpac;

This is the final opacity value used for combining components together in Shader::CombineComponents().

Color finalC;

This is the final output color that the Shader::CombineComponents() composites together.

Color finalT;

This is the final Shader transparency color output.

Constructor & Destructor Documentation

◆ IllumParams()

CoreExport IllumParams ( int nUserOut = 0,
const MCHAR ** pUserNames = NULL )

◆ ~IllumParams()

Member Function Documentation

◆ nUserIllumChannels()

int nUserIllumChannels ( )
inline
161{ return nUserIllumOut; }
int nUserIllumOut
Definition IllumParams.h:133

◆ GetUserIllumName()

const MCHAR * GetUserIllumName ( int n)
inline
164 {
166 if( userIllumNames )
167 return userIllumNames[n];
168 return NULL;
169 }
#define NULL
Definition autoptr.h:18
const MCHAR ** userIllumNames
Definition IllumParams.h:134
#define DbgAssert(expr)
Definition assert1.h:83

◆ FindUserIllumName()

CoreExport int FindUserIllumName ( const MCHAR * name)

◆ SetUserIllumOutput() [1/2]

void SetUserIllumOutput ( int n,
Color & out )
inline
176 {
178 userIllumOut[n] = out;
179 }
Color * userIllumOut
Definition IllumParams.h:135

◆ SetUserIllumOutput() [2/2]

CoreExport void SetUserIllumOutput ( const MCHAR * name,
Color & out )

◆ GetUserIllumOutput() [1/2]

Color GetUserIllumOutput ( int n)
inline
183 {
185 return userIllumOut[n];
186 }

◆ GetUserIllumOutput() [2/2]

CoreExport Color GetUserIllumOutput ( const MCHAR * name,
int n )

◆ ClearOutputs()

void ClearOutputs ( )
inline
Remarks
This method is called by the Standard material prior to calling the Illum() method of the Shader. It sets to black all the output colors:

ambIllumOut=diffIllumOut=transIllumOut=selfIllumOut=

specIllumOut=reflIllumOut=Color(0.0f, 0.0f, 0.0f);
195 {
197 specIllumOut=reflIllumOut= Color( 0.0f, 0.0f, 0.0f );
199 for( int i=0; i < nUserIllumOut; ++i )
200 userIllumOut[i] = finalC;
201 }
Color ambIllumOut
Definition IllumParams.h:129
Color diffIllumOut
Definition IllumParams.h:129
float finalAttenuation
Definition IllumParams.h:138
Color finalC
Definition IllumParams.h:141
Color reflIllumOut
Definition IllumParams.h:130
Color selfIllumOut
Definition IllumParams.h:129
Color finalT
Definition IllumParams.h:142
Color transIllumOut
Definition IllumParams.h:129
float diffIllumIntens
Definition IllumParams.h:137
Color specIllumOut
Definition IllumParams.h:130
@ Color
The grid is displayed using a color which is accumulated during the volume sampling.
Definition ViewportVolumeDisplay.h:56

◆ ClearInputs()

void ClearInputs ( )
inline
203 {
204 /*mtlFlags = */ stdParams = hasComponents = 0;
205 pShader = NULL; pMtl = NULL;
207 refractAmt = reflectAmt = 0.0f;
208 for( int i=0; i < STD2_NMAX_TEXMAPS; ++i )
209 channels[ i ] = Color( 0, 0, 0 );
210 }
#define STD2_NMAX_TEXMAPS
Definition IllumParams.h:19
ULONG hasComponents
Definition IllumParams.h:124
ULONG stdParams
Definition IllumParams.h:125
Shader * pShader
Definition IllumParams.h:116
Mtl * pMtl
Definition IllumParams.h:117
float refractAmt
Definition IllumParams.h:123
int * stdIDToChannel
Definition IllumParams.h:126
float reflectAmt
Definition IllumParams.h:122
Color channels[STD2_NMAX_TEXMAPS]
Definition IllumParams.h:119

Member Data Documentation

◆ pShader

Shader* pShader

◆ pMtl

Mtl* pMtl

◆ channels

Color channels[STD2_NMAX_TEXMAPS]

◆ finalOpac

float finalOpac

◆ reflectAmt

float reflectAmt

◆ refractAmt

float refractAmt

◆ hasComponents

ULONG hasComponents

◆ stdParams

ULONG stdParams

◆ stdIDToChannel

int* stdIDToChannel

◆ ambIllumOut

Color ambIllumOut

◆ diffIllumOut

Color diffIllumOut

◆ transIllumOut

Color transIllumOut

◆ selfIllumOut

Color selfIllumOut

◆ specIllumOut

Color specIllumOut

◆ reflIllumOut

Color reflIllumOut

◆ nUserIllumOut

int nUserIllumOut

◆ userIllumNames

const MCHAR** userIllumNames

◆ userIllumOut

Color* userIllumOut

◆ diffIllumIntens

float diffIllumIntens

◆ finalAttenuation

float finalAttenuation

◆ finalC

Color finalC

◆ finalT

Color finalT