Merge branch 'master' of https://github.com/assimp/assimp into implementation_warning_fix

# Conflicts:
#	code/ObjFileImporter.cpp
This commit is contained in:
Jared Mulconry
2016-11-27 13:00:33 +11:00
16 changed files with 267 additions and 99 deletions

View File

@@ -150,7 +150,7 @@ void ReportSceneNotFoundError()
DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. "
"The C-API does not accept scenes produced by the C++ API and vice versa");
assert(false);
ai_assert(false);
}
// ------------------------------------------------------------------------------------------------

View File

@@ -59,7 +59,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
using namespace Assimp;
using namespace Assimp::Collada;
using namespace Assimp::Formatter;

View File

@@ -268,8 +268,7 @@ namespace Assimp
Collada::InputType GetTypeForSemantic( const std::string& pSemantic);
/** Finds the item in the given library by its reference, throws if not found */
template <typename Type> const Type& ResolveLibraryReference(
const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
template <typename Type> const Type& ResolveLibraryReference( const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
protected:
/** Filename, for a verbose error message */

View File

@@ -602,28 +602,28 @@ bool ExportProperties :: HasPropertyInteger(const char* szName) const
bool ExportProperties :: HasPropertyBool(const char* szName) const
{
return HasGenericProperty<int>(mIntProperties, szName);
};
}
// ------------------------------------------------------------------------------------------------
// Has a configuration property
bool ExportProperties :: HasPropertyFloat(const char* szName) const
{
return HasGenericProperty<ai_real>(mFloatProperties, szName);
};
}
// ------------------------------------------------------------------------------------------------
// Has a configuration property
bool ExportProperties :: HasPropertyString(const char* szName) const
{
return HasGenericProperty<std::string>(mStringProperties, szName);
};
}
// ------------------------------------------------------------------------------------------------
// Has a configuration property
bool ExportProperties :: HasPropertyMatrix(const char* szName) const
{
return HasGenericProperty<aiMatrix4x4>(mMatrixProperties, szName);
};
}
#endif // !ASSIMP_BUILD_NO_EXPORT

View File

