/usr/include/crystalspace-2.0/imap/loader.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 | /*
The Crystal Space geometry loader interface
Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IMAP_PARSER_H__
#define __CS_IMAP_PARSER_H__
/**\file
* Geometry loader interface
*/
/**\addtogroup loadsave
* @{ */
#include "csutil/refarr.h"
#include "csutil/refcount.h"
#include "csutil/scf_interface.h"
#include "csutil/threading/condition.h"
#include "igraphic/image.h"
#include "ivideo/txtmgr.h"
#include "imap/streamsource.h"
#include "iutil/job.h"
#include "iutil/threadmanager.h"
#include "csutil/deprecated_warn_off.h"
struct iCameraPosition;
struct iCollection;
struct iDocumentNode;
struct iImage;
struct iLight;
struct iMaterialWrapper;
struct iMeshWrapper;
struct iMeshFactoryWrapper;
struct iSector;
struct iShader;
struct iTextureHandle;
struct iTextureManager;
struct iTextureWrapper;
struct iSharedVariable;
struct iSndSysData;
struct iSndSysWrapper;
struct iSndSysStream;
// The keep type flags for collections.
#define KEEP_ALL 0
#define KEEP_USED 1
/**
* This callback is called when the loader can't find some material,
* texture, factory, mesh, light, shader, or sector. This gives the
* application a chance to manually load it first.
*/
struct iMissingLoaderData : public virtual iBase
{
SCF_INTERFACE (iMissingLoaderData, 1, 0, 0);
/**
* Called when a material is missing. This implementation should
* either attempt to find or load the material or else return 0.
* In the last case the loader will proceed as usual when a material
* is not found.
*/
virtual iMaterialWrapper* MissingMaterial (const char* name,
const char* filename) = 0;
/**
* Called when a texture is missing. This implementation should
* either attempt to find or load the texture or else return 0.
* In the last case the loader will proceed as usual when a texture
* is not found.
*/
virtual iTextureWrapper* MissingTexture (const char* name,
const char* filename) = 0;
/**
* Called when a shader is missing. This implementation should
* either attempt to find or load the shader or else return 0.
* In the last case the loader will proceed as usual when a shader
* is not found.
*/
virtual iShader* MissingShader (const char* name) = 0;
/**
* Called when a mesh factory is missing. This implementation should
* either attempt to find or load the mesh factory or else return 0.
* In the last case the loader will proceed as usual when a mesh factory
* is not found.
*/
virtual iMeshFactoryWrapper* MissingFactory (const char* name) = 0;
/**
* Called when a mesh is missing. This implementation should
* either attempt to find or load the mesh or else return 0.
* In the last case the loader will proceed as usual when a mesh
* is not found.
*/
virtual iMeshWrapper* MissingMesh (const char* name) = 0;
/**
* Called when a sector is missing. This implementation should
* either attempt to find or load the sector or else return 0.
* In the last case the loader will proceed as usual when a sector
* is not found.
*/
virtual iSector* MissingSector (const char* name) = 0;
/**
* Called when a light is missing. This implementation should
* either attempt to find or load the light or else return 0.
* In the last case the loader will proceed as usual when a light
* is not found.
*/
virtual iLight* MissingLight (const char* name) = 0;
};
/**
* Return structure for the iLoader::Load() routines.
*/
struct csLoadResult
{
/// True if the object was loaded successfully.
bool success;
/**
* The object that was loaded. Depending on the file you load this
* can be anything like:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
* Note! In case of a light call DecRef() after you added it to a sector.
* Note! Use scfQueryInterface on 'result' to detect what type was loaded.
*/
csRef<iBase> result;
};
/**
* Return structure for threaded loader functions.
*/
class csLoaderReturn : public scfImplementation1<csLoaderReturn, iThreadReturn>
{
public:
csLoaderReturn(iThreadManager* tm) : scfImplementationType(this),
finished(false), success(false), waitLock(0), wait(0), tm(tm)
{
}
virtual ~csLoaderReturn()
{
}
bool IsFinished()
{
CS::Threading::MutexScopedLock lock(updateLock);
return finished;
}
bool WasSuccessful()
{
CS::Threading::MutexScopedLock lock(updateLock);
return success;
}
void* GetResultPtr()
{ CS_ASSERT_MSG("csLoaderReturn does not implement a void* result", false); return NULL; }
csRef<iBase> GetResultRefPtr() { return result; }
void MarkFinished()
{
if(waitLock)
waitLock->Lock();
{
CS::Threading::MutexScopedLock ulock(updateLock);
finished = true;
if(wait)
{
wait->NotifyAll();
}
}
if(waitLock)
waitLock->Unlock();
}
void MarkSuccessful()
{
CS::Threading::MutexScopedLock lock(updateLock);
success = true;
}
void SetResult(void* result)
{ CS_ASSERT_MSG("csLoaderReturn does not implement a void* result", false); }
void SetResult(csRef<iBase> result) { this->result = result; }
void Copy(iThreadReturn* other)
{
result = other->GetResultRefPtr();
}
void Wait(bool process = true)
{
if(tm.IsValid())
{
csRefArray<iThreadReturn> rets;
rets.Push(this);
tm->Wait(rets, process);
}
}
void SetWaitPtrs(CS::Threading::Condition* c, CS::Threading::Mutex* m)
{
CS::Threading::MutexScopedLock lock(updateLock);
wait = c;
waitLock = m;
}
void SetJob(iJob* j)
{
job = j;
}
iJob* GetJob() const
{
return job;
}
private:
/// True if the loading has finished (should be true at some point).
bool finished;
/// True if the object was loaded successfully.
bool success;
/// Wait condition.
CS::Threading::Mutex* waitLock;
CS::Threading::Condition* wait;
CS::Threading::Mutex updateLock;
/**
* The object that was loaded. Depending on the file you load this
* can be anything like:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
* Note! In case of a light call DecRef() after you added it to a sector.
* Note! Use scfQueryInterface on 'result' to detect what type was loaded.
*/
csRef<iBase> result;
// Reference to the thread manager.
csRef<iThreadManager> tm;
// Pointer to the thread job.
csRef<iJob> job;
};
struct iSectorLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iSectorLoaderIterator, 1, 0, 0);
virtual iSector* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iMeshFactLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iMeshFactLoaderIterator, 1, 0, 0);
virtual iMeshFactoryWrapper* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iMeshLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iMeshLoaderIterator, 1, 0, 0);
virtual iMeshWrapper* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iCamposLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iCamposLoaderIterator, 1, 0, 0);
virtual iCameraPosition* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iTextureLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iTextureLoaderIterator, 1, 0, 0);
virtual iTextureWrapper* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iMaterialLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iMaterialLoaderIterator, 1, 0, 0);
virtual iMaterialWrapper* Next() = 0;
virtual bool HasNext() const = 0;
};
struct iSharedVarLoaderIterator : public virtual iBase
{
SCF_INTERFACE (iSharedVarLoaderIterator, 1, 0, 0);
virtual iSharedVariable* Next() = 0;
virtual bool HasNext() const = 0;
};
/**
* Loader flags
*/
#define CS_LOADER_NONE 0
#define CS_LOADER_CREATE_DUMMY_MATS 1
/**
* This interface represents the threaded map loader methods.
*/
struct iThreadedLoader : public virtual iBase
{
SCF_INTERFACE (iThreadedLoader, 2, 3, 0);
/**
* Get the loader sector list.
*/
virtual csPtr<iSectorLoaderIterator> GetLoaderSectors() = 0;
/**
* Get the loader mesh factory list.
*/
virtual csPtr<iMeshFactLoaderIterator> GetLoaderMeshFactories() = 0;
/**
* Get the loader mesh sector list.
*/
virtual csPtr<iMeshLoaderIterator> GetLoaderMeshes() = 0;
/**
* Get the loader camera list.
*/
virtual csPtr<iCamposLoaderIterator> GetLoaderCameraPositions() = 0;
/**
* Get the loader texture list.
*/
virtual csPtr<iTextureLoaderIterator> GetLoaderTextures() = 0;
/**
* Get the loader material list.
*/
virtual csPtr<iMaterialLoaderIterator> GetLoaderMaterials() = 0;
/**
* Get the loader shared variable list.
*/
virtual csPtr<iSharedVarLoaderIterator> GetLoaderSharedVariables() = 0;
/**
* Load an image file. The image will be loaded in the format requested by
* the engine. If no engine exists, the format is taken from the video
* renderer. If no video renderer exists, this function fails. You may also
* request an alternate format to override the above sequence.
* \param result Result of the method call.
* \param Filename VFS path to the image file to load.
* \param Format The format of the image.
*/
THREADED_INTERFACE4(LoadImage, const char* cwd, const char* Filename, int Format = CS_IMGFMT_INVALID,
bool do_verbose = false);
/**
* Load an image file. The image will be loaded in the format requested by
* the engine. If no engine exists, the format is taken from the video
* renderer. If no video renderer exists, this function fails. You may also
* request an alternate format to override the above sequence.
* This version reads the image from a data buffer.
*/
THREADED_INTERFACE4(LoadImage, const char* cwd, csRef<iDataBuffer> buf, int Format = CS_IMGFMT_INVALID,
bool do_verbose = false);
/**
* Load an image as with LoadImage() and create a texture handle from it.
* \param result Result of the method call.
* \param Filename VFS path to the image file to load.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param image Optionally returns a reference to the loaded image.
*/
THREADED_INTERFACE6(LoadTexture, const char* cwd, const char* Filename, int Flags = CS_TEXTURE_3D,
csRef<iTextureManager> tm = 0, csRef<iImage>* image = 0, bool do_verbose = false);
/**
* Load an image as with LoadImage() and create a texture handle from it.
* This version reads the image from a data buffer.
* \param buf Buffer containing the image file data.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param image Optionally returns a reference to the loaded image.
*/
THREADED_INTERFACE6(LoadTexture, const char* cwd, csRef<iDataBuffer> buf, int Flags = CS_TEXTURE_3D,
csRef<iTextureManager> texman = 0, csRef<iImage>* image = 0, bool do_verbose = false);
/**
* Load a texture as with LoadTexture() above and register it with the
* engine. This version reads the image from a data buffer.
*
* \param Name The name that the engine will use for the wrapper.
* \param buf Buffer containing the image file data.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param reg if true then the texture and material will be registered
* to the texture manager. Set 'register' to false if you plan on calling
* 'iEngine::Prepare()' later as that function will take care of registering
* too.
* \param create_material if true then this function also creates a
* material for the texture.
* \param free_image if true then after registration the loaded image
* will be removed immediatelly. This saves some memory. Set to false
* if you want to keep it. free_image is ignored if reg is false.
*/
THREADED_INTERFACE9(LoadTexture, const char* cwd, const char *Name, csRef<iDataBuffer> buf,
int Flags = CS_TEXTURE_3D, csRef<iTextureManager> texman = 0, bool reg = true,
bool create_material = true, bool free_image = true, bool do_verbose = false);
//@{
/**
* Load a texture as with LoadTexture() above and register it with the
* engine.
*
* \param Name The name that the engine will use for the wrapper.
* \param FileName VFS path to the image file to load.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param reg If true then the texture and material will be registered
* to the texture manager. Set 'register' to false if you plan on calling
* 'iEngine::Prepare()' later as that function will take care of registering
* too.
* \param create_material If true then this function also creates a
* material for the texture.
* \param free_image If true then after registration the loaded image
* will be removed immediatelly. This saves some memory. Set to false
* if you want to keep it. free_image is ignored if reg is false.
* \param collection [optional] Collection to register the texture
* and material to.
*/
THREADED_INTERFACE11(LoadTexture, const char* cwd, const char *Name, const char *FileName,
int Flags = CS_TEXTURE_3D, csRef<iTextureManager> texman = 0, bool reg = true,
bool create_material = true, bool free_image = true, csRef<iCollection> Collection = 0,
uint keepFlags = KEEP_ALL, bool do_verbose = false);
//@}
/// New Sound System: Load a sound file and return an iSndSysData object
THREADED_INTERFACE3(LoadSoundSysData, const char* cwd, const char *fname,
bool do_verbose = false);
/**
* New Sound System: Load a sound file and create a stream from it.
* \param fname is the VFS filename.
* \param mode3d is one of CS_SND3D_DISABLE, CS_SND3D_RELATIVE, or
* CS_SND3D_ABSOLUTE.
*/
THREADED_INTERFACE4(LoadSoundStream, const char* cwd, const char *fname, int mode3d,
bool do_verbose = false);
/**
* New Sound System: Load a sound file, create sound data and create a
* wrapper object for it.
* \param name of the sound.
* \param fname is the VFS filename.
*/
THREADED_INTERFACE4(LoadSoundWrapper, const char* cwd, const char *name, const char *fname,
bool do_verbose = false);
/**
* Load a Mesh Object Factory from a file.
* \param fname is the VFS name of the file.
* \param ssource is an optional stream source for faster loading.
*/
THREADED_INTERFACE4(LoadMeshObjectFactory, const char* cwd, const char* fname, csRef<iStreamSource> ssource = 0,
bool do_verbose = false);
/**
* Load a mesh object from a file.
* The mesh object is not automatically added to any sector.
* \param fname is the VFS name of the file.
* \param ssource is an optional stream source for faster loading.
*/
THREADED_INTERFACE4(LoadMeshObject, const char* cwd, const char* fname, csRef<iStreamSource> ssource = 0,
bool do_verbose = false);
/**
* Load a shader from a file.
*/
THREADED_INTERFACE4(LoadShader, const char* cwd, const char* filename, bool registerShader = true,
bool do_verbose = false);
//@}
/**
* Load a map file. If 'clearEngine' is true then the current contents
* of the engine will be deleted before loading.
* If 'region' is not 0 then portals will only connect to the
* sectors in that region, things will only use thing templates
* defined in that region and meshes will only use mesh factories
* defined in that region. If the region is not 0 and curRegOnly is true
* then objects (materials, factories, ...) will only be found in the
* given region.
* <p>
* \param filename is a VFS filename for the XML file.
* \param clearEngine is true by default which means that the previous
* contents of the engine is cleared (all objects/sectors/... are removed).
* \param collection is 0 by default which means that all loaded
* objects are added to the default collection. If you give a collection
* here then all loaded objects will be added to that collection (subject
* to keepFlags).
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param Set useProxyTextures to true if you're loading materials and
* textures from a library shared with other maps.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
* This argument is only used in conjunction with Collections, and overrides the value
* of useProxyTextures in that case.
*/
THREADED_INTERFACE8(LoadMapFile, const char* cwd, const char* filename, bool clearEngine = true,
csRef<iCollection> collection = 0, csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0,
uint keepFlags = KEEP_ALL, bool do_verbose = false);
//@}
//@{
/**
* Load a map from the given 'world' node. If 'clearEngine' is true then
* the current contents of the engine will be deleted before loading.
* If 'region' is not 0 then portals will only connect to the
* sectors in that region, things will only use thing templates
* defined in that region and meshes will only use mesh factories
* defined in that region. If the region is not 0 and curRegOnly is true
* then objects (materials, factories, ...) will only be found in the
* given region.
* <p>
* \param world_node is the 'world' node from an XML document.
* \param clearEngine is true by default which means that the previous
* contents of the engine is cleared (all objects/sectors/... are removed).
* \param collection is 0 by default which means that all loaded objects are not
* added to any collection. If you give a collection here then all loaded objects
* will be added to that collection.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param Set useProxyTextures to true if you're loading materials and
* textures from a library shared with other maps.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
* This argument is only used in conjunction with Collections, and overrides the value
* of useProxyTextures in that case.
*/
THREADED_INTERFACE8(LoadMap, const char* cwd, csRef<iDocumentNode> world_node, bool clearEngine = true,
csRef<iCollection> collection = 0, csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0,
uint keepFlags = KEEP_ALL, bool do_verbose = false);
//@}
//@{
/**
* Load library from a VFS file
* \param filename is a VFS filename for the XML file.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
THREADED_INTERFACE7(LoadLibraryFile, const char* cwd, const char* filename, csRef<iCollection> collection = 0,
csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0, uint keepFlags = KEEP_ALL,
bool do_verbose = false);
//@}
//@{
/**
* Load library from a 'library' node.
* \param lib_node is the 'library' node from an XML document.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
THREADED_INTERFACE7(LoadLibrary, const char* cwd, csRef<iDocumentNode> lib_node, csRef<iCollection> collection = 0,
csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0, uint keepFlags = KEEP_ALL,
bool do_verbose = false);
//@)
//@{
/**
* Load a file. This is a smart function that will try to recognize
* what kind of file it is. It recognizes the following types of
* files:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 3ds/md2 models: 'result' will be the mesh factory wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* Returns csLoadResult.
* <br>
* Note! In case a world file is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param fname is a VFS filename for the XML file.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
THREADED_INTERFACE7(LoadFile, const char* cwd, const char* fname, csRef<iCollection> collection = 0,
csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0, uint keepFlags = KEEP_ALL,
bool do_verbose = false);
//@}
//@{
/**
* Load a file. This is a smart function that will try to recognize
* what kind of file it is. It recognizes the following types of
* files:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 3ds/md2 models: 'result' will be the mesh factory wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* Returns csLoadResult.
* <br>
* Note! In case a world file is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param buffer is a buffer for the model contents.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
THREADED_INTERFACE7(LoadBuffer, const char* cwd, csRef<iDataBuffer> buffer, csRef<iCollection> collection = 0,
csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0, uint keepFlags = KEEP_ALL,
bool do_verbose = false);
//@}
//@{
/**
* Load a node. This is a smart function that will try to recognize
* what kind of node it is. It recognizes the following types of
* nodes:
* - 'world' node: in that case 'result' will be set to the engine.
* - 'library' node: 'result' will be 0.
* - 'meshfact' node: 'result' will be the mesh factory wrapper.
* - 'meshobj' node: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* <br>
* Note! In case a world node is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param node is the node from which to read.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring collections). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
THREADED_INTERFACE8(LoadNode, const char* cwd, csRef<iDocumentNode> node, csRef<iCollection> collection = 0,
csRef<iSector> sector = 0, csRef<iStreamSource> ssource = 0, csRef<iMissingLoaderData> missingdata = 0,
uint keepFlags = KEEP_ALL, bool do_verbose = false);
//@}
/// Add object to the transfer list.
virtual void AddSectorToList(iSector* obj) = 0;
virtual void AddMeshFactToList(iMeshFactoryWrapper* obj) = 0;
virtual void AddMeshToList(iMeshWrapper* obj) = 0;
virtual void AddCamposToList(iCameraPosition* obj) = 0;
virtual void AddTextureToList(iTextureWrapper* obj) = 0;
virtual void AddMaterialToList(iMaterialWrapper* obj) = 0;
virtual void AddSharedVarToList(iSharedVariable* obj) = 0;
virtual void MarkSyncDone() = 0;
// Get/Set loader flags.
virtual const int& GetFlags () const = 0;
virtual void SetFlags (int flags) = 0;
};
/**
* This interface represents the map loader.
*/
struct iLoader : public virtual iBase
{
SCF_INTERFACE (iLoader, 5, 0, 0);
/////////////////////////// Generic ///////////////////////////
/**
* Load an image file. The image will be loaded in the format requested by
* the engine. If no engine exists, the format is taken from the video
* renderer. If no video renderer exists, this function fails. You may also
* request an alternate format to override the above sequence.
*/
virtual csPtr<iImage> LoadImage (const char* Filename,
int Format = CS_IMGFMT_INVALID) = 0;
/**
* Load an image as with LoadImage() and create a texture handle from it.
* \param Filename VFS path to the image file to load.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param image Optionally returns a reference to the loaded image.
*/
virtual csPtr<iTextureHandle> LoadTexture (const char* Filename,
int Flags = CS_TEXTURE_3D, iTextureManager *tm = 0,
csRef<iImage>* image=0) = 0;
/// New Sound System: Load a sound file and return an iSndSysData object
virtual csPtr<iSndSysData> LoadSoundSysData (const char *fname) = 0;
/**
* New Sound System: Load a sound file and create a stream from it.
* \param fname is the VFS filename.
* \param mode3d is one of CS_SND3D_DISABLE, CS_SND3D_RELATIVE, or
* CS_SND3D_ABSOLUTE.
*/
virtual csPtr<iSndSysStream> LoadSoundStream (const char *fname,
int mode3d) = 0;
/**
* New Sound System: Load a sound file, create sound data and create a
* wrapper object for it.
* \param name of the sound.
* \param fname is the VFS filename.
*/
virtual iSndSysWrapper* LoadSoundWrapper (const char *name,
const char *fname) = 0;
/**
* Load an image file. The image will be loaded in the format requested by
* the engine. If no engine exists, the format is taken from the video
* renderer. If no video renderer exists, this function fails. You may also
* request an alternate format to override the above sequence.
* This version reads the image from a data buffer.
*/
virtual csPtr<iImage> LoadImage (iDataBuffer* buf,
int Format = CS_IMGFMT_INVALID) = 0;
/**
* Load an image as with LoadImage() and create a texture handle from it.
* This version reads the image from a data buffer.
* \param buf Buffer containing the image file data.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param image Optionally returns a reference to the loaded image.
*/
virtual csPtr<iTextureHandle> LoadTexture (iDataBuffer* buf,
int Flags = CS_TEXTURE_3D, iTextureManager *tm = 0,
csRef<iImage>* image=0) = 0;
/**
* Load a texture as with LoadTexture() above and register it with the
* engine. This version reads the image from a data buffer.
*
* \param Name The name that the engine will use for the wrapper.
* \param buf Buffer containing the image file data.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param reg if true then the texture and material will be registered
* to the texture manager. Set 'register' to false if you plan on calling
* 'iEngine::Prepare()' later as that function will take care of registering
* too.
* \param create_material if true then this function also creates a
* material for the texture.
* \param free_image if true then after registration the loaded image
* will be removed immediatelly. This saves some memory. Set to false
* if you want to keep it. free_image is ignored if reg is false.
*/
virtual iTextureWrapper* LoadTexture (const char *Name,
iDataBuffer* buf,
int Flags = CS_TEXTURE_3D, iTextureManager *tm = 0,
bool reg = true, bool create_material = true,
bool free_image = true) = 0;
/**
* Load a Mesh Object Factory from a file.
* \param fname is the VFS name of the file.
* \param ssource is an optional stream source for faster loading.
*/
virtual csPtr<iMeshFactoryWrapper> LoadMeshObjectFactory (
const char* fname, iStreamSource* ssource = 0) = 0;
/**
* Load a mesh object from a file.
* The mesh object is not automatically added to any sector.
* \param fname is the VFS name of the file.
* \param ssource is an optional stream source for faster loading.
*/
virtual csPtr<iMeshWrapper> LoadMeshObject (const char* fname,
iStreamSource* ssource = 0) = 0;
/**
* Load a shader from a file.
*/
virtual csRef<iShader> LoadShader (const char* filename, bool registerShader = true) = 0;
//@{
/**
* Load a texture as with LoadTexture() above and register it with the
* engine.
*
* \param Name The name that the engine will use for the wrapper.
* \param FileName VFS path to the image file to load.
* \param Flags Accepts the flags described in ivideo/txtmgr.h.
* The texture manager determines the format, so choosing an alternate
* format doesn't make sense here. Instead you may choose an alternate
* texture manager.
* \param tm Texture manager, used to determine the format the image is to
* be loaded in (defaults to CS_IMGFMT_TRUECOLOR if no texture manager is
* specified).
* \param reg If true then the texture and material will be registered
* to the texture manager. Set 'register' to false if you plan on calling
* 'iEngine::Prepare()' later as that function will take care of registering
* too.
* \param create_material If true then this function also creates a
* material for the texture.
* \param free_image If true then after registration the loaded image
* will be removed immediatelly. This saves some memory. Set to false
* if you want to keep it. free_image is ignored if reg is false.
* \param collection [optional] Collection to register the texture
* and material to.
*/
virtual iTextureWrapper* LoadTexture (const char *Name,
const char *FileName, int Flags = CS_TEXTURE_3D, iTextureManager *tm = 0,
bool reg = true, bool create_material = true, bool free_image = true,
iCollection* Collection = 0, uint keepFlags = KEEP_ALL) = 0;
//@}
//@}
/**
* Load a map file. If 'clearEngine' is true then the current contents
* of the engine will be deleted before loading.
* If 'region' is not 0 then portals will only connect to the
* sectors in that region, things will only use thing templates
* defined in that region and meshes will only use mesh factories
* defined in that region. If the region is not 0 and curRegOnly is true
* then objects (materials, factories, ...) will only be found in the
* given region.
* <p>
* \param filename is a VFS filename for the XML file.
* \param clearEngine is true by default which means that the previous
* contents of the engine is cleared (all objects/sectors/... are removed).
* \param collection is 0 by default which means that all loaded
* objects are added to the default collection. If you give a collection
* here then all loaded objects will be added to that collection (subject
* to keepFlags).
* \param curRegOnly is true by default which means that it will only
* find materials/factories/... from current region if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param Set useProxyTextures to true if you're loading materials and
* textures from a library shared with other maps.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
* This argument is only used in conjunction with Collections, and overrides the value
* of useProxyTextures in that case.
*/
virtual bool LoadMapFile (const char* filename, bool clearEngine = true,
iCollection* collection = 0, bool curRegOnly = true,
bool checkDupes = false, iStreamSource* ssource = 0,
iMissingLoaderData* missingdata = 0, uint keepFlags = KEEP_ALL) = 0;
//@}
//@{
/**
* Load a map from the given 'world' node. If 'clearEngine' is true then
* the current contents of the engine will be deleted before loading.
* If 'region' is not 0 then portals will only connect to the
* sectors in that region, things will only use thing templates
* defined in that region and meshes will only use mesh factories
* defined in that region. If the region is not 0 and curRegOnly is true
* then objects (materials, factories, ...) will only be found in the
* given region.
* <p>
* \param world_node is the 'world' node from an XML document.
* \param clearEngine is true by default which means that the previous
* contents of the engine is cleared (all objects/sectors/... are removed).
* \param collection is 0 by default which means that all loaded objects are not
* added to any collection. If you give a region here then all loaded objects
* will be added to that region.
* \param curRegOnly is true by default which means that it will only
* find materials/factories/... from current region if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param Set useProxyTextures to true if you're loading materials and
* textures from a library shared with other maps.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
* This argument is only used in conjunction with Collections, and overrides the value
* of useProxyTextures in that case.
*/
virtual bool LoadMap (iDocumentNode* world_node, bool clearEngine = true,
iCollection* collection = 0, bool curRegOnly = true,
bool checkDupes = false, iStreamSource* ssource = 0,
iMissingLoaderData* missingdata = 0, uint keepFlags = KEEP_ALL) = 0;
//@}
//@{
/**
* Load library from a VFS file
* \param filename is a VFS filename for the XML file.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
virtual bool LoadLibraryFile (const char* filename, iCollection* collection = 0,
bool searchCollectionOnly = true, bool checkDupes = false, iStreamSource* ssource = 0,
iMissingLoaderData* missingdata = 0, uint keepFlags = KEEP_ALL) = 0;
//@}
//@{
/**
* Load library from a 'library' node.
* \param lib_node is the 'library' node from an XML document.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
virtual bool LoadLibrary (iDocumentNode* lib_node, iCollection* collection = 0,
bool searchCollectionOnly = true, bool checkDupes = false, iStreamSource* ssource = 0,
iMissingLoaderData* missingdata = 0, uint keepFlags = KEEP_ALL) = 0;
//@)
//@{
/**
* Load a file. This is a smart function that will try to recognize
* what kind of file it is. It recognizes the following types of
* files:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 3ds/md2 models: 'result' will be the mesh factory wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* Returns csLoadResult.
* <br>
* Note! In case a world file is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param fname is a VFS filename for the XML file.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param override_name if this is given the the name of the loaded object
* will be set to that. This only works in case of meshfact, meshobj, and
* 3ds or md2 model.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
virtual csLoadResult Load (const char* fname, iCollection* collection = 0,
bool searchCollectionOnly = true, bool checkDupes = false, iStreamSource* ssource = 0,
const char* override_name = 0, iMissingLoaderData* missingdata = 0,
uint keepFlags = KEEP_ALL) = 0;
//@}
//@{
/**
* Load a file. This is a smart function that will try to recognize
* what kind of file it is. It recognizes the following types of
* files:
* - 'world' file: in that case 'result' will be set to the engine.
* - 'library' file: 'result' will be 0.
* - 'meshfact' file: 'result' will be the mesh factory wrapper.
* - 'meshobj' file: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 3ds/md2 models: 'result' will be the mesh factory wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* Returns csLoadResult.
* <br>
* Note! In case a world file is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param buffer is a buffer for the model contents.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param override_name if this is given the the name of the loaded object
* will be set to that. This only works in case of meshfact, meshobj, and
* 3ds or md2 model.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
virtual csLoadResult Load (iDataBuffer* buffer, iCollection* collection = 0,
bool searchCollectionOnly = true, bool checkDupes = false, iStreamSource* ssource = 0,
const char* override_name = 0, iMissingLoaderData* missingdata = 0,
uint keepFlags = KEEP_ALL) = 0;
//@}
//@{
/**
* Load a node. This is a smart function that will try to recognize
* what kind of node it is. It recognizes the following types of
* nodes:
* - 'world' node: in that case 'result' will be set to the engine.
* - 'library' node: 'result' will be 0.
* - 'meshfact' node: 'result' will be the mesh factory wrapper.
* - 'meshobj' node: 'result' will be the mesh wrapper.
* - 'meshref' file: 'result' will be the mesh wrapper.
* - 'portals' file: 'result' will be the portal's mesh wrapper.
* - 'light' file: 'result' will be the light.
*
* Returns csLoadResult.
* <br>
* Note! In case a world node is loaded this function will NOT
* clear the engine!
* <br>
* Note! In case a mesh factory or mesh object is loaded this function
* will not actually do anything if checkDupes is true and the mesh or
* factory is already in memory (with that name). This function will
* still return true in that case and set 'result' to the correct object.
* <br>
* \param node is the node from which to read.
* \param collection is 0 by default which means that all loaded objects are
* either added to the default collection or not added to any collection,
* depending on the value of the keepFlags argument.
* \param searchCollectionOnly is true by default which means that it will only
* find materials/factories/... from current collection if that is given.
* \param checkDupes if true then materials, textures,
* and mesh factories will only be loaded if they don't already exist
* in the entire engine (ignoring regions). By default this is false because
* it is very legal for different world files to have different objects
* with the same name. Only use checkDupes == true if you know that your
* objects have unique names accross all world files.
* \param ssource is an optional stream source for faster loading.
* \param override_name if this is given the the name of the loaded object
* will be set to that. This only works in case of meshfact, meshobj, and
* 3ds or md2 model.
* \param missingdata is an optional callback in case data is missing.
* The application can then provide that missing data in some other way.
* \param keepFlags Use these to define whether or not you wish to guarantee
* that all loaded resources are kept (default to KEEP_ALL). KEEP_USED is useful
* when you are loading from a shared library containing more resources than you
* actually need (a world file loading from a shared library of textures for example).
*/
virtual csLoadResult Load (iDocumentNode* node, iCollection* collection = 0,
bool searchCollectionOnly = true, bool checkDupes = false, iStreamSource* ssource = 0,
const char* override_name = 0, iMissingLoaderData* missingdata = 0,
uint keepFlags = KEEP_ALL) = 0;
//@}
};
/** @} */
#include "csutil/deprecated_warn_on.h"
#endif // __CS_IMAP_PARSER_H__
|