Merge branch 'master' into kimkulling-documentationfixes
commit
a531e4f35b
|
@ -72,7 +72,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
|
||||||
unsigned int idx( NotSet );
|
unsigned int idx( NotSet );
|
||||||
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
|
for (unsigned int i = 0; i < mScene->mMaterials.size();++i)
|
||||||
{
|
{
|
||||||
std::string s = mScene->mMaterials[i].mName;
|
std::string &s = mScene->mMaterials[i].mName;
|
||||||
for ( std::string::iterator it = s.begin(); it != s.end(); ++it ) {
|
for ( std::string::iterator it = s.begin(); it != s.end(); ++it ) {
|
||||||
*it = static_cast< char >( ::tolower( *it ) );
|
*it = static_cast< char >( ::tolower( *it ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,10 +156,11 @@ size_t AMFImporter::PostprocessHelper_GetTextureID_Or_Create(const std::string&
|
||||||
TextureConverted_Index = 0;
|
TextureConverted_Index = 0;
|
||||||
for(const SPP_Texture& tex_convd: mTexture_Converted)
|
for(const SPP_Texture& tex_convd: mTexture_Converted)
|
||||||
{
|
{
|
||||||
if(tex_convd.ID == TextureConverted_ID)
|
if ( tex_convd.ID == TextureConverted_ID ) {
|
||||||
return TextureConverted_Index;
|
return TextureConverted_Index;
|
||||||
else
|
} else {
|
||||||
TextureConverted_Index++;
|
++TextureConverted_Index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -267,7 +267,9 @@ void Parser::Parse()
|
||||||
// at the file extension (ASE, ASK, ASC)
|
// at the file extension (ASE, ASK, ASC)
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
|
|
||||||
if (fmt)iFileFormat = fmt;
|
if ( fmt ) {
|
||||||
|
iFileFormat = fmt;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// main scene information
|
// main scene information
|
||||||
|
@ -427,28 +429,25 @@ void Parser::ParseLV1SoftSkinBlock()
|
||||||
// Reserve enough storage
|
// Reserve enough storage
|
||||||
vert.mBoneWeights.reserve(numWeights);
|
vert.mBoneWeights.reserve(numWeights);
|
||||||
|
|
||||||
for (unsigned int w = 0; w < numWeights;++w)
|
std::string bone;
|
||||||
{
|
for (unsigned int w = 0; w < numWeights;++w) {
|
||||||
std::string bone;
|
bone.clear();
|
||||||
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");
|
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");
|
||||||
|
|
||||||
// Find the bone in the mesh's list
|
// Find the bone in the mesh's list
|
||||||
std::pair<int,ai_real> me;
|
std::pair<int,ai_real> me;
|
||||||
me.first = -1;
|
me.first = -1;
|
||||||
|
|
||||||
for (unsigned int n = 0; n < curMesh->mBones.size();++n)
|
for (unsigned int n = 0; n < curMesh->mBones.size();++n) {
|
||||||
{
|
if (curMesh->mBones[n].mName == bone) {
|
||||||
if (curMesh->mBones[n].mName == bone)
|
|
||||||
{
|
|
||||||
me.first = n;
|
me.first = n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (-1 == me.first)
|
if (-1 == me.first) {
|
||||||
{
|
|
||||||
// We don't have this bone yet, so add it to the list
|
// We don't have this bone yet, so add it to the list
|
||||||
me.first = (int)curMesh->mBones.size();
|
me.first = static_cast<int>( curMesh->mBones.size() );
|
||||||
curMesh->mBones.push_back(ASE::Bone(bone));
|
curMesh->mBones.push_back( ASE::Bone( bone ) );
|
||||||
}
|
}
|
||||||
ParseLV4MeshFloat( me.second );
|
ParseLV4MeshFloat( me.second );
|
||||||
|
|
||||||
|
@ -745,6 +744,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
|
||||||
// empty the texture won't be used later.
|
// empty the texture won't be used later.
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
bool parsePath = true;
|
bool parsePath = true;
|
||||||
|
std::string temp;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if ('*' == *filePtr)
|
if ('*' == *filePtr)
|
||||||
|
@ -753,7 +753,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
|
||||||
// type of map
|
// type of map
|
||||||
if (TokenMatch(filePtr,"MAP_CLASS" ,9))
|
if (TokenMatch(filePtr,"MAP_CLASS" ,9))
|
||||||
{
|
{
|
||||||
std::string temp;
|
temp.clear();
|
||||||
if(!ParseString(temp,"*MAP_CLASS"))
|
if(!ParseString(temp,"*MAP_CLASS"))
|
||||||
SkipToNextToken();
|
SkipToNextToken();
|
||||||
if (temp != "Bitmap" && temp != "Normal Bump")
|
if (temp != "Bitmap" && temp != "Normal Bump")
|
||||||
|
|
|
@ -199,6 +199,7 @@ aiNode* BVHLoader::ReadNode()
|
||||||
Node& internNode = mNodes.back();
|
Node& internNode = mNodes.back();
|
||||||
|
|
||||||
// now read the node's contents
|
// now read the node's contents
|
||||||
|
std::string siteToken;
|
||||||
while( 1)
|
while( 1)
|
||||||
{
|
{
|
||||||
std::string token = GetNextToken();
|
std::string token = GetNextToken();
|
||||||
|
@ -218,7 +219,8 @@ aiNode* BVHLoader::ReadNode()
|
||||||
else if( token == "End")
|
else if( token == "End")
|
||||||
{
|
{
|
||||||
// The real symbol is "End Site". Second part comes in a separate token
|
// The real symbol is "End Site". Second part comes in a separate token
|
||||||
std::string siteToken = GetNextToken();
|
siteToken.clear();
|
||||||
|
siteToken = GetNextToken();
|
||||||
if( siteToken != "Site")
|
if( siteToken != "Site")
|
||||||
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );
|
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );
|
||||||
|
|
||||||
|
@ -262,21 +264,18 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
|
||||||
aiNode* node = new aiNode( "EndSite_" + pParentName);
|
aiNode* node = new aiNode( "EndSite_" + pParentName);
|
||||||
|
|
||||||
// now read the node's contents. Only possible entry is "OFFSET"
|
// now read the node's contents. Only possible entry is "OFFSET"
|
||||||
while( 1)
|
std::string token;
|
||||||
{
|
while( 1) {
|
||||||
std::string token = GetNextToken();
|
token.clear();
|
||||||
|
token = GetNextToken();
|
||||||
|
|
||||||
// end node's offset
|
// end node's offset
|
||||||
if( token == "OFFSET")
|
if( token == "OFFSET") {
|
||||||
{
|
|
||||||
ReadNodeOffset( node);
|
ReadNodeOffset( node);
|
||||||
}
|
} else if( token == "}") {
|
||||||
else if( token == "}")
|
|
||||||
{
|
|
||||||
// we're done with the end node
|
// we're done with the end node
|
||||||
break;
|
break;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
// everything else is a parse error
|
// everything else is a parse error
|
||||||
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
|
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
|
||||||
}
|
}
|
||||||
|
@ -296,8 +295,10 @@ void BVHLoader::ReadNodeOffset( aiNode* pNode)
|
||||||
offset.z = GetNextTokenAsFloat();
|
offset.z = GetNextTokenAsFloat();
|
||||||
|
|
||||||
// build a transformation matrix from it
|
// build a transformation matrix from it
|
||||||
pNode->mTransformation = aiMatrix4x4( 1.0f, 0.0f, 0.0f, offset.x, 0.0f, 1.0f, 0.0f, offset.y,
|
pNode->mTransformation = aiMatrix4x4( 1.0f, 0.0f, 0.0f, offset.x,
|
||||||
0.0f, 0.0f, 1.0f, offset.z, 0.0f, 0.0f, 0.0f, 1.0f);
|
0.0f, 1.0f, 0.0f, offset.y,
|
||||||
|
0.0f, 0.0f, 1.0f, offset.z,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -251,7 +251,8 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions) {
|
||||||
/* static */ bool BaseImporter::CheckMagicToken(IOSystem* pIOHandler, const std::string& pFile,
|
/* static */ bool BaseImporter::CheckMagicToken(IOSystem* pIOHandler, const std::string& pFile,
|
||||||
const void* _magic, unsigned int num, unsigned int offset, unsigned int size)
|
const void* _magic, unsigned int num, unsigned int offset, unsigned int size)
|
||||||
{
|
{
|
||||||
ai_assert(size <= 16 && _magic);
|
ai_assert( size <= 16 );
|
||||||
|
ai_assert( _magic );
|
||||||
|
|
||||||
if (!pIOHandler) {
|
if (!pIOHandler) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1270,6 +1270,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
mOutput << startstr << "<animation id=\"" + idstrEscaped + "\" name=\"" + animation_name_escaped + "\">" << endstr;
|
mOutput << startstr << "<animation id=\"" + idstrEscaped + "\" name=\"" + animation_name_escaped + "\">" << endstr;
|
||||||
PushTag();
|
PushTag();
|
||||||
|
|
||||||
|
std::string node_idstr;
|
||||||
for (size_t a = 0; a < anim->mNumChannels; ++a) {
|
for (size_t a = 0; a < anim->mNumChannels; ++a) {
|
||||||
const aiNodeAnim * nodeAnim = anim->mChannels[a];
|
const aiNodeAnim * nodeAnim = anim->mChannels[a];
|
||||||
|
|
||||||
|
@ -1277,7 +1278,9 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
if ( nodeAnim->mNumPositionKeys != nodeAnim->mNumScalingKeys || nodeAnim->mNumPositionKeys != nodeAnim->mNumRotationKeys ) continue;
|
if ( nodeAnim->mNumPositionKeys != nodeAnim->mNumScalingKeys || nodeAnim->mNumPositionKeys != nodeAnim->mNumRotationKeys ) continue;
|
||||||
|
|
||||||
{
|
{
|
||||||
const std::string node_idstr = nodeAnim->mNodeName.data + std::string("_matrix-input");
|
node_idstr.clear();
|
||||||
|
node_idstr += nodeAnim->mNodeName.data;
|
||||||
|
node_idstr += std::string( "_matrix-input" );
|
||||||
|
|
||||||
std::vector<ai_real> frames;
|
std::vector<ai_real> frames;
|
||||||
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
||||||
|
@ -1289,12 +1292,14 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const std::string node_idstr = nodeAnim->mNodeName.data + std::string("_matrix-output");
|
node_idstr.clear();
|
||||||
|
|
||||||
|
node_idstr += nodeAnim->mNodeName.data;
|
||||||
|
node_idstr += std::string("_matrix-output");
|
||||||
|
|
||||||
std::vector<ai_real> keyframes;
|
std::vector<ai_real> keyframes;
|
||||||
keyframes.reserve(nodeAnim->mNumPositionKeys * 16);
|
keyframes.reserve(nodeAnim->mNumPositionKeys * 16);
|
||||||
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
for( size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
|
||||||
|
|
||||||
aiVector3D Scaling = nodeAnim->mScalingKeys[i].mValue;
|
aiVector3D Scaling = nodeAnim->mScalingKeys[i].mValue;
|
||||||
aiMatrix4x4 ScalingM; // identity
|
aiMatrix4x4 ScalingM; // identity
|
||||||
ScalingM[0][0] = Scaling.x; ScalingM[1][1] = Scaling.y; ScalingM[2][2] = Scaling.z;
|
ScalingM[0][0] = Scaling.x; ScalingM[1][1] = Scaling.y; ScalingM[2][2] = Scaling.z;
|
||||||
|
@ -1361,7 +1366,6 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex)
|
||||||
PopTag();
|
PopTag();
|
||||||
mOutput << startstr << "</source>" << endstr;
|
mOutput << startstr << "</source>" << endstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t a = 0; a < anim->mNumChannels; ++a) {
|
for (size_t a = 0; a < anim->mNumChannels; ++a) {
|
||||||
|
|
|
@ -1121,6 +1121,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// now check all channels if they affect the current node
|
// now check all channels if they affect the current node
|
||||||
|
std::string targetID, subElement;
|
||||||
for( std::vector<Collada::AnimationChannel>::const_iterator cit = pSrcAnim->mChannels.begin();
|
for( std::vector<Collada::AnimationChannel>::const_iterator cit = pSrcAnim->mChannels.begin();
|
||||||
cit != pSrcAnim->mChannels.end(); ++cit)
|
cit != pSrcAnim->mChannels.end(); ++cit)
|
||||||
{
|
{
|
||||||
|
@ -1147,7 +1148,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
}
|
}
|
||||||
if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos)
|
if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos)
|
||||||
continue;
|
continue;
|
||||||
std::string targetID = srcChannel.mTarget.substr( 0, slashPos);
|
|
||||||
|
targetID.clear();
|
||||||
|
targetID = srcChannel.mTarget.substr( 0, slashPos);
|
||||||
if( targetID != srcNode->mID)
|
if( targetID != srcNode->mID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1160,7 +1163,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
|
|
||||||
entry.mTransformId = srcChannel.mTarget.substr( slashPos+1, dotPos - slashPos - 1);
|
entry.mTransformId = srcChannel.mTarget.substr( slashPos+1, dotPos - slashPos - 1);
|
||||||
|
|
||||||
std::string subElement = srcChannel.mTarget.substr( dotPos+1);
|
subElement.clear();
|
||||||
|
subElement = srcChannel.mTarget.substr( dotPos+1);
|
||||||
if( subElement == "ANGLE")
|
if( subElement == "ANGLE")
|
||||||
entry.mSubElement = 3; // last number in an Axis-Angle-Transform is the angle
|
entry.mSubElement = 3; // last number in an Axis-Angle-Transform is the angle
|
||||||
else if( subElement == "X")
|
else if( subElement == "X")
|
||||||
|
@ -1181,7 +1185,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
if (bracketPos != std::string::npos)
|
if (bracketPos != std::string::npos)
|
||||||
{
|
{
|
||||||
entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1);
|
entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1);
|
||||||
std::string subElement = srcChannel.mTarget.substr(bracketPos);
|
subElement.clear();
|
||||||
|
subElement = srcChannel.mTarget.substr(bracketPos);
|
||||||
|
|
||||||
if (subElement == "(0)(0)")
|
if (subElement == "(0)(0)")
|
||||||
entry.mSubElement = 0;
|
entry.mSubElement = 0;
|
||||||
|
@ -1215,7 +1220,6 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
|
||||||
entry.mSubElement = 14;
|
entry.mSubElement = 14;
|
||||||
else if (subElement == "(3)(3)")
|
else if (subElement == "(3)(3)")
|
||||||
entry.mSubElement = 15;
|
entry.mSubElement = 15;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine which transform step is affected by this channel
|
// determine which transform step is affected by this channel
|
||||||
|
|
|
@ -237,20 +237,20 @@ void D3MFExporter::writeMetaData() {
|
||||||
|
|
||||||
void D3MFExporter::writeBaseMaterials() {
|
void D3MFExporter::writeBaseMaterials() {
|
||||||
mModelOutput << "<basematerials id=\"1\">\n";
|
mModelOutput << "<basematerials id=\"1\">\n";
|
||||||
|
std::string strName, hexDiffuseColor , tmp;
|
||||||
for ( size_t i = 0; i < mScene->mNumMaterials; ++i ) {
|
for ( size_t i = 0; i < mScene->mNumMaterials; ++i ) {
|
||||||
aiMaterial *mat = mScene->mMaterials[ i ];
|
aiMaterial *mat = mScene->mMaterials[ i ];
|
||||||
std::string strName;
|
|
||||||
aiString name;
|
aiString name;
|
||||||
if ( mat->Get( AI_MATKEY_NAME, name ) != aiReturn_SUCCESS ) {
|
if ( mat->Get( AI_MATKEY_NAME, name ) != aiReturn_SUCCESS ) {
|
||||||
strName = "basemat_" + to_string( i );
|
strName = "basemat_" + to_string( i );
|
||||||
} else {
|
} else {
|
||||||
strName = name.C_Str();
|
strName = name.C_Str();
|
||||||
}
|
}
|
||||||
std::string hexDiffuseColor;
|
|
||||||
aiColor4D color;
|
aiColor4D color;
|
||||||
if ( mat->Get( AI_MATKEY_COLOR_DIFFUSE, color ) == aiReturn_SUCCESS ) {
|
if ( mat->Get( AI_MATKEY_COLOR_DIFFUSE, color ) == aiReturn_SUCCESS ) {
|
||||||
|
hexDiffuseColor.clear();
|
||||||
|
tmp.clear();
|
||||||
hexDiffuseColor = "#";
|
hexDiffuseColor = "#";
|
||||||
std::string tmp;
|
|
||||||
|
|
||||||
tmp = DecimalToHexa( color.r );
|
tmp = DecimalToHexa( color.r );
|
||||||
hexDiffuseColor += tmp;
|
hexDiffuseColor += tmp;
|
||||||
|
|
|
@ -94,8 +94,9 @@ public:
|
||||||
scene->mRootNode = new aiNode();
|
scene->mRootNode = new aiNode();
|
||||||
std::vector<aiNode*> children;
|
std::vector<aiNode*> children;
|
||||||
|
|
||||||
|
std::string nodeName;
|
||||||
while(ReadToEndElement(D3MF::XmlTag::model)) {
|
while(ReadToEndElement(D3MF::XmlTag::model)) {
|
||||||
const std::string nodeName( xmlReader->getNodeName() );
|
nodeName = xmlReader->getNodeName();
|
||||||
if( nodeName == D3MF::XmlTag::object) {
|
if( nodeName == D3MF::XmlTag::object) {
|
||||||
children.push_back(ReadObject(scene));
|
children.push_back(ReadObject(scene));
|
||||||
} else if( nodeName == D3MF::XmlTag::build) {
|
} else if( nodeName == D3MF::XmlTag::build) {
|
||||||
|
|
|
@ -288,8 +288,8 @@ bool D3MFZipArchive::Exists(const char* pFile) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rFile(pFile);
|
std::string filename(pFile);
|
||||||
std::map<std::string, ZipFile*>::const_iterator it = m_ArchiveMap.find(rFile);
|
std::map<std::string, ZipFile*>::const_iterator it = m_ArchiveMap.find(filename);
|
||||||
bool exist( false );
|
bool exist( false );
|
||||||
if(it != m_ArchiveMap.end()) {
|
if(it != m_ArchiveMap.end()) {
|
||||||
exist = true;
|
exist = true;
|
||||||
|
|
|
@ -169,7 +169,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LineSplitter splitter;
|
LineSplitter splitter;
|
||||||
int groupcode;
|
int groupcode;
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|
|
@ -1642,9 +1642,8 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
|
||||||
}
|
}
|
||||||
|
|
||||||
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
|
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
|
||||||
const std::string& propName,
|
const std::string& propName,
|
||||||
aiTextureType target, const MeshGeometry* const mesh )
|
aiTextureType target, const MeshGeometry* const mesh ) {
|
||||||
{
|
|
||||||
LayeredTextureMap::const_iterator it = layeredTextures.find( propName );
|
LayeredTextureMap::const_iterator it = layeredTextures.find( propName );
|
||||||
if ( it == layeredTextures.end() ) {
|
if ( it == layeredTextures.end() ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -622,7 +622,6 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
||||||
if (s != std::string::npos) {
|
if (s != std::string::npos) {
|
||||||
DefaultLogger::get()->info("File extension not known, trying signature-based detection");
|
DefaultLogger::get()->info("File extension not known, trying signature-based detection");
|
||||||
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
|
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) {
|
||||||
|
|
||||||
if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
|
if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
|
||||||
imp = pimpl->mImporter[a];
|
imp = pimpl->mImporter[a];
|
||||||
break;
|
break;
|
||||||
|
@ -947,6 +946,7 @@ BaseImporter* Importer::GetImporter (const char* szExtension) const
|
||||||
size_t Importer::GetImporterIndex (const char* szExtension) const
|
size_t Importer::GetImporterIndex (const char* szExtension) const
|
||||||
{
|
{
|
||||||
ai_assert(szExtension);
|
ai_assert(szExtension);
|
||||||
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// skip over wildcard and dot characters at string head --
|
// skip over wildcard and dot characters at string head --
|
||||||
|
|
|
@ -583,9 +583,8 @@ 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,
|
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 = "",
|
||||||
unsigned int nest = 0)
|
unsigned int nest = 0) {
|
||||||
{
|
|
||||||
for(const Schema_2x3::IfcProperty& property : set) {
|
for(const Schema_2x3::IfcProperty& property : set) {
|
||||||
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
||||||
if (const Schema_2x3::IfcPropertySingleValue* const singleValue = property.ToPtr<Schema_2x3::IfcPropertySingleValue>()) {
|
if (const Schema_2x3::IfcPropertySingleValue* const singleValue = property.ToPtr<Schema_2x3::IfcPropertySingleValue>()) {
|
||||||
|
|
|
@ -132,18 +132,18 @@ ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMt
|
||||||
mOutputMat.precision(16);
|
mOutputMat.precision(16);
|
||||||
|
|
||||||
WriteGeometryFile(noMtl);
|
WriteGeometryFile(noMtl);
|
||||||
if (!noMtl)
|
if ( !noMtl ) {
|
||||||
WriteMaterialFile();
|
WriteMaterialFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ObjExporter::~ObjExporter() {
|
ObjExporter::~ObjExporter() {
|
||||||
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
std::string ObjExporter :: GetMaterialLibName()
|
std::string ObjExporter::GetMaterialLibName() {
|
||||||
{
|
|
||||||
// within the Obj file, we use just the relative file name with the path stripped
|
// within the Obj file, we use just the relative file name with the path stripped
|
||||||
const std::string& s = GetMaterialLibFileName();
|
const std::string& s = GetMaterialLibFileName();
|
||||||
std::string::size_type il = s.find_last_of("/\\");
|
std::string::size_type il = s.find_last_of("/\\");
|
||||||
|
@ -158,8 +158,9 @@ std::string ObjExporter :: GetMaterialLibName()
|
||||||
std::string ObjExporter::GetMaterialLibFileName() {
|
std::string ObjExporter::GetMaterialLibFileName() {
|
||||||
// Remove existing .obj file extension so that the final material file name will be fileName.mtl and not fileName.obj.mtl
|
// Remove existing .obj file extension so that the final material file name will be fileName.mtl and not fileName.obj.mtl
|
||||||
size_t lastdot = filename.find_last_of('.');
|
size_t lastdot = filename.find_last_of('.');
|
||||||
if (lastdot != std::string::npos)
|
if ( lastdot != std::string::npos ) {
|
||||||
return filename.substr(0, lastdot) + MaterialExt;
|
return filename.substr( 0, lastdot ) + MaterialExt;
|
||||||
|
}
|
||||||
|
|
||||||
return filename + MaterialExt;
|
return filename + MaterialExt;
|
||||||
}
|
}
|
||||||
|
@ -172,8 +173,7 @@ void ObjExporter::WriteHeader(std::ostringstream& out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
std::string ObjExporter::GetMaterialName(unsigned int index)
|
std::string ObjExporter::GetMaterialName(unsigned int index) {
|
||||||
{
|
|
||||||
const aiMaterial* const mat = pScene->mMaterials[index];
|
const aiMaterial* const mat = pScene->mMaterials[index];
|
||||||
if ( nullptr == mat ) {
|
if ( nullptr == mat ) {
|
||||||
static const std::string EmptyStr;
|
static const std::string EmptyStr;
|
||||||
|
@ -191,8 +191,7 @@ std::string ObjExporter::GetMaterialName(unsigned int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter::WriteMaterialFile()
|
void ObjExporter::WriteMaterialFile() {
|
||||||
{
|
|
||||||
WriteHeader(mOutputMat);
|
WriteHeader(mOutputMat);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < pScene->mNumMaterials; ++i) {
|
for(unsigned int i = 0; i < pScene->mNumMaterials; ++i) {
|
||||||
|
@ -310,8 +309,9 @@ void ObjExporter::WriteGeometryFile(bool noMtl) {
|
||||||
if (!m.name.empty()) {
|
if (!m.name.empty()) {
|
||||||
mOutput << "g " << m.name << endl;
|
mOutput << "g " << m.name << endl;
|
||||||
}
|
}
|
||||||
if (!noMtl)
|
if ( !noMtl ) {
|
||||||
mOutput << "usemtl " << m.matname << endl;
|
mOutput << "usemtl " << m.matname << endl;
|
||||||
|
}
|
||||||
|
|
||||||
for(const Face& f : m.faces) {
|
for(const Face& f : m.faces) {
|
||||||
mOutput << f.kind << ' ';
|
mOutput << f.kind << ' ';
|
||||||
|
@ -382,7 +382,7 @@ void ObjExporter::colIndexMap::getColors( std::vector<aiColor4D> &colors ) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat) {
|
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat) {
|
||||||
mMeshes.push_back(MeshInstance());
|
mMeshes.push_back(MeshInstance() );
|
||||||
MeshInstance& mesh = mMeshes.back();
|
MeshInstance& mesh = mMeshes.back();
|
||||||
|
|
||||||
mesh.name = std::string( name.data, name.length );
|
mesh.name = std::string( name.data, name.length );
|
||||||
|
@ -436,8 +436,7 @@ void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void ObjExporter::AddNode(const aiNode* nd, const aiMatrix4x4& mParent)
|
void ObjExporter::AddNode(const aiNode* nd, const aiMatrix4x4& mParent) {
|
||||||
{
|
|
||||||
const aiMatrix4x4& mAbs = mParent * nd->mTransformation;
|
const aiMatrix4x4& mAbs = mParent * nd->mTransformation;
|
||||||
|
|
||||||
for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
|
for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
|
||||||
|
|
|
@ -207,30 +207,24 @@ void ObjFileImporter::CreateDataFromImport(const ObjFile::Model* pModel, aiScene
|
||||||
|
|
||||||
// Create the root node of the scene
|
// Create the root node of the scene
|
||||||
pScene->mRootNode = new aiNode;
|
pScene->mRootNode = new aiNode;
|
||||||
if ( !pModel->m_ModelName.empty() )
|
if ( !pModel->m_ModelName.empty() ) {
|
||||||
{
|
|
||||||
// Set the name of the scene
|
// Set the name of the scene
|
||||||
pScene->mRootNode->mName.Set(pModel->m_ModelName);
|
pScene->mRootNode->mName.Set(pModel->m_ModelName);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// This is a fatal error, so break down the application
|
// This is a fatal error, so break down the application
|
||||||
ai_assert(false);
|
ai_assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create nodes for the whole scene
|
// Create nodes for the whole scene
|
||||||
std::vector<aiMesh*> MeshArray;
|
std::vector<aiMesh*> MeshArray;
|
||||||
for (size_t index = 0; index < pModel->m_Objects.size(); index++)
|
for (size_t index = 0; index < pModel->m_Objects.size(); ++index ) {
|
||||||
{
|
|
||||||
createNodes(pModel, pModel->m_Objects[ index ], pScene->mRootNode, pScene, MeshArray);
|
createNodes(pModel, pModel->m_Objects[ index ], pScene->mRootNode, pScene, MeshArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create mesh pointer buffer for this scene
|
// Create mesh pointer buffer for this scene
|
||||||
if (pScene->mNumMeshes > 0)
|
if (pScene->mNumMeshes > 0) {
|
||||||
{
|
|
||||||
pScene->mMeshes = new aiMesh*[ MeshArray.size() ];
|
pScene->mMeshes = new aiMesh*[ MeshArray.size() ];
|
||||||
for (size_t index =0; index < MeshArray.size(); index++)
|
for (size_t index =0; index < MeshArray.size(); ++index ) {
|
||||||
{
|
|
||||||
pScene->mMeshes[ index ] = MeshArray[ index ];
|
pScene->mMeshes[ index ] = MeshArray[ index ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,8 +255,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
|
||||||
appendChildToParentNode( pParent, pNode );
|
appendChildToParentNode( pParent, pNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( size_t i=0; i< pObject->m_Meshes.size(); i++ )
|
for ( size_t i=0; i< pObject->m_Meshes.size(); ++i ) {
|
||||||
{
|
|
||||||
unsigned int meshId = pObject->m_Meshes[ i ];
|
unsigned int meshId = pObject->m_Meshes[ i ];
|
||||||
aiMesh *pMesh = createTopology( pModel, pObject, meshId );
|
aiMesh *pMesh = createTopology( pModel, pObject, meshId );
|
||||||
if( pMesh ) {
|
if( pMesh ) {
|
||||||
|
@ -275,8 +268,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create all nodes from the sub-objects stored in the current object
|
// Create all nodes from the sub-objects stored in the current object
|
||||||
if ( !pObject->m_SubObjects.empty() )
|
if ( !pObject->m_SubObjects.empty() ) {
|
||||||
{
|
|
||||||
size_t numChilds = pObject->m_SubObjects.size();
|
size_t numChilds = pObject->m_SubObjects.size();
|
||||||
pNode->mNumChildren = static_cast<unsigned int>( numChilds );
|
pNode->mNumChildren = static_cast<unsigned int>( numChilds );
|
||||||
pNode->mChildren = new aiNode*[ numChilds ];
|
pNode->mChildren = new aiNode*[ numChilds ];
|
||||||
|
@ -286,16 +278,14 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
|
||||||
|
|
||||||
// Set mesh instances into scene- and node-instances
|
// Set mesh instances into scene- and node-instances
|
||||||
const size_t meshSizeDiff = MeshArray.size()- oldMeshSize;
|
const size_t meshSizeDiff = MeshArray.size()- oldMeshSize;
|
||||||
if ( meshSizeDiff > 0 )
|
if ( meshSizeDiff > 0 ) {
|
||||||
{
|
|
||||||
pNode->mMeshes = new unsigned int[ meshSizeDiff ];
|
pNode->mMeshes = new unsigned int[ meshSizeDiff ];
|
||||||
pNode->mNumMeshes = static_cast<unsigned int>( meshSizeDiff );
|
pNode->mNumMeshes = static_cast<unsigned int>( meshSizeDiff );
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
for (size_t i = oldMeshSize; i < MeshArray.size(); i++)
|
for (size_t i = oldMeshSize; i < MeshArray.size(); ++i ) {
|
||||||
{
|
|
||||||
pNode->mMeshes[ index ] = pScene->mNumMeshes;
|
pNode->mMeshes[ index ] = pScene->mNumMeshes;
|
||||||
pScene->mNumMeshes++;
|
pScene->mNumMeshes++;
|
||||||
index++;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -612,13 +612,14 @@ void ObjFileParser::getMaterialLib() {
|
||||||
if ( '/' != *path.rbegin() ) {
|
if ( '/' != *path.rbegin() ) {
|
||||||
path += '/';
|
path += '/';
|
||||||
}
|
}
|
||||||
absName = path + strMatName;
|
absName += path;
|
||||||
|
absName += strMatName;
|
||||||
} else {
|
} else {
|
||||||
absName = strMatName;
|
absName = strMatName;
|
||||||
}
|
}
|
||||||
IOStream *pFile = m_pIO->Open( absName );
|
|
||||||
|
|
||||||
if (!pFile ) {
|
IOStream *pFile = m_pIO->Open( absName );
|
||||||
|
if ( nullptr == pFile ) {
|
||||||
DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName);
|
DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName);
|
||||||
std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl";
|
std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl";
|
||||||
DefaultLogger::get()->info("OBJ: Opening fallback material file " + strMatFallbackName);
|
DefaultLogger::get()->info("OBJ: Opening fallback material file " + strMatFallbackName);
|
||||||
|
|
|
@ -52,27 +52,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp {
|
||||||
{
|
namespace Ogre {
|
||||||
namespace Ogre
|
|
||||||
{
|
|
||||||
|
|
||||||
/// Returns a lower cased copy of @s.
|
/// Returns a lower cased copy of @s.
|
||||||
static inline std::string ToLower(std::string s)
|
static AI_FORCE_INLINE
|
||||||
|
std::string ToLower(std::string s)
|
||||||
{
|
{
|
||||||
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
|
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns if @c s ends with @c suffix. If @c caseSensitive is false, both strings will be lower cased before matching.
|
/// Returns if @c s ends with @c suffix. If @c caseSensitive is false, both strings will be lower cased before matching.
|
||||||
static inline bool EndsWith(const std::string &s, const std::string &suffix, bool caseSensitive = true)
|
static AI_FORCE_INLINE
|
||||||
{
|
bool EndsWith(const std::string &s, const std::string &suffix, bool caseSensitive = true) {
|
||||||
if (s.empty() || suffix.empty())
|
if (s.empty() || suffix.empty()) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (s.length() < suffix.length()) {
|
||||||
else if (s.length() < suffix.length())
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,48 +78,43 @@ static inline bool EndsWith(const std::string &s, const std::string &suffix, boo
|
||||||
|
|
||||||
size_t len = suffix.length();
|
size_t len = suffix.length();
|
||||||
std::string sSuffix = s.substr(s.length()-len, len);
|
std::string sSuffix = s.substr(s.length()-len, len);
|
||||||
|
|
||||||
return (ASSIMP_stricmp(sSuffix, suffix) == 0);
|
return (ASSIMP_stricmp(sSuffix, suffix) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below trim functions adapted from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
|
// Below trim functions adapted from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
|
||||||
|
|
||||||
/// Trim from start
|
/// Trim from start
|
||||||
static inline std::string &TrimLeft(std::string &s, bool newlines = true)
|
static AI_FORCE_INLINE
|
||||||
{
|
std::string &TrimLeft(std::string &s, bool newlines = true) {
|
||||||
if (!newlines)
|
if (!newlines) {
|
||||||
{
|
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpace<char>(c); }));
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpace<char>(c); }));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpaceOrNewLine<char>(c); }));
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpaceOrNewLine<char>(c); }));
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trim from end
|
/// Trim from end
|
||||||
static inline std::string &TrimRight(std::string &s, bool newlines = true)
|
static AI_FORCE_INLINE
|
||||||
{
|
std::string &TrimRight(std::string &s, bool newlines = true) {
|
||||||
if (!newlines)
|
if (!newlines) {
|
||||||
{
|
|
||||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](char c) { return !Assimp::IsSpace<char>(c); }).base(),s.end());
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](char c) { return !Assimp::IsSpace<char>(c); }).base(),s.end());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpaceOrNewLine<char>(c); }));
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !Assimp::IsSpaceOrNewLine<char>(c); }));
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trim from both ends
|
/// Trim from both ends
|
||||||
static inline std::string &Trim(std::string &s, bool newlines = true)
|
static AI_FORCE_INLINE
|
||||||
{
|
std::string &Trim(std::string &s, bool newlines = true) {
|
||||||
return TrimLeft(TrimRight(s, newlines), newlines);
|
return TrimLeft(TrimRight(s, newlines), newlines);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Skips a line from current @ss position until a newline. Returns the skipped part.
|
/// Skips a line from current @ss position until a newline. Returns the skipped part.
|
||||||
static inline std::string SkipLine(std::stringstream &ss)
|
static AI_FORCE_INLINE
|
||||||
{
|
std::string SkipLine(std::stringstream &ss) {
|
||||||
std::string skipped;
|
std::string skipped;
|
||||||
getline(ss, skipped);
|
getline(ss, skipped);
|
||||||
return skipped;
|
return skipped;
|
||||||
|
@ -131,8 +122,8 @@ static inline std::string SkipLine(std::stringstream &ss)
|
||||||
|
|
||||||
/// Skips a line and reads next element from @c ss to @c nextElement.
|
/// Skips a line and reads next element from @c ss to @c nextElement.
|
||||||
/** @return Skipped line content until newline. */
|
/** @return Skipped line content until newline. */
|
||||||
static inline std::string NextAfterNewLine(std::stringstream &ss, std::string &nextElement)
|
static AI_FORCE_INLINE
|
||||||
{
|
std::string NextAfterNewLine(std::stringstream &ss, std::string &nextElement) {
|
||||||
std::string skipped = SkipLine(ss);
|
std::string skipped = SkipLine(ss);
|
||||||
ss >> nextElement;
|
ss >> nextElement;
|
||||||
return skipped;
|
return skipped;
|
||||||
|
|
|
@ -213,18 +213,18 @@ std::string &OgreXmlSerializer::SkipCurrentNode()
|
||||||
DefaultLogger::get()->debug("Skipping node <" + m_currentNodeName + ">");
|
DefaultLogger::get()->debug("Skipping node <" + m_currentNodeName + ">");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(;;)
|
for(;;) {
|
||||||
{
|
if (!m_reader->read()) {
|
||||||
if (!m_reader->read())
|
|
||||||
{
|
|
||||||
m_currentNodeName = "";
|
m_currentNodeName = "";
|
||||||
return m_currentNodeName;
|
return m_currentNodeName;
|
||||||
}
|
}
|
||||||
if (m_reader->getNodeType() != irr::io::EXN_ELEMENT_END)
|
if ( m_reader->getNodeType() != irr::io::EXN_ELEMENT_END ) {
|
||||||
continue;
|
continue;
|
||||||
else if (std::string(m_reader->getNodeName()) == m_currentNodeName)
|
} else if ( std::string( m_reader->getNodeName() ) == m_currentNodeName ) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextNode();
|
return NextNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,17 +303,16 @@ static const char *anZ = "z";
|
||||||
|
|
||||||
// Mesh
|
// Mesh
|
||||||
|
|
||||||
MeshXml *OgreXmlSerializer::ImportMesh(XmlReader *reader)
|
MeshXml *OgreXmlSerializer::ImportMesh(XmlReader *reader) {
|
||||||
{
|
|
||||||
OgreXmlSerializer serializer(reader);
|
OgreXmlSerializer serializer(reader);
|
||||||
|
|
||||||
MeshXml *mesh = new MeshXml();
|
MeshXml *mesh = new MeshXml();
|
||||||
serializer.ReadMesh(mesh);
|
serializer.ReadMesh(mesh);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OgreXmlSerializer::ReadMesh(MeshXml *mesh)
|
void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
|
||||||
{
|
|
||||||
if (NextNode() != nnMesh) {
|
if (NextNode() != nnMesh) {
|
||||||
throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <mesh>");
|
throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <mesh>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,8 +807,9 @@ void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
||||||
if ((*it)->mNormals) {
|
if ((*it)->mNormals) {
|
||||||
::memcpy(pv2,(*it)->mNormals,(*it)->mNumVertices*sizeof(aiVector3D));
|
::memcpy(pv2,(*it)->mNormals,(*it)->mNumVertices*sizeof(aiVector3D));
|
||||||
|
} else {
|
||||||
|
DefaultLogger::get()->warn( "JoinMeshes: Normals expected but input mesh contains no normals" );
|
||||||
}
|
}
|
||||||
else DefaultLogger::get()->warn("JoinMeshes: Normals expected but input mesh contains no normals");
|
|
||||||
pv2 += (*it)->mNumVertices;
|
pv2 += (*it)->mNumVertices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,28 +819,29 @@ void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
||||||
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|
||||||
aiVector3D* pv2b = out->mBitangents = new aiVector3D[out->mNumVertices];
|
aiVector3D* pv2b = out->mBitangents = new aiVector3D[out->mNumVertices];
|
||||||
|
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
||||||
if ((*it)->mTangents) {
|
if ((*it)->mTangents) {
|
||||||
::memcpy(pv2, (*it)->mTangents, (*it)->mNumVertices*sizeof(aiVector3D));
|
::memcpy(pv2, (*it)->mTangents, (*it)->mNumVertices*sizeof(aiVector3D));
|
||||||
::memcpy(pv2b,(*it)->mBitangents,(*it)->mNumVertices*sizeof(aiVector3D));
|
::memcpy(pv2b,(*it)->mBitangents,(*it)->mNumVertices*sizeof(aiVector3D));
|
||||||
|
} else {
|
||||||
|
DefaultLogger::get()->warn( "JoinMeshes: Tangents expected but input mesh contains no tangents" );
|
||||||
}
|
}
|
||||||
else DefaultLogger::get()->warn("JoinMeshes: Tangents expected but input mesh contains no tangents");
|
|
||||||
pv2 += (*it)->mNumVertices;
|
pv2 += (*it)->mNumVertices;
|
||||||
pv2b += (*it)->mNumVertices;
|
pv2b += (*it)->mNumVertices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// copy texture coordinates
|
// copy texture coordinates
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
while ((**begin).HasTextureCoords(n)) {
|
while ((**begin).HasTextureCoords(n)) {
|
||||||
out->mNumUVComponents[n] = (*begin)->mNumUVComponents[n];
|
out->mNumUVComponents[n] = (*begin)->mNumUVComponents[n];
|
||||||
|
|
||||||
pv2 = out->mTextureCoords[n] = new aiVector3D[out->mNumVertices];
|
pv2 = out->mTextureCoords[n] = new aiVector3D[out->mNumVertices];
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
||||||
|
|
||||||
if ((*it)->mTextureCoords[n]) {
|
if ((*it)->mTextureCoords[n]) {
|
||||||
::memcpy(pv2,(*it)->mTextureCoords[n],(*it)->mNumVertices*sizeof(aiVector3D));
|
::memcpy(pv2,(*it)->mTextureCoords[n],(*it)->mNumVertices*sizeof(aiVector3D));
|
||||||
|
} else {
|
||||||
|
DefaultLogger::get()->warn( "JoinMeshes: UVs expected but input mesh contains no UVs" );
|
||||||
}
|
}
|
||||||
else DefaultLogger::get()->warn("JoinMeshes: UVs expected but input mesh contains no UVs");
|
|
||||||
pv2 += (*it)->mNumVertices;
|
pv2 += (*it)->mNumVertices;
|
||||||
}
|
}
|
||||||
++n;
|
++n;
|
||||||
|
@ -849,11 +851,11 @@ void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
||||||
while ((**begin).HasVertexColors(n)) {
|
while ((**begin).HasVertexColors(n)) {
|
||||||
aiColor4D* pv2 = out->mColors[n] = new aiColor4D[out->mNumVertices];
|
aiColor4D* pv2 = out->mColors[n] = new aiColor4D[out->mNumVertices];
|
||||||
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
||||||
|
|
||||||
if ((*it)->mColors[n]) {
|
if ((*it)->mColors[n]) {
|
||||||
::memcpy(pv2,(*it)->mColors[n],(*it)->mNumVertices*sizeof(aiColor4D));
|
::memcpy(pv2,(*it)->mColors[n],(*it)->mNumVertices*sizeof(aiColor4D));
|
||||||
|
} else {
|
||||||
|
DefaultLogger::get()->warn( "JoinMeshes: VCs expected but input mesh contains no VCs" );
|
||||||
}
|
}
|
||||||
else DefaultLogger::get()->warn("JoinMeshes: VCs expected but input mesh contains no VCs");
|
|
||||||
pv2 += (*it)->mNumVertices;
|
pv2 += (*it)->mNumVertices;
|
||||||
}
|
}
|
||||||
++n;
|
++n;
|
||||||
|
|
|
@ -131,9 +131,7 @@ public:
|
||||||
bool detatchStream(LogStream *pStream,
|
bool detatchStream(LogStream *pStream,
|
||||||
unsigned int severity);
|
unsigned int severity);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
/** @briefPrivate construction for internal use by create().
|
/** @briefPrivate construction for internal use by create().
|
||||||
* @param severity Logging granularity */
|
* @param severity Logging granularity */
|
||||||
|
@ -143,8 +141,6 @@ private:
|
||||||
/** @briefDestructor */
|
/** @briefDestructor */
|
||||||
~DefaultLogger();
|
~DefaultLogger();
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
||||||
void OnDebug(const char* message);
|
void OnDebug(const char* message);
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ bool IsSpaceOrNewLine( char_t in) {
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipSpaces( const char_t* in, const char_t** out)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipSpaces( const char_t* in, const char_t** out) {
|
||||||
while( *in == ( char_t )' ' || *in == ( char_t )'\t' ) {
|
while( *in == ( char_t )' ' || *in == ( char_t )'\t' ) {
|
||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
|
@ -126,15 +126,15 @@ AI_FORCE_INLINE bool SkipSpaces( const char_t* in, const char_t** out)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipSpaces( const char_t** inout)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipSpaces( const char_t** inout) {
|
||||||
return SkipSpaces<char_t>(*inout,inout);
|
return SkipSpaces<char_t>(*inout,inout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipLine( const char_t* in, const char_t** out)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipLine( const char_t* in, const char_t** out) {
|
||||||
while( *in != ( char_t )'\r' && *in != ( char_t )'\n' && *in != ( char_t )'\0' ) {
|
while( *in != ( char_t )'\r' && *in != ( char_t )'\n' && *in != ( char_t )'\0' ) {
|
||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
|
@ -149,15 +149,15 @@ AI_FORCE_INLINE bool SkipLine( const char_t* in, const char_t** out)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipLine( const char_t** inout)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipLine( const char_t** inout) {
|
||||||
return SkipLine<char_t>(*inout,inout);
|
return SkipLine<char_t>(*inout,inout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipSpacesAndLineEnd( const char_t* in, const char_t** out)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipSpacesAndLineEnd( const char_t* in, const char_t** out) {
|
||||||
while( *in == ( char_t )' ' || *in == ( char_t )'\t' || *in == ( char_t )'\r' || *in == ( char_t )'\n' ) {
|
while( *in == ( char_t )' ' || *in == ( char_t )'\t' || *in == ( char_t )'\r' || *in == ( char_t )'\n' ) {
|
||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
|
@ -167,15 +167,15 @@ AI_FORCE_INLINE bool SkipSpacesAndLineEnd( const char_t* in, const char_t** out)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool SkipSpacesAndLineEnd( const char_t** inout)
|
AI_FORCE_INLINE
|
||||||
{
|
bool SkipSpacesAndLineEnd( const char_t** inout) {
|
||||||
return SkipSpacesAndLineEnd<char_t>(*inout,inout);
|
return SkipSpacesAndLineEnd<char_t>(*inout,inout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool GetNextLine( const char_t*& buffer, char_t out[ BufferSize ] )
|
AI_FORCE_INLINE
|
||||||
{
|
bool GetNextLine( const char_t*& buffer, char_t out[ BufferSize ] ) {
|
||||||
if( ( char_t )'\0' == *buffer ) {
|
if( ( char_t )'\0' == *buffer ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,8 @@ AI_FORCE_INLINE bool IsNumeric( char_t in)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
template <class char_t>
|
template <class char_t>
|
||||||
AI_FORCE_INLINE bool TokenMatch(char_t*& in, const char* token, unsigned int len)
|
AI_FORCE_INLINE
|
||||||
|
bool TokenMatch(char_t*& in, const char* token, unsigned int len)
|
||||||
{
|
{
|
||||||
if (!::strncmp(token,in,len) && IsSpaceOrNewLine(in[len])) {
|
if (!::strncmp(token,in,len) && IsSpaceOrNewLine(in[len])) {
|
||||||
if (in[len] != '\0') {
|
if (in[len] != '\0') {
|
||||||
|
@ -223,26 +224,32 @@ AI_FORCE_INLINE bool TokenMatch(char_t*& in, const char* token, unsigned int len
|
||||||
* @param token Token to check for
|
* @param token Token to check for
|
||||||
* @param len Number of characters to check
|
* @param len Number of characters to check
|
||||||
*/
|
*/
|
||||||
AI_FORCE_INLINE bool TokenMatchI(const char*& in, const char* token, unsigned int len)
|
AI_FORCE_INLINE
|
||||||
{
|
bool TokenMatchI(const char*& in, const char* token, unsigned int len) {
|
||||||
if (!ASSIMP_strincmp(token,in,len) && IsSpaceOrNewLine(in[len])) {
|
if (!ASSIMP_strincmp(token,in,len) && IsSpaceOrNewLine(in[len])) {
|
||||||
in += len+1;
|
in += len+1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
AI_FORCE_INLINE void SkipToken(const char*& in)
|
AI_FORCE_INLINE
|
||||||
{
|
void SkipToken(const char*& in) {
|
||||||
SkipSpaces(&in);
|
SkipSpaces(&in);
|
||||||
while (!IsSpaceOrNewLine(*in))++in;
|
while ( !IsSpaceOrNewLine( *in ) ) {
|
||||||
|
++in;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
AI_FORCE_INLINE std::string GetNextToken(const char*& in)
|
AI_FORCE_INLINE
|
||||||
{
|
std::string GetNextToken(const char*& in) {
|
||||||
SkipSpacesAndLineEnd(&in);
|
SkipSpacesAndLineEnd(&in);
|
||||||
const char* cur = in;
|
const char* cur = in;
|
||||||
while (!IsSpaceOrNewLine(*in))++in;
|
while ( !IsSpaceOrNewLine( *in ) ) {
|
||||||
|
++in;
|
||||||
|
}
|
||||||
return std::string(cur,(size_t)(in-cur));
|
return std::string(cur,(size_t)(in-cur));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define INCLUDED_AI_STRING_WORKERS_H
|
#define INCLUDED_AI_STRING_WORKERS_H
|
||||||
|
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
|
#include <assimp/defs.h>
|
||||||
#include "StringComparison.h"
|
#include "StringComparison.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -72,8 +73,8 @@ namespace Assimp {
|
||||||
* @param number Number to be written
|
* @param number Number to be written
|
||||||
* @return Length of the output string, excluding the '\0'
|
* @return Length of the output string, excluding the '\0'
|
||||||
*/
|
*/
|
||||||
inline unsigned int ASSIMP_itoa10( char* out, unsigned int max, int32_t number)
|
AI_FORCE_INLINE
|
||||||
{
|
unsigned int ASSIMP_itoa10( char* out, unsigned int max, int32_t number) {
|
||||||
ai_assert(NULL != out);
|
ai_assert(NULL != out);
|
||||||
|
|
||||||
// write the unary minus to indicate we have a negative number
|
// write the unary minus to indicate we have a negative number
|
||||||
|
@ -91,7 +92,7 @@ inline unsigned int ASSIMP_itoa10( char* out, unsigned int max, int32_t number)
|
||||||
|
|
||||||
const unsigned int digit = number / cur;
|
const unsigned int digit = number / cur;
|
||||||
if (mustPrint || digit > 0 || 1 == cur) {
|
if (mustPrint || digit > 0 || 1 == cur) {
|
||||||
// print all future zeroes from now
|
// print all future zeroe's from now
|
||||||
mustPrint = true;
|
mustPrint = true;
|
||||||
|
|
||||||
*out++ = '0'+static_cast<char>(digit);
|
*out++ = '0'+static_cast<char>(digit);
|
||||||
|
@ -116,8 +117,8 @@ inline unsigned int ASSIMP_itoa10( char* out, unsigned int max, int32_t number)
|
||||||
* size of the array automatically.
|
* size of the array automatically.
|
||||||
*/
|
*/
|
||||||
template <size_t length>
|
template <size_t length>
|
||||||
inline unsigned int ASSIMP_itoa10( char(& out)[length], int32_t number)
|
AI_FORCE_INLINE
|
||||||
{
|
unsigned int ASSIMP_itoa10( char(& out)[length], int32_t number) {
|
||||||
return ASSIMP_itoa10(out,length,number);
|
return ASSIMP_itoa10(out,length,number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +133,10 @@ inline unsigned int ASSIMP_itoa10( char(& out)[length], int32_t number)
|
||||||
* @param s2 Second input string
|
* @param s2 Second input string
|
||||||
* @return 0 if the given strings are identical
|
* @return 0 if the given strings are identical
|
||||||
*/
|
*/
|
||||||
inline int ASSIMP_stricmp(const char *s1, const char *s2)
|
AI_FORCE_INLINE
|
||||||
{
|
int ASSIMP_stricmp(const char *s1, const char *s2) {
|
||||||
ai_assert(NULL != s1 && NULL != s2);
|
ai_assert( NULL != s1 );
|
||||||
|
ai_assert( NULL != s2 );
|
||||||
|
|
||||||
#if (defined _MSC_VER)
|
#if (defined _MSC_VER)
|
||||||
|
|
||||||
|
@ -161,8 +163,8 @@ inline int ASSIMP_stricmp(const char *s1, const char *s2)
|
||||||
* @param b Second string
|
* @param b Second string
|
||||||
* @return 0 if a == b
|
* @return 0 if a == b
|
||||||
*/
|
*/
|
||||||
inline int ASSIMP_stricmp(const std::string& a, const std::string& b)
|
AI_FORCE_INLINE
|
||||||
{
|
int ASSIMP_stricmp(const std::string& a, const std::string& b) {
|
||||||
int i = (int)b.length()-(int)a.length();
|
int i = (int)b.length()-(int)a.length();
|
||||||
return (i ? i : ASSIMP_stricmp(a.c_str(),b.c_str()));
|
return (i ? i : ASSIMP_stricmp(a.c_str(),b.c_str()));
|
||||||
}
|
}
|
||||||
|
@ -179,10 +181,13 @@ inline int ASSIMP_stricmp(const std::string& a, const std::string& b)
|
||||||
* @param n Macimum number of characters to compare
|
* @param n Macimum number of characters to compare
|
||||||
* @return 0 if the given strings are identical
|
* @return 0 if the given strings are identical
|
||||||
*/
|
*/
|
||||||
inline int ASSIMP_strincmp(const char *s1, const char *s2, unsigned int n)
|
AI_FORCE_INLINE
|
||||||
{
|
int ASSIMP_strincmp(const char *s1, const char *s2, unsigned int n) {
|
||||||
ai_assert(NULL != s1 && NULL != s2);
|
ai_assert( NULL != s1 );
|
||||||
if (!n)return 0;
|
ai_assert( NULL != s2 );
|
||||||
|
if ( !n ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if (defined _MSC_VER)
|
#if (defined _MSC_VER)
|
||||||
|
|
||||||
|
@ -213,14 +218,16 @@ inline int ASSIMP_strincmp(const char *s1, const char *s2, unsigned int n)
|
||||||
*
|
*
|
||||||
* todo: move somewhere where it fits better in than here
|
* todo: move somewhere where it fits better in than here
|
||||||
*/
|
*/
|
||||||
inline unsigned int integer_pow (unsigned int base, unsigned int power)
|
AI_FORCE_INLINE
|
||||||
{
|
unsigned int integer_pow( unsigned int base, unsigned int power ) {
|
||||||
unsigned int res = 1;
|
unsigned int res = 1;
|
||||||
for (unsigned int i = 0; i < power;++i)
|
for ( unsigned int i = 0; i < power; ++i ) {
|
||||||
res *= base;
|
res *= base;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace
|
} // end of namespace
|
||||||
|
|
||||||
#endif // ! AI_STRINGCOMPARISON_H_INC
|
#endif // ! AI_STRINGCOMPARISON_H_INC
|
||||||
|
|
|
@ -42,6 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef INCLUDED_AI_STRINGUTILS_H
|
#ifndef INCLUDED_AI_STRINGUTILS_H
|
||||||
#define INCLUDED_AI_STRINGUTILS_H
|
#define INCLUDED_AI_STRINGUTILS_H
|
||||||
|
|
||||||
|
#include <assimp/defs.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -55,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/// @return The number of written characters if the buffer size was big enough. If an encoding error occurs, a negative number is returned.
|
/// @return The number of written characters if the buffer size was big enough. If an encoding error occurs, a negative number is returned.
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
|
|
||||||
inline
|
AI_FORCE_INLINE
|
||||||
int c99_ai_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) {
|
int c99_ai_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) {
|
||||||
int count(-1);
|
int count(-1);
|
||||||
if (0 != size) {
|
if (0 != size) {
|
||||||
|
@ -68,7 +70,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
AI_FORCE_INLINE
|
||||||
int ai_snprintf(char *outBuf, size_t size, const char *format, ...) {
|
int ai_snprintf(char *outBuf, size_t size, const char *format, ...) {
|
||||||
int count;
|
int count;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -89,7 +91,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
/// @param value The value to write into the std::string.
|
/// @param value The value to write into the std::string.
|
||||||
/// @return The value as a std::string
|
/// @return The value as a std::string
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
AI_FORCE_INLINE
|
||||||
std::string to_string( T value ) {
|
std::string to_string( T value ) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << value;
|
os << value;
|
||||||
|
@ -102,7 +104,7 @@ std::string to_string( T value ) {
|
||||||
/// @param begin The first character of the string.
|
/// @param begin The first character of the string.
|
||||||
/// @param end The last character
|
/// @param end The last character
|
||||||
/// @return The float value, 0.0f in cas of an error.
|
/// @return The float value, 0.0f in cas of an error.
|
||||||
inline
|
AI_FORCE_INLINE
|
||||||
float ai_strtof( const char *begin, const char *end ) {
|
float ai_strtof( const char *begin, const char *end ) {
|
||||||
if ( nullptr == begin ) {
|
if ( nullptr == begin ) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
@ -124,7 +126,7 @@ float ai_strtof( const char *begin, const char *end ) {
|
||||||
/// @param toConvert Value to convert
|
/// @param toConvert Value to convert
|
||||||
/// @return The hexadecimal string, is empty in case of an error.
|
/// @return The hexadecimal string, is empty in case of an error.
|
||||||
template<class T>
|
template<class T>
|
||||||
inline
|
AI_FORCE_INLINE
|
||||||
std::string DecimalToHexa( T toConvert ) {
|
std::string DecimalToHexa( T toConvert ) {
|
||||||
std::string result;
|
std::string result;
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
Loading…
Reference in New Issue