Merge branch 'master' into master
commit
376f66a06d
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -117,6 +115,9 @@ void MD5Parser::ParseHeader() {
|
||||||
ReportError("MD5 version tag is unknown (10 is expected)");
|
ReportError("MD5 version tag is unknown (10 is expected)");
|
||||||
}
|
}
|
||||||
SkipLine();
|
SkipLine();
|
||||||
|
if (buffer == bufferEnd) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// print the command line options to the console
|
// print the command line options to the console
|
||||||
// FIX: can break the log length limit, so we need to be careful
|
// FIX: can break the log length limit, so we need to be careful
|
||||||
|
@ -135,8 +136,9 @@ bool MD5Parser::ParseSection(Section &out) {
|
||||||
|
|
||||||
// first parse the name of the section
|
// first parse the name of the section
|
||||||
char *sz = buffer;
|
char *sz = buffer;
|
||||||
while (!IsSpaceOrNewLine(*buffer))
|
while (!IsSpaceOrNewLine(*buffer)) {
|
||||||
buffer++;
|
++buffer;
|
||||||
|
}
|
||||||
out.mName = std::string(sz, (uintptr_t)(buffer - sz));
|
out.mName = std::string(sz, (uintptr_t)(buffer - sz));
|
||||||
SkipSpaces();
|
SkipSpaces();
|
||||||
|
|
||||||
|
@ -144,14 +146,14 @@ bool MD5Parser::ParseSection(Section &out) {
|
||||||
while (running) {
|
while (running) {
|
||||||
if ('{' == *buffer) {
|
if ('{' == *buffer) {
|
||||||
// it is a normal section so read all lines
|
// it is a normal section so read all lines
|
||||||
buffer++;
|
++buffer;
|
||||||
bool run = true;
|
bool run = true;
|
||||||
while (run) {
|
while (run) {
|
||||||
if (!SkipSpacesAndLineEnd()) {
|
if (!SkipSpacesAndLineEnd()) {
|
||||||
return false; // seems this was the last section
|
return false; // seems this was the last section
|
||||||
}
|
}
|
||||||
if ('}' == *buffer) {
|
if ('}' == *buffer) {
|
||||||
buffer++;
|
++buffer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +165,7 @@ bool MD5Parser::ParseSection(Section &out) {
|
||||||
|
|
||||||
// terminate the line with zero
|
// terminate the line with zero
|
||||||
while (!IsLineEnd(*buffer))
|
while (!IsLineEnd(*buffer))
|
||||||
buffer++;
|
++buffer;
|
||||||
if (*buffer) {
|
if (*buffer) {
|
||||||
++lineNumber;
|
++lineNumber;
|
||||||
*buffer++ = '\0';
|
*buffer++ = '\0';
|
||||||
|
|
|
@ -290,11 +290,12 @@ void OFFImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
||||||
sz = line; SkipSpaces(&sz);
|
sz = line; SkipSpaces(&sz);
|
||||||
idx = strtoul10(sz,&sz);
|
idx = strtoul10(sz,&sz);
|
||||||
if(!idx || idx > 9) {
|
if(!idx || idx > 9) {
|
||||||
ASSIMP_LOG_ERROR("OFF: Faces with zero indices aren't allowed");
|
ASSIMP_LOG_ERROR("OFF: Faces with zero indices aren't allowed");
|
||||||
--mesh->mNumFaces;
|
--mesh->mNumFaces;
|
||||||
|
++i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
faces->mNumIndices = idx;
|
faces->mNumIndices = idx;
|
||||||
faces->mIndices = new unsigned int[faces->mNumIndices];
|
faces->mIndices = new unsigned int[faces->mNumIndices];
|
||||||
for (unsigned int m = 0; m < faces->mNumIndices;++m) {
|
for (unsigned int m = 0; m < faces->mNumIndices;++m) {
|
||||||
SkipSpaces(&sz);
|
SkipSpaces(&sz);
|
||||||
|
|
|
@ -440,7 +440,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) {
|
||||||
const bool vt = (!m_pModel->mTextureCoord.empty());
|
const bool vt = (!m_pModel->mTextureCoord.empty());
|
||||||
const bool vn = (!m_pModel->mNormals.empty());
|
const bool vn = (!m_pModel->mNormals.empty());
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
while (m_DataIt != m_DataItEnd) {
|
while (m_DataIt < m_DataItEnd) {
|
||||||
int iStep = 1;
|
int iStep = 1;
|
||||||
|
|
||||||
if (IsLineEnd(*m_DataIt)) {
|
if (IsLineEnd(*m_DataIt)) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -111,6 +111,10 @@ inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) {
|
||||||
*/
|
*/
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
|
inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
|
||||||
|
if (it >= end) {
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
while (!isEndOfBuffer(it, end) && !IsLineEnd(*it)) {
|
while (!isEndOfBuffer(it, end) && !IsLineEnd(*it)) {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +133,7 @@ inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a name from the current line. Preserve space in the middle,
|
* @brief Get a name from the current line. Preserve space in the middle,
|
||||||
* but trim it at the end.
|
* but trim it at the end.
|
||||||
* @param[in] it set to current position
|
* @param[in] it set to current position
|
||||||
* @param[in] end set to end of scratch buffer for readout
|
* @param[in] end set to end of scratch buffer for readout
|
||||||
* @param[out] name Separated name
|
* @param[out] name Separated name
|
||||||
|
|
Loading…
Reference in New Issue