Commit 6308cf9e authored by frankie's avatar frankie 💬

fail safe in panton pouf

parent 6f8a0c6e
......@@ -591,10 +591,14 @@ function PantonPouf() {
};
this.set_influence = function( name, weight ) {
if ( weight > 1 ) {
weight = 1;
}
var morph_id = this.morphable.obj3d.morphTargetDictionary[ name ];
this.morphable.obj3d.morphTargetInfluences[ morph_id ] = weight;
if ( this.butt_animations[ name ] !== undefined ) {
this.butt_animations[ name ].time = weight * 100;
}
......
/*
_________ ____ .-. _________/ ____ .-. ____
__|__ (_)_/(_)( )____< \| ( ) (_)
`-' `-'
_________ ____ .-. _________/ ____ .-. ____
__|__ (_)_/(_)( )____< \| ( ) (_)
`-' `-'
libre video game bazaar
____________________________________ ? ____________________________________
(._.)
____________________________________ ? ____________________________________
(._.)
This file is part of sysiphus project
......@@ -41,11 +41,6 @@
*/
// DO NOT FORGET TO TURN THIS OFF FOR PROD!
var skip_splash = false;
var remote_timestamp_server = "server/json/timestamp.json";
var remote_gallery_server = "server/json/gallery.json";
if ( ! Detector.webgl ) {
Detector.addGetWebGLMessage();
}
......@@ -55,6 +50,11 @@ if ( ! Detector.webgl ) {
// *********************************
{
// DO NOT FORGET TO TURN THIS OFF FOR PROD!
var skip_splash = false;
var remote_timestamp_server = "server/json/timestamp.json";
var remote_gallery_server = "server/json/gallery.json";
var SHADOW_ENABLED = true;
var SHADOW_MAP_WIDTH = 2048, SHADOW_MAP_HEIGHT = 2048;
......@@ -97,7 +97,7 @@ if ( ! Detector.webgl ) {
config_pantonpouf.morph_default = 'basis';
config_pantonpouf.butt_anim_path = 'models/butt_anims.json';
config_pantonpouf.falling_anim_path = 'models/pouf_falling.json';
config_pantonpouf.diffuse_map = 'models/generated/log_2018-05-25T14:27:14.141_diffuse.png';
config_pantonpouf.diffuse_map = 'textures/crash_diffuse.png';
// config_pantonpouf.specular_map = 'textures/cube_specular.png';
// config_pantonpouf.normal_map = 'textures/cube_normal.png';
config_pantonpouf.left_foot_anchor = { 'pos': new THREE.Vector3( 0.24,.07,0.13 ), 'euler': new THREE.Euler( -0.95,0,Math.PI, 'XYZ' ) };
......@@ -314,7 +314,6 @@ function on_pouf_ready() {
if ( ground !== undefined && avatar !== undefined && ground.ready && avatar.ready ) {
on_all_ready();
}
}
......@@ -354,7 +353,7 @@ function number_display( num ) {
var n = str.indexOf(".");
if ( n == -1 ) {
return str + ".00";
} else if ( n == str.length - 2 ) {
} else if ( n == str.length - 2 ) {
return str + "0";
}
return str;
......@@ -444,9 +443,9 @@ function working_time() {
var content = "production time: ";
var millis = tmngr.morph_inter.current * timestamp_data['max'];
var secs = millis / 1000;
var h = Math.floor( secs / 3600 );
var m = Math.floor( ( secs - h * 3600 ) / 60 );
var s = Math.floor( secs - ( h * 3600 + m * 60 ) );
var h = Math.floor( secs / 3600 );
var m = Math.floor( ( secs - h * 3600 ) / 60 );
var s = Math.floor( secs - ( h * 3600 + m * 60 ) );
if ( h < 10 ) content += "0";
content += h + ":";
if ( m < 10 ) content += "0";
......@@ -478,25 +477,25 @@ function debug_json( e ) {
// https://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window
var q_canvas, q_ctx, q_flag = false,
q_prevX = 0,
q_currX = 0,
q_prevY = 0,
q_currY = 0,
q_dot_flag = false;
q_prevX = 0,
q_currX = 0,
q_prevY = 0,
q_currY = 0,
q_dot_flag = false;
var q_margins = [ 120, 50, 100, 50 ];
var q_ruler_gap = 50;
var q_x = "yellow",
q_y = 4;
q_y = 4;
function question_size() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
return [x,y];
}
......@@ -588,10 +587,10 @@ function question_init() {
}
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
}
function question_resize() {
......@@ -683,7 +682,7 @@ function menu_start( el ) {
el.style.opacity = '1';
el.style.animation='menu_opening_anim 0.5s ease-out';
var newone = el.cloneNode(true);
el.parentNode.replaceChild(newone, el);
el.parentNode.replaceChild(newone, el);
}
function goto_mainmenu() {
......@@ -868,13 +867,13 @@ var timestamp_data = undefined;
// this function is called at startup
function timestamp_request() {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open( 'GET', remote_timestamp_server, true );
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
try{
var data = JSON.parse( xobj.responseText );
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open( 'GET', remote_timestamp_server, true );
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
try{
var data = JSON.parse( xobj.responseText );
if ( timestamp_data === undefined ) {
console.log( ">>>>> first reception of timestamp!!!" );
init_timeline();
......@@ -883,19 +882,19 @@ function timestamp_request() {
timestamp_data = data;
}
// callback depends on data sent by the server
setTimeout( function(){ timestamp_request(); }, data['revisit'] );
} catch( exception ) {
setTimeout( function(){ timestamp_request(); }, data['revisit'] );
} catch( exception ) {
console.log( "Received crappy json from timestamp server" );
}
} else if ( xobj.status != "200" ) {
console.log( "Unable to contact timestamp server!" );
}
} else if ( xobj.status != "200" ) {
console.log( "Unable to contact timestamp server!" );
timestamp_data = undefined;
hide_timeline();
// retry in 30 seconds
setTimeout( function(){ timestamp_request(); }, 30000 );
}
}
xobj.send(null);
}
}
xobj.send(null);
}
......@@ -904,13 +903,13 @@ var gallery_server_enabled = false;
function gallery_request( update ) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open( 'GET', remote_gallery_server, true );
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// try{
var data = JSON.parse( xobj.responseText );
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open( 'GET', remote_gallery_server, true );
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// try{
var data = JSON.parse( xobj.responseText );
// console.log( data );
gallery_data = [];
for( var i in data ) {
......@@ -918,18 +917,18 @@ function gallery_request( update ) {
}
gallery_server_enabled = true;
if ( update ) { update_gallery(); }
// } catch( exception ) {
// } catch( exception ) {
// console.log( "Received crappy json from gallery server" );
// }
} else if ( xobj.status != "200" ) {
console.log( "Unable to contact gallery server!" );
// }
} else if ( xobj.status != "200" ) {
console.log( "Unable to contact gallery server!" );
if ( update ) update_gallery();
timestamp_data = undefined;
// retry in 30 seconds
// setTimeout( function(){ gallery_request(); }, 30000 );
}
}
xobj.send(null);
}
}
xobj.send(null);
}
......
......@@ -909,36 +909,38 @@ function add_gallery_item( item ) {
// source: https://www.cssscript.com/responsive-touch-enabled-range-slider-in-vanilla-javascript-rangeslider/
try {
(function () {
var selector = '[data-rangeSlider]',
elements = document.querySelectorAll(selector);
// Basic rangeSlider initialization
rangeSlider.create(elements, {
onInit: function () {
},
onSlideStart: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = false;
}
},
onSlide: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = false;
cube.current_frame = percent * cube.total_frames;
}
},
onSlideEnd: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = true;
(function () {
var selector = '[data-rangeSlider]',
elements = document.querySelectorAll(selector);
// Basic rangeSlider initialization
rangeSlider.create(elements, {
onInit: function () {
},
onSlideStart: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = false;
}
},
onSlide: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = false;
cube.current_frame = percent * cube.total_frames;
}
},
onSlideEnd: function (value, percent, position) {
if ( cube.ready ) {
cube.playing = true;
}
}
}
});
});
timeline_slider_enabled = true;
timeline_slider_enabled = true;
window.alert( "timeline slider successfully started!" );
})();
})();
}
catch (e) {
window.alert( "timeline slider is fucked up!" );
......
......@@ -107,7 +107,24 @@ js_replace = [
]
#copy_dirs = [ 'fonts', 'models', 'presets', 'textures', 'gallery' ]
copy_dirs = [ 'fonts', 'models', 'presets', 'textures' ]
copy_dirs = [
{
'src':'fonts',
'overwrite': False
},
{
'src': 'presets',
'overwrite': True
},
{
'src': 'models',
'overwrite': False
},
{
'src': 'textures',
'overwrite': True
}
]
create_dir = []
copy_files = [
['README.md'],
......@@ -184,13 +201,22 @@ for root, dirs, files in os.walk( export_folder ):
for f in files:
os.unlink(os.path.join( root, f ))
for d in dirs:
shutil.rmtree(os.path.join( root, d ))
rmv = True
for cd in copy_dirs:
if d == cd[ 'src' ] and not cd[ 'overwrite' ]:
rmv = False
break
if rmv:
shutil.rmtree(os.path.join( root, d ))
# copying all dirs
for d in copy_dirs:
newpath = os.path.join( export_folder, d )
print( "copying folder '" + newpath + "' in destination folder" )
copy( d, newpath )
newpath = os.path.join( export_folder, d['src'] )
if d[ 'overwrite' ] or not os.path.isdir( newpath ):
print( "copying folder '" + newpath + "' in destination folder" )
copy( d['src'], newpath )
else:
print( "folder '" + newpath + "' is already present in destination folder" )
# creation of directories in package folder
for d in create_dir:
......@@ -205,7 +231,7 @@ for d in copy_files:
outfife = os.path.join( export_folder, d[0] )
if len( d ) == 2:
outfife = os.path.join( export_folder, d[1] )
print( "copying file '" + src + "'" )
print( "copying file '" + infife + "' in '" + outfife + "'" )
with open(infife, 'rb') as src, open( outfife, 'wb') as dst:
copyfileobj_example(src, dst)
......
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