in Engine

Castle Game Engine: More integration with Vampyre Imaging Library, used by default with both FPC and Delphi

From Castle Game Engine: link to original post

Castle Game Engine editor with 3D level Castle Game Engine Lazarus packages Castle Game Engine images demo

We’re moving further with Vampyre Imaging Library integration, to have more features related to image loading and at the same time less code to maintain in Castle Game Engine.

  1. We now use Vampyre always, by default, with both FPC and Delphi. This makes our code simpler and more consistent.

    Note: our castle_base.lpk depends on Vampyre Lazarus packages, to use Vampyre packages in a clean (Lazarus) way, using all compilation configuration done by Vampyre authors. This is important if you compile using Lazarus (though project LPI file, that in turn uses LPK packages).

    After updating to latest CGE, be sure to use “Preferences -> FPC and Lazarus -> Register Lazarus Packages” in CGE editor,or just open in Lazarus and compile these 2 packages:

    src/vampyre_imaginglib/src/Packages/VampyreImaginePackage.lpk
    src/vampyre_imaginglib/src/Packages/VampyreImaginePackageExt.lpk
    

    This doesn’t matter if you compile using Delphi, or using CGE build tool that executes FPC directly (passing paths to CGE and Vampyre, without relying on Lazarus LPI/LPK information).

  2. We now rely on Vampyre for loading and saving of BMP, PPM and RGBE image formats.

    I completely removed the old code for handling these image formats (without Vampyre) in CGE. This means less code in CGE which makes me happy 🙂 Moreover, Vampyre brings some extra features: handles RLE-compressed BMP files, can save RGBE files with compression.

  3. We synchronized with latest Vampyre Imaging Library code, and reenabled JP2 and TIFF saving using Vampyre. We check TSingleImage.SaveToStream to know if it’s successful.

  4. For now, you can still disable Vampyre usage, by removing {$define USE_VAMPYRE_IMAGING} from our src/common_includes/castleconf.inc.

    If you have a good reason to do this (disable Vampyre), please tell us (on forum or Discord) — we want to know about it. In the future, Vampyre may be just non-optional dependency of CGE, and we’ll integrate more and just use Vampyre as our image container in memory (right now we copy data between Vampyre and CGE TCastleImage, TGPUCompressedImage, instead of referencing it).