LightsprintSDK 2021.08.08
|
Functions | |
void RR_IO_API | registerIO (int argc, char **argv, unsigned step=0) |
void RR_IO_API | isolateIO (int argc, char **argv) |
LightsprintIO - import and export of scenes, textures, vertex buffers, videos, materials.
void RR_IO_API rr_io::registerIO | ( | int | argc, |
char ** | argv, | ||
unsigned | step = 0 |
||
) |
Registers callbacks for loading and saving scenes, textures and videos in ~75 fileformats (Supported formats).
After registering loaders and savers, use
argc | Copy of your main() argument. Used only for import isolation on non-Windows platforms, can be 0 otherwise. |
argv | Copy of your main() argument. Used only for import isolation on non-Windows platforms, can be nullptr otherwise. |
step | Keep empty. Only if you need to register your own isolated loader for fileformat already supported by LightsprintIO, all without modifying LightsprintIO, call registerIO(1); registerYourLoader(); registerIO(2); isolateIO(); |
void RR_IO_API rr_io::isolateIO | ( | int | argc, |
char ** | argv | ||
) |
Isolates scene loaders and saver, makes them run in separated processes.
Isolation increases robustness of main application, by protecting it against various ill effects of low quality importers and exporters. Although no problems are known within Lightsprint's importers/exporters, imagine that one day in future, you run e.g. into memory corruption problem. Without isolated importers, any part of codebase can be responsible for corruption, it's tough problem to debug. With isolation, importers/exporters are ruled out as a source of problem (they make more than 50% of lines of code in Lightsprint SDK).
When isolating loaders/savers, your program startup should look like
Isolation works by rerunning our own executable as a separated process with special arguments each time scene needs to be imported. This function checks for special arguments and if found, it converts the scene to .rr3 and exits. Therefore you should run this function as soon in your application as possible (before all slow steps), and you should let it exit, if it needs to. Caller then imports newly created .rr3, and deletes it. If isolated process fails to import the scene or write it back as .rr3, caller tries to import the scene without isolation.
.rr3 fileformat is never isolated, it is used for transferring data between processes.
argc | Copy of your main() argument. Used only on non-Windows platforms, can be 0 otherwise. |
argv | Copy of your main() argument. Used only on non-Windows platforms, can be nullptr otherwise. |