Headlight, built-in simple profiler, more

Posted on


New stuff in the engine 🙂

  1. More comfortable control over headlight using TCastleSceneManager.UseHeadlight property. This allows to easily turn headlight on/off regardless of the MainScene existence and it’s contents.

    See also TUseHeadlight type docs. See also new TCastleSceneManager.HeadlightNode property to customize headlight shape.

    A new demo showing how to control the headlight is in examples/headlight_test/

  2. view3dscene has a new menu option Print Current Camera (Viewpoint) (Pascal) that outputs a suitable Camera.SetView(...) Pascal code.

  3. The engine includes a simple time usage profiler (TCastleProfiler, Profiler singleton).

    It is automatically used by various CGE loading routines.

    Simply call Profiler.Enabled := true, and you will get in the log profile of the TCastleApplication.OnInitialize execution.

    Display Profiler.Summary at any point, in any way, in your application, to show the currently gathered profile.

    See the TCastleProfiler docs for more.

    Sample output:

    -------------------- Time Profile begin
    Profile (speed of execution).
    Each line shows time, followed by [time spent in this process], followed by description.
    Lines are sorted within each group, to show the most expensive operation at the top.
    7.35 [7.35] - TCastleApplication.OnInitialize
    > 1.65 [1.65] - Loading .../character/soldier1.castle-anim-frames (TCastleSceneCore)
    > 1.49 [1.48] - Loading .../level/level-dungeon.x3d (TCastleSceneCore)
    > 0.78 [0.78] - Loading All Sounds From .../audio/index.xml (TRepoSoundEngine)
    > > 0.71 [0.71] - Loading .../audio/dark_fallout.ogg (TSoundFile)
    > > 0.00 [0.00] - Loading .../audio/flaunch.wav (TSoundFile)
    2.07 [2.07] - Prepare Resources .../level/level-dungeon.x3d
    -------------------- Time Profile end

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.