New features: KTX (Khronos texture format), nvcompress, X3D helpers…

Posted on

lets_take_a_walk_screen_3
lets_take_a_walk_screen_4
lets_take_a_walk_screen_5
fps_game_screen_0
fps_game_screen_2

As a little break from the work on Delphi compatibility, I added some new features to the engine 🙂

  1. KTX (Khronos Texture format) support throughout the engine. See the details about KTX features supported. KTX format is in many ways an alternative to DDS, with a clean specification, supporting the same features (GPU compression, 2D and 3D textures…). The KTX Khronos page has links to various tools that can create KTX files.

    You can test it now by downloading glViewImage 1.7.0! Sample KTX files are e.g. inside official KTX repository.

  2. Support nvcompress for automatic compressing of textures for GPU.

    nvcompress is part of the NVidia Texture Tools. It is cross-platform (Windows, Linux…), free and open source. On Debian and derivatives (like Ubuntu) you can install it simply by apt-get install libnvtt-bin. Thanks to Eugene Loza for advicing it!

    The nvcompress will be automatically used underneath when you call castle-engine auto-generate-textures in your project. This requires using our build tool to manage your game project.

  3. Our fps_demo shows how to easily get texture compression in your games. See the material_properties.xml in fps_game for how to trivially compress your textures to DXT1 and DXT5. See material_properties.xml and texture compression documentation for more information.

    There was also an important fix to using this approach for textures referenced from X3D.

  4. Useful helpers for X3D building, to easily create and modify X3D graph:

    • New methods AddChildren, RemoveChildren for grouping nodes (like TTransformNode, TGroupNode).
    • New methods CreateShape, CreateTransform for geometry nodes (like TBoxNode, TIndexedFaceSetNode).
    • Also on geometry nodes: Coord, FogCoord, TexCoord and some more are now simple properties.
    • SetXxx methods available to set various multiple-value (array) fields. Use them like this:
      Coord.SetPoint([Vector3(...), Vector3(...)]);
      IndexedFaceSet.SetCoordIndex([0, 1, 2]);
      Inline.SetUrl(['my_file.x3d']);
      

      These look much better than

      Coord.FdPoint.Items.Assign([Vector3(...), Vector3(...)]);
      Coord.FdPoint.Changed;
      

      and they always cause an appropriate update (they automatically will call Changed for you, and send the new value using X3D events).

    This is all part of my ongoing effort to enable you to operate on X3D graph more comfortably, without accessing “somewhat-internal” fields instances in FdXxx (like FdChildren, FdCoord…).

  5. Improved and simplified lets_take_a_walk example (examples/3d_sound_game/).
Comments on the forum ➤

Delphi base compatibility, Spine improvements, other stuff :)

Posted on

Delphi running CGE base test :)
  1. Intensive work on the engine Delphi compatibility is ongoing 🙂

    We can now actually compile and run in Delphi (10.2) a simple console demo using our “base” units. Vectors, matrices, colors, rectangles, time measuring, logging, a lot of string and class and other utilities… it’s all working in Delphi. This is the demo code.

    In parallel, I’m fixing the syntax of all the code to compile in “FPC Delphi test mode”, this is providing a nice baseline to later compile in the actual Delphi. On this front, I almost finished porting everything non-visual (I’m finishing the X3DNodes unit, which is a huge unit that depends on almost everything non-visual in the engine). So, we’re close 🙂

    The “FPC Delphi test mode” means that we use FPC, but in Delphi mode, and disable macros, and disable operators like += etc. And I can run on Linux too, which is comfortable for me 🙂 So it’s like “make FPC behave as much as Delphi”. Any changes required at this stage would be required by Delphi too. To use it, you can set environment variable CASTLE_ENGINE_TEST_DELPHI_MODE to “true” before running the build tool.

  2. Units cleanup was done along the way. I rearranged some units, to remove some uncomfortable dependencies (when too many units are inter-dependent on each other). In effect, we now have a “files” unit group that includes units from old group “net” + units dealing with files. More details in the units map in the wiki.

  3. Spine (2D animations format) improvements:

    1. When animating in Spine using Bezier curves (translations or rotations), the resulting movement in our engine is now exactly what you see in Spine.
    2. Animating the scale in Spine is now fixed (it was accidentally changing the order of layers).
  4. DDS (image file format) improvements: support reading DX10 + DXGI_FORMAT_R8G8B8A8_UNORM case (produced e.g. by PowerVR Texture Tools when converting RGBA image to DDS).

  5. In a spur of the moment, I wrote a short page about “What are range and overflow checks (and errors) in Pascal” 🙂

  6. TDebug3D class is a new simple approach to visualize debug things attached to 3D objects.

Comments on the forum (1) ➤