New class for ZIP handling (TCastleZip), progress on new pretty wireframe approach, WOFF fonts support, LOD usage demo

Posted on

LOD example
Wireframe tests

Announcing a number of engine improvements from the last weeks:

  1. We have a new class for ZIP handling: TCastleZip. Features:
    • Reading ZIP files from any TStream or URL (see networking about our URL support). Just open ZIP by TCastleZip.Open and read by TCastleZip.Read.

    • Create and write ZIP files. Again, with API consistent with our engine, supporting URLs and so on. Just open ZIP by TCastleZip.OpenEmpty and write by TCastleZip.Write.

    • Optionally register a URL handler, to read or write files inside a ZIP archive by just accesing URL with the given prefix. See TCastleZip.RegisterUrlProtocol for an example. Very comfortable to use ZIP throughout our engine. E.g. you can open TCastleScene using an URL that points to a ZIP file, and relative URLs in the scene (e.g. texture names from a 3D format like glTF or X3D) will be automatically resolved to files inside the ZIP archive. Everything else in our engine also in effect supports ZIP, e.g. you can use FileToString or StringToFile to access ZIP files as well.

      Examples are in the linked API docs and in improved examples/network/custom_url_handler.

    • Works with both FPC and Delphi.

    • Has been tested on really wild examples, to make sure it supports out-of-the-box also files with non-ASCII characters (spaces, Polish characters) with all compilers, for both reading and writing. You can see some of the testcases it passes in tests/code/testcases/testcastlezip.pas and tools/build-tool/tests/testtoolutils.pas.

    • Used also internally in our engine, so it’s really well-tested, we rely on the API being functional and implementation being correct. Our build tool uses it, for both packaging web data to zip, and for packing whole application release to zip. Web target also uses it at run-time to read data — castle-data:/ URLs are resolved to a ZIP file that holds your data on the web, by default.

  2. Using TAbstractShapeNode.Shading with shWireframe value in Pascal (or shading=”WIREFRAME” in X3D) is now supported for all geometry node types.

    This is a new way for rendering things as wireframe. It looks pretty (quads and other polygons look good in wireframe, as we don’t display diagonals) and it works also on OpenGLES and WebGL (as it doesn’t depend on glPolygonMode).

    See roadmap about our wireframe plans. This a step towards uniform support for TCastleRenderOptions.WireframeEffect, also on mobile (OpenGLES) and web (WebGL).

  3. We have added a new simple example examples/viewport_and_scenes/level_of_detail_demo showing how to setup LOD (level of detail) for your 3D models. This is a simple way to optimize rendering, by using simpler geometry for objects that are far away from the camera.

    If you are interested in details, we talk about LOD on the forum thread now too.

  4. We support WOFF fonts throughout the engine. Our underlying FreeType already supported them, we just enhanced some filters (in dialog boxes) and improved our documentation to make it official.

    And by the way, our documentation about text and fonts has been improved in various small ways and documentation about localization (translation) is now on a separate page. Hopefully this makes things easier to find.

Do you like what we do? Please support us on Patreon or donate to keep the engine development going! Thank you!

Start the discussion at Castle Game Engine Forum