00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
00030 #define NVBLASTACTORSERIALIZATIONBLOCK_H
00031
00032
00033 #include "NvBlastFixedBoolArray.h"
00034
00035
00036 namespace Nv
00037 {
00038 namespace Blast
00039 {
00040
00044 struct ActorSerializationFormat
00045 {
00046 enum Version
00047 {
00049 Initial,
00050
00051
00052
00054 Count,
00055
00057 Current = Count - 1
00058 };
00059 };
00060
00061
00069 struct ActorSerializationHeader
00070 {
00074 uint32_t m_formatVersion;
00075
00081 uint32_t m_size;
00082
00086 uint32_t m_index;
00087
00091 uint32_t m_visibleChunkCount;
00092
00096 uint32_t m_graphNodeCount;
00097
00101 uint32_t m_leafChunkCount;
00102
00106 NvBlastBlockArrayData(uint32_t, m_visibleChunkIndicesOffset, getVisibleChunkIndices, m_visibleChunkCount);
00107
00111 NvBlastBlockArrayData(uint32_t, m_graphNodeIndicesOffset, getGraphNodeIndices, m_graphNodeCount);
00112
00116 NvBlastBlockData(float, m_lowerSupportChunkHealthsOffset, getLowerSupportChunkHealths);
00117
00121 NvBlastBlockData(float, m_bondHealthsOffset, getBondHealths);
00122
00126 NvBlastBlockArrayData(uint32_t, m_fastRouteOffset, getFastRoute, m_graphNodeCount);
00127
00131 NvBlastBlockArrayData(uint32_t, m_hopCountsOffset, getHopCounts, m_graphNodeCount);
00132
00136 NvBlastBlockData(FixedBoolArray, m_edgeRemovedArrayOffset, getEdgeRemovedArray);
00137 };
00138
00139
00141
00152 NV_INLINE size_t getActorSerializationSize(uint32_t visibleChunkCount, uint32_t lowerSupportChunkCount, uint32_t graphNodeCount, uint32_t bondCount)
00153 {
00154
00155 const size_t visibleChunkIndicesOffset = align16(sizeof(ActorSerializationHeader));
00156 const size_t graphNodeIndicesOffset = align16(visibleChunkIndicesOffset + visibleChunkCount*sizeof(uint32_t));
00157 const size_t lowerSupportHealthsOffset = align16(graphNodeIndicesOffset + graphNodeCount*sizeof(uint32_t));
00158 const size_t bondHealthsOffset = align16(lowerSupportHealthsOffset + lowerSupportChunkCount*sizeof(float));
00159 const size_t fastRouteOffset = align16(bondHealthsOffset + bondCount*sizeof(float));
00160 const size_t hopCountsOffset = align16(fastRouteOffset + graphNodeCount*sizeof(uint32_t));
00161 const size_t edgeRemovedArrayOffset = align16(hopCountsOffset + graphNodeCount*sizeof(uint32_t));
00162 return align16(edgeRemovedArrayOffset + (bondCount == 0 ? 0 : FixedBoolArray::requiredMemorySize(bondCount)));
00163 }
00164
00165 }
00166 }
00167
00168
00169 #endif // ifndef NVBLASTACTORSERIALIZATIONBLOCK_H