Merge branch 'master' into issue_3398
commit
df739f00dd
|
@ -44,7 +44,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 3.10 )
|
|||
option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
||||
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
include("cmake/HunterGate.cmake")
|
||||
include("cmake-modules/HunterGate.cmake")
|
||||
HunterGate(
|
||||
URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz"
|
||||
SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410"
|
||||
|
@ -135,11 +135,11 @@ IF ( WIN32 )
|
|||
# Use subset of Windows.h
|
||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||
|
||||
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW
|
||||
"If the Assimp view tool is built. (requires DirectX)"
|
||||
OFF )
|
||||
|
||||
IF(MSVC)
|
||||
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW
|
||||
"If the Assimp view tool is built. (requires DirectX)"
|
||||
OFF )
|
||||
|
||||
OPTION( ASSIMP_INSTALL_PDB
|
||||
"Install MSVC debug files."
|
||||
ON )
|
||||
|
@ -397,14 +397,14 @@ set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|||
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-hunter-config.cmake.in")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
|
||||
set(NAMESPACE "${PROJECT_NAME}::")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
||||
ELSE()
|
||||
set(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-plain-config.cmake.in")
|
||||
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
|
||||
set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets")
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# Find IrrXMl from irrlicht project
|
||||
#
|
||||
# Find LibIrrXML headers and library
|
||||
#
|
||||
# IRRXML_FOUND - IrrXML found
|
||||
# IRRXML_INCLUDE_DIR - Headers location
|
||||
# IRRXML_LIBRARY - IrrXML main library
|
||||
|
||||
find_path(IRRXML_INCLUDE_DIR irrXML.h
|
||||
PATH_SUFFIXES include/irrlicht include/irrxml)
|
||||
find_library(IRRXML_LIBRARY IrrXML)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(IrrXML REQUIRED_VARS IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
||||
|
||||
|
||||
mark_as_advanced(IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
|
|
@ -0,0 +1,19 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
find_package(RapidJSON CONFIG REQUIRED)
|
||||
find_package(ZLIB CONFIG REQUIRED)
|
||||
find_package(utf8cpp CONFIG REQUIRED)
|
||||
find_package(minizip CONFIG REQUIRED)
|
||||
find_package(openddlparser CONFIG REQUIRED)
|
||||
find_package(poly2tri CONFIG REQUIRED)
|
||||
find_package(polyclipping CONFIG REQUIRED)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
find_package(pugixml CONFIG REQUIRED)
|
||||
find_package(stb CONFIG REQUIRED)
|
||||
|
||||
if(@ASSIMP_BUILD_DRACO@)
|
||||
find_package(draco CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
|
@ -1,19 +0,0 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
find_package(RapidJSON CONFIG REQUIRED)
|
||||
find_package(ZLIB CONFIG REQUIRED)
|
||||
find_package(utf8cpp CONFIG REQUIRED)
|
||||
find_package(minizip CONFIG REQUIRED)
|
||||
find_package(openddlparser CONFIG REQUIRED)
|
||||
find_package(poly2tri CONFIG REQUIRED)
|
||||
find_package(polyclipping CONFIG REQUIRED)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
find_package(pugixml CONFIG REQUIRED)
|
||||
find_package(stb CONFIG REQUIRED)
|
||||
|
||||
if(@ASSIMP_BUILD_DRACO@)
|
||||
find_package(draco CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
|
@ -111,7 +111,7 @@ namespace XmlTag {
|
|||
const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
|
||||
const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
|
||||
}
|
||||
}
|
||||
|
||||
} // Namespace D3MF
|
||||
} // Namespace Assimp
|
||||
|
|
|
@ -172,7 +172,7 @@ inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) {
|
|||
t += Write<float>(stream, v.z);
|
||||
ai_assert(t == 16);
|
||||
|
||||
return 16;
|
||||
return t;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
|
|
@ -146,8 +146,14 @@ void C4DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
|||
ThrowException("failed to read document " + pFile);
|
||||
}
|
||||
|
||||
// Generate the root-node
|
||||
pScene->mRootNode = new aiNode("<C4DRoot>");
|
||||
|
||||
// convert left-handed to right-handed
|
||||
pScene->mRootNode->mTransformation.a1 = 0.01f;
|
||||
pScene->mRootNode->mTransformation.b2 = 0.01f;
|
||||
pScene->mRootNode->mTransformation.c3 = -0.01f;
|
||||
|
||||
// first convert all materials
|
||||
ReadMaterials(doc->GetFirstMaterial());
|
||||
|
||||
|
|
|
@ -620,6 +620,10 @@ aiMesh *ColladaLoader::CreateMesh(const ColladaParser &pParser, const Mesh *pSrc
|
|||
dstMesh->mName = pSrcMesh->mId;
|
||||
}
|
||||
|
||||
if (pSrcMesh->mPositions.empty()) {
|
||||
return dstMesh.release();
|
||||
}
|
||||
|
||||
// count the vertices addressed by its faces
|
||||
const size_t numVertices = std::accumulate(pSrcMesh->mFaceSize.begin() + pStartFace,
|
||||
pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, size_t(0));
|
||||
|
|
|
@ -231,11 +231,7 @@ void ColladaParser::UriDecodePath(aiString &ss) {
|
|||
|
||||
// Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes...
|
||||
// I need to filter it without destroying linux paths starting with "/somewhere"
|
||||
#if defined(_MSC_VER)
|
||||
if (ss.data[0] == '/' && isalpha((unsigned char)ss.data[1]) && ss.data[2] == ':') {
|
||||
#else
|
||||
if (ss.data[0] == '/' && isalpha((unsigned char)ss.data[1]) && ss.data[2] == ':') {
|
||||
#endif
|
||||
--ss.length;
|
||||
::memmove(ss.data, ss.data + 1, ss.length);
|
||||
ss.data[ss.length] = 0;
|
||||
|
|
|
@ -2131,7 +2131,7 @@ void FBXConverter::SetShadingPropertiesCommon(aiMaterial *out_mat, const Propert
|
|||
if (ok) {
|
||||
out_mat->AddProperty(&Emissive, 1, AI_MATKEY_COLOR_EMISSIVE);
|
||||
} else {
|
||||
const aiColor3D &emissiveColor = GetColorPropertyFromMaterial(props, "Maya|emissive", ok);
|
||||
const aiColor3D &emissiveColor = GetColorProperty(props, "Maya|emissive", ok);
|
||||
if (ok) {
|
||||
out_mat->AddProperty(&emissiveColor, 1, AI_MATKEY_COLOR_EMISSIVE);
|
||||
}
|
||||
|
@ -2218,7 +2218,7 @@ void FBXConverter::SetShadingPropertiesCommon(aiMaterial *out_mat, const Propert
|
|||
}
|
||||
|
||||
// PBR material information
|
||||
const aiColor3D &baseColor = GetColorPropertyFromMaterial(props, "Maya|base_color", ok);
|
||||
const aiColor3D &baseColor = GetColorProperty(props, "Maya|base_color", ok);
|
||||
if (ok) {
|
||||
out_mat->AddProperty(&baseColor, 1, AI_MATKEY_BASE_COLOR);
|
||||
}
|
||||
|
|
|
@ -192,6 +192,10 @@ Scope::Scope(Parser& parser,bool topLevel)
|
|||
}
|
||||
|
||||
const std::string& str = n->StringContents();
|
||||
if (str.empty()) {
|
||||
ParseError("unexpected content: empty string.");
|
||||
}
|
||||
|
||||
elements.insert(ElementMap::value_type(str,new_Element(*n,parser)));
|
||||
|
||||
// Element() should stop at the next Key token (or right after a Close token)
|
||||
|
@ -642,8 +646,7 @@ void ParseVectorDataArray(std::vector<aiVector3D>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * (type == 'd' ? 8 : 4);
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -733,8 +736,7 @@ void ParseVectorDataArray(std::vector<aiColor4D>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * (type == 'd' ? 8 : 4);
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -816,8 +818,7 @@ void ParseVectorDataArray(std::vector<aiVector2D>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * (type == 'd' ? 8 : 4);
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -892,8 +893,7 @@ void ParseVectorDataArray(std::vector<int>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * 4;
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -954,8 +954,7 @@ void ParseVectorDataArray(std::vector<float>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * (type == 'd' ? 8 : 4);
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -1019,8 +1018,7 @@ void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * 4;
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -1088,8 +1086,7 @@ void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * 8;
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
@ -1150,8 +1147,7 @@ void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el)
|
|||
|
||||
ai_assert(data == end);
|
||||
uint64_t dataToRead = static_cast<uint64_t>(count) * 8;
|
||||
ai_assert(buff.size() == dataToRead);
|
||||
if (dataToRead > buff.size()) {
|
||||
if (dataToRead != buff.size()) {
|
||||
ParseError("Invalid read size (binary)",&el);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,12 +233,12 @@ void M3DImporter::importMaterials(const M3DWrapper &m3d) {
|
|||
ASSIMP_LOG_DEBUG("M3D: importMaterials ", mScene->mNumMaterials);
|
||||
|
||||
// add a default material as first
|
||||
aiMaterial *mat = new aiMaterial;
|
||||
mat->AddProperty(&name, AI_MATKEY_NAME);
|
||||
aiMaterial *defaultMat = new aiMaterial;
|
||||
defaultMat->AddProperty(&name, AI_MATKEY_NAME);
|
||||
c.a = 1.0f;
|
||||
c.b = c.g = c.r = 0.6f;
|
||||
mat->AddProperty(&c, 1, AI_MATKEY_COLOR_DIFFUSE);
|
||||
mScene->mMaterials[0] = mat;
|
||||
defaultMat->AddProperty(&c, 1, AI_MATKEY_COLOR_DIFFUSE);
|
||||
mScene->mMaterials[0] = defaultMat;
|
||||
|
||||
if (!m3d->nummaterial || !m3d->material) {
|
||||
return;
|
||||
|
@ -300,12 +300,12 @@ void M3DImporter::importMaterials(const M3DWrapper &m3d) {
|
|||
m->prop[j].value.textureid < m3d->numtexture &&
|
||||
m3d->texture[m->prop[j].value.textureid].name) {
|
||||
name.Set(std::string(std::string(m3d->texture[m->prop[j].value.textureid].name) + ".png"));
|
||||
mat->AddProperty(&name, aiTxProps[k].pKey, aiTxProps[k].type, aiTxProps[k].index);
|
||||
newMat->AddProperty(&name, aiTxProps[k].pKey, aiTxProps[k].type, aiTxProps[k].index);
|
||||
n = 0;
|
||||
mat->AddProperty(&n, 1, _AI_MATKEY_UVWSRC_BASE, aiProps[k].type, aiProps[k].index);
|
||||
newMat->AddProperty(&n, 1, _AI_MATKEY_UVWSRC_BASE, aiProps[k].type, aiProps[k].index);
|
||||
}
|
||||
}
|
||||
mScene->mMaterials[i + 1] = mat;
|
||||
mScene->mMaterials[i + 1] = newMat;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#ifndef AI_M3DWRAPPER_H_INC
|
||||
#define AI_M3DWRAPPER_H_INC
|
||||
|
||||
#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER) || !ASSIMP_BUILD_NO_M3D_IMPORTER
|
||||
|
||||
#include <memory>
|
||||
|
@ -62,41 +63,68 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "m3d.h"
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
class IOSystem;
|
||||
|
||||
/// brief The M3D-Wrapper, provudes c++ access to the data.
|
||||
class M3DWrapper {
|
||||
m3d_t *m3d_ = nullptr;
|
||||
unsigned char *saved_output_ = nullptr;
|
||||
|
||||
public:
|
||||
// Construct an empty M3D model
|
||||
/// Construct an empty M3D model
|
||||
explicit M3DWrapper();
|
||||
|
||||
// Construct an M3D model from provided buffer
|
||||
// NOTE: The m3d.h SDK function does not mark the data as const. Have assumed it does not write.
|
||||
// BUG: SECURITY: The m3d.h SDK cannot be informed of the buffer size. BUFFER OVERFLOW IS CERTAIN
|
||||
/// Construct an M3D model from provided buffer
|
||||
/// @note The m3d.h SDK function does not mark the data as const. Have assumed it does not write.
|
||||
/// BUG: SECURITY: The m3d.h SDK cannot be informed of the buffer size. BUFFER OVERFLOW IS CERTAIN
|
||||
explicit M3DWrapper(IOSystem *pIOHandler, const std::vector<unsigned char> &buffer);
|
||||
|
||||
~M3DWrapper();
|
||||
/// Theclasss destructor.
|
||||
~M3DWrapper();
|
||||
|
||||
void reset();
|
||||
/// Will reset the wrapper, all data will become nullptr.
|
||||
void reset();
|
||||
|
||||
// Name
|
||||
inline std::string Name() const {
|
||||
if (m3d_) return std::string(m3d_->name);
|
||||
return std::string();
|
||||
}
|
||||
// The Name access, empty string returned when no m3d instance.
|
||||
std::string Name() const;
|
||||
|
||||
// Execute a save
|
||||
/// Executes a save.
|
||||
unsigned char *Save(int quality, int flags, unsigned int &size);
|
||||
|
||||
/// Clearer
|
||||
void ClearSave();
|
||||
|
||||
inline explicit operator bool() const { return m3d_ != nullptr; }
|
||||
/// True for m3d instance exists.
|
||||
explicit operator bool() const;
|
||||
|
||||
// Allow direct access to M3D API
|
||||
inline m3d_t *operator->() const { return m3d_; }
|
||||
inline m3d_t *M3D() const { return m3d_; }
|
||||
m3d_t *operator->() const;
|
||||
m3d_t *M3D() const;
|
||||
|
||||
private:
|
||||
m3d_t *m3d_ = nullptr;
|
||||
unsigned char *saved_output_ = nullptr;
|
||||
};
|
||||
|
||||
inline std::string M3DWrapper::Name() const {
|
||||
if (nullptr != m3d_) {
|
||||
if (nullptr != m3d_->name) {
|
||||
return std::string(m3d_->name);
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
inline M3DWrapper::operator bool() const {
|
||||
return m3d_ != nullptr;
|
||||
}
|
||||
|
||||
inline m3d_t *M3DWrapper::operator->() const {
|
||||
return m3d_;
|
||||
}
|
||||
|
||||
inline m3d_t *M3DWrapper::M3D() const {
|
||||
return m3d_;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif
|
||||
|
|
|
@ -516,13 +516,13 @@ namespace pmx
|
|||
stream->read((char*) magic, sizeof(char) * 4);
|
||||
if (magic[0] != 0x50 || magic[1] != 0x4d || magic[2] != 0x58 || magic[3] != 0x20)
|
||||
{
|
||||
throw DeadlyImportError("MMD: Invalid magic number.");
|
||||
}
|
||||
throw DeadlyImportError("MMD: Invalid magic number.");
|
||||
}
|
||||
stream->read((char*) &version, sizeof(float));
|
||||
if (version != 2.0f && version != 2.1f)
|
||||
{
|
||||
throw DeadlyImportError("MMD: Unsupported version (must be 2.0 or 2.1): ", ai_to_string(version));
|
||||
}
|
||||
}
|
||||
this->setting.Read(stream);
|
||||
|
||||
this->model_name = ReadString(stream, setting.encoding);
|
||||
|
|
|
@ -468,7 +468,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model *pModel,
|
|||
}
|
||||
|
||||
// Copy all vertex colors
|
||||
if (!pModel->m_VertexColors.empty()) {
|
||||
if (vertex < pModel->m_VertexColors.size()) {
|
||||
const aiVector3D &color = pModel->m_VertexColors[vertex];
|
||||
pMesh->mColors[0][newIndex] = aiColor4D(color.x, color.y, color.z, 1.0);
|
||||
}
|
||||
|
|
|
@ -58,13 +58,13 @@ using namespace Assimp;
|
|||
namespace EXPRESS = STEP::EXPRESS;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "")
|
||||
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = std::string())
|
||||
{
|
||||
return line == STEP::SyntaxError::LINE_NOT_SPECIFIED ? prefix+s : static_cast<std::string>( (Formatter::format(),prefix,"(line ",line,") ",s) );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = "")
|
||||
std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = std::string())
|
||||
{
|
||||
return entity == STEP::TypeError::ENTITY_NOT_SPECIFIED ? prefix+s : static_cast<std::string>( (Formatter::format(),prefix,"(entity #",entity,") ",s));
|
||||
}
|
||||
|
|
|
@ -175,12 +175,11 @@ void StepExporter::WriteFile()
|
|||
fColor.b = 0.8f;
|
||||
|
||||
int ind = 100; // the start index to be used
|
||||
int faceEntryLen = 30; // number of entries for a triangle/face
|
||||
std::vector<int> faceEntryLen; // numbers of entries for a triangle/face
|
||||
// prepare unique (count triangles and vertices)
|
||||
|
||||
VectorIndexUMap uniqueVerts; // use a map to reduce find complexity to log(n)
|
||||
VectorIndexUMap::iterator it;
|
||||
int countFace = 0;
|
||||
|
||||
for (unsigned int i=0; i<mScene->mNumMeshes; ++i)
|
||||
{
|
||||
|
@ -189,7 +188,7 @@ void StepExporter::WriteFile()
|
|||
{
|
||||
aiFace* face = &(mesh->mFaces[j]);
|
||||
|
||||
if (face->mNumIndices == 3) countFace++;
|
||||
if (face->mNumIndices >= 3) faceEntryLen.push_back(15 + 5 * face->mNumIndices);
|
||||
}
|
||||
for (unsigned int j=0; j<mesh->mNumVertices; ++j)
|
||||
{
|
||||
|
@ -218,10 +217,13 @@ void StepExporter::WriteFile()
|
|||
// write the top of data
|
||||
mOutput << "DATA" << endstr;
|
||||
mOutput << "#1=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION(' ',(";
|
||||
for (int i=0; i<countFace; ++i)
|
||||
size_t countFace = faceEntryLen.size();
|
||||
size_t faceLenIndex = ind + 2 * uniqueVerts.size();
|
||||
for (size_t i=0; i<countFace; ++i)
|
||||
{
|
||||
mOutput << "#" << i*faceEntryLen + ind + 2*uniqueVerts.size();
|
||||
mOutput << "#" << faceLenIndex;
|
||||
if (i!=countFace-1) mOutput << ",";
|
||||
faceLenIndex += faceEntryLen[i];
|
||||
}
|
||||
mOutput << "),#6)" << endstr;
|
||||
|
||||
|
@ -253,10 +255,12 @@ void StepExporter::WriteFile()
|
|||
mOutput << "#27=DIRECTION('',(1.0,0.0,0.0))" << endstr;
|
||||
mOutput << "#28= (NAMED_UNIT(#21)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.))" << endstr;
|
||||
mOutput << "#29=CLOSED_SHELL('',(";
|
||||
for (int i=0; i<countFace; ++i)
|
||||
faceLenIndex = ind + 2 * uniqueVerts.size() + 8;
|
||||
for (size_t i=0; i<countFace; ++i)
|
||||
{
|
||||
mOutput << "#" << i*faceEntryLen + ind + 2*uniqueVerts.size() + 8;
|
||||
mOutput << "#" << faceLenIndex;
|
||||
if (i!=countFace-1) mOutput << ",";
|
||||
faceLenIndex += faceEntryLen[i];
|
||||
}
|
||||
mOutput << "))" << endstr;
|
||||
|
||||
|
@ -289,28 +293,29 @@ void StepExporter::WriteFile()
|
|||
{
|
||||
aiFace* face = &(mesh->mFaces[j]);
|
||||
|
||||
if (face->mNumIndices != 3) continue;
|
||||
const int numIndices = face->mNumIndices;
|
||||
if (numIndices < 3) continue;
|
||||
|
||||
aiVector3D* v1 = &(mesh->mVertices[face->mIndices[0]]);
|
||||
aiVector3D* v2 = &(mesh->mVertices[face->mIndices[1]]);
|
||||
aiVector3D* v3 = &(mesh->mVertices[face->mIndices[2]]);
|
||||
aiVector3D dv12 = *v2 - *v1;
|
||||
aiVector3D dv23 = *v3 - *v2;
|
||||
aiVector3D dv31 = *v1 - *v3;
|
||||
aiVector3D dv13 = *v3 - *v1;
|
||||
dv12.Normalize();
|
||||
dv23.Normalize();
|
||||
dv31.Normalize();
|
||||
dv13.Normalize();
|
||||
std::vector<int> pidArray(numIndices, -1); // vertex id
|
||||
std::vector<aiVector3D> dvArray(numIndices); // edge dir
|
||||
for (int k = 0; k < numIndices; ++k)
|
||||
{
|
||||
aiVector3D *v1 = &(mesh->mVertices[face->mIndices[k]]);
|
||||
pidArray[k] = uniqueVerts.find(v1)->second;
|
||||
|
||||
aiVector3D dvY = dv12;
|
||||
aiVector3D dvX = dvY ^ dv13;
|
||||
aiVector3D *v2 = nullptr;
|
||||
if (k + 1 == numIndices)
|
||||
v2 = &(mesh->mVertices[face->mIndices[0]]);
|
||||
else
|
||||
v2 = &(mesh->mVertices[face->mIndices[k + 1]]);
|
||||
dvArray[k] = *v2 - *v1;
|
||||
dvArray[k].Normalize();
|
||||
}
|
||||
|
||||
aiVector3D dvY = dvArray[1];
|
||||
aiVector3D dvX = dvY ^ dvArray[0];
|
||||
dvX.Normalize();
|
||||
|
||||
int pid1 = uniqueVerts.find(v1)->second;
|
||||
int pid2 = uniqueVerts.find(v2)->second;
|
||||
int pid3 = uniqueVerts.find(v3)->second;
|
||||
|
||||
// mean vertex color for the face if available
|
||||
if (mesh->HasVertexColors(0))
|
||||
{
|
||||
|
@ -339,35 +344,62 @@ void StepExporter::WriteFile()
|
|||
|
||||
/* 2 directions of the plane */
|
||||
mOutput << "#" << sid+9 << "=PLANE('',#" << sid+10 << ")" << endstr;
|
||||
mOutput << "#" << sid+10 << "=AXIS2_PLACEMENT_3D('',#" << pid1 << ", #" << sid+11 << ",#" << sid+12 << ")" << endstr;
|
||||
mOutput << "#" << sid+10 << "=AXIS2_PLACEMENT_3D('',#" << pidArray[0] << ",#" << sid+11 << ",#" << sid+12 << ")" << endstr;
|
||||
|
||||
mOutput << "#" << sid + 11 << "=DIRECTION('',(" << dvX.x << "," << dvX.y << "," << dvX.z << "))" << endstr;
|
||||
mOutput << "#" << sid + 12 << "=DIRECTION('',(" << dvY.x << "," << dvY.y << "," << dvY.z << "))" << endstr;
|
||||
|
||||
mOutput << "#" << sid+13 << "=FACE_BOUND('',#" << sid+14 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+14 << "=EDGE_LOOP('',(#" << sid+15 << ",#" << sid+16 << ",#" << sid+17 << "))" << endstr;
|
||||
mOutput << "#" << sid+14 << "=EDGE_LOOP('',(";
|
||||
int edgeLoopStart = sid + 15;
|
||||
for (int k = 0; k < numIndices; ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
mOutput << "#";
|
||||
else
|
||||
mOutput << ",#";
|
||||
mOutput << edgeLoopStart + k;
|
||||
}
|
||||
mOutput << "))" << endstr;
|
||||
|
||||
/* edge loop */
|
||||
mOutput << "#" << sid+15 << "=ORIENTED_EDGE('',*,*,#" << sid+18 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+16 << "=ORIENTED_EDGE('',*,*,#" << sid+19 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+17 << "=ORIENTED_EDGE('',*,*,#" << sid+20 << ",.T.)" << endstr;
|
||||
int orientedEdgesStart = edgeLoopStart + numIndices;
|
||||
for (int k=0; k < numIndices; k++)
|
||||
{
|
||||
mOutput << "#" << edgeLoopStart+k << "=ORIENTED_EDGE('',*,*,#" << orientedEdgesStart + k << ",.T.)" << endstr;
|
||||
}
|
||||
|
||||
/* oriented edges */
|
||||
mOutput << "#" << sid+18 << "=EDGE_CURVE('',#" << pid1+1 << ",#" << pid2+1 << ",#" << sid+21 << ",.F.)" << endstr;
|
||||
mOutput << "#" << sid+19 << "=EDGE_CURVE('',#" << pid2+1 << ",#" << pid3+1 << ",#" << sid+22 << ",.T.)" << endstr;
|
||||
mOutput << "#" << sid+20 << "=EDGE_CURVE('',#" << pid3+1 << ",#" << pid1+1 << ",#" << sid+23 << ",.T.)" << endstr;
|
||||
int lineStart = orientedEdgesStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[k+1]+1 << ",#" << lineStart+k << ",.F.)" << endstr;
|
||||
else if (k+1 == numIndices)
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[0]+1 << ",#" << lineStart+k << ",.T.)" << endstr;
|
||||
else
|
||||
mOutput << "#" << orientedEdgesStart+k << "=EDGE_CURVE('',#" << pidArray[k]+1 << ",#" << pidArray[k+1]+1 << ",#" << lineStart+k << ",.T.)" << endstr;
|
||||
}
|
||||
|
||||
/* 3 lines and 3 vectors for the lines for the 3 edge curves */
|
||||
mOutput << "#" << sid+21 << "=LINE('',#" << pid1 << ",#" << sid+24 << ")" << endstr;
|
||||
mOutput << "#" << sid+22 << "=LINE('',#" << pid2 << ",#" << sid+25 << ")" << endstr;
|
||||
mOutput << "#" << sid+23 << "=LINE('',#" << pid3 << ",#" << sid+26 << ")" << endstr;
|
||||
mOutput << "#" << sid+24 << "=VECTOR('',#" << sid+27 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+25 << "=VECTOR('',#" << sid+28 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+26 << "=VECTOR('',#" << sid+29 << ",1.0)" << endstr;
|
||||
mOutput << "#" << sid+27 << "=DIRECTION('',(" << dv12.x << "," << dv12.y << "," << dv12.z << "))" << endstr;
|
||||
mOutput << "#" << sid+28 << "=DIRECTION('',(" << dv23.x << "," << dv23.y << "," << dv23.z << "))" << endstr;
|
||||
mOutput << "#" << sid+29 << "=DIRECTION('',(" << dv31.x << "," << dv31.y << "," << dv31.z << "))" << endstr;
|
||||
ind += faceEntryLen; // increase counter
|
||||
/* n lines and n vectors for the lines for the n edge curves */
|
||||
int vectorStart = lineStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
mOutput << "#" << lineStart+k << "=LINE('',#" << pidArray[k] << ",#" << vectorStart+k << ")" << endstr;
|
||||
}
|
||||
|
||||
int directionStart = vectorStart + numIndices;
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
mOutput << "#" << vectorStart+k << "=VECTOR('',#" << directionStart+k << ",1.0)" << endstr;
|
||||
}
|
||||
|
||||
for (int k=0; k < numIndices; ++k)
|
||||
{
|
||||
const aiVector3D &dv = dvArray[k];
|
||||
mOutput << "#" << directionStart + k << "=DIRECTION('',(" << dv.x << "," << dv.y << "," << dv.z << "))" << endstr;
|
||||
}
|
||||
ind += 15 + 5*numIndices; // increase counter
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -667,9 +667,7 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, std::vector<XFile::Materi
|
|||
|
||||
// convert to lower case for easier comparison
|
||||
for ( unsigned int c = 0; c < sz.length(); ++c ) {
|
||||
if ( isalpha( (unsigned char) sz[ c ] ) ) {
|
||||
sz[ c ] = (char) tolower( (unsigned char) sz[ c ] );
|
||||
}
|
||||
sz[ c ] = (char) tolower( (unsigned char) sz[ c ] );
|
||||
}
|
||||
|
||||
// Place texture filename property under the corresponding name
|
||||
|
|
|
@ -196,7 +196,7 @@ inline std::string getCurrentAssetDir(const std::string &pFile) {
|
|||
std::string path = pFile;
|
||||
int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
|
||||
if (pos == int(std::string::npos)) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return pFile.substr(0, pos + 1);
|
||||
|
|
|
@ -526,6 +526,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
|||
|
||||
#if defined(__has_warning)
|
||||
#if __has_warning("-Wunused-but-set-variable")
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1522,7 +1522,7 @@ inline bool GetAttribTargetVector(Mesh::Primitive &p, const int targetIndex, con
|
|||
|
||||
inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
|
||||
Value *curName = FindMember(pJSON_Object, "name");
|
||||
if (nullptr != curName) {
|
||||
if (nullptr != curName && curName->IsString()) {
|
||||
name = curName->GetString();
|
||||
}
|
||||
|
||||
|
|
|
@ -992,8 +992,8 @@ void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
|
|||
metadata->Add(extension.name.c_str(), extension.mBoolValue.value);
|
||||
} else if (extension.mValues.isPresent) {
|
||||
aiMetadata val;
|
||||
for (size_t i = 0; i < extension.mValues.value.size(); ++i) {
|
||||
ParseExtensions(&val, extension.mValues.value[i]);
|
||||
for (auto const & subExtension : extension.mValues.value) {
|
||||
ParseExtensions(&val, subExtension);
|
||||
}
|
||||
metadata->Add(extension.name.c_str(), val);
|
||||
}
|
||||
|
@ -1001,8 +1001,8 @@ void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
|
|||
|
||||
void ParseExtras(aiMetadata *metadata, const CustomExtension &extension) {
|
||||
if (extension.mValues.isPresent) {
|
||||
for (size_t i = 0; i < extension.mValues.value.size(); ++i) {
|
||||
ParseExtensions(metadata, extension.mValues.value[i]);
|
||||
for (auto const & subExtension : extension.mValues.value) {
|
||||
ParseExtensions(metadata, subExtension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1336,6 +1336,12 @@ std::unordered_map<unsigned int, AnimationSamplers> GatherSamplers(Animation &an
|
|||
continue;
|
||||
}
|
||||
|
||||
auto& animsampler = anim.samplers[channel.sampler];
|
||||
if (animsampler.input->count > animsampler.output->count) {
|
||||
ASSIMP_LOG_WARN("Animation ", anim.name, ": Number of keyframes in sampler input ", animsampler.input->count, " exceeds number of keyframes in sampler output ", animsampler.output->count);
|
||||
continue;
|
||||
}
|
||||
|
||||
const unsigned int node_index = channel.target.node.GetIndex();
|
||||
|
||||
AnimationSamplers &sampler = samplers[node_index];
|
||||
|
|
|
@ -72,12 +72,25 @@ namespace Assimp {
|
|||
// underlying structure for aiPropertyStore
|
||||
typedef BatchLoader::PropertyMap PropertyMap;
|
||||
|
||||
#if defined(__has_warning)
|
||||
#if __has_warning("-Wordered-compare-function-pointers")
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wordered-compare-function-pointers"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Stores the LogStream objects for all active C log streams */
|
||||
struct mpred {
|
||||
bool operator()(const aiLogStream &s0, const aiLogStream &s1) const {
|
||||
return s0.callback < s1.callback && s0.user < s1.user;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__has_warning)
|
||||
#if __has_warning("-Wordered-compare-function-pointers")
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
typedef std::map<aiLogStream, Assimp::LogStream *, mpred> LogStreamMap;
|
||||
|
||||
/** Stores the LogStream objects allocated by #aiGetPredefinedLogStream */
|
||||
|
|
|
@ -59,13 +59,16 @@ void CommentRemover::RemoveLineComments(const char* szComment,
|
|||
ai_assert(nullptr != szBuffer);
|
||||
ai_assert(*szComment);
|
||||
|
||||
const size_t len = strlen(szComment);
|
||||
size_t len = strlen(szComment);
|
||||
const size_t lenBuffer = strlen(szBuffer);
|
||||
if (len > lenBuffer) {
|
||||
len = lenBuffer;
|
||||
}
|
||||
while (*szBuffer) {
|
||||
|
||||
// skip over quotes
|
||||
if (*szBuffer == '\"' || *szBuffer == '\'')
|
||||
while (*szBuffer++ && *szBuffer != '\"' && *szBuffer != '\'');
|
||||
|
||||
if (!strncmp(szBuffer,szComment,len)) {
|
||||
while (!IsLineEnd(*szBuffer))
|
||||
*szBuffer++ = chReplacement;
|
||||
|
|
|
@ -134,10 +134,9 @@ bool OpenDDLExport::writeToStream(const std::string &statement) {
|
|||
}
|
||||
|
||||
bool OpenDDLExport::writeNode(DDLNode *node, std::string &statement) {
|
||||
bool success(true);
|
||||
writeNodeHeader(node, statement);
|
||||
if (node->hasProperties()) {
|
||||
success |= writeProperties(node, statement);
|
||||
writeProperties(node, statement);
|
||||
}
|
||||
writeLineEnd(statement);
|
||||
|
||||
|
|
|
@ -132,6 +132,24 @@ OpenDDLParser::~OpenDDLParser() {
|
|||
clear();
|
||||
}
|
||||
|
||||
void OpenDDLParser::logToStream(FILE *f, LogSeverity severity, const std::string &message) {
|
||||
if (f) {
|
||||
const char *tag = "none";
|
||||
switch (severity) {
|
||||
case ddl_debug_msg: tag = "debug"; break;
|
||||
case ddl_info_msg: tag = "info"; break;
|
||||
case ddl_warn_msg: tag = "warn"; break;
|
||||
case ddl_error_msg: tag = "error"; break;
|
||||
}
|
||||
fprintf(f, "OpenDDLParser: (%5s) %s\n", tag, message.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
OpenDDLParser::logCallback OpenDDLParser::StdLogCallback (FILE *destination) {
|
||||
using namespace std::placeholders;
|
||||
return std::bind(logToStream, destination ? destination : stderr, _1, _2);
|
||||
}
|
||||
|
||||
void OpenDDLParser::setLogCallback(logCallback callback) {
|
||||
// install user-specific log callback; null = no log callback
|
||||
m_logCallback = callback;
|
||||
|
@ -171,12 +189,8 @@ size_t OpenDDLParser::getBufferSize() const {
|
|||
|
||||
void OpenDDLParser::clear() {
|
||||
m_buffer.resize(0);
|
||||
if (nullptr != m_context) {
|
||||
delete m_context;
|
||||
m_context = nullptr;
|
||||
}
|
||||
|
||||
// DDLNode::releaseNodes();
|
||||
delete m_context;
|
||||
m_context = nullptr;
|
||||
}
|
||||
|
||||
bool OpenDDLParser::validate() {
|
||||
|
@ -506,7 +520,9 @@ char *OpenDDLParser::parseName(char *in, char *end, Name **name) {
|
|||
in = parseIdentifier(in, end, &id);
|
||||
if (id) {
|
||||
currentName = new Name(ntype, id);
|
||||
*name = currentName;
|
||||
if (currentName) {
|
||||
*name = currentName;
|
||||
}
|
||||
}
|
||||
|
||||
return in;
|
||||
|
|
|
@ -113,13 +113,14 @@ Value::~Value() {
|
|||
if (m_data != nullptr) {
|
||||
if (m_type == ValueType::ddl_ref) {
|
||||
Reference *tmp = (Reference *)m_data;
|
||||
if (tmp != nullptr)
|
||||
if (tmp != nullptr) {
|
||||
delete tmp;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
delete[] m_data;
|
||||
}
|
||||
}
|
||||
if (m_next != nullptr)
|
||||
delete m_next;
|
||||
delete m_next;
|
||||
}
|
||||
|
||||
void Value::setBool(bool value) {
|
||||
|
|
|
@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
BEGIN_ODDLPARSER_NS
|
||||
|
||||
|
@ -97,8 +98,8 @@ DLL_ODDLPARSER_EXPORT const char *getTypeToken(Value::ValueType type);
|
|||
//-------------------------------------------------------------------------------------------------
|
||||
class DLL_ODDLPARSER_EXPORT OpenDDLParser {
|
||||
public:
|
||||
/// @brief The log callback function pointer.
|
||||
typedef void (*logCallback)(LogSeverity severity, const std::string &msg);
|
||||
/// @brief The log callback function.
|
||||
typedef std::function<void (LogSeverity severity, const std::string &msg)> logCallback;
|
||||
|
||||
public:
|
||||
/// @brief The default class constructor.
|
||||
|
@ -120,6 +121,11 @@ public:
|
|||
/// @return The current log callback.
|
||||
logCallback getLogCallback() const;
|
||||
|
||||
/// @brief A default log callback that writes to a FILE.
|
||||
/// @param destination [in] Output stream. NULL will use stderr.
|
||||
/// @return A callback that you can pass to setLogCallback.
|
||||
static logCallback StdLogCallback(FILE *destination = nullptr);
|
||||
|
||||
/// @brief Assigns a new buffer to parse.
|
||||
/// @param buffer [in] The buffer
|
||||
/// @param len [in] Size of the buffer
|
||||
|
@ -192,6 +198,9 @@ private:
|
|||
typedef std::vector<DDLNode *> DDLNodeStack;
|
||||
DDLNodeStack m_stack;
|
||||
Context *m_context;
|
||||
|
||||
/// @brief Callback for StdLogCallback(). Not meant to be called directly.
|
||||
static void logToStream (FILE *, LogSeverity, const std::string &);
|
||||
};
|
||||
|
||||
END_ODDLPARSER_NS
|
||||
|
|
|
@ -99,8 +99,8 @@ public:
|
|||
virtual ~Logger();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message*/
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void debug(const char* message);
|
||||
|
||||
template<typename... T>
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a debug message
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void verboseDebug(const char* message);
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes an error message
|
||||
* @param message Info message*/
|
||||
* @param message Error message*/
|
||||
void error(const char* message);
|
||||
|
||||
template<typename... T>
|
||||
|
|
|
@ -194,7 +194,7 @@ uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_ino
|
|||
|
||||
if ( *in < '0' || *in > '9' ) {
|
||||
// The string is known to be bad, so don't risk printing the whole thing.
|
||||
throw ExceptionType("The string \"", ai_str_toprintable(in, 30), "\" cannot be converted into a value." );
|
||||
throw ExceptionType("The string \"", ai_str_toprintable(in, (int)strlen(in)), "\" cannot be converted into a value." );
|
||||
}
|
||||
|
||||
for ( ;; ) {
|
||||
|
@ -294,7 +294,7 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
|
|||
if (!(c[0] >= '0' && c[0] <= '9') &&
|
||||
!((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9')) {
|
||||
// The string is known to be bad, so don't risk printing the whole thing.
|
||||
throw ExceptionType("Cannot parse string \"", ai_str_toprintable(c, 30),
|
||||
throw ExceptionType("Cannot parse string \"", ai_str_toprintable(c, (int)strlen(c)),
|
||||
"\" as a real number: does not start with digit "
|
||||
"or decimal point followed by digit.");
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
explicit aiQuaterniont( const aiMatrix3x3t<TReal>& pRotMatrix);
|
||||
|
||||
/** Construct from euler angles */
|
||||
aiQuaterniont( TReal rotx, TReal roty, TReal rotz);
|
||||
aiQuaterniont( TReal roty, TReal rotz, TReal rotx);
|
||||
|
||||
/** Construct from an axis-angle pair */
|
||||
aiQuaterniont( aiVector3t<TReal> axis, TReal angle);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#endif // _MSC_VER
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "contrib/stb_image/stb_image.h"
|
||||
#include "contrib/stb/stb_image.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default: 4100) // Enable warning 'unreferenced formal parameter'
|
||||
|
|
|
@ -615,12 +615,12 @@ TEST_F(utglTF2ImportExport, texcoords) {
|
|||
aiTextureMapMode modes[2];
|
||||
EXPECT_EQ(aiReturn_SUCCESS, material->GetTexture(AI_MATKEY_BASE_COLOR_TEXTURE, &path, nullptr, &uvIndex, nullptr, nullptr, modes));
|
||||
EXPECT_STREQ(path.C_Str(), "texture.png");
|
||||
EXPECT_EQ(uvIndex, 0);
|
||||
EXPECT_EQ(uvIndex, 0u);
|
||||
|
||||
uvIndex = 255;
|
||||
EXPECT_EQ(aiReturn_SUCCESS, material->GetTexture(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE, &path, nullptr, &uvIndex, nullptr, nullptr, modes));
|
||||
EXPECT_STREQ(path.C_Str(), "texture.png");
|
||||
EXPECT_EQ(uvIndex, 1);
|
||||
EXPECT_EQ(uvIndex, 1u);
|
||||
}
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
@ -646,12 +646,12 @@ TEST_F(utglTF2ImportExport, texcoords_export) {
|
|||
aiTextureMapMode modes[2];
|
||||
EXPECT_EQ(aiReturn_SUCCESS, material->GetTexture(AI_MATKEY_BASE_COLOR_TEXTURE, &path, nullptr, &uvIndex, nullptr, nullptr, modes));
|
||||
EXPECT_STREQ(path.C_Str(), "texture.png");
|
||||
EXPECT_EQ(uvIndex, 0);
|
||||
EXPECT_EQ(uvIndex, 0u);
|
||||
|
||||
uvIndex = 255;
|
||||
EXPECT_EQ(aiReturn_SUCCESS, material->GetTexture(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE, &path, nullptr, &uvIndex, nullptr, nullptr, modes));
|
||||
EXPECT_STREQ(path.C_Str(), "texture.png");
|
||||
EXPECT_EQ(uvIndex, 1);
|
||||
EXPECT_EQ(uvIndex, 1u);
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
@ -748,7 +748,8 @@ TEST_F(utglTF2ImportExport, import_dracoEncoded) {
|
|||
|
||||
TEST_F(utglTF2ImportExport, wrongTypes) {
|
||||
// Deliberately broken version of the BoxTextured.gltf asset.
|
||||
std::vector<std::tuple<std::string, std::string, std::string, std::string>> wrongTypes = {
|
||||
using tup_T = std::tuple<std::string, std::string, std::string, std::string>;
|
||||
std::vector<tup_T> wrongTypes = {
|
||||
{ "/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]" },
|
||||
{ "/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]" },
|
||||
{ "/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]" },
|
||||
|
|
Loading…
Reference in New Issue