@using BuildOurOwnBabylonJSServer.Extensions;
@{
    ViewBag.Title = "Our Own BabylonJS";
    ViewBag.BabylonJSFolder = "..\\..\\..\\";
}

<script type="text/javascript">
    $(document).ready(function () {

        var loading = new OURBABYLON.Loading(OURBABYLON.canvas.parentElement);

        loading.show();

        BABYLON.SceneLoader.Load("@Html.Raw(this.BabylonJSSamplesFile("Scenes/" + (string)ViewBag.DemoFolderName))" + "@Url.Encode("/")", "@ViewBag.DemoFile", OURBABYLON.engine, function (scene) {
            OURBABYLON.sceneInitialization(scene);
            scene.activeCamera.attachControl(OURBABYLON.canvas);

            // Render loop
            var renderLoop = function () {
                scene.render();
            };

            // Launch render loop
            scene.getEngine().runRenderLoop(renderLoop);

            loading.hide();

        }, $.proxy(loading.onProgress, loading));
    });
</script>