MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / Append

Method Append

Engine/lib/assimp/code/Common/SpatialSort.cpp:107–124  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

105
106// ------------------------------------------------------------------------------------------------
107void SpatialSort::Append(const aiVector3D *pPositions, unsigned int pNumPositions,
108 unsigned int pElementOffset,
109 bool pFinalize /*= true */) {
110 ai_assert(!mFinalized && "You cannot add positions to the SpatialSort object after it has been finalized.");
111 // store references to all given positions along with their distance to the reference plane
112 const size_t initial = mPositions.size();
113 mPositions.reserve(initial + pNumPositions);
114 for (unsigned int a = 0; a < pNumPositions; a++) {
115 const char *tempPointer = reinterpret_cast<const char *>(pPositions);
116 const aiVector3D *vec = reinterpret_cast<const aiVector3D *>(tempPointer + a * pElementOffset);
117 mPositions.emplace_back(static_cast<unsigned int>(a + initial), *vec);
118 }
119
120 if (pFinalize) {
121 // now sort the array ascending by distance.
122 Finalize();
123 }
124}
125
126// ------------------------------------------------------------------------------------------------
127// Returns an iterator for all positions close to the given position.

Callers 2

InternSubdivideMethod · 0.45
GetExtensionListMethod · 0.45

Calls 3

sizeMethod · 0.45
reserveMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected