# IRfMaterialListSet Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | Attach ([in] IRsNode *pNode)
HRESULT | CreateMaterialListManager ()
HRESULT | GetFreeMaterialIndex ([out] RtDWORD *pdwIndex)
HRESULT | AddMaterialChunk ([in] RtDWORD dwIndex,[in] RtMatClsId activeMatClsId,[out] IRsNode **ppNode)
HRESULT | GetMaterialsCount ([out, retval] RtDWORD *pdwCount)
HRESULT | GetMaterialIndices ([out] RtDWORD *pIndices)
HRESULT | GetNextMaterialIndex ([in, out] RtLong *pdwIndex)
HRESULT | GetMaterial ([in] RtDWORD dwMatInd,[in]RtMatClsId MatClsId,[out] IRsObject **ppMaterial)
HRESULT | SetMaterial ([in] RtDWORD dwMatInd,[in] IRsNode *pMaterial)
HRESULT | SetMaterialFromGeneric ([in] RtDWORD dwMatInd, IRdMaterialGeneric *pMaterial)
HRESULT | DeleteMaterials ()
HRESULT | GetMaterialFlavorManager ([in] RtDWORD dwMatInd,[out] IRsNode **ppNode)
HRESULT | GetMaterialFlavorManagerByOrder ([in] RtDWORD dwMatOrder,[out] IRsNode **ppNode,[out] RtDWORD *pdwMatIndex)
HRESULT | FindMaterialFlavorNode ([in] RtDWORD dwMatInd,[in]RtMatClsId MatClsId,[out] IRsNode **ppMatItemNode)
HRESULT | GetMaterialNode (RtDWORD dwMatInd, IRsNode **ppSrNode)
HRESULT | GetMaterialNodeByOrder (RtDWORD dwMatOrder, IRsNode **ppNode, RtDWORD *pdwMatIndex)
HRESULT | GetSharedMaterialNode (IRsNode *pNode, IRsNode **ppSharedMaterial)
HRESULT | PermutateMaterials ([in] RtUlong *pdwLookup,[in] RtUlong dwLookupSize)
HRESULT | GetMaterialIndex (IRsMaterialGeneric *pGeneric, RtDWORD *pdwIndex, IRsNode **ppMaterialNode)
HRESULT | SynchronizeMaterialFromGeneric ([in] RtDWORD dwMatInd,[in] IRdMaterialGeneric *spMaterial,[in] RtMaterialGenComponent dwComponentFilter)
HRESULT | GetMaterialGeneric ([in] RtDWORD dwMatInd,[out] IRsMaterialGeneric **ppMaterial)
HRESULT | GetMaterialGenericByOrder ([in] RtDWORD dwMatInd,[out] IRsMaterialGeneric **ppMaterial)
HRESULT | GetMaterialGenericDesc ([in] RtDWORD dwMatInd,[out] IRdMaterialGeneric **ppMaterial)
HRESULT | ConvertToMaterialList ()
HRESULT | FindMaterialConnector ([in] IRsNode *pNode,[out, retval] IRsConnector **ppConnector)
HRESULT | GetMaterialListManagerNode ([out, retval] IRsNode **ppNode)
HRESULT | MergeMaterialLists ([in] IRsNode *pNode,[out] RtMaterialIndexTranslation **ppTranslations,[out] RtDWORD *pTranslationsCount)
HRESULT | DeleteUnusedMaterials ()
HRESULT | CreateEmptyMaterialList (IRsNode **ppMaterialListEncaps)
HRESULT | GetMaterialConnector ([in] RtDWORD dwMatInd,[out] IRsConnector **ppCon)
HRESULT | GetFreeMaterialConnector ([out] RtDWORD *pdwUnusedCon)
HRESULT | SetMaterialList (IRsNode *pMaterial)
HRESULT | RemoveMaterial ([in] RtDWORD dwMatInd)

## Detailed Description

Material list function set contains low level functions for material management.

## Member Function Documentation

HRESULT IRfMaterialListSet::Attach | ( | [in] IRsNode * | pNode | ) |

Attach node to this function set.

Parameters:

  | pNode | [in] Name of node.

HRESULT IRfMaterialListSet::CreateMaterialListManager | ( |  | ) |

Creates empty material list manager.

HRESULT IRfMaterialListSet::GetFreeMaterialIndex | ( | [out] RtDWORD * | pdwIndex | ) |

Get first free material index.

Parameters:

  | pdwIndex | [out] First free material index.

