#include <NvBlastSupportGraph.h>
Public Member Functions | |
| uint32_t | findBond (uint32_t nodeIndex0, uint32_t nodeIndex1) const |
| NvBlastBlockArrayData (uint32_t, m_adjacentBondIndicesOffset, getAdjacentBondIndices, getAdjacencyPartition()[m_nodeCount]) | |
| NvBlastBlockArrayData (uint32_t, m_adjacentNodeIndicesOffset, getAdjacentNodeIndices, getAdjacencyPartition()[m_nodeCount]) | |
| NvBlastBlockArrayData (uint32_t, m_adjacencyPartitionOffset, getAdjacencyPartition, m_nodeCount+1) | |
| NvBlastBlockArrayData (uint32_t, m_chunkIndicesOffset, getChunkIndices, m_nodeCount) | |
Public Attributes | |
| uint32_t | m_nodeCount |
Vertices in the support graph are termed "nodes," and represent particular chunks (NvBlastChunk) in an NvBlastAsset. The indexing for nodes is not the same as that for chunks. Only some chunks are represented by nodes in the graph, and these chunks are called "support chunks."
Adjacent node indices and adjacent bond indices are stored for each node, and therefore each bond is represented twice in this graph, going from node[i] -> node[j] and from node[j] -> node[i]. Therefore the size of the getAdjacentNodeIndices() and getAdjacentBondIndices() arrays are twice the number of bonds stored in the corresponding NvBlastAsset.
The graph is used as follows. Given a SupportGraph "graph" and node index i, (0 <= i < graph.nodeCount), one may find all adjacent bonds and nodes using:
const uint32_t* adjacencyPartition = graph.getAdjacencyPartition(); const uint32_t* adjacentNodeIndices = graph.getAdjacentNodeIndices(); const uint32_t* adjacentBondIndices = graph.getAdjacentBondIndices();
adj is the lookup value in adjacentNodeIndices and graph.getAdjacentBondIndices() for (uint32_t adj = adjacencyPartition[i]; adj < adjacencyPartition[i+1]; ++adj) { An adjacent node: uint32_t adjacentNodeIndex = adjacentNodeIndices[adj];
The corresponding bond (that connects node index i with node indexed adjacentNodeIndex: uint32_t adjacentBondIndex = adjacentBondIndices[adj]; }
For a graph node with index i, the corresponding asset chunk index is found using graph.getChunkIndices()[i]. The reverse mapping (obtaining a graph node index from an asset chunk index) can be done using the
NvBlastAssetGetChunkToGraphNodeMap(asset, logFn);
function. See the documentation for its use. The returned "node index" for a non-support chunk is the invalid value 0xFFFFFFFF.
| NV_INLINE uint32_t Nv::Blast::SupportGraph::findBond | ( | uint32_t | nodeIndex0, | |
| uint32_t | nodeIndex1 | |||
| ) | const |
Finds the bond between two given graph nodes (if it exists) and returns the bond index. If no bond exists, returns invalidIndex<uint32_t>().
| Nv::Blast::SupportGraph::NvBlastBlockArrayData | ( | uint32_t | , | |
| m_adjacentBondIndicesOffset | , | |||
| getAdjacentBondIndices | , | |||
| getAdjacencyPartition() | [m_nodeCount] | |||
| ) |
Array of uint32_t composed of subarrays holding the indices of bonds (NvBlastBond) for a given node. The subarrays may be accessed through the getAdjacencyPartition() array.
getAdjacentBondIndices returns an array of size getAdjacencyPartition()[m_nodeCount].
| Nv::Blast::SupportGraph::NvBlastBlockArrayData | ( | uint32_t | , | |
| m_adjacentNodeIndicesOffset | , | |||
| getAdjacentNodeIndices | , | |||
| getAdjacencyPartition() | [m_nodeCount] | |||
| ) |
Array of uint32_t composed of subarrays holding the indices of nodes adjacent to a given node. The subarrays may be accessed through the getAdjacencyPartition() array.
getAdjacentNodeIndices returns an array of size getAdjacencyPartition()[m_nodeCount].
| Nv::Blast::SupportGraph::NvBlastBlockArrayData | ( | uint32_t | , | |
| m_adjacencyPartitionOffset | , | |||
| getAdjacencyPartition | , | |||
| m_nodeCount+ | 1 | |||
| ) |
Adjacency lookup table, of type uint32_t.
Partitions both the getAdjacentNodeIndices() and the getAdjacentBondIndices() arrays into subsets corresponding to each node. The size of this array is nodeCount+1. For 0 <= i < nodeCount, getAdjacencyPartition()[i] is the index of the first element in getAdjacentNodeIndices() (or getAdjacentBondIndices()) for nodes adjacent to the node with index i. getAdjacencyPartition()[nodeCount] is the size of the getAdjacentNodeIndices() and getAdjacentBondIndices() arrays. This allows one to easily count the number of nodes adjacent to a node with index i, using getAdjacencyPartition()[i+1] - getAdjacencyPartition()[i].
getAdjacencyPartition returns an array of size m_nodeCount + 1.
| Nv::Blast::SupportGraph::NvBlastBlockArrayData | ( | uint32_t | , | |
| m_chunkIndicesOffset | , | |||
| getChunkIndices | , | |||
| m_nodeCount | ||||
| ) |
Indices of chunks represented by the nodes.
getChunkIndices returns an array of size m_nodeCount.
| uint32_t Nv::Blast::SupportGraph::m_nodeCount |
Total number of nodes in the support graph.