Various API improvements (ShowUserInterfaceToQuit, SaveScreenToDefaultFile, orientation matching glTF by default) and build tool and editor improvements

my-new-project-2d_screen_0

A number of improvements all across the engine:

  1. ApplicationProperties.ShowUserInterfaceToQuit. Useful to hide that “Quit” button on mobile. Used by the editor new project templates for 2D and 3D games.

  2. Saving screenshot to the best location, automatically determined: Container.SaveScreenToDefaultFile, lower-level SaveScreenPath. This is important as you cannot assume that your application can write to the current directory when installed. This featue is also already used by the editor new project templates (press F5 in 2D and 3D games).

  3. Viewport.TransformUnderMouse represents the current TCastleTransform under the mouse. It’s easier to use than lower-level Viewport.MouseRayHit.

  4. The default orientation (important if you use TCastleTransform.Direction property to rotate your models) changed from otUpYDirectionMinusZ to otUpYDirectionZ. The new default makes us work out-of-the-box intuitively with glTF models.

    I wrote a lot of text why this change, although breaking compatibility, makes sense on our page documenting upgrade process from CGE 6.4. See also manual about it.

    If you use TCastleTransform.Direction and want to restore compatibility, just set TCastleTransform.DefaultOrientation := otUpYDirectionMinusZ; somewhere early (like in the Application.OnInitialize callback).

  5. Our build tool now does output filtering to hide many useless FPC warnings that occur when using Generics.Collections. This is better than disabling these warnings through FPC command-line options, this way e.g. compiler will still warn about instantiating abstract classes.

  6. view3dscene gets a new command-line option --project, automatically used by the editor if you double-click on a scene file in your project. In effect, the castle-data:/ protocol will also work as URL for textures etc. inside X3D, glTF and other files.

  7. CGE editor has now context menu when you right-click on files section at the bottom. You can open file manager, delete the file, refresh the directory.

  8. For PointLight / SpotLight, radius < 0 means “infinity”. This is useful to convert glTF lights, that may have range equal 0 to mean infinity. So we just convert 0 to -1.

  9. New glTF tests:

1 Like