Merge branch 'master' into coverity_scan

This commit is contained in:
Kim Kulling
2016-05-13 14:28:11 +02:00
253 changed files with 15293 additions and 7627 deletions

View File

@@ -1,3 +1,40 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
#
# Copyright (c) 2006-2016, 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.
#
#----------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6 )
INCLUDE_DIRECTORIES(

View File

@@ -245,7 +245,7 @@ private:
/** print our 'stack' */
std::string print_hierarchy() {
std::stringstream ss;
ss << std::endl;
ss << "\n";
const char* last = history.back().first.c_str();
std::string pad;
@@ -253,14 +253,16 @@ private:
for(ChunkHistory::reverse_iterator rev = history.rbegin(),
end = history.rend(); rev != end; ++rev, pad += " ")
{
ss << pad << (*rev).first << "(Index: " << (*rev).second[last] << ")" << std::endl;
ss << pad << (*rev).first << "(Index: " << (*rev).second[last] << ")" << "\n";
last = (*rev).first.c_str();
}
ss << std::endl << "Debug trace: "<< std::endl;
ss << std::endl << "Debug trace: "<< "\n";
for (std::vector<std::string>::const_iterator it = debug_trace.begin(); it != debug_trace.end(); ++it) {
ss << *it << std::endl;
ss << *it << "\n";
}
ss << std::flush;
return ss.str();
}

View File

@@ -58,7 +58,6 @@ const char* AICMD_MSG_DUMP_HELP =
;
#include "../../code/assbin_chunks.h"
#include <boost/static_assert.hpp>
FILE* out = NULL;
bool shortened = false;
@@ -151,7 +150,7 @@ inline uint32_t Write<uint16_t>(const uint16_t& w)
template <>
inline uint32_t Write<float>(const float& f)
{
BOOST_STATIC_ASSERT(sizeof(float)==4);
static_assert(sizeof(float)==4, "sizeof(float)==4");
fwrite(&f,4,1,out);
return 4;
}
@@ -161,7 +160,7 @@ inline uint32_t Write<float>(const float& f)
template <>
inline uint32_t Write<double>(const double& f)
{
BOOST_STATIC_ASSERT(sizeof(double)==8);
static_assert(sizeof(double)==8, "sizeof(double)==8");
fwrite(&f,8,1,out);
return 8;
}
@@ -424,7 +423,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
uint32_t tmp = f.mNumIndices;
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
for (unsigned int i = 0; i < f.mNumIndices; ++i) {
BOOST_STATIC_ASSERT(AI_MAX_VERTICES <= 0xffffffff);
static_assert(AI_MAX_VERTICES <= 0xffffffff, "AI_MAX_VERTICES <= 0xffffffff");
tmp = static_cast<uint32_t>( f.mIndices[i] );
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
}
@@ -438,7 +437,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
const aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff);
static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
len += Write<uint16_t>(f.mNumIndices);
for (unsigned int a = 0; a < f.mNumIndices;++a) {

View File

@@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "assimp_view.h"
#include <tuple>
using namespace AssimpView;
@@ -49,7 +50,7 @@ AnimEvaluator::AnimEvaluator( const aiAnimation* pAnim)
{
mAnim = pAnim;
mLastTime = 0.0;
mLastPositions.resize( pAnim->mNumChannels, boost::make_tuple( 0, 0, 0));
mLastPositions.resize( pAnim->mNumChannels, std::make_tuple( 0, 0, 0));
}
// ------------------------------------------------------------------------------------------------
@@ -80,7 +81,7 @@ void AnimEvaluator::Evaluate( double pTime)
{
// Look for present frame number. Search from last position if time is after the last time, else from beginning
// Should be much quicker than always looking from start for the average use case.
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<0>() : 0;
unsigned int frame = (time >= mLastTime) ? std::get<0>(mLastPositions[a]) : 0;
while( frame < channel->mNumPositionKeys - 1)
{
if( time < channel->mPositionKeys[frame+1].mTime)
@@ -104,14 +105,14 @@ void AnimEvaluator::Evaluate( double pTime)
presentPosition = key.mValue;
}
mLastPositions[a].get<0>() = frame;
std::get<0>(mLastPositions[a]) = frame;
}
// ******** Rotation *********
aiQuaternion presentRotation( 1, 0, 0, 0);
if( channel->mNumRotationKeys > 0)
{
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<1>() : 0;
unsigned int frame = (time >= mLastTime) ? std::get<1>(mLastPositions[a]) : 0;
while( frame < channel->mNumRotationKeys - 1)
{
if( time < channel->mRotationKeys[frame+1].mTime)
@@ -135,14 +136,14 @@ void AnimEvaluator::Evaluate( double pTime)
presentRotation = key.mValue;
}
mLastPositions[a].get<1>() = frame;
std::get<1>(mLastPositions[a]) = frame;
}
// ******** Scaling **********
aiVector3D presentScaling( 1, 1, 1);
if( channel->mNumScalingKeys > 0)
{
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<2>() : 0;
unsigned int frame = (time >= mLastTime) ? std::get<2>(mLastPositions[a]) : 0;
while( frame < channel->mNumScalingKeys - 1)
{
if( time < channel->mScalingKeys[frame+1].mTime)
@@ -152,7 +153,7 @@ void AnimEvaluator::Evaluate( double pTime)
// TODO: (thom) interpolation maybe? This time maybe even logarithmic, not linear
presentScaling = channel->mScalingKeys[frame].mValue;
mLastPositions[a].get<2>() = frame;
std::get<2>(mLastPositions[a]) = frame;
}
// build a transformation matrix from it

View File

@@ -43,7 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AV_ANIMEVALUATOR_H_INCLUDED
#define AV_ANIMEVALUATOR_H_INCLUDED
#include <boost/tuple/tuple.hpp>
#include <tuple>
#include <vector>
namespace AssimpView
{
@@ -80,7 +81,7 @@ protected:
* Useful to quickly find the corresponding frame for slightly increased time stamps
*/
double mLastTime;
std::vector<boost::tuple<unsigned int, unsigned int, unsigned int> > mLastPositions;
std::vector<std::tuple<unsigned int, unsigned int, unsigned int> > mLastPositions;
/** The array to store the transformations results of the evaluation */
std::vector<aiMatrix4x4> mTransforms;

View File

@@ -1,3 +1,40 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
#
# Copyright (c) 2006-2016, 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.
#
#----------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6 )
FIND_PACKAGE(DirectX REQUIRED)

View File

@@ -1104,7 +1104,7 @@ int CDisplay::OnSetup(HTREEITEM p_hTreeItem)
return OnSetupTextureView(pcNew);
}
// seach the node list
// search the node list
for (std::vector<NodeInfo>::iterator i = m_asNodes.begin(); i != m_asNodes.end();++i){
if (p_hTreeItem == (*i).hTreeItem) {
pcNew2 = &(*i);
@@ -1115,7 +1115,7 @@ int CDisplay::OnSetup(HTREEITEM p_hTreeItem)
return OnSetupNodeView(pcNew2);
}
// seach the material list
// search the material list
for (std::vector<MaterialInfo>::iterator i = m_asMaterials.begin();i != m_asMaterials.end();++i){
if (p_hTreeItem == (*i).hTreeItem){
pcNew3 = &(*i);

View File

@@ -605,7 +605,7 @@ void CMaterialManager::HMtoNMIfNecessary(
*piTextureOut = piTexture;
// Lock the input texture and try to determine its type.
// Criterias:
// Criteria:
// - If r,g,b channel are identical it MUST be a height map
// - If one of the rgb channels is used and the others are empty it
// must be a height map, too.

View File

@@ -194,7 +194,7 @@ enum EClickPos
{
// The click was inside the inner circle (x,y axis)
EClickPos_Circle,
// The click was inside one of tghe vertical snap-ins
// The click was inside one of the vertical snap-ins
EClickPos_CircleVert,
// The click was inside onf of the horizontal snap-ins
EClickPos_CircleHor,