Castle Game Engine 4.1.1, view3dscene 3.13.0 release and more

August 17, 2013
view3dscene on Mac OS X, with nice icon, menu bar, file dialog
view3dscene on Mac OS X, with nice icon, menu
Caffeine model from http://www.web3d.org/x3d/content/examples/Basic/ChemicalMarkupLanguage/index.html
data URI demo. All the textures, movies, sounds, scripts, linked 3D models here are embedded using data URI.
MultiTexture.function test
Model with textures loaded from network, URL dialog
CAD example model from http://www.web3d.org/wiki/index.php/X3DOM_CAD#X3D_Models

New 4.1.1 version of Castle Game Engine is released! Along with it, as usual, we release view3dscene 3.13.0, our VRML/X3D browser, and update a couple of other tools/games.

New user-visible features (in Castle Game Engine and view3dscene):

  1. Mac OS X native look and easy installation. Our Mac OS X programs now have a native look, with typical Mac OS X theme and menu and dialogs. They are nicely packaged in a dmg file, with a Mac OS X "bundle" inside that you can drag to your Applications folder.
    This concerns both view3dscene and glViewImage (our handy image viewer, supporting some uncommon formats like DDS).
  2. Network (http) support. We can download everything from the Internet, everything is correctly treated as URL, we also use MIME-types more. For developers new chapter of our tutorial describing network support is available.
  3. More complete data URI support. Absolutely everything can now use data URI to embed data inside a single VRML/X3D file. There is a demo data_uri.x3dv showing how you can use data URI to embed all kinds of things inside X3D file: textures, sounds, other 3D models (to Inline or Anchor to them), scripts etc.
    Engine examples contain a simple tool examples/tools/to_data_uri.lpr that can generate data URI from any file.
  4. Clipboard (Ctrl+C, Ctrl+V, Ctrl+X in message boxes, especially handy to copy/paste URLs). For developers: use Clipboard.AsText property.
  5. view3dscene interprets Home / PageUp / PageDown / End keys to switch to initial / next / previous / last viewpoint. This is consistent with other VRML / X3D browsers behavior and follows recommended X3D shortcuts, and it makes moving through viewpoints easier, using just a keyboard. Thanks to Don Brutzman for bringing this to my attention :)
  6. Nice message on status when switching viewpoints. Together with Home/PageUp/PageDown/End combo, this makes switching viewpoints by keyboard very comfortable.
  7. X3D CAD level 2 support (CADXxx nodes).
  8. MultiTexture.function support. Demo model.
  9. NavigationInfo.transitionComplete support. Demo model transition_multiple_viewpoints.x3dv shows how to use it to make an animated transition between a couple of viewpoints.
  10. Support for 8 and 16 samples for anti-aliasing.
  11. If you load or save image sequences using the syntax image%d.png, for example inside our extension Movies for MovieTexture can be loaded from images sequence: the new syntax to indicate counter inside the URL is @counter(4), where 4 is the padding. For example image%d.png has to be changed to image@counter(1).png and image%4d.png has to be changed to image@counter(4).png. See previous news for explanation why this change is necessary.
  12. FullScreen switching much improved: you can now freely change TCastleWindow.FullScreen property at runtime. For backends that handle it (GTK, LCL) the switch may happen by resizing the window, instead of recreating it, which means it avoids (sometimes time-consuming) reinitialization of OpenGL resources. On Mac OS X, fullscreen mode hides the dock and menu, so they don't cover the window. Added TMenuItemToggleFullScreen for comfort.
  13. You can now load material_properties.xml files in view3dscene, will be used to enhance all subsequent materials. You can also specify alpha_channel (see alphaChannel extension) in material properties. I expect to enhance this in the next release, so that you can add there also stuff like TextureProperties (for anisotropic filtering and more, right now you have to edit VRML/X3D to add it, which is not always comfortable when exporting VRML/X3D e.g. from Blender).

Other new engine features, visible only to developers:

  1. CastleWindow LCL backend. This was used to create native Mac OS X apps now, see Mac OS X notes.
  2. ApplicationData and ApplicationConfig to get data/config dirs as URLs. On Mac OS X ApplicationData can use data from bundle Contents/Resources/data . See also useful CastleFilesUtils.BundlePath function.
  3. Nicer TInputListener.Update API, with simple HandleInput parameter. It used to be called Idle, but we renamed it to Update, since this describes its behavior correctly.
  4. Various improvements to 2D rendering and API. Use SetWindowPos, this will also be portable to next engine compatible with GLES20 (Android, iOS).
  5. TCastleControl.AggressiveUpdate* are removed. The (simplified and improved) version of this mechanism is now always "on" and automatically makes mouse look work better. (Still not perfect, though. Lazarus event loop still causes problems with mouse look. Use our CastleWindow for smooth mouse look.)
  6. In all programs (view3dscene and others created by Castle Game Engine) the Home / PageUp / PageDown keys loose their old meaning (they were used to raise/bow/straighten head in Walk, or rotate/reset in 3rd axis in Examine). I think that nowadays, people don't need keys to perform these actions, as rotating with mouse (like mouse look or mouse dragging or scroll wheel) is more intuitive and more discoverable. This way these keys are free to use for viewpoint navigation.

    If you would like to restore the previous behavior just for your application, you can of course do it, since all the inputs of cameras remain configurable. Like this:

    var
      Camera: TUniversalCamera;
    
    ....
    { Make sure to create a camera, if none was created yet
      (SceneManager.Camera is autocreated at first render).
      The default CreateDefaultCamera always creates
      a TUniversalCamera descendant, so the cast below is safe,
      unless you do something non-standard with cameras otherwise. }
    if SceneManager.Camera = nil then
      SceneManager.Camera := SceneManager.CreateDefaultCamera;
    Camera := SceneManager.Camera as TUniversalCamera;
    
    { Assign old Home/PageDown/PageUp meanings to Examine and Walk cameras. }
    Camera.Examime.Input_Home.Assign(K_Home);
    Camera.Examime.Inputs_Move[2, false].Assign(K_PageDown);
    Camera.Examime.Inputs_Move[2, true ].Assign(K_PageUp);
    Camera.Examime.Inputs_Rotate[2, false].Assign(K_PageDown);
    Camera.Examime.Inputs_Rotate[2, true ].Assign(K_PageUp);
    Camera.Walk.Input_GravityUp .Assign(K_Home);
    Camera.Walk.Input_UpRotate  .Assign(K_PageUp);
    Camera.Walk.Input_DownRotate.Assign(K_PageDown);
    
  7. Comfortably add modifiers (Ctrl, Shift, Alt) to menu item shortcuts by TMenuItem.Modifiers. Previously it was somewhat-possible (by using CharKey like CtrlA..CtrlZ or uppercase letter, which requests Ctrl or Shift modifier). New approach is much more flexible.

Along with the engine and view3dscene, we also release glViewImage 1.5.0, castle game 1.0.1, demo models 3.3.0.

Future: Jan Adamec has started work on iOS port, you can see his results in ios_tests/ directory inside SVN. And Michalis started work on porting engine renderer to GLES20. If all goes well, this will result in next engine release (4.2.0) being able to use GLES20 on mobile devices like iOS and Android :)