diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..898953d --- /dev/null +++ b/.htaccess @@ -0,0 +1 @@ +php_value include_path 'include' diff --git a/bouncing/.htaccess b/bouncing/.htaccess new file mode 100644 index 0000000..7031355 --- /dev/null +++ b/bouncing/.htaccess @@ -0,0 +1 @@ +php_value include_path '../include' diff --git a/bouncing/index.html b/bouncing/index.html deleted file mode 100644 index 4143e15..0000000 --- a/bouncing/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - The begining - - - -

Here is stuff

-
- - - - - - - - - - diff --git a/bouncing/index.php b/bouncing/index.php new file mode 100644 index 0000000..55429e8 --- /dev/null +++ b/bouncing/index.php @@ -0,0 +1,13 @@ + + + + + + + +

Here is stuff

+
+ + + + diff --git a/include/header.php b/include/header.php new file mode 100644 index 0000000..747143e --- /dev/null +++ b/include/header.php @@ -0,0 +1,5 @@ + +
+

Welcome !

+
+ diff --git a/include/header_functions.php b/include/header_functions.php new file mode 100644 index 0000000..2fbe8fb --- /dev/null +++ b/include/header_functions.php @@ -0,0 +1,10 @@ +\n"; + echo "\t\tThe begining - " . $title . "\n"; + echo "\t\t\n"; + echo "\t\n\n"; + } + diff --git a/scene/index.html b/include/jsIncludes.php similarity index 54% rename from scene/index.html rename to include/jsIncludes.php index a7b9d56..81ac4ff 100644 --- a/scene/index.html +++ b/include/jsIncludes.php @@ -1,27 +1,16 @@ - - - - The begining - - - -

Here is stuff

-
- + + + + - - - + - - - + + + - - - diff --git a/include/nav.php b/include/nav.php new file mode 100644 index 0000000..4e98bc1 --- /dev/null +++ b/include/nav.php @@ -0,0 +1,11 @@ + + + diff --git a/index.html b/index.html deleted file mode 100644 index cb152a1..0000000 --- a/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - The begining - - - -

Here is a list of places where you can go

