Added php for parameter of resolution of sphere in stream
This commit is contained in:
parent
566f42f5dc
commit
5c9390da90
|
@ -1,4 +1,4 @@
|
||||||
var ProgessiveSphere = function(loader) {
|
var ProgessiveSphere = function(loader, res) {
|
||||||
Displayable.call(this);
|
Displayable.call(this);
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
|
@ -6,8 +6,11 @@ var ProgessiveSphere = function(loader) {
|
||||||
this.begin = false;
|
this.begin = false;
|
||||||
this.addedToScene = false;
|
this.addedToScene = false;
|
||||||
|
|
||||||
|
if (res === undefined)
|
||||||
|
res = 5;
|
||||||
|
|
||||||
(function(self) {
|
(function(self) {
|
||||||
loader.load('/data/spheres/4.obj', function(object) {
|
loader.load('/data/spheres/' + res + '.obj', function(object) {
|
||||||
object.traverse(function(child) {
|
object.traverse(function(child) {
|
||||||
if (child instanceof THREE.Mesh) {
|
if (child instanceof THREE.Mesh) {
|
||||||
child.up = new THREE.Vector3(0,0,1);
|
child.up = new THREE.Vector3(0,0,1);
|
||||||
|
|
|
@ -21,7 +21,31 @@
|
||||||
<script src="/js/CameraContainer.js"></script>
|
<script src="/js/CameraContainer.js"></script>
|
||||||
<script src="/js/Tools.js"></script>
|
<script src="/js/Tools.js"></script>
|
||||||
<script src="/js/ProgressiveSphere.js"></script>
|
<script src="/js/ProgressiveSphere.js"></script>
|
||||||
|
<?php
|
||||||
|
// Set global variables
|
||||||
|
$default = 5;
|
||||||
|
$res = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (isset($_GET['res']))
|
||||||
|
{
|
||||||
|
$res = intval($_GET['res']);
|
||||||
|
if ($res < 1 || $res > 25)
|
||||||
|
{
|
||||||
|
throw new Exception('Variable res not set');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception('Variable res not set');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$res = $default;
|
||||||
|
}
|
||||||
|
echo "<script>var global_array = {res: " . $res . "};</script>\n";
|
||||||
|
?>
|
||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -46,7 +46,7 @@ function init() {
|
||||||
|
|
||||||
// Load the scene
|
// Load the scene
|
||||||
loader = new THREE.OBJLoader();
|
loader = new THREE.OBJLoader();
|
||||||
sphere = new ProgessiveSphere(loader);
|
sphere = new ProgessiveSphere(loader, global_array.res);
|
||||||
|
|
||||||
plane = new Plane(1000,1000);
|
plane = new Plane(1000,1000);
|
||||||
plane.translate(0,0,-100);
|
plane.translate(0,0,-100);
|
||||||
|
|
Loading…
Reference in New Issue