Merge branch 'master' into coverity_scan
commit
dadc656d3a
|
@ -10,7 +10,6 @@ language: cpp
|
||||||
|
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
cmake . -DASSIMP_ENABLE_BOOST_WORKAROUND=YES
|
cmake . -DASSIMP_ENABLE_BOOST_WORKAROUND=YES
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
LineReader(StreamReaderLE& reader)
|
LineReader(StreamReaderLE& reader)
|
||||||
// do NOT skip empty lines. In DXF files, they count as valid data.
|
// do NOT skip empty lines. In DXF files, they count as valid data.
|
||||||
: splitter(reader,false,true)
|
: splitter(reader,false,true)
|
||||||
|
, groupcode( 0 )
|
||||||
|
, value()
|
||||||
, end()
|
, end()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@ public:
|
||||||
note: trim is *always* assumed true if skyp_empty_lines==true
|
note: trim is *always* assumed true if skyp_empty_lines==true
|
||||||
*/
|
*/
|
||||||
LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true)
|
LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true)
|
||||||
: stream(stream)
|
: idx( 0 )
|
||||||
|
, stream(stream)
|
||||||
, swallow()
|
, swallow()
|
||||||
, skip_empty_lines(skip_empty_lines)
|
, skip_empty_lines(skip_empty_lines)
|
||||||
, trim(trim)
|
, trim(trim)
|
||||||
|
@ -94,6 +95,10 @@ public:
|
||||||
idx = 0;
|
idx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~LineSplitter() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
|
@ -227,7 +232,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
LineSplitter( const LineSplitter & );
|
||||||
|
LineSplitter &operator = ( const LineSplitter & );
|
||||||
|
|
||||||
|
private:
|
||||||
line_idx idx;
|
line_idx idx;
|
||||||
std::string cur;
|
std::string cur;
|
||||||
StreamReaderLE& stream;
|
StreamReaderLE& stream;
|
||||||
|
|
|
@ -172,13 +172,14 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
|
||||||
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
|
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
|
||||||
{
|
{
|
||||||
delete pcMesh->mBones[i]->mWeights;
|
delete pcMesh->mBones[i]->mWeights;
|
||||||
if (!newWeights[i].empty())
|
if (!newWeights[i].empty()) {
|
||||||
{
|
|
||||||
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
|
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
|
||||||
memcpy(pcMesh->mBones[i]->mWeights,&newWeights[i][0],
|
memcpy(pcMesh->mBones[i]->mWeights, &newWeights[i][0],
|
||||||
sizeof(aiVertexWeight) * newWeights[i].size());
|
sizeof(aiVertexWeight) * newWeights[i].size());
|
||||||
|
delete[] newWeights;
|
||||||
|
} else {
|
||||||
|
pcMesh->mBones[i]->mWeights = NULL;
|
||||||
}
|
}
|
||||||
else pcMesh->mBones[i]->mWeights = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the old members
|
// delete the old members
|
||||||
|
|
|
@ -801,19 +801,6 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
|
||||||
bool isSpecialRootDir(aiString &texName) {
|
|
||||||
if (texName.length < 2) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texName.data[0] = '/' || texName.data[1] == '/') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
||||||
if( NULL == node ) {
|
if( NULL == node ) {
|
||||||
|
|
|
@ -312,6 +312,7 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
|
||||||
p_pcOut->mNumVertices = iNum;
|
p_pcOut->mNumVertices = iNum;
|
||||||
if( 0 == iNum ) { // nothing to do
|
if( 0 == iNum ) { // nothing to do
|
||||||
delete[] aiSplit; // cleanup
|
delete[] aiSplit; // cleanup
|
||||||
|
delete p_pcOut;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p_pcOut->mVertices = new aiVector3D[iNum];
|
p_pcOut->mVertices = new aiVector3D[iNum];
|
||||||
|
|
|
@ -95,12 +95,16 @@ void FindMeshCenter (aiMesh* mesh, aiVector3D& out, aiVector3D& min, aiVector3D&
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector3D& max)
|
void FindSceneCenter (aiScene* scene, aiVector3D& out, aiVector3D& min, aiVector3D& max) {
|
||||||
{
|
if ( NULL == scene ) {
|
||||||
if (scene->mNumMeshes == 0) return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 0 == scene->mNumMeshes ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
FindMeshCenter(scene->mMeshes[0], out, min, max);
|
FindMeshCenter(scene->mMeshes[0], out, min, max);
|
||||||
for (unsigned int i = 1; i < scene->mNumMeshes; ++i)
|
for (unsigned int i = 1; i < scene->mNumMeshes; ++i) {
|
||||||
{
|
|
||||||
aiVector3D tout, tmin, tmax;
|
aiVector3D tout, tmin, tmax;
|
||||||
FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax);
|
FindMeshCenter(scene->mMeshes[i], tout, tmin, tmax);
|
||||||
if (min[0] > tmin[0]) min[0] = tmin[0];
|
if (min[0] > tmin[0]) min[0] = tmin[0];
|
||||||
|
@ -151,6 +155,8 @@ float ComputePositionEpsilon(const aiMesh* pMesh)
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
float ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num)
|
float ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num)
|
||||||
{
|
{
|
||||||
|
ai_assert( NULL != pMeshes );
|
||||||
|
|
||||||
const float epsilon = 1e-4f;
|
const float epsilon = 1e-4f;
|
||||||
|
|
||||||
// calculate the position bounds so we have a reliable epsilon to check position differences against
|
// calculate the position bounds so we have a reliable epsilon to check position differences against
|
||||||
|
|
|
@ -55,7 +55,7 @@ using namespace Assimp;
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
RemoveRedundantMatsProcess::RemoveRedundantMatsProcess()
|
RemoveRedundantMatsProcess::RemoveRedundantMatsProcess()
|
||||||
{
|
: configFixedMaterials() {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,16 +126,18 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: reimplement this algorithm to work in-place
|
// TODO: re-implement this algorithm to work in-place
|
||||||
unsigned int* aiMappingTable = new unsigned int[pScene->mNumMaterials];
|
unsigned int *aiMappingTable = new unsigned int[pScene->mNumMaterials];
|
||||||
|
for ( unsigned int i=0; i<pScene->mNumMaterials; i++ ) {
|
||||||
|
aiMappingTable[ i ] = 0;
|
||||||
|
}
|
||||||
unsigned int iNewNum = 0;
|
unsigned int iNewNum = 0;
|
||||||
|
|
||||||
// Iterate through all materials and calculate a hash for them
|
// Iterate through all materials and calculate a hash for them
|
||||||
// store all hashes in a list and so a quick search whether
|
// store all hashes in a list and so a quick search whether
|
||||||
// we do already have a specific hash. This allows us to
|
// we do already have a specific hash. This allows us to
|
||||||
// determine which materials are identical.
|
// determine which materials are identical.
|
||||||
uint32_t* aiHashes;
|
uint32_t *aiHashes = new uint32_t[ pScene->mNumMaterials ];;
|
||||||
aiHashes = new uint32_t[pScene->mNumMaterials];
|
|
||||||
for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
|
for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
|
||||||
{
|
{
|
||||||
// No mesh is referencing this material, remove it.
|
// No mesh is referencing this material, remove it.
|
||||||
|
@ -177,18 +179,18 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
|
||||||
|
|
||||||
// generate new names for all modified materials
|
// generate new names for all modified materials
|
||||||
const unsigned int idx = aiMappingTable[p];
|
const unsigned int idx = aiMappingTable[p];
|
||||||
if (ppcMaterials[idx])
|
if (ppcMaterials[idx]) {
|
||||||
{
|
|
||||||
aiString sz;
|
aiString sz;
|
||||||
sz.length = ::sprintf(sz.data,"JoinedMaterial_#%u",p);
|
sz.length = ::sprintf(sz.data,"JoinedMaterial_#%u",p);
|
||||||
((aiMaterial*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME);
|
((aiMaterial*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
ppcMaterials[idx] = pScene->mMaterials[p];
|
ppcMaterials[idx] = pScene->mMaterials[p];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// update all material indices
|
// update all material indices
|
||||||
for (unsigned int p = 0; p < pScene->mNumMeshes;++p) {
|
for (unsigned int p = 0; p < pScene->mNumMeshes;++p) {
|
||||||
aiMesh* mesh = pScene->mMeshes[p];
|
aiMesh* mesh = pScene->mMeshes[p];
|
||||||
|
ai_assert( NULL!=mesh );
|
||||||
mesh->mMaterialIndex = aiMappingTable[mesh->mMaterialIndex];
|
mesh->mMaterialIndex = aiMappingTable[mesh->mMaterialIndex];
|
||||||
}
|
}
|
||||||
// delete the old material list
|
// delete the old material list
|
||||||
|
|
|
@ -863,6 +863,7 @@ namespace STEP {
|
||||||
: reader(reader)
|
: reader(reader)
|
||||||
, splitter(*reader,true,true)
|
, splitter(*reader,true,true)
|
||||||
, evaluated_count()
|
, evaluated_count()
|
||||||
|
, schema( NULL )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue