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

#include <ShadeContext.h>

+ Inheritance diagram for ShadeOutput:

Public Member Functions

CoreExport void MixIn (ShadeOutput &a, float f)
 
 ShadeOutput ()
 
 ShadeOutput (int nEle)
 
void Reset (int nEle=-1)
 
CoreExport ShadeOutputClone ()
 
int NewElementVal ()
 
int NElementVals ()
 
void SetNElements (int n)
 
AColor ElementVal (int n)
 
void SetElementVal (int n, AColor color)
 
void AccumElementVal (int n, AColor color)
 
void Sum (ShadeOutput *pSample)
 
void Scale (float x)
 
void SumClr (ShadeOutput *pSample)
 
ShadeOutputoperator+= (ShadeOutput &a)
 
ShadeOutputoperator*= (Color x)
 
ShadeOutputoperator= (const ShadeOutput &a)
 
- 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.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Public Attributes

ULONG flags
 
Color c
 
Color t
 
float ior
 
int gbufId
 
int nElements
 
AColor elementVals [N_MAX_RENDER_ELEMENTS]
 

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 ShadeContext, Class Color.

Description:
An instance of this class is a data member of the ShadeContext. This is used to contain the computed color and transparency of the pixel being shaded by a material. All methods of this class are implemented by the system.
Data Members:
ULONG flags;

These flags are not currently used.

Color c;

Shaded color of the pixel.

Color t;

Transparency of the pixel.

float ior;

Index of refraction of the pixel.

int gbufId;

The G-buffer ID. This allows the MixIn() method to pick the id of the material which was blended in the highest proportion.

Constructor & Destructor Documentation

◆ ShadeOutput() [1/2]

ShadeOutput ( )
inline
179:nElements(0), flags(0), gbufId(0){};
int gbufId
Definition: ShadeContext.h:140
ULONG flags
Definition: ShadeContext.h:136
int nElements
Definition: ShadeContext.h:143

◆ ShadeOutput() [2/2]

ShadeOutput ( int  nEle)
inline
180:flags(0), gbufId(0){ nElements = nEle; }

Member Function Documentation

◆ MixIn()

CoreExport void MixIn ( ShadeOutput a,
float  f 
)
Remarks
This method is used to blend the output of two texmaps, for example, in the Mix texmap. The function is as follows:
{
if (f<=0.0f) {
(*this) = a;
return;
}
else if (f>=1.0f) {
return;
}
else {
float s = 1.0f - f;
flags |= a.flags;
c = s*a.c + f*c;
t = s*a.t + f*t;
ior = s*a.ior + f*ior;
if (f<=0.5f) gbufId = a.gbufId;
}
}
Definition: ShadeContext.h:134
Color c
Definition: ShadeContext.h:137
float ior
Definition: ShadeContext.h:139
Color t
Definition: ShadeContext.h:138
CoreExport void MixIn(ShadeOutput &a, float f)
float a
Definition: texutil.h:51
This does a blend of a with (*this). This blend is applied to the color, transparency, and index of refraction. The flags of are OR'ed together.
Parameters:
ShadeOutput& a

The output of the texmap to blend in.

float f

The amount to blend in, i.e.:

a.MixIn(b, 1.0f) results in 100% of a and none of b.

◆ Reset()

void Reset ( int  nEle = -1)
inline
Remarks
Implemented by the System.

This method resets the data member such that: c is set to black, t is set to black, ior is set to 1.0, gbufId is set to 0, and the flags are set to 0.
Parameters:
int n = -1

By supplying a negative value this method will clear elements but leave the number of elements unchanged.
190 {
191 flags = 0;
192 gbufId = 0;
193 c.Black(); t.Black(); ior = 1.0f;
194 // clear nEle's worth of render elements
195 if (nEle >= 0)
196 nElements = nEle;
197 for( int i=0; i < nElements; ++i )
198 elementVals[i].r = elementVals[i].g =
199 elementVals[i].b = elementVals[i].a = 0.0f;
200 }
void Black()
Definition: color.h:231
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: ShadeContext.h:144
float float b
Definition: texutil.h:51

◆ Clone()

CoreExport ShadeOutput * Clone ( )

◆ NewElementVal()

int NewElementVal ( )
inline
205 {
207 return nElements++;
208 }
#define N_MAX_RENDER_ELEMENTS
Definition: ShadeContext.h:29
#define DbgAssert(expr)
Definition: assert1.h:83

◆ NElementVals()

int NElementVals ( )
inline
209{ return nElements; }

◆ SetNElements()

void SetNElements ( int  n)
inline
211 {
212 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
213 nElements = n;
214 }

◆ ElementVal()

AColor ElementVal ( int  n)
inline
216 {
217 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
218 return elementVals[n];
219 }

◆ SetElementVal()

void SetElementVal ( int  n,
AColor  color 
)
inline
221 {
222 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
223 elementVals[n] = color;
224 }

◆ AccumElementVal()

void AccumElementVal ( int  n,
AColor  color 
)
inline
226 {
227 DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
228 elementVals[n] += color;
229 }

◆ Sum()

void Sum ( ShadeOutput pSample)
inline
231 {
232 c += pSample->c; t += pSample->t;
233 for( int i = 0; i < nElements; ++i )
234 elementVals[i] += pSample->elementVals[i];
235 }

◆ Scale()

void Scale ( float  x)
inline
236 {
237 c *= x; t *= x;
238 for( int i = 0; i < nElements; ++i )
239 elementVals[i] *= x;
240 }
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:212

◆ SumClr()

void SumClr ( ShadeOutput pSample)
inline
242 {
243 c += pSample->c;
244 for( int i = 0; i < nElements; ++i ){
245 elementVals[i].r += pSample->elementVals[i].r;
246 elementVals[i].g += pSample->elementVals[i].g;
247 elementVals[i].b += pSample->elementVals[i].b;
248 }
249 }
float r
These values are in the range 0.0 to 1.0.
Definition: acolor.h:36
float b
Definition: acolor.h:38
float g
Definition: acolor.h:37

◆ operator+=()

ShadeOutput & operator+= ( ShadeOutput a)
inline
251 {
252 c += a.c;
253 t += a.t;
254 for( int i = 0; i < nElements; ++i )
255 elementVals[i] += a.elementVals[i];
256 return *this;
257 }

◆ operator*=()

ShadeOutput & operator*= ( Color  x)
inline
258 {
259 c *= x; // t *= x;
260 AColor ac( x );
261 ac.a = Intens( x );
262 for( int i = 0; i < nElements; ++i )
263 elementVals[i] *= ac;
264 return *this;
265 }
static float Intens(const AColor &c)
Definition: acolor.h:476
Definition: acolor.h:31

◆ operator=()

ShadeOutput & operator= ( const ShadeOutput a)
inline
267 {
268 flags = a.flags;
269 c = a.c; t = a.t;
270 ior = a.ior;
271 gbufId = a.gbufId;
272 nElements = a.nElements;
273 for( int i = 0; i < nElements; ++i )
274 elementVals[i] = a.elementVals[i];
275 return *this;
276 }

Member Data Documentation

◆ flags

ULONG flags

◆ c

Color c

◆ t

Color t

◆ ior

float ior

◆ gbufId

int gbufId

◆ nElements

int nElements

◆ elementVals