Replaced BOOST_FOREACH with c++11 ranged for loops

pull/850/head
mensinda 2016-04-05 22:53:54 +02:00
parent 4836a2993e
commit 18843fe5e1
33 changed files with 209 additions and 236 deletions

View File

@ -48,13 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h"
#include "StreamReader.h"
#include "fast_atof.h"
#include <boost/foreach.hpp>
using namespace Assimp;
using namespace Assimp::Blender;
using namespace Assimp::Formatter;
#define for_each BOOST_FOREACH
bool match4(StreamReaderAny& stream, const char* string) {
char tmp[] = {
(stream).GetI1(),
@ -86,7 +84,7 @@ void DNAParser :: Parse ()
}
std::vector<std::string> names (stream.GetI4());
for_each(std::string& s, names) {
for(std::string& s : names) {
while (char c = stream.GetI1()) {
s += c;
}
@ -99,7 +97,7 @@ void DNAParser :: Parse ()
}
std::vector<Type> types (stream.GetI4());
for_each(Type& s, types) {
for(Type& s : types) {
while (char c = stream.GetI1()) {
s.name += c;
}
@ -111,7 +109,7 @@ void DNAParser :: Parse ()
throw DeadlyImportError("BlenderDNA: Expected TLEN field");
}
for_each(Type& s, types) {
for(Type& s : types) {
s.size = stream.GetI2();
}
@ -238,9 +236,9 @@ void DNA :: DumpToFile()
f << "Field format: type name offset size" << "\n";
f << "Structure format: name size" << "\n";
for_each(const Structure& s, structures) {
for(const Structure& s : structures) {
f << s.name << " " << s.size << "\n\n";
for_each(const Field& ff, s.fields) {
for(const Field& ff : s.fields) {
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl;
}
f << std::endl;

View File

@ -49,14 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderDNA.h"
#include "BlenderScene.h"
#include "BlenderSceneGen.h"
#include <boost/foreach.hpp>
#include <deque>
#include "./../include/assimp/material.h"
struct aiTexture;
#define for_each(x,y) BOOST_FOREACH(x,y)
namespace Assimp {
namespace Blender {
@ -71,7 +68,7 @@ namespace Blender {
}
~TempArray () {
for_each(T* elem, arr) {
for(T* elem : arr) {
delete elem;
}
}

View File

@ -305,7 +305,7 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
const Structure& ss = file.dna.structures[(*it).second];
// we need a scene somewhere to start with.
for_each(const FileBlockHead& bl,file.entries) {
for(const FileBlockHead& bl :file.entries) {
// Fix: using the DNA index is more reliable to locate scenes
//if (bl.id == "SC") {
@ -560,7 +560,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
// add a default material if necessary
unsigned int index = static_cast<unsigned int>( -1 );
for_each( aiMesh* mesh, conv_data.meshes.get() ) {
for( aiMesh* mesh : conv_data.meshes.get() ) {
if (mesh->mMaterialIndex == static_cast<unsigned int>( -1 )) {
if (index == static_cast<unsigned int>( -1 )) {
@ -589,7 +589,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
}
}
for_each(boost::shared_ptr<Material> mat, conv_data.materials_raw) {
for(boost::shared_ptr<Material> mat : conv_data.materials_raw) {
// reset per material global counters
for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) {
@ -722,7 +722,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
temp->reserve(temp->size() + per_mat.size());
std::map<size_t,size_t> mat_num_to_mesh_idx;
for_each(MyPair& it, per_mat) {
for(MyPair& it : per_mat) {
mat_num_to_mesh_idx[it.first] = temp->size();
temp->push_back(new aiMesh());
@ -1157,7 +1157,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
if (children.size()) {
node->mNumChildren = static_cast<unsigned int>(children.size());
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
for_each (const Object* nobj,children) {
for (const Object* nobj :children) {
*nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform);
(*nd++)->mParent = node;
}

View File

@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "./../include/assimp/cexport.h"
#include "./../include/assimp/IOSystem.hpp"
#include "./../include/assimp/DefaultLogger.hpp"
#include <boost/foreach.hpp>
#include <stdint.h>
#include <set>
#include <vector>
@ -224,7 +223,7 @@ public:
virtual ~BlobIOSystem()
{
BOOST_FOREACH(BlobEntry& blobby, blobs) {
for(BlobEntry& blobby : blobs) {
delete blobby.second;
}
}
@ -243,7 +242,7 @@ public:
{
// one must be the master
aiExportDataBlob* master = NULL, *cur;
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
for(const BlobEntry& blobby : blobs) {
if (blobby.first == AI_BLOBIO_MAGIC) {
master = blobby.second;
break;
@ -257,7 +256,7 @@ public:
master->name.Set("");
cur = master;
BOOST_FOREACH(const BlobEntry& blobby, blobs) {
for(const BlobEntry& blobby : blobs) {
if (blobby.second == master) {
continue;
}

View File

@ -161,7 +161,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
RecurseHierarchy(doc->GetFirstObject(), pScene->mRootNode);
}
catch(...) {
BOOST_FOREACH(aiMesh* mesh, meshes) {
for(aiMesh* mesh : meshes) {
delete mesh;
}
BaseDocument::Free(doc);
@ -176,7 +176,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// copy materials over, adding a default material if necessary
unsigned int mat_count = static_cast<unsigned int>(materials.size());
BOOST_FOREACH(aiMesh* mesh, meshes) {
for(aiMesh* mesh : meshes) {
ai_assert(mesh->mMaterialIndex <= mat_count);
if(mesh->mMaterialIndex >= mat_count) {
++mat_count;

View File

@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "LineSplitter.h"
#include "TinyFormatter.h"
#include <boost/scoped_ptr.hpp>
#include <boost/foreach.hpp>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
@ -64,8 +63,6 @@ using namespace Assimp;
using namespace Assimp::COB;
using namespace Assimp::Formatter;
#define for_each BOOST_FOREACH
static const float units[] = {
1000.f,
@ -170,17 +167,17 @@ void COBImporter::InternReadFile( const std::string& pFile,
}
// sort faces by material indices
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(boost::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
Mesh& mesh = (Mesh&)(*n.get());
for_each(Face& f,mesh.faces) {
for(Face& f : mesh.faces) {
mesh.temp_map[f.material].push_back(&f);
}
}
}
// count meshes
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(boost::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_MESH) {
Mesh& mesh = (Mesh&)(*n.get());
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
@ -193,7 +190,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
pScene->mNumMeshes = 0;
// count lights and cameras
for_each(boost::shared_ptr< Node >& n,scene.nodes) {
for(boost::shared_ptr< Node >& n : scene.nodes) {
if (n->type == Node::TYPE_LIGHT) {
++pScene->mNumLights;
}
@ -251,10 +248,10 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
if (ndmesh.vertex_positions.size() && ndmesh.texture_coords.size()) {
typedef std::pair<unsigned int,Mesh::FaceRefList> Entry;
for_each(const Entry& reflist,ndmesh.temp_map) {
for(const Entry& reflist : ndmesh.temp_map) {
{ // create mesh
size_t n = 0;
for_each(Face* f, reflist.second) {
for(Face* f : reflist.second) {
n += f->indices.size();
}
if (!n) {
@ -267,7 +264,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
outmesh->mTextureCoords[0] = new aiVector3D[n];
outmesh->mFaces = new aiFace[reflist.second.size()]();
for_each(Face* f, reflist.second) {
for(Face* f : reflist.second) {
if (f->indices.empty()) {
continue;
}
@ -275,7 +272,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
aiFace& fout = outmesh->mFaces[outmesh->mNumFaces++];
fout.mIndices = new unsigned int[f->indices.size()];
for_each(VertexIndex& v, f->indices) {
for(VertexIndex& v : f->indices) {
if (v.pos_idx >= ndmesh.vertex_positions.size()) {
ThrowException("Position index out of range");
}
@ -295,7 +292,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
outmesh->mMaterialIndex = fill->mNumMaterials;
}{ // create material
const Material* min = NULL;
for_each(const Material& m, scin.materials) {
for(const Material& m : scin.materials) {
if (m.parent_id == ndmesh.id && m.matnum == reflist.first) {
min = &m;
break;
@ -396,7 +393,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
// add children recursively
nd->mChildren = new aiNode*[root.temp_children.size()]();
for_each(const Node* n, root.temp_children) {
for(const Node* n : root.temp_children) {
(nd->mChildren[nd->mNumChildren++] = BuildNodes(*n,scin,fill))->mParent = nd;
}
@ -647,7 +644,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
// parent chunks preceede their childs, so we should have the
// corresponding chunk already.
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
for(boost::shared_ptr< Node >& nd : out.nodes) {
if (nd->id == nfo.parent_id) {
const unsigned int t=strtoul10(splitter[1]);
@ -903,7 +900,7 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
void COBImporter::ReadString_Binary(std::string& out, StreamReaderLE& reader)
{
out.resize( reader.GetI2());
for_each(char& c,out) {
for(char& c : out) {
c = reader.GetI1();
}
}
@ -1043,14 +1040,14 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
ReadBasicNodeInfo_Binary(msh,reader,nfo);
msh.vertex_positions.resize(reader.GetI4());
for_each(aiVector3D& v,msh.vertex_positions) {
for(aiVector3D& v : msh.vertex_positions) {
v.x = reader.GetF4();
v.y = reader.GetF4();
v.z = reader.GetF4();
}
msh.texture_coords.resize(reader.GetI4());
for_each(aiVector2D& v,msh.texture_coords) {
for(aiVector2D& v : msh.texture_coords) {
v.x = reader.GetF4();
v.y = reader.GetF4();
}
@ -1283,7 +1280,7 @@ void COBImporter::ReadUnit_Binary(COB::Scene& out, StreamReaderLE& reader, const
// parent chunks preceede their childs, so we should have the
// corresponding chunk already.
for_each(boost::shared_ptr< Node >& nd, out.nodes) {
for(boost::shared_ptr< Node >& nd : out.nodes) {
if (nd->id == nfo.parent_id) {
const unsigned int t=reader.GetI2();
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(

View File

@ -56,7 +56,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "time.h"
#include "math.h"
#include <boost/foreach.hpp>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Importer.hpp"
#include <numeric>
@ -317,7 +316,7 @@ void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler
// Builds lights for the given node and references them
void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
{
BOOST_FOREACH( const Collada::LightInstance& lid, pNode->mLights)
for( const Collada::LightInstance& lid : pNode->mLights)
{
// find the referred light
ColladaParser::LightLibrary::const_iterator srcLightIt = pParser.mLightLibrary.find( lid.mLight);
@ -385,7 +384,7 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
// Builds cameras for the given node and references them
void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, aiNode* pTarget)
{
BOOST_FOREACH( const Collada::CameraInstance& cid, pNode->mCameras)
for( const Collada::CameraInstance& cid : pNode->mCameras)
{
// find the referred light
ColladaParser::CameraLibrary::const_iterator srcCameraIt = pParser.mCameraLibrary.find( cid.mCamera);
@ -447,7 +446,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
newMeshRefs.reserve(pNode->mMeshes.size());
// add a mesh for each subgroup in each collada mesh
BOOST_FOREACH( const Collada::MeshInstance& mid, pNode->mMeshes)
for( const Collada::MeshInstance& mid : pNode->mMeshes)
{
const Collada::Mesh* srcMesh = NULL;
const Collada::Controller* srcController = NULL;
@ -1170,7 +1169,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
}
++pos;
}
// https://github.com/assimp/assimp/issues/458
// Sub-sample axis-angle channels if the delta between two consecutive
// key-frame angles is >= 180 degrees.

View File

@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fast_atof.h"
#include "ParsingUtils.h"
#include <boost/scoped_ptr.hpp>
#include <boost/foreach.hpp>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/light.h"
@ -529,10 +528,10 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
// it turned out to have channels - add them
if( !channels.empty())
{
// FIXME: Is this essentially doing the same as "single-anim-node" codepath in
// FIXME: Is this essentially doing the same as "single-anim-node" codepath in
// ColladaLoader::StoreAnimations? For now, this has been deferred to after
// all animations and all clips have been read. Due to handling of
// <library_animation_clips> this cannot be done here, as the channel owner
// all animations and all clips have been read. Due to handling of
// <library_animation_clips> this cannot be done here, as the channel owner
// is lost, and some exporters make up animations by referring to multiple
// single-channel animations from an <instance_animation>.
/*
@ -1404,7 +1403,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
pEffect.mHasTransparency = true;
const char* opaque = mReader->getAttributeValueSafe("opaque");
if(::strcmp(opaque, "RGB_ZERO") == 0 || ::strcmp(opaque, "RGB_ONE") == 0) {
pEffect.mRGBTransparency = true;
}
@ -2249,7 +2248,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
// find the offset index for all per-vertex channels
size_t numOffsets = 1;
size_t perVertexOffset = SIZE_MAX; // invalid value
BOOST_FOREACH( const InputChannel& channel, pPerIndexChannels)
for( const InputChannel& channel : pPerIndexChannels)
{
numOffsets = std::max( numOffsets, channel.mOffset+1);
if( channel.mType == IT_Vertex)
@ -2262,7 +2261,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
{
case Prim_Polylist:
{
BOOST_FOREACH( size_t i, pVCount)
for( size_t i : pVCount)
expectedPointCount += i;
break;
}
@ -2910,14 +2909,14 @@ AI_WONT_RETURN void ColladaParser::ThrowException( const std::string& pError) co
void ColladaParser::ReportWarning(const char* msg,...)
{
ai_assert(NULL != msg);
va_list args;
va_start(args,msg);
char szBuffer[3000];
const int iLen = vsprintf(szBuffer,msg,args);
ai_assert(iLen > 0);
va_end(args);
DefaultLogger::get()->warn("Validation warning: " + std::string(szBuffer,iLen));
}

View File

@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "DXFHelper.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include <boost/foreach.hpp>
#include <numeric>
using namespace Assimp;
@ -222,8 +221,8 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
if (!DefaultLogger::isNullLogger()) {
unsigned int vcount = 0, icount = 0;
BOOST_FOREACH (const DXF::Block& bl, output.blocks) {
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl, bl.lines) {
for (const DXF::Block& bl : output.blocks) {
for (boost::shared_ptr<const DXF::PolyLine> pl : bl.lines) {
vcount += pl->positions.size();
icount += pl->counts.size();
}
@ -242,7 +241,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
// index blocks by name
DXF::BlockMap blocks_by_name;
BOOST_FOREACH (DXF::Block& bl, output.blocks) {
for (DXF::Block& bl : output.blocks) {
blocks_by_name[bl.name] = &bl;
if ( !entities && bl.name == AI_DXF_ENTITIES_MAGIC_BLOCK ) {
entities = &bl;
@ -263,7 +262,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
ExpandBlockReferences(*entities,blocks_by_name);
unsigned int cur = 0;
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl, entities->lines) {
for (boost::shared_ptr<const DXF::PolyLine> pl : entities->lines) {
if (pl->positions.size()) {
std::map<std::string, unsigned int>::iterator it = layers.find(pl->layer);
@ -289,12 +288,12 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ] ();
BOOST_FOREACH(const LayerMap::value_type& elem, layers){
for(const LayerMap::value_type& elem : layers){
aiMesh* const mesh = pScene->mMeshes[elem.second] = new aiMesh();
mesh->mName.Set(elem.first);
unsigned int cvert = 0,cface = 0;
BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){
for(const DXF::PolyLine* pl : corr[elem.second]){
// sum over all faces since we need to 'verbosify' them.
cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0);
cface += pl->counts.size();
@ -309,10 +308,10 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
unsigned int prims = 0;
unsigned int overall_indices = 0;
BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){
for(const DXF::PolyLine* pl : corr[elem.second]){
std::vector<unsigned int>::const_iterator it = pl->indices.begin();
BOOST_FOREACH(unsigned int facenumv,pl->counts) {
for(unsigned int facenumv : pl->counts) {
aiFace& face = *faces++;
face.mIndices = new unsigned int[face.mNumIndices = facenumv];
@ -358,7 +357,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
// ------------------------------------------------------------------------------------------------
void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& blocks_by_name)
{
BOOST_FOREACH (const DXF::InsertBlock& insert, bl.insertions) {
for (const DXF::InsertBlock& insert : bl.insertions) {
// first check if the referenced blocks exists ...
const DXF::BlockMap::const_iterator it = blocks_by_name.find(insert.name);
@ -372,7 +371,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// XXX this would be the place to implement recursive expansion if needed.
const DXF::Block& bl_src = *(*it).second;
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl_in, bl_src.lines) {
for (boost::shared_ptr<const DXF::PolyLine> pl_in : bl_src.lines) {
boost::shared_ptr<DXF::PolyLine> pl_out = boost::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {
@ -388,7 +387,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
DefaultLogger::get()->warn("DXF: BLOCK rotation not currently implemented");
}
BOOST_FOREACH (aiVector3D& v, pl_out->positions) {
for (aiVector3D& v : pl_out->positions) {
v *= trafo;
}
}

View File

@ -491,7 +491,7 @@ const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex
// ------------------------------------------------------------------------------------------------
aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
{
BOOST_FOREACH(const ExportFormatEntry& e, pimpl->mExporters) {
for(const ExportFormatEntry& e : pimpl->mExporters) {
if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
return aiReturn_FAILURE;
}

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImportSettings.h"
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <boost/foreach.hpp>
namespace Assimp {
namespace FBX {
@ -110,7 +109,7 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, cons
const char* whitelist[] = {"Model","NodeAttribute"};
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// link should go for a property
if (!con->PropertyName().length()) {
@ -171,7 +170,7 @@ const AnimationCurveMap& AnimationCurveNode::Curves() const
// resolve attached animation curves
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// link should go for a property
if (!con->PropertyName().length()) {
@ -227,7 +226,7 @@ AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whi
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurveNode");
nodes.reserve(conns.size());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// link should not go to a property
if (con->PropertyName().length()) {
@ -278,7 +277,7 @@ AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::s
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
layers.reserve(conns.size());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// link should not go to a property
if (con->PropertyName().length()) {

View File

@ -55,7 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/scene.h"
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#include <boost/scoped_array.hpp>
#include <iterator>
@ -79,8 +78,8 @@ using namespace Util;
class Converter
{
public:
/**
* The different parts that make up the final local transformation of a fbx-node
/**
* The different parts that make up the final local transformation of a fbx-node
*/
enum TransformationComp
{
@ -144,8 +143,8 @@ private:
// ------------------------------------------------------------------------------------------------
void GetRotationMatrix( Model::RotOrder mode, const aiVector3D& rotation, aiMatrix4x4& out );
// ------------------------------------------------------------------------------------------------
/**
* checks if a node has more than just scaling, rotation and translation components
/**
* checks if a node has more than just scaling, rotation and translation components
*/
bool NeedsComplexTransformationChain( const Model& model );
@ -154,8 +153,8 @@ private:
std::string NameTransformationChainNode( const std::string& name, TransformationComp comp );
// ------------------------------------------------------------------------------------------------
/**
* note: memory for output_nodes will be managed by the caller
/**
* note: memory for output_nodes will be managed by the caller
*/
void GenerateTransformationNodeChain( const Model& model, std::vector<aiNode*>& output_nodes );
@ -192,11 +191,11 @@ private:
// ------------------------------------------------------------------------------------------------
/**
/**
* - if materialIndex == NO_MATERIAL_SEPARATION, materials are not taken into
* account when determining which weights to include.
* - outputVertStartIndices is only used when a material index is specified, it gives for
* each output vertex the DOM index it maps to.
* each output vertex the DOM index it maps to.
*/
void ConvertWeights( aiMesh* out, const Model& model, const MeshGeometry& geo,
const aiMatrix4x4& node_global_transform = aiMatrix4x4(),
@ -457,7 +456,7 @@ Converter::Converter( aiScene* out, const Document& doc )
if ( doc.Settings().readAllMaterials ) {
// unfortunately this means we have to evaluate all objects
BOOST_FOREACH( const ObjectMap::value_type& v, doc.Objects() ) {
for( const ObjectMap::value_type& v : doc.Objects() ) {
const Object* ob = v.second->Get();
if ( !ob ) {
@ -515,7 +514,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
std::vector<aiNode*> nodes_chain;
try {
BOOST_FOREACH( const Connection* con, conns ) {
for( const Connection* con : conns ) {
// ignore object-property links
if ( con->PropertyName().length() ) {
@ -550,7 +549,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
// preserve the name - people might have scripts etc. that rely
// on specific node names.
aiNode* name_carrier = NULL;
BOOST_FOREACH( aiNode* prenode, nodes_chain ) {
for( aiNode* prenode : nodes_chain ) {
if ( !strcmp( prenode->mName.C_Str(), original_name.c_str() ) ) {
name_carrier = prenode;
break;
@ -567,7 +566,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
// link all nodes in a row
aiNode* last_parent = &parent;
BOOST_FOREACH( aiNode* prenode, nodes_chain ) {
for( aiNode* prenode : nodes_chain ) {
ai_assert( prenode );
if ( last_parent != &parent ) {
@ -619,7 +618,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
void Converter::ConvertLights( const Model& model )
{
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
BOOST_FOREACH( const NodeAttribute* attr, node_attrs ) {
for( const NodeAttribute* attr : node_attrs ) {
const Light* const light = dynamic_cast<const Light*>( attr );
if ( light ) {
ConvertLight( model, *light );
@ -630,7 +629,7 @@ void Converter::ConvertLights( const Model& model )
void Converter::ConvertCameras( const Model& model )
{
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
BOOST_FOREACH( const NodeAttribute* attr, node_attrs ) {
for( const NodeAttribute* attr : node_attrs ) {
const Camera* const cam = dynamic_cast<const Camera*>( attr );
if ( cam ) {
ConvertCamera( model, *cam );
@ -1089,7 +1088,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
data->Set( index++, "IsNull", model.IsNull() ? true : false );
// add unparsed properties to the node's metadata
BOOST_FOREACH( const DirectPropertyMap::value_type& prop, unparsedProperties ) {
for( const DirectPropertyMap::value_type& prop : unparsedProperties ) {
// Interpret the property as a concrete type
if ( const TypedProperty<bool>* interpreted = prop.second->As<TypedProperty<bool> >() )
@ -1116,7 +1115,7 @@ void Converter::ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4&
std::vector<unsigned int> meshes;
meshes.reserve( geos.size() );
BOOST_FOREACH( const Geometry* geo, geos ) {
for( const Geometry* geo : geos ) {
const MeshGeometry* const mesh = dynamic_cast< const MeshGeometry* >( geo );
if ( mesh ) {
@ -1160,7 +1159,7 @@ std::vector<unsigned int> Converter::ConvertMesh( const MeshGeometry& mesh, cons
const MatIndexArray& mindices = mesh.GetMaterialIndices();
if ( doc.Settings().readMaterials && !mindices.empty() ) {
const MatIndexArray::value_type base = mindices[ 0 ];
BOOST_FOREACH( MatIndexArray::value_type index, mindices ) {
for( MatIndexArray::value_type index : mindices ) {
if ( index != base ) {
return ConvertMeshMultiMaterial( mesh, model, node_global_transform );
}
@ -1212,7 +1211,7 @@ unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, con
aiFace* fac = out_mesh->mFaces = new aiFace[ faces.size() ]();
unsigned int cursor = 0;
BOOST_FOREACH( unsigned int pcount, faces ) {
for( unsigned int pcount : faces ) {
aiFace& f = *fac++;
f.mNumIndices = pcount;
f.mIndices = new unsigned int[ pcount ];
@ -1287,7 +1286,7 @@ unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, con
}
aiVector3D* out_uv = out_mesh->mTextureCoords[ i ] = new aiVector3D[ vertices.size() ];
BOOST_FOREACH( const aiVector2D& v, uvs ) {
for( const aiVector2D& v : uvs ) {
*out_uv++ = aiVector3D( v.x, v.y, 0.0f );
}
@ -1329,7 +1328,7 @@ std::vector<unsigned int> Converter::ConvertMeshMultiMaterial( const MeshGeometr
std::set<MatIndexArray::value_type> had;
std::vector<unsigned int> indices;
BOOST_FOREACH( MatIndexArray::value_type index, mindices ) {
for( MatIndexArray::value_type index : mindices ) {
if ( had.find( index ) == had.end() ) {
indices.push_back( ConvertMeshMultiMaterial( mesh, model, index, node_global_transform ) );
@ -1537,7 +1536,7 @@ void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeome
try {
BOOST_FOREACH( const Cluster* cluster, sk.Clusters() ) {
for( const Cluster* cluster : sk.Clusters() ) {
ai_assert( cluster );
const WeightIndexArray& indices = cluster->GetIndices();
@ -1558,7 +1557,7 @@ void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeome
// now check if *any* of these weights is contained in the output mesh,
// taking notes so we don't need to do it twice.
BOOST_FOREACH( WeightIndexArray::value_type index, indices ) {
for( WeightIndexArray::value_type index : indices ) {
unsigned int count = 0;
const unsigned int* const out_idx = geo.ToOutputVertexIndex( index, count );
@ -1839,7 +1838,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
uvIndex = -1;
if ( !mesh )
{
BOOST_FOREACH( const MeshMap::value_type& v, meshes_converted ) {
for( const MeshMap::value_type& v : meshes_converted ) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
if ( !mesh ) {
continue;
@ -1957,7 +1956,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
uvIndex = -1;
if ( !mesh )
{
BOOST_FOREACH( const MeshMap::value_type& v, meshes_converted ) {
for( const MeshMap::value_type& v : meshes_converted ) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> ( v.first );
if ( !mesh ) {
continue;
@ -2190,7 +2189,7 @@ void Converter::ConvertAnimations()
anim_fps = FrameRateToDouble( fps, custom );
const std::vector<const AnimationStack*>& animations = doc.AnimationStacks();
BOOST_FOREACH( const AnimationStack* stack, animations ) {
for( const AnimationStack* stack : animations ) {
ConvertAnimationStack( *stack );
}
}
@ -2205,21 +2204,21 @@ void Converter::RenameNode( const std::string& fixed_name, const std::string& ne
const aiString fn( fixed_name );
BOOST_FOREACH( aiCamera* cam, cameras ) {
for( aiCamera* cam : cameras ) {
if ( cam->mName == fn ) {
cam->mName.Set( new_name );
break;
}
}
BOOST_FOREACH( aiLight* light, lights ) {
for( aiLight* light : lights ) {
if ( light->mName == fn ) {
light->mName.Set( new_name );
break;
}
}
BOOST_FOREACH( aiAnimation* anim, animations ) {
for( aiAnimation* anim : animations ) {
for ( unsigned int i = 0; i < anim->mNumChannels; ++i ) {
aiNodeAnim* const na = anim->mChannels[ i ];
if ( na->mNodeName == fn ) {
@ -2299,11 +2298,11 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
"Lcl Translation"
};
BOOST_FOREACH( const AnimationLayer* layer, layers ) {
for( const AnimationLayer* layer : layers ) {
ai_assert( layer );
const AnimationCurveNodeList& nodes = layer->Nodes( prop_whitelist, 3 );
BOOST_FOREACH( const AnimationCurveNode* node, nodes ) {
for( const AnimationCurveNode* node : nodes ) {
ai_assert( node );
const Model* const model = dynamic_cast<const Model*>( node->Target() );
@ -2331,7 +2330,7 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
double stop_timeF = CONVERT_FBX_TIME( stop_time );
try {
BOOST_FOREACH( const NodeMap::value_type& kv, node_map ) {
for( const NodeMap::value_type& kv : node_map ) {
GenerateNodeAnimations( node_anims,
kv.first,
kv.second,
@ -2389,7 +2388,7 @@ void Converter::ConvertAnimationStack( const AnimationStack& st )
static void validateAnimCurveNodes( const std::vector<const AnimationCurveNode*>& curves,
bool strictMode ) {
const Object* target( NULL );
BOOST_FOREACH( const AnimationCurveNode* node, curves ) {
for( const AnimationCurveNode* node : curves ) {
if ( !target ) {
target = node->Target();
}
@ -2419,7 +2418,7 @@ void Converter::GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
validateAnimCurveNodes( curves, doc.Settings().strictMode );
#endif
const AnimationCurveNode* curve_node = NULL;
BOOST_FOREACH( const AnimationCurveNode* node, curves ) {
for( const AnimationCurveNode* node : curves ) {
ai_assert( node );
if ( node->TargetProperty().empty() ) {
@ -2927,11 +2926,11 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
int64_t adj_start = start - 10000;
int64_t adj_stop = stop + 10000;
BOOST_FOREACH( const AnimationCurveNode* node, nodes ) {
for( const AnimationCurveNode* node : nodes ) {
ai_assert( node );
const AnimationCurveMap& curves = node->Curves();
BOOST_FOREACH( const AnimationCurveMap::value_type& kv, curves ) {
for( const AnimationCurveMap::value_type& kv : curves ) {
unsigned int mapto;
if ( kv.first == "d|X" ) {
@ -2984,7 +2983,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
KeyTimeList keys;
size_t estimate = 0;
BOOST_FOREACH( const KeyFrameList& kfl, inputs ) {
for( const KeyFrameList& kfl : inputs ) {
estimate = std::max( estimate, kfl.get<0>()->size() );
}
@ -3037,7 +3036,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
next_pos.resize( inputs.size(), 0 );
BOOST_FOREACH( KeyTimeList::value_type time, keys ) {
for( KeyTimeList::value_type time : keys ) {
float result[ 3 ] = { def_value.x, def_value.y, def_value.z };
for ( size_t i = 0; i < count; ++i ) {

View File

@ -50,7 +50,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImportSettings.h"
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <boost/foreach.hpp>
namespace Assimp {
namespace FBX {
@ -107,7 +106,7 @@ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const
// read assigned node
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Model");
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
const Model* const mod = ProcessSimpleConnection<Model>(*con, false, "Model -> Cluster", element);
if(mod) {
node = mod;
@ -143,7 +142,7 @@ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
clusters.reserve(conns.size());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
const Cluster* const cluster = ProcessSimpleConnection<Cluster>(*con, false, "Cluster -> Skin", element);
if(cluster) {

View File

@ -53,7 +53,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include <functional>
@ -146,7 +145,7 @@ const Object* LazyObject::Get(bool dieOnError)
// For debugging
//dumpObjectClassInfo( objtype, classtag );
if (!strncmp(obtype,"Geometry",length)) {
if (!strcmp(classtag.c_str(),"Mesh")) {
object.reset(new MeshGeometry(id,element,name,doc));
@ -290,11 +289,11 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
// ------------------------------------------------------------------------------------------------
Document::~Document()
{
BOOST_FOREACH(ObjectMap::value_type& v, objects) {
for(ObjectMap::value_type& v : objects) {
delete v.second;
}
BOOST_FOREACH(ConnectionMap::value_type& v, src_connections) {
for(ConnectionMap::value_type& v : src_connections) {
delete v.second;
}
// |dest_connections| contain the same Connection objects as the |src_connections|
@ -388,7 +387,7 @@ void Document::ReadObjects()
objects[0] = new LazyObject(0L, *eobjects, *this);
const Scope& sobjects = *eobjects->Compound();
BOOST_FOREACH(const ElementMap::value_type& el, sobjects.Elements()) {
for(const ElementMap::value_type& el : sobjects.Elements()) {
// extract ID
const TokenList& tok = el.second->Tokens();
@ -538,7 +537,7 @@ const std::vector<const AnimationStack*>& Document::AnimationStacks() const
}
animationStacksResolved.reserve(animationStacks.size());
BOOST_FOREACH(uint64_t id, animationStacks) {
for(uint64_t id : animationStacks) {
LazyObject* const lazy = GetObject(id);
const AnimationStack* stack;
if(!lazy || !(stack = lazy->Get<AnimationStack>())) {

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include "ByteSwapper.h"
#include <boost/foreach.hpp>
namespace Assimp {
namespace FBX {
@ -96,7 +95,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
// resolve texture links
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// texture link to properties, not objects
if (!con->PropertyName().length()) {
@ -205,7 +204,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
// resolve video links
if(doc.Settings().readTextures) {
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
const Object* const ob = con->SourceObject();
if(!ob) {
DOMWarning("failed to read source object for texture link, ignoring",&element);

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImporter.h"
#include "FBXImportSettings.h"
#include "FBXDocumentUtil.h"
#include <boost/foreach.hpp>
namespace Assimp {
@ -65,7 +64,7 @@ Geometry::Geometry(uint64_t id, const Element& element, const std::string& name,
, skin()
{
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
const Skin* const sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);
if(sk) {
skin = sk;
@ -130,7 +129,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
// generate output vertices, computing an adjacency table to
// preserve the mapping from fbx indices to *this* indexing.
unsigned int count = 0;
BOOST_FOREACH(int index, tempFaces) {
for(int index : tempFaces) {
const int absi = index < 0 ? (-index - 1) : index;
if(static_cast<size_t>(absi) >= vertex_count) {
DOMError("polygon vertex index out of range",&PolygonVertexIndex);
@ -156,7 +155,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
}
cursor = 0;
BOOST_FOREACH(int index, tempFaces) {
for(int index : tempFaces) {
const int absi = index < 0 ? (-index - 1) : index;
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++;
}
@ -494,7 +493,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
}
unsigned int next = 0;
BOOST_FOREACH(int i, uvIndices) {
for(int i : uvIndices) {
if (static_cast<size_t>(i) >= tempData.size()) {
DOMError("index out of range",&GetRequiredElement(source,indexDataElementName));
}

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImportSettings.h"
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <boost/foreach.hpp>
namespace Assimp {
namespace FBX {
@ -98,7 +97,7 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
materials.reserve(conns.size());
geometry.reserve(conns.size());
attributes.reserve(conns.size());
BOOST_FOREACH(const Connection* con, conns) {
for(const Connection* con : conns) {
// material and geometry links should be Object-Object connections
if (con->PropertyName().length()) {
@ -139,7 +138,7 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
bool Model::IsNull() const
{
const std::vector<const NodeAttribute*>& attrs = GetAttributes();
BOOST_FOREACH(const NodeAttribute* att, attrs) {
for(const NodeAttribute* att : attrs) {
const Null* null_tag = dynamic_cast<const Null*>(att);
if(null_tag) {

View File

@ -58,7 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ParsingUtils.h"
#include "fast_atof.h"
#include <boost/foreach.hpp>
#include "ByteSwapper.h"
#include <iostream>
@ -208,7 +207,7 @@ Scope::Scope(Parser& parser,bool topLevel)
// ------------------------------------------------------------------------------------------------
Scope::~Scope()
{
BOOST_FOREACH(ElementMap::value_type& v, elements) {
for(ElementMap::value_type& v : elements) {
delete v.second;
}
}

View File

@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXDocument.h"
#include "FBXDocumentUtil.h"
#include "FBXProperties.h"
#include <boost/foreach.hpp>
namespace Assimp {
namespace FBX {
@ -145,7 +144,7 @@ PropertyTable::PropertyTable(const Element& element, boost::shared_ptr<const Pro
, element(&element)
{
const Scope& scope = GetRequiredScope(element);
BOOST_FOREACH(const ElementMap::value_type& v, scope.Elements()) {
for(const ElementMap::value_type& v : scope.Elements()) {
if(v.first != "P") {
DOMWarning("expected only P elements in property table",v.second);
continue;
@ -171,7 +170,7 @@ PropertyTable::PropertyTable(const Element& element, boost::shared_ptr<const Pro
// ------------------------------------------------------------------------------------------------
PropertyTable::~PropertyTable()
{
BOOST_FOREACH(PropertyMap::value_type& v, props) {
for(PropertyMap::value_type& v : props) {
delete v.second;
}
}
@ -209,7 +208,7 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
DirectPropertyMap result;
// Loop through all the lazy properties (which is all the properties)
BOOST_FOREACH(const LazyPropertyMap::value_type& element, lazyProps) {
for(const LazyPropertyMap::value_type& element : lazyProps) {
// Skip parsed properties
if (props.end() != props.find(element.first)) continue;

View File

@ -740,7 +740,7 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T
TempMesh temp;
std::vector<IfcVector3>::const_iterator vit = first_operand.verts.begin();
BOOST_FOREACH(unsigned int pcount, first_operand.vertcnt) {
for(unsigned int pcount : first_operand.vertcnt) {
temp.Clear();
temp.verts.insert(temp.verts.end(), vit, vit + pcount);

View File

@ -239,7 +239,7 @@ public:
, total()
{
curves.reserve(entity.Segments.size());
BOOST_FOREACH(const IfcCompositeCurveSegment& curveSegment,entity.Segments) {
for(const IfcCompositeCurveSegment& curveSegment :entity.Segments) {
// according to the specification, this must be a bounded curve
boost::shared_ptr< Curve > cv(Curve::Convert(curveSegment.ParentCurve,conv));
boost::shared_ptr< BoundedCurve > bc = boost::dynamic_pointer_cast<BoundedCurve>(cv);
@ -271,7 +271,7 @@ public:
}
IfcFloat acc = 0;
BOOST_FOREACH(const CurveEntry& entry, curves) {
for(const CurveEntry& entry : curves) {
const ParamRange& range = entry.first->GetParametricRange();
const IfcFloat delta = std::abs(range.second-range.first);
if (u < acc+delta) {
@ -290,7 +290,7 @@ public:
size_t cnt = 0;
IfcFloat acc = 0;
BOOST_FOREACH(const CurveEntry& entry, curves) {
for(const CurveEntry& entry : curves) {
const ParamRange& range = entry.first->GetParametricRange();
const IfcFloat delta = std::abs(range.second-range.first);
if (a <= acc+delta && b >= acc) {
@ -312,7 +312,7 @@ public:
const size_t cnt = EstimateSampleCount(a,b);
out.verts.reserve(out.verts.size() + cnt);
BOOST_FOREACH(const CurveEntry& entry, curves) {
for(const CurveEntry& entry : curves) {
const size_t cnt = out.verts.size();
entry.first->SampleDiscrete(out);
@ -357,7 +357,7 @@ public:
// oh well.
bool have_param = false, have_point = false;
IfcVector3 point;
BOOST_FOREACH(const Entry sel,entity.Trim1) {
for(const Entry sel :entity.Trim1) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
range.first = *r;
have_param = true;
@ -374,7 +374,7 @@ public:
}
}
have_param = false, have_point = false;
BOOST_FOREACH(const Entry sel,entity.Trim2) {
for(const Entry sel :entity.Trim2) {
if (const EXPRESS::REAL* const r = sel->ToPtr<EXPRESS::REAL>()) {
range.second = *r;
have_param = true;
@ -465,7 +465,7 @@ public:
points.reserve(entity.Points.size());
IfcVector3 t;
BOOST_FOREACH(const IfcCartesianPoint& cp, entity.Points) {
for(const IfcCartesianPoint& cp : entity.Points) {
ConvertCartesianPoint(t,cp);
points.push_back(t);
}

View File

@ -62,7 +62,7 @@ namespace Assimp {
bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/)
{
size_t cnt = 0;
BOOST_FOREACH(const IfcCartesianPoint& c, loop.Polygon) {
for(const IfcCartesianPoint& c : loop.Polygon) {
IfcVector3 tmp;
ConvertCartesianPoint(tmp,c);
@ -191,10 +191,10 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
// ------------------------------------------------------------------------------------------------
void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, ConversionData& conv)
{
BOOST_FOREACH(const IfcFace& face, fset.CfsFaces) {
for(const IfcFace& face : fset.CfsFaces) {
// size_t ob = -1, cnt = 0;
TempMesh meshout;
BOOST_FOREACH(const IfcFaceBound& bound, face.Bounds) {
for(const IfcFaceBound& bound : face.Bounds) {
if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr<IfcPolyLoop>()) {
if(ProcessPolyloop(*polyloop, meshout,conv)) {
@ -219,7 +219,7 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result,
/*if(!IsTrue(bound.Orientation)) {
size_t c = 0;
BOOST_FOREACH(unsigned int& c, meshout.vertcnt) {
for(unsigned int& c : meshout.vertcnt) {
std::reverse(result.verts.begin() + cnt,result.verts.begin() + cnt + c);
cnt += c;
}
@ -547,7 +547,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
IfcVector3 vmin, vmax;
MinMaxChooser<IfcVector3>()(vmin, vmax);
BOOST_FOREACH(IfcVector3& v, in) {
for(IfcVector3& v : in) {
v *= trafo;
vmin = std::min(vmin, v);
@ -579,7 +579,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
}
nors.reserve(conv.apply_openings->size());
BOOST_FOREACH(TempOpening& t, *conv.apply_openings) {
for(TempOpening& t : *conv.apply_openings) {
TempMesh& bounds = *t.profileMesh.get();
if( bounds.verts.size() <= 2 ) {
@ -617,7 +617,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
}
if( openings ) {
BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) {
for(TempOpening& opening : *conv.apply_openings) {
if( !opening.wallPoints.empty() ) {
IFCImporter::LogError("failed to generate all window caps");
}
@ -697,7 +697,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
conv.collect_openings = &fisherPriceMyFirstOpenings;
BOOST_FOREACH(const IfcCurve* curve, cprofile->InnerCurves) {
for(const IfcCurve* curve : cprofile->InnerCurves) {
TempMesh curveMesh, tempMesh;
ProcessCurve(*curve, curveMesh, conv);
ProcessExtrudedArea(solid, curveMesh, dir, tempMesh, conv, true);
@ -734,7 +734,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
bool fix_orientation = false;
boost::shared_ptr< TempMesh > meshtmp = boost::make_shared<TempMesh>();
if(const IfcShellBasedSurfaceModel* shellmod = geo.ToPtr<IfcShellBasedSurfaceModel>()) {
BOOST_FOREACH(boost::shared_ptr<const IfcShell> shell,shellmod->SbsmBoundary) {
for(boost::shared_ptr<const IfcShell> shell :shellmod->SbsmBoundary) {
try {
const EXPRESS::ENTITY& e = shell->To<ENTITY>();
const IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To<IfcConnectedFaceSet>();
@ -762,7 +762,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
fix_orientation = true;
}
else if(const IfcFaceBasedSurfaceModel* surf = geo.ToPtr<IfcFaceBasedSurfaceModel>()) {
BOOST_FOREACH(const IfcConnectedFaceSet& fc, surf->FbsmFaces) {
for(const IfcConnectedFaceSet& fc : surf->FbsmFaces) {
ProcessConnectedFaceSet(fc,*meshtmp.get(),conv);
}
fix_orientation = true;

View File

@ -383,7 +383,7 @@ void SetUnits(ConversionData& conv)
void SetCoordinateSpace(ConversionData& conv)
{
const IfcRepresentationContext* fav = NULL;
BOOST_FOREACH(const IfcRepresentationContext& v, conv.proj.RepresentationContexts) {
for(const IfcRepresentationContext& v : conv.proj.RepresentationContexts) {
fav = &v;
// Model should be the most suitable type of context, hence ignore the others
if (v.ContextType && v.ContextType.Get() == "Model") {
@ -440,7 +440,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
if (conv.apply_openings) {
IfcMatrix4 minv = msrc;
minv.Inverse();
BOOST_FOREACH(TempOpening& open,*conv.apply_openings){
for(TempOpening& open :*conv.apply_openings){
open.Transform(minv);
}
}
@ -449,7 +449,7 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
bool got = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr.Items) {
for(const IfcRepresentationItem& item : repr.Items) {
if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
}
@ -564,9 +564,9 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
std::vector<const IfcRepresentation*> repr_ordered(src.size());
std::copy(src.begin(),src.end(),repr_ordered.begin());
std::sort(repr_ordered.begin(),repr_ordered.end(),RateRepresentationPredicate());
BOOST_FOREACH(const IfcRepresentation* repr, repr_ordered) {
for(const IfcRepresentation* repr : repr_ordered) {
bool res = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr->Items) {
for(const IfcRepresentationItem& item : repr->Items) {
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
}
@ -589,7 +589,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
const std::string& prefix = "",
unsigned int nest = 0)
{
BOOST_FOREACH(const IfcProperty& property, set) {
for(const IfcProperty& property : set) {
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
if (singleValue->NominalValue) {
@ -615,7 +615,7 @@ void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionD
std::stringstream ss;
ss << "[";
unsigned index=0;
BOOST_FOREACH(const IfcValue::Out& v, listValue->ListValues) {
for(const IfcValue::Out& v : listValue->ListValues) {
if (!v) continue;
if (const EXPRESS::STRING* str = v->ToPtr<EXPRESS::STRING>()) {
std::string value = static_cast<std::string>(*str);
@ -713,7 +713,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
data->mValues = new aiMetadataEntry[data->mNumProperties]();
unsigned int index = 0;
BOOST_FOREACH(const Metadata::value_type& kv, properties)
for(const Metadata::value_type& kv : properties)
data->Set(index++, kv.first, aiString(kv.second));
nd->mMetaData = data;
@ -751,7 +751,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if(cont->RelatingStructure->GetID() != el.GetID()) {
continue;
}
BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {
for(const IfcProduct& pro : cont->RelatedElements) {
if(pro.ToPtr<IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey,
@ -794,7 +794,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
}
// we need all openings to be in the local space of *this* node, so transform them
BOOST_FOREACH(TempOpening& op,openings_local) {
for(TempOpening& op :openings_local) {
op.Transform( myInv*nd_aggr->mChildren[0]->mTransformation);
openings.push_back(op);
}
@ -823,7 +823,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
nd_aggr->mTransformation = nd->mTransformation;
nd_aggr->mChildren = new aiNode*[aggr->RelatedObjects.size()]();
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
if(const IfcProduct* const prod = def.ToPtr<IfcProduct>()) {
aiNode* const ndnew = ProcessSpatialStructure(nd_aggr.get(),*prod,conv,NULL);
@ -849,7 +849,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
if (subnodes.size()) {
nd->mChildren = new aiNode*[subnodes.size()]();
BOOST_FOREACH(aiNode* nd2, subnodes) {
for(aiNode* nd2 : subnodes) {
nd->mChildren[nd->mNumChildren++] = nd2;
nd2->mParent = nd.get();
}
@ -889,7 +889,7 @@ void ProcessSpatialStructures(ConversionData& conv)
}
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
if(!prod) {
continue;
@ -902,7 +902,7 @@ void ProcessSpatialStructures(ConversionData& conv)
for(;range.first != range.second; ++range.first) {
if(const IfcRelAggregates* const aggr = conv.db.GetObject((*range.first).second)->ToPtr<IfcRelAggregates>()) {
BOOST_FOREACH(const IfcObjectDefinition& def, aggr->RelatedObjects) {
for(const IfcObjectDefinition& def : aggr->RelatedObjects) {
// comparing pointer values is not sufficient, we would need to cast them to the same type first
// as there is multiple inheritance in the game.
if (def.GetID() == prod->GetID()) {
@ -919,7 +919,7 @@ void ProcessSpatialStructures(ConversionData& conv)
IFCImporter::LogWarn("failed to determine primary site element, taking the first IfcSite");
BOOST_FOREACH(const STEP::LazyObject* lz, *range) {
for(const STEP::LazyObject* lz : *range) {
const IfcSpatialStructureElement* const prod = lz->ToPtr<IfcSpatialStructureElement>();
if(!prod) {
continue;

View File

@ -76,7 +76,7 @@ void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionDat
mat->AddProperty(&name,AI_MATKEY_NAME);
// now see which kinds of surface information are present
BOOST_FOREACH(boost::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2, surf->Styles) {
for(boost::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2 : surf->Styles) {
if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr<IFC::IfcSurfaceStyleShading>(conv.db)) {
aiColor4D col_base,col;
@ -139,8 +139,8 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id);
for(;range.first != range.second; ++range.first) {
if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) {
BOOST_FOREACH(const IFC::IfcPresentationStyleAssignment& as, styled->Styles) {
BOOST_FOREACH(boost::shared_ptr<const IFC::IfcPresentationStyleSelect> sel, as.Styles) {
for(const IFC::IfcPresentationStyleAssignment& as : styled->Styles) {
for(boost::shared_ptr<const IFC::IfcPresentationStyleSelect> sel : as.Styles) {
if( const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr<IFC::IfcSurfaceStyle>(conv.db) ) {
// try to satisfy from cache

View File

@ -213,7 +213,7 @@ bool BoundingBoxesOverlapping( const BoundingBox &ibb, const BoundingBox &bb )
bool IsDuplicateVertex(const IfcVector2& vv, const std::vector<IfcVector2>& temp_contour)
{
// sanity check for duplicate vertices
BOOST_FOREACH(const IfcVector2& cp, temp_contour) {
for(const IfcVector2& cp : temp_contour) {
if ((cp-vv).SquareLength() < 1e-5f) {
return true;
}
@ -226,7 +226,7 @@ void ExtractVerticesFromClipper(const ClipperLib::Polygon& poly, std::vector<Ifc
bool filter_duplicates = false)
{
temp_contour.clear();
BOOST_FOREACH(const ClipperLib::IntPoint& point, poly) {
for(const ClipperLib::IntPoint& point : poly) {
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
vv = std::max(vv,IfcVector2());
vv = std::min(vv,one_vec);
@ -243,7 +243,7 @@ BoundingBox GetBoundingBox(const ClipperLib::Polygon& poly)
IfcVector2 newbb_min, newbb_max;
MinMaxChooser<IfcVector2>()(newbb_min, newbb_max);
BOOST_FOREACH(const ClipperLib::IntPoint& point, poly) {
for(const ClipperLib::IntPoint& point : poly) {
IfcVector2 vv = IfcVector2( from_int64(point.X), from_int64(point.Y));
// sanity rounding
@ -391,7 +391,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Clipper clipper;
ClipperLib::Polygon clip;
BOOST_FOREACH(const IfcVector2& pip, a) {
for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -402,7 +402,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
clipper.AddPolygon(clip, ClipperLib::ptSubject);
clip.clear();
BOOST_FOREACH(const IfcVector2& pip, b) {
for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -425,7 +425,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Clipper clipper;
ClipperLib::Polygon clip;
BOOST_FOREACH(const IfcVector2& pip, a) {
for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -436,7 +436,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
clipper.AddPolygon(clip, ClipperLib::ptClip);
clip.clear();
BOOST_FOREACH(const IfcVector2& pip, b) {
for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -458,7 +458,7 @@ void CleanupWindowContour(ProjectedWindowContour& window)
ClipperLib::Clipper clipper;
ClipperLib::ExPolygons clipped;
BOOST_FOREACH(const IfcVector2& pip, contour) {
for(const IfcVector2& pip : contour) {
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -488,7 +488,7 @@ void CleanupWindowContours(ContourVector& contours)
{
// Use PolyClipper to clean up window contours
try {
BOOST_FOREACH(ProjectedWindowContour& window, contours) {
for(ProjectedWindowContour& window : contours) {
CleanupWindowContour(window);
}
}
@ -516,7 +516,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
ClipperLib::Polygon clip;
clip.reserve(contour_flat.size());
BOOST_FOREACH(const IfcVector2& pip, contour_flat) {
for(const IfcVector2& pip : contour_flat) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
}
@ -530,7 +530,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
subject.reserve(4);
size_t index = 0;
size_t countdown = 0;
BOOST_FOREACH(const IfcVector3& pip, curmesh.verts) {
for(const IfcVector3& pip : curmesh.verts) {
if (!countdown) {
countdown = curmesh.vertcnt[index++];
if (!countdown) {
@ -548,9 +548,9 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
BOOST_FOREACH(const ClipperLib::ExPolygon& ex, clipped) {
for(const ClipperLib::ExPolygon& ex : clipped) {
iold.push_back(ex.outer.size());
BOOST_FOREACH(const ClipperLib::IntPoint& point, ex.outer) {
for(const ClipperLib::IntPoint& point : ex.outer) {
vold.push_back(IfcVector3(
from_int64(point.X),
from_int64(point.Y),
@ -866,7 +866,7 @@ size_t CloseWindows(ContourVector& contours,
OpeningRefs& refs = contours_to_openings[std::distance(contours.begin(), it)];
bool has_other_side = false;
BOOST_FOREACH(const TempOpening* opening, refs) {
for(const TempOpening* opening : refs) {
if(!opening->wallPoints.empty()) {
has_other_side = true;
break;
@ -929,8 +929,8 @@ size_t CloseWindows(ContourVector& contours,
const IfcVector3 world_point = minv * IfcVector3(proj_point.x,proj_point.y,0.0f);
BOOST_FOREACH(const TempOpening* opening, refs) {
BOOST_FOREACH(const IfcVector3& other, opening->wallPoints) {
for(const TempOpening* opening : refs) {
for(const IfcVector3& other : opening->wallPoints) {
const IfcFloat sqdist = (world_point - other).SquareLength();
if (sqdist < best) {
@ -987,7 +987,7 @@ size_t CloseWindows(ContourVector& contours,
else {
const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
BOOST_FOREACH(TempOpening* opening, refs) {
for(TempOpening* opening : refs) {
ai_assert(opening->wallPoints.empty());
opening->wallPoints.reserve(opening->wallPoints.capacity() + (*it).contour.size());
for (Contour::const_iterator cit = cbegin; cit != cend; ++cit) {
@ -1023,7 +1023,7 @@ void Quadrify(const std::vector< BoundingBox >& bbs, TempMesh& curmesh)
curmesh.vertcnt.resize(quads.size()/4,4);
curmesh.verts.reserve(quads.size());
BOOST_FOREACH(const IfcVector2& v2, quads) {
for(const IfcVector2& v2 : quads) {
curmesh.verts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
}
}
@ -1034,7 +1034,7 @@ void Quadrify(const ContourVector& contours, TempMesh& curmesh)
std::vector<BoundingBox> bbs;
bbs.reserve(contours.size());
BOOST_FOREACH(const ContourVector::value_type& val, contours) {
for(const ContourVector::value_type& val : contours) {
bbs.push_back(val.bb);
}
@ -1065,7 +1065,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
MinMaxChooser<IfcVector3>()(vmin, vmax);
// Project all points into the new coordinate system, collect min/max verts on the way
BOOST_FOREACH(const IfcVector3& x, in_verts) {
for(const IfcVector3& x : in_verts) {
const IfcVector3 vv = m * x;
// keep Z offset in the plane coordinate system. Ignoring precision issues
// (which are present, of course), this should be the same value for
@ -1089,7 +1089,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
// [0,1] range. This gives us a consistent data range so all epsilons
// used below can be constants.
vmax -= vmin;
BOOST_FOREACH(IfcVector2& vv, out_contour) {
for(IfcVector2& vv : out_contour) {
vv.x = (vv.x - vmin.x) / vmax.x;
vv.y = (vv.y - vmin.y) / vmax.y;
@ -1110,7 +1110,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
// debug code to verify correctness
#ifdef ASSIMP_BUILD_DEBUG
std::vector<IfcVector2> out_contour2;
BOOST_FOREACH(const IfcVector3& x, in_verts) {
for(const IfcVector3& x : in_verts) {
const IfcVector3& vv = m * x;
out_contour2.push_back(IfcVector2(vv.x,vv.y));
@ -1161,7 +1161,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
IfcVector3 wall_extrusion_axis_norm = wall_extrusion_axis;
wall_extrusion_axis_norm.Normalize();
BOOST_FOREACH(TempOpening& opening,openings) {
for(TempOpening& opening :openings) {
// extrusionDir may be 0,0,0 on case where the opening mesh is not an
// IfcExtrudedAreaSolid but something else (i.e. a brep)
@ -1413,7 +1413,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
CleanupOuterContour(contour_flat, curmesh);
// Undo the projection and get back to world (or local object) space
BOOST_FOREACH(IfcVector3& v3, curmesh.verts) {
for(IfcVector3& v3 : curmesh.verts) {
v3 = minv * v3;
}
@ -1455,7 +1455,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
MinMaxChooser<IfcVector2>()(vmin, vmax);
// Move all points into the new coordinate system, collecting min/max verts on the way
BOOST_FOREACH(IfcVector3& x, out) {
for(IfcVector3& x : out) {
const IfcVector3 vv = m * x;
// keep Z offset in the plane coordinate system. Ignoring precision issues
@ -1498,7 +1498,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
ClipperLib::Clipper clipper_holes;
size_t c = 0;
BOOST_FOREACH(const TempOpening& t,openings) {
for(const TempOpening& t :openings) {
const IfcVector3& outernor = nors[c++];
const IfcFloat dot = nor * outernor;
if (std::fabs(dot)<1.f-1e-6f) {
@ -1512,7 +1512,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
std::vector<IfcVector2> contour;
BOOST_FOREACH(const IfcVector3& xx, t.profileMesh->verts) {
for(const IfcVector3& xx : t.profileMesh->verts) {
IfcVector3 vv = m * xx, vv_extr = m * (xx + t.extrusionDir);
const bool is_extruded_side = std::fabs(vv.z - coord) > std::fabs(vv_extr.z - coord);
@ -1533,7 +1533,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
}
ClipperLib::Polygon hole;
BOOST_FOREACH(IfcVector2& pip, contour) {
for(IfcVector2& pip : contour) {
pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y;
@ -1566,7 +1566,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
// to obtain the final polygon to feed into the triangulator.
{
ClipperLib::Polygon poly;
BOOST_FOREACH(IfcVector2& pip, contour_flat) {
for(IfcVector2& pip : contour_flat) {
pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y;
@ -1606,13 +1606,13 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
if (false && do_connections) {
std::vector<IfcVector3> tmpvec;
BOOST_FOREACH(ClipperLib::Polygon& opening, holes_union) {
for(ClipperLib::Polygon& opening : holes_union) {
assert(ClipperLib::Orientation(opening));
tmpvec.clear();
BOOST_FOREACH(ClipperLib::IntPoint& point, opening) {
for(ClipperLib::IntPoint& point : opening) {
tmpvec.push_back( minv * IfcVector3(
vmin.x + from_int64(point.X) * vmax.x,
@ -1638,13 +1638,13 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
}
std::vector< std::vector<p2t::Point*> > contours;
BOOST_FOREACH(ClipperLib::ExPolygon& clip, clipped) {
for(ClipperLib::ExPolygon& clip : clipped) {
contours.clear();
// Build the outer polygon contour line for feeding into poly2tri
std::vector<p2t::Point*> contour_points;
BOOST_FOREACH(ClipperLib::IntPoint& point, clip.outer) {
for(ClipperLib::IntPoint& point : clip.outer) {
contour_points.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
}
@ -1664,12 +1664,12 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
// Build the poly2tri inner contours for all holes we got from ClipperLib
BOOST_FOREACH(ClipperLib::Polygon& opening, clip.holes) {
for(ClipperLib::Polygon& opening : clip.holes) {
contours.push_back(std::vector<p2t::Point*>());
std::vector<p2t::Point*>& contour = contours.back();
BOOST_FOREACH(ClipperLib::IntPoint& point, opening) {
for(ClipperLib::IntPoint& point : opening) {
contour.push_back( new p2t::Point(from_int64(point.X), from_int64(point.Y)) );
}
@ -1689,7 +1689,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
const std::vector<p2t::Triangle*> tris = cdt->GetTriangles();
// Collect the triangles we just produced
BOOST_FOREACH(p2t::Triangle* tri, tris) {
for(p2t::Triangle* tri : tris) {
for(int i = 0; i < 3; ++i) {
const IfcVector2 v = IfcVector2(

View File

@ -55,7 +55,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData&
{
// this won't produce a valid mesh, it just spits out a list of vertices
IfcVector3 t;
BOOST_FOREACH(const IfcCartesianPoint& cp, def.Points) {
for(const IfcCartesianPoint& cp : def.Points) {
ConvertCartesianPoint(t,cp);
meshout.verts.push_back(t);
}

View File

@ -115,7 +115,7 @@ void TempMesh::Clear()
// ------------------------------------------------------------------------------------------------
void TempMesh::Transform(const IfcMatrix4& mat)
{
BOOST_FOREACH(IfcVector3& v, verts) {
for(IfcVector3& v : verts) {
v *= mat;
}
}
@ -222,7 +222,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
}
if(normalize) {
BOOST_FOREACH(IfcVector3& n, normals) {
for(IfcVector3& n : normals) {
n.Normalize();
}
}
@ -383,7 +383,7 @@ void TempMesh::RemoveAdjacentDuplicates()
bool drop = false;
std::vector<IfcVector3>::iterator base = verts.begin();
BOOST_FOREACH(unsigned int& cnt, vertcnt) {
for(unsigned int& cnt : vertcnt) {
if (cnt < 2){
base += cnt;
continue;

View File

@ -50,10 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include "StreamReader.h"
#include <boost/foreach.hpp>
using namespace Assimp;
#define for_each BOOST_FOREACH
static const aiImporterDesc desc = {
"Nendo Mesh Importer",
@ -241,7 +239,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
std::vector<aiVector3D> vertices;
std::vector<unsigned int> indices;
for_each(const Object& obj,objects) {
for(const Object& obj : objects) {
aiNode* nd = *cc++ = new aiNode(obj.name);
nd->mParent = root;
@ -250,7 +248,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
FaceTable face_table;
unsigned int n = 0;
for_each(const Edge& edge, obj.edges) {
for(const Edge& edge : obj.edges) {
face_table[edge.edge[2]] = n;
face_table[edge.edge[3]] = n;
@ -263,7 +261,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
vertices.clear();
vertices.reserve(4 * face_table.size()); // arbitrarily chosen
for_each(FaceTable::value_type& v, face_table) {
for(FaceTable::value_type& v : face_table) {
indices.clear();
aiFace& f = *faces++;

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/Exporter.hpp>
#include <assimp/material.h>
#include <assimp/scene.h>
#include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp>
@ -217,7 +216,7 @@ void ObjExporter :: WriteGeometryFile()
// write vertex positions
vpMap.getVectors(vp);
mOutput << "# " << vp.size() << " vertex positions" << endl;
BOOST_FOREACH(const aiVector3D& v, vp) {
for(const aiVector3D& v : vp) {
mOutput << "v " << v.x << " " << v.y << " " << v.z << endl;
}
mOutput << endl;
@ -225,7 +224,7 @@ void ObjExporter :: WriteGeometryFile()
// write uv coordinates
vtMap.getVectors(vt);
mOutput << "# " << vt.size() << " UV coordinates" << endl;
BOOST_FOREACH(const aiVector3D& v, vt) {
for(const aiVector3D& v : vt) {
mOutput << "vt " << v.x << " " << v.y << " " << v.z << endl;
}
mOutput << endl;
@ -233,22 +232,22 @@ void ObjExporter :: WriteGeometryFile()
// write vertex normals
vnMap.getVectors(vn);
mOutput << "# " << vn.size() << " vertex normals" << endl;
BOOST_FOREACH(const aiVector3D& v, vn) {
for(const aiVector3D& v : vn) {
mOutput << "vn " << v.x << " " << v.y << " " << v.z << endl;
}
mOutput << endl;
// now write all mesh instances
BOOST_FOREACH(const MeshInstance& m, meshes) {
for(const MeshInstance& m : meshes) {
mOutput << "# Mesh \'" << m.name << "\' with " << m.faces.size() << " faces" << endl;
if (!m.name.empty()) {
mOutput << "g " << m.name << endl;
}
mOutput << "usemtl " << m.matname << endl;
BOOST_FOREACH(const Face& f, m.faces) {
for(const Face& f : m.faces) {
mOutput << f.kind << ' ';
BOOST_FOREACH(const FaceVertex& fv, f.indices) {
for(const FaceVertex& fv : f.indices) {
mOutput << ' ' << fv.vp;
if (f.kind != 'p') {

View File

@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_STEPFILE_H
#include <boost/noncopyable.hpp>
#include <boost/foreach.hpp>
#include <bitset>
#include <memory>
#include <typeinfo>
@ -868,7 +867,7 @@ namespace STEP {
public:
~DB() {
BOOST_FOREACH(ObjectMap::value_type& o, objects) {
for(ObjectMap::value_type& o : objects) {
delete o.second;
}
}
@ -950,7 +949,7 @@ namespace STEP {
// evaluate *all* entities in the file. this is a power test for the loader
void EvaluateAll() {
BOOST_FOREACH(ObjectMap::value_type& e,objects) {
for(ObjectMap::value_type& e :objects) {
**e.second;
}
ai_assert(evaluated_count == objects.size());

View File

@ -431,7 +431,7 @@ aiNode* XGLImporter::ReadObject(TempScope& scope, bool skipFirst, const char* cl
}
} catch(...) {
BOOST_FOREACH(aiNode* ch, children) {
for(aiNode* ch : children) {
delete ch;
}
throw;
@ -691,7 +691,7 @@ bool XGLImporter::ReadMesh(TempScope& scope)
// finally extract output meshes and add them to the scope
typedef std::pair<unsigned int, TempMaterialMesh> pairt;
BOOST_FOREACH(const pairt& p, bymat) {
for(const pairt& p : bymat) {
aiMesh* const m = ToOutputMesh(p.second);
scope.meshes_linear.push_back(m);

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "irrXMLWrapper.h"
#include "LogAux.h"
#include <boost/foreach.hpp>
#include "../include/assimp/material.h"
#include "../include/assimp/Importer.hpp"
#include "../include/assimp/mesh.h"
@ -102,11 +101,11 @@ private:
~TempScope()
{
BOOST_FOREACH(aiMesh* m, meshes_linear) {
for(aiMesh* m : meshes_linear) {
delete m;
}
BOOST_FOREACH(aiMaterial* m, materials_linear) {
for(aiMaterial* m : materials_linear) {
delete m;
}

View File

@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h>
#include <assimp/scene.h>
#include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
@ -130,7 +129,7 @@ glTFExporter::glTFExporter(const char* filename, IOSystem* pIOSystem, const aiSc
static void CopyValue(const aiMatrix4x4& v, glTF::mat4& o)
{
{
o[ 0] = v.a1; o[ 1] = v.b1; o[ 2] = v.c1; o[ 3] = v.d1;
o[ 4] = v.a2; o[ 5] = v.b2; o[ 6] = v.c2; o[ 7] = v.d2;
o[ 8] = v.a3; o[ 9] = v.b3; o[10] = v.c3; o[11] = v.d3;
@ -233,7 +232,7 @@ void glTFExporter::ExportMaterials()
for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) {
const aiMaterial* mat = mScene->mMaterials[i];
std::string name;
if (mat->Get(AI_MATKEY_NAME, aiName) == AI_SUCCESS) {
name = aiName.C_Str();