| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include <osg/Object> |
|---|
| 14 | |
|---|
| 15 | #include <osgDB/Registry> |
|---|
| 16 | #include <osgDB/ReadFile> |
|---|
| 17 | #include <osgDB/Input> |
|---|
| 18 | |
|---|
| 19 | using namespace osgDB; |
|---|
| 20 | |
|---|
| 21 | Input::Input() |
|---|
| 22 | { |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | Input::~Input() |
|---|
| 27 | { |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | osg::Object* Input::getObjectForUniqueID(const std::string& uniqueID) |
|---|
| 32 | { |
|---|
| 33 | UniqueIDToObjectMapping::iterator fitr = _uniqueIDToObjectMap.find(uniqueID); |
|---|
| 34 | if (fitr != _uniqueIDToObjectMap.end()) return (*fitr).second.get(); |
|---|
| 35 | else return NULL; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | void Input::registerUniqueIDForObject(const std::string& uniqueID,osg::Object* obj) |
|---|
| 40 | { |
|---|
| 41 | _uniqueIDToObjectMap[uniqueID] = obj; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | osg::Object* Input::readObjectOfType(const osg::Object& compObj) |
|---|
| 46 | { |
|---|
| 47 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObjectOfType(compObj,*this); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | osg::Object* Input::readObjectOfType(const basic_type_wrapper &btw) |
|---|
| 51 | { |
|---|
| 52 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObjectOfType(btw,*this); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | osg::Object* Input::readObject() |
|---|
| 56 | { |
|---|
| 57 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readObject(*this); |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | osg::Image* Input::readImage() |
|---|
| 62 | { |
|---|
| 63 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readImage(*this); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | osg::Drawable* Input::readDrawable() |
|---|
| 67 | { |
|---|
| 68 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readDrawable(*this); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | osg::StateAttribute* Input::readStateAttribute() |
|---|
| 72 | { |
|---|
| 73 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readStateAttribute(*this); |
|---|
| 74 | } |
|---|
| 75 | osg::Uniform* Input::readUniform() |
|---|
| 76 | { |
|---|
| 77 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readUniform(*this); |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | osg::Node* Input::readNode() |
|---|
| 81 | { |
|---|
| 82 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readNode(*this); |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | osg::Object* Input::readObject(const std::string& fileName) |
|---|
| 86 | { |
|---|
| 87 | return readObjectFile(fileName,_options.get()); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | osg::Shader* Input::readShader() |
|---|
| 91 | { |
|---|
| 92 | return Registry::instance()->getDeprecatedDotOsgObjectWrapperManager()->readShader(*this); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | osg::Image* Input::readImage(const std::string& fileName) |
|---|
| 96 | { |
|---|
| 97 | return readImageFile(fileName,_options.get()); |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | osg::Node* Input::readNode(const std::string& fileName) |
|---|
| 101 | { |
|---|
| 102 | return readNodeFile(fileName,_options.get()); |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | osg::Shader* Input::readShader(const std::string& fileName) |
|---|
| 106 | { |
|---|
| 107 | return readShaderFile(fileName,_options.get()); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | bool Input::read(Parameter value1) |
|---|
| 111 | { |
|---|
| 112 | if (value1.valid((*this)[0].getStr())) |
|---|
| 113 | { |
|---|
| 114 | value1.assign((*this)[0].getStr()); |
|---|
| 115 | (*this) += 1; |
|---|
| 116 | return true; |
|---|
| 117 | } |
|---|
| 118 | else return false; |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | bool Input::read(Parameter value1, Parameter value2) |
|---|
| 122 | { |
|---|
| 123 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 124 | value2.valid((*this)[1].getStr())) |
|---|
| 125 | { |
|---|
| 126 | value1.assign((*this)[0].getStr()); |
|---|
| 127 | value2.assign((*this)[1].getStr()); |
|---|
| 128 | (*this) += 2; |
|---|
| 129 | return true; |
|---|
| 130 | } |
|---|
| 131 | else return false; |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | bool Input::read(Parameter value1, Parameter value2, Parameter value3) |
|---|
| 135 | { |
|---|
| 136 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 137 | value2.valid((*this)[1].getStr()) && |
|---|
| 138 | value3.valid((*this)[2].getStr())) |
|---|
| 139 | { |
|---|
| 140 | value1.assign((*this)[0].getStr()); |
|---|
| 141 | value2.assign((*this)[1].getStr()); |
|---|
| 142 | value3.assign((*this)[2].getStr()); |
|---|
| 143 | (*this) += 3; |
|---|
| 144 | return true; |
|---|
| 145 | } |
|---|
| 146 | else return false; |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | bool Input::read(Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
|---|
| 150 | { |
|---|
| 151 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 152 | value2.valid((*this)[1].getStr()) && |
|---|
| 153 | value3.valid((*this)[2].getStr()) && |
|---|
| 154 | value4.valid((*this)[3].getStr())) |
|---|
| 155 | { |
|---|
| 156 | value1.assign((*this)[0].getStr()); |
|---|
| 157 | value2.assign((*this)[1].getStr()); |
|---|
| 158 | value3.assign((*this)[2].getStr()); |
|---|
| 159 | value4.assign((*this)[3].getStr()); |
|---|
| 160 | (*this) += 4; |
|---|
| 161 | return true; |
|---|
| 162 | } |
|---|
| 163 | else return false; |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | bool Input::read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5) |
|---|
| 167 | { |
|---|
| 168 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 169 | value2.valid((*this)[1].getStr()) && |
|---|
| 170 | value3.valid((*this)[2].getStr()) && |
|---|
| 171 | value4.valid((*this)[3].getStr()) && |
|---|
| 172 | value5.valid((*this)[4].getStr())) |
|---|
| 173 | { |
|---|
| 174 | value1.assign((*this)[0].getStr()); |
|---|
| 175 | value2.assign((*this)[1].getStr()); |
|---|
| 176 | value3.assign((*this)[2].getStr()); |
|---|
| 177 | value4.assign((*this)[3].getStr()); |
|---|
| 178 | value5.assign((*this)[4].getStr()); |
|---|
| 179 | (*this) += 5; |
|---|
| 180 | return true; |
|---|
| 181 | } |
|---|
| 182 | else return false; |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | bool Input::read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6) |
|---|
| 186 | { |
|---|
| 187 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 188 | value2.valid((*this)[1].getStr()) && |
|---|
| 189 | value3.valid((*this)[2].getStr()) && |
|---|
| 190 | value4.valid((*this)[3].getStr()) && |
|---|
| 191 | value5.valid((*this)[4].getStr()) && |
|---|
| 192 | value6.valid((*this)[5].getStr())) |
|---|
| 193 | { |
|---|
| 194 | value1.assign((*this)[0].getStr()); |
|---|
| 195 | value2.assign((*this)[1].getStr()); |
|---|
| 196 | value3.assign((*this)[2].getStr()); |
|---|
| 197 | value4.assign((*this)[3].getStr()); |
|---|
| 198 | value5.assign((*this)[4].getStr()); |
|---|
| 199 | value6.assign((*this)[5].getStr()); |
|---|
| 200 | (*this) += 6; |
|---|
| 201 | return true; |
|---|
| 202 | } |
|---|
| 203 | else return false; |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | bool Input::read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7) |
|---|
| 207 | { |
|---|
| 208 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 209 | value2.valid((*this)[1].getStr()) && |
|---|
| 210 | value3.valid((*this)[2].getStr()) && |
|---|
| 211 | value4.valid((*this)[3].getStr()) && |
|---|
| 212 | value5.valid((*this)[4].getStr()) && |
|---|
| 213 | value6.valid((*this)[5].getStr()) && |
|---|
| 214 | value7.valid((*this)[6].getStr())) |
|---|
| 215 | { |
|---|
| 216 | value1.assign((*this)[0].getStr()); |
|---|
| 217 | value2.assign((*this)[1].getStr()); |
|---|
| 218 | value3.assign((*this)[2].getStr()); |
|---|
| 219 | value4.assign((*this)[3].getStr()); |
|---|
| 220 | value5.assign((*this)[4].getStr()); |
|---|
| 221 | value6.assign((*this)[5].getStr()); |
|---|
| 222 | value7.assign((*this)[6].getStr()); |
|---|
| 223 | (*this) += 7; |
|---|
| 224 | return true; |
|---|
| 225 | } |
|---|
| 226 | else return false; |
|---|
| 227 | } |
|---|
| 228 | |
|---|
| 229 | bool Input::read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8) |
|---|
| 230 | { |
|---|
| 231 | if (value1.valid((*this)[0].getStr()) && |
|---|
| 232 | value2.valid((*this)[1].getStr()) && |
|---|
| 233 | value3.valid((*this)[2].getStr()) && |
|---|
| 234 | value4.valid((*this)[3].getStr()) && |
|---|
| 235 | value5.valid((*this)[4].getStr()) && |
|---|
| 236 | value6.valid((*this)[5].getStr()) && |
|---|
| 237 | value7.valid((*this)[6].getStr()) && |
|---|
| 238 | value8.valid((*this)[7].getStr())) |
|---|
| 239 | { |
|---|
| 240 | value1.assign((*this)[0].getStr()); |
|---|
| 241 | value2.assign((*this)[1].getStr()); |
|---|
| 242 | value3.assign((*this)[2].getStr()); |
|---|
| 243 | value4.assign((*this)[3].getStr()); |
|---|
| 244 | value5.assign((*this)[4].getStr()); |
|---|
| 245 | value6.assign((*this)[5].getStr()); |
|---|
| 246 | value7.assign((*this)[6].getStr()); |
|---|
| 247 | value8.assign((*this)[7].getStr()); |
|---|
| 248 | (*this) += 8; |
|---|
| 249 | return true; |
|---|
| 250 | } |
|---|
| 251 | else return false; |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | bool Input::read(const char* str) |
|---|
| 255 | { |
|---|
| 256 | if ((*this)[0].matchWord(str)) |
|---|
| 257 | { |
|---|
| 258 | (*this) += 1; |
|---|
| 259 | return true; |
|---|
| 260 | } |
|---|
| 261 | else return false; |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | bool Input::read(const char* str, Parameter value1) |
|---|
| 265 | { |
|---|
| 266 | if ((*this)[0].matchWord(str) && value1.valid((*this)[1].getStr())) |
|---|
| 267 | { |
|---|
| 268 | value1.assign((*this)[1].getStr()); |
|---|
| 269 | (*this) += 2; |
|---|
| 270 | return true; |
|---|
| 271 | } |
|---|
| 272 | else return false; |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | bool Input::read(const char* str, Parameter value1, Parameter value2) |
|---|
| 276 | { |
|---|
| 277 | if ((*this)[0].matchWord(str) && |
|---|
| 278 | value1.valid((*this)[1].getStr()) && |
|---|
| 279 | value2.valid((*this)[2].getStr())) |
|---|
| 280 | { |
|---|
| 281 | value1.assign((*this)[1].getStr()); |
|---|
| 282 | value2.assign((*this)[2].getStr()); |
|---|
| 283 | (*this) += 3; |
|---|
| 284 | return true; |
|---|
| 285 | } |
|---|
| 286 | else return false; |
|---|
| 287 | } |
|---|
| 288 | |
|---|
| 289 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3) |
|---|
| 290 | { |
|---|
| 291 | if ((*this)[0].matchWord(str) && |
|---|
| 292 | value1.valid((*this)[1].getStr()) && |
|---|
| 293 | value2.valid((*this)[2].getStr()) && |
|---|
| 294 | value3.valid((*this)[3].getStr())) |
|---|
| 295 | { |
|---|
| 296 | value1.assign((*this)[1].getStr()); |
|---|
| 297 | value2.assign((*this)[2].getStr()); |
|---|
| 298 | value3.assign((*this)[3].getStr()); |
|---|
| 299 | (*this) += 4; |
|---|
| 300 | return true; |
|---|
| 301 | } |
|---|
| 302 | else return false; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
|---|
| 306 | { |
|---|
| 307 | if ((*this)[0].matchWord(str) && |
|---|
| 308 | value1.valid((*this)[1].getStr()) && |
|---|
| 309 | value2.valid((*this)[2].getStr()) && |
|---|
| 310 | value3.valid((*this)[3].getStr()) && |
|---|
| 311 | value4.valid((*this)[4].getStr())) |
|---|
| 312 | { |
|---|
| 313 | value1.assign((*this)[1].getStr()); |
|---|
| 314 | value2.assign((*this)[2].getStr()); |
|---|
| 315 | value3.assign((*this)[3].getStr()); |
|---|
| 316 | value4.assign((*this)[4].getStr()); |
|---|
| 317 | (*this) += 5; |
|---|
| 318 | return true; |
|---|
| 319 | } |
|---|
| 320 | else return false; |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5) |
|---|
| 324 | { |
|---|
| 325 | if ((*this)[0].matchWord(str) && |
|---|
| 326 | value1.valid((*this)[1].getStr()) && |
|---|
| 327 | value2.valid((*this)[2].getStr()) && |
|---|
| 328 | value3.valid((*this)[3].getStr()) && |
|---|
| 329 | value4.valid((*this)[4].getStr()) && |
|---|
| 330 | value5.valid((*this)[5].getStr())) |
|---|
| 331 | { |
|---|
| 332 | value1.assign((*this)[1].getStr()); |
|---|
| 333 | value2.assign((*this)[2].getStr()); |
|---|
| 334 | value3.assign((*this)[3].getStr()); |
|---|
| 335 | value4.assign((*this)[4].getStr()); |
|---|
| 336 | value5.assign((*this)[5].getStr()); |
|---|
| 337 | (*this) += 6; |
|---|
| 338 | return true; |
|---|
| 339 | } |
|---|
| 340 | else return false; |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6) |
|---|
| 344 | { |
|---|
| 345 | if ((*this)[0].matchWord(str) && |
|---|
| 346 | value1.valid((*this)[1].getStr()) && |
|---|
| 347 | value2.valid((*this)[2].getStr()) && |
|---|
| 348 | value3.valid((*this)[3].getStr()) && |
|---|
| 349 | value4.valid((*this)[4].getStr()) && |
|---|
| 350 | value5.valid((*this)[5].getStr()) && |
|---|
| 351 | value6.valid((*this)[6].getStr())) |
|---|
| 352 | { |
|---|
| 353 | value1.assign((*this)[1].getStr()); |
|---|
| 354 | value2.assign((*this)[2].getStr()); |
|---|
| 355 | value3.assign((*this)[3].getStr()); |
|---|
| 356 | value4.assign((*this)[4].getStr()); |
|---|
| 357 | value5.assign((*this)[5].getStr()); |
|---|
| 358 | value6.assign((*this)[6].getStr()); |
|---|
| 359 | (*this) += 7; |
|---|
| 360 | return true; |
|---|
| 361 | } |
|---|
| 362 | else return false; |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7) |
|---|
| 366 | { |
|---|
| 367 | if ((*this)[0].matchWord(str) && |
|---|
| 368 | value1.valid((*this)[1].getStr()) && |
|---|
| 369 | value2.valid((*this)[2].getStr()) && |
|---|
| 370 | value3.valid((*this)[3].getStr()) && |
|---|
| 371 | value4.valid((*this)[4].getStr()) && |
|---|
| 372 | value5.valid((*this)[5].getStr()) && |
|---|
| 373 | value6.valid((*this)[6].getStr()) && |
|---|
| 374 | value7.valid((*this)[7].getStr())) |
|---|
| 375 | { |
|---|
| 376 | value1.assign((*this)[1].getStr()); |
|---|
| 377 | value2.assign((*this)[2].getStr()); |
|---|
| 378 | value3.assign((*this)[3].getStr()); |
|---|
| 379 | value4.assign((*this)[4].getStr()); |
|---|
| 380 | value5.assign((*this)[5].getStr()); |
|---|
| 381 | value6.assign((*this)[6].getStr()); |
|---|
| 382 | value7.assign((*this)[7].getStr()); |
|---|
| 383 | (*this) += 8; |
|---|
| 384 | return true; |
|---|
| 385 | } |
|---|
| 386 | else return false; |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | bool Input::read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8) |
|---|
| 390 | { |
|---|
| 391 | if ((*this)[0].matchWord(str) && |
|---|
| 392 | value1.valid((*this)[1].getStr()) && |
|---|
| 393 | value2.valid((*this)[2].getStr()) && |
|---|
| 394 | value3.valid((*this)[3].getStr()) && |
|---|
| 395 | value4.valid((*this)[4].getStr()) && |
|---|
| 396 | value5.valid((*this)[5].getStr()) && |
|---|
| 397 | value6.valid((*this)[6].getStr()) && |
|---|
| 398 | value7.valid((*this)[7].getStr()) && |
|---|
| 399 | value8.valid((*this)[8].getStr())) |
|---|
| 400 | { |
|---|
| 401 | value1.assign((*this)[1].getStr()); |
|---|
| 402 | value2.assign((*this)[2].getStr()); |
|---|
| 403 | value3.assign((*this)[3].getStr()); |
|---|
| 404 | value4.assign((*this)[4].getStr()); |
|---|
| 405 | value5.assign((*this)[5].getStr()); |
|---|
| 406 | value6.assign((*this)[6].getStr()); |
|---|
| 407 | value7.assign((*this)[7].getStr()); |
|---|
| 408 | value8.assign((*this)[8].getStr()); |
|---|
| 409 | (*this) += 9; |
|---|
| 410 | return true; |
|---|
| 411 | } |
|---|
| 412 | else return false; |
|---|
| 413 | } |
|---|