# IRsHairStrandGeneratorAlg Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | SetInputMesh ([in] IRdMesh *pMesh)
HRESULT | LockMesh ()
HRESULT | UnlockMesh ()
HRESULT | Process ()
HRESULT | Configure ([in] IRsNode *pNode)
HRESULT | SetStreamData ([in] RtVertexHair *pData)
HRESULT | EnableCacheMode ([in] RtBool enable)
HRESULT | SetCachingStrategy ([in] RtDWORD strategy)
HRESULT | SetControlMatrix ([in] const RtMatrixf *matrix)
HRESULT | SetHash ([in] RtDWORD hash)
HRESULT | GenerateStrands ()
HRESULT | GetOutputMesh ([out, retval] IRdMesh **ppMesh)
HRESULT | SetPreviewMode ([in] RtBool preview_mode)
HRESULT | SetParamProvider ([in] IRsHairParameterProvider *pParamProvider)
HRESULT | SetOfflineMode ([in] RtBool offline_mode)
HRESULT | GetStrandCount ([out] RtDWORD *pStrandCount,[out] RtDWORD *pNodeCount)
HRESULT | GetStrands ([in, out] RtHairStrand *pStrands,[in, out] RtHairStrandNode *pNodes)
HRESULT | ProjectTips (const RtMatrixf *pMatrix)
HRESULT | GetTipsProjections ([in] RtVector2f *pProjections)
HRESULT | GenerateMeshForTriangle ([in] RtDWORD index,[in, out] RtFloat *residual_count,[out, retval] IRdMesh **ppMesh)

## Detailed Description

Algorithm for generating hair strands. It uses control mesh to generate list of strands and nodes It can convert them to hair mesh geometry, but also provides them for further processing

## Member Function Documentation

HRESULT IRsHairStrandGeneratorAlg::SetInputMesh | ( | [in] IRdMesh * | pMesh | ) |

Sets the input (control) mesh on which strands have to be generated.

Parameters:

  | pMesh | [in] Mesh to set.

HRESULT IRsHairStrandGeneratorAlg::LockMesh | ( |  | ) |

Locks the neccessary mesh streams used for generating strands.

HRESULT IRsHairStrandGeneratorAlg::UnlockMesh | ( |  | ) |

Unlocks control mesh streams.

HRESULT IRsHairStrandGeneratorAlg::Process | ( |  | ) |

Generates the strands.

HRESULT IRsHairStrandGeneratorAlg::Configure | ( | [in] IRsNode * | pNode | ) |

Sets the parameters contained in specified hair node connectors.

Parameters:

  | pNode | [in] RnHair node instance.

HRESULT IRsHairStrandGeneratorAlg::SetStreamData | ( | [in] RtVertexHair * | pData | ) |

Overrides current hair data stream with specified one.

Parameters:

  | pData | [in] Hair vertex stream data.

HRESULT IRsHairStrandGeneratorAlg::EnableCacheMode | ( | [in] RtBool | enable | ) |

Enables hair strand caching.

Parameters:

  | enable | [in] Desired status of caching .

HRESULT IRsHairStrandGeneratorAlg::SetCachingStrategy | ( | [in] RtDWORD | strategy | ) |

Sets the caching strategy for hair generator (see RtHairCacheStrategy).

Parameters:

  | strategy | [in] One of RtHairCacheStrategy values.

HRESULT IRsHairStrandGeneratorAlg::SetControlMatrix | ( | [in] const RtMatrixf * | matrix | ) |

Sets the mesh control matrix (world transform of control mesh). matrix [in] Control matrix to set.

HRESULT IRsHairStrandGeneratorAlg::SetHash | ( | [in] RtDWORD | hash | ) |

Sets generator hash which is used as a part of random generator seed.

Parameters:

  | hash | [in] .

HRESULT IRsHairStrandGeneratorAlg::GenerateStrands | ( |  | ) |

Generates hair strands

HRESULT IRsHairStrandGeneratorAlg::GetOutputMesh | ( | [out, retval] IRdMesh ** | ppMesh | ) |

Gets the generated hair mesh.

Returns:
  ppMesh [out,retval] Output hair mesh.

HRESULT IRsHairStrandGeneratorAlg::SetPreviewMode | ( | [in] RtBool | preview_mode | ) |

Sets the preview mode flag. In preview mode, hair strands are rendered as single lines.

Parameters:

  | preview_mode | [in] Desired preview mode.

HRESULT IRsHairStrandGeneratorAlg::SetParamProvider | ( | [in] IRsHairParameterProvider * | pParamProvider | ) |

Sets the parameter provider for generator.

Parameters:

  | pParamProvider | [in] Parameter provider to set.

HRESULT IRsHairStrandGeneratorAlg::SetOfflineMode | ( | [in] RtBool | offline_mode | ) |

Sets the flag specifying that generator is used for offline rendering.

Parameters:

  | offline_mode | [in] Desired status of offline rendering flag.

HRESULT IRsHairStrandGeneratorAlg::GetStrandCount | ( | [out] RtDWORD * | pStrandCount,
|  | [out] RtDWORD * | pNodeCount |
| ) |  |  |

Gets generated strand and node count.

Parameters:

  | pStrandCount | [out] Returned number of generated strands.
  | pNodeCount | [out] Returned number of generated nodes.

HRESULT IRsHairStrandGeneratorAlg::GetStrands | ( | [in, out] RtHairStrand * | pStrands,
|  | [in, out] RtHairStrandNode * | pNodes |
| ) |  |  |

Fills the strand and node arrays with currently generated strands and nodes.

Parameters:

  | pStrands | [in,out] Array to fill with generated strands.
  | pNodes | [in,out] Array to fill with generated strand nodes.

HRESULT IRsHairStrandGeneratorAlg::ProjectTips | ( | const RtMatrixf * | pMatrix | ) |

Calculates positions of strand tips in screen space using specified projection matrix.

Parameters:

  | pMatrix | [in] View * projection matrix.

HRESULT IRsHairStrandGeneratorAlg::GetTipsProjections | ( | [in] RtVector2f * | pProjections | ) |

Fills specified array with strand tip projections in screen space.

Parameters:

  | pProjections | [in] Array to fill strand projections.

HRESULT IRsHairStrandGeneratorAlg::GenerateMeshForTriangle | ( | [in] RtDWORD | index,
|  | [in, out] RtFloat * | residual_count,
|  | [out, retval] IRdMesh ** | ppMesh |
| ) |  |  |

Generates hair mesh for specified triangle of control mesh.

Parameters:

  | index | [in] Triangle index.
  | residual_count | [in,out] Input/output parameter used to maintain specified density on very small triangles. Specify 0 at the beginning and then just pass returned value to subsequent calls.

Returns:
  ppMesh [out,retval] Generated mesh.