Did lot of stuff with php
This commit is contained in:
parent
0bbd0fb44a
commit
a320618599
|
@ -0,0 +1 @@
|
|||
php_value include_path '../include'
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The begining</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Here is stuff</h1>
|
||||
<div id="container"></div>
|
||||
<script src="/js/three/three.min.js"></script>
|
||||
<script src="/js/three/OBJLoader.js"></script>
|
||||
<script src="/js/three/OrbitControls.js"></script>
|
||||
<script src="/js/three/PointerLockControls.js"></script>
|
||||
<script src="/js/Cube.js"></script>
|
||||
<script src="/js/BouncingCube.js"></script>
|
||||
<script src="/js/Camera.js"></script>
|
||||
<script src="js/BouncingMain.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<?php include_once("header_functions.php"); ?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<?php head("Bouncing cube"); ?>
|
||||
<body>
|
||||
<?php include("header.php"); ?>
|
||||
<?php include("nav.php"); ?>
|
||||
<h1>Here is stuff</h1>
|
||||
<div id="container"></div>
|
||||
<?php include("jsIncludes.php"); ?>
|
||||
<script src="js/BouncingMain.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
<header>
|
||||
<h1 id="title">Welcome !</h1>
|
||||
</header>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
function head($title = "Title")
|
||||
{
|
||||
echo "\n\t<head>\n";
|
||||
echo "\t\t<title>The begining - " . $title . "</title>\n";
|
||||
echo "\t\t<meta charset='utf-8'>\n";
|
||||
echo "\t</head>\n\n";
|
||||
}
|
||||
|
|
@ -1,27 +1,16 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The begining</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Here is stuff</h1>
|
||||
<div style="border-width:1px; border-style: solid;" id="container"></div>
|
||||
<script src="/js/three/three.min.js"></script>
|
||||
|
||||
<script src="/js/three.js"></script>
|
||||
<script src="/js/Tools.js"></script>
|
||||
<script src="/js/three/DDSLoader.js"></script>
|
||||
<script src="/js/three/MTLLoader.js"></script>
|
||||
<script src="/js/three/OBJLoader.js"></script>
|
||||
<script src="/js/three/OBJMTLLoader.js"></script>
|
||||
<script src="/js/three/OrbitControls.js"></script>
|
||||
<script src="/js/three/PointerLockControls.js"></script>
|
||||
<script src="/js/Cube.js"></script>
|
||||
<script src="/js/BouncingCube.js"></script>
|
||||
<script src="/js/ProgressiveSphere.js"></script>
|
||||
<script src="/js/Camera.js"></script>
|
||||
<script src="/js/PointerCamera.js"></script>
|
||||
<script src="/js/FixedCamera.js"></script>
|
||||
<script src="/js/CameraContainer.js"></script>
|
||||
<script src="/js/Tools.js"></script>
|
||||
<script src="/js/BouncingCube.js"></script>
|
||||
<script src="/js/BufferGeometryToGeometry.js"></script>
|
||||
<script src="/js/PointerCamera.js"></script>
|
||||
<script src="/js/CameraContainer.js"></script>
|
||||
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Index</a></li>
|
||||
<li><a href="/bouncing/">Bouncing cube</a></li>
|
||||
<li><a href="/multisphere/">Multi-sphere</a></li>
|
||||
<li><a href="/scene/">Prototype</a></li>
|
||||
<li><a href="/stream/">Streaming simulator</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
49
index.html
49
index.html
|
@ -1,49 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The begining</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title">Here is a list of places where you can go</h1>
|
||||
<ul>
|
||||
<li><a href="/bouncing/">A bouncing cube that jumps when you click on it</a></li>
|
||||
<li>
|
||||
<p>
|
||||
<a href="/multisphere/">Sphere with multi-resolution</a>
|
||||
</p>
|
||||
<p>
|
||||
Lots of obj files loaded and displayed. When you click
|
||||
somewhere, the current obj is hidden and the next one, with
|
||||
a better resolution is shown.
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<a href="/scene/">A proto of the real thing</a>
|
||||
</p>
|
||||
<p>
|
||||
You can move the camera with the arrow keys and move the
|
||||
angle of the camera with 2, 4, 6 and 8 (the arrows of the
|
||||
numpad), or you can do a drag-and-drop like (click on the
|
||||
mouse to grap the scene, and move the mouse to rotate the
|
||||
camera). You can also select a camera by clicking on the
|
||||
red part of it, and get back to the free camera by clicking
|
||||
again. You can also select a camera by simply clicking on
|
||||
the object you want to see. The program will choose the
|
||||
camera that you want, and move to it progressively.
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<a href="/stream/">Streaming simulation</a>
|
||||
</p>
|
||||
<p>
|
||||
A mesh of a sphere is fully loaded, and displayed
|
||||
progressively. This test is here to prove that we can
|
||||
dynamically add vertices and faces to a mesh.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<?php include_once("header_functions.php"); ?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<?php head("Bouncing cube"); ?>
|
||||
<body>
|
||||
<?php include("header.php"); ?>
|
||||
<?php include("nav.php"); ?>
|
||||
</body>
|
||||
</html>
|
112
js/BigScene.js
112
js/BigScene.js
|
@ -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();
|
||||
}
|
|
@ -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;
|
||||
|
|
88
js/test1.js
88
js/test1.js
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
|
@ -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 );
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}();
|
||||
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
php_value include_path '../include'
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The begining</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Here is stuff</h1>
|
||||
<div id="container"></div>
|
||||
<script src="/js/three/three.min.js"></script>
|
||||
<script src="/js/three/OBJLoader.js"></script>
|
||||
<script src="/js/three/OrbitControls.js"></script>
|
||||
<script src="/js/three/PointerLockControls.js"></script>
|
||||
<script src="/js/Cube.js"></script>
|
||||
<script src="/js/BouncingCube.js"></script>
|
||||
<script src="/js/Camera.js"></script>
|
||||
<script src="js/MultiSphere.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<?php include_once("header_functions.php"); ?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<?php head("Multisphere"); ?>
|
||||
<body>
|
||||
<?php include("header.php"); ?>
|
||||
<?php include("nav.php"); ?>
|
||||
<div id="container"></div>
|
||||
<?php include("jsIncludes.php"); ?>
|
||||
<script src="js/MultiSphere.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
php_value include_path '../include'
|
|
@ -0,0 +1,12 @@
|
|||
<?php include_once("header_functions.php"); ?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<?php head("Prototype"); ?>
|
||||
<body>
|
||||
<?php include("header.php"); ?>
|
||||
<?php include("nav.php"); ?>
|
||||
<div style="border-width:1px; border-style: solid;" id="container"></div>
|
||||
<?php include("jsIncludes.php"); ?>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
php_value include_path '../include'
|
|
@ -1,26 +1,12 @@
|
|||
<?php include_once("header_functions.php"); ?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The begining</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<?php head('Streaming simulator'); ?>
|
||||
<body>
|
||||
<h1>Here is stuff</h1>
|
||||
<?php include("header.php"); ?>
|
||||
<?php include("nav.php"); ?>
|
||||
<div style="border-width:1px; border-style: solid;" id="container"></div>
|
||||
<script src="/js/three/three.min.js"></script>
|
||||
<script src="/js/three/MTLLoader.js"></script>
|
||||
<script src="/js/three/OBJLoader.js"></script>
|
||||
<script src="/js/three/OBJMTLLoader.js"></script>
|
||||
<script src="/js/three/OrbitControls.js"></script>
|
||||
<script src="/js/three/PointerLockControls.js"></script>
|
||||
<script src="/js/Cube.js"></script>
|
||||
<script src="/js/BouncingCube.js"></script>
|
||||
<script src="/js/Camera.js"></script>
|
||||
<script src="/js/PointerCamera.js"></script>
|
||||
<script src="/js/FixedCamera.js"></script>
|
||||
<script src="/js/CameraContainer.js"></script>
|
||||
<script src="/js/Tools.js"></script>
|
||||
<script src="/js/ProgressiveSphere.js"></script>
|
||||
<?php include("jsIncludes.php"); ?>
|
||||
<script src="js/Params.js.php?<?php echo htmlentities($_SERVER['QUERY_STRING']); ?>"></script>
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue