Class LightObject

3DS Max Plug-In SDK

Class LightObject

See Also: Class Object, Class ObjLightDesc, Class Interval, Class Texmap.

class LightObject : public Object

Description:

This is the base class from which plug-in lights may be derived.

Methods:

Prototype:

virtual RefResult EvalLightState(TimeValue time, Interval& valid, LightState *ls)=0;

Remarks:

Implemented by the Plug-In.

This method is called to update the passed LightState and validity interval of the light.

Parameters:

TimeValue time

The time to evaluate the light state.

Interval& valid

The validity interval of the light about the specified time. This interval should be updated to reflect the validity interval of the light.

LightState *ls

A pointer to the LightState structure which describes the properties of the light. This function updates the data in the structure to reflect the properties of the light at the specified time. See Structure LightState.

Return Value:

REF_SUCCEED if the LightState was updated; otherwise REF_FAIL.

Prototype:

virtual ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuffer

)

Remarks:

Implemented by the Plug-In.

When the renderer goes to render the scene it asks all of the lights to create an ObjectLighDesc object. This is the method that is called to return this object.

Parameters:

INode *n

The node pointer of the light.

BOOL forceShadowBuffer

Forces the creation of a shadow buffer.

 

Return Value:

An instance of ObjectLightDesc. See Class ObjectLightDesc.

Default Implementation:

{return NULL;}

Prototype:

virtual void SetUseLight(int onOff)=0;

Remarks:

This method is available in release 3.0 and later only.

Sets if the light is on or off.

Parameters:

int onOff

TRUE for on; FALSE for off.

Prototype:

virtual BOOL GetUseLight()=0;

Remarks:

This method is available in release 3.0 and later only.

Returns TRUE if the light is on; otherwise FALSE.

Prototype:

virtual void SetHotspot(TimeValue time, float f)=0;

Remarks:

Implemented by the Plug-In.

Sets the hotspot to the specified angle at the specified time.

Parameters:

TimeValue time

The time to set the hotspot angle.

float f

The angle to set in degrees.

Prototype:

