Class CameraObject

3DS Max Plug-In SDK

Class CameraObject

See Also: Class Object.

class CameraObject : public Object

Description:

This is a base class from which camera plug-ins may be derived. Methods of this class are used to get and set properties of the camera. All methods of this class are implemented by the plug-in.

Methods:

Prototype:

virtual RefResult EvalCameraState(TimeValue time,

Interval& valid, CameraState* cs)=0;

Remarks:

Implemented by the Plug-In.

This method is called to update the CameraState and validity interval at the specified time.

Parameters:

TimeValue time

Specifies the time to evaluate the camera.

Interval& valid

The plug-in computes the validity interval of the camera at the specified time and stores the result here.

CameraState* cs

The camera state to update. See Structure CameraState. Note: The view vector and 'up' vector for the camera are stored with the matrix transform for the node. Cameras can be multiple-instanced so it must work this way. To get at this matrix use the following method from Class INode:

virtual Matrix3 GetObjTMAfterWSM(TimeValue time,

Interval* valid=NULL)=0;

The scaling of this matrix may be removed by normalizing each of the rows.

Return Value:

REF_SUCCEED if the camera state was updated successfully; otherwise REF_FAIL.

Prototype:

virtual void SetOrtho(BOOL b)=0;

Remarks:

Implemented by the Plug-In.

Sets whether the camera is on ortho mode or not.

Parameters:

BOOL b

Pass TRUE for ortho and FALSE for not ortho.

Prototype:

virtual BOOL IsOrtho()=0;

Remarks:

Implemented by the Plug-In.

Returns TRUE if the camera is in ortho mode and FALSE if it is not.

Prototype:

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

Remarks:

Implemented by the Plug-In.

Sets the field-of-view of the camera at the specified time.

Parameters:

TimeValue t

The time at which to set the field-of-view.

float f

The value to set in radians.

Prototype:

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

Remarks:

Implemented by the Plug-In.

Returns the field-of-view setting of the camera at the specified time and adjusts the validity interval of the camera at this time to reflect the field-of-view parameter.

Parameters:

TimeValue t

The time to retrieve the field-of-view setting.

Interval& valid = Interval(0,0)

The validity interval to set.

Return Value:

The field-of-view of the camera in radians.

Prototype:

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

Remarks:

Implemented by the Plug-In.

Sets the target distance setting (for free cameras) at the specified time.

Parameters:

TimeValue t

The time at which to set the target distance.

float f

The value to set.

Prototype:

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

Remarks:

Implemented by the Plug-In.

Returns the target distance setting of the camera at the specified time and adjusts the validity interval of the camera to reflect the target distance parameter.

Parameters:

TimeValue t

The time to retrieve the target distance setting.

Interval& valid = Interval(0,0)

This validity interval is intersected with the validity interval of the target distance parameter.

Return Value:

The target distance of the camera.

Prototype:

virtual int GetManualClip()=0;

Remarks:

Implemented by the Plug-In.

Returns the manual clip flag. This indicates the camera will perform clipping at its hither and yon distances.

Return Value:

Nonzero if manual clipping is enabled; otherwise 0.

Prototype:

virtual void SetManualClip(int onOff)=0;

Remarks:

Implemented by the Plug-In.

Sets the manual clip flag. This indicates the camera will perform clipping at its hither and yon distances.

Parameters:

int onOff

The state of the manual clipping flag to set. Nonzero indicates clipping will be performed.

Prototype:

