Changeset 1210
- Timestamp:
- 05/08/08 13:53:36 (3 days ago)
- Files:
-
- trunk/Source/System/FileIO/OSB/OSGNFIOOptions.cpp (modified) (5 diffs)
- trunk/Source/System/FileIO/OSB/OSGNFIOOptions.h (modified) (2 diffs)
- trunk/Source/System/FileIO/OSB/OSGOSBImageElement.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/System/FileIO/OSB/OSGNFIOOptions.cpp
r785 r1210 69 69 /*----------------------------- constructors -----------------------------*/ 70 70 71 NFIOOptions::NFIOOptions(void) : 72 _inlineTextures(true), 73 _compressTextures(false), 74 _texturesCompressionQuality(75), 75 _quantizePositions(Quantizer::QRES_OFF), 76 _quantizeNormals(Quantizer::QRES_OFF), 77 _quantizeTexCoords(Quantizer::QRES_OFF), 78 _packIndices(false), 79 _unpack16BitIndices(true) 71 NFIOOptions::NFIOOptions(void) 72 : _inlineTextures(true), 73 _compressTextures(false), 74 _texturesCompressionQuality(75), 75 _texturesImageType("jpeg"), 76 _quantizePositions(Quantizer::QRES_OFF), 77 _quantizeNormals(Quantizer::QRES_OFF), 78 _quantizeTexCoords(Quantizer::QRES_OFF), 79 _packIndices(false), 80 _unpack16BitIndices(true) 80 81 { 81 82 } … … 95 96 _compressTextures = false; 96 97 _texturesCompressionQuality = 75; 98 _texturesImageType = "jpeg", 97 99 _quantizePositions = Quantizer::QRES_OFF; 98 100 _quantizeNormals = Quantizer::QRES_OFF; … … 119 121 _texturesCompressionQuality = getInteger(options.substr(i+option.size())); 120 122 123 option = "texturesImageType="; 124 if((i = options.find(option)) != std::string::npos) 125 _texturesImageType = getString(options.substr(i + option.size())); 126 121 127 if(options.find("quantizePositions=0") != std::string::npos) 122 128 _quantizePositions = Quantizer::QRES_OFF; … … 172 178 { 173 179 return _texturesCompressionQuality; 180 } 181 182 std::string NFIOOptions::texturesImageType(void) const 183 { 184 return _texturesImageType; 174 185 } 175 186 … … 214 225 return r; 215 226 } 227 228 std::string NFIOOptions::getString(const std::string &str) 229 { 230 std::string rstr; 231 UInt32 i = 0; 232 while(i < str.length() && str[i] != ',') 233 { 234 rstr += str[i++]; 235 } 236 return rstr; 237 } trunk/Source/System/FileIO/OSB/OSGNFIOOptions.h
r785 r1210 83 83 /*! \{ */ 84 84 85 bool inlineTextures(void) const; 86 bool compressTextures(void) const; 87 UInt32 texturesCompressionQuality(void) const; 85 bool inlineTextures(void) const; 86 bool compressTextures(void) const; 87 UInt32 texturesCompressionQuality(void) const; 88 std::string texturesImageType(void) const; 88 89 89 90 UInt8 quantizePositions(void) const; … … 101 102 private: 102 103 103 Int32 getInteger(const std::string &str); 104 Int32 getInteger(const std::string &str); 105 std::string getString (const std::string &str); 104 106 105 bool _inlineTextures; 106 bool _compressTextures; 107 UInt32 _texturesCompressionQuality; 108 UInt8 _quantizePositions; 109 UInt8 _quantizeNormals; 110 UInt8 _quantizeTexCoords; 111 bool _packIndices; 112 bool _unpack16BitIndices; 107 bool _inlineTextures; 108 bool _compressTextures; 109 UInt32 _texturesCompressionQuality; 110 std::string _texturesImageType; 111 112 UInt8 _quantizePositions; 113 UInt8 _quantizeNormals; 114 UInt8 _quantizeTexCoords; 115 116 bool _packIndices; 117 bool _unpack16BitIndices; 113 118 }; 114 119 trunk/Source/System/FileIO/OSB/OSGOSBImageElement.cpp
r1198 r1210 274 274 275 275 Image *img = dynamic_cast<Image *>(getContainer()); 276 //std::string imageType = root->getOptions().textureImageType();277 std::string imageType = "jpeg";276 std::string imageType = root->getOptions().texturesImageType(); 277 // std::string imageType = "jpeg"; 278 278 279 279 std::vector<UInt8> buffer; … … 285 285 286 286 // some extra space is needed for the image header 287 UInt32 bufferSize = 0;288 // ImageFileHandler::the().getDefaultType()->maxBufferSize(img) * factor +289 //16384;287 UInt32 bufferSize = 288 ImageFileHandler::the()->getDefaultType()->maxBufferSize(img) * factor + 289 16384; 290 290 291 291 buffer.resize(bufferSize); 292 //UInt64 compressedSize = img->store(imageType.c_str(), &buffer.front());293 UInt64 compressedSize = 0;292 UInt64 compressedSize = img->store(imageType.c_str(), &buffer.front()); 293 // UInt64 compressedSize = 0; 294 294 295 295 UInt32 byteSize = static_cast<UInt32>(compressedSize); 296 296 UInt32 fieldSize = sizeof(UInt32) + sizeof(UInt8) * byteSize; 297 297 298 wh->putValue (fieldSize);299 wh->putValue (byteSize);298 wh->putValue (fieldSize ); 299 wh->putValue (byteSize ); 300 300 wh->putValues(&buffer.front(), byteSize); 301 301 }
