~ubuntu-branches/ubuntu/raring/openwalnut/raring

« back to all changes in this revision

Viewing changes to src/modules/atlasCreator/WMAtlasCreator.cpp

  • Committer: Package Import Robot
  • Author(s): Sebastian Eichelbaum
  • Date: 2012-12-12 11:26:32 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20121212112632-xhiuwkxuz5h0idkh
Tags: 1.3.1+hg5849-1
* Minor changes compared to 1.3.0 but included several bug fixes.
* See http://www.openwalnut.org/versions/4

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
//---------------------------------------------------------------------------
24
24
 
25
25
#include <string>
 
26
#include <vector>
26
27
 
27
 
// Use filesystem version 2 for compatibility with newer boost versions.
28
 
#ifndef BOOST_FILESYSTEM_VERSION
29
 
    #define BOOST_FILESYSTEM_VERSION 2
30
 
#endif
31
28
#include <boost/filesystem.hpp>
32
29
 
33
30
#include <osg/Image>
34
31
#include <osg/Texture3D>
35
32
#include <osgDB/ReadFile>
36
33
 
 
34
#include "core/common/WStringUtils.h"
37
35
#include "core/kernel/WKernel.h"
 
36
 
 
37
#include "WMAtlasCreator.h"
38
38
#include "WMAtlasCreator.xpm"
39
 
#include "WMAtlasCreator.h"
40
39
 
41
40
// This line is needed by the module loader to actually find your module. Do not remove. Do NOT add a ";" here.
42
41
W_LOADABLE_MODULE( WMAtlasCreator )
135
134
    }
136
135
 
137
136
    osg::Image* osgImage;
138
 
    osgImage = osgDB::readImageFile( sliceFile.file_string().c_str() );
 
137
    osgImage = osgDB::readImageFile( sliceFile.string().c_str() );
139
138
 
140
139
    debugLog() << osgImage->r() << " : " << osgImage->s() << " : " << osgImage->t();
141
140
 
145
144
 
146
145
 
147
146
    path dirPath( sliceFile );
148
 
    dirPath.remove_filename().file_string();
 
147
    dirPath.remove_filename().string();
149
148
 
150
149
    m_volume.resize( m_xDim * m_yDim * m_zDim, 0 );
151
150
 
152
151
    directory_iterator end_itr; // default construction yields past-the-end
153
152
    for( directory_iterator itr( dirPath ); itr != end_itr; ++itr )
154
153
    {
155
 
        //debugLog() << itr->path().file_string().c_str();
 
154
        //debugLog() << itr->path().string().c_str();
156
155
        path p( itr->path() );
157
156
 
158
157
        if( p.extension() == ".png" )
173
172
{
174
173
    using namespace boost::filesystem; //NOLINT
175
174
 
176
 
    std::string fn = image.filename();
 
175
    std::string fn = image.filename().string();
177
176
    fn.erase( fn.size() - 4, 4 );
178
177
    std::string number = fn.substr( fn.size() - 3 );
179
178
    fn.erase( fn.size() - 3, 3 );
180
179
 
181
 
    size_t pos = boost::lexical_cast<size_t>( number );
 
180
    size_t pos = string_utils::fromString<size_t>( number );
182
181
 
183
182
    if( pos > 119 )
184
183
    {
203
202
    }
204
203
 
205
204
    osg::Image* osgImage;
206
 
    osgImage = osgDB::readImageFile( image.file_string().c_str() );
 
205
    osgImage = osgDB::readImageFile( image.string().c_str() );
207
206
    unsigned char* data = osgImage->data();
208
207
 
209
208
    pos /= 2;