virtual float GetClipDist(TimeValue t, int which,

Interval &valid=Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Retrieves the clipping distance of the specified plane at the specified time and modifies the validity interval to reflect the setting of the clipping distance parameter.

Parameters:

TimeValue t

The time to retrieve the clipping distance.

int which

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

CAM_HITHER_CLIP - The hither distance

CAM_YON_CLIP - The yon distance.

Interval &valid=Interval(0,0)

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

Return Value:

The clipping distance.

Prototype:

virtual void SetClipDist(TimeValue t, int which, float val)=0;

Remarks:

Implemented by the Plug-In.

Sets the clipping distance of the specified plane at the specified time.

Parameters:

TimeValue t

The time to set the clipping distance.

int which

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

CAM_HITHER_CLIP - The hither distance

CAM_YON_CLIP - The yon distance.

float val

The distance to set.

Prototype:

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

Remarks:

Implemented by the Plug-In.

Sets the environment range distance at the specified time.

Parameters:

TimeValue time

The time to set the environment range.

int which

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

ENV_NEAR_RANGE - The near distance.

ENV_FAR_RANGE - The far distance.

float f

The distance to set.

Prototype:

virtual float GetEnvRange(TimeValue t, int which,

Interval& valid = Interval(0,0))=0;

Remarks:

Implemented by the Plug-In.

Retrieves the environment range distance at the specified time and intersects the specified validity interval with the interval of the environment range parameter.

Parameters:

TimeValue time

The time to retrieve the environment range.

int which

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

ENV_NEAR_RANGE - The near distance.

ENV_FAR_RANGE - The far distance.

Interval& valid = Interval(0,0)

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

Return Value:

The environment range distance at the specified time.

Prototype:

virtual void SetEnvDisplay(BOOL b, int notify=TRUE)=0;

Remarks:

Implemented by the Plug-In.

Sets the environment range display flag. This indicates if the camera will display its range settings.

Parameters:

BOOL b

The flag state to set.

int notify=TRUE

If notify is TRUE, dependents of this message are sent the REFMSG_CHANGE message, via:

NotifyDependents(FOREVER, PART_OBJ, REFMSG_CHANGE);

Otherwise no notification is sent.

Prototype:

virtual BOOL GetEnvDisplay()=0;

Remarks:

Implemented by the Plug-In.

Retrieves the environment range display setting.

Return Value:

TRUE if ranges are displayed; otherwise FALSE.

Prototype:

virtual void RenderApertureChanged(TimeValue t)=0;

Remarks:

This method is available in release 2.0 and later only.

This method is called on all cameras when the render aperture width has changed.

Parameters:

TimeValue t

The time of the change.

Prototype:

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

Remarks:

This method is available in release 2.0 and later only.

This method is called on all target cameras when the target distance has changed. For instance, a distance shown in the user interface may be updated in this method.

Parameters:

TimeValue t

The time of the change.

INode *inode

The camera node.

Default Implementation:

{}

Prototype:

virtual void SetIMultiPassCameraEffect(IMultiPassCameraEffect *pIMultiPassCameraEffect);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the plug-in.

The IMultiPassCameraEffect should be checked to see if compatible with the camera

before being assigned.

Parameters:

IMultiPassCameraEffect *pIMultiPassCameraEffect

The IMultiPassCameraEffect to assign.

Default Implementation:

{ }

Prototype:

virtual void SetMultiPassEffectEnabled(TimeValue t, BOOL enabled);

Remarks:

This method is available in release 4.0 and later only.

Enables or disables the multi-pass effect.

Parameters:

TimeValue t

The time at which to enable the effect.

BOOL enabled

TRUE for enabled; FALSE for disabled.

Default Implementation:

{ }

Prototype:

virtual BOOL GetMultiPassEffectEnabled(TimeValue t, Interval& valid);

Remarks:

This method is available in release 4.0 and later only.

Returns the enabled or disabled state of the multi-pass effect setting for the camera.

Parameters:

TimeValue t

The time at which to get the setting.

Interval& valid

The validity interfal for the setting.

Return Value:

TRUE for enabled; FALSE for disabled.

Default Implementation:

{ return FALSE; }

Prototype:

virtual IMultiPassCameraEffect *GetIMultiPassCameraEffect();

Remarks:

This method is available in release 4.0 and later only.

Returns a pointer to the current multi-pass camera effect. See Class IMultiPassCameraEffect.

Default Implementation:

{ return NULL; }