Capricorn 76
Dynamic lighting example.
ScriptENGINE supports dynamic lighting.
All entities in the world with lighting enabled will be affected by the dynamic lights.
The entity/light material properties affect the color attributes of the entity.

---------------------------
---------------------------
-- Dynamic lighting example
-- Copyright (c) 2007-09 Capricorn 76 Pty. Ltd.
--
-- ScriptENGINE supports dynamic lighting.
-- All entities in the world with lighting enabled will be affected by the dynamic lights.
-- The entity/light material properties affect the color attributes of the entity.
--
-- NOTE:
-- The ./Demos/runDemo.e76script is a utility script used to run all the examples.
-- It loads the world, calls the OnWorldLoad(), OnWorldUnload() functions, and runs the graphics engine loop, waiting for the user to press escape.
---------------------------
---------------------------

---------------------------
-- runDemo.e76script calls this function when the world is loaded
-- The lights and entities were set up via the editor and are already prepared once this example is loaded.
---------------------------
function OnWorldLoad(worldName)
    --print('OnWorldLoad');

    ---------------------------
    -- The SDK world editor creates a worldIds.e76script when the world is saved. It contains all the entity ids.
    -- We load the IDs so that we can refer to the world entities using friendly names.
    ---------------------------
    IApp:loadScript(IWorld:getNameLong() .. '/worldIds');
    IWorld:setActiveCameraId(idCamera_cam1);

    ---------------------------
    -- Load this example's GUI
    ---------------------------
    OnWorldLoadGui();

    ---------------------------
    -- Set the agent's animation, to play all
    ---------------------------
    IGraphics:setEntityAnimationEx(idAgent_Mech, 0, 14, true, 10);

    ---------------------------
    -- Enable auto camera movement based upon mouse/key input.
    -- The active camera is 'fps' type meaning it operates in a first-person-shooter style
    ---------------------------
    IWorld:setActiveCameraAutoProcessed(true);

    ---------------------------
    -- Set the scene's ambient color
    ---------------------------
    IGraphics:setAmbientColor('0.25 0.25 0.25 1');
end

---------------------------
-- Load GUI specific to this example
---------------------------
function OnWorldLoadGui()
    IGraphics:loadGui('help');
end

---------------------------
-- runDemo.e76script calls this function when the world is unloaded
---------------------------
function OnWorldUnload(worldName)
    --print('OnWorldUnload');
end

Copyright © 2006-23 Sep 2009 Capricorn 76 Pty. Ltd. (created on Wed Sep 23 16:49:12 2009)