From 5c9390da90efb8ebb44c230a0aefe389d2d0e5c0 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 8 Apr 2015 17:26:02 +0200 Subject: [PATCH] Added php for parameter of resolution of sphere in stream --- js/ProgressiveSphere.js | 7 +++++-- stream/{index.html => index.php} | 26 +++++++++++++++++++++++++- stream/js/main.js | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) rename stream/{index.html => index.php} (58%) diff --git a/js/ProgressiveSphere.js b/js/ProgressiveSphere.js index a91431f..f1fd78a 100644 --- a/js/ProgressiveSphere.js +++ b/js/ProgressiveSphere.js @@ -1,4 +1,4 @@ -var ProgessiveSphere = function(loader) { +var ProgessiveSphere = function(loader, res) { Displayable.call(this); this.started = false; this.finished = false; @@ -6,8 +6,11 @@ var ProgessiveSphere = function(loader) { this.begin = false; this.addedToScene = false; + if (res === undefined) + res = 5; + (function(self) { - loader.load('/data/spheres/4.obj', function(object) { + loader.load('/data/spheres/' + res + '.obj', function(object) { object.traverse(function(child) { if (child instanceof THREE.Mesh) { child.up = new THREE.Vector3(0,0,1); diff --git a/stream/index.html b/stream/index.php similarity index 58% rename from stream/index.html rename to stream/index.php index 8e972b5..cbcc214 100644 --- a/stream/index.html +++ b/stream/index.php @@ -21,7 +21,31 @@ - + 25) + { + throw new Exception('Variable res not set'); + } + } + else + { + throw new Exception('Variable res not set'); + } + } + catch (Exception $e) + { + $res = $default; + } + echo "\n"; + ?> diff --git a/stream/js/main.js b/stream/js/main.js index 84c91f6..2b3872a 100644 --- a/stream/js/main.js +++ b/stream/js/main.js @@ -46,7 +46,7 @@ function init() { // Load the scene loader = new THREE.OBJLoader(); - sphere = new ProgessiveSphere(loader); + sphere = new ProgessiveSphere(loader, global_array.res); plane = new Plane(1000,1000); plane.translate(0,0,-100);