@@ -62,7 +62,6 @@ namespace Assimp
class ASSIMP_API JoinVerticesProcess : public BaseProcess
{
public:
JoinVerticesProcess();
~JoinVerticesProcess();

View File

@@ -149,10 +149,10 @@ void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene,
// This next stage takes ~ 1/3th of the total readFile task
// so should amount for 1/3th of the progress
// only update every 100KB or it'll be too slow
unsigned int progress = 0;
/*unsigned int progress = 0;
unsigned int progressCounter = 0;
const unsigned int updateProgressEveryBytes = 100 * 1024;
const unsigned int progressTotal = static_cast<unsigned int>(3*m_Buffer.size()/updateProgressEveryBytes);
const unsigned int progressTotal = static_cast<unsigned int>(3*m_Buffer.size()/updateProgressEveryBytes);*/
// process all '\'
/*std::vector<char> ::iterator iter = m_Buffer.begin();
while (iter != m_Buffer.end())
@@ -600,9 +600,6 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);
// multiplying the specular exponent with 2 seems to yield better results
pCurrentMaterial->shineness *= 4.f;
// Adding material colors
mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );

View File

@@ -102,7 +102,7 @@ ObjFile::Model *ObjFileParser::GetModel() const {
// File parsing method.
void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
// only update every 100KB or it'll be too slow
const unsigned int updateProgressEveryBytes = 100 * 1024;
//const unsigned int updateProgressEveryBytes = 100 * 1024;
unsigned int progressCounter = 0;
const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size());
const unsigned int progressTotal = 3 * bytesToProcess;

View File

@@ -197,13 +197,15 @@ static aiString ReadString(StreamReaderLE* stream, uint32_t numWChars)
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
SIBImporter::SIBImporter()
{}
SIBImporter::SIBImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
SIBImporter::~SIBImporter()
{}
SIBImporter::~SIBImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@@ -508,7 +510,7 @@ struct TempMesh
std::vector<aiVector3D> vtx;
std::vector<aiVector3D> nrm;
std::vector<aiVector3D> uv;
std::vector<aiFace> faces;
std::vector<aiFace> faces;
};
static void ReadShape(SIB* sib, StreamReaderLE* stream)
@@ -546,7 +548,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
stream->SetReadLimit(oldLimit);
}
assert(smesh.faceStart.size() == smesh.mtls.size()); // sanity check
ai_assert(smesh.faceStart.size() == smesh.mtls.size()); // sanity check
// Silo doesn't store any normals in the file - we need to compute
// them ourselves. We can't let AssImp handle it as AssImp doesn't
@@ -792,8 +794,9 @@ static void ReadInstance(SIB* sib, StreamReaderLE* stream)
stream->SetReadLimit(oldLimit);
}
if (shapeIndex >= sib->objs.size())
throw DeadlyImportError("SIB: Invalid shape index.");
if ( shapeIndex >= sib->objs.size() ) {
throw DeadlyImportError( "SIB: Invalid shape index." );
}
const SIBObject& src = sib->objs[shapeIndex];
inst.meshIdx = src.meshIdx;
@@ -805,8 +808,9 @@ static void ReadInstance(SIB* sib, StreamReaderLE* stream)
static void CheckVersion(StreamReaderLE* stream)
{
uint32_t version = stream->GetU4();
if (version != 1)
throw DeadlyImportError("SIB: Unsupported file version.");
if ( version != 1 ) {
throw DeadlyImportError( "SIB: Unsupported file version." );
}
}
static void ReadScene(SIB* sib, StreamReaderLE* stream)

View File

@@ -53,15 +53,13 @@ namespace Assimp {
// ---------------------------------------------------------------------------
/** Importer class for the Nevercenter Silo SIB scene format
*/
class SIBImporter : public BaseImporter
class ASSIMP_API SIBImporter : public BaseImporter
{
public:
SIBImporter();
~SIBImporter();
public:
// -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details.
@@ -70,7 +68,6 @@ public:
bool checkSig) const;
protected:
// -------------------------------------------------------------------
/** Return importer meta information.
* See #BaseImporter::GetInfo for the details
@@ -85,7 +82,6 @@ protected:
IOSystem* pIOHandler);
private:
struct MeshInformation
{
explicit MeshInformation(const std::string& _name)

View File

@@ -57,9 +57,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* - dump all polygons and their triangulation sequences to
* a file
*/
#ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
#include "TriangulateProcess.h"
#include "ProcessHelper.h"
@@ -106,11 +103,15 @@ void TriangulateProcess::Execute( aiScene* pScene)
bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
{
if( TriangulateMesh( pScene->mMeshes[a]))
if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) {
bHas = true;
}
}
if ( bHas ) {
DefaultLogger::get()->info( "TriangulateProcess finished. All polygons have been triangulated." );
} else {
DefaultLogger::get()->debug( "TriangulateProcess finished. There was nothing to be done." );
}
if (bHas)DefaultLogger::get()->info ("TriangulateProcess finished. All polygons have been triangulated.");
else DefaultLogger::get()->debug("TriangulateProcess finished. There was nothing to be done.");
}
@@ -155,7 +156,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
}
// Just another check whether aiMesh::mPrimitiveTypes is correct
assert(numOut != pMesh->mNumFaces);
ai_assert(numOut != pMesh->mNumFaces);
aiVector3D* nor_out = NULL;
@@ -184,7 +185,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
aiColor4D* clr = pMesh->mColors[0];
#endif
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
FILE* fout = fopen(POLY_OUTPUT_FILE,"a");
#endif
@@ -276,7 +276,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
{
// A polygon with more than 3 vertices can be either concave or convex.
// Usually everything we're getting is convex and we could easily
// triangulate by trifanning. However, LightWave is probably the only
// triangulate by tri-fanning. However, LightWave is probably the only
// modeling suite to make extensive use of highly concave, monster polygons ...
// so we need to apply the full 'ear cutting' algorithm to get it right.
@@ -325,7 +325,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
done[tmp] = false;
}
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
// plot the plane onto which we mapped the polygon to a 2D ASCII pic
aiVector2D bmin,bmax;
@@ -404,14 +403,13 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
if (num_found == 2) {
// Due to the 'two ear theorem', every simple polygon with more than three points must
// have 2 'ears'. Here's definitely someting wrong ... but we don't give up yet.
// have 2 'ears'. Here's definitely something wrong ... but we don't give up yet.
//
// Instead we're continuting with the standard trifanning algorithm which we'd
// Instead we're continuing with the standard tri-fanning algorithm which we'd
// use if we had only convex polygons. That's life.
DefaultLogger::get()->error("Failed to triangulate polygon (no ear found). Probably not a simple polygon?");
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
fprintf(fout,"critical error here, no ear found! ");
#endif

View File

@@ -158,7 +158,7 @@ string tstr;
AttrHelper_FloatToString(pValue, tstr);
pList.push_back({pName, tstr});
};
}
void X3DExporter::NodeHelper_OpenNode(const string& pNodeName, const size_t pTabLevel, const bool pEmptyElement, const list<SAttribute>& pAttrList)
{