- - - diff --git a/index.php b/index.php new file mode 100644 index 0000000..ccd10cb --- /dev/null +++ b/index.php @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/js/BigScene.js b/js/BigScene.js deleted file mode 100644 index f130af4..0000000 --- a/js/BigScene.js +++ /dev/null @@ -1,112 +0,0 @@ -var mesh_number = 25; -var renderer, scene, controls, cube, container, plane, mouse= {x:0, y:0}; -var bigmesh; -var raycaster; -var objects = []; -var cameras = new CameraContainer(); -var spheres = new Array(mesh_number); -var visible = 0; - -var loader; - -var container_size = new Object(); -container_size.width = 1067; -container_size.height = 600; - -init(); -animate(); - -function init() { - // on initialise le moteur de rendu - container = document.getElementById('container'); - container.style.height = container_size.height + 'px'; - container.style.width = container_size.width + 'px'; - renderer = new THREE.WebGLRenderer({alpha:"true"}); - renderer.setSize(container_size.width, container_size.height); - renderer.shadowMapEnabled = true; - renderer.setClearColor(0x000000); - document.getElementById('container').appendChild(renderer.domElement); - - // on initialise la scène - scene = new THREE.Scene(); - raycaster = new THREE.Raycaster(); - - // init light - var directional_light = new THREE.DirectionalLight(0x444444); - directional_light.position.set(1, 0.5, 1).normalize(); - directional_light.castShadow = true; - scene.add(directional_light); - - var ambient_light = new THREE.AmbientLight(0x666666); - scene.add(ambient_light); - - // on initialise la camera que l’on place ensuite sur la scène - var camera1 = new PointerCamera(50, container_size.width / container_size.height, 1, 100000); - camera1.position.z = 1500; - scene.add(camera1); - cameras.push(camera1); - - var camera3 = new FixedCamera( - 50, - container_size.width / container_size.height, - 1, - 100000, - new THREE.Vector3(500,0,500), - new THREE.Vector3(0,0,0) - ); - - camera3.addToScene(scene); - cameras.push(camera3); - - window.addEventListener('resize', onWindowResize, false); - - container.addEventListener('mousedown', click, false); - - // Création d'un objloader - var helper = new THREE.LoadingManager(); - helper.onProgress = function(item, loaded, total) { - console.log(item, ": " , loaded, " / ", total); - }; - - loader = new THREE.OBJLoader(helper); - loader.load('mesh/TheCarnival.obj', function (object) { - object.traverse(function (child) { - if (child instanceof THREE.Mesh) { - child.up = new THREE.Vector3(0,0,1); - child.rotation.x = Math.PI / 2; - child.scale.set(0.05,0.05,0.05); - } - }); - scene.add(object); - }); -} - -function animate() { - // on appelle la fonction animate() récursivement à chaque frame - requestAnimationFrame(animate); - - cameras.update(); - cameras.look(); - - renderer.render(scene, cameras.mainCamera()); -} - -function onWindowResize() { - cameras.forEach(function(camera) {camera.aspect = container.offsetWidth / container.offsetHeight;}); - cameras.forEach(function(camera) {camera.updateProjectionMatrix();}); - - renderer.setSize(container.offsetWidth, container.offsetHeight); - renderer.render(scene, cameras.mainCamera()); -} - -function hide(object) { - object.traverse(function(object) {object.visible = false;}); -} - -function show(object) { - object.traverse(function(object) {object.visible = true;}); -} - -function click(event) { - cameras.nextCamera(); -} diff --git a/js/PointerCamera.js b/js/PointerCamera.js index abebd59..167890e 100644 --- a/js/PointerCamera.js +++ b/js/PointerCamera.js @@ -56,8 +56,8 @@ PointerCamera.prototype.update = function() { this.position.add(Tools.mul(position_direction, 0.05)); this.target.add(Tools.mul(target_direction, 0.05)); - if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 1 && - Tools.norm2(Tools.diff(this.target, this.new_target)) < 1) { + if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 0.01 && + Tools.norm2(Tools.diff(this.target, this.new_target)) < 0.01) { // this.position = this.new_position.clone(); // this.target = this.new_target.clone(); this.moving = false; diff --git a/js/test1.js b/js/test1.js deleted file mode 100644 index a604e03..0000000 --- a/js/test1.js +++ /dev/null @@ -1,88 +0,0 @@ -var renderer, scene, camera, controls, mesh, i = 0; -var raycaster; -var objects = []; -var container_size = new Object(); -container_size.width = 1067; -container_size.height = 600; - -init(); -animate(); - -function init() -{ - // on initialise le moteur de rendu - container = document.getElementById('container'); - container.style.height = container_size.height + 'px'; - container.style.width = container_size.width + 'px'; - renderer = new THREE.WebGLRenderer({alpha:"true"}); - renderer.setSize(container_size.width, container_size.height); - renderer.shadowMapEnabled = true; - document.getElementById('container').appendChild(renderer.domElement); - container.addEventListener('mousedown', click, false); - - // on initialise la scène - scene = new THREE.Scene(); - raycaster = new THREE.Raycaster(); - - // init light - var directional_light = new THREE.DirectionalLight(0xffffff); - directional_light.position.set(1, 0.5, 1).normalize(); - directional_light.castShadow = true; - scene.add(directional_light); - - var ambient_light = new THREE.AmbientLight(0x444444); - scene.add(ambient_light); - - // on initialise la camera que l’on place ensuite sur la scène - camera = new Camera(50, container_size.width / container_size.height, 1, 10000); - scene.add(camera); - - window.addEventListener('resize', onWindowResize, false); - - geometry = new THREE.Geometry(); - geometry.vertices.push(new THREE.Vector3(0,0,0), new THREE.Vector3(100,100,0), new THREE.Vector3(100,0,100)); - geometry.faces.push(new THREE.Face3(0,1,2)); - geometry.faces.push(new THREE.Face3(0,2,1)); - - geometry.verticesNeedUpdate = true; - geometry.groupsNeedUpdate = true; - - mesh = new THREE.Mesh(geometry); - - - scene.add(mesh); -} - -function animate() -{ - // on appelle la fonction animate() récursivement à chaque frame - requestAnimationFrame(animate); - - i += 1; - - mesh.geometry.vertices.push(new THREE.Vector3(0+i,0+i,0+i), new THREE.Vector3(100+i,100+i,+i), new THREE.Vector3(100+i,0+i,100+i)); - var size = mesh.geometry.vertices.length-3; - mesh.geometry.faces.push(new THREE.Face3(size, size+1, size+2), new THREE.Face3(size, size+2, size+1)); - mesh.geometry.verticesNeedUpdate = true; - mesh.geometry.groupsNeedUpdate = true; - - camera.update(); - camera.look(); - - renderer.render(scene, camera); - -} - -function onWindowResize() -{ - camera.aspect = container.offsetWidth / container.offsetHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(container.offsetWidth, container.offsetHeight); - renderer.render(scene, camera); -} - -function click(event) -{ - -} diff --git a/js/three/OBJMTLLoader.js b/js/three/OBJMTLLoader.js deleted file mode 100644 index 6efac3e..0000000 --- a/js/three/OBJMTLLoader.js +++ /dev/null @@ -1,365 +0,0 @@ -/** - * Loads a Wavefront .obj file with materials - * - * @author mrdoob / http://mrdoob.com/ - * @author angelxuanchang - */ - -THREE.OBJMTLLoader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.OBJMTLLoader.prototype = { - - constructor: THREE.OBJMTLLoader, - - load: function ( url, mtlurl, onLoad, onProgress, onError ) { - - var scope = this; - - var mtlLoader = new THREE.MTLLoader( url.substr( 0, url.lastIndexOf( "/" ) + 1 ) ); - mtlLoader.crossOrigin = scope.crossOrigin; - mtlLoader.load( mtlurl, function ( materials ) { - - var materialsCreator = materials; - materialsCreator.preload(); - - var loader = new THREE.XHRLoader( scope.manager ); - loader.setCrossOrigin( scope.crossOrigin ); - loader.load( url, function ( text ) { - - var object = scope.parse( text ); - - object.traverse( function ( object ) { - - if ( object instanceof THREE.Mesh ) { - - if ( object.material.name ) { - - var material = materialsCreator.create( object.material.name ); - - if ( material ) object.material = material; - - } - - } - - } ); - - onLoad( object ); - - }, onProgress, onError ); - - }, onProgress, onError ); - - }, - - /** - * Parses loaded .obj file - * @param data - content of .obj file - * @param mtllibCallback - callback to handle mtllib declaration (optional) - * @return {THREE.Object3D} - Object3D (with default material) - */ - - parse: function ( data, mtllibCallback ) { - - function vector( x, y, z ) { - - return new THREE.Vector3( x, y, z ); - - } - - function uv( u, v ) { - - return new THREE.Vector2( u, v ); - - } - - function face3( a, b, c, normals ) { - - return new THREE.Face3( a, b, c, normals ); - - } - - var face_offset = 0; - - function meshN( meshName, materialName ) { - - if ( vertices.length > 0 ) { - - geometry.vertices = vertices; - - geometry.mergeVertices(); - geometry.computeFaceNormals(); - geometry.computeBoundingSphere(); - - object.add( mesh ); - - geometry = new THREE.Geometry(); - mesh = new THREE.Mesh( geometry, material ); - - } - - if ( meshName !== undefined ) mesh.name = meshName; - - if ( materialName !== undefined ) { - - material = new THREE.MeshLambertMaterial(); - material.name = materialName; - - mesh.material = material; - - } - - } - - var group = new THREE.Group(); - var object = group; - - var geometry = new THREE.Geometry(); - var material = new THREE.MeshLambertMaterial(); - var mesh = new THREE.Mesh( geometry, material ); - - var vertices = []; - var normals = []; - var uvs = []; - - function add_face( a, b, c, normals_inds ) { - - if ( normals_inds === undefined ) { - - geometry.faces.push( face3( - parseInt( a ) - (face_offset + 1), - parseInt( b ) - (face_offset + 1), - parseInt( c ) - (face_offset + 1) - ) ); - - } else { - - geometry.faces.push( face3( - parseInt( a ) - (face_offset + 1), - parseInt( b ) - (face_offset + 1), - parseInt( c ) - (face_offset + 1), - [ - normals[ parseInt( normals_inds[ 0 ] ) - 1 ].clone(), - normals[ parseInt( normals_inds[ 1 ] ) - 1 ].clone(), - normals[ parseInt( normals_inds[ 2 ] ) - 1 ].clone() - ] - ) ); - - } - - } - - function add_uvs( a, b, c ) { - - geometry.faceVertexUvs[ 0 ].push( [ - uvs[ parseInt( a ) - 1 ].clone(), - uvs[ parseInt( b ) - 1 ].clone(), - uvs[ parseInt( c ) - 1 ].clone() - ] ); - - } - - function handle_face_line(faces, uvs, normals_inds) { - - if ( faces[ 3 ] === undefined ) { - - add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds ); - - if (!(uvs === undefined) && uvs.length > 0) { - add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] ); - } - - } else { - - if (!(normals_inds === undefined) && normals_inds.length > 0) { - - add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ]); - add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ]); - - } else { - - add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ]); - add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ]); - - } - - if (!(uvs === undefined) && uvs.length > 0) { - - add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ); - add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ); - - } - - } - - } - - - // v float float float - - var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/; - - // vn float float float - - var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/; - - // vt float float - - var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/; - - // f vertex vertex vertex ... - - var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/; - - // f vertex/uv vertex/uv vertex/uv ... - - var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/; - - // f vertex/uv/normal vertex/uv/normal vertex/uv/normal ... - - var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/; - - // f vertex//normal vertex//normal vertex//normal ... - - var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/ - - // - - var lines = data.split( "\n" ); - - for ( var i = 0; i < lines.length; i ++ ) { - - var line = lines[ i ]; - line = line.trim(); - - var result; - - if ( line.length === 0 || line.charAt( 0 ) === '#' ) { - - continue; - - } else if ( ( result = vertex_pattern.exec( line ) ) !== null ) { - - // ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"] - - vertices.push( vector( - parseFloat( result[ 1 ] ), - parseFloat( result[ 2 ] ), - parseFloat( result[ 3 ] ) - ) ); - - } else if ( ( result = normal_pattern.exec( line ) ) !== null ) { - - // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"] - - normals.push( vector( - parseFloat( result[ 1 ] ), - parseFloat( result[ 2 ] ), - parseFloat( result[ 3 ] ) - ) ); - - } else if ( ( result = uv_pattern.exec( line ) ) !== null ) { - - // ["vt 0.1 0.2", "0.1", "0.2"] - - uvs.push( uv( - parseFloat( result[ 1 ] ), - parseFloat( result[ 2 ] ) - ) ); - - } else if ( ( result = face_pattern1.exec( line ) ) !== null ) { - - // ["f 1 2 3", "1", "2", "3", undefined] - - handle_face_line([ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ]); - - } else if ( ( result = face_pattern2.exec( line ) ) !== null ) { - - // ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined] - - handle_face_line( - [ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces - [ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //uv - ); - - } else if ( ( result = face_pattern3.exec( line ) ) !== null ) { - - // ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined] - - handle_face_line( - [ result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ] ], //faces - [ result[ 3 ], result[ 7 ], result[ 11 ], result[ 15 ] ], //uv - [ result[ 4 ], result[ 8 ], result[ 12 ], result[ 16 ] ] //normal - ); - - } else if ( ( result = face_pattern4.exec( line ) ) !== null ) { - - // ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined] - - handle_face_line( - [ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces - [ ], //uv - [ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //normal - ); - - } else if ( /^o /.test( line ) ) { - - // object - - meshN(); - face_offset = face_offset + vertices.length; - vertices = []; - object = new THREE.Object3D(); - object.name = line.substring( 2 ).trim(); - group.add( object ); - - } else if ( /^g /.test( line ) ) { - - // group - - meshN( line.substring( 2 ).trim(), undefined ); - - } else if ( /^usemtl /.test( line ) ) { - - // material - - meshN( undefined, line.substring( 7 ).trim() ); - - } else if ( /^mtllib /.test( line ) ) { - - // mtl file - - if ( mtllibCallback ) { - - var mtlfile = line.substring( 7 ); - mtlfile = mtlfile.trim(); - mtllibCallback( mtlfile ); - - } - - } else if ( /^s /.test( line ) ) { - - // Smooth shading - - } else { - - console.log( "THREE.OBJMTLLoader: Unhandled line " + line ); - - } - - } - - //Add last object - meshN(undefined, undefined); - - return group; - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.OBJMTLLoader.prototype ); diff --git a/js/three/PointerLockControls.js b/js/three/PointerLockControls.js deleted file mode 100644 index 4b9f299..0000000 --- a/js/three/PointerLockControls.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PointerLockControls = function ( camera ) { - - var scope = this; - - camera.rotation.set( 0, 0, 0 ); - - var pitchObject = new THREE.Object3D(); - pitchObject.add( camera ); - - var yawObject = new THREE.Object3D(); - yawObject.position.y = 10; - yawObject.add( pitchObject ); - - var PI_2 = Math.PI / 2; - - var onMouseMove = function ( event ) { - - if ( scope.enabled === false ) return; - - var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; - var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; - - yawObject.rotation.y -= movementX * 0.002; - pitchObject.rotation.x -= movementY * 0.002; - - pitchObject.rotation.x = Math.max( - PI_2, Math.min( PI_2, pitchObject.rotation.x ) ); - - }; - - document.addEventListener( 'mousemove', onMouseMove, false ); - - this.enabled = false; - - this.getObject = function () { - - return yawObject; - - }; - - this.getDirection = function() { - - // assumes the camera itself is not rotated - - var direction = new THREE.Vector3( 0, 0, -1 ); - var rotation = new THREE.Euler( 0, 0, 0, "YXZ" ); - - return function( v ) { - - rotation.set( pitchObject.rotation.x, yawObject.rotation.y, 0 ); - - v.copy( direction ).applyEuler( rotation ); - - return v; - - } - - }(); - -}; diff --git a/multisphere/.htaccess b/multisphere/.htaccess new file mode 100644 index 0000000..7031355 --- /dev/null +++ b/multisphere/.htaccess @@ -0,0 +1 @@ +php_value include_path '../include' diff --git a/multisphere/index.html b/multisphere/index.html deleted file mode 100644 index eddae53..0000000 --- a/multisphere/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - The begining - - - -

Here is stuff

-
- - - - - - - - - - diff --git a/multisphere/index.php b/multisphere/index.php new file mode 100644 index 0000000..f639182 --- /dev/null +++ b/multisphere/index.php @@ -0,0 +1,12 @@ + + + + + + + +
+ + + + diff --git a/scene/.htaccess b/scene/.htaccess new file mode 100644 index 0000000..7031355 --- /dev/null +++ b/scene/.htaccess @@ -0,0 +1 @@ +php_value include_path '../include' diff --git a/scene/index.php b/scene/index.php new file mode 100644 index 0000000..af381e1 --- /dev/null +++ b/scene/index.php @@ -0,0 +1,12 @@ + + + + + + + +
+ + + + diff --git a/stream/.htaccess b/stream/.htaccess new file mode 100644 index 0000000..7031355 --- /dev/null +++ b/stream/.htaccess @@ -0,0 +1 @@ +php_value include_path '../include' diff --git a/stream/index.php b/stream/index.php index 0e4b9bd..b061d7f 100644 --- a/stream/index.php +++ b/stream/index.php @@ -1,26 +1,12 @@ + - - The begining - - + -

Here is stuff

+ +
- - - - - - - - - - - - - - +