Merge branch 'master' of https://github.com/assimp/assimp
commit
d052b74b96
10
.travis.yml
10
.travis.yml
|
@ -3,7 +3,15 @@ language: cpp
|
|||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install cmake python3 homebrew/x11/freeglut; fi
|
||||
- 'if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
if brew ls --versions cmake > /dev/null; then
|
||||
echo cmake already installed.;
|
||||
else
|
||||
brew install cmake;
|
||||
fi;
|
||||
brew install python3;
|
||||
brew install homebrew/x11/freeglut;
|
||||
fi'
|
||||
- echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h
|
||||
# install latest LCOV (1.9 was failing)
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz && tar xf lcov_1.11.orig.tar.gz && sudo make -C lcov-1.11/ install && gem install coveralls-lcov && lcov --version && g++ --version ; fi
|
||||
|
|
|
@ -50,12 +50,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "FBXDocument.h"
|
||||
#include "FBXImporter.h"
|
||||
#include "FBXDocumentUtil.h"
|
||||
#include "FBXProperties.h"
|
||||
|
||||
namespace Assimp {
|
||||
namespace FBX {
|
||||
|
||||
using namespace Util;
|
||||
using namespace Util;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& /*doc*/)
|
||||
|
|
|
@ -181,11 +181,8 @@ void OptimizeMeshesProcess::ProcessNode( aiNode* pNode)
|
|||
verts += mScene->mMeshes[am]->mNumVertices;
|
||||
faces += mScene->mMeshes[am]->mNumFaces;
|
||||
|
||||
pNode->mMeshes[a] = pNode->mMeshes[pNode->mNumMeshes - 1];
|
||||
--pNode->mNumMeshes;
|
||||
for( unsigned int n = a; n < pNode->mNumMeshes; ++n ) {
|
||||
pNode->mMeshes[ n ] = pNode->mMeshes[ n + 1 ];
|
||||
}
|
||||
|
||||
--a;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,21 +52,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <map>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Profiling {
|
||||
|
||||
using namespace Formatter;
|
||||
namespace Profiling {
|
||||
|
||||
using namespace Formatter;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/** Simple wrapper around boost::timer to simplify reporting. Timings are automatically
|
||||
* dumped to the log file.
|
||||
*/
|
||||
class Profiler
|
||||
{
|
||||
|
||||
class Profiler {
|
||||
public:
|
||||
|
||||
Profiler() {}
|
||||
Profiler() {
|
||||
// empty
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
@ -84,17 +82,17 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
auto elapsedSeconds = std::chrono::system_clock::now() - regions[region];
|
||||
std::chrono::duration<double> elapsedSeconds = std::chrono::system_clock::now() - regions[region];
|
||||
DefaultLogger::get()->debug((format("END `"),region,"`, dt= ", elapsedSeconds.count()," s"));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<std::string,std::chrono::time_point<std::chrono::system_clock>> RegionMap;
|
||||
RegionMap regions;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,12 +64,11 @@ class ASSIMP_API LogStream
|
|||
{
|
||||
protected:
|
||||
/** @brief Default constructor */
|
||||
LogStream() {
|
||||
}
|
||||
LogStream();
|
||||
|
||||
public:
|
||||
/** @brief Virtual destructor */
|
||||
virtual ~LogStream() {
|
||||
}
|
||||
virtual ~LogStream();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Overwrite this for your own output methods
|
||||
|
@ -94,6 +93,17 @@ public:
|
|||
IOSystem* io = NULL);
|
||||
|
||||
}; // !class LogStream
|
||||
|
||||
inline
|
||||
LogStream::LogStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
inline
|
||||
LogStream::~LogStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
} // Namespace Assimp
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ ASSIMP_API void aiSetImportPropertyInteger(
|
|||
ASSIMP_API void aiSetImportPropertyFloat(
|
||||
C_STRUCT aiPropertyStore* store,
|
||||
const char* szName,
|
||||
float value);
|
||||
ai_real value);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
/** Set a string property.
|
||||
|
|
|
@ -119,7 +119,10 @@ def _init(self, target = None, parent = None):
|
|||
|
||||
if m == 'mName':
|
||||
obj = self.mName
|
||||
uni = unicode(obj.data, errors='ignore')
|
||||
try:
|
||||
uni = unicode(obj.data, errors='ignore')
|
||||
except:
|
||||
uni = str(obj.data, errors='ignore')
|
||||
target.name = str( uni )
|
||||
target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + x.name + ")"
|
||||
target.__class__.__str__ = lambda x: x.name
|
||||
|
@ -440,7 +443,10 @@ def _get_properties(properties, length):
|
|||
for p in [properties[i] for i in range(length)]:
|
||||
#the name
|
||||
p = p.contents
|
||||
uni = unicode(p.mKey.data, errors='ignore')
|
||||
try:
|
||||
uni = unicode(p.mKey.data, errors='ignore')
|
||||
except:
|
||||
uni = str(p.mKey.data, errors='ignore')
|
||||
key = (str(uni).split('.')[1], p.mSemantic)
|
||||
|
||||
#the data
|
||||
|
@ -449,7 +455,10 @@ def _get_properties(properties, length):
|
|||
arr = cast(p.mData, POINTER(c_float * int(p.mDataLength/sizeof(c_float)) )).contents
|
||||
value = [x for x in arr]
|
||||
elif p.mType == 3: #string can't be an array
|
||||
uni = unicode(cast(p.mData, POINTER(structs.MaterialPropertyString)).contents.data, errors='ignore')
|
||||
try:
|
||||
uni = unicode(cast(p.mData, POINTER(structs.MaterialPropertyString)).contents.data, errors='ignore')
|
||||
except:
|
||||
uni = str(cast(p.mData, POINTER(structs.MaterialPropertyString)).contents.data, errors='ignore')
|
||||
value = uni
|
||||
|
||||
elif p.mType == 4:
|
||||
|
@ -476,3 +485,4 @@ def decompose_matrix(matrix):
|
|||
from ctypes import byref, pointer
|
||||
_assimp_lib.dll.aiDecomposeMatrix(pointer(matrix), byref(scaling), byref(rotation), byref(position))
|
||||
return scaling._init(), rotation._init(), position._init()
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ SOURCE_GROUP( unit FILES
|
|||
)
|
||||
|
||||
SET( TEST_SRCS
|
||||
unit/UTLogStream.h
|
||||
unit/AbstractImportExportBase.cpp
|
||||
unit/TestIOSystem.h
|
||||
unit/TestModelFactory.h
|
||||
|
@ -129,6 +130,7 @@ SET( TEST_SRCS
|
|||
unit/utVector3.cpp
|
||||
unit/utXImporterExporter.cpp
|
||||
unit/utD3MFImportExport.cpp
|
||||
unit/utProfiler.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP( tests FILES ${TEST_SRCS} )
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <assimp/LogStream.hpp>
|
||||
|
||||
class UTLogStream : public Assimp::LogStream {
|
||||
public:
|
||||
UTLogStream()
|
||||
: LogStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual ~UTLogStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual void write(const char* message) {
|
||||
if ( nullptr != message ) {
|
||||
m_messages.push_back( std::string( message ) );
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> m_messages;
|
||||
};
|
|
@ -1,8 +1,44 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
// #ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||
// # include <boost/thread.hpp>
|
||||
// #endif
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// We need to be sure to have the same STL settings as Assimp
|
||||
|
||||
|
@ -10,6 +46,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <memory>
|
||||
#include <math.h>
|
||||
#include "UTLogStream.h"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
#include "UTLogStream.h"
|
||||
#include "code/Profiler.h"
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
|
||||
using namespace ::Assimp;
|
||||
using namespace ::Assimp::Profiling;
|
||||
|
||||
class utProfiler : public ::testing::Test {
|
||||
public:
|
||||
LogStream *m_stream;
|
||||
|
||||
/*virtual void SetUp() {
|
||||
m_stream = new UTLogStream;
|
||||
DefaultLogger::create();
|
||||
DefaultLogger::get()->attachStream( m_stream );
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
DefaultLogger::get()->detatchStream( m_stream );
|
||||
m_stream = nullptr;
|
||||
}*/
|
||||
};
|
||||
|
||||
TEST_F( utProfiler, addRegion_success ) {
|
||||
Profiler myProfiler;
|
||||
myProfiler.BeginRegion( "t1" );
|
||||
for ( int i=0; i<10; i++ ) {
|
||||
volatile int j=0;
|
||||
j++;
|
||||
}
|
||||
myProfiler.EndRegion( "t1" );
|
||||
//UTLogStream *stream( (UTLogStream*) m_stream );
|
||||
//EXPECT_FALSE( stream->m_messages.empty() );
|
||||
}
|
Loading…
Reference in New Issue