# IRsD3DResource Struct Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | AttachToD3DRenderer ([in] IUnknown *pRenderer)
HRESULT | CreateInternalData ([in] ULONG dwInternalID)
HRESULT | GetInternalID ([out, retval] ULONG *pInternalID)
HRESULT | Update ([in] ULONG dwUpdateFlags)
HRESULT | DeviceLost (void)
HRESULT | Detach ([in] ULONG dwDetachFlags)
HRESULT | D3DRendererEvent ([in] RtD3DRendererEvent Event)
HRESULT | GetAutomaticRegisterStatus ([out] RtBOOL *bAutoRegister)

## Detailed Description

All D3DView nodes should implement this interface. It is used to identify nodes that create internal nodes in the renderer. It is also used to communicate with the renderer on the lower level

## Member Function Documentation

HRESULT IRsD3DResource::AttachToD3DRenderer | ( | [in] IUnknown * | pRenderer | ) |

This method is called to attach the node to the renderer. At this point, node is supposed not to perform creation of any D3D internal structures. This method should be called by the node itself (i.e. in the LoadDefault() method) if registration in the renderer is required just after creation of the node or is called by a external command. Implementation should call D3DRenderer's method AttachD3DResource() here.

Parameters:

  | pRenderer | points to D3DRenderer object. If this parameter is NULL, node is supposed to find D3DRenderer object by itself (i.e. from the View3D package).

HRESULT IRsD3DResource::CreateInternalData | ( | [in] ULONG | dwInternalID | ) |

This method is called by the renderer's method AttachD3DResource() to complete the process of registration. Node is supposed to create all internal D3D structures.

Parameters:

  | pRenderer | points directly to CRsD3DRenderer class. This parameter cannot be NULL.
  | dwInternalID | is internal ID that CRsD3DRenderer associated with a node.

HRESULT IRsD3DResource::GetInternalID | ( | [out, retval] ULONG * | pInternalID | ) |

This method returns issued InternalID.

Parameters:

  | pInternalID | is filled with issued ID. Uregistered resources should fill with NULL.

HRESULT IRsD3DResource::Update | ( | [in] ULONG | dwUpdateFlags | ) |

This method is called by the renderer to update (or even recreate) internal data of the renderer (for example after node requested update with renderer's UpdateD3DResource()). All unused internal data should be released. Implementation should perform only the updates described by dwUpdateFlags

Parameters:

  | dwUpdateFlags | - update flags. This is any combination of the RtD3DResourceUpdate enum.

HRESULT IRsD3DResource::DeviceLost | ( | void |  | ) |

This method is called by the renderer if Direct3DDevice was lost. Implementation is supposed to set all internal resources to the lost state (except for those that are managed by the internal manager - i.e. most of meshes or textures) and to release all Direct3D related classes.

HRESULT IRsD3DResource::Detach | ( | [in] ULONG | dwDetachFlags | ) |

This method is called by the renderer just before node is detached from the renderer. This can happen for example if node called renderer's DetachD3DResource(). Implementation is supposed to release all its internal renderer data and release all Direct3D related classes. InternalID and CRsD3DRenderer pointer passed in CreateInternalData are no longer valid. Resource should not call any of D3DRenderer methods except for AttachD3DResource.

Parameters:

  | dwDetachFlags | is any combination of RtD3DResourceDetach enum.

HRESULT IRsD3DResource::D3DRendererEvent | ( | [in] RtD3DRendererEvent | Event | ) |

This method is called by the renderer to hooked resources to let know of some global events

Parameters:

  | Event | is type of event.

See also:
  RtD3DRendererEvent.

HRESULT IRsD3DResource::GetAutomaticRegisterStatus | ( | [out] RtBOOL * | bAutoRegister | ) |

This methods returns boolean that tells the engine if object want's to be automatically registered if found unregistered by scanning engine