virtual float GetHotspot(TimeValue t, Interval& valid = Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Retrieves the hotspot angle.

Parameters:

TimeValue t

The time to retrieve the angle.

Interval& valid = Interval(0,0)

The validity interval that this method will update to reflect the hotspot setting.

Return Value:

The hotspot angle (in degrees).

Prototype:

virtual void SetFallsize(TimeValue time, float f)=0;

Remarks:

Implemented by the Plug-In.

Sets the falloff setting of the light.

Parameters:

TimeValue time

The time to set the falloff.

float f

The falloff angle in degrees.

Prototype:

virtual float GetFallsize(TimeValue t, Interval& valid = Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Returns the falloff angle of the light in radians.

Parameters:

TimeValue t

The time to retrieve the falloff angle.

Interval& valid = Interval(0,0)

The validity interval that this method will update to reflect the falloff setting.

Return Value:

The falloff angle of the light in degrees.

Prototype:

virtual void SetAtten(TimeValue time, int which, float f)=0;

Remarks:

Implemented by the Plug-In.

Sets the specified attenuation range distance at the time passed.

Parameters:

TimeValue time

The time to set the attenuation distance.

int which

Indicates which distance to set. One of the following values:

LIGHT_ATTEN_START - The start range radius.

LIGHT_ATTEN_END - The end range radius.

float f

The distance to set.

Prototype:

virtual float GetAtten(TimeValue t, int which, Interval& valid = Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Returns the specified attenuation range distance at the time passed.

Parameters:

TimeValue t

The time to retrieve the attenuation distance.

int which

Indicates which distance to retrieve. One of the following values:

LIGHT_ATTEN_START - The start range radius.

LIGHT_ATTEN_END - The end range radius.

Interval& valid = Interval(0,0)

The validity interval that this method will update to reflect the attenuation setting.

Return Value:

The specified attenuation range distance.

Prototype:

virtual void SetTDist(TimeValue time, float f)=0;

Remarks:

Implemented by the Plug-In.

Sets the light's target distance.

Parameters:

TimeValue time

The time to set the distance.

float f

The distance to set.

Prototype:

virtual float GetTDist(TimeValue t, Interval& valid = Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Retrieves the light's target distance.

Parameters:

TimeValue t

The time to retrieve the distance.

Interval& valid = Interval(0,0)

The validity interval that this method will update to reflect the target distance setting.

Return Value:

The light's target distance.

Prototype:

virtual void SetConeDisplay(int s, int notify=TRUE)=0;

Remarks:

Implemented by the Plug-In.

Sets the light's cone display flag. This controls if the cone is depicted graphically in the viewports.

Parameters:

int s

Indicates if the cone display should be on or off. If nonzero, the cone should be displayed; otherwise it should be turned off.

int notify=TRUE

If notify is TRUE the plug-in should call NotifyDependents() to notify its dependents.

Prototype:

virtual BOOL GetConeDisplay()=0;

Remarks:

Implemented by the Plug-In.

Retrieves the light's cone display setting. This indicates if the cone is depicted graphically in the viewports.

Return Value:

TRUE to indicate the cone is displayed; FALSE to indicate it is turned off.

Prototype:

virtual int GetShadowMethod();

Remarks:

Implemented by the Plug-In.

Returns the type of shadows used by the light.

Return Value:

One of the following values:

LIGHTSHADOW_NONE

LIGHTSHADOW_MAPPED

LIGHTSHADOW_RAYTRACED

Default Implementation:

{return LIGHTSHADOW_NONE;}

Prototype:

virtual void SetRGBColor(TimeValue t, Point3& rgb);

Remarks:

Implemented by the Plug-In.

Sets the color of the light at the specified time.

Parameters:

TimeValue t

The time to set the color.

Point3& rgb

The color to set.

Prototype:

virtual Point3 GetRGBColor(TimeValue t, Interval &valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Returns the color of the light at the specified time and updates the validity interval to reflect this parameters validity interval.

Parameters:

TimeValue t

The time to retrieve the value.

Interval &valid = Interval(0,0)

The validity interval to intersect with this parameters interval.

Return Value:

The color of the light at the specified time.

Default Implementation:

{return Point3(0,0,0);}

Prototype:

virtual void SetIntensity(TimeValue time, float f);

Remarks:

Implemented by the Plug-In.

Sets the intensity of the light to the value passed.

Parameters:

TimeValue time

The time to set the value.

float f

The value to set.

Prototype:

virtual float GetIntensity(TimeValue t, Interval& valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Retrieves the intensity of the light at the specified time and updates the validity interval passed to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval &valid = Interval(0,0)

The validity interval to intersect with this parameters interval.

Return Value:

The intensity of the light at the specified time

Default Implementation:

{return 0.0f;}

Prototype:

virtual void SetAspect(TimeValue t, float f);

Remarks:

Implemented by the Plug-In.

Sets the aspect ratio of the light at the specified time.

Parameters:

TimeValue t

The time to set the value.

float f

The value to set.

Prototype:

virtual float GetAspect(TimeValue t, Interval& valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Retrieves the aspect ratio of the light at the specified time and updates the validity interval passed to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval &valid = Interval(0,0)

The validity interval to intersect with this parameters interval.

Return Value:

The aspect ratio of the light at the specified time

Default Implementation:

{return 0.0f;}

Prototype:

virtual void SetUseAtten(int s);

Remarks:

Implemented by the Plug-In.

Sets the flag to indicate if the light is attenuated.

Parameters:

int s

Nonzero to indicate the light is attenuated; otherwise 0.

Prototype:

virtual BOOL GetUseAtten();

Remarks:

Implemented by the Plug-In.

Returns TRUE to indicate the light is attenuated; otherwise FALSE.

Default Implementation:

{return FALSE;}

Prototype:

virtual void SetAttenDisplay(int s);

Remarks:

Implemented by the Plug-In.

Sets the flag to indicate if the light attenuation ranges are displayed.

Parameters:

int s

Nonzero to indicate the light attenuation ranges are displayed; otherwise 0.

Prototype:

virtual BOOL GetAttenDisplay();

Remarks:

Implemented by the Plug-In.

Returns TRUE if the light attenuation ranges are displayed; otherwise FALSE.

Default Implementation:

{return FALSE;}

Prototype:

virtual void Enable(int enab);

Remarks:

Implemented by the Plug-In.

Sets the light to enabled or disables (on or off).

Parameters:

int enab

Nonzero to set the light to on; zero to turn the light off.

Prototype:

virtual void SetMapBias(TimeValue t, float f);

Remarks:

Implemented by the Plug-In.

Sets the map bias setting at the time passed.

Parameters:

TimeValue t

The time to set the value.

float f

The map bias value to set. The 3ds max lights use a range of 0.0 to 100.0.

Prototype:

virtual float GetMapBias(TimeValue t, Interval& valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Returns the map bias setting at the time passed and updates the validity interval to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval& valid = Interval(0,0)

The validity interval to update to reflect this parameters validity interval.

Return Value:

The map bias setting at the time passed.

Default Implementation:

{return 0.0f;}

Prototype:

virtual void SetMapRange(TimeValue t, float f);

Remarks:

Implemented by the Plug-In.

Sets the map sample range setting to the value passed at the time passed.

Parameters:

TimeValue t

The time to set the value.

float f

The value to set. The 3ds max lights use a range of 0.0 to 20.0.

Prototype:

virtual float GetMapRange(TimeValue t, Interval& valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Retrieves the lights map sample range setting at the specified time and updates the validity interval to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval& valid = Interval(0,0)

The validity interval to update to reflect this parameters validity interval.

Return Value:

The lights map sample range setting.

Default Implementation:

{return 0.0f;}

Prototype:

virtual void SetMapSize(TimeValue t, int f);

Remarks:

Implemented by the Plug-In.

Sets the lights map size parameter to the value passed at the time passed.

Parameters:

TimeValue t

The time to set the value.

int f

The value to set.

Prototype:

virtual int GetMapSize(TimeValue t, Interval& valid = Interval(0,0))

Remarks:

Implemented by the Plug-In.

Returns the lights map size parameter at the specified time and updates the validity interval passed to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval& valid = Interval(0,0)

The validity interval to update to reflect this parameters validity interval.

Return Value:

The lights map size parameter.

Default Implementation:

{return 0;}

Prototype:

virtual void SetRayBias(TimeValue t, float f);

Remarks:

Implemented by the Plug-In.

Sets the raytrace bias setting to the value passed at the specified time.

Parameters:

TimeValue t

The time to set the value.

float f

The value to set.

Prototype:

virtual float GetRayBias(TimeValue t, Interval& valid = Interval(0,0));

Remarks:

Implemented by the Plug-In.

Returns the lights raytrace bias setting at the specified time and updates the validity interval passed to reflect the validity interval of this parameter.

Parameters:

TimeValue t

The time to retrieve the value.

Interval& valid = Interval(0,0)

The validity interval to update to reflect this parameters validity interval.

Return Value:

The lights raytrace bias setting at the specified time.

Default Implementation:

{return 0.0f;}

Prototype:

virtual int GetUseGlobal()

Remarks:

Implemented by the Plug-In.

Returns the Use Global Settings flag setting.

Default Implementation:

{return 0;}

Prototype:

virtual void SetUseGlobal(int a);

Remarks:

Implemented by the Plug-In.

Sets the lights Use Global Settings flag.

Parameters:

int a

Nonzero indicates the light uses the global settings; zero indicates the light uses its own settings.

Prototype:

virtual int GetShadow()

Remarks:

Implemented by the Plug-In.

Returns the lights Cast Shadows flag.

Return Value:

Nonzero indicates the light casts shadows; otherwise 0.

Default Implementation:

{return 0;}

Prototype:

virtual void SetShadow(int a);

Remarks:

Implemented by the Plug-In.

Sets the lights Cast Shadows flag.

Parameters:

int a

Nonzero indicates the light casts shadows; zero indicates the light does not cast shadows.

Prototype:

virtual int GetShadowType()

Remarks:

Implemented by the Plug-In.

Retrieves the type of shadows used by the light - mapped or raytraced.

Return Value:

One of the following values:

-1: if the Shadow Generator is NULL. (R3 only).

0: if the light uses Shadow Maps.

1: if the light uses Raytraced Shadows.

0xffff: for any other Shadow Generators. (R3 only).

Default Implementation:

{return 0;}

Prototype:

virtual void SetShadowType(int a);

Remarks:

Implemented by the Plug-In.

Sets the type of shadows used by the light - mapped or raytraced.

Parameters:

int a

One of the following values:

0: This value plugs in a Shadow Map Generator

1: This value plugs in a Raytraced Shadow Generator.

Any other value is a NOOP.

Prototype:

virtual void SetShadowGenerator(ShadowType *s);

Remarks:

This method is available in release 3.0 and later only.

Sets the shadow generator used by the light.

Parameters:

ShadowType *s

The shadow plug-in to use. See Class ShadowType.

Default Implementation:

{}

Prototype:

virtual ShadowType *GetShadowGenerator();

Remarks:

This method is available in release 3.0 and later only.

Returns a pointer to the shadow generator plug-in in use by the light. See Class ShadowType.

Default Implementation:

{ return NULL; }

Prototype:

virtual int GetAbsMapBias()

Remarks:

Implemented by the Plug-In.

Returns the lights Absolute Map Bias setting.

Return Value:

Nonzero indicates Absolute Map Bias is on; zero indicates it is off.

Default Implementation:

{return 0;}

Prototype:

virtual void SetAbsMapBias(int a);

Remarks:

Implemented by the Plug-In.

Sets the lights Absolute Map Bias setting.

Parameters:

int a

Nonzero indicates Absolute Map Bias is on; zero indicates it is off.

Prototype:

void SetAtmosShadows(TimeValue t, int onOff);

Remarks:

This method is available in release 3.0 and later only.

Sets the state of the atmospheric shadowing shadows on / off toggle for the light.

Parameters:

TimeValue t

The time at which to set the state.

int onOff

Nonzero for on; zero for off.

Prototype:

int GetAtmosShadows(TimeValue t);

Remarks:

This method is available in release 3.0 and later only.

Returns the state of the atmospheric shadowing shadows on / off toggle for the light.

Parameters:

TimeValue t

The time at which to retrieve the state.

Prototype:

void SetAtmosOpacity(TimeValue t, float f);

Remarks:

This method is available in release 3.0 and later only.

Sets the atmospheric shadowing opacity for the light to the specified value at the time specified.

Parameters:

TimeValue t

The time at which to set the value.

float f

The value to set.

Prototype:

float GetAtmosOpacity(TimeValue t, Interval& valid=FOREVER);

Remarks:

This method is available in release 3.0 and later only.

Returns the atmospheric shadowing opacity for the light at the specified time.

Parameters:

TimeValue t

The time at which to retrieve the value.

Interval& valid=FOREVER

The validity interval which is updated to reflect the validity of the opacity setting.

Prototype:

void SetAtmosColAmt(TimeValue t, float f);

Remarks:

This method is available in release 3.0 and later only.

Sets the atmospheric shadowing color amount to the specified value at the time passed.

Parameters:

TimeValue t

The time at which to set the value.

float f

The value to set.

Prototype:

float GetAtmosColAmt(TimeValue t, Interval& valid=FOREVER);

Remarks:

This method is available in release 3.0 and later only.

Returns the atmospheric shadowing color amount setting at the specified time.

Parameters:

TimeValue t

The time at which to retrieve the value.

Interval& valid=FOREVER

The validity interval which is updated to reflect the validity of the color amount setting.

Prototype:

virtual int GetOvershoot()

Remarks:

Implemented by the Plug-In.

Returns the lights Overshoot on / off setting. Nonzero indicates overshoot is on; otherwise 0.

Default Implementation:

{return 0;}

Prototype:

virtual void SetOvershoot(int a);

Remarks:

Implemented by the Plug-In.

Sets the lights Overshoot on / off setting.

Parameters:

int a

Nonzero indicates overshoot is on; otherwise 0.

Prototype:

virtual int GetProjector()

Remarks:

Implemented by the Plug-In.

Returns the lights Projector on / off setting. Nonzero indicates this light projects an image; otherwise 0.

Default Implementation:

{return 0;}

Prototype:

virtual void SetProjector(int a);

Remarks:

Implemented by the Plug-In.

Sets the lights projector on / off setting.

Parameters:

int a

Nonzero indicates this light projects an image; otherwise 0.

Prototype:

virtual ExclList* GetExclList();

Remarks:

Implemented by the Plug-In.

Returns the list of names of items included or excluded by this light. See Class NameTab.

Default Implementation:

{return NULL;}

Prototype:

virtual BOOL Include();

Remarks:

Implemented by the Plug-In.

Returns TRUE if the light's name list is of items to be included by the light. Returns FALSE if the list is of items to exclude from the light.

Default Implementation:

{return FALSE;}

Prototype:

virtual Texmap* GetProjMap()

Remarks:

Implemented by the Plug-In.

Returns the map used by a projector light.

Default Implementation:

{return NULL;}

Prototype:

virtual void SetProjMap(Texmap* pmap);

Remarks:

Implemented by the Plug-In.

Sets the image(s) used by the projector light.

Parameters:

Texmap* pmap

The map to use.

Prototype:

virtual void UpdateTargDistance(TimeValue t, INode* inode);

Remarks:

This method is available in release 2.0 and later only.

Implemented by the Plug-In.

Updates the display of the light's target distance in the light's rollup page.

Parameters:

TimeValue t

The time to retrieve the distance.

INode* inode

The light node.

Default Implementation:

{}