PxArrayConverter

Defined in include/PxArrayConverter.h

class PxArrayConverter

Utility class to convert gpu arrays to a different memory layout.

Public Functions

virtual void interleaveGpuBuffers(const PxVec4 *verticesD, const PxVec4 *normalsD, PxU32 length, PxVec3 *interleavedResultBufferD, CUstream stream) = 0

Helper function to merge two separate PxVec4 arrays into one interleaved PxVec3 array.

Parameters
  • verticesD[in] The vertices device memory buffer

  • normalsD[in] The normals device memory buffer

  • length[in] The number of vertices and normals

  • interleavedResultBufferD[out] The resulting interleaved buffer containing 2*length elements with the format vertex0, normal0, vertex1, normal1…

  • stream[in] The cuda stream on which the conversion is processed

virtual void extractLinesFromStrands(const PxVec4 *verticesD, PxU32 numVertices, const PxU32 *strandPastEndIndicesD, PxU32 numStrands, PxVec4 *resultD, CUstream stream) = 0

Helper function to convert the hair system’s strand representation to a line list.

The conversion is done on the GPU.

Parameters
  • verticesD[in] The strand vertices device memory buffer

  • numVertices[in] The total number of vertices

  • strandPastEndIndicesD[in] One index per strand (device memory array) to find out where the next strand starts

  • numStrands[in] the number of strands

  • resultD[out] A device memory buffer with 2*numVertices capacity describing line segment where line i extends from result[2*i] to result[2*i+1]

  • stream[in] The cuda stream on which the conversion is processed

virtual void extractLinesFromStrands(const PxVec3 *verticesD, PxU32 numVertices, const PxU32 *strandPastEndIndicesD, PxU32 numStrands, PxVec3 *resultD, CUstream stream) = 0

Helper function to convert the hair system’s strand representation to a line list.

The conversion is done on the GPU.

Parameters
  • verticesD[in] The strand vertices device memory buffer

  • numVertices[in] The total number of vertices

  • strandPastEndIndicesD[in] One index per strand (device memory array) to find out where the next strand starts

  • numStrands[in] the number of strands

  • resultD[out] A device memory buffer with 2*numVertices capacity describing line segment where line i extends from result[2*i] to result[2*i+1]

  • stream[in] The cuda stream on which the conversion is processed

inline virtual ~PxArrayConverter()

Destructor.