HRESULT IRfMaterialListSet::AddMaterialChunk | ( | [in] RtDWORD | dwIndex,
|  | [in] RtMatClsId | activeMatClsId,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

Create empty material chunk (encapsulated material flavor manager) and attach it to the material list.

Parameters:

  | dwIndex | [in] Specific index to attach material chunk to.
  | activeMatClsId | [in] Active material class ID.
  | ppNode | [out] Created material chunk node.

HRESULT IRfMaterialListSet::GetMaterialsCount | ( | [out, retval] RtDWORD * | pdwCount | ) |

Get number of materials in the material list.

Returns:
  pdwCount [out,retval] Returns number of materials in list.

HRESULT IRfMaterialListSet::GetMaterialIndices | ( | [out] RtDWORD * | pIndices | ) |

GetMaterialIndexes: Get an array of indices of materials in the material list.

Parameters:

  | pIndices | [in] Array filled with material indices. Array must contain at the lease GetMaterialsCount elements.

HRESULT IRfMaterialListSet::GetNextMaterialIndex | ( | [in, out] RtLong * | pdwIndex | ) |

GetNextMaterialIndex: return next index in the list:

- To get first index, use -1.
  Parameters:

    | pdwIndex | [in,out] Returns next index in list.

HRESULT IRfMaterialListSet::GetMaterial | ( | [in] RtDWORD | dwMatInd,
|  | [in] RtMatClsId | MatClsId,
|  | [out] IRsObject ** | ppMaterial |
| ) |  |  |

GetMaterial: return material's IRsObject for given material index.

Parameters:

  | dwMatInd | [in] Specific index.
  | MatClsId | [in] Material class ID.
  | ppMaterial | [out] Generic material interface for the material.

HRESULT IRfMaterialListSet::SetMaterial | ( | [in] RtDWORD | dwMatInd,
|  | [in] IRsNode * | pMaterial |
| ) |  |  |

Set material to specified index.

- If function fails, material node is not destroyed.

Parameters:

  | dwMatInd | [in] Specific index.
  | pMaterial | [in] Material node to add to manager.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::SetMaterialFromGeneric | ( | [in] RtDWORD | dwMatInd,
|  | IRdMaterialGeneric * | pMaterial |
| ) |  |  |

Set material defined using generic descriptor to specified index.

Parameters:

  | dwMatInd | [in] Specific index.
  | pMaterial | [in] Material descriptor.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::DeleteMaterials | ( |  | ) |

Delete all materials.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialFlavorManager | ( | [in] RtDWORD | dwMatInd,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

For specified material index find material flavor manager node.

Parameters:

  | dwMatInd | [in] Material index.
  | ppNode | [out] Material flavor manager node.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialFlavorManagerByOrder | ( | [in] RtDWORD | dwMatOrder,
|  | [out] IRsNode ** | ppNode,
|  | [out] RtDWORD * | pdwMatIndex |
| ) |  |  |

For specified material order get material flavor manager node.

Parameters:

  | dwMatOrder | [in] Material order.
  | ppNode | [out] Material flavor manager node.
  | pdwMatIndex | [out] Material index.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::FindMaterialFlavorNode | ( | [in] RtDWORD | dwMatInd,
|  | [in] RtMatClsId | MatClsId,
|  | [out] IRsNode ** | ppMatItemNode |
| ) |  |  |

For specified material index and material class, find material flavor node.

Parameters:

  | dwMatInd | [in] Index of material.
  | MatClsId | [in] Material class ID.
  | ppMatItemNode | [out] Material flavor node.

HRESULT IRfMaterialListSet::GetMaterialNode | ( | RtDWORD | dwMatInd,
|  | IRsNode ** | ppSrNode |
| ) |  |  |

For specified material index, find material node with all flavors inside.

- Node exports CON_MATERIAL_CHUNK connector.
  Parameters:

    | dwMatInd | [in] Material index.

  Returns:
    ppSrNode [out,retval] Material node.

HRESULT IRfMaterialListSet::GetMaterialNodeByOrder | ( | RtDWORD | dwMatOrder,
|  | IRsNode ** | ppNode,
|  | RtDWORD * | pdwMatIndex |
| ) |  |  |

For specified material order, find material node with all flavors inside.

- Node exports CON_MATERIAL_CHUNK connector.

Parameters:

  | dwMatOrder | [in] Material order.
  | ppNode | [out] Material node.
  | pdwMatIndex | [out] Material index.

HRESULT IRfMaterialListSet::GetSharedMaterialNode | ( | IRsNode * | pNode,
|  | IRsNode ** | ppSharedMaterial |
| ) |  |  |

Get shared material for specified material node.

Parameters:

  | pNode | [in] Material node (referenced or direct).
  | ppSharedMaterial | [out] Shared material node if material is instanced.

HRESULT IRfMaterialListSet::PermutateMaterials | ( | [in] RtUlong * | pdwLookup,
|  | [in] RtUlong | dwLookupSize |
| ) |  |  |

Permutate materials according to lookup table.

- Lookup table defines old material index->new material index lookup.
- Moving material to -1 removes it from the list.

Parameters:

  | pdwLookup | [in] Material permutation table.
  | dwLookupSize | [in] Number of items in lookup table.

HRESULT IRfMaterialListSet::GetMaterialIndex | ( | IRsMaterialGeneric * | pGeneric,
|  | RtDWORD * | pdwIndex,
|  | IRsNode ** | ppMaterialNode |
| ) |  |  |

Get material index according to provided material instance.

Parameters:

  | pGeneric | [in] Generic flavor of material to locate.
  | pdwIndex | [out] Material index if succeeded.
  | pMaterialNode | [out] Material node with provided index if succeeded.

Returns:
  S_OK if material found.

HRESULT IRfMaterialListSet::SynchronizeMaterialFromGeneric | ( | [in] RtDWORD | dwMatInd,
|  | [in] IRdMaterialGeneric * | spMaterial,
|  | [in] RtMaterialGenComponent | dwComponentFilter |
| ) |  |  |

Update specified material with material defined using generic material description.

Parameters:

  | dwMatInd | [in] Material index to update.
  | spMaterial | [in] Generic material description to use for updating.
  | dwComponentFilter | [in] Or-ed flags of components to update.

Returns:
  S_OK if material found.

HRESULT IRfMaterialListSet::GetMaterialGeneric | ( | [in] RtDWORD | dwMatInd,
|  | [out] IRsMaterialGeneric ** | ppMaterial |
| ) |  |  |

Get a master material specified by index.

Parameters:

  | dwMatInd | [in] Material index.
  | ppMaterial | [out] Generic material interface for the material.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialGenericByOrder | ( | [in] RtDWORD | dwMatInd,
|  | [out] IRsMaterialGeneric ** | ppMaterial |
| ) |  |  |

Get a master material specified by material order.

Parameters:

  | dwMatInd | [in] Material index.
  | ppMaterial | [out] Generic material interface for the material.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialGenericDesc | ( | [in] RtDWORD | dwMatInd,
|  | [out] IRdMaterialGeneric ** | ppMaterial |
| ) |  |  |

Get generic description data from master material specified by index.

Parameters:

  | dwMatInd | [in] Material index.
  | ppMaterial | [out] Generic material data for the material.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::ConvertToMaterialList | ( |  | ) |

Convert d3d only material to material list material.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::FindMaterialConnector | ( | [in] IRsNode * | pNode,
|  | [out, retval] IRsConnector ** | ppConnector |
| ) |  |  |

Find material output connector.

Parameters:

  | pNode | [in] Node to check.

Returns:
  ppConnector [out,retval] Material output connector if found.

  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialListManagerNode | ( | [out, retval] IRsNode ** | ppNode | ) |

Return material list manager node for currently attached object.

Returns:
  ppNode [out,retval] Material manager node.

  S_OK if succeeded.

HRESULT IRfMaterialListSet::MergeMaterialLists | ( | [in] IRsNode * | pNode,
|  | [out] RtMaterialIndexTranslation ** | ppTranslations,
|  | [out] RtDWORD * | pTranslationsCount |
| ) |  |  |

Merges material lists from attached node and specified node into attached node.

- Also, generates a mapping for material indices of second mesh to new material list of attached mesh.

Parameters:

  | pNode | [in] Node with material list to append (mesh node containing material list).
  | ppTranslations | [out] Output array of second mesh material indices translations.
  | pTranslationsCount | [out] Number of translations generated.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::DeleteUnusedMaterials | ( |  | ) |

Deletes all unused materials from attached node.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::CreateEmptyMaterialList | ( | IRsNode ** | ppMaterialListEncaps | ) |

Create empty material encapsulator.

- Note that Fn set will NOT destroy the list during release.

Returns:
  ppMaterialListEncaps [out,retval] Created empty material encapsulator.
  - Add it to mesh node and export material list connector.

  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetMaterialConnector | ( | [in] RtDWORD | dwMatInd,
|  | [out] IRsConnector ** | ppCon |
| ) |  |  |

For specified material index find material list manager connector.

Parameters:

  | dwMatInd | [in] Material index.
  | ppCon | Material [out] List connector.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::GetFreeMaterialConnector | ( | [out] RtDWORD * | pdwUnusedCon | ) |

Return first unused (free) material connector on material list node.

- If all connectors are used, S_FALSE is returned.

Parameters:

  | pdwUnusedCon | [out] Free material connector index.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::SetMaterialList | ( | IRsNode * | pMaterial | ) |

Set material list to object.

- If material list is present, it is removed.

Parameters:

  | pMaterial | [in] Material list node to attached object.

Returns:
  S_OK if succeeded.

HRESULT IRfMaterialListSet::RemoveMaterial | ( | [in] RtDWORD | dwMatInd | ) |

Removes material with specified index.

Parameters:

  | dwMatInd | [in] Material index.

Returns:
  S_OK if succeeded