Compare commits
8 Commits
bugfix/fix
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a9e4b4a59 | ||
|
|
ea7f710d70 | ||
|
|
93f3c38ceb | ||
|
|
0a9cefe943 | ||
|
|
daa6d64227 | ||
|
|
04946cc0f4 | ||
|
|
30c4784619 | ||
|
|
f7d2de1efc |
@@ -1,17 +1,54 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "assimp",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS": "OFF"
|
||||
}
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "assimp_with_tools",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS" : "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
{
|
||||
"name": "assimp_static",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"BUILD_SHARED_LIBS": "OFF",
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS": "OFF",
|
||||
"ASSIMP_DOUBLE_PRECISION": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "assimp_double_precision",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS": "OFF",
|
||||
"ASSIMP_DOUBLE_PRECISION": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "assimp_with_tools",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "assimp_all",
|
||||
"binaryDir": "${sourceDir}",
|
||||
"cacheVariables": {
|
||||
"ASSIMP_BUILD_ASSIMP_TOOLS": "ON",
|
||||
"ASSIMP_BUILD_SAMPLES": "ON",
|
||||
"ASSIMP_BUILD_DOCS": "ON"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
@@ -139,11 +139,12 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
|
||||
// handle c-stype section end (http://paulbourke.net/dataformats/obj/)
|
||||
if (insideCstype) {
|
||||
switch (*m_DataIt) {
|
||||
case 'e': {
|
||||
std::string name;
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, name);
|
||||
insideCstype = name != "end";
|
||||
} break;
|
||||
case 'e': {
|
||||
char *name{nullptr};
|
||||
size_t len{0};
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, &name, len);
|
||||
insideCstype = !(len == 3 && strncmp(name, "end", 3) == 0);
|
||||
} break;
|
||||
}
|
||||
goto pf_skip_line;
|
||||
}
|
||||
@@ -198,32 +199,23 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
|
||||
|
||||
case 'u': // Parse a material desc. setter
|
||||
{
|
||||
std::string name;
|
||||
char *name{nullptr};
|
||||
size_t len{ 0 };
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, &name, len);
|
||||
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, name);
|
||||
|
||||
size_t nextSpace = name.find(' ');
|
||||
if (nextSpace != std::string::npos)
|
||||
name = name.substr(0, nextSpace);
|
||||
|
||||
if (name == "usemtl") {
|
||||
if (strncmp(name, "usemtl", len) == 0) {
|
||||
getMaterialDesc();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'm': // Parse a material library or merging group ('mg')
|
||||
{
|
||||
std::string name;
|
||||
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, name);
|
||||
|
||||
size_t nextSpace = name.find(' ');
|
||||
if (nextSpace != std::string::npos)
|
||||
name = name.substr(0, nextSpace);
|
||||
|
||||
if (name == "mg")
|
||||
char *name{nullptr};
|
||||
size_t len{ 0 };
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, &name, len);
|
||||
if (strncmp(name, "mg", len) == 0)
|
||||
getGroupNumberAndResolution();
|
||||
else if (name == "mtllib")
|
||||
else if (strncmp(name, "mtllib", len) == 0)
|
||||
getMaterialLib();
|
||||
else
|
||||
goto pf_skip_line;
|
||||
@@ -246,9 +238,11 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
|
||||
|
||||
case 'c': // handle cstype section start
|
||||
{
|
||||
std::string name;
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, name);
|
||||
insideCstype = name == "cstype";
|
||||
//std::string name;
|
||||
char *name{nullptr};
|
||||
size_t len{0};
|
||||
getNameNoSpace(m_DataIt, m_DataItEnd, &name, len);
|
||||
insideCstype = strncmp(name, "cstype", len) == 0;
|
||||
goto pf_skip_line;
|
||||
}
|
||||
|
||||
|
||||
@@ -177,31 +177,37 @@ inline char_t getName(char_t it, char_t end, std::string &name) {
|
||||
* @return Current-iterator with new position
|
||||
*/
|
||||
template <class char_t>
|
||||
inline char_t getNameNoSpace(char_t it, char_t end, std::string &name) {
|
||||
name = "";
|
||||
inline char_t getNameNoSpace(char_t it, char_t end, char **name, size_t &len) {
|
||||
*name = nullptr;
|
||||
len = 0;
|
||||
if (isEndOfBuffer(it, end)) {
|
||||
return end;
|
||||
}
|
||||
|
||||
char *pStart = &(*it);
|
||||
while (&(*it) > pStart && (isEndOfBuffer(it, end) || IsLineEnd(*it) || IsSpaceOrNewLine(*it))) {
|
||||
--it;
|
||||
--len;
|
||||
}
|
||||
while (!isEndOfBuffer(it, end) && !IsLineEnd(*it) && !IsSpaceOrNewLine(*it)) {
|
||||
++it;
|
||||
++len;
|
||||
}
|
||||
|
||||
while (isEndOfBuffer(it, end) || IsLineEnd(*it) || IsSpaceOrNewLine(*it)) {
|
||||
--it;
|
||||
--len;
|
||||
}
|
||||
++it;
|
||||
++len;
|
||||
|
||||
// Get name
|
||||
// if there is no name, and the previous char is a separator, come back to start
|
||||
while (&(*it) < pStart) {
|
||||
++it;
|
||||
++len;
|
||||
}
|
||||
std::string strName(pStart, &(*it));
|
||||
if (!strName.empty()) {
|
||||
name = strName;
|
||||
}
|
||||
*name = pStart;
|
||||
|
||||
return it;
|
||||
}
|
||||
@@ -239,7 +245,7 @@ inline char_t CopyNextWord(char_t it, char_t end, char *pBuffer, size_t length)
|
||||
*/
|
||||
template <class char_t>
|
||||
inline char_t getFloat(char_t it, char_t end, ai_real &value) {
|
||||
static const size_t BUFFERSIZE = 1024;
|
||||
static constexpr size_t BUFFERSIZE = 1024;
|
||||
char buffer[BUFFERSIZE] = {};
|
||||
it = CopyNextWord<char_t>(it, end, buffer, BUFFERSIZE);
|
||||
value = (ai_real)fast_atof(buffer);
|
||||
|
||||
@@ -58,8 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef GLTF2ASSET_H_INC
|
||||
#define GLTF2ASSET_H_INC
|
||||
|
||||
//#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||
|
||||
#include <assimp/Exceptional.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -1283,6 +1281,4 @@ inline std::string getContextForErrorMessages(const std::string &id, const std::
|
||||
// Include the implementation of the methods
|
||||
#include "glTF2Asset.inl"
|
||||
|
||||
//#endif // ASSIMP_BUILD_NO_GLTF_IMPORTER
|
||||
|
||||
#endif // GLTF2ASSET_H_INC
|
||||
|
||||
Reference in New Issue
Block a user