Commit 0ede6d38 authored by frankie's avatar frankie 💬

automatic closing of menus in kiosk + shadow map display in index & kiosk

parent f859fa02
......@@ -115,7 +115,10 @@
<script src="js/threejs/shaders/ConvolutionShader.js"></script>
<script src="js/threejs/shaders/LuminosityHighPassShader.js"></script>
<script src="js/threejs/postprocessing/UnrealBloomPass.js"></script>
<script src="js/threejs/shaders/UnpackDepthRGBAShader.js"></script>
<script src="js/threejs/utils/ShadowMapViewer.js"></script>
<!-- sysiphus utils -->
<script src="js/utils/Basics.js"></script>
<script src="js/utils/Interpolation.js"></script>
......
......@@ -158,16 +158,14 @@ function Ground() {
this.mat2.color = this.config.color2;
this.mat2.emissive = this.config.emissive2;
try{
if ( GROUND_PURE_BLACK !== undefined ) {
this.mat1.reflectivity = 0;
this.mat1.shininess = 0;
this.mat1.roughness = 0;
this.mat1.color = new THREE.Color( 0x000000 );
this.mat1.emissive = new THREE.Color( 0x000000 );
this.mat1.specular = new THREE.Color( 0x000000 );
}
} catch(e) {}
if (typeof GROUND_PURE_BLACK !== undefined ) {
this.mat1.reflectivity = 0;
this.mat1.shininess = 0;
this.mat1.roughness = 0;
this.mat1.color = new THREE.Color( 0x000000 );
this.mat1.emissive = new THREE.Color( 0x000000 );
this.mat1.specular = new THREE.Color( 0x000000 );
}
var cgeom = undefined;
if ( this.config.use_cubes ) {
......
function requestFullScreen(element) {
// Supports most browsers and their versions.
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) { // Native full screen.
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
var elem = document.body; // Make the body go full screen.
requestFullScreen(elem);
var GROUND_PURE_BLACK = true;
\ No newline at end of file
// black squares of ground will be pure black
var GROUND_PURE_BLACK = true;
// menu closes automatically after x seconds
var MENU_TIMEOUT = 180;
// enables controls of the camera by just moving the mouse
var CONTROL_MOUSE_MOTION = true;
\ No newline at end of file
......@@ -127,6 +127,8 @@ if ( ! Detector.webgl ) {
// debug objects
var lightShadowMapViewer;
var axis_3d = undefined;
var frame_count = 0;
......@@ -158,6 +160,7 @@ if ( ! Detector.webgl ) {
var second_light = undefined;
var inventory_scrolltop = 0;
var menu_close_timer = -1;
}
......@@ -184,6 +187,17 @@ function init_controls() {
}
function init_shadow_viewer() {
lightShadowMapViewer = new THREE.ShadowMapViewer( main_light );
lightShadowMapViewer.position.x = 10;
lightShadowMapViewer.position.y = window.innerHeight - 260;
lightShadowMapViewer.size.width = 250;
lightShadowMapViewer.size.height = 250;
lightShadowMapViewer.update();
}
function init_threejs() {
container = document.getElementById( 'container' );
......@@ -213,7 +227,9 @@ function init_threejs() {
main_light.position.set( 0.4 * pmult, 0.5 * pmult, 0.2 * pmult );
main_light.rotation.x = 1;
light_pivot.add( main_light );
init_shadow_viewer();
second_light = new THREE.DirectionalLight( 0xfdfdff, 0.2 );
// second_light = new THREE.DirectionalLight( 0xffffff, 0 );
second_light.position.set( -1.2, 0, 0.5 );
......@@ -304,6 +320,7 @@ function on_avatar_ready() {
fps_camera.rotateX( -0.3 );
// var help = new THREE.CameraHelper( fps_camera );
// scene.add( help );
main_light.target = avatar.bones["mixamorig_Spine"].bone;
if ( ground !== undefined && pouf !== undefined && ground.ready && pouf.ready ) {
on_all_ready();
......@@ -377,6 +394,8 @@ function onWindowResize() {
renderer.setSize( window.innerWidth, window.innerHeight );
//composer.setSize( window.innerWidth, window.innerHeight );
//fps_controls.handleResize();
init_shadow_viewer();
}
......@@ -458,9 +477,17 @@ function render() {
if ( fps_camera_active ) {
renderer.render( scene, fps_camera );
lightShadowMapViewer.render( renderer );
} else {
renderer.render( scene, camera );
}
if ( menu_close_timer > 0 ) {
menu_close_timer -= delta;
if ( menu_close_timer <= 0 && !mainmenu_visible() ) {
goto_mainmenu();
}
}
// composer.render();
......@@ -705,17 +732,27 @@ function question_ok() {
// ********** UI RELATED ***********
// *********************************
function mainmenu_visible() {
return document.getElementById( 'ui_3d' ).style.visible == 'visible';
}
function menu_stop( el ) {
el.className = '';
el.style.visibility = 'hidden';
}
function menu_start( el ) {
el.style.visibility = 'visible';
el.style.opacity = '1';
el.style.animation='menu_opening_anim 0.5s ease-out';
var newone = el.cloneNode(true);
el.parentNode.replaceChild(newone, el);
}
function goto_mainmenu() {
......@@ -738,6 +775,10 @@ function goto_about() {
menu_start( document.getElementById( 'about_panel' ) );
document.getElementById( 'container' ).className = 'blurry';
if (typeof MENU_TIMEOUT !== 'undefined') {
menu_close_timer = MENU_TIMEOUT;
}
}
function goto_inventory() {
......@@ -748,6 +789,10 @@ function goto_inventory() {
menu_start( document.getElementById( 'inventory_preview' ) );
document.getElementById( 'container' ).className = 'blurry';
document.getElementById("inventory_preview").scrollTop = inventory_scrolltop;
if (typeof MENU_TIMEOUT !== 'undefined') {
menu_close_timer = MENU_TIMEOUT;
}
}
......
......@@ -161,6 +161,7 @@ if ( ! Detector.webgl ) {
var splash_finished = false;
var close_splash_request = false;
var menu_close_timer = -1;
}
......@@ -187,6 +188,17 @@ function init_controls() {
}
function init_shadow_viewer() {
lightShadowMapViewer = new THREE.ShadowMapViewer( main_light );
lightShadowMapViewer.position.x = 10;
lightShadowMapViewer.position.y = window.innerHeight - 300;
lightShadowMapViewer.size.width = 250;
lightShadowMapViewer.size.height = 250;
lightShadowMapViewer.update();
}
function init_threejs() {
container = document.getElementById( 'container' );
......@@ -217,13 +229,8 @@ function init_threejs() {
main_light.rotation.x = 1;
light_pivot.add( main_light );
lightShadowMapViewer = new THREE.ShadowMapViewer( main_light );
lightShadowMapViewer.position.x = 10;
lightShadowMapViewer.position.y = window.innerHeight - 300;
lightShadowMapViewer.size.width = 250;
lightShadowMapViewer.size.height = 250;
lightShadowMapViewer.update();
init_shadow_viewer();
second_light = new THREE.DirectionalLight( 0xfdfdff, 0.2 );
second_light.position.set( -1.2, 0, 0.5 );
light_pivot.add( second_light );
......@@ -430,12 +437,7 @@ function onWindowResize() {
}
renderer.setSize( window.innerWidth, window.innerHeight );
lightShadowMapViewer = new THREE.ShadowMapViewer( main_light );
lightShadowMapViewer.position.x = 10;
lightShadowMapViewer.position.y = window.innerHeight - 300;
lightShadowMapViewer.size.width = 250;
lightShadowMapViewer.size.height = 250;
lightShadowMapViewer.update();
init_shadow_viewer();
//composer.setSize( window.innerWidth, window.innerHeight );
//fps_controls.handleResize();
......@@ -570,18 +572,22 @@ function render() {
if ( fps_camera_active ) {
renderer.render( scene, fps_camera );
lightShadowMapViewer.render( renderer );
} else {
renderer.render( scene, camera );
}
// frame_count++;
if ( fps_camera_active ) {
lightShadowMapViewer.render( renderer );
if ( menu_close_timer > 0 ) {
menu_close_timer -= delta;
if ( menu_close_timer <= 0 && !mainmenu_visible() ) {
goto_mainmenu();
}
}
}
function working_time() {
var content = "";
//var millis = tmngr.morph_inter.current * timestamp_data['max'];
//var secs = millis / 1000;
......@@ -597,6 +603,7 @@ function working_time() {
content += s;
document.getElementById( 'duration' ).style.visibility = "visible";
document.getElementById( 'duration' ).innerHTML = content;
}
function print( e ) {}
......@@ -749,17 +756,27 @@ function on_cube_listing_loaded( e ) {
}
function mainmenu_visible() {
return document.getElementById( 'ui_3d' ).style.visible == 'visible';
}
function menu_stop( el ) {
el.className = '';
el.style.visibility = 'hidden';
}
function menu_start( el ) {
el.style.visibility = 'visible';
el.style.opacity = '1';
el.style.animation='menu_opening_anim 0.5s ease-out';
var newone = el.cloneNode(true);
el.parentNode.replaceChild(newone, el);
}
function goto_mainmenu() {
......@@ -774,10 +791,16 @@ function goto_mainmenu() {
}
function goto_about() {
menu_stop( document.getElementById( 'ui_3d' ) );
menu_stop( document.getElementById( 'inventory_panel' ) );
menu_start( document.getElementById( 'about_panel' ) );
document.getElementById( 'container' ).className = 'blurry';
if (typeof MENU_TIMEOUT !== 'undefined') {
menu_close_timer = MENU_TIMEOUT;
}
}
function goto_inventory() {
......@@ -792,6 +815,10 @@ function goto_inventory() {
document.getElementById("inventory_panel").scrollTop = inventory_scrolltop;
document.getElementById("timeline").className = 'closed';
if (typeof MENU_TIMEOUT !== 'undefined') {
menu_close_timer = MENU_TIMEOUT;
}
}
......
......@@ -117,6 +117,9 @@
<script src="js/threejs/shaders/ConvolutionShader.js"></script>
<script src="js/threejs/shaders/LuminosityHighPassShader.js"></script>
<script src="js/threejs/postprocessing/UnrealBloomPass.js"></script>
<script src="js/threejs/shaders/UnpackDepthRGBAShader.js"></script>
<script src="js/threejs/utils/ShadowMapViewer.js"></script>
<!-- sysiphus utils -->
<script src="js/utils/Basics.js"></script>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment