Build: fix some compiler warnings for g++.

pull/1302/head
Kim Kulling 2017-05-26 09:18:23 +02:00
parent 1b4cbcc6ad
commit e93355c8b4
6 changed files with 27 additions and 26 deletions

View File

@ -87,11 +87,16 @@ static const std::string MaterialExt = ".mtl";
ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene) ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene)
: filename(_filename) : filename(_filename)
, pScene(pScene) , pScene(pScene)
, endl("\n")
, vp() , vp()
, vn() , vn()
, vt() , vt()
, vc() { , vc()
, vpMap()
, vnMap()
, vtMap()
, vcMap()
, meshes()
, endl("\n") {
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C"); const std::locale& l = std::locale("C");
mOutput.imbue(l); mOutput.imbue(l);

View File

@ -98,16 +98,13 @@ private:
void WriteHeader(std::ostringstream& out); void WriteHeader(std::ostringstream& out);
void WriteMaterialFile(); void WriteMaterialFile();
void WriteGeometryFile(); void WriteGeometryFile();
std::string GetMaterialName(unsigned int index); std::string GetMaterialName(unsigned int index);
void AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat); void AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat);
void AddNode(const aiNode* nd, const aiMatrix4x4& mParent); void AddNode(const aiNode* nd, const aiMatrix4x4& mParent);
private: private:
std::string filename; std::string filename;
const aiScene* const pScene; const aiScene* const pScene;
std::vector<aiVector3D> vp, vn, vt; std::vector<aiVector3D> vp, vn, vt;
std::vector<aiColor4D> vc; std::vector<aiColor4D> vc;

View File

