Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/XSIExport/src/OgreXSIHelper.cpp @ 6

Last change on this file since 6 was 6, checked in by anonymous, 18 years ago

=…

File size: 2.9 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#include "OgreXSIHelper.h"
30#include <fstream>
31
32namespace Ogre {
33
34        //-----------------------------------------------------------------------
35        void copyFile(const String& src, const String& dst)
36        {
37                std::ifstream in(src.c_str(), std::ios::in | std::ios::binary);
38                std::ofstream out(dst.c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
39
40                if (!in || !out)
41                {
42                        LogOgreAndXSI("Unable to copy texture '" + src + "' to '" + dst + "'");
43                        return;
44                }
45
46                char tmpBuf[2048];
47
48                while (!in.eof())
49                {
50                        in.read(tmpBuf, 2048);
51
52                        std::streamsize c = in.gcount();
53
54                        out.write(tmpBuf, c);
55
56                }
57
58                in.close();
59                out.close();
60
61
62
63        }
64        //-----------------------------------------------------------------------
65        template<> ProgressManager* Singleton<ProgressManager>::ms_Singleton = 0;
66        ProgressManager* ProgressManager::getSingletonPtr(void)
67        {
68                return ms_Singleton;
69        }
70        ProgressManager& ProgressManager::getSingleton(void)
71        { 
72                assert( ms_Singleton );  return ( *ms_Singleton ); 
73        }
74        //-----------------------------------------------------------------------------
75        ProgressManager::ProgressManager(size_t numberOfStages)
76                :mNumberOfStages(numberOfStages), mProgress(0)
77        {
78                XSI::Application app;
79
80                mProgressBar = app.GetUIToolkit().GetProgressBar();
81                mProgressBar.PutMaximum(numberOfStages);
82                mProgressBar.PutStep(1);
83                mProgressBar.PutVisible(true);
84                mProgressBar.PutCaption(L"Exporting");
85        }
86        //-----------------------------------------------------------------------------
87        ProgressManager::~ProgressManager()
88        {
89        }
90        //-----------------------------------------------------------------------------
91        void ProgressManager::progress(void)
92        {
93                ++mProgress;
94                mProgressBar.Increment();
95               
96        }
97
98}
Note: See TracBrowser for help on using the repository browser.