-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
77 lines (65 loc) · 3.08 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>WebGLStudio Player</title>
<style type='text/css'>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<!-- core libraries -->
<script type="text/javascript" src="js/extra/gl-matrix-min.js"></script>
<script type="text/javascript" src="js/extra/litegl.js"></script>
<script type="text/javascript" src="js/extra/litegraph.js"></script>
<script type="text/javascript" src="js/extra/litescene.js"></script>
<script type="text/javascript" src="js/extra/Canvas2DtoWebGL.js"></script>
<script type="text/javascript">
//LiteSCENE CODE *************************
var player = new LS.Player( {
alpha: false, //enables to have alpha in the canvas to blend with background
stencil: true,
redraw: true, //force to redraw
resources: "fileserver/files/",
autoresize: true, //resize the 3D window if the browser window is resized
loadingbar: true, //shows loading bar progress
proxy: "@/proxy.php?url=" //allows to proxy request to avoid cross domain problems, in this case the @ means same domain, so it will be http://hostname/proxy
});
var allow_remote_scenes = false; //allow scenes with full urls? this could be not safe...
//support for external server
var data = localStorage.getItem("wgl_user_preferences" );
if(data)
{
var config = JSON.parse(data);
if(config.modules.Drive && config.modules.Drive.fileserver_files_url)
{
allow_remote_scenes = true;
LS.ResourcesManager.setPath( config.modules.Drive.fileserver_files_url );
}
}
//allow to use Canvas2D call in the WebGLCanvas (this is not mandatory, just useful)
if( window.enableWebGLCanvas )
enableWebGLCanvas( gl.canvas );
if( LS.queryString["debug"] )
player.enableDebug();
//this code defines which scene to load, in case you are loading an specific scene replce it by player.loadScene( scene_url )
if( LS.queryString["session"] )
player.setScene( JSON.parse( localStorage.getItem( LS.queryString["session"] ) ) );
else if( allow_remote_scenes || (LS.queryString["url"] && LS.queryString["url"].indexOf("://") == -1) ) //for safety measures
player.loadScene( LS.queryString["url"] ); //the url must be something like: fileserver/files/guest/projects/Lee_FX.json
else if( LS.queryString["preview"] === undefined )
player.loadConfig("config.json");
var button = document.createElement("button");
button.style.cssText = "background-color: transparent;background-image: url('https://png.icons8.com/dusk/100/27ae60/enter-pin.png');filter: brightness(0.85);background-size: cover;height: 40px;width: 40px;position: fixed;bottom: 1em;right: 1em;margin: 0;padding: 0;border: 0;";
button.addEventListener("click", function(){
LS.Globals.showGUI = !LS.Globals.showGUI;
})
document.body.appendChild(button);
</script>
</body>
</html>