Simplifications, optimizations, GTK backend suitable for testing OpenGLES too

Posted on

mobile/simple_3d_demo screenshot
  1. We had a few methods that needlessly traversed whole TCastleTransform hierarchy. Reworking them was an optimization and also an API simplification (IOW, a “no-brainer” 🙂 ). Changes:

    1. TCastleTransform.Press, TCastleTransform.Release are now only called when TCastleTransform.ListenPressRelease is true.

      The need to process keys in TCastleTransform is very seldom (we only had 2 use-cases for it in the engine, one is in soon-to-be-deprecated CastlePlayer, the other was for X3D key sensors which are not very useful for normal engine usage).

    2. TCastleTransform.CameraChanged, TCastleTransform.UpdateGeneratedTextures, TCastleTransform.VisibleChangeHere virtual methods removed (their use-case is now implemented as an internal mechanism, tailored to factual needs, not needing to be recursive).

    3. TCastleTransform.Dragging removed (not needed, a simple Boolean internal field that tracks “whether something is between PointingDevicePress and PointingDeviceRelease” is enough).

  2. CastleWindow GTK backend (default on Linux) can now initialize OpenGLES context using EGL. (Note that it was already possible with Xlib backend previously.)

    This allows to test OpenGLES rendering on desktops, just define symbol OpenGLES at compilation (e.g. by adding it to CastleEngineManifest.xml, or just tweak one line of src/base/ And make sure you have OpenGLES installed (libgles2 package on Debian and similar).

  3. Updated documentation about CastleWindow backends.

  4. Optimized bounding box calculation for meshes (boxes are now a little less optimal, but much faster calculated; undefine FAST_MESH_BOUNDING_BOXES if you want to try again the old method).

  5. Optimized GeneratedCubeMap with update=NONE (should take zero time, was accidentally consuming some).

  6. Fixed LOD node behavior under transformation animation (testcase: navigation/lod_test.x3dv in demo-models).

Comments on the forum ➤

Demo of showing loading progress, WaitForRenderAndCall utility, new TCastleTouchNavigation

Posted on

zombie_fighter demo - loading
zombie_fighter demo
zombie_fighter demo
  1. We have new TUIState.WaitForRenderAndCall utility, especially useful to implement loading inside TUIState descendant.

  2. Our examples/user_interface/zombie_fighter features now a demo showing loading progress (as a descendant of TUIState, which is our advised approach for loading screens now).

  3. Whole examples/user_interface/zombie_fighter was remade to use editor.

  4. We have a new UI control, available from code and in editor: TCastleTouchNavigation.

    This shows controls that you can drag to navigate within a viewport. Thus it allows navigation in a TCastleViewport on touch devices. It is a “reboot” of previous TCastleWindowTouch use-case, now expressed as UI control that can have any size, can be attached to any viewport, and in general is consistent with the rest of CGE.

    In a typical usage scenario, you just add it as a child of TCastleViewport, set FullSize=true, set Viewport to the parent. Then control the touch interface. It is easiest to call MyTouchNavigation.AutoTouchInterface := true to let it be automatically assigned. Set MyTouchNavigation.AutoTouchInterface := ApplicationProperties.TouchDevice to let it be automatically assigned, but only on touch devices (that do not have regular keyboard / mouse).

    See TCastleTouchNavigation API docs for more info. An example is in examples/mobile/simple_3d_demo.

Comments on the forum ➤

Interactive example showing our collision routines, various engine and editor improvements

Posted on

collisions example screenshot
collisions example screenshot - sphere collision
  1. I made a nice new example to demonstrate our collision checking routines examples/3d_rendering_processing/collisions:

  2. Sphere collisions are now more precise (at least when uniform scaling is used for transformations),

  3. TCastleTransform.CollisionSphereRadius is visible in the editor,

  4. Added various properties to Basic tab on editor,

  5. Nicer editor behavior when toggling TCastleViewport.AutoCamera (or changing MainScene when AutoCamera=true), it will now immediately update the camera,

  6. Fix editor main window hiding on Windows,

  7. Fix editor crash when toggling multiple components property at once (remember: you can select multiple objects with Ctrl in the hierarchy),

  8. Improved shadow maps cooperation with X3D 4 nodes.

Comments on the forum ➤