Public Member Functions

ShadowType Class Reference

Search for all occurrences

Detailed Description

This class is only available in release 5 or later.

The user of GetAreaShadowType() is a linear or area light. The usage is:

void AreaShadowLightObjDesc::createShadowGenerator(AreaLight* light,bool forceShadowBuf)
{
    ShadowType* shad = light->ActiveShadowType();
    IAreaShadowType* area = shad->GetAreaShadowType();

// If we aren't forcing Shadow Map and the shadow generator
// supports area shadows, then create the area shadow generator.
// The flags are the same as for CreateShdowGenerator
    if (!forceShadowBuf && area != NULL) {
        _areaShadGen = area->CreateAreaShadowGenerator(light, this, SHAD_2SIDED)
    }
    else {
        _shadGen = shad->CreateShadowGenerator(light, this, SHAD_2SIDED);
    }
}

Sampling the area shadows is a little tricky to allow for some optimizaton. This is an example of the code needed in AreaShadowLightObjDesc::Illuminate. The variable, sampler, should be local to allow multithreading.

AreaShadowSampler* sampler =_areaShadGen->InitializeSampler(alloca(_areaShadGen->GetSamplerSize()));

Once the sampler has been initialized, you can calculate the visibility between any point on the light and the point being shaded by using:

float atten = sampler->(sc, pointOnLight, shadedNormal, lightColor);

The value of pointOnLight depends on the type of light we are sampling. If the light is parallel, then pointOnLight needs to be in the local light coordinates. If the light is not parallel, then pointOnLight needs to be in camera coordinates.

#include <shadgen.h>

Inheritance diagram for ShadowType:
Inheritance graph
[legend]

List of all members.

Public Member Functions

SClass_ID  SuperClassID ()
  Retrieves a constant representing the type of the plugin.
virtual ShadowParamDlg CreateShadowParamDlg (Interface *ip)
virtual ShadowGenerator CreateShadowGenerator (LightObject *l, ObjLightDesc *ld, ULONG flags)=0
virtual BOOL  SupportStdMapInterface ()
BOOL  BypassPropertyLevel ()
virtual BOOL  CanDoOmni ()
virtual void  ConvertParamBlk (ParamBlockDescID *descOld, int oldCount, IParamBlock *oldPB)
virtual int  MapSize (TimeValue t)
virtual void  SetMapRange (TimeValue t, float f)
virtual float  GetMapRange (TimeValue t, Interval &valid=Interval(0, 0))
virtual void  SetMapSize (TimeValue t, int f)
virtual int  GetMapSize (TimeValue t, Interval &valid=Interval(0, 0))
virtual void  SetMapBias (TimeValue t, float f)
virtual float  GetMapBias (TimeValue t, Interval &valid=Interval(0, 0))
virtual void  SetAbsMapBias (TimeValue t, int a)
virtual int  GetAbsMapBias (TimeValue t, Interval &valid=Interval(0, 0))
virtual float  GetRayBias (TimeValue t, Interval &valid=Interval(0, 0))
virtual void  SetRayBias (TimeValue t, float f)
virtual int  GetMaxDepth (TimeValue t, Interval &valid=Interval(0, 0))
virtual void  SetMaxDepth (TimeValue t, int f)
IAreaShadowType GetAreaShadowType ()

Member Function Documentation

SClass_ID SuperClassID ( ) [inline, virtual]

Retrieves a constant representing the type of the plugin.

Returns:
A super class id that uniquely identifies the type (category) of the plugin. Note that several plugin classes can be of the same type, thus return the same super class id. Plugins are uniquely identified by their class ids. List of Super Class IDs.
See also:
SClass_ID

Reimplemented from ReferenceTarget.

virtual ShadowParamDlg* CreateShadowParamDlg ( Interface ip ) [inline, virtual]
{ return NULL; }
virtual ShadowGenerator* CreateShadowGenerator ( LightObject l,
ObjLightDesc ld,
ULONG  flags 
) [pure virtual]
virtual BOOL SupportStdMapInterface ( ) [inline, virtual]
{ return FALSE; }
BOOL BypassPropertyLevel ( ) [inline, virtual]
Remarks:
Use this method in order to cause parameters in this Animatable (as a sub-anim) to appear to reside at the level of the parent Animatable in the scripter. Return TRUE and this Animatable won't appear as a property in the scripter however it's sub-anims children will. The default implementation returns FALSE indicating it will appear normally.
Default Implementation:
{ return FALSE; }

Reimplemented from Animatable.

{ return TRUE; }  // want to promote shadowtype props to light level
virtual BOOL CanDoOmni ( ) [inline, virtual]
{ return FALSE; }
virtual void ConvertParamBlk ( ParamBlockDescID descOld,
int  oldCount,
IParamBlock oldPB 
) [inline, virtual]
virtual int MapSize ( TimeValue  t ) [inline, virtual]
{ return 512; } 
virtual void SetMapRange ( TimeValue  t,
float  f 
) [inline, virtual]
virtual float GetMapRange ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
{ return 0.0f; }
virtual void SetMapSize ( TimeValue  t,
int  f 
) [inline, virtual]
virtual int GetMapSize ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
virtual void SetMapBias ( TimeValue  t,
float  f 
) [inline, virtual]
virtual float GetMapBias ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
{ return 0.0f; }
virtual void SetAbsMapBias ( TimeValue  t,
int  a 
) [inline, virtual]
virtual int GetAbsMapBias ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
virtual float GetRayBias ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
{ return 0.0f; }
virtual void SetRayBias ( TimeValue  t,
float  f 
) [inline, virtual]
virtual int GetMaxDepth ( TimeValue  t,
Interval valid = Interval(0,0) 
) [inline, virtual]
virtual void SetMaxDepth ( TimeValue  t,
int  f 
) [inline, virtual]
IAreaShadowType * GetAreaShadowType ( ) [inline]
{
    return static_cast<IAreaShadowType*>(GetInterface(AREA_SHADOW_TYPE_INTERFACE_ID));
}

ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType
ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType ShadowType