<script language="JavaScript" src="/js/Kribi3DPlayer.js" type="text/javascript"></script>

    <script language="JavaScript" src="/js/gFunct.js" type="text/javascript"></script>

   

    <script language="JavaScript" type="text/javascript">

          

        var arrIstance = new Array(0);

        var loadok = false;

        var opening = false;

 

        /* ------------------------------------------------------------ */

        /* This function is invoked when the page is loaded.

        *Allows the loading of plugins*/

        window.onload = function() {

            loadok = true;

        }

 

        /* ------------------------------------------------------------ */

        /* This function is invoked every time the player sends a message to the

        * browser, we use it to intercept the Ready event which is sent when

        * the player is ready to accept commands and the ModelOpened event which is

        * sent when the model has been loaded. */

        function KribiPlayer_Tell(msg) {

            var player = document.getElementById("KribiPlayer");

            if (loadok) {

                if (msg == "ModelOpened") {

                    // initialize the camera.

                    DefaultView_init();

                    //store the initial position of scene's element

                    var count = player.Do("Instance GetCount ");

                    arrIstance = Array(count);

                    for (i = 0; i < count - 1; i++) {

                        arrIstance[i] = player.Do('Instance[' + i + '] Size');

                    }

                } else if (msg == "Refresh") {

                    if (!opening) {

                        // Wait for all the controls to be opened, make sure that this will run only once.

                        opening = true;

                        player.Do("Model OpenAsync '" + FullModelsPath() + "UrbanPackingV04_OP.kmo'");

                    }

                }

            }

        }

 

        /* ------------------------------------------------------------ */

        // Set default

        function DefaultView_init() {

            var player = document.getElementById("KribiPlayer");

            // Set the camera to its initial position.

                  player.Do("Camera Position 1940.97,-3006.41,2432.94");

                  player.Do("Camera Orientation -47.6987,35.6666,0");

                  player.Do("Camera FieldOfView 71.00");

            // Enable realistic rendering.

                  player.Do("Renderer Shading Realistic");

                  // Set tool

            InstanceSizing();

            //code after the first loading stage

            if (arrIstance[0] != undefined) {

                var count = player.Do("Instance GetCount ");

                for (i = 0; i < count - 1; i++) {

                    player.Do('Instance[' + i + '] Size ' + arrIstance[i]);

                }

            }

        }

       

        /* ------------------------------------------------------------ */

        // Tools

        function InstanceSizing() {

            // Set Tool InstanceSizing

            var player = document.getElementById("KribiPlayer");

            player.Do("Tool SetCurrent 'InstanceSizing'");

        }