- Timestamp:
- Apr 21, 2011, 6:32:28 PM (14 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
- Property svn:mergeinfo changed
/code/branches/kicklib merged: 7940-7948,7950-7951,7953,7956-7957,7959-7961,7964-7965,7967-7969,7971,7973-7974
- Property svn:mergeinfo changed
-
code/branches/kicklib2/src/libraries/core/GraphicsManager.cc
r8079 r8283 35 35 #include <boost/shared_array.hpp> 36 36 37 #include <OgreArchiveFactory.h>38 #include <OgreArchiveManager.h>39 37 #include <OgreFrameListener.h> 40 38 #include <OgreRoot.h> … … 60 58 #include "GUIManager.h" 61 59 #include "Loader.h" 62 #include "MemoryArchive.h"63 60 #include "PathConfig.h" 64 61 #include "ViewportEventListener.h" … … 102 99 GraphicsManager::GraphicsManager(bool bLoadRenderer) 103 100 : ogreWindowEventListener_(new OgreWindowEventListener()) 104 #if OGRE_VERSION < 0x010600105 , memoryArchiveFactory_(new MemoryArchiveFactory())106 #endif107 101 , renderWindow_(0) 108 102 , viewport_(0) … … 195 189 196 190 this->loadRenderer(); 197 198 #if OGRE_VERSION < 0x010600199 // WORKAROUND: There is an incompatibility for particle scripts when trying200 // to support both Ogre 1.4 and 1.6. The hacky solution is to create201 // scripts for the 1.6 version and then remove the inserted "particle_system"202 // keyword. But we need to supply these new scripts as well, which is why203 // there is an extra Ogre::Archive dealing with it in the memory.204 using namespace Ogre;205 ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());206 const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();207 // Travers all groups208 for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)209 {210 FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");211 for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)212 {213 // open file214 Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);215 std::stringstream output;216 // Parse file and replace "particle_system" with nothing217 while (!input->eof())218 {219 std::string line = input->getLine();220 size_t pos = line.find("particle_system");221 if (pos != std::string::npos)222 {223 // 15 is the length of "particle_system"224 line.replace(pos, 15, "");225 }226 output << line << std::endl;227 }228 // Add file to the memory archive229 shared_array<char> data(new char[output.str().size()]);230 // Debug optimisations231 const std::string& outputStr = output.str();232 char* rawData = data.get();233 for (unsigned i = 0; i < outputStr.size(); ++i)234 rawData[i] = outputStr[i];235 MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());236 }237 if (!files->empty())238 {239 // Declare the files, but using a new group240 ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,241 "Memory", "particle_scripts_ogre_1.4_" + *itGroup);242 }243 }244 #endif245 191 246 192 // Initialise all resources (do this AFTER the renderer has been loaded!)
Note: See TracChangeset
for help on using the changeset viewer.