mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-06-12 08:23:59 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef ASSIMP_BUILD_NO_MDC_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "AssetLib/MDC/MDCLoader.h"
|
||||
#include "MDCLoader.h"
|
||||
#include "AssetLib/MD3/MD3FileData.h"
|
||||
#include "AssetLib/MDC/MDCNormalTable.h" // shouldn't be included by other units
|
||||
#include "MDCNormalTable.h" // shouldn't be included by other units
|
||||
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/scene.h>
|
||||
|
|
@ -106,7 +106,7 @@ MDCImporter::MDCImporter() :
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool MDCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
|
||||
static const uint32_t tokens[] = { AI_MDC_MAGIC_NUMBER_LE };
|
||||
static constexpr uint32_t tokens[] = { AI_MDC_MAGIC_NUMBER_LE };
|
||||
return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
|
||||
}
|
||||
|
||||
|
|
@ -160,6 +160,7 @@ void MDCImporter::ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf) {
|
|||
AI_SWAP4(pcSurf->ulOffsetTexCoords);
|
||||
AI_SWAP4(pcSurf->ulOffsetBaseVerts);
|
||||
AI_SWAP4(pcSurf->ulOffsetCompVerts);
|
||||
AI_SWAP4(pcSurf->ulOffsetShaders);
|
||||
AI_SWAP4(pcSurf->ulOffsetFrameBaseFrames);
|
||||
AI_SWAP4(pcSurf->ulOffsetFrameCompFrames);
|
||||
AI_SWAP4(pcSurf->ulOffsetEnd);
|
||||
|
|
@ -172,7 +173,8 @@ void MDCImporter::ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf) {
|
|||
pcSurf->ulOffsetTexCoords + pcSurf->ulNumVertices * sizeof(MDC::TexturCoord) > iMax ||
|
||||
pcSurf->ulOffsetShaders + pcSurf->ulNumShaders * sizeof(MDC::Shader) > iMax ||
|
||||
pcSurf->ulOffsetFrameBaseFrames + pcSurf->ulNumBaseFrames * 2 > iMax ||
|
||||
(pcSurf->ulNumCompFrames && pcSurf->ulOffsetFrameCompFrames + pcSurf->ulNumCompFrames * 2 > iMax)) {
|
||||
(pcSurf->ulNumCompFrames && pcSurf->ulOffsetFrameCompFrames + pcSurf->ulNumCompFrames * 2 > iMax) ||
|
||||
pcSurf->ulOffsetEnd > iMax) {
|
||||
throw DeadlyImportError("Some of the offset values in the MDC surface header "
|
||||
"are invalid and point somewhere behind the file.");
|
||||
}
|
||||
|
|
@ -324,6 +326,15 @@ void MDCImporter::InternReadFile(
|
|||
|
||||
#endif
|
||||
|
||||
// boundary check for pcVerts
|
||||
auto surfStart = reinterpret_cast<const uint8_t*>(pcSurface);
|
||||
const uint8_t* surfEnd = surfStart + pcSurface->ulOffsetEnd;
|
||||
auto vertBufStart = reinterpret_cast<const uint8_t*>(pcVerts);
|
||||
const size_t needVertBytes = sizeof(MDC::BaseVertex) * pcSurface->ulNumVertices;
|
||||
if (vertBufStart < surfStart || vertBufStart + needVertBytes > surfEnd) {
|
||||
throw DeadlyImportError("MDCImporter: pcVerts points outside of surface block.");
|
||||
}
|
||||
|
||||
const MDC::CompressedVertex *pcCVerts = nullptr;
|
||||
int16_t *mdcCompVert = nullptr;
|
||||
|
||||
|
|
@ -335,6 +346,12 @@ void MDCImporter::InternReadFile(
|
|||
pcCVerts = (const MDC::CompressedVertex *)((int8_t *)pcSurface +
|
||||
pcSurface->ulOffsetCompVerts) +
|
||||
*mdcCompVert * pcSurface->ulNumVertices;
|
||||
auto cvertBufStart = reinterpret_cast<const uint8_t*>(pcCVerts);
|
||||
const size_t needCompVertBytes = sizeof(MDC::CompressedVertex) * pcSurface->ulNumVertices;
|
||||
if (cvertBufStart < surfStart || cvertBufStart > surfEnd ||
|
||||
needCompVertBytes > static_cast<size_t>(surfEnd - cvertBufStart)) {
|
||||
throw DeadlyImportError("MDCImporter: pcCVerts points outside of surface block.");
|
||||
}
|
||||
} else
|
||||
mdcCompVert = nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue