Merge branch 'master' into fix-3ds-matrix
This commit is contained in:
@@ -212,7 +212,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
||||
mat.AddProperty(&tex, AI_MATKEY_GLOBAL_BACKGROUND_IMAGE);
|
||||
|
||||
// Be sure this is only done for the first material
|
||||
mBackgroundImage = std::string("");
|
||||
mBackgroundImage = std::string();
|
||||
}
|
||||
|
||||
// At first add the base ambient color of the scene to the material
|
||||
|
||||
@@ -164,7 +164,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
mRootNode->mHierarchyIndex = -1;
|
||||
mRootNode->mParent = nullptr;
|
||||
mMasterScale = 1.0f;
|
||||
mBackgroundImage = "";
|
||||
mBackgroundImage = std::string();
|
||||
bHasBG = false;
|
||||
bIsPrj = false;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ bool D3MFOpcPackage::validate() {
|
||||
std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
|
||||
XmlParser xmlParser;
|
||||
if (!xmlParser.parse(stream)) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
OpcPackageRelationshipReader reader(xmlParser);
|
||||
|
||||
@@ -123,9 +123,9 @@ public:
|
||||
struct Object {
|
||||
Object() :
|
||||
type(World),
|
||||
name(""),
|
||||
name(),
|
||||
children(),
|
||||
texture(""),
|
||||
texture(),
|
||||
texRepeat(1.f, 1.f),
|
||||
texOffset(0.0f, 0.0f),
|
||||
rotation(),
|
||||
|
||||
@@ -685,7 +685,7 @@ void Parser::ParseLV3MapBlock(Texture &map) {
|
||||
// Files with 'None' as map name are produced by
|
||||
// an Maja to ASE exporter which name I forgot ..
|
||||
ASSIMP_LOG_WARN("ASE: Skipping invalid map entry");
|
||||
map.mMapName = "";
|
||||
map.mMapName = std::string();
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@@ -88,7 +88,7 @@ using namespace Assimp::Blender;
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
static const aiImporterDesc blenderDesc = {
|
||||
"Blender 3D Importer \nhttp://www.blender3d.org",
|
||||
"Blender 3D Importer (http://www.blender3d.org)",
|
||||
"",
|
||||
"",
|
||||
"No animation support yet",
|
||||
|
||||
@@ -1241,7 +1241,7 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
|
||||
continue;
|
||||
}
|
||||
entry.mTargetId = entry.mTransformId;
|
||||
entry.mTransformId = "";
|
||||
entry.mTransformId = std::string();
|
||||
}
|
||||
|
||||
entry.mChannel = &(*cit);
|
||||
|
||||
@@ -330,7 +330,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
|
||||
}
|
||||
|
||||
const Element* Name = source["Name"];
|
||||
m_uvNames[index] = "";
|
||||
m_uvNames[index] = std::string();
|
||||
if(Name) {
|
||||
m_uvNames[index] = ParseTokenAsString(GetRequiredToken(*Name,0));
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
||||
|
||||
if (t.Type() != TokenType_DATA) {
|
||||
err_out = "expected TOK_DATA token";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
if(t.IsBinary())
|
||||
@@ -470,7 +470,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
||||
const char* data = t.begin();
|
||||
if (data[0] != 'S') {
|
||||
err_out = "failed to parse S(tring), unexpected data type (binary)";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// read string length
|
||||
@@ -484,13 +484,13 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
||||
const size_t length = static_cast<size_t>(t.end() - t.begin());
|
||||
if(length < 2) {
|
||||
err_out = "token is too short to hold a string";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const char* s = t.begin(), *e = t.end() - 1;
|
||||
if (*s != '\"' || *e != '\"') {
|
||||
err_out = "expected double quoted string";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return std::string(s+1,length-2);
|
||||
|
||||
@@ -155,7 +155,7 @@ std::string PeekPropertyName(const Element& element)
|
||||
ai_assert(element.KeyToken().StringContents() == "P");
|
||||
const TokenList& tok = element.Tokens();
|
||||
if(tok.size() < 4) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return ParseTokenAsString(*tok[0]);
|
||||
|
||||
@@ -567,7 +567,7 @@ typedef std::map<std::string, std::string> Metadata;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcProperty>, 1, 0> &set, ConversionData &conv, Metadata &properties,
|
||||
const std::string &prefix = "",
|
||||
const std::string &prefix = std::string(),
|
||||
unsigned int nest = 0) {
|
||||
for (const Schema_2x3::IfcProperty &property : set) {
|
||||
const std::string &key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
||||
@@ -618,7 +618,7 @@ void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcPr
|
||||
ProcessMetadata(complexProp->HasProperties, conv, properties, key, nest + 1);
|
||||
}
|
||||
} else {
|
||||
properties[key] = "";
|
||||
properties[key] = std::string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open IRR file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open IRR file " + pFile);
|
||||
}
|
||||
|
||||
// Construct the irrXML parser
|
||||
|
||||
@@ -135,7 +135,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == NULL)
|
||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile);
|
||||
|
||||
// Construct the irrXML parser
|
||||
XmlParser parser;
|
||||
|
||||
@@ -502,7 +502,7 @@ struct Surface {
|
||||
Surface() :
|
||||
mColor(0.78431f, 0.78431f, 0.78431f), bDoubleSided(false), mDiffuseValue(1.f), mSpecularValue(0.f), mTransparency(0.f), mGlossiness(0.4f), mLuminosity(0.f), mColorHighlights(0.f), mMaximumSmoothAngle(0.f) // 0 == not specified, no smoothing
|
||||
,
|
||||
mVCMap(""),
|
||||
mVCMap(),
|
||||
mVCMapType(AI_LWO_RGBA),
|
||||
mIOR(1.f) // vakuum
|
||||
,
|
||||
|
||||
@@ -88,7 +88,7 @@ struct NodeDesc {
|
||||
id(),
|
||||
number(0),
|
||||
parent(0),
|
||||
name(""),
|
||||
name(),
|
||||
isPivotSet(false),
|
||||
lightColor(1.f, 1.f, 1.f),
|
||||
lightIntensity(1.f),
|
||||
|
||||
@@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_MDL_NORMALTABLE_H_INC
|
||||
|
||||
|
||||
float g_avNormals[162][3] = {
|
||||
const float g_avNormals[162][3] = {
|
||||
{ -0.525731f, 0.000000f, 0.850651f },
|
||||
{ -0.442863f, 0.238856f, 0.864188f },
|
||||
{ -0.295242f, 0.000000f, 0.955423f },
|
||||
|
||||
@@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define MDC_NORMAL_TABLE_INCLUDED
|
||||
|
||||
/* mdc decoding normal table */
|
||||
float mdcNormals[ 256 ][ 3 ] =
|
||||
const float mdcNormals[ 256 ][ 3 ] =
|
||||
{
|
||||
{ 1.000000f, 0.000000f, 0.000000f },
|
||||
{ 0.980785f, 0.195090f, 0.000000f },
|
||||
|
||||
@@ -95,7 +95,7 @@ void UniqueNameGenerator::make_unique(std::vector<std::string> &names) {
|
||||
auto generate_unique_name = [&](const std::string &base_name) -> std::string {
|
||||
auto *duplicate_info = &names_to_duplicates[base_name];
|
||||
|
||||
std::string new_name = "";
|
||||
std::string new_name;
|
||||
|
||||
bool found_identical_name;
|
||||
bool tried_with_base_name_only = false;
|
||||
|
||||
@@ -75,7 +75,7 @@ using namespace std;
|
||||
// Default constructor
|
||||
MMDImporter::MMDImporter() :
|
||||
m_Buffer(),
|
||||
m_strAbsPath("") {
|
||||
m_strAbsPath() {
|
||||
DefaultIOSystem io;
|
||||
m_strAbsPath = io.getOsSeparator();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace pmx
|
||||
std::vector<char> buffer;
|
||||
if (size == 0)
|
||||
{
|
||||
return std::string("");
|
||||
return std::string();
|
||||
}
|
||||
buffer.reserve(size);
|
||||
stream->read((char*) buffer.data(), size);
|
||||
|
||||
@@ -206,7 +206,7 @@ USE_ODDLPARSER_NS
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static void propId2StdString(Property *prop, std::string &name, std::string &key) {
|
||||
name = key = "";
|
||||
name = key = std::string();
|
||||
if (nullptr == prop) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ struct MetricInfo {
|
||||
int m_intValue;
|
||||
|
||||
MetricInfo()
|
||||
: m_stringValue( "" )
|
||||
: m_stringValue( )
|
||||
, m_floatValue( 0.0f )
|
||||
, m_intValue( -1 ) {
|
||||
// empty
|
||||
|
||||
@@ -178,7 +178,7 @@ struct Q3BSPModel {
|
||||
m_Textures(),
|
||||
m_Lightmaps(),
|
||||
m_EntityData(),
|
||||
m_ModelName( "" )
|
||||
m_ModelName()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ static void extractIds(const std::string &key, int &id1, int &id2) {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Local helper function to normalize filenames.
|
||||
static void normalizePathName(const std::string &rPath, std::string &normalizedPath) {
|
||||
normalizedPath = "";
|
||||
normalizedPath = std::string();
|
||||
if (rPath.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
|
||||
throw DeadlyImportError("Failed to open file ", rFile, ".");
|
||||
}
|
||||
|
||||
std::string archiveName(""), mapName("");
|
||||
std::string archiveName, mapName;
|
||||
separateMapName(rFile, archiveName, mapName);
|
||||
|
||||
if (mapName.empty()) {
|
||||
@@ -202,8 +202,8 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Separates the map name from the import name.
|
||||
void Q3BSPFileImporter::separateMapName(const std::string &importName, std::string &archiveName, std::string &mapName) {
|
||||
archiveName = "";
|
||||
mapName = "";
|
||||
archiveName = std::string();
|
||||
mapName = std::string();
|
||||
if (importName.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void Q3BSPFileImporter::separateMapName(const std::string &importName, std::stri
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns the first map in the map archive.
|
||||
bool Q3BSPFileImporter::findFirstMapInArchive(ZipArchiveIOSystem &bspArchive, std::string &mapName) {
|
||||
mapName = "";
|
||||
mapName = std::string();
|
||||
std::vector<std::string> fileList;
|
||||
bspArchive.getFileListExtension(fileList, "bsp");
|
||||
if (fileList.empty()) {
|
||||
@@ -440,7 +440,7 @@ void Q3BSPFileImporter::createMaterials(const Q3BSP::Q3BSPModel *pModel, aiScene
|
||||
if (-1 != textureId) {
|
||||
sQ3BSPTexture *pTexture = pModel->m_Textures[textureId];
|
||||
if (nullptr != pTexture) {
|
||||
std::string tmp("*"), texName("");
|
||||
std::string tmp("*"), texName;
|
||||
tmp += pTexture->strName;
|
||||
tmp += ".jpg";
|
||||
normalizePathName(tmp, texName);
|
||||
@@ -512,7 +512,7 @@ size_t Q3BSPFileImporter::countTriangles(const std::vector<Q3BSP::sQ3BSPFace *>
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Creates the faces-to-material map.
|
||||
void Q3BSPFileImporter::createMaterialMap(const Q3BSP::Q3BSPModel *pModel) {
|
||||
std::string key("");
|
||||
std::string key;
|
||||
std::vector<sQ3BSPFace *> *pCurFaceArray = nullptr;
|
||||
for (size_t idx = 0; idx < pModel->m_Faces.size(); idx++) {
|
||||
Q3BSP::sQ3BSPFace *pQ3BSPFace = pModel->m_Faces[idx];
|
||||
@@ -660,7 +660,7 @@ bool Q3BSPFileImporter::expandFile(ZipArchiveIOSystem *pArchive, const std::stri
|
||||
|
||||
if (rExtList.empty()) {
|
||||
rFile = rFilename;
|
||||
rExt = "";
|
||||
rExt = std::string();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ struct Mesh {
|
||||
|
||||
std::vector<Bone> mBones;
|
||||
|
||||
explicit Mesh(const std::string &pName = "") AI_NO_EXCEPT
|
||||
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
|
||||
: mName( pName )
|
||||
, mPositions()
|
||||
, mPosFaces()
|
||||
|
||||
@@ -142,7 +142,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
|
||||
// check whether we can read from the file
|
||||
if (stream.get() == NULL) {
|
||||
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile);
|
||||
}
|
||||
|
||||
// see if its compressed, if so uncompress it
|
||||
|
||||
@@ -1033,7 +1033,7 @@ namespace glTF
|
||||
|
||||
AssetMetadata()
|
||||
: premultipliedAlpha(false)
|
||||
, version("")
|
||||
, version()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1071,7 +1071,7 @@ struct AssetMetadata {
|
||||
void Read(Document &doc);
|
||||
|
||||
AssetMetadata() :
|
||||
version("") {}
|
||||
version() {}
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -162,6 +162,9 @@ inline static bool ReadValue(Value &val, T &out) {
|
||||
|
||||
template <class T>
|
||||
inline static bool ReadMember(Value &obj, const char *id, T &out) {
|
||||
if (!obj.IsObject()) {
|
||||
return false;
|
||||
}
|
||||
Value::MemberIterator it = obj.FindMember(id);
|
||||
if (it != obj.MemberEnd()) {
|
||||
return ReadHelper<T>::Read(it->value, out);
|
||||
@@ -176,6 +179,9 @@ inline static T MemberOrDefault(Value &obj, const char *id, T defaultValue) {
|
||||
}
|
||||
|
||||
inline Value *FindMember(Value &val, const char *id) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(id);
|
||||
return (it != val.MemberEnd()) ? &it->value : nullptr;
|
||||
}
|
||||
@@ -193,6 +199,9 @@ inline void throwUnexpectedTypeError(const char (&expectedTypeName)[N], const ch
|
||||
// Look-up functions with type checks. Context and extra context help the user identify the problem if there's an error.
|
||||
|
||||
inline Value *FindStringInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(memberId);
|
||||
if (it == val.MemberEnd()) {
|
||||
return nullptr;
|
||||
@@ -204,6 +213,9 @@ inline Value *FindStringInContext(Value &val, const char *memberId, const char*
|
||||
}
|
||||
|
||||
inline Value *FindNumberInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(memberId);
|
||||
if (it == val.MemberEnd()) {
|
||||
return nullptr;
|
||||
@@ -215,6 +227,9 @@ inline Value *FindNumberInContext(Value &val, const char *memberId, const char*
|
||||
}
|
||||
|
||||
inline Value *FindUIntInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(memberId);
|
||||
if (it == val.MemberEnd()) {
|
||||
return nullptr;
|
||||
@@ -226,6 +241,9 @@ inline Value *FindUIntInContext(Value &val, const char *memberId, const char* co
|
||||
}
|
||||
|
||||
inline Value *FindArrayInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(memberId);
|
||||
if (it == val.MemberEnd()) {
|
||||
return nullptr;
|
||||
@@ -237,6 +255,9 @@ inline Value *FindArrayInContext(Value &val, const char *memberId, const char* c
|
||||
}
|
||||
|
||||
inline Value *FindObjectInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
|
||||
if (!val.IsObject()) {
|
||||
return nullptr;
|
||||
}
|
||||
Value::MemberIterator it = val.FindMember(memberId);
|
||||
if (it == val.MemberEnd()) {
|
||||
return nullptr;
|
||||
@@ -886,7 +907,7 @@ inline void Accessor::Read(Value &obj, Asset &r) {
|
||||
componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
|
||||
{
|
||||
const Value* countValue = FindUInt(obj, "count");
|
||||
if (!countValue || countValue->GetInt() < 1)
|
||||
if (!countValue || countValue->GetUint() < 1)
|
||||
{
|
||||
throw DeadlyImportError("A strictly positive count value is required, when reading ", id.c_str(), name.empty() ? "" : " (" + name + ")");
|
||||
}
|
||||
@@ -1105,7 +1126,9 @@ inline Accessor::Indexer::Indexer(Accessor &acc) :
|
||||
template <class T>
|
||||
T Accessor::Indexer::GetValue(int i) {
|
||||
ai_assert(data);
|
||||
ai_assert(i * stride < accessor.GetMaxByteSize());
|
||||
if (i * stride >= accessor.GetMaxByteSize()) {
|
||||
throw DeadlyImportError("GLTF: Invalid index ", i, ", count out of range for buffer with stride ", stride, " and size ", accessor.GetMaxByteSize(), ".");
|
||||
}
|
||||
// Ensure that the memcpy doesn't overwrite the local.
|
||||
const size_t sizeToCopy = std::min(elemSize, sizeof(T));
|
||||
T value = T();
|
||||
|
||||
@@ -1172,7 +1172,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &sampler
|
||||
|
||||
static const float kMillisecondsFromSeconds = 1000.f;
|
||||
|
||||
if (samplers.translation) {
|
||||
if (samplers.translation && samplers.translation->input && samplers.translation->output) {
|
||||
float *times = nullptr;
|
||||
samplers.translation->input->ExtractData(times);
|
||||
aiVector3D *values = nullptr;
|
||||
@@ -1196,7 +1196,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &sampler
|
||||
anim->mPositionKeys->mValue.z = node.translation.value[2];
|
||||
}
|
||||
|
||||
if (samplers.rotation) {
|
||||
if (samplers.rotation && samplers.rotation->input && samplers.rotation->output) {
|
||||
float *times = nullptr;
|
||||
samplers.rotation->input->ExtractData(times);
|
||||
aiQuaternion *values = nullptr;
|
||||
@@ -1224,7 +1224,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &sampler
|
||||
anim->mRotationKeys->mValue.w = node.rotation.value[3];
|
||||
}
|
||||
|
||||
if (samplers.scale) {
|
||||
if (samplers.scale && samplers.scale->input && samplers.scale->output) {
|
||||
float *times = nullptr;
|
||||
samplers.scale->input->ExtractData(times);
|
||||
aiVector3D *values = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user