ShadeOutput Class Reference

#include <imtl.h>

Class 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.
+ 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 c)
 
void AccumElementVal (int n, AColor c)
 
void Sum (ShadeOutput *pSample)
 
void Scale (float x)
 
void SumClr (ShadeOutput *pSample)
 
ShadeOutputoperator+= (ShadeOutput &a)
 
ShadeOutputoperator*= (Color x)
 
ShadeOutputoperator= (ShadeOutput &a)
 
- Public Member Functions inherited from BaseInterfaceServer
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Constructor & Destructor Documentation

ShadeOutput ( )
inline
845 :nElements(0), flags(0), gbufId(0){};
int gbufId
Definition: imtl.h:806
ULONG flags
Definition: imtl.h:802
int nElements
Definition: imtl.h:809
ShadeOutput ( int  nEle)
inline
846 :flags(0), gbufId(0){ nElements = nEle; }
int gbufId
Definition: imtl.h:806
ULONG flags
Definition: imtl.h:802
int nElements
Definition: imtl.h:809

Member Function Documentation

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;
}
}
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.
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.
856  {
857  flags = 0;
858  gbufId = 0;
859  c.Black(); t.Black(); ior = 1.0f;
860  // clear nEle's worth of render elements
861  if (nEle >= 0)
862  nElements = nEle;
863  for( int i=0; i < nElements; ++i )
864  elementVals[i].r = elementVals[i].g =
865  elementVals[i].b = elementVals[i].a = 0.0f;
866  }
int gbufId
Definition: imtl.h:806
Color t
Definition: imtl.h:804
void Black()
Definition: color.h:180
ULONG flags
Definition: imtl.h:802
float ior
Definition: imtl.h:805
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803
CoreExport ShadeOutput* Clone ( )
int NewElementVal ( )
inline
871  {
873  return nElements++;
874  }
int nElements
Definition: imtl.h:809
#define N_MAX_RENDER_ELEMENTS
Definition: imtl.h:781
#define DbgAssert(expr)
Definition: assert1.h:74
int NElementVals ( )
inline
875 { return nElements; }
int nElements
Definition: imtl.h:809
void SetNElements ( int  n)
inline
877  {
878  DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
879  nElements = n;
880  }
int nElements
Definition: imtl.h:809
#define N_MAX_RENDER_ELEMENTS
Definition: imtl.h:781
#define DbgAssert(expr)
Definition: assert1.h:74
AColor ElementVal ( int  n)
inline
882  {
883  DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
884  return elementVals[n];
885  }
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
#define N_MAX_RENDER_ELEMENTS
Definition: imtl.h:781
#define DbgAssert(expr)
Definition: assert1.h:74
void SetElementVal ( int  n,
AColor  c 
)
inline
887  {
888  DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
889  elementVals[n] = c;
890  }
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
#define N_MAX_RENDER_ELEMENTS
Definition: imtl.h:781
Color c
Definition: imtl.h:803
#define DbgAssert(expr)
Definition: assert1.h:74
void AccumElementVal ( int  n,
AColor  c 
)
inline
892  {
893  DbgAssert( n>=0 && n<N_MAX_RENDER_ELEMENTS);
894  elementVals[n] += c;
895  }
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
#define N_MAX_RENDER_ELEMENTS
Definition: imtl.h:781
Color c
Definition: imtl.h:803
#define DbgAssert(expr)
Definition: assert1.h:74
void Sum ( ShadeOutput pSample)
inline
897  {
898  c += pSample->c; t += pSample->t;
899  for( int i = 0; i < nElements; ++i )
900  elementVals[i] += pSample->elementVals[i];
901  }
Color t
Definition: imtl.h:804
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803
void Scale ( float  x)
inline
902  {
903  c *= x; t *= x;
904  for( int i = 0; i < nElements; ++i )
905  elementVals[i] *= x;
906  }
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:211
Color t
Definition: imtl.h:804
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803
void SumClr ( ShadeOutput pSample)
inline
908  {
909  c += pSample->c;
910  for( int i = 0; i < nElements; ++i ){
911  elementVals[i].r += pSample->elementVals[i].r;
912  elementVals[i].g += pSample->elementVals[i].g;
913  elementVals[i].b += pSample->elementVals[i].b;
914  }
915  }
float r
These values are in the range 0.0 to 1.0.
Definition: acolor.h:36
float g
Definition: acolor.h:36
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803
float b
Definition: acolor.h:36
ShadeOutput& operator+= ( ShadeOutput a)
inline
917  {
918  c += a.c;
919  t += a.t;
920  for( int i = 0; i < nElements; ++i )
921  elementVals[i] += a.elementVals[i];
922  return *this;
923  }
Color t
Definition: imtl.h:804
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803
ShadeOutput& operator*= ( Color  x)
inline
924  {
925  c *= x; // t *= x;
926  AColor ac( x );
927  ac.a = Intens( x );
928  for( int i = 0; i < nElements; ++i )
929  elementVals[i] *= ac;
930  return *this;
931  }
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:211
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Definition: acolor.h:30
static float Intens(const AColor &c)
Definition: imtl.h:68
Color c
Definition: imtl.h:803
ShadeOutput& operator= ( ShadeOutput a)
inline
933  {
934  flags = a.flags;
935  c = a.c; t = a.t;
936  ior = a.ior;
937  gbufId = a.gbufId;
938  nElements = a.nElements;
939  for( int i = 0; i < nElements; ++i )
940  elementVals[i] = a.elementVals[i];
941  return *this;
942  }
int gbufId
Definition: imtl.h:806
Color t
Definition: imtl.h:804
ULONG flags
Definition: imtl.h:802
float ior
Definition: imtl.h:805
int nElements
Definition: imtl.h:809
AColor elementVals[N_MAX_RENDER_ELEMENTS]
Definition: imtl.h:810
Color c
Definition: imtl.h:803

Member Data Documentation

ULONG flags
Color c
Color t
float ior
int gbufId
int nElements