@ -66,7 +66,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map> #include <map>
using namespace Assimp; using namespace Assimp;
static const aiImporterDesc desc = { static const aiImporterDesc desc = {
@ -80,25 +79,26 @@ static const aiImporterDesc desc = {
"sib" "sib"
}; };
struct SIBChunk struct SIBChunk {
{
uint32_t Tag; uint32_t Tag;
uint32_t Size; uint32_t Size;
} PACK_STRUCT; } PACK_STRUCT;
enum { POS, NRM, UV, N }; enum {
POS,
NRM,
UV,
N
};
typedef std::pair<uint32_t, uint32_t> SIBPair; typedef std::pair<uint32_t, uint32_t> SIBPair;
static SIBPair makePair(uint32_t a, uint32_t b) { return (a<b) ? SIBPair(a, b) : SIBPair(b, a); }
struct SIBEdge struct SIBEdge {
{
uint32_t faceA, faceB; uint32_t faceA, faceB;
bool creased; bool creased;
}; };
struct SIBMesh struct SIBMesh {
{
aiMatrix4x4 axis; aiMatrix4x4 axis;
uint32_t numPts; uint32_t numPts;
std::vector<aiVector3D> pos, nrm, uv; std::vector<aiVector3D> pos, nrm, uv;
@ -109,15 +109,13 @@ struct SIBMesh
std::map<SIBPair, uint32_t> edgeMap; std::map<SIBPair, uint32_t> edgeMap;
}; };
struct SIBObject struct SIBObject {
{
aiString name; aiString name;
aiMatrix4x4 axis; aiMatrix4x4 axis;
size_t meshIdx, meshCount; size_t meshIdx, meshCount;
}; };
struct SIB struct SIB {
{
std::vector<aiMaterial*> mtls; std::vector<aiMaterial*> mtls;
std::vector<aiMesh*> meshes; std::vector<aiMesh*> meshes;
std::vector<aiLight*> lights; std::vector<aiLight*> lights;
@ -125,8 +123,7 @@ struct SIB
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static SIBEdge& GetEdge(SIBMesh* mesh, uint32_t posA, uint32_t posB) static SIBEdge& GetEdge(SIBMesh* mesh, uint32_t posA, uint32_t posB) {
{
SIBPair pair = (posA < posB) ? SIBPair(posA, posB) : SIBPair(posB, posA); SIBPair pair = (posA < posB) ? SIBPair(posA, posB) : SIBPair(posB, posA);
std::map<SIBPair, uint32_t>::iterator it = mesh->edgeMap.find(pair); std::map<SIBPair, uint32_t>::iterator it = mesh->edgeMap.find(pair);
if (it != mesh->edgeMap.end()) if (it != mesh->edgeMap.end())

View File

@ -70,7 +70,7 @@ TEST_F(BlendImportMaterials, testImportMaterial)
ASSERT_TRUE(pTest != NULL); ASSERT_TRUE(pTest != NULL);
ASSERT_TRUE(pTest->HasMaterials()); ASSERT_TRUE(pTest->HasMaterials());
ASSERT_EQ(1, pTest->mNumMaterials); ASSERT_EQ(1U, pTest->mNumMaterials);
auto alpha = pTest->mMaterials[0]; auto alpha = pTest->mMaterials[0];
@ -86,8 +86,8 @@ TEST_F(BlendImportMaterials, testImportMaterial)
ASSERT_PROPERTY_EQ(aiColor3D(0.1f, 0.2f, 0.3f), "diffuse.color", diffuseColor); ASSERT_PROPERTY_EQ(aiColor3D(0.1f, 0.2f, 0.3f), "diffuse.color", diffuseColor);
ASSERT_PROPERTY_EQ(0.4f, "diffuse.intensity", diffuseIntensity); ASSERT_PROPERTY_EQ(0.4f, "diffuse.intensity", diffuseIntensity);
ASSERT_PROPERTY_EQ(1, "diffuse.shader", diffuseShader); ASSERT_PROPERTY_EQ(1U, "diffuse.shader", diffuseShader);
ASSERT_PROPERTY_EQ(0, "diffuse.ramp", diffuseRamp); ASSERT_PROPERTY_EQ(0U, "diffuse.ramp", diffuseRamp);
ASSERT_PROPERTY_EQ(aiColor3D(0.5f, 0.6f, 0.7f), "specular.color", specularColor); ASSERT_PROPERTY_EQ(aiColor3D(0.5f, 0.6f, 0.7f), "specular.color", specularColor);
ASSERT_PROPERTY_EQ(0.8f, "specular.intensity", specularIntensity); ASSERT_PROPERTY_EQ(0.8f, "specular.intensity", specularIntensity);

View File

@ -63,12 +63,13 @@ protected:
TEST_F( IOSystemTest, accessDirectoryStackTest ) { TEST_F( IOSystemTest, accessDirectoryStackTest ) {
EXPECT_FALSE( pImp->PopDirectory() ); EXPECT_FALSE( pImp->PopDirectory() );
EXPECT_EQ( 0, pImp->StackSize() ); EXPECT_EQ( 0U, pImp->StackSize() );
EXPECT_FALSE( pImp->PushDirectory( "" ) ); EXPECT_FALSE( pImp->PushDirectory( "" ) );
std::string path = "test/"; std::string path = "test/";
EXPECT_TRUE( pImp->PushDirectory( path ) ); EXPECT_TRUE( pImp->PushDirectory( path ) );
EXPECT_EQ( 1, pImp->StackSize() ); EXPECT_EQ( 1U, pImp->StackSize() );
EXPECT_EQ( path, pImp->CurrentDirectory() ); EXPECT_EQ( path, pImp->CurrentDirectory() );
EXPECT_TRUE( pImp->PopDirectory() ); EXPECT_TRUE( pImp->PopDirectory() );
EXPECT_EQ( 0, pImp->StackSize() ); EXPECT_EQ( 0U, pImp->StackSize() );
} }

View File

@ -66,5 +66,6 @@ TEST_F( utOpenGEXImportExport, importLWSFromFileTest ) {
TEST_F( utOpenGEXImportExport, Importissue1262_NoCrash ) { TEST_F( utOpenGEXImportExport, Importissue1262_NoCrash ) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OpenGEX/light_issue1262.ogex", 0 ); const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OpenGEX/light_issue1262.ogex", 0 );
EXPECT_NE( nullptr, scene );
} }