commit
477edfec20
33
LICENSE
33
LICENSE
@ -1,5 +1,8 @@
|
||||
|
||||
potree.js
|
||||
============
|
||||
== POTREE ==
|
||||
============
|
||||
|
||||
http://potree.org
|
||||
|
||||
Copyright (c) 2011-2014, Markus Schütz
|
||||
@ -29,3 +32,31 @@ The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
|
||||
|
||||
=====================
|
||||
== PLASIO / LASLAZ ==
|
||||
=====================
|
||||
|
||||
http://plas.io/
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Uday Verma, uday.karan@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
41
README.md
41
README.md
@ -1,41 +1,42 @@
|
||||
# Potree - WebGL Pointcloud Viewer
|
||||
|
||||
## About
|
||||
|
||||
Potree is a WebGL based point cloud viewer for large datasets.
|
||||
Thanks to WebGL, it runs in all major browsers without plugins.
|
||||
|
||||
Homepage: <a href="http://potree.org/">potree.org</a>
|
||||
<img src="http://potree.org/resources/images/pompei.jpg">
|
||||
|
||||
## Demos
|
||||
* <a href="http://potree.org/demo/pompei/pompei.html" target="_blank">pompei</a>
|
||||
* <a href="http://potree.org/demo/potree_2014.01.22/skatepark.html" target="_blank">skatepark</a>
|
||||
|
||||
This video shows a point cloud of the St. Stephens Cathedral. It consists of ~700m points.
|
||||
This video shows a point cloud of the St. Stephens Cathedral. It consists of ~700m points.
|
||||
<a href="http://www.youtube.com/watch?v=p9e6xElafJU" target="_blank"><img src="http://img.youtube.com/vi/p9e6xElafJU/0.jpg"></a>
|
||||
|
||||
Take a look at the [online showcase](http://potree.org/wp/demo/)
|
||||
|
||||
## Getting Started
|
||||
1. Deploy potree on a webserver.
|
||||
1. Deploy potree on a webserver.
|
||||
2. Open one of the demos in the examples directory. <br>
|
||||
Potree pages must run on a webserver so the url
|
||||
Potree pages must run on a webserver so the url
|
||||
should be something like "localhost/potree/examples/lion.html". URLs starting with "file:///" will not work.
|
||||
|
||||
This is what the lion demo looks like:
|
||||
|
||||

|
||||
|
||||
For more details, read the [Getting Started Section](./docs/getting_started.md)
|
||||
|
||||
## Convert Your Own Pointclouds
|
||||
Use the PotreeConverter to convert your own point clouds into the potree format.
|
||||
|
||||
PotreeConverter source code and binaries for windows are available here:
|
||||
https://github.com/potree/PotreeConverter
|
||||
Use the [PotreeConverter](https://github.com/potree/PotreeConverter) to convert your own point clouds into the potree format.
|
||||
|
||||
## Compatibility
|
||||
|
||||
| Browser | OS | Result |
|
||||
| -------------------- |:----:|:-------------:|
|
||||
| Chrome 32 | Win7 | works |
|
||||
| Firefox 26 | Win7 | works |
|
||||
| Safari | Mac | works |
|
||||
| Opera 19 | Win7 | works |
|
||||
| Internet Explorer 11 | Win7 | does not work |
|
||||
| Browser | OS | Result |
|
||||
| -------------------- |:-------:|:-------------:|
|
||||
| Chrome 32 | Win7 | works |
|
||||
| Firefox 26 | Win7 | works |
|
||||
| Opera 19 | Win7 | works |
|
||||
| Internet Explorer 11 | Win7 | technically works, if you don't expect performance |
|
||||
| Safari | Mac | works |
|
||||
| Firefox | Android | partially works, GUI and stability issues |
|
||||
| Opera | Android | partially works, GUI and stabilty issues and slow |
|
||||
|
||||
|
||||
## License
|
||||
|
||||
1950
build/js/potree.js
Normal file
1950
build/js/potree.js
Normal file
File diff suppressed because one or more lines are too long
3
build/js/potree.min.js
vendored
Normal file
3
build/js/potree.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
build/workers/lasdecoder-worker.js
Normal file
1
build/workers/lasdecoder-worker.js
Normal file
File diff suppressed because one or more lines are too long
1
build/workers/laslaz-worker.js
Normal file
1
build/workers/laslaz-worker.js
Normal file
File diff suppressed because one or more lines are too long
16
docs/build.md
Normal file
16
docs/build.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# How to build the library
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you have [node.js](http://nodejs.org/) installed
|
||||
|
||||
Setting up gulp:
|
||||
|
||||
cd potree_directory
|
||||
npm install -g gulp
|
||||
npm install --save-dev
|
||||
|
||||
## Usage
|
||||
|
||||
gulp scripts // creates single script files in build/js
|
||||
@ -7,6 +7,15 @@
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.info{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 1px black,
|
||||
1px -1px 1px black,
|
||||
-1px 1px 1px black,
|
||||
-1px -1px 1px black;
|
||||
}
|
||||
|
||||
#lblDistance{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
@ -14,8 +23,6 @@
|
||||
2px -2px 2px black,
|
||||
-2px 2px 2px black,
|
||||
-2px -2px 2px black;
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -23,13 +30,7 @@
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
<input type="button" value="place start"
|
||||
style="position:absolute; left: 10px; top: 10px; width: 100px; z-index: 100"
|
||||
@ -38,7 +39,7 @@
|
||||
style="position:absolute; left: 10px; top: 40px; width: 100px; z-index: 100"
|
||||
onclick="placeEnd()">
|
||||
|
||||
<div id="lblDistance" style="position: absolute; width: 20px; z-index: 100;">abc</div>
|
||||
<div id="lblDistance" class="info" style="position: absolute; width: 20px; z-index: 100;">abc</div>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px;"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px;"></div>
|
||||
@ -47,7 +48,7 @@
|
||||
|
||||
var defaultPointSize = 0.03;
|
||||
var defaultLOD = 15;
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud.js";
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud_bin.js";
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
@ -58,39 +59,7 @@
|
||||
var spStart, spEnd, sConnection;
|
||||
var placeStartMode = false;
|
||||
var placeEndMode = false;
|
||||
var cube, cameraCube, sceneCube;
|
||||
|
||||
function loadSkybox(){
|
||||
cameraCube = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
|
||||
sceneCube = new THREE.Scene();
|
||||
|
||||
var path = "../resources/textures/skybox/";
|
||||
var format = ".jpg";
|
||||
var urls = [
|
||||
path + 'px' + format, path + 'nx' + format,
|
||||
path + 'py' + format, path + 'ny' + format,
|
||||
path + 'pz' + format, path + 'nz' + format
|
||||
];
|
||||
|
||||
var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
var shader = THREE.ShaderLib[ "cube" ];
|
||||
shader.uniforms[ "tCube" ].value = textureCube;
|
||||
|
||||
var material = new THREE.ShaderMaterial( {
|
||||
|
||||
fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms,
|
||||
depthWrite: false,
|
||||
side: THREE.BackSide
|
||||
|
||||
} ),
|
||||
|
||||
mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
|
||||
sceneCube.add( mesh );
|
||||
}
|
||||
var skybox;
|
||||
|
||||
function initGUI(){
|
||||
var gui = new dat.GUI({
|
||||
@ -99,7 +68,8 @@
|
||||
|
||||
var params = {
|
||||
PointSize: defaultPointSize,
|
||||
LOD: defaultLOD
|
||||
LOD: defaultLOD,
|
||||
"show aabb" : false
|
||||
};
|
||||
|
||||
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
||||
@ -111,6 +81,11 @@
|
||||
pPointSize.onChange(function(value){
|
||||
pointcloudMaterial.size = value;
|
||||
});
|
||||
|
||||
var pBoundingBox = gui.add(params, 'show aabb');
|
||||
pBoundingBox.onChange(function(value){
|
||||
pointcloud.showBoundingBox = value;
|
||||
});
|
||||
}
|
||||
|
||||
function initThree() {
|
||||
@ -125,7 +100,7 @@
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
loadSkybox();
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// pointcloud
|
||||
pointcloudMaterial = new THREE.PointCloudMaterial( { size: defaultPointSize, vertexColors: true } );
|
||||
@ -133,22 +108,19 @@
|
||||
pointcloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
//pointcloud.scale.set(0.5,0.5,0.5);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
pointcloud.position.y -= 1.6
|
||||
scene.add(pointcloud);
|
||||
|
||||
// grid
|
||||
scene.add(createGrid(8,8,1));
|
||||
scene.add(Potree.utils.createGrid(8,8,1));
|
||||
|
||||
// measurement
|
||||
var sphereGeometry = new THREE.SphereGeometry(0.05, 32, 32);
|
||||
var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xbb0000, shading: THREE.FlatShading});
|
||||
spStart = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
||||
spEnd = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
||||
//spStart.position.set(-1.1,1.05,2);
|
||||
//spEnd.position.set(1.3,1.0,1.15);
|
||||
spStart.position.set(-2.2,1.9, 1.66);
|
||||
spEnd.position.set(0.02,2,2.64);
|
||||
scene.add(spStart);
|
||||
@ -172,27 +144,6 @@
|
||||
renderer.domElement.addEventListener( 'click', onClick, false );
|
||||
}
|
||||
|
||||
function createGrid(width, length, spacing){
|
||||
var material = new THREE.LineBasicMaterial({
|
||||
color: 0xBBBBBB
|
||||
});
|
||||
|
||||
var geometry = new THREE.Geometry();
|
||||
for(var i = 0; i <= length; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(-(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(+(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
}
|
||||
|
||||
for(var i = 0; i <= width; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, -(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, +(spacing*length)/2));
|
||||
}
|
||||
|
||||
var line = new THREE.Line(geometry, material, THREE.LinePieces);
|
||||
line.receiveShadow = true;
|
||||
return line;
|
||||
}
|
||||
|
||||
function onDocumentMouseMove( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -252,8 +203,8 @@
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(numVisiblePoints);
|
||||
|
||||
// render skybox
|
||||
cameraCube.rotation.copy( camera.rotation );
|
||||
renderer.render( sceneCube, cameraCube );
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
@ -29,15 +29,8 @@
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
|
||||
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
@ -47,82 +40,73 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var defaultPointSize = 0.03;
|
||||
var defaultPointSize = 0.04;
|
||||
var defaultLOD = 15;
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud.js";
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud_bin.js";
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var cube;
|
||||
var scene;
|
||||
var pointclouds = [];
|
||||
var cameraCube, sceneCube;
|
||||
var pointcloud;
|
||||
var skybox;
|
||||
var stats;
|
||||
var pointcloudMaterial;
|
||||
|
||||
function loadSkybox(){
|
||||
cameraCube = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
|
||||
sceneCube = new THREE.Scene();
|
||||
|
||||
var path = "../resources/textures/skybox/";
|
||||
var format = ".jpg";
|
||||
var urls = [
|
||||
path + 'px' + format, path + 'nx' + format,
|
||||
path + 'py' + format, path + 'ny' + format,
|
||||
path + 'pz' + format, path + 'nz' + format
|
||||
];
|
||||
|
||||
var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
var shader = THREE.ShaderLib[ "cube" ];
|
||||
shader.uniforms[ "tCube" ].value = textureCube;
|
||||
|
||||
var material = new THREE.ShaderMaterial( {
|
||||
|
||||
fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms,
|
||||
depthWrite: false,
|
||||
side: THREE.BackSide
|
||||
|
||||
} ),
|
||||
|
||||
mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
|
||||
sceneCube.add( mesh );
|
||||
}
|
||||
var clock = new THREE.Clock();
|
||||
var materials = {};
|
||||
|
||||
function initGUI(){
|
||||
|
||||
// dat.gui
|
||||
var gui = new dat.GUI({
|
||||
height : 5 * 32 - 1
|
||||
});
|
||||
|
||||
var params = {
|
||||
PointSize: defaultPointSize,
|
||||
LOD: defaultLOD
|
||||
LOD: defaultLOD,
|
||||
"show aabb" : false,
|
||||
"Materials" : materials.rgb
|
||||
};
|
||||
|
||||
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
||||
pLOD.onChange(function(value){
|
||||
//pointCloud.LOD = value;
|
||||
for(var i = 0; i < pointclouds.length; i++){
|
||||
pointclouds[i].LOD = value;
|
||||
}
|
||||
pointcloud.LOD = value;
|
||||
});
|
||||
|
||||
var pPointSize = gui.add(params, 'PointSize', 0.01, 0.1);
|
||||
pPointSize.onChange(function(value){
|
||||
pointcloudMaterial.size = value;
|
||||
pointcloud.material.size = value;
|
||||
});
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
|
||||
var pMaterial = gui.add(params, 'Materials', [ "RGB", "Color", "Height" ]);
|
||||
pMaterial.onChange(function(value){
|
||||
var size = pointcloud.material.size;
|
||||
if(value === "RGB"){
|
||||
pointcloud.material = materials.rgb;
|
||||
}else if(value === "Color"){
|
||||
pointcloud.material = materials.color;
|
||||
}else if(value === "Height"){
|
||||
pointcloud.material = materials.height;
|
||||
}
|
||||
|
||||
pointcloud.material.size = size;
|
||||
|
||||
console.log(value);
|
||||
});
|
||||
|
||||
var pBoundingBox = gui.add(params, 'show aabb');
|
||||
pBoundingBox.onChange(function(value){
|
||||
pointcloud.showBoundingBox = value;
|
||||
});
|
||||
|
||||
// stats
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
stats.domElement.style.margin = '5px';
|
||||
document.body.appendChild( stats.domElement );
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 100000);
|
||||
|
||||
@ -131,69 +115,52 @@
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
loadSkybox();
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// camera and controls
|
||||
camera.position.z = 25;
|
||||
camera.position.y = 10;
|
||||
camera.position.x = 15;
|
||||
camera.position.set(5, 10, 15);
|
||||
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
||||
controls.target.set( 0, 3, 0 );
|
||||
controls.target.set( 0, 4, 0 );
|
||||
camera.lookAt(controls.target);
|
||||
|
||||
// materials
|
||||
materials.rgb = new Potree.PointCloudRGBMaterial({ size: defaultPointSize});
|
||||
materials.color = new Potree.PointCloudColorMaterial({size: defaultPointSize});
|
||||
materials.height = new Potree.PointCloudHeightMaterial({size: defaultPointSize, min: 0, max: 10});
|
||||
materials.height = new Potree.PointCloudHeightMaterial({size: defaultPointSize, min: 0, max: 10});
|
||||
|
||||
pointcloudMaterial = new THREE.PointCloudMaterial( { size: defaultPointSize, vertexColors: true } );
|
||||
// load pointcloud
|
||||
var pco = POCLoader.load(pointcloudPath, {toOrigin: true});
|
||||
|
||||
//// load pointcloud
|
||||
var pco = POCLoader.load(pointcloudPath);
|
||||
//pointCloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
||||
//pointCloud.LOD = defaultLOD;
|
||||
//pointCloud.rotation.set(Math.PI,-1.2,0);
|
||||
//pointCloud.moveToOrigin();
|
||||
//pointCloud.moveToGroundPlane();
|
||||
//scene.add(pointCloud);
|
||||
pointcloud = new Potree.PointCloudOctree(pco, materials.rgb);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
|
||||
for(var i = -2; i <= 2; i++){
|
||||
for(var j = -2; j <= 2; j++){
|
||||
var pointcloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
//pointcloud.rotation.set(Math.PI,-1.2,0);
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
pointcloud.position.x += 8*i;
|
||||
pointcloud.position.z += 8*j;
|
||||
|
||||
pointclouds.push(pointcloud);
|
||||
scene.add(pointcloud);
|
||||
}
|
||||
}
|
||||
scene.add(pointcloud);
|
||||
|
||||
var grid = Potree.utils.createGrid(5, 5, 2);
|
||||
scene.add(grid);
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
requestAnimationFrame(render);
|
||||
|
||||
var numVisibleNodes = 0;
|
||||
var numVisiblePoints = 0;
|
||||
for(var i = 0; i < pointclouds.length; i++){
|
||||
var pointcloud = pointclouds[i];
|
||||
pointcloud.update(camera);
|
||||
numVisibleNodes += pointcloud.numVisibleNodes;
|
||||
numVisiblePoints += pointcloud.numVisiblePoints;
|
||||
}
|
||||
pointcloud.update(camera);
|
||||
|
||||
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + pointcloud.numVisibleNodes;
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(pointcloud.numVisiblePoints);
|
||||
stats.update();
|
||||
|
||||
controls.update(clock.getDelta());
|
||||
|
||||
// render skybox
|
||||
cameraCube.rotation.copy( camera.rotation );
|
||||
renderer.render( sceneCube, cameraCube );
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
// render scene
|
||||
renderer.render(scene, camera);
|
||||
|
||||
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + numVisibleNodes;
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(numVisiblePoints);
|
||||
|
||||
stats.update();
|
||||
controls.update(0.1);
|
||||
|
||||
};
|
||||
|
||||
initThree();
|
||||
@ -202,8 +169,5 @@
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
177
examples/lion_las.html
Normal file
177
examples/lion_las.html
Normal file
@ -0,0 +1,177 @@
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Lion</title>
|
||||
<style>canvas { width: 100%; height: 100% }</style>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0">
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.info{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 1px black,
|
||||
1px -1px 1px black,
|
||||
-1px 1px 1px black,
|
||||
-1px -1px 1px black;
|
||||
}
|
||||
|
||||
a:hover, a:visited, a:link, a:active{
|
||||
color: #ccccff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var defaultPointSize = 0.09;
|
||||
var defaultLOD = 12;
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud_las.js";
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var scene;
|
||||
var pointcloud;
|
||||
var skybox;
|
||||
var stats;
|
||||
var clock = new THREE.Clock();
|
||||
var materials = {};
|
||||
|
||||
function initGUI(){
|
||||
|
||||
// dat.gui
|
||||
var gui = new dat.GUI({
|
||||
height : 5 * 32 - 1
|
||||
});
|
||||
|
||||
var params = {
|
||||
PointSize: defaultPointSize,
|
||||
LOD: defaultLOD,
|
||||
"show aabb" : false,
|
||||
"Materials" : materials.rgb
|
||||
};
|
||||
|
||||
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
||||
pLOD.onChange(function(value){
|
||||
pointcloud.LOD = value;
|
||||
});
|
||||
|
||||
var pPointSize = gui.add(params, 'PointSize', 0.01, 0.3);
|
||||
pPointSize.onChange(function(value){
|
||||
pointcloud.material.size = value;
|
||||
});
|
||||
|
||||
var pMaterial = gui.add(params, 'Materials', [ "RGB", "Color", "Height", "Intensity" ]);
|
||||
pMaterial.onChange(function(value){
|
||||
var size = pointcloud.material.size;
|
||||
if(value === "RGB"){
|
||||
pointcloud.material = materials.rgb;
|
||||
}else if(value === "Color"){
|
||||
pointcloud.material = materials.color;
|
||||
}else if(value === "Height"){
|
||||
pointcloud.material = materials.height;
|
||||
}else if(value === "Intensity"){
|
||||
pointcloud.material = materials.intensity;
|
||||
}
|
||||
|
||||
pointcloud.material.size = size;
|
||||
|
||||
console.log(value);
|
||||
});
|
||||
|
||||
var pBoundingBox = gui.add(params, 'show aabb');
|
||||
pBoundingBox.onChange(function(value){
|
||||
pointcloud.showBoundingBox = value;
|
||||
});
|
||||
|
||||
// stats
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
stats.domElement.style.margin = '5px';
|
||||
document.body.appendChild( stats.domElement );
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 100000);
|
||||
|
||||
renderer = new THREE.WebGLRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// camera and controls
|
||||
camera.position.set(2, 7, 7);
|
||||
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
||||
controls.target.set( 0, 4, 0 );
|
||||
camera.lookAt(controls.target);
|
||||
|
||||
// materials
|
||||
materials.rgb = new Potree.PointCloudRGBMaterial({ size: defaultPointSize});
|
||||
materials.color = new Potree.PointCloudColorMaterial({size: defaultPointSize});
|
||||
materials.height = new Potree.PointCloudHeightMaterial({size: defaultPointSize, min: 0, max: 10});
|
||||
materials.intensity = new Potree.PointCloudIntensityMaterial({size: defaultPointSize, min: 0, max: 65535});
|
||||
|
||||
// load pointcloud
|
||||
var pco = POCLoader.load(pointcloudPath, {toOrigin: true});
|
||||
|
||||
pointcloud = new Potree.PointCloudOctree(pco, materials.rgb);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
|
||||
scene.add(pointcloud);
|
||||
|
||||
var grid = Potree.utils.createGrid(5, 5, 2);
|
||||
scene.add(grid);
|
||||
}
|
||||
|
||||
function render() {
|
||||
requestAnimationFrame(render);
|
||||
|
||||
pointcloud.update(camera);
|
||||
|
||||
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + pointcloud.numVisibleNodes;
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(pointcloud.numVisiblePoints);
|
||||
stats.update();
|
||||
|
||||
controls.update(clock.getDelta());
|
||||
|
||||
// render skybox
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
// render scene
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
initThree();
|
||||
initGUI();
|
||||
render();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
177
examples/lion_laz.html
Normal file
177
examples/lion_laz.html
Normal file
@ -0,0 +1,177 @@
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Lion</title>
|
||||
<style>canvas { width: 100%; height: 100% }</style>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0">
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.info{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 1px black,
|
||||
1px -1px 1px black,
|
||||
-1px 1px 1px black,
|
||||
-1px -1px 1px black;
|
||||
}
|
||||
|
||||
a:hover, a:visited, a:link, a:active{
|
||||
color: #ccccff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var defaultPointSize = 0.09;
|
||||
var defaultLOD = 12;
|
||||
var pointcloudPath = "../resources/pointclouds/lion_takanawa/cloud_laz.js";
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var scene;
|
||||
var pointcloud;
|
||||
var skybox;
|
||||
var stats;
|
||||
var clock = new THREE.Clock();
|
||||
var materials = {};
|
||||
|
||||
function initGUI(){
|
||||
|
||||
// dat.gui
|
||||
var gui = new dat.GUI({
|
||||
height : 5 * 32 - 1
|
||||
});
|
||||
|
||||
var params = {
|
||||
PointSize: defaultPointSize,
|
||||
LOD: defaultLOD,
|
||||
"show aabb" : false,
|
||||
"Materials" : materials.rgb
|
||||
};
|
||||
|
||||
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
||||
pLOD.onChange(function(value){
|
||||
pointcloud.LOD = value;
|
||||
});
|
||||
|
||||
var pPointSize = gui.add(params, 'PointSize', 0.01, 0.3);
|
||||
pPointSize.onChange(function(value){
|
||||
pointcloud.material.size = value;
|
||||
});
|
||||
|
||||
var pMaterial = gui.add(params, 'Materials', [ "RGB", "Color", "Height", "Intensity" ]);
|
||||
pMaterial.onChange(function(value){
|
||||
var size = pointcloud.material.size;
|
||||
if(value === "RGB"){
|
||||
pointcloud.material = materials.rgb;
|
||||
}else if(value === "Color"){
|
||||
pointcloud.material = materials.color;
|
||||
}else if(value === "Height"){
|
||||
pointcloud.material = materials.height;
|
||||
}else if(value === "Intensity"){
|
||||
pointcloud.material = materials.intensity;
|
||||
}
|
||||
|
||||
pointcloud.material.size = size;
|
||||
|
||||
console.log(value);
|
||||
});
|
||||
|
||||
var pBoundingBox = gui.add(params, 'show aabb');
|
||||
pBoundingBox.onChange(function(value){
|
||||
pointcloud.showBoundingBox = value;
|
||||
});
|
||||
|
||||
// stats
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
stats.domElement.style.margin = '5px';
|
||||
document.body.appendChild( stats.domElement );
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 100000);
|
||||
|
||||
renderer = new THREE.WebGLRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// camera and controls
|
||||
camera.position.set(2, 7, 7);
|
||||
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
||||
controls.target.set( 0, 4, 0 );
|
||||
camera.lookAt(controls.target);
|
||||
|
||||
// materials
|
||||
materials.rgb = new Potree.PointCloudRGBMaterial({ size: defaultPointSize});
|
||||
materials.color = new Potree.PointCloudColorMaterial({size: defaultPointSize});
|
||||
materials.height = new Potree.PointCloudHeightMaterial({size: defaultPointSize, min: 0, max: 10});
|
||||
materials.intensity = new Potree.PointCloudIntensityMaterial({size: defaultPointSize, min: 0, max: 65535});
|
||||
|
||||
// load pointcloud
|
||||
var pco = POCLoader.load(pointcloudPath, {toOrigin: true});
|
||||
|
||||
pointcloud = new Potree.PointCloudOctree(pco, materials.rgb);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
|
||||
scene.add(pointcloud);
|
||||
|
||||
var grid = Potree.utils.createGrid(5, 5, 2);
|
||||
scene.add(grid);
|
||||
}
|
||||
|
||||
function render() {
|
||||
requestAnimationFrame(render);
|
||||
|
||||
pointcloud.update(camera);
|
||||
|
||||
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + pointcloud.numVisibleNodes;
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(pointcloud.numVisiblePoints);
|
||||
stats.update();
|
||||
|
||||
controls.update(clock.getDelta());
|
||||
|
||||
// render skybox
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
// render scene
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
initThree();
|
||||
initGUI();
|
||||
render();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -3,11 +3,7 @@
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px;">
|
||||
@ -62,8 +58,6 @@ function generatePointcloud(){
|
||||
return pointcloud;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init() {
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
|
||||
|
||||
@ -1,95 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px;">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var scene;
|
||||
|
||||
function generatePointcloud(){
|
||||
var geometry = new THREE.BufferGeometry();
|
||||
var width = 200;
|
||||
var length = 200;
|
||||
var numPoints = width*length;
|
||||
|
||||
var positions = new Float32Array(numPoints*3);
|
||||
var colors = new Float32Array(numPoints*3);
|
||||
|
||||
var color = new THREE.Color();
|
||||
var k = 0;
|
||||
for(var i = 0; i < width; i++){
|
||||
for(var j = 0; j < length; j++){
|
||||
var u = i/width;
|
||||
var v = j/length;
|
||||
var x = 10*u - 5;
|
||||
var y = (Math.cos(u*Math.PI*8) + Math.sin(v*Math.PI*8))/2;
|
||||
var z = 10*v - 5;
|
||||
|
||||
positions[3*k] = x;
|
||||
positions[3*k+1] = y;
|
||||
positions[3*k+2] = z;
|
||||
|
||||
var intensity = y+1;
|
||||
color.setRGB(u*intensity, v*intensity, 0);
|
||||
colors[3*k] = color.r;
|
||||
colors[3*k+1] = color.g;
|
||||
colors[3*k+2] = color.b;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
geometry.addAttribute('position', new THREE.Float32Attribute(positions, 3));
|
||||
geometry.addAttribute('color', new THREE.Float32Attribute(colors, 3));
|
||||
|
||||
var material = new THREE.PointCloudMaterial({ size: 0.01, vertexColors: true });
|
||||
var pointcloud = new THREE.PointCloud(geometry, material);
|
||||
|
||||
return pointcloud;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init() {
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
|
||||
|
||||
renderer = new THREE.WebGLRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
pointcloud = generatePointcloud();
|
||||
scene.add(pointcloud);
|
||||
|
||||
// controls
|
||||
camera.position.set(5,5,2);
|
||||
controls = new THREE.OrbitControls(camera);
|
||||
controls.target.set( 0, 0, 0 );
|
||||
camera.lookAt(new THREE.Vector3(0,0,0));
|
||||
}
|
||||
|
||||
function render() {
|
||||
requestAnimationFrame(render);
|
||||
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
init();
|
||||
render();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
130
gulpfile.js
Normal file
130
gulpfile.js
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
var path = require('path');
|
||||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var size = require('gulp-size');
|
||||
var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
var gutil = require('gulp-util');
|
||||
var through = require('through');
|
||||
var os = require('os');
|
||||
var File = gutil.File;
|
||||
|
||||
|
||||
var paths = {
|
||||
potree : [
|
||||
"src/Potree.js",
|
||||
"src/WorkerManager.js",
|
||||
"build/workers/laslaz-worker.js",
|
||||
"build/workers/lasdecoder-worker.js",
|
||||
"src/extensions/PerspectiveCamera.js",
|
||||
"src/extensions/Ray.js",
|
||||
"src/loader/POCLoader.js",
|
||||
"src/loader/PointAttributes.js",
|
||||
"src/loader/LasLazLoader.js",
|
||||
"src/materials/PointCloudRGBMaterial.js",
|
||||
"src/materials/PointCloudIntensityMaterial.js",
|
||||
"src/materials/PointCloudHeightMaterial.js",
|
||||
"src/materials/PointCloudColorMaterial.js",
|
||||
"src/FirstPersonControls.js",
|
||||
"src/LRU.js",
|
||||
"src/PointCloudOctree.js",
|
||||
"src/PointCloudOctreeGeometry.js",
|
||||
"src/utils.js"
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
var workers = {
|
||||
"laslaz": [
|
||||
"libs/plasio/workers/laz-perf.js",
|
||||
"libs/plasio/workers/laz-loader-worker.js"
|
||||
],
|
||||
"LASDecoder": [
|
||||
"src/workers/LASDecoderWorker.js"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
gulp.task("workers", function(){
|
||||
gulp.src(workers.laslaz)
|
||||
.pipe(encodeWorker('laslaz-worker.js', "Potree.workers.laslaz"))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/workers'));
|
||||
|
||||
gulp.src(workers.LASDecoder)
|
||||
.pipe(encodeWorker('lasdecoder-worker.js', "Potree.workers.lasdecoder"))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/workers'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task("scripts", function(){
|
||||
gulp.src(paths.potree)
|
||||
.pipe(concat('potree.js'))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/js'))
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
.pipe(uglify({preserveComments: 'some'}))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/js'));
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var encodeWorker = function(fileName, varname, opt){
|
||||
if (!fileName) throw new PluginError('gulp-concat', 'Missing fileName option for gulp-concat');
|
||||
if (!opt) opt = {};
|
||||
if (!opt.newLine) opt.newLine = gutil.linefeed;
|
||||
|
||||
var buffer = [];
|
||||
var firstFile = null;
|
||||
|
||||
function bufferContents(file){
|
||||
if (file.isNull()) return; // ignore
|
||||
if (file.isStream()) return this.emit('error', new PluginError('gulp-concat', 'Streaming not supported'));
|
||||
|
||||
if (!firstFile) firstFile = file;
|
||||
|
||||
var string = file.contents.toString('utf8');
|
||||
buffer.push(string);
|
||||
}
|
||||
|
||||
function endStream(){
|
||||
if (buffer.length === 0) return this.emit('end');
|
||||
|
||||
var joinedContents = buffer.join("");
|
||||
//var content = varname + " = {\n";
|
||||
//content += "\tcode:\tatob(\"" + new Buffer(joinedContents).toString('base64') + "\"),\n";
|
||||
//content += "\tinstances:\t[]\n";
|
||||
//content += "};";
|
||||
var content = varname + " = new Potree.WorkerManager(atob(\"" + new Buffer(joinedContents).toString('base64') + "\"));";
|
||||
|
||||
var joinedPath = path.join(firstFile.base, fileName);
|
||||
|
||||
var joinedFile = new File({
|
||||
cwd: firstFile.cwd,
|
||||
base: firstFile.base,
|
||||
path: joinedPath,
|
||||
contents: new Buffer(content)
|
||||
});
|
||||
|
||||
this.emit('data', joinedFile);
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
return through(bufferContents, endStream);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
112
libs/plasio/js/client.js
Normal file
112
libs/plasio/js/client.js
Normal file
@ -0,0 +1,112 @@
|
||||
// client.js
|
||||
// Client side stuffs for greyhound web viewer
|
||||
//
|
||||
|
||||
// Import all modules here even if we don't want to use them
|
||||
// so that browserify can pick them up
|
||||
var $ = require('jquery'),
|
||||
render = require('./render'),
|
||||
ui = require('./ui'),
|
||||
laslaz = require('./laslaz');
|
||||
|
||||
|
||||
function endsWith(str, s) {
|
||||
return str.indexOf(s) === (str.length - s.length);
|
||||
}
|
||||
|
||||
(function(w) {
|
||||
"use strict";
|
||||
|
||||
// The NACL module calls method on the window, make sure the laslaz module
|
||||
// can see messages sent by NACL
|
||||
//
|
||||
window.handleMessage = laslaz.handleMessage;
|
||||
|
||||
// show an error message to the user
|
||||
//
|
||||
var errorOut = function(msg) {
|
||||
$("#messages").html("<p class='error'>" + msg + "</p>");
|
||||
console.log('Error : ' + msg);
|
||||
};
|
||||
|
||||
// show a status message to the user
|
||||
var message = function(msg) {
|
||||
$("#messages").html("<p class='message'>" + msg + "</p>");
|
||||
console.log('Status: ' + msg);
|
||||
};
|
||||
|
||||
$(document).on("plasio.start", function() {
|
||||
render.startRenderer($("#container").get(0), message);
|
||||
});
|
||||
|
||||
})(window);
|
||||
|
||||
$(function() {
|
||||
setTimeout(function() {
|
||||
var isWebGLSupported = function() {
|
||||
if ("WebGLRenderingContext" in window) {
|
||||
// might have support
|
||||
//
|
||||
var e = document.createElement("canvas");
|
||||
var webgl = e.getContext("webgl");
|
||||
var experimental = false;
|
||||
if (webgl === null) {
|
||||
webgl = e.getContext("experimental-webgl");
|
||||
experimental = true;
|
||||
}
|
||||
|
||||
return [webgl !== null, experimental];
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// if we're good to go, trigger the plasio.start event, all initializers
|
||||
// should be hooked to this event, and not DOMContentLoaded
|
||||
//
|
||||
var r = isWebGLSupported();
|
||||
var supported = r[0];
|
||||
var experimental = r[1];
|
||||
if(supported) {
|
||||
$(".fullscreen").fadeOut(200);
|
||||
// we need to intialize the UI first, before we initialize everything else,
|
||||
// since UI has to show results and statuses about things as they initialize
|
||||
//
|
||||
$.event.trigger({
|
||||
type: "plasio.startUI"
|
||||
});
|
||||
|
||||
$.event.trigger({
|
||||
type: "plasio.start"
|
||||
});
|
||||
|
||||
if (experimental) {
|
||||
$.event.trigger({
|
||||
type: "plasio.webglIsExperimental"
|
||||
});
|
||||
}
|
||||
|
||||
var parseURL = function(qs) {
|
||||
var name = qs.match(/\?s=(\S+)/);
|
||||
return name ? name[1] : null;
|
||||
};
|
||||
|
||||
|
||||
// If a URL is specified, load that now
|
||||
var query = window.location.search;
|
||||
if (query) {
|
||||
query = parseURL(query);
|
||||
if (query && query.length > 0) {
|
||||
$.event.trigger({
|
||||
type: "plasio.loadfiles.remote",
|
||||
url: query,
|
||||
name: query
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#no-support").css("opacity", 1.0);
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
482
libs/plasio/js/common.js
Normal file
482
libs/plasio/js/common.js
Normal file
@ -0,0 +1,482 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Set to true when the Document is loaded IFF "test=true" is in the query
|
||||
// string.
|
||||
var isTest = false;
|
||||
|
||||
// Set to true when loading a "Release" NaCl module, false when loading a
|
||||
// "Debug" NaCl module.
|
||||
var isRelease = true;
|
||||
|
||||
// Javascript module pattern:
|
||||
// see http://en.wikipedia.org/wiki/Unobtrusive_JavaScript#Namespaces
|
||||
// In essence, we define an anonymous function which is immediately called and
|
||||
// returns a new object. The new object contains only the exported definitions;
|
||||
// all other definitions in the anonymous function are inaccessible to external
|
||||
// code.
|
||||
var common = (function() {
|
||||
|
||||
function isHostToolchain(tool) {
|
||||
return tool == 'win' || tool == 'linux' || tool == 'mac';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mime type for NaCl plugin.
|
||||
*
|
||||
* @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc.
|
||||
* @return {string} The mime-type for the kind of NaCl plugin matching
|
||||
* the given toolchain.
|
||||
*/
|
||||
function mimeTypeForTool(tool) {
|
||||
// For NaCl modules use application/x-nacl.
|
||||
var mimetype = 'application/x-pnacl';
|
||||
if (isHostToolchain(tool)) {
|
||||
// For non-NaCl PPAPI plugins use the x-ppapi-debug/release
|
||||
// mime type.
|
||||
if (isRelease)
|
||||
mimetype = 'application/x-ppapi-release';
|
||||
else
|
||||
mimetype = 'application/x-ppapi-debug';
|
||||
} else if (tool == 'pnacl' && isRelease) {
|
||||
mimetype = 'application/x-pnacl';
|
||||
}
|
||||
return mimetype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the browser supports NaCl plugins.
|
||||
*
|
||||
* @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc.
|
||||
* @return {bool} True if the browser supports the type of NaCl plugin
|
||||
* produced by the given toolchain.
|
||||
*/
|
||||
function browserSupportsNaCl(tool) {
|
||||
// Assume host toolchains always work with the given browser.
|
||||
// The below mime-type checking might not work with
|
||||
// --register-pepper-plugins.
|
||||
if (isHostToolchain(tool)) {
|
||||
return true;
|
||||
}
|
||||
var mimetype = mimeTypeForTool(tool);
|
||||
return navigator.mimeTypes[mimetype] !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject a script into the DOM, and call a callback when it is loaded.
|
||||
*
|
||||
* @param {string} url The url of the script to load.
|
||||
* @param {Function} onload The callback to call when the script is loaded.
|
||||
* @param {Function} onerror The callback to call if the script fails to load.
|
||||
*/
|
||||
function injectScript(url, onload, onerror) {
|
||||
var scriptEl = document.createElement('script');
|
||||
scriptEl.type = 'text/javascript';
|
||||
scriptEl.src = url;
|
||||
scriptEl.onload = onload;
|
||||
if (onerror) {
|
||||
scriptEl.addEventListener('error', onerror, false);
|
||||
}
|
||||
document.head.appendChild(scriptEl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run all tests for this example.
|
||||
*
|
||||
* @param {Object} moduleEl The module DOM element.
|
||||
*/
|
||||
function runTests(moduleEl) {
|
||||
console.log('runTests()');
|
||||
common.tester = new Tester();
|
||||
|
||||
// All NaCl SDK examples are OK if the example exits cleanly; (i.e. the
|
||||
// NaCl module returns 0 or calls exit(0)).
|
||||
//
|
||||
// Without this exception, the browser_tester thinks that the module
|
||||
// has crashed.
|
||||
common.tester.exitCleanlyIsOK();
|
||||
|
||||
common.tester.addAsyncTest('loaded', function(test) {
|
||||
test.pass();
|
||||
});
|
||||
|
||||
if (typeof window.addTests !== 'undefined') {
|
||||
window.addTests();
|
||||
}
|
||||
|
||||
common.tester.waitFor(moduleEl);
|
||||
common.tester.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Native Client <embed> element as a child of the DOM element
|
||||
* named "listener".
|
||||
*
|
||||
* @param {string} name The name of the example.
|
||||
* @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc.
|
||||
* @param {string} path Directory name where .nmf file can be found.
|
||||
* @param {number} width The width to create the plugin.
|
||||
* @param {number} height The height to create the plugin.
|
||||
* @param {Object} attrs Dictionary of attributes to set on the module.
|
||||
*/
|
||||
function createNaClModule(name, tool, path, width, height, attrs) {
|
||||
var mimetype = mimeTypeForTool(tool);
|
||||
|
||||
var moduleEl = document.createElement('embed');
|
||||
moduleEl.setAttribute('name', 'nacl_module');
|
||||
moduleEl.setAttribute('id', 'nacl_module');
|
||||
moduleEl.setAttribute('width', width);
|
||||
moduleEl.setAttribute('height', height);
|
||||
moduleEl.setAttribute('path', path);
|
||||
moduleEl.setAttribute('src', path + '/' + name + '.nmf');
|
||||
|
||||
|
||||
// Add any optional arguments
|
||||
if (attrs) {
|
||||
for (var key in attrs) {
|
||||
moduleEl.setAttribute(key, attrs[key]);
|
||||
}
|
||||
}
|
||||
|
||||
moduleEl.setAttribute('type', mimetype);
|
||||
|
||||
|
||||
// The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
|
||||
// and a 'message' event listener attached. This wrapping method is used
|
||||
// instead of attaching the event listeners directly to the <EMBED> element
|
||||
// to ensure that the listeners are active before the NaCl module 'load'
|
||||
// event fires.
|
||||
var listenerDiv = document.getElementById('listener');
|
||||
listenerDiv.appendChild(moduleEl);
|
||||
|
||||
// Host plugins don't send a moduleDidLoad message. We'll fake it here.
|
||||
var isHost = isHostToolchain(tool);
|
||||
if (isHost) {
|
||||
window.setTimeout(function() {
|
||||
moduleEl.readyState = 1;
|
||||
moduleEl.dispatchEvent(new CustomEvent('loadstart'));
|
||||
moduleEl.readyState = 4;
|
||||
moduleEl.dispatchEvent(new CustomEvent('load'));
|
||||
moduleEl.dispatchEvent(new CustomEvent('loadend'));
|
||||
}, 100); // 100 ms
|
||||
}
|
||||
|
||||
// This is code that is only used to test the SDK.
|
||||
if (isTest) {
|
||||
var loadNaClTest = function() {
|
||||
injectScript('nacltest.js', function() {
|
||||
runTests(moduleEl);
|
||||
});
|
||||
};
|
||||
|
||||
// Try to load test.js for the example. Whether or not it exists, load
|
||||
// nacltest.js.
|
||||
injectScript('test.js', loadNaClTest, loadNaClTest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the default "load" and "message" event listeners to the element with
|
||||
* id "listener".
|
||||
*
|
||||
* The "load" event is sent when the module is successfully loaded. The
|
||||
* "message" event is sent when the naclModule posts a message using
|
||||
* PPB_Messaging.PostMessage() (in C) or pp::Instance().PostMessage() (in
|
||||
* C++).
|
||||
*/
|
||||
function attachDefaultListeners() {
|
||||
var listenerDiv = document.getElementById('listener');
|
||||
listenerDiv.addEventListener('load', moduleDidLoad, true);
|
||||
listenerDiv.addEventListener('message', handleMessage, true);
|
||||
listenerDiv.addEventListener('error', handleError, true);
|
||||
listenerDiv.addEventListener('crash', handleCrash, true);
|
||||
if (typeof window.attachListeners !== 'undefined') {
|
||||
window.attachListeners();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the NaCl module fails to load.
|
||||
*
|
||||
* This event listener is registered in createNaClModule above.
|
||||
*/
|
||||
function handleError(event) {
|
||||
// We can't use common.naclModule yet because the module has not been
|
||||
// loaded.
|
||||
var moduleEl = document.getElementById('nacl_module');
|
||||
updateStatus('ERROR [' + moduleEl.lastError + ']');
|
||||
|
||||
$.event.trigger({
|
||||
type: "plasio.nacl.error",
|
||||
message: moduleEl.lastError
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the Browser can not communicate with the Module
|
||||
*
|
||||
* This event listener is registered in attachDefaultListeners above.
|
||||
*/
|
||||
function handleCrash(event) {
|
||||
var msg = "Unknown Error";
|
||||
if (common.naclModule.exitStatus == -1) {
|
||||
updateStatus('CRASHED');
|
||||
msg = "The module has crashed";
|
||||
} else {
|
||||
updateStatus('EXITED [' + common.naclModule.exitStatus + ']');
|
||||
msg = "The module has exited";
|
||||
}
|
||||
if (typeof window.handleCrash !== 'undefined') {
|
||||
window.handleCrash(common.naclModule.lastError);
|
||||
msg = common.naclModule.lastError;
|
||||
}
|
||||
|
||||
$.event.trigger({
|
||||
type: "plasio.nacl.error",
|
||||
message: msg
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the NaCl module is loaded.
|
||||
*
|
||||
* This event listener is registered in attachDefaultListeners above.
|
||||
*/
|
||||
function moduleDidLoad() {
|
||||
common.naclModule = document.getElementById('nacl_module');
|
||||
updateStatus('RUNNING');
|
||||
|
||||
hideModule();
|
||||
$.event.trigger({
|
||||
type: "plasio.nacl.available"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the NaCl module's embed element.
|
||||
*
|
||||
* We don't want to hide by default; if we do, it is harder to determine that
|
||||
* a plugin failed to load. Instead, call this function inside the example's
|
||||
* "moduleDidLoad" function.
|
||||
*
|
||||
*/
|
||||
function hideModule() {
|
||||
// Setting common.naclModule.style.display = "None" doesn't work; the
|
||||
// module will no longer be able to receive postMessages.
|
||||
common.naclModule.style.height = '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the NaCl module from the page.
|
||||
*/
|
||||
function removeModule() {
|
||||
common.naclModule.parentNode.removeChild(common.naclModule);
|
||||
common.naclModule = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true when |s| starts with the string |prefix|.
|
||||
*
|
||||
* @param {string} s The string to search.
|
||||
* @param {string} prefix The prefix to search for in |s|.
|
||||
*/
|
||||
function startsWith(s, prefix) {
|
||||
// indexOf would search the entire string, lastIndexOf(p, 0) only checks at
|
||||
// the first index. See: http://stackoverflow.com/a/4579228
|
||||
return s.lastIndexOf(prefix, 0) === 0;
|
||||
}
|
||||
|
||||
/** Maximum length of logMessageArray. */
|
||||
var kMaxLogMessageLength = 20;
|
||||
|
||||
/** An array of messages to display in the element with id "log". */
|
||||
var logMessageArray = [];
|
||||
|
||||
/**
|
||||
* Add a message to an element with id "log".
|
||||
*
|
||||
* This function is used by the default "log:" message handler.
|
||||
*
|
||||
* @param {string} message The message to log.
|
||||
*/
|
||||
function logMessage(message) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
var defaultMessageTypes = {
|
||||
'alert': alert,
|
||||
'log': logMessage
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when the NaCl module sends a message to JavaScript (via
|
||||
* PPB_Messaging.PostMessage())
|
||||
*
|
||||
* This event listener is registered in createNaClModule above.
|
||||
*
|
||||
* @param {Event} message_event A message event. message_event.data contains
|
||||
* the data sent from the NaCl module.
|
||||
*/
|
||||
function handleMessage(message_event) {
|
||||
console.log(JSON.stringify(message_event.data));
|
||||
if (typeof message_event.data === 'string') {
|
||||
for (var type in defaultMessageTypes) {
|
||||
if (defaultMessageTypes.hasOwnProperty(type)) {
|
||||
if (startsWith(message_event.data, type + ':')) {
|
||||
func = defaultMessageTypes[type];
|
||||
func(message_event.data.slice(type.length + 1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window.handleMessage !== 'undefined') {
|
||||
window.handleMessage(message_event);
|
||||
return;
|
||||
}
|
||||
|
||||
logMessage('Unhandled message: ' + message_event.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the DOM content has loaded; i.e. the page's document is fully
|
||||
* parsed. At this point, we can safely query any elements in the document via
|
||||
* document.querySelector, document.getElementById, etc.
|
||||
*
|
||||
* @param {string} name The name of the example.
|
||||
* @param {string} tool The name of the toolchain, e.g. "glibc", "newlib" etc.
|
||||
* @param {string} path Directory name where .nmf file can be found.
|
||||
* @param {number} width The width to create the plugin.
|
||||
* @param {number} height The height to create the plugin.
|
||||
* @param {Object} attrs Optional dictionary of additional attributes.
|
||||
*/
|
||||
function startNaCl(name, tool, path, width, height, attrs) {
|
||||
// If the page loads before the Native Client module loads, then set the
|
||||
// status message indicating that the module is still loading. Otherwise,
|
||||
// do not change the status message.
|
||||
updateStatus('Page loaded.');
|
||||
if (!browserSupportsNaCl(tool)) {
|
||||
updateStatus(
|
||||
'Browser does not support NaCl (' + tool + '), or NaCl is disabled');
|
||||
} else if (common.naclModule === null) {
|
||||
updateStatus('Creating embed: ' + tool);
|
||||
|
||||
// We use a non-zero sized embed to give Chrome space to place the bad
|
||||
// plug-in graphic, if there is a problem.
|
||||
width = typeof width !== 'undefined' ? width : 200;
|
||||
height = typeof height !== 'undefined' ? height : 200;
|
||||
attachDefaultListeners();
|
||||
createNaClModule(name, tool, path, width, height, attrs);
|
||||
} else {
|
||||
// It's possible that the Native Client module onload event fired
|
||||
// before the page's onload event. In this case, the status message
|
||||
// will reflect 'SUCCESS', but won't be displayed. This call will
|
||||
// display the current message.
|
||||
updateStatus('Waiting.');
|
||||
}
|
||||
}
|
||||
|
||||
/** Saved text to display in the element with id 'statusField'. */
|
||||
var statusText = 'NO-STATUSES';
|
||||
|
||||
/**
|
||||
* Set the global status message. If the element with id 'statusField'
|
||||
* exists, then set its HTML to the status message as well.
|
||||
*
|
||||
* @param {string} opt_message The message to set. If null or undefined, then
|
||||
* set element 'statusField' to the message from the last call to
|
||||
* updateStatus.
|
||||
*/
|
||||
function updateStatus(opt_message) {
|
||||
console.log(opt_message);
|
||||
}
|
||||
|
||||
// The symbols to export.
|
||||
return {
|
||||
/** A reference to the NaCl module, once it is loaded. */
|
||||
naclModule: null,
|
||||
|
||||
attachDefaultListeners: attachDefaultListeners,
|
||||
startNaCl: startNaCl,
|
||||
createNaClModule: createNaClModule,
|
||||
hideModule: hideModule,
|
||||
removeModule: removeModule,
|
||||
logMessage: logMessage,
|
||||
updateStatus: updateStatus,
|
||||
browserSupportsNaCl: browserSupportsNaCl
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
module.exports = common;
|
||||
|
||||
// listen to the plasio start notification to trigger NaCl stuff
|
||||
//
|
||||
$(document).on("plasio.start", function() {
|
||||
var body = document.body;
|
||||
|
||||
// The data-* attributes on the body can be referenced via body.dataset.
|
||||
if (body.dataset) {
|
||||
var loadFunction;
|
||||
if (!body.dataset.customLoad) {
|
||||
loadFunction = common.startNaCl;
|
||||
} else if (typeof window.startNaCl !== 'undefined') {
|
||||
loadFunction = window.startNaCl;
|
||||
}
|
||||
|
||||
// From https://developer.mozilla.org/en-US/docs/DOM/window.location
|
||||
var searchVars = {};
|
||||
if (window.location.search.length > 1) {
|
||||
var pairs = window.location.search.substr(1).split('&');
|
||||
for (var key_ix = 0; key_ix < pairs.length; key_ix++) {
|
||||
var keyValue = pairs[key_ix].split('=');
|
||||
searchVars[unescape(keyValue[0])] =
|
||||
keyValue.length > 1 ? unescape(keyValue[1]) : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (loadFunction) {
|
||||
var toolchains = body.dataset.tools.split(' ');
|
||||
var configs = body.dataset.configs.split(' ');
|
||||
|
||||
var attrs = {};
|
||||
if (body.dataset.attrs) {
|
||||
var attr_list = body.dataset.attrs.split(' ');
|
||||
for (var key in attr_list) {
|
||||
var attr = attr_list[key].split('=');
|
||||
var k = attr[0];
|
||||
var value = attr[1];
|
||||
attrs[k] = value;
|
||||
}
|
||||
}
|
||||
|
||||
var tc = toolchains.indexOf(searchVars.tc) !== -1 ?
|
||||
searchVars.tc : toolchains[0];
|
||||
|
||||
// If the config value is included in the search vars, use that.
|
||||
// Otherwise default to Release if it is valid, or the first value if
|
||||
// Release is not valid.
|
||||
var config;
|
||||
if (configs.indexOf(searchVars.config) !== -1)
|
||||
config = searchVars.config;
|
||||
else if (configs.indexOf('Release') !== -1)
|
||||
config = 'Release';
|
||||
else
|
||||
config = configs[0];
|
||||
|
||||
var pathFormat = body.dataset.path;
|
||||
var path = pathFormat.replace('{tc}', tc).replace('{config}', config);
|
||||
|
||||
isTest = searchVars.test === 'true';
|
||||
isRelease = path.toLowerCase().indexOf('release') != -1;
|
||||
|
||||
loadFunction(body.dataset.name, tc, path, body.dataset.width,
|
||||
body.dataset.height, attrs);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
395
libs/plasio/js/laslaz.js
Normal file
395
libs/plasio/js/laslaz.js
Normal file
@ -0,0 +1,395 @@
|
||||
// laslaz.js
|
||||
// LAS/LAZ loading
|
||||
//
|
||||
|
||||
//var common = require("./common"),
|
||||
// Promise = require("bluebird");
|
||||
|
||||
(function(scope) {
|
||||
"use strict";
|
||||
|
||||
var pointFormatReaders = {
|
||||
0: function(dv) {
|
||||
return {
|
||||
"position": [ dv.getInt32(0, true), dv.getInt32(4, true), dv.getInt32(8, true)],
|
||||
"intensity": dv.getUint16(12, true),
|
||||
"classification": dv.getUint8(16, true)
|
||||
};
|
||||
},
|
||||
1: function(dv) {
|
||||
return {
|
||||
"position": [ dv.getInt32(0, true), dv.getInt32(4, true), dv.getInt32(8, true)],
|
||||
"intensity": dv.getUint16(12, true),
|
||||
"classification": dv.getUint8(16, true)
|
||||
};
|
||||
},
|
||||
2: function(dv) {
|
||||
return {
|
||||
"position": [ dv.getInt32(0, true), dv.getInt32(4, true), dv.getInt32(8, true)],
|
||||
"intensity": dv.getUint16(12, true),
|
||||
"classification": dv.getUint8(16, true),
|
||||
"color": [dv.getUint16(20, true), dv.getUint16(22, true), dv.getUint16(24, true)]
|
||||
};
|
||||
},
|
||||
3: function(dv) {
|
||||
return {
|
||||
"position": [ dv.getInt32(0, true), dv.getInt32(4, true), dv.getInt32(8, true)],
|
||||
"intensity": dv.getUint16(12, true),
|
||||
"classification": dv.getUint8(16, true),
|
||||
"color": [dv.getUint16(28, true), dv.getUint16(30, true), dv.getUint16(32, true)]
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
function readAs(buf, Type, offset, count) {
|
||||
count = (count === undefined || count === 0 ? 1 : count);
|
||||
var sub = buf.slice(offset, offset + Type.BYTES_PER_ELEMENT * count);
|
||||
|
||||
var r = new Type(sub);
|
||||
if (count === undefined || count === 1)
|
||||
return r[0];
|
||||
|
||||
var ret = [];
|
||||
for (var i = 0 ; i < count ; i ++) {
|
||||
ret.push(r[i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function parseLASHeader(arraybuffer) {
|
||||
var o = {};
|
||||
|
||||
o.pointsOffset = readAs(arraybuffer, Uint32Array, 32*3);
|
||||
o.pointsFormatId = readAs(arraybuffer, Uint8Array, 32*3+8);
|
||||
o.pointsStructSize = readAs(arraybuffer, Uint16Array, 32*3+8+1);
|
||||
o.pointsCount = readAs(arraybuffer, Uint32Array, 32*3 + 11);
|
||||
|
||||
|
||||
var start = 32*3 + 35;
|
||||
o.scale = readAs(arraybuffer, Float64Array, start, 3); start += 24; // 8*3
|
||||
o.offset = readAs(arraybuffer, Float64Array, start, 3); start += 24;
|
||||
|
||||
|
||||
|
||||
var bounds = readAs(arraybuffer, Float64Array, start, 6); start += 48; // 8*6;
|
||||
o.maxs = [bounds[0], bounds[2], bounds[4]];
|
||||
o.mins = [bounds[1], bounds[3], bounds[5]];
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
var msgIndex = 0;
|
||||
var waitHandlers = {};
|
||||
|
||||
// This method is scope-wide since the nacl module uses this fuction to notify
|
||||
// us of events
|
||||
scope.handleMessage = function(message_event) {
|
||||
var msg = message_event.data;
|
||||
var resolver = waitHandlers[msg.id];
|
||||
delete waitHandlers[msg.id];
|
||||
|
||||
// call the callback in a separate context, make sure we've cleaned our
|
||||
// state out before the callback is invoked since it may queue more doExchanges
|
||||
setTimeout(function() {
|
||||
if (msg.error)
|
||||
return resolver.reject(new Error(msg.message || "Unknown Error"));
|
||||
|
||||
if (msg.hasOwnProperty('count') && msg.hasOwnProperty('hasMoreData')) {
|
||||
return resolver.resolve({
|
||||
buffer: msg.result,
|
||||
count: msg.count,
|
||||
hasMoreData: msg.hasMoreData});
|
||||
}
|
||||
|
||||
resolver.resolve(msg.result);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var doDataExchange = function(cmd, callback) {
|
||||
cmd.id = msgIndex.toString();
|
||||
msgIndex ++;
|
||||
|
||||
var resolver = Promise.defer();
|
||||
waitHandlers[cmd.id] = resolver;
|
||||
|
||||
nacl_module.postMessage(cmd);
|
||||
|
||||
return resolver.promise.cancellable();
|
||||
};
|
||||
|
||||
// LAS Loader
|
||||
// Loads uncompressed files
|
||||
//
|
||||
var LASLoader = function(arraybuffer) {
|
||||
this.arraybuffer = arraybuffer;
|
||||
};
|
||||
|
||||
LASLoader.prototype.open = function() {
|
||||
// nothing needs to be done to open this file
|
||||
//
|
||||
this.readOffset = 0;
|
||||
return new Promise(function(res, rej) {
|
||||
setTimeout(res, 0);
|
||||
});
|
||||
};
|
||||
|
||||
LASLoader.prototype.getHeader = function() {
|
||||
var o = this;
|
||||
|
||||
return new Promise(function(res, rej) {
|
||||
setTimeout(function() {
|
||||
o.header = parseLASHeader(o.arraybuffer);
|
||||
res(o.header);
|
||||
}, 0);
|
||||
});
|
||||
};
|
||||
|
||||
LASLoader.prototype.readData = function(count, offset, skip) {
|
||||
var o = this;
|
||||
|
||||
return new Promise(function(res, rej) {
|
||||
setTimeout(function() {
|
||||
if (!o.header)
|
||||
return rej(new Error("Cannot start reading data till a header request is issued"));
|
||||
|
||||
var start;
|
||||
if (skip <= 1) {
|
||||
count = Math.min(count, o.header.pointsCount - o.readOffset);
|
||||
start = o.header.pointsOffset + o.readOffset * o.header.pointsStructSize;
|
||||
var end = start + count * o.header.pointsStructSize;
|
||||
res({
|
||||
buffer: o.arraybuffer.slice(start, end),
|
||||
count: count,
|
||||
hasMoreData: o.readOffset + count < o.header.pointsCount});
|
||||
o.readOffset += count;
|
||||
}
|
||||
else {
|
||||
var pointsToRead = Math.min(count * skip, o.header.pointsCount - o.readOffset);
|
||||
var bufferSize = Math.ceil(pointsToRead / skip);
|
||||
var pointsRead = 0;
|
||||
|
||||
var buf = new Uint8Array(bufferSize * o.header.pointsStructSize);
|
||||
for (var i = 0 ; i < pointsToRead ; i ++) {
|
||||
if (i % skip === 0) {
|
||||
start = o.header.pointsOffset + o.readOffset * o.header.pointsStructSize;
|
||||
var src = new Uint8Array(o.arraybuffer, start, o.header.pointsStructSize);
|
||||
|
||||
buf.set(src, pointsRead * o.header.pointsStructSize);
|
||||
pointsRead ++;
|
||||
}
|
||||
|
||||
o.readOffset ++;
|
||||
}
|
||||
|
||||
res({
|
||||
buffer: buf.buffer,
|
||||
count: pointsRead,
|
||||
hasMoreData: o.readOffset < o.header.pointsCount
|
||||
});
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
};
|
||||
|
||||
LASLoader.prototype.close = function() {
|
||||
var o = this;
|
||||
return new Promise(function(res, rej) {
|
||||
o.arraybuffer = null;
|
||||
setTimeout(res, 0);
|
||||
});
|
||||
};
|
||||
|
||||
// LAZ Loader
|
||||
// Uses NaCL module to load LAZ files
|
||||
//
|
||||
var LAZLoader = function(arraybuffer) {
|
||||
this.arraybuffer = arraybuffer;
|
||||
this.ww = Potree.workers.laslaz.getWorker();
|
||||
|
||||
this.nextCB = null;
|
||||
var o = this;
|
||||
|
||||
this.ww.onmessage = function(e) {
|
||||
if (o.nextCB !== null) {
|
||||
o.nextCB(e.data);
|
||||
o.nextCB = null;
|
||||
}
|
||||
};
|
||||
|
||||
this.dorr = function(req, cb) {
|
||||
o.nextCB = cb;
|
||||
o.ww.postMessage(req);
|
||||
};
|
||||
};
|
||||
|
||||
LAZLoader.prototype.open = function() {
|
||||
|
||||
// nothing needs to be done to open this file
|
||||
//
|
||||
var o = this;
|
||||
return new Promise(function(res, rej) {
|
||||
o.dorr({type:"open", arraybuffer: o.arraybuffer}, function(r) {
|
||||
if (r.status !== 1)
|
||||
return rej(new Error("Failed to open file"));
|
||||
|
||||
res(true);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
LAZLoader.prototype.getHeader = function() {
|
||||
var o = this;
|
||||
|
||||
return new Promise(function(res, rej) {
|
||||
o.dorr({type:'header'}, function(r) {
|
||||
if (r.status !== 1)
|
||||
return rej(new Error("Failed to get header"));
|
||||
|
||||
res(r.header);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
LAZLoader.prototype.readData = function(count, offset, skip) {
|
||||
var o = this;
|
||||
|
||||
return new Promise(function(res, rej) {
|
||||
o.dorr({type:'read', count: count, offset: offset, skip: skip}, function(r) {
|
||||
if (r.status !== 1)
|
||||
return rej(new Error("Failed to read data"));
|
||||
res({
|
||||
buffer: r.buffer,
|
||||
count: r.count,
|
||||
hasMoreData: r.hasMoreData
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
LAZLoader.prototype.close = function() {
|
||||
var o = this;
|
||||
|
||||
return new Promise(function(res, rej) {
|
||||
o.dorr({type:'close'}, function(r) {
|
||||
Potree.workers.laslaz.returnWorker(o.ww);
|
||||
|
||||
if (r.status !== 1)
|
||||
return rej(new Error("Failed to close file"));
|
||||
|
||||
res(true);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// A single consistent interface for loading LAS/LAZ files
|
||||
var LASFile = function(arraybuffer) {
|
||||
this.arraybuffer = arraybuffer;
|
||||
|
||||
this.determineVersion();
|
||||
if (this.version > 12)
|
||||
throw new Error("Only file versions <= 1.2 are supported at this time");
|
||||
|
||||
this.determineFormat();
|
||||
if (pointFormatReaders[this.formatId] === undefined)
|
||||
throw new Error("The point format ID is not supported");
|
||||
|
||||
this.loader = this.isCompressed ?
|
||||
new LAZLoader(this.arraybuffer) :
|
||||
new LASLoader(this.arraybuffer);
|
||||
};
|
||||
|
||||
LASFile.prototype.determineFormat = function() {
|
||||
var formatId = readAs(this.arraybuffer, Uint8Array, 32*3+8);
|
||||
var bit_7 = (formatId & 0x80) >> 7;
|
||||
var bit_6 = (formatId & 0x40) >> 6;
|
||||
|
||||
if (bit_7 === 1 && bit_6 === 1)
|
||||
throw new Error("Old style compression not supported");
|
||||
|
||||
this.formatId = formatId & 0x3f;
|
||||
this.isCompressed = (bit_7 === 1 || bit_6 === 1);
|
||||
};
|
||||
|
||||
LASFile.prototype.determineVersion = function() {
|
||||
var ver = new Int8Array(this.arraybuffer, 24, 2);
|
||||
this.version = ver[0] * 10 + ver[1];
|
||||
this.versionAsString = ver[0] + "." + ver[1];
|
||||
};
|
||||
|
||||
LASFile.prototype.open = function() {
|
||||
return this.loader.open();
|
||||
};
|
||||
|
||||
LASFile.prototype.getHeader = function() {
|
||||
return this.loader.getHeader();
|
||||
};
|
||||
|
||||
LASFile.prototype.readData = function(count, start, skip) {
|
||||
return this.loader.readData(count, start, skip);
|
||||
};
|
||||
|
||||
LASFile.prototype.close = function() {
|
||||
return this.loader.close();
|
||||
};
|
||||
|
||||
// Decodes LAS records into points
|
||||
//
|
||||
var LASDecoder = function(buffer, pointFormatID, pointSize, pointsCount, scale, offset, mins, maxs) {
|
||||
this.arrayb = buffer;
|
||||
this.decoder = pointFormatReaders[pointFormatID];
|
||||
this.pointsCount = pointsCount;
|
||||
this.pointSize = pointSize;
|
||||
this.scale = scale;
|
||||
this.offset = offset;
|
||||
this.mins = mins;
|
||||
this.maxs = maxs;
|
||||
};
|
||||
|
||||
LASDecoder.prototype.getPoint = function(index) {
|
||||
if (index < 0 || index >= this.pointsCount)
|
||||
throw new Error("Point index out of range");
|
||||
|
||||
var dv = new DataView(this.arrayb, index * this.pointSize, this.pointSize);
|
||||
return this.decoder(dv);
|
||||
};
|
||||
|
||||
// NACL Module support
|
||||
// Called by the common.js module.
|
||||
//
|
||||
window.startNaCl = function(name, tc, config, width, height) {
|
||||
// check browser support for nacl
|
||||
//
|
||||
if(!common.browserSupportsNaCl()) {
|
||||
return $.event.trigger({
|
||||
type: "plasio.nacl.error",
|
||||
message: "NaCl support is not available"
|
||||
});
|
||||
}
|
||||
|
||||
navigator.webkitPersistentStorage.requestQuota(2048 * 2048, function(bytes) {
|
||||
common.updateStatus(
|
||||
'Allocated ' + bytes + ' bytes of persistant storage.');
|
||||
common.attachDefaultListeners();
|
||||
common.createNaClModule(name, tc, config, width, height);
|
||||
},
|
||||
function(e) {
|
||||
$.event.trigger({
|
||||
type: "plasio.nacl.error",
|
||||
message: "Could not allocate persistant storage"
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("plasio.nacl.available", function() {
|
||||
scope.LASModuleWasLoaded = true;
|
||||
});
|
||||
};
|
||||
|
||||
scope.LAZLoader = LAZLoader;
|
||||
scope.LASLoader = LASLoader;
|
||||
scope.LASFile = LASFile;
|
||||
scope.LASDecoder = LASDecoder;
|
||||
scope.LASModuleWasLoaded = false;
|
||||
//})(module.exports);
|
||||
})(this);
|
||||
|
||||
1842
libs/plasio/js/render.js
Normal file
1842
libs/plasio/js/render.js
Normal file
File diff suppressed because it is too large
Load Diff
1675
libs/plasio/js/ui.js
Normal file
1675
libs/plasio/js/ui.js
Normal file
File diff suppressed because it is too large
Load Diff
5140
libs/plasio/vendor/bluebird.js
vendored
Normal file
5140
libs/plasio/vendor/bluebird.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
libs/plasio/vendor/bootstrap.min.js
vendored
Normal file
6
libs/plasio/vendor/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
591
libs/plasio/vendor/controls/TrackballControls.js
vendored
Normal file
591
libs/plasio/vendor/controls/TrackballControls.js
vendored
Normal file
@ -0,0 +1,591 @@
|
||||
/**
|
||||
* @author Eberhard Graether / http://egraether.com/
|
||||
* @author Mark Lundin / http://mark-lundin.com
|
||||
*/
|
||||
|
||||
THREE.TrackballControls = function ( object, domElement ) {
|
||||
|
||||
var _this = this;
|
||||
var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5 };
|
||||
|
||||
this.object = object;
|
||||
this.domElement = ( domElement !== undefined ) ? domElement : document;
|
||||
|
||||
// API
|
||||
|
||||
this.enabled = true;
|
||||
|
||||
this.screen = { left: 0, top: 0, width: 0, height: 0 };
|
||||
|
||||
this.rotateSpeed = 1.0;
|
||||
this.zoomSpeed = 1.2;
|
||||
this.panSpeed = 0.3;
|
||||
|
||||
this.noRotate = false;
|
||||
this.noZoom = false;
|
||||
this.noPan = false;
|
||||
this.noRoll = false;
|
||||
|
||||
this.staticMoving = true;
|
||||
this.dynamicDampingFactor = 0.2;
|
||||
|
||||
this.minDistance = 0;
|
||||
this.maxDistance = Infinity;
|
||||
|
||||
this.keys = [ 65 /*A*/, 83 /*S*/, 68 /*D*/ ];
|
||||
|
||||
// internals
|
||||
|
||||
this.target = new THREE.Vector3();
|
||||
|
||||
var lastPosition = new THREE.Vector3();
|
||||
|
||||
var _state = STATE.NONE,
|
||||
_prevState = STATE.NONE,
|
||||
|
||||
_eye = new THREE.Vector3(),
|
||||
|
||||
_rotateStart = new THREE.Vector3(),
|
||||
_rotateEnd = new THREE.Vector3(),
|
||||
|
||||
_zoomStart = new THREE.Vector2(),
|
||||
_zoomEnd = new THREE.Vector2(),
|
||||
|
||||
_touchZoomDistanceStart = 0,
|
||||
_touchZoomDistanceEnd = 0,
|
||||
|
||||
_panStart = new THREE.Vector2(),
|
||||
_panEnd = new THREE.Vector2();
|
||||
|
||||
// for reset
|
||||
|
||||
this.target0 = this.target.clone();
|
||||
this.position0 = this.object.position.clone();
|
||||
this.up0 = this.object.up.clone();
|
||||
|
||||
// events
|
||||
|
||||
var changeEvent = { type: 'change' };
|
||||
var startEvent = { type: 'start'};
|
||||
var endEvent = { type: 'end'};
|
||||
|
||||
|
||||
// methods
|
||||
|
||||
this.handleResize = function () {
|
||||
|
||||
if ( this.domElement === document ) {
|
||||
|
||||
this.screen.left = 0;
|
||||
this.screen.top = 0;
|
||||
this.screen.width = window.innerWidth;
|
||||
this.screen.height = window.innerHeight;
|
||||
|
||||
} else {
|
||||
|
||||
this.screen = this.domElement.getBoundingClientRect();
|
||||
// adjustments come from similar code in the jquery offset() function
|
||||
var d = this.domElement.ownerDocument.documentElement
|
||||
this.screen.left += window.pageXOffset - d.clientLeft
|
||||
this.screen.top += window.pageYOffset - d.clientTop
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.handleEvent = function ( event ) {
|
||||
|
||||
if ( typeof this[ event.type ] == 'function' ) {
|
||||
|
||||
this[ event.type ]( event );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.getMouseOnScreen = function ( pageX, pageY, optionalTarget ) {
|
||||
|
||||
return ( optionalTarget || new THREE.Vector2() ).set(
|
||||
( pageX - _this.screen.left ) / _this.screen.width,
|
||||
( pageY - _this.screen.top ) / _this.screen.height
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
this.getMouseProjectionOnBall = (function(){
|
||||
|
||||
var objectUp = new THREE.Vector3();
|
||||
|
||||
|
||||
return function ( pageX, pageY, projection ) {
|
||||
|
||||
var mouseOnBall = new THREE.Vector3(
|
||||
( pageX - _this.screen.width * 0.5 - _this.screen.left ) / (_this.screen.width*.5),
|
||||
( _this.screen.height * 0.5 + _this.screen.top - pageY ) / (_this.screen.height*.5),
|
||||
0.0
|
||||
);
|
||||
|
||||
var length = mouseOnBall.length();
|
||||
|
||||
if ( _this.noRoll ) {
|
||||
|
||||
if ( length < Math.SQRT1_2 ) {
|
||||
|
||||
mouseOnBall.z = Math.sqrt( 1.0 - length*length );
|
||||
|
||||
} else {
|
||||
|
||||
mouseOnBall.z = .5 / length;
|
||||
|
||||
}
|
||||
|
||||
} else if ( length > 1.0 ) {
|
||||
|
||||
mouseOnBall.normalize();
|
||||
|
||||
} else {
|
||||
|
||||
mouseOnBall.z = Math.sqrt( 1.0 - length * length );
|
||||
|
||||
}
|
||||
|
||||
_eye.copy( _this.object.position ).sub( _this.target );
|
||||
|
||||
projection.copy( _this.object.up ).setLength( mouseOnBall.y )
|
||||
projection.add( objectUp.copy( _this.object.up ).cross( _eye ).setLength( mouseOnBall.x ) );
|
||||
projection.add( _eye.setLength( mouseOnBall.z ) );
|
||||
|
||||
return projection;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
this.rotateCamera = (function(){
|
||||
|
||||
var axis = new THREE.Vector3(),
|
||||
quaternion = new THREE.Quaternion();
|
||||
|
||||
|
||||
return function () {
|
||||
|
||||
var angle = Math.acos( _rotateStart.dot( _rotateEnd ) / _rotateStart.length() / _rotateEnd.length() );
|
||||
|
||||
if ( angle ) {
|
||||
|
||||
axis.crossVectors( _rotateStart, _rotateEnd ).normalize();
|
||||
|
||||
angle *= _this.rotateSpeed;
|
||||
|
||||
quaternion.setFromAxisAngle( axis, -angle );
|
||||
|
||||
_eye.applyQuaternion( quaternion );
|
||||
_this.object.up.applyQuaternion( quaternion );
|
||||
|
||||
_rotateEnd.applyQuaternion( quaternion );
|
||||
|
||||
if ( _this.staticMoving ) {
|
||||
|
||||
_rotateStart.copy( _rotateEnd );
|
||||
|
||||
} else {
|
||||
|
||||
quaternion.setFromAxisAngle( axis, angle * ( _this.dynamicDampingFactor - 1.0 ) );
|
||||
_rotateStart.applyQuaternion( quaternion );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
this.zoomCamera = function () {
|
||||
|
||||
if ( _state === STATE.TOUCH_ZOOM ) {
|
||||
|
||||
var factor = _touchZoomDistanceStart / _touchZoomDistanceEnd;
|
||||
_touchZoomDistanceStart = _touchZoomDistanceEnd;
|
||||
_eye.multiplyScalar( factor );
|
||||
|
||||
} else {
|
||||
|
||||
var factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * _this.zoomSpeed;
|
||||
|
||||
if ( factor !== 1.0 && factor > 0.0 ) {
|
||||
|
||||
_eye.multiplyScalar( factor );
|
||||
|
||||
if ( _this.staticMoving ) {
|
||||
|
||||
_zoomStart.copy( _zoomEnd );
|
||||
|
||||
} else {
|
||||
|
||||
_zoomStart.y += ( _zoomEnd.y - _zoomStart.y ) * this.dynamicDampingFactor;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.panCamera = (function(){
|
||||
|
||||
var mouseChange = new THREE.Vector2(),
|
||||
objectUp = new THREE.Vector3(),
|
||||
pan = new THREE.Vector3();
|
||||
|
||||
return function () {
|
||||
|
||||
mouseChange.copy( _panEnd ).sub( _panStart );
|
||||
|
||||
if ( mouseChange.lengthSq() ) {
|
||||
|
||||
mouseChange.multiplyScalar( _eye.length() * _this.panSpeed );
|
||||
|
||||
pan.copy( _eye ).cross( _this.object.up ).setLength( mouseChange.x );
|
||||
pan.add( objectUp.copy( _this.object.up ).setLength( mouseChange.y ) );
|
||||
|
||||
_this.object.position.add( pan );
|
||||
_this.target.add( pan );
|
||||
|
||||
if ( _this.staticMoving ) {
|
||||
|
||||
_panStart.copy( _panEnd );
|
||||
|
||||
} else {
|
||||
|
||||
_panStart.add( mouseChange.subVectors( _panEnd, _panStart ).multiplyScalar( _this.dynamicDampingFactor ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
this.checkDistances = function () {
|
||||
|
||||
if ( !_this.noZoom || !_this.noPan ) {
|
||||
|
||||
if ( _eye.lengthSq() > _this.maxDistance * _this.maxDistance ) {
|
||||
|
||||
_this.object.position.addVectors( _this.target, _eye.setLength( _this.maxDistance ) );
|
||||
|
||||
}
|
||||
|
||||
if ( _eye.lengthSq() < _this.minDistance * _this.minDistance ) {
|
||||
|
||||
_this.object.position.addVectors( _this.target, _eye.setLength( _this.minDistance ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.update = function () {
|
||||
|
||||
_eye.subVectors( _this.object.position, _this.target );
|
||||
|
||||
if ( !_this.noRotate ) {
|
||||
|
||||
_this.rotateCamera();
|
||||
|
||||
}
|
||||
|
||||
if ( !_this.noZoom ) {
|
||||
|
||||
_this.zoomCamera();
|
||||
|
||||
}
|
||||
|
||||
if ( !_this.noPan ) {
|
||||
|
||||
_this.panCamera();
|
||||
|
||||
}
|
||||
|
||||
_this.object.position.addVectors( _this.target, _eye );
|
||||
|
||||
_this.checkDistances();
|
||||
|
||||
_this.object.lookAt( _this.target );
|
||||
|
||||
if ( lastPosition.distanceToSquared( _this.object.position ) > 0 ) {
|
||||
|
||||
_this.dispatchEvent( changeEvent );
|
||||
|
||||
lastPosition.copy( _this.object.position );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.reset = function () {
|
||||
|
||||
_state = STATE.NONE;
|
||||
_prevState = STATE.NONE;
|
||||
|
||||
_this.target.copy( _this.target0 );
|
||||
_this.object.position.copy( _this.position0 );
|
||||
_this.object.up.copy( _this.up0 );
|
||||
|
||||
_eye.subVectors( _this.object.position, _this.target );
|
||||
|
||||
_this.object.lookAt( _this.target );
|
||||
|
||||
_this.dispatchEvent( changeEvent );
|
||||
|
||||
lastPosition.copy( _this.object.position );
|
||||
|
||||
};
|
||||
|
||||
// listeners
|
||||
|
||||
function keydown( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
window.removeEventListener( 'keydown', keydown );
|
||||
|
||||
_prevState = _state;
|
||||
|
||||
if ( _state !== STATE.NONE ) {
|
||||
|
||||
return;
|
||||
|
||||
} else if ( event.keyCode === _this.keys[ STATE.ROTATE ] && !_this.noRotate ) {
|
||||
|
||||
_state = STATE.ROTATE;
|
||||
|
||||
} else if ( event.keyCode === _this.keys[ STATE.ZOOM ] && !_this.noZoom ) {
|
||||
|
||||
_state = STATE.ZOOM;
|
||||
|
||||
} else if ( event.keyCode === _this.keys[ STATE.PAN ] && !_this.noPan ) {
|
||||
|
||||
_state = STATE.PAN;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function keyup( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
_state = _prevState;
|
||||
|
||||
window.addEventListener( 'keydown', keydown, false );
|
||||
|
||||
}
|
||||
|
||||
function mousedown( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if ( _state === STATE.NONE ) {
|
||||
|
||||
_state = event.button;
|
||||
|
||||
}
|
||||
|
||||
if ( _state === STATE.ROTATE && !_this.noRotate ) {
|
||||
|
||||
_rotateStart = _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateStart );
|
||||
_rotateEnd.copy(_rotateStart)
|
||||
|
||||
} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
|
||||
|
||||
_zoomStart = _this.getMouseOnScreen( event.pageX, event.pageY, _zoomStart );
|
||||
_zoomEnd.copy(_zoomStart);
|
||||
|
||||
} else if ( _state === STATE.PAN && !_this.noPan ) {
|
||||
|
||||
_panStart = _this.getMouseOnScreen( event.pageX, event.pageY, _panStart);
|
||||
_panEnd.copy(_panStart)
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener( 'mousemove', mousemove, false );
|
||||
document.addEventListener( 'mouseup', mouseup, false );
|
||||
_this.dispatchEvent( startEvent );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function mousemove( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if ( _state === STATE.ROTATE && !_this.noRotate ) {
|
||||
|
||||
_rotateEnd = _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateEnd );
|
||||
|
||||
} else if ( _state === STATE.ZOOM && !_this.noZoom ) {
|
||||
|
||||
_zoomEnd = _this.getMouseOnScreen( event.pageX, event.pageY, _zoomEnd );
|
||||
|
||||
} else if ( _state === STATE.PAN && !_this.noPan ) {
|
||||
|
||||
_panEnd = _this.getMouseOnScreen( event.pageX, event.pageY, _panEnd );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function mouseup( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
_state = STATE.NONE;
|
||||
|
||||
document.removeEventListener( 'mousemove', mousemove );
|
||||
document.removeEventListener( 'mouseup', mouseup );
|
||||
_this.dispatchEvent( endEvent );
|
||||
|
||||
}
|
||||
|
||||
function mousewheel( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
var delta = 0;
|
||||
|
||||
if ( event.wheelDelta ) { // WebKit / Opera / Explorer 9
|
||||
|
||||
delta = event.wheelDelta / 40;
|
||||
|
||||
} else if ( event.detail ) { // Firefox
|
||||
|
||||
delta = - event.detail / 3;
|
||||
|
||||
}
|
||||
|
||||
_zoomStart.y += delta * 0.01;
|
||||
_this.dispatchEvent( startEvent );
|
||||
_this.dispatchEvent( endEvent );
|
||||
|
||||
}
|
||||
|
||||
function touchstart( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
switch ( event.touches.length ) {
|
||||
|
||||
case 1:
|
||||
_state = STATE.TOUCH_ROTATE;
|
||||
_rotateEnd.copy( _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateStart ));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_state = STATE.TOUCH_ZOOM;
|
||||
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
|
||||
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
|
||||
_touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt( dx * dx + dy * dy );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_state = STATE.TOUCH_PAN;
|
||||
_panEnd.copy( _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panStart ));
|
||||
break;
|
||||
|
||||
default:
|
||||
_state = STATE.NONE;
|
||||
|
||||
}
|
||||
_this.dispatchEvent( startEvent );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function touchmove( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
switch ( event.touches.length ) {
|
||||
|
||||
case 1:
|
||||
_rotateEnd = _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateEnd );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
|
||||
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
|
||||
_touchZoomDistanceEnd = Math.sqrt( dx * dx + dy * dy )
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_panEnd = _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panEnd );
|
||||
break;
|
||||
|
||||
default:
|
||||
_state = STATE.NONE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function touchend( event ) {
|
||||
|
||||
if ( _this.enabled === false ) return;
|
||||
|
||||
switch ( event.touches.length ) {
|
||||
|
||||
case 1:
|
||||
_rotateStart.copy( _this.getMouseProjectionOnBall( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _rotateEnd ));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_touchZoomDistanceStart = _touchZoomDistanceEnd = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_panStart.copy( _this.getMouseOnScreen( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, _panEnd ));
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
_state = STATE.NONE;
|
||||
_this.dispatchEvent( endEvent );
|
||||
|
||||
}
|
||||
|
||||
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
|
||||
|
||||
this.domElement.addEventListener( 'mousedown', mousedown, false );
|
||||
|
||||
this.domElement.addEventListener( 'mousewheel', mousewheel, false );
|
||||
this.domElement.addEventListener( 'DOMMouseScroll', mousewheel, false ); // firefox
|
||||
|
||||
this.domElement.addEventListener( 'touchstart', touchstart, false );
|
||||
this.domElement.addEventListener( 'touchend', touchend, false );
|
||||
this.domElement.addEventListener( 'touchmove', touchmove, false );
|
||||
|
||||
window.addEventListener( 'keydown', keydown, false );
|
||||
window.addEventListener( 'keyup', keyup, false );
|
||||
|
||||
this.handleResize();
|
||||
|
||||
};
|
||||
|
||||
THREE.TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype );
|
||||
9789
libs/plasio/vendor/jquery.js
vendored
Normal file
9789
libs/plasio/vendor/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
142
libs/plasio/vendor/jquery.layout.js
vendored
Normal file
142
libs/plasio/vendor/jquery.layout.js
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
jquery.layout 1.3.0 - Release Candidate 30.79
|
||||
$Date: 2013-01-01 08:00:00 (Tue, 1 Jan 2013) $
|
||||
$Rev: 303007 $
|
||||
|
||||
Copyright (c) 2013 Kevin Dalman (http://allpro.net)
|
||||
Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net)
|
||||
|
||||
Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
|
||||
and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
|
||||
|
||||
SEE: http://layout.jquery-dev.net/LICENSE.txt
|
||||
|
||||
Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc30.79
|
||||
|
||||
Docs: http://layout.jquery-dev.net/documentation.html
|
||||
Tips: http://layout.jquery-dev.net/tips.html
|
||||
Help: http://groups.google.com/group/jquery-ui-layout
|
||||
*/
|
||||
(function(b){var a=Math.min,d=Math.max,c=Math.floor,f=function(a){return"string"===b.type(a)},j=function(a,d){if(b.isArray(d))for(var c=0,j=d.length;c<j;c++){var h=d[c];try{f(h)&&(h=eval(h)),b.isFunction(h)&&h(a)}catch(k){}}};b.layout={version:"1.3.rc30.79",revision:0.033007,browser:{},effects:{slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},
|
||||
west:{direction:"left"}},scale:{all:{duration:"fast"}},blind:{},clip:{},explode:{},fade:{},fold:{},puff:{},size:{all:{easing:"swing"}}},config:{optionRootKeys:"effects panes north south west east center".split(" "),allPanes:["north","south","west","east","center"],borderPanes:["north","south","west","east"],oppositeEdge:{north:"south",south:"north",east:"west",west:"east"},offscreenCSS:{left:"-99999px",right:"auto"},offscreenReset:"offscreenReset",hidden:{visibility:"hidden"},visible:{visibility:"visible"},
|
||||
resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden"},cssDemo:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDemo:{background:"#AAA"}},content:{cssReq:{position:"relative"},cssDemo:{overflow:"auto",padding:"10px"},cssDemoPane:{overflow:"hidden",padding:0}},panes:{cssReq:{position:"absolute",margin:0},cssDemo:{padding:"10px",
|
||||
background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{side:"top",sizeType:"Height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{side:"bottom",sizeType:"Height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{side:"right",sizeType:"Width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{side:"left",sizeType:"Width",dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}},
|
||||
center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}},callbacks:{},getParentPaneElem:function(a){a=b(a);if(a=a.data("layout")||a.data("parentLayout")){a=a.container;if(a.data("layoutPane"))return a;a=a.closest("."+b.layout.defaults.panes.paneClass);if(a.data("layoutPane"))return a}return null},getParentPaneInstance:function(a){return(a=b.layout.getParentPaneElem(a))?a.data("layoutPane"):null},getParentLayoutInstance:function(a){return(a=b.layout.getParentPaneElem(a))?
|
||||
a.data("parentLayout"):null},getEventObject:function(b){return"object"===typeof b&&b.stopPropagation?b:null},parsePaneName:function(a){var d=b.layout.getEventObject(a);d&&(d.stopPropagation(),a=b(this).data("layoutEdge"));a&&!/^(west|east|north|south|center)$/.test(a)&&(b.layout.msg('LAYOUT ERROR - Invalid pane-name: "'+a+'"'),a="error");return a},plugins:{draggable:!!b.fn.draggable,effects:{core:!!b.effects,slide:b.effects&&(b.effects.slide||b.effects.effect&&b.effects.effect.slide)}},onCreate:[],
|
||||
onLoad:[],onReady:[],onDestroy:[],onUnload:[],afterOpen:[],afterClose:[],scrollbarWidth:function(){return window.scrollbarWidth||b.layout.getScrollbarSize("width")},scrollbarHeight:function(){return window.scrollbarHeight||b.layout.getScrollbarSize("height")},getScrollbarSize:function(a){var d=b('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body"),c={width:d.css("width")-d[0].clientWidth,height:d.height()-d[0].clientHeight};
|
||||
d.remove();window.scrollbarWidth=c.width;window.scrollbarHeight=c.height;return a.match(/^(width|height)$/)?c[a]:c},showInvisibly:function(b,a){if(b&&b.length&&(a||"none"===b.css("display"))){var d=b[0].style,d={display:d.display||"",visibility:d.visibility||""};b.css({display:"block",visibility:"hidden"});return d}return{}},getElementDimensions:function(a,c){var f={css:{},inset:{}},j=f.css,h={bottom:0},k=b.layout.cssNum,p=a.offset(),O,R,D;f.offsetLeft=p.left;f.offsetTop=p.top;c||(c={});b.each(["Left",
|
||||
"Right","Top","Bottom"],function(d,k){O=j["border"+k]=b.layout.borderWidth(a,k);R=j["padding"+k]=b.layout.cssNum(a,"padding"+k);D=k.toLowerCase();f.inset[D]=0<=c[D]?c[D]:R;h[D]=f.inset[D]+O});j.width=a.width();j.height=a.height();j.top=k(a,"top",!0);j.bottom=k(a,"bottom",!0);j.left=k(a,"left",!0);j.right=k(a,"right",!0);f.outerWidth=a.outerWidth();f.outerHeight=a.outerHeight();f.innerWidth=d(0,f.outerWidth-h.left-h.right);f.innerHeight=d(0,f.outerHeight-h.top-h.bottom);f.layoutWidth=a.innerWidth();
|
||||
f.layoutHeight=a.innerHeight();return f},getElementStyles:function(b,a){var d={},c=b[0].style,f=a.split(","),k=["Top","Bottom","Left","Right"],j=["Color","Style","Width"],h,p,D,x,A,r;for(x=0;x<f.length;x++)if(h=f[x],h.match(/(border|padding|margin)$/))for(A=0;4>A;A++)if(p=k[A],"border"===h)for(r=0;3>r;r++)D=j[r],d[h+p+D]=c[h+p+D];else d[h+p]=c[h+p];else d[h]=c[h];return d},cssWidth:function(a,c){if(0>=c)return 0;var f=!b.layout.browser.boxModel?"border-box":b.support.boxSizing?a.css("boxSizing"):
|
||||
"content-box",j=b.layout.borderWidth,h=b.layout.cssNum,k=c;"border-box"!==f&&(k-=j(a,"Left")+j(a,"Right"));"content-box"===f&&(k-=h(a,"paddingLeft")+h(a,"paddingRight"));return d(0,k)},cssHeight:function(a,c){if(0>=c)return 0;var f=!b.layout.browser.boxModel?"border-box":b.support.boxSizing?a.css("boxSizing"):"content-box",j=b.layout.borderWidth,h=b.layout.cssNum,k=c;"border-box"!==f&&(k-=j(a,"Top")+j(a,"Bottom"));"content-box"===f&&(k-=h(a,"paddingTop")+h(a,"paddingBottom"));return d(0,k)},cssNum:function(a,
|
||||
d,c){a.jquery||(a=b(a));var f=b.layout.showInvisibly(a);d=b.css(a[0],d,!0);c=c&&"auto"==d?d:Math.round(parseFloat(d)||0);a.css(f);return c},borderWidth:function(a,d){a.jquery&&(a=a[0]);var c="border"+d.substr(0,1).toUpperCase()+d.substr(1);return"none"===b.css(a,c+"Style",!0)?0:Math.round(parseFloat(b.css(a,c+"Width",!0))||0)},isMouseOverElem:function(a,d){var c=b(d||this),f=c.offset(),j=f.top,f=f.left,k=f+c.outerWidth(),c=j+c.outerHeight(),h=a.pageX,p=a.pageY;return b.layout.browser.msie&&0>h&&0>
|
||||
p||h>=f&&h<=k&&p>=j&&p<=c},msg:function(a,d,c,f){b.isPlainObject(a)&&window.debugData?("string"===typeof d?(f=c,c=d):"object"===typeof c&&(f=c,c=null),c=c||"log( <object> )",f=b.extend({sort:!1,returnHTML:!1,display:!1},f),!0===d||f.display?debugData(a,c,f):window.console&&console.log(debugData(a,c,f))):d?alert(a):window.console?console.log(a):(d=b("#layoutLogger"),d.length||(d=b('<div id="layoutLogger" style="position: '+(b.support.fixedPosition?"fixed":"absolute")+'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);"><div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;"><span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div><ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul></div>').appendTo("body"),
|
||||
d.css("left",b(window).width()-d.outerWidth()-5),b.ui.draggable&&d.draggable({handle:":first-child"})),d.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+a.replace(/\</g,"<").replace(/\>/g,">")+"</li>"))}};var h=navigator.userAgent.toLowerCase(),p=/(chrome)[ \/]([\w.]+)/.exec(h)||/(webkit)[ \/]([\w.]+)/.exec(h)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(h)||/(msie) ([\w.]+)/.exec(h)||0>h.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(h)||
|
||||
[],h=p[1]||"",p=p[2]||0,x="msie"===h;b.layout.browser={version:p,safari:"webkit"===h,webkit:"chrome"===h,msie:x,isIE6:x&&6==p,boxModel:!x||!1!==b.support.boxModel};h&&(b.layout.browser[h]=!0);x&&b(function(){b.layout.browser.boxModel=b.support.boxModel});b.layout.defaults={name:"",containerClass:"ui-layout-container",inset:null,scrollToBookmarkOnLoad:!0,resizeWithWindow:!0,resizeWithWindowDelay:200,resizeWithWindowMaxDelay:0,maskPanesEarly:!1,onresizeall_start:null,onresizeall_end:null,onload_start:null,
|
||||
onload_end:null,onunload_start:null,onunload_end:null,initPanes:!0,showErrorMessages:!0,showDebugMessages:!1,zIndex:null,zIndexes:{pane_normal:0,content_mask:1,resizer_normal:2,pane_sliding:100,pane_animate:1E3,resizer_drag:1E4},errors:{pane:"pane",selector:"selector",addButtonError:"Error Adding Button\nInvalid ",containerMissing:"UI Layout Initialization Error\nThe specified layout-container does not exist.",centerPaneMissing:"UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element.",
|
||||
noContainerHeight:"UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!",callbackError:"UI Layout Callback Error\nThe EVENT callback is not a valid function."},panes:{applyDemoStyles:!1,closable:!0,resizable:!0,slidable:!0,initClosed:!1,initHidden:!1,contentSelector:".ui-layout-content",contentIgnoreSelector:".ui-layout-ignore",findNestedContent:!1,paneClass:"ui-layout-pane",resizerClass:"ui-layout-resizer",togglerClass:"ui-layout-toggler",
|
||||
buttonClass:"ui-layout-button",minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerContent_open:"",togglerContent_closed:"",resizerDblClickToggle:!0,autoResize:!0,autoReopen:!0,resizerDragOpacity:1,maskContents:!1,maskObjects:!1,maskZindex:null,resizingGrid:!1,livePaneResizing:!1,liveContentResizing:!1,liveResizingTolerance:1,sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseleave",
|
||||
slideDelay_open:300,slideDelay_close:300,hideTogglerOnSlide:!1,preventQuickSlideClose:b.layout.browser.webkit,preventPrematureSlideClose:!1,tips:{Open:"Open",Close:"Close",Resize:"Resize",Slide:"Slide Open",Pin:"Pin",Unpin:"Un-Pin",noRoomToOpen:"Not enough room to show this panel.",minSizeWarning:"Panel has reached its minimum size",maxSizeWarning:"Panel has reached its maximum size"},showOverflowOnHover:!1,enableCursorHotkey:!0,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{},
|
||||
fxOpacityFix:!0,animatePaneSizing:!1,children:null,containerSelector:"",initChildren:!0,destroyChildren:!0,resizeChildren:!0,triggerEventsOnLoad:!1,triggerEventsDuringLiveResize:!0,onshow_start:null,onshow_end:null,onhide_start:null,onhide_end:null,onopen_start:null,onopen_end:null,onclose_start:null,onclose_end:null,onresize_start:null,onresize_end:null,onsizecontent_start:null,onsizecontent_end:null,onswap_start:null,onswap_end:null,ondrag_start:null,ondrag_end:null},north:{paneSelector:".ui-layout-north",
|
||||
size:"auto",resizerCursor:"n-resize",customHotkey:""},south:{paneSelector:".ui-layout-south",size:"auto",resizerCursor:"s-resize",customHotkey:""},east:{paneSelector:".ui-layout-east",size:200,resizerCursor:"e-resize",customHotkey:""},west:{paneSelector:".ui-layout-west",size:200,resizerCursor:"w-resize",customHotkey:""},center:{paneSelector:".ui-layout-center",minWidth:0,minHeight:0}};b.layout.optionsMap={layout:"name instanceKey stateManagement effects inset zIndexes errors zIndex scrollToBookmarkOnLoad showErrorMessages maskPanesEarly outset resizeWithWindow resizeWithWindowDelay resizeWithWindowMaxDelay onresizeall onresizeall_start onresizeall_end onload onload_start onload_end onunload onunload_start onunload_end".split(" "),
|
||||
center:"paneClass contentSelector contentIgnoreSelector findNestedContent applyDemoStyles triggerEventsOnLoad showOverflowOnHover maskContents maskObjects liveContentResizing containerSelector children initChildren resizeChildren destroyChildren onresize onresize_start onresize_end onsizecontent onsizecontent_start onsizecontent_end".split(" "),noDefault:["paneSelector","resizerCursor","customHotkey"]};b.layout.transformData=function(a,d){var c=d?{panes:{},center:{}}:{},f,j,k,h,p,x,D;if("object"!==
|
||||
typeof a)return c;for(j in a){f=c;p=a[j];k=j.split("__");D=k.length-1;for(x=0;x<=D;x++)h=k[x],x===D?f[h]=b.isPlainObject(p)?b.layout.transformData(p):p:(f[h]||(f[h]={}),f=f[h])}return c};b.layout.backwardCompatibility={map:{applyDefaultStyles:"applyDemoStyles",childOptions:"children",initChildLayout:"initChildren",destroyChildLayout:"destroyChildren",resizeChildLayout:"resizeChildren",resizeNestedLayout:"resizeChildren",resizeWhileDragging:"livePaneResizing",resizeContentWhileDragging:"liveContentResizing",
|
||||
triggerEventsWhileDragging:"triggerEventsDuringLiveResize",maskIframesOnResize:"maskContents",useStateCookie:"stateManagement.enabled","cookie.autoLoad":"stateManagement.autoLoad","cookie.autoSave":"stateManagement.autoSave","cookie.keys":"stateManagement.stateKeys","cookie.name":"stateManagement.cookie.name","cookie.domain":"stateManagement.cookie.domain","cookie.path":"stateManagement.cookie.path","cookie.expires":"stateManagement.cookie.expires","cookie.secure":"stateManagement.cookie.secure",
|
||||
noRoomToOpenTip:"tips.noRoomToOpen",togglerTip_open:"tips.Close",togglerTip_closed:"tips.Open",resizerTip:"tips.Resize",sliderTip:"tips.Slide"},renameOptions:function(a){function d(b,c){for(var f=b.split("."),k=f.length-1,j={branch:a,key:f[k]},r=0,q;r<k;r++)q=f[r],j.branch=void 0==j.branch[q]?c?j.branch[q]={}:{}:j.branch[q];return j}var c=b.layout.backwardCompatibility.map,f,j,k,h;for(h in c)f=d(h),k=f.branch[f.key],void 0!==k&&(j=d(c[h],!0),j.branch[j.key]=k,delete f.branch[f.key])},renameAllOptions:function(a){var d=
|
||||
b.layout.backwardCompatibility.renameOptions;d(a);a.defaults&&("object"!==typeof a.panes&&(a.panes={}),b.extend(!0,a.panes,a.defaults),delete a.defaults);a.panes&&d(a.panes);b.each(b.layout.config.allPanes,function(b,c){a[c]&&d(a[c])});return a}};b.fn.layout=function(h){function p(e){if(!e)return!0;var w=e.keyCode;if(33>w)return!0;var m={38:"north",40:"south",37:"west",39:"east"},a=e.shiftKey,g=e.ctrlKey,t,n,d,c;g&&(37<=w&&40>=w)&&r[m[w]].enableCursorHotkey?c=m[w]:(g||a)&&b.each(k.borderPanes,function(e,
|
||||
b){t=r[b];n=t.customHotkey;d=t.customHotkeyModifier;if(a&&"SHIFT"==d||g&&"CTRL"==d||g&&a)if(n&&w===(isNaN(n)||9>=n?n.toUpperCase().charCodeAt(0):n))return c=b,!1});if(!c||!y[c]||!r[c].closable||q[c].isHidden)return!0;na(c);e.stopPropagation();return e.returnValue=!1}function x(e){if(H()){this&&this.tagName&&(e=this);var w;f(e)?w=y[e]:b(e).data("layoutRole")?w=b(e):b(e).parents().each(function(){if(b(this).data("layoutRole"))return w=b(this),!1});if(w&&w.length){var m=w.data("layoutEdge");e=q[m];e.cssSaved&&
|
||||
X(m);if(e.isSliding||e.isResizing||e.isClosed)e.cssSaved=!1;else{var a={zIndex:r.zIndexes.resizer_normal+1},g={},t=w.css("overflow"),n=w.css("overflowX"),d=w.css("overflowY");"visible"!=t&&(g.overflow=t,a.overflow="visible");n&&!n.match(/(visible|auto)/)&&(g.overflowX=n,a.overflowX="visible");d&&!d.match(/(visible|auto)/)&&(g.overflowY=n,a.overflowY="visible");e.cssSaved=g;w.css(a);b.each(k.allPanes,function(e,b){b!=m&&X(b)})}}}}function X(e){if(H()){this&&this.tagName&&(e=this);var w;f(e)?w=y[e]:
|
||||
b(e).data("layoutRole")?w=b(e):b(e).parents().each(function(){if(b(this).data("layoutRole"))return w=b(this),!1});if(w&&w.length){e=w.data("layoutEdge");e=q[e];var m=e.cssSaved||{};!e.isSliding&&!e.isResizing&&w.css("zIndex",r.zIndexes.pane_normal);w.css(m);e.cssSaved=!1}}}var G=b.layout.browser,k=b.layout.config,Q=b.layout.cssWidth,O=b.layout.cssHeight,R=b.layout.getElementDimensions,D=b.layout.getElementStyles,Ma=b.layout.getEventObject,A=b.layout.parsePaneName,r=b.extend(!0,{},b.layout.defaults);
|
||||
r.effects=b.extend(!0,{},b.layout.effects);var q={id:"layout"+b.now(),initialized:!1,paneResizing:!1,panesSliding:{},container:{innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0,layoutWidth:0,layoutHeight:0},north:{childIdx:0},south:{childIdx:0},east:{childIdx:0},west:{childIdx:0},center:{childIdx:0}},ba={north:null,south:null,east:null,west:null,center:null},M={data:{},set:function(e,b,m){M.clear(e);M.data[e]=setTimeout(b,m)},clear:function(e){var b=M.data;b[e]&&(clearTimeout(b[e]),delete b[e])}},
|
||||
ca=function(e,w,m){var a=r;(a.showErrorMessages&&!m||m&&a.showDebugMessages)&&b.layout.msg(a.name+" / "+e,!1!==w);return!1},C=function(e,w,m){var a=w&&f(w),g=a?q[w]:q,t=a?r[w]:r,n=r.name,d=e+(e.match(/_/)?"":"_end"),c=d.match(/_end$/)?d.substr(0,d.length-4):"",l=t[d]||t[c],h="NC",k=[];!a&&"boolean"===b.type(w)&&(m=w,w="");if(l)try{f(l)&&(l.match(/,/)?(k=l.split(","),l=eval(k[0])):l=eval(l)),b.isFunction(l)&&(h=k.length?l(k[1]):a?l(w,y[w],g,t,n):l(z,g,t,n))}catch(j){ca(r.errors.callbackError.replace(/EVENT/,
|
||||
b.trim((w||"")+" "+d)),!1),"string"===b.type(j)&&string.length&&ca("Exception: "+j,!1)}!m&&!1!==h&&(a?(m=y[w],t=r[w],g=q[w],m.triggerHandler("layoutpane"+d,[w,m,g,t,n]),c&&m.triggerHandler("layoutpane"+c,[w,m,g,t,n])):(u.triggerHandler("layout"+d,[z,g,t,n]),c&&u.triggerHandler("layout"+c,[z,g,t,n])));a&&"onresize_end"===e&&db(w+"",!0);return h},eb=function(e){if(!G.mozilla){var b=y[e];"IFRAME"===q[e].tagName?b.css(k.hidden).css(k.visible):b.find("IFRAME").css(k.hidden).css(k.visible)}},ya=function(e){var b=
|
||||
y[e];e=k[e].dir;b={minWidth:1001-Q(b,1E3),minHeight:1001-O(b,1E3)};"horz"===e&&(b.minSize=b.minHeight);"vert"===e&&(b.minSize=b.minWidth);return b},fa=function(e,w,m){m||(m=k[e].dir);f(w)&&w.match(/%/)&&(w="100%"===w?-1:parseInt(w,10)/100);if(0===w)return 0;if(1<=w)return parseInt(w,10);var a=r,g=0;"horz"==m?g=v.innerHeight-(y.north?a.north.spacing_open:0)-(y.south?a.south.spacing_open:0):"vert"==m&&(g=v.innerWidth-(y.west?a.west.spacing_open:0)-(y.east?a.east.spacing_open:0));if(-1===w)return g;
|
||||
if(0<w)return c(g*w);if("center"==e)return 0;m="horz"===m?"height":"width";a=y[e];e="height"===m?U[e]:!1;var g=b.layout.showInvisibly(a),t=a.css(m),n=e?e.css(m):0;a.css(m,"auto");e&&e.css(m,"auto");w="height"===m?a.outerHeight():a.outerWidth();a.css(m,t).css(g);e&&e.css(m,n);return w},ga=function(e,b){var a=y[e],E=r[e],g=q[e],t=b?E.spacing_open:0,E=b?E.spacing_closed:0;return!a||g.isHidden?0:g.isClosed||g.isSliding&&b?E:"horz"===k[e].dir?a.outerHeight()+t:a.outerWidth()+t},Y=function(e,b){if(H()){var m=
|
||||
r[e],E=q[e],g=k[e],t=g.dir;g.sizeType.toLowerCase();var g=void 0!=b?b:E.isSliding,n=m.spacing_open,c=k.oppositeEdge[e],f=q[c],l=y[c],h=!l||!1===f.isVisible||f.isSliding?0:"horz"==t?l.outerHeight():l.outerWidth(),c=(!l||f.isHidden?0:r[c][!1!==f.isClosed?"spacing_closed":"spacing_open"])||0,f="horz"==t?v.innerHeight:v.innerWidth,l=ya("center"),l="horz"==t?d(r.center.minHeight,l.minHeight):d(r.center.minWidth,l.minWidth),g=f-n-(g?0:fa("center",l,t)+h+c),t=E.minSize=d(fa(e,m.minSize),ya(e).minSize),g=
|
||||
E.maxSize=a(m.maxSize?fa(e,m.maxSize):1E5,g),E=E.resizerPosition={},n=v.inset.top,h=v.inset.left,c=v.innerWidth,f=v.innerHeight,m=m.spacing_open;switch(e){case "north":E.min=n+t;E.max=n+g;break;case "west":E.min=h+t;E.max=h+g;break;case "south":E.min=n+f-g-m;E.max=n+f-t-m;break;case "east":E.min=h+c-g-m,E.max=h+c-t-m}}},Na=function(e,a){var m=b(e),E=m.data("layoutRole"),g=m.data("layoutEdge"),t=r[g][E+"Class"],g="-"+g,n=m.hasClass(t+"-closed")?"-closed":"-open",d="-closed"===n?"-open":"-closed",n=
|
||||
t+"-hover "+(t+g+"-hover ")+(t+n+"-hover ")+(t+g+n+"-hover ");a&&(n+=t+d+"-hover "+(t+g+d+"-hover "));"resizer"==E&&m.hasClass(t+"-sliding")&&(n+=t+"-sliding-hover "+(t+g+"-sliding-hover "));return b.trim(n)},Oa=function(e,a){var m=b(a||this);e&&"toggler"===m.data("layoutRole")&&e.stopPropagation();m.addClass(Na(m))},da=function(e,a){var m=b(a||this);m.removeClass(Na(m,!0))},fb=function(){var e=b(this).data("layoutEdge"),a=q[e];!a.isClosed&&(!a.isResizing&&!q.paneResizing)&&(b.fn.disableSelection&&
|
||||
b("body").disableSelection(),r.maskPanesEarly&&va(e,{resizing:!0}))},gb=function(e,a){var m=a||this,E=b(m).data("layoutEdge"),g=E+"ResizerLeave";M.clear(E+"_openSlider");M.clear(g);a?q.paneResizing||(b.fn.enableSelection&&b("body").enableSelection(),r.maskPanesEarly&&za()):M.set(g,function(){gb(e,m)},200)},H=function(){return q.initialized||q.creatingLayout?!0:Aa()},Aa=function(e){var a=r;if(!u.is(":visible"))return!e&&(G.webkit&&"BODY"===u[0].tagName)&&setTimeout(function(){Aa(!0)},50),!1;if(!hb("center").length)return ca(a.errors.centerPaneMissing);
|
||||
q.creatingLayout=!0;b.extend(v,R(u,a.inset));A(void 0);b.each(k.allPanes,function(e,b){ib(b,!0)});Pa();b.each(k.borderPanes,function(e,b){y[b]&&q[b].isVisible&&(Y(b),ha(b))});ia("center");b.each(k.allPanes,function(e,b){jb(b)});a.scrollToBookmarkOnLoad&&(e=self.location,e.hash&&e.replace(e.hash));z.hasParentLayout?a.resizeWithWindow=!1:a.resizeWithWindow&&b(window).bind("resize."+K,Ab);delete q.creatingLayout;q.initialized=!0;j(z,b.layout.onReady);C("onload_end");return!0},Qa=function(e,a){var m=
|
||||
A.call(this,e),d=y[m];if(d){var g=U[m],t=q[m],n=r[m],c=r.stateManagement||{},n=a?n.children=a:n.children;if(b.isPlainObject(n))n=[n];else if(!n||!b.isArray(n))return;b.each(n,function(e,a){b.isPlainObject(a)&&(a.containerSelector?d.find(a.containerSelector):g||d).each(function(){var e=b(this),g=e.data("layout");if(!g){kb({container:e,options:a},t);if(c.includeChildren&&q.stateData[m]){var g=(q.stateData[m].children||{})[a.instanceKey],w=a.stateManagement||(a.stateManagement={autoLoad:!0});!0===w.autoLoad&&
|
||||
g&&(w.autoSave=!1,w.includeChildren=!0,w.autoLoad=b.extend(!0,{},g))}(g=e.layout(a))&&Ba(m,g)}})})}},kb=function(e,b){var a=e.container,d=e.options,g=d.stateManagement,t=d.instanceKey||a.data("layoutInstanceKey");t||(t=(g&&g.cookie?g.cookie.name:"")||d.name);t=t?t.replace(/[^\w-]/gi,"_").replace(/_{2,}/g,"_"):"layout"+ ++b.childIdx;d.instanceKey=t;a.data("layoutInstanceKey",t);return t},Ba=function(e,a){var m=y[e],d=ba[e],g=q[e];b.isPlainObject(d)&&(b.each(d,function(e,b){b.destroyed&&delete d[e]}),
|
||||
b.isEmptyObject(d)&&(d=ba[e]=null));!a&&!d&&(a=m.data("layout"));a&&(a.hasParentLayout=!0,m=a.options,kb(a,g),d||(d=ba[e]={}),d[m.instanceKey]=a.container.data("layout"));z[e].children=ba[e];a||Qa(e)},Ab=function(){var e=r,b=Number(e.resizeWithWindowDelay);10>b&&(b=100);M.clear("winResize");M.set("winResize",function(){M.clear("winResize");M.clear("winResizeRepeater");var b=R(u,e.inset);(b.innerWidth!==v.innerWidth||b.innerHeight!==v.innerHeight)&&oa()},b);M.data.winResizeRepeater||lb()},lb=function(){var e=
|
||||
Number(r.resizeWithWindowMaxDelay);0<e&&M.set("winResizeRepeater",function(){lb();oa()},e)},mb=function(){C("onunload_start");j(z,b.layout.onUnload);C("onunload_end")},nb=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,a){var d=r[a];if(d.enableCursorHotkey||d.customHotkey)return b(document).bind("keydown."+K,p),!1})},hb=function(e){e=r[e].paneSelector;if("#"===e.substr(0,1))return u.find(e).eq(0);var b=u.children(e).eq(0);return b.length?b:u.children("form:first").children(e).eq(0)},
|
||||
ib=function(e,b){if(b||H()){var m=r[e],c=q[e],g=k[e],t=g.dir,n="center"===e,f={},h=y[e],l,j;h?Ra(e,!1,!0,!1):U[e]=!1;h=y[e]=hb(e);if(h.length){h.data("layoutCSS")||h.data("layoutCSS",D(h,"position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"));z[e]={name:e,pane:y[e],content:U[e],options:r[e],state:q[e],children:ba[e]};h.data({parentLayout:z,layoutPane:z[e],layoutEdge:e,layoutRole:"pane"}).css(g.cssReq).css("zIndex",r.zIndexes.pane_normal).css(m.applyDemoStyles?
|
||||
g.cssDemo:{}).addClass(m.paneClass+" "+m.paneClass+"-"+e).bind("mouseenter."+K,Oa).bind("mouseleave."+K,da);g={hide:"",show:"",toggle:"",close:"",open:"",slideOpen:"",slideClose:"",slideToggle:"",size:"sizePane",sizePane:"sizePane",sizeContent:"",sizeHandles:"",enableClosable:"",disableClosable:"",enableSlideable:"",disableSlideable:"",enableResizable:"",disableResizable:"",swapPanes:"swapPanes",swap:"swapPanes",move:"swapPanes",removePane:"removePane",remove:"removePane",createChildren:"",resizeChildren:"",
|
||||
resizeAll:"resizeAll",resizeLayout:"resizeAll"};for(j in g)h.bind("layoutpane"+j.toLowerCase()+"."+K,z[g[j]||j]);Sa(e,!1);n||(l=c.size=fa(e,m.size),n=fa(e,m.minSize)||1,j=fa(e,m.maxSize)||1E5,0<l&&(l=d(a(l,j),n)),c.autoResize=m.autoResize,c.isClosed=!1,c.isSliding=!1,c.isResizing=!1,c.isHidden=!1,c.pins||(c.pins=[]));c.tagName=h[0].tagName;c.edge=e;c.noRoom=!1;c.isVisible=!0;ob(e);"horz"===t?f.height=O(h,l):"vert"===t&&(f.width=Q(h,l));h.css(f);"horz"!=t&&ia(e,!0);q.initialized&&(Pa(e),nb(e));m.initClosed&&
|
||||
m.closable&&!m.initHidden?ja(e,!0,!0):m.initHidden||m.initClosed?Ta(e):c.noRoom||h.css("display","block");h.css("visibility","visible");m.showOverflowOnHover&&h.hover(x,X);q.initialized&&jb(e)}else y[e]=!1}},jb=function(e){var b=y[e],a=q[e],d=r[e];b&&(b.data("layout")&&Ba(e,b.data("layout")),a.isVisible&&(q.initialized?oa():pa(e),d.triggerEventsOnLoad?C("onresize_end",e):db(e,!0)),d.initChildren&&d.children&&Qa(e))},ob=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,b){var a=y[b],g=
|
||||
F[b],d=q[b],c=k[b].side,f={};if(a){switch(b){case "north":f.top=v.inset.top;f.left=v.inset.left;f.right=v.inset.right;break;case "south":f.bottom=v.inset.bottom;f.left=v.inset.left;f.right=v.inset.right;break;case "west":f.left=v.inset.left;break;case "east":f.right=v.inset.right}a.css(f);g&&d.isClosed?g.css(c,v.inset[c]):g&&!d.isHidden&&g.css(c,v.inset[c]+ga(b))}})},Pa=function(e){e=e?e.split(","):k.borderPanes;b.each(e,function(e,a){var d=y[a];F[a]=!1;P[a]=!1;if(d){var g=r[a],d=q[a],c="#"===g.paneSelector.substr(0,
|
||||
1)?g.paneSelector.substr(1):"",n=g.resizerClass,f=g.togglerClass,h="-"+a,l=z[a],j=l.resizer=F[a]=b("<div></div>"),l=l.toggler=g.closable?P[a]=b("<div></div>"):!1;!d.isVisible&&g.slidable&&j.attr("title",g.tips.Slide).css("cursor",g.sliderCursor);j.attr("id",c?c+"-resizer":"").data({parentLayout:z,layoutPane:z[a],layoutEdge:a,layoutRole:"resizer"}).css(k.resizers.cssReq).css("zIndex",r.zIndexes.resizer_normal).css(g.applyDemoStyles?k.resizers.cssDemo:{}).addClass(n+" "+n+h).hover(Oa,da).hover(fb,gb).appendTo(u);
|
||||
g.resizerDblClickToggle&&j.bind("dblclick."+K,na);l&&(l.attr("id",c?c+"-toggler":"").data({parentLayout:z,layoutPane:z[a],layoutEdge:a,layoutRole:"toggler"}).css(k.togglers.cssReq).css(g.applyDemoStyles?k.togglers.cssDemo:{}).addClass(f+" "+f+h).hover(Oa,da).bind("mouseenter",fb).appendTo(j),g.togglerContent_open&&b("<span>"+g.togglerContent_open+"</span>").data({layoutEdge:a,layoutRole:"togglerContent"}).data("layoutRole","togglerContent").data("layoutEdge",a).addClass("content content-open").css("display",
|
||||
"none").appendTo(l),g.togglerContent_closed&&b("<span>"+g.togglerContent_closed+"</span>").data({layoutEdge:a,layoutRole:"togglerContent"}).addClass("content content-closed").css("display","none").appendTo(l),pb(a));var g=a,B=b.layout.plugins.draggable,g=g?g.split(","):k.borderPanes;b.each(g,function(e,a){var g=r[a];if(!B||!y[a]||!g.resizable)return g.resizable=!1,!0;var m=q[a],w=r.zIndexes,d=k[a],c="horz"==d.dir?"top":"left",t=F[a],n=g.resizerClass,f=0,l,h,E=n+"-drag",j=n+"-"+a+"-drag",J=n+"-dragging",
|
||||
zb=n+"-"+a+"-dragging",cb=n+"-dragging-limit",v=n+"-"+a+"-dragging-limit",x=!1;m.isClosed||t.attr("title",g.tips.Resize).css("cursor",g.resizerCursor);t.draggable({containment:u[0],axis:"horz"==d.dir?"y":"x",delay:0,distance:1,grid:g.resizingGrid,helper:"clone",opacity:g.resizerDragOpacity,addClasses:!1,zIndex:w.resizer_drag,start:function(e,w){g=r[a];m=q[a];h=g.livePaneResizing;if(!1===C("ondrag_start",a))return!1;m.isResizing=!0;q.paneResizing=a;M.clear(a+"_closeSlider");Y(a);l=m.resizerPosition;
|
||||
f=w.position[c];t.addClass(E+" "+j);x=!1;b("body").disableSelection();va(a,{resizing:!0})},drag:function(e,b){x||(b.helper.addClass(J+" "+zb).css({right:"auto",bottom:"auto"}).children().css("visibility","hidden"),x=!0,m.isSliding&&y[a].css("zIndex",w.pane_sliding));var d=0;b.position[c]<l.min?(b.position[c]=l.min,d=-1):b.position[c]>l.max&&(b.position[c]=l.max,d=1);d?(b.helper.addClass(cb+" "+v),window.defaultStatus=0<d&&a.match(/(north|west)/)||0>d&&a.match(/(south|east)/)?g.tips.maxSizeWarning:
|
||||
g.tips.minSizeWarning):(b.helper.removeClass(cb+" "+v),window.defaultStatus="");h&&Math.abs(b.position[c]-f)>=g.liveResizingTolerance&&(f=b.position[c],p(e,b,a))},stop:function(e,g){b("body").enableSelection();window.defaultStatus="";t.removeClass(E+" "+j);m.isResizing=!1;q.paneResizing=!1;p(e,g,a,!0)}})});var p=function(b,e,a,g){var m=e.position,w=k[a];b=r[a];e=q[a];var d;switch(a){case "north":d=m.top;break;case "west":d=m.left;break;case "south":d=v.layoutHeight-m.top-b.spacing_open;break;case "east":d=
|
||||
v.layoutWidth-m.left-b.spacing_open}d-=v.inset[w.side];g?(!1!==C("ondrag_end",a)&&Ca(a,d,!1,!0),za(!0),e.isSliding&&va(a,{resizing:!0})):Math.abs(d-e.size)<b.liveResizingTolerance||(Ca(a,d,!1,!0),ea.each(qb))};d.isVisible?Ua(a):(Da(a),ma(a,!0))}});qa()},Sa=function(b,a){if(H()){var m=r[b],d=m.contentSelector,g=z[b],c=y[b],n;d&&(n=g.content=U[b]=m.findNestedContent?c.find(d).eq(0):c.children(d).eq(0));n&&n.length?(n.data("layoutRole","content"),n.data("layoutCSS")||n.data("layoutCSS",D(n,"height")),
|
||||
n.css(k.content.cssReq),m.applyDemoStyles&&(n.css(k.content.cssDemo),c.css(k.content.cssDemoPane)),c.css("overflowX").match(/(scroll|auto)/)&&c.css("overflow","hidden"),q[b].content={},!1!==a&&pa(b)):g.content=U[b]=!1}},qb=function(){var e=b(this),a=e.data("layoutMask"),a=q[a];"IFRAME"==a.tagName&&a.isVisible&&e.css({top:a.offsetTop,left:a.offsetLeft,width:a.outerWidth,height:a.outerHeight})},va=function(e,a){var m=k[e],d=["center"],g=r.zIndexes,c=b.extend({objectsOnly:!1,animation:!1,resizing:!0,
|
||||
sliding:q[e].isSliding},a),n,f;c.resizing&&d.push(e);c.sliding&&d.push(k.oppositeEdge[e]);"horz"===m.dir&&(d.push("west"),d.push("east"));b.each(d,function(e,a){f=q[a];n=r[a];if(f.isVisible&&(n.maskObjects||!c.objectsOnly&&n.maskContents)){for(var m=b([]),d,w=0,h=ea.length;w<h;w++)d=ea.eq(w),d.data("layoutMask")===a&&(m=m.add(d));if(!m.length){m=y[a];d=q[a];var w=r[a],h=r.zIndexes,j=b([]),E,k,v,p,x;if(w.maskContents||w.maskObjects)for(x=0;x<(w.maskObjects?2:1);x++)E=w.maskObjects&&0==x,k=document.createElement(E?
|
||||
"iframe":"div"),v=b(k).data("layoutMask",a),k.className="ui-layout-mask ui-layout-mask-"+a,p=k.style,p.display="block",p.position="absolute",p.background="#FFF",E&&(k.frameborder=0,k.src="about:blank",p.opacity=0,p.filter="Alpha(Opacity='0')",p.border=0),"IFRAME"==d.tagName?(p.zIndex=h.pane_normal+1,u.append(k)):(v.addClass("ui-layout-mask-inside-pane"),p.zIndex=w.maskZindex||h.content_mask,p.top=0,p.left=0,p.width="100%",p.height="100%",m.append(k)),j=j.add(k),ea=ea.add(k);m=j}m.each(function(){qb.call(this);
|
||||
this.style.zIndex=f.isSliding?g.pane_sliding+1:g.pane_normal+1;this.style.display="block"})}})},za=function(a){if(a||!q.paneResizing)ea.hide();else if(!a&&!b.isEmptyObject(q.panesSliding)){a=ea.length-1;for(var d,m;0<=a;a--)m=ea.eq(a),d=m.data("layoutMask"),r[d].maskObjects||m.hide()}},Ra=function(a,d,m,c){if(H()){a=A.call(this,a);var g=y[a],t=U[a],n=F[a],f=P[a];g&&b.isEmptyObject(g.data())&&(g=!1);t&&b.isEmptyObject(t.data())&&(t=!1);n&&b.isEmptyObject(n.data())&&(n=!1);f&&b.isEmptyObject(f.data())&&
|
||||
(f=!1);g&&g.stop(!0,!0);var h=r[a],l=ba[a],j=b.isPlainObject(l)&&!b.isEmptyObject(l);c=void 0!==c?c:h.destroyChildren;j&&c&&(b.each(l,function(a,b){b.destroyed||b.destroy(!0);b.destroyed&&delete l[a]}),b.isEmptyObject(l)&&(l=ba[a]=null,j=!1));g&&d&&!j?g.remove():g&&g[0]&&(d=h.paneClass,c=d+"-"+a,d=[d,d+"-open",d+"-closed",d+"-sliding",c,c+"-open",c+"-closed",c+"-sliding"],b.merge(d,Na(g,!0)),g.removeClass(d.join(" ")).removeData("parentLayout").removeData("layoutPane").removeData("layoutRole").removeData("layoutEdge").removeData("autoHidden").unbind("."+
|
||||
K),j&&t?(t.width(t.width()),b.each(l,function(a,b){b.resizeAll()})):t&&t.css(t.data("layoutCSS")).removeData("layoutCSS").removeData("layoutRole"),g.data("layout")||g.css(g.data("layoutCSS")).removeData("layoutCSS"));f&&f.remove();n&&n.remove();z[a]=y[a]=U[a]=F[a]=P[a]=!1;m||oa()}},Ea=function(a){var b=y[a],d=b[0].style;r[a].useOffscreenClose?(b.data(k.offscreenReset)||b.data(k.offscreenReset,{left:d.left,right:d.right}),b.css(k.offscreenCSS)):b.hide().removeData(k.offscreenReset)},rb=function(a){var b=
|
||||
y[a];a=r[a];var d=k.offscreenCSS,c=b.data(k.offscreenReset),g=b[0].style;b.show().removeData(k.offscreenReset);a.useOffscreenClose&&c&&(g.left==d.left&&(g.left=c.left),g.right==d.right&&(g.right=c.right))},Ta=function(a,b){if(H()){var d=A.call(this,a),c=r[d],g=q[d],t=F[d];y[d]&&!g.isHidden&&!(q.initialized&&!1===C("onhide_start",d))&&(g.isSliding=!1,delete q.panesSliding[d],t&&t.hide(),!q.initialized||g.isClosed?(g.isClosed=!0,g.isHidden=!0,g.isVisible=!1,q.initialized||Ea(d),ia("horz"===k[d].dir?
|
||||
"":"center"),(q.initialized||c.triggerEventsOnLoad)&&C("onhide_end",d)):(g.isHiding=!0,ja(d,!1,b)))}},Fa=function(a,b,d,c){if(H()){a=A.call(this,a);var g=q[a];y[a]&&g.isHidden&&!1!==C("onshow_start",a)&&(g.isShowing=!0,g.isSliding=!1,delete q.panesSliding[a],!1===b?ja(a,!0):ra(a,!1,d,c))}},na=function(a,b){if(H()){var d=Ma(a),c=A.call(this,a),g=q[c];d&&d.stopImmediatePropagation();g.isHidden?Fa(c):g.isClosed?ra(c,!!b):ja(c)}},ja=function(a,b,d,c){function g(){l.isMoving=!1;ma(t,!0);var a=k.oppositeEdge[t];
|
||||
q[a].noRoom&&(Y(a),ha(a));if(!c&&(q.initialized||h.triggerEventsOnLoad))p||C("onclose_end",t),p&&C("onshow_end",t),v&&C("onhide_end",t)}var t=A.call(this,a);if(!q.initialized&&y[t]){a=t;var n=q[a];Ea(a);n.isClosed=!0;n.isVisible=!1;Da(a)}else if(H()){var f=y[t],h=r[t],l=q[t],j,p,v;u.queue(function(a){if(!f||!h.closable&&!l.isShowing&&!l.isHiding||!b&&l.isClosed&&!l.isShowing)return a();var e=!l.isShowing&&!1===C("onclose_start",t);p=l.isShowing;v=l.isHiding;delete l.isShowing;delete l.isHiding;if(e)return a();
|
||||
j=!d&&!l.isClosed&&"none"!=h.fxName_close;l.isMoving=!0;l.isClosed=!0;l.isVisible=!1;v?l.isHidden=!0:p&&(l.isHidden=!1);l.isSliding?wa(t,!1):ia("horz"===k[t].dir?"":"center",!1);Da(t);j?(Ga(t,!0),f.hide(h.fxName_close,h.fxSettings_close,h.fxSpeed_close,function(){Ga(t,!1);l.isClosed&&g();a()})):(Ea(t),g(),a())})}},Da=function(a){if(F[a]){var d=F[a],c=P[a],f=r[a],g=k[a].side,t=f.resizerClass,n=f.togglerClass,h="-"+a;d.css(g,v.inset[g]).removeClass(t+"-open "+t+h+"-open").removeClass(t+"-sliding "+
|
||||
t+h+"-sliding").addClass(t+"-closed "+t+h+"-closed");f.resizable&&b.layout.plugins.draggable&&d.draggable("disable").removeClass("ui-state-disabled").css("cursor","default").attr("title","");c&&(c.removeClass(n+"-open "+n+h+"-open").addClass(n+"-closed "+n+h+"-closed").attr("title",f.tips.Open),c.children(".content-open").hide(),c.children(".content-closed").css("display","block"));Va(a,!1);q.initialized&&qa()}},ra=function(a,b,d,c){function g(){j.isMoving=!1;eb(f);j.isSliding||ia("vert"==k[f].dir?
|
||||
"center":"",!1);Ua(f)}if(H()){var f=A.call(this,a),n=y[f],h=r[f],j=q[f],l,p;u.queue(function(a){if(!n||!h.resizable&&!h.closable&&!j.isShowing||j.isVisible&&!j.isSliding)return a();if(j.isHidden&&!j.isShowing)a(),Fa(f,!0);else{j.autoResize&&j.size!=h.size?ka(f,h.size,!0,!0,!0):Y(f,b);var e=C("onopen_start",f);if("abort"===e)return a();"NC"!==e&&Y(f,b);if(j.minSize>j.maxSize)return Va(f,!1),!c&&h.tips.noRoomToOpen&&alert(h.tips.noRoomToOpen),a();b?wa(f,!0):j.isSliding?wa(f,!1):h.slidable&&ma(f,!1);
|
||||
j.noRoom=!1;ha(f);p=j.isShowing;delete j.isShowing;l=!d&&j.isClosed&&"none"!=h.fxName_open;j.isMoving=!0;j.isVisible=!0;j.isClosed=!1;p&&(j.isHidden=!1);l?(Ga(f,!0),n.show(h.fxName_open,h.fxSettings_open,h.fxSpeed_open,function(){Ga(f,!1);j.isVisible&&g();a()})):(rb(f),g(),a())}})}},Ua=function(a,d){var c=y[a],f=F[a],g=P[a],h=r[a],n=q[a],j=k[a].side,p=h.resizerClass,l=h.togglerClass,u="-"+a;f.css(j,v.inset[j]+ga(a)).removeClass(p+"-closed "+p+u+"-closed").addClass(p+"-open "+p+u+"-open");n.isSliding?
|
||||
f.addClass(p+"-sliding "+p+u+"-sliding"):f.removeClass(p+"-sliding "+p+u+"-sliding");da(0,f);h.resizable&&b.layout.plugins.draggable?f.draggable("enable").css("cursor",h.resizerCursor).attr("title",h.tips.Resize):n.isSliding||f.css("cursor","default");g&&(g.removeClass(l+"-closed "+l+u+"-closed").addClass(l+"-open "+l+u+"-open").attr("title",h.tips.Close),da(0,g),g.children(".content-closed").hide(),g.children(".content-open").css("display","block"));Va(a,!n.isSliding);b.extend(n,R(c));q.initialized&&
|
||||
(qa(),pa(a,!0));if(!d&&(q.initialized||h.triggerEventsOnLoad)&&c.is(":visible"))C("onopen_end",a),n.isShowing&&C("onshow_end",a),q.initialized&&C("onresize_end",a)},sb=function(a){function b(){g.isClosed?g.isMoving||ra(c,!0):wa(c,!0)}if(H()){var d=Ma(a),c=A.call(this,a),g=q[c];a=r[c].slideDelay_open;d&&d.stopImmediatePropagation();g.isClosed&&d&&"mouseenter"===d.type&&0<a?M.set(c+"_openSlider",b,a):b()}},Wa=function(a){function c(){g.isClosed?wa(f,!1):g.isMoving||ja(f)}if(H()){var m=Ma(a),f=A.call(this,
|
||||
a);a=r[f];var g=q[f],h=g.isMoving?1E3:300;!g.isClosed&&!g.isResizing&&("click"===a.slideTrigger_close?c():a.preventQuickSlideClose&&g.isMoving||a.preventPrematureSlideClose&&m&&b.layout.isMouseOverElem(m,y[f])||(m?M.set(f+"_closeSlider",c,d(a.slideDelay_close,h)):c()))}},Ga=function(a,b){var d=y[a],c=q[a],g=r[a],f=r.zIndexes;b?(va(a,{animation:!0,objectsOnly:!0}),d.css({zIndex:f.pane_animate}),"south"==a?d.css({top:v.inset.top+v.innerHeight-d.outerHeight()}):"east"==a&&d.css({left:v.inset.left+v.innerWidth-
|
||||
d.outerWidth()})):(za(),d.css({zIndex:c.isSliding?f.pane_sliding:f.pane_normal}),"south"==a?d.css({top:"auto"}):"east"==a&&!d.css("left").match(/\-99999/)&&d.css({left:"auto"}),G.msie&&(g.fxOpacityFix&&"slide"!=g.fxName_open&&d.css("filter")&&1==d.css("opacity"))&&d[0].style.removeAttribute("filter"))},ma=function(a,b){var d=r[a],c=F[a],g=d.slideTrigger_open.toLowerCase();if(c&&(!b||d.slidable)){g.match(/mouseover/)?g=d.slideTrigger_open="mouseenter":g.match(/(click|dblclick|mouseenter)/)||(g=d.slideTrigger_open=
|
||||
"click");if(d.resizerDblClickToggle&&g.match(/click/))c[b?"unbind":"bind"]("dblclick."+K,na);c[b?"bind":"unbind"](g+"."+K,sb).css("cursor",b?d.sliderCursor:"default").attr("title",b?d.tips.Slide:"")}},wa=function(a,b){function d(b){M.clear(a+"_closeSlider");b.stopPropagation()}var c=r[a],g=q[a],f=r.zIndexes,h=c.slideTrigger_close.toLowerCase(),j=b?"bind":"unbind",k=y[a],l=F[a];M.clear(a+"_closeSlider");b?(g.isSliding=!0,q.panesSliding[a]=!0,ma(a,!1)):(g.isSliding=!1,delete q.panesSliding[a]);k.css("zIndex",
|
||||
b?f.pane_sliding:f.pane_normal);l.css("zIndex",b?f.pane_sliding+2:f.resizer_normal);h.match(/(click|mouseleave)/)||(h=c.slideTrigger_close="mouseleave");l[j](h,Wa);"mouseleave"===h&&(k[j]("mouseleave."+K,Wa),l[j]("mouseenter."+K,d),k[j]("mouseenter."+K,d));b?"click"===h&&!c.resizable&&(l.css("cursor",b?c.sliderCursor:"default"),l.attr("title",b?c.tips.Close:"")):M.clear(a+"_closeSlider")},ha=function(a,d,c,f){d=r[a];var g=q[a],h=k[a],n=y[a],j=F[a],p="vert"===h.dir,l=!1;if("center"===a||p&&g.noVerticalRoom)(l=
|
||||
0<=g.maxHeight)&&g.noRoom?(rb(a),j&&j.show(),g.isVisible=!0,g.noRoom=!1,p&&(g.noVerticalRoom=!1),eb(a)):!l&&!g.noRoom&&(Ea(a),j&&j.hide(),g.isVisible=!1,g.noRoom=!0);"center"!==a&&(g.minSize<=g.maxSize?(g.size>g.maxSize?ka(a,g.maxSize,c,!0,f):g.size<g.minSize?ka(a,g.minSize,c,!0,f):j&&(g.isVisible&&n.is(":visible"))&&(c=g.size+v.inset[h.side],b.layout.cssNum(j,h.side)!=c&&j.css(h.side,c)),g.noRoom&&(g.wasOpen&&d.closable?d.autoReopen?ra(a,!1,!0,!0):g.noRoom=!1:Fa(a,g.wasOpen,!0,!0))):g.noRoom||(g.noRoom=
|
||||
!0,g.wasOpen=!g.isClosed&&!g.isSliding,g.isClosed||(d.closable?ja(a,!0,!0):Ta(a,!0))))},Ca=function(a,b,d,c,g){if(H()){a=A.call(this,a);var f=r[a],h=q[a];g=g||f.livePaneResizing&&!h.isResizing;h.autoResize=!1;ka(a,b,d,c,g)}},ka=function(e,c,f,h,g){function j(){for(var a="width"===ua?l.outerWidth():l.outerHeight(),a=[{pane:n,count:1,target:c,actual:a,correct:c===a,attempt:c,cssSize:D}],e=a[0],h={},t="Inaccurate size after resizing the "+n+"-pane.";!e.correct;){h={pane:n,count:e.count+1,target:c};h.attempt=
|
||||
e.actual>c?d(0,e.attempt-(e.actual-c)):d(0,e.attempt+(c-e.actual));h.cssSize=("horz"==k[n].dir?O:Q)(y[n],h.attempt);l.css(ua,h.cssSize);h.actual="width"==ua?l.outerWidth():l.outerHeight();h.correct=c===h.actual;1===a.length&&(ca(t,!1,!0),ca(e,!1,!0));ca(h,!1,!0);if(3<a.length)break;a.push(h);e=a[a.length-1]}J.size=c;b.extend(J,R(l));J.isVisible&&l.is(":visible")&&(x&&x.css(B,c+v.inset[B]),pa(n));!f&&(!Z&&q.initialized&&J.isVisible)&&C("onresize_end",n);f||(J.isSliding||ia("horz"==k[n].dir?"":"center",
|
||||
Z,g),qa());e=k.oppositeEdge[n];c<G&&q[e].noRoom&&(Y(e),ha(e,!1,f));1<a.length&&ca(t+"\nSee the Error Console for details.",!0,!0)}if(H()){var n=A.call(this,e),p=r[n],J=q[n],l=y[n],x=F[n],B=k[n].side,ua=k[n].sizeType.toLowerCase(),Z=J.isResizing&&!p.triggerEventsDuringLiveResize,z=!0!==h&&p.animatePaneSizing,G,D;u.queue(function(e){Y(n);G=J.size;c=fa(n,c);c=d(c,fa(n,p.minSize));c=a(c,J.maxSize);if(c<J.minSize)e(),ha(n,!1,f);else{if(!g&&c===G)return e();J.newSize=c;!f&&(q.initialized&&J.isVisible)&&
|
||||
C("onresize_start",n);D=("horz"==k[n].dir?O:Q)(y[n],c);if(z&&l.is(":visible")){var h=b.layout.effects.size[n]||b.layout.effects.size.all,h=p.fxSettings_size.easing||h.easing,v=r.zIndexes,u={};u[ua]=D+"px";J.isMoving=!0;l.css({zIndex:v.pane_animate}).show().animate(u,p.fxSpeed_size,h,function(){l.css({zIndex:J.isSliding?v.pane_sliding:v.pane_normal});J.isMoving=!1;delete J.newSize;j();e()})}else l.css(ua,D),delete J.newSize,l.is(":visible")?j():(J.size=c,b.extend(J,R(l))),e()}})}},ia=function(a,c,
|
||||
f){a=(a?a:"east,west,center").split(",");b.each(a,function(a,e){if(y[e]){var h=r[e],j=q[e],k=y[e],p=!0,l={},u=b.layout.showInvisibly(k),B={top:ga("north",!0),bottom:ga("south",!0),left:ga("west",!0),right:ga("east",!0),width:0,height:0};B.width=v.innerWidth-B.left-B.right;B.height=v.innerHeight-B.bottom-B.top;B.top+=v.inset.top;B.bottom+=v.inset.bottom;B.left+=v.inset.left;B.right+=v.inset.right;b.extend(j,R(k));if("center"===e){if(!f&&j.isVisible&&B.width===j.outerWidth&&B.height===j.outerHeight)return k.css(u),
|
||||
!0;b.extend(j,ya(e),{maxWidth:B.width,maxHeight:B.height});l=B;j.newWidth=l.width;j.newHeight=l.height;l.width=Q(k,l.width);l.height=O(k,l.height);p=0<=l.width&&0<=l.height;if(!q.initialized&&h.minWidth>B.width){var h=h.minWidth-j.outerWidth,B=r.east.minSize||0,x=r.west.minSize||0,Z=q.east.size,z=q.west.size,A=Z,D=z;0<h&&(q.east.isVisible&&Z>B)&&(A=d(Z-B,Z-h),h-=Z-A);0<h&&(q.west.isVisible&&z>x)&&(D=d(z-x,z-h),h-=z-D);if(0===h){Z&&Z!=B&&ka("east",A,!0,!0,f);z&&z!=x&&ka("west",D,!0,!0,f);ia("center",
|
||||
c,f);k.css(u);return}}}else{j.isVisible&&!j.noVerticalRoom&&b.extend(j,R(k),ya(e));if(!f&&!j.noVerticalRoom&&B.height===j.outerHeight)return k.css(u),!0;l.top=B.top;l.bottom=B.bottom;j.newSize=B.height;l.height=O(k,B.height);j.maxHeight=l.height;p=0<=j.maxHeight;p||(j.noVerticalRoom=!0)}p?(!c&&q.initialized&&C("onresize_start",e),k.css(l),"center"!==e&&qa(e),j.noRoom&&(!j.isClosed&&!j.isHidden)&&ha(e),j.isVisible&&(b.extend(j,R(k)),q.initialized&&pa(e))):!j.noRoom&&j.isVisible&&ha(e);k.css(u);delete j.newSize;
|
||||
delete j.newWidth;delete j.newHeight;if(!j.isVisible)return!0;"center"===e&&(j=G.isIE6||!G.boxModel,y.north&&(j||"IFRAME"==q.north.tagName)&&y.north.css("width",Q(y.north,v.innerWidth)),y.south&&(j||"IFRAME"==q.south.tagName)&&y.south.css("width",Q(y.south,v.innerWidth)));!c&&q.initialized&&C("onresize_end",e)}})},oa=function(a){A(a);if(u.is(":visible"))if(q.initialized){if(!0===a&&b.isPlainObject(r.outset)&&u.css(r.outset),b.extend(v,R(u,r.inset)),v.outerHeight){!0===a&&ob();if(!1===C("onresizeall_start"))return!1;
|
||||
var d,c,f;b.each(["south","north","east","west"],function(a,b){y[b]&&(c=r[b],f=q[b],f.autoResize&&f.size!=c.size?ka(b,c.size,!0,!0,!0):(Y(b),ha(b,!1,!0,!0)))});ia("",!0,!0);qa();b.each(k.allPanes,function(a,b){(d=y[b])&&q[b].isVisible&&C("onresize_end",b)});C("onresizeall_end")}}else Aa()},db=function(a,d){var c=A.call(this,a);r[c].resizeChildren&&(d||Ba(c),c=ba[c],b.isPlainObject(c)&&b.each(c,function(a,b){b.destroyed||b.resizeAll()}))},pa=function(a,c){if(H()){var h=A.call(this,a),h=h?h.split(","):
|
||||
k.allPanes;b.each(h,function(a,e){function h(a){return d(u.css.paddingBottom,parseInt(a.css("marginBottom"),10)||0)}function j(){var a=r[e].contentIgnoreSelector,a=p.nextAll().not(".ui-layout-mask").not(a||":lt(0)"),b=a.filter(":visible"),d=b.filter(":last");v={top:p[0].offsetTop,height:p.outerHeight(),numFooters:a.length,hiddenFooters:a.length-b.length,spaceBelow:0};v.spaceAbove=v.top;v.bottom=v.top+v.height;v.spaceBelow=d.length?d[0].offsetTop+d.outerHeight()-v.bottom+h(d):h(p)}var m=y[e],p=U[e],
|
||||
l=r[e],u=q[e],v=u.content;if(!m||!p||!m.is(":visible"))return!0;if(!p.length&&(Sa(e,!1),!p))return;if(!1!==C("onsizecontent_start",e)){if(!u.isMoving&&!u.isResizing||l.liveContentResizing||c||void 0==v.top)j(),0<v.hiddenFooters&&"hidden"===m.css("overflow")&&(m.css("overflow","visible"),j(),m.css("overflow","hidden"));m=u.innerHeight-(v.spaceAbove-u.css.paddingTop)-(v.spaceBelow-u.css.paddingBottom);if(!p.is(":visible")||v.height!=m){var x=p,l=x;f(x)?l=y[x]:x.jquery||(l=b(x));x=O(l,m);l.css({height:x,
|
||||
visibility:"visible"});0<x&&0<l.innerWidth()?l.data("autoHidden")&&(l.show().data("autoHidden",!1),G.mozilla||l.css(k.hidden).css(k.visible)):l.data("autoHidden")||l.hide().data("autoHidden",!0);v.height=m}q.initialized&&C("onsizecontent_end",e)}})}},qa=function(a){a=(a=A.call(this,a))?a.split(","):k.borderPanes;b.each(a,function(a,d){var e=r[d],g=q[d],h=y[d],j=F[d],p=P[d],u;if(h&&j){var l=k[d].dir,x=g.isClosed?"_closed":"_open",B=e["spacing"+x],z=e["togglerAlign"+x],x=e["togglerLength"+x],A;if(0===
|
||||
B)j.hide();else{!g.noRoom&&!g.isHidden&&j.show();"horz"===l?(A=v.innerWidth,g.resizerLength=A,h=b.layout.cssNum(h,"left"),j.css({width:Q(j,A),height:O(j,B),left:-9999<h?h:v.inset.left})):(A=h.outerHeight(),g.resizerLength=A,j.css({height:O(j,A),width:Q(j,B),top:v.inset.top+ga("north",!0)}));da(e,j);if(p){if(0===x||g.isSliding&&e.hideTogglerOnSlide){p.hide();return}p.show();if(!(0<x)||"100%"===x||x>A)x=A,z=0;else if(f(z))switch(z){case "top":case "left":z=0;break;case "bottom":case "right":z=A-x;break;
|
||||
default:z=c((A-x)/2)}else h=parseInt(z,10),z=0<=z?h:A-x+h;if("horz"===l){var D=Q(p,x);p.css({width:D,height:O(p,B),left:z,top:0});p.children(".content").each(function(){u=b(this);u.css("marginLeft",c((D-u.outerWidth())/2))})}else{var C=O(p,x);p.css({height:C,width:Q(p,B),top:z,left:0});p.children(".content").each(function(){u=b(this);u.css("marginTop",c((C-u.outerHeight())/2))})}da(0,p)}if(!q.initialized&&(e.initHidden||g.isHidden))j.hide(),p&&p.hide()}}})},pb=function(a){if(H()){var b=A.call(this,
|
||||
a);a=P[b];var d=r[b];a&&(d.closable=!0,a.bind("click."+K,function(a){a.stopPropagation();na(b)}).css("visibility","visible").css("cursor","pointer").attr("title",q[b].isClosed?d.tips.Open:d.tips.Close).show())}},Va=function(a,d){b.layout.plugins.buttons&&b.each(q[a].pins,function(c,f){b.layout.buttons.setPinState(z,b(f),a,d)})},u=b(this).eq(0);if(!u.length)return ca(r.errors.containerMissing);if(u.data("layoutContainer")&&u.data("layout"))return u.data("layout");var y={},U={},F={},P={},ea=b([]),v=
|
||||
q.container,K=q.id,z={options:r,state:q,container:u,panes:y,contents:U,resizers:F,togglers:P,hide:Ta,show:Fa,toggle:na,open:ra,close:ja,slideOpen:sb,slideClose:Wa,slideToggle:function(a){a=A.call(this,a);na(a,!0)},setSizeLimits:Y,_sizePane:ka,sizePane:Ca,sizeContent:pa,swapPanes:function(a,c){function f(a){var d=y[a],c=U[a];return!d?!1:{pane:a,P:d?d[0]:!1,C:c?c[0]:!1,state:b.extend(!0,{},q[a]),options:b.extend(!0,{},r[a])}}function h(a,c){if(a){var e=a.P,f=a.C,g=a.pane,j=k[c],m=b.extend(!0,{},q[c]),
|
||||
n=r[c],w={resizerCursor:n.resizerCursor};b.each(["fxName","fxSpeed","fxSettings"],function(a,b){w[b+"_open"]=n[b+"_open"];w[b+"_close"]=n[b+"_close"];w[b+"_size"]=n[b+"_size"]});y[c]=b(e).data({layoutPane:z[c],layoutEdge:c}).css(k.hidden).css(j.cssReq);U[c]=f?b(f):!1;r[c]=b.extend(!0,{},a.options,w);q[c]=b.extend(!0,{},a.state);e.className=e.className.replace(RegExp(n.paneClass+"-"+g,"g"),n.paneClass+"-"+c);Pa(c);j.dir!=k[g].dir?(e=p[c]||0,Y(c),e=d(e,q[c].minSize),Ca(c,e,!0,!0)):F[c].css(j.side,v.inset[j.side]+
|
||||
(q[c].isVisible?ga(c):0));a.state.isVisible&&!m.isVisible?Ua(c,!0):(Da(c),ma(c,!0));a=null}}if(H()){var g=A.call(this,a);q[g].edge=c;q[c].edge=g;if(!1===C("onswap_start",g)||!1===C("onswap_start",c))q[g].edge=g,q[c].edge=c;else{var j=f(g),n=f(c),p={};p[g]=j?j.state.size:0;p[c]=n?n.state.size:0;y[g]=!1;y[c]=!1;q[g]={};q[c]={};P[g]&&P[g].remove();P[c]&&P[c].remove();F[g]&&F[g].remove();F[c]&&F[c].remove();F[g]=F[c]=P[g]=P[c]=!1;h(j,c);h(n,g);j=n=p=null;y[g]&&y[g].css(k.visible);y[c]&&y[c].css(k.visible);
|
||||
oa();C("onswap_end",g);C("onswap_end",c)}}},showMasks:va,hideMasks:za,initContent:Sa,addPane:ib,removePane:Ra,createChildren:Qa,refreshChildren:Ba,enableClosable:pb,disableClosable:function(a,b){if(H()){var c=A.call(this,a),d=P[c];d&&(r[c].closable=!1,q[c].isClosed&&ra(c,!1,!0),d.unbind("."+K).css("visibility",b?"hidden":"visible").css("cursor","default").attr("title",""))}},enableSlidable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&b.data("draggable")&&(r[a].slidable=!0,q[a].isClosed&&ma(a,
|
||||
!0))}},disableSlidable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&(r[a].slidable=!1,q[a].isSliding?ja(a,!1,!0):(ma(a,!1),b.css("cursor","default").attr("title",""),da(null,b[0])))}},enableResizable:function(a){if(H()){a=A.call(this,a);var b=F[a],c=r[a];b&&b.data("draggable")&&(c.resizable=!0,b.draggable("enable"),q[a].isClosed||b.css("cursor",c.resizerCursor).attr("title",c.tips.Resize))}},disableResizable:function(a){if(H()){a=A.call(this,a);var b=F[a];b&&b.data("draggable")&&(r[a].resizable=
|
||||
!1,b.draggable("disable").css("cursor","default").attr("title",""),da(null,b[0]))}},allowOverflow:x,resetOverflow:X,destroy:function(a,c){b(window).unbind("."+K);b(document).unbind("."+K);"object"===typeof a?A(a):c=a;u.clearQueue().removeData("layout").removeData("layoutContainer").removeClass(r.containerClass).unbind("."+K);ea.remove();b.each(k.allPanes,function(a,b){Ra(b,!1,!0,c)});u.data("layoutCSS")&&!u.data("layoutRole")&&u.css(u.data("layoutCSS")).removeData("layoutCSS");"BODY"===v.tagName&&
|
||||
(u=b("html")).data("layoutCSS")&&u.css(u.data("layoutCSS")).removeData("layoutCSS");j(z,b.layout.onDestroy);mb();for(var d in z)d.match(/^(container|options)$/)||delete z[d];z.destroyed=!0;return z},initPanes:H,resizeAll:oa,runCallbacks:C,hasParentLayout:!1,children:ba,north:!1,south:!1,west:!1,east:!1,center:!1},Xa;var V,Ya,N,Ha,la,sa,W;h=b.layout.transformData(h,!0);h=b.layout.backwardCompatibility.renameAllOptions(h);if(!b.isEmptyObject(h.panes)){V=b.layout.optionsMap.noDefault;la=0;for(sa=V.length;la<
|
||||
sa;la++)N=V[la],delete h.panes[N];V=b.layout.optionsMap.layout;la=0;for(sa=V.length;la<sa;la++)N=V[la],delete h.panes[N]}V=b.layout.optionsMap.layout;var Bb=b.layout.config.optionRootKeys;for(N in h)Ha=h[N],0>b.inArray(N,Bb)&&0>b.inArray(N,V)&&(h.panes[N]||(h.panes[N]=b.isPlainObject(Ha)?b.extend(!0,{},Ha):Ha),delete h[N]);b.extend(!0,r,h);b.each(k.allPanes,function(a,c){k[c]=b.extend(!0,{},k.panes,k[c]);Ya=r.panes;W=r[c];if("center"===c){V=b.layout.optionsMap.center;a=0;for(sa=V.length;a<sa;a++)if(N=
|
||||
V[a],!h.center[N]&&(h.panes[N]||!W[N]))W[N]=Ya[N]}else{W=r[c]=b.extend(!0,{},Ya,W);var d=r[c],f=r.panes;d.fxSettings||(d.fxSettings={});f.fxSettings||(f.fxSettings={});b.each(["_open","_close","_size"],function(a,e){var h="fxName"+e,j="fxSpeed"+e,k="fxSettings"+e,l=d[h]=d[h]||f[h]||d.fxName||f.fxName||"none",p=b.effects&&(b.effects[l]||b.effects.effect&&b.effects.effect[l]);if("none"===l||!r.effects[l]||!p)l=d[h]="none";l=r.effects[l]||{};h=l.all||null;l=l[c]||null;d[j]=d[j]||f[j]||d.fxSpeed||f.fxSpeed||
|
||||
null;d[k]=b.extend(!0,{},h,l,f.fxSettings,d.fxSettings,f[k],d[k])});delete d.fxName;delete d.fxSpeed;delete d.fxSettings;W.resizerClass||(W.resizerClass="ui-layout-resizer");W.togglerClass||(W.togglerClass="ui-layout-toggler")}W.paneClass||(W.paneClass="ui-layout-pane")});var Ia=h.zIndex,xa=r.zIndexes;0<Ia&&(xa.pane_normal=Ia,xa.content_mask=d(Ia+1,xa.content_mask),xa.resizer_normal=d(Ia+2,xa.resizer_normal));delete r.panes;var Cb=r,tb=q;tb.creatingLayout=!0;j(z,b.layout.onCreate);if(!1===C("onload_start"))Xa=
|
||||
"cancel";else{var Za=u[0],$=b("html"),ub=v.tagName=Za.tagName,vb=v.id=Za.id,wb=v.className=Za.className,L=r,Ja=L.name,$a={},Ka=u.data("parentLayout"),La=u.data("layoutEdge"),ab=Ka&&La,ta=b.layout.cssNum,bb,aa;v.selector=u.selector.split(".slice")[0];v.ref=(L.name?L.name+" layout / ":"")+ub+(vb?"#"+vb:wb?".["+wb+"]":"");v.isBody="BODY"===ub;!ab&&!v.isBody&&(bb=u.closest("."+b.layout.defaults.panes.paneClass),Ka=bb.data("parentLayout"),La=bb.data("layoutEdge"),ab=Ka&&La);u.data({layout:z,layoutContainer:K}).addClass(L.containerClass);
|
||||
var xb={destroy:"",initPanes:"",resizeAll:"resizeAll",resize:"resizeAll"};for(Ja in xb)u.bind("layout"+Ja.toLowerCase()+"."+K,z[xb[Ja]||Ja]);ab&&(z.hasParentLayout=!0,Ka.refreshChildren(La,z));u.data("layoutCSS")||(v.isBody?(u.data("layoutCSS",b.extend(D(u,"position,margin,padding,border"),{height:u.css("height"),overflow:u.css("overflow"),overflowX:u.css("overflowX"),overflowY:u.css("overflowY")})),$.data("layoutCSS",b.extend(D($,"padding"),{height:"auto",overflow:$.css("overflow"),overflowX:$.css("overflowX"),
|
||||
overflowY:$.css("overflowY")}))):u.data("layoutCSS",D(u,"position,margin,padding,border,top,bottom,left,right,width,height,overflow,overflowX,overflowY")));try{$a={overflow:"hidden",overflowX:"hidden",overflowY:"hidden"};u.css($a);L.inset&&!b.isPlainObject(L.inset)&&(aa=parseInt(L.inset,10)||0,L.inset={top:aa,bottom:aa,left:aa,right:aa});if(v.isBody)L.outset?b.isPlainObject(L.outset)||(aa=parseInt(L.outset,10)||0,L.outset={top:aa,bottom:aa,left:aa,right:aa}):L.outset={top:ta($,"paddingTop"),bottom:ta($,
|
||||
"paddingBottom"),left:ta($,"paddingLeft"),right:ta($,"paddingRight")},$.css($a).css({height:"100%",border:"none",padding:0,margin:0}),G.isIE6?(u.css({width:"100%",height:"100%",border:"none",padding:0,margin:0,position:"relative"}),L.inset||(L.inset=R(u).inset)):(u.css({width:"auto",height:"auto",margin:0,position:"absolute"}),u.css(L.outset)),b.extend(v,R(u,L.inset));else{var yb=u.css("position");(!yb||!yb.match(/(fixed|absolute|relative)/))&&u.css("position","relative");u.is(":visible")&&(b.extend(v,
|
||||
R(u,L.inset)),1>v.innerHeight&&ca(L.errors.noContainerHeight.replace(/CONTAINER/,v.ref)))}ta(u,"minWidth")&&u.parent().css("overflowX","auto");ta(u,"minHeight")&&u.parent().css("overflowY","auto")}catch(Db){}nb();b(window).bind("unload."+K,mb);j(z,b.layout.onLoad);Cb.initPanes&&Aa();delete tb.creatingLayout;Xa=q.initialized}return"cancel"===Xa?null:z}})(jQuery);
|
||||
(function(b){b.ui||(b.ui={});b.ui.cookie={acceptsCookies:!!navigator.cookieEnabled,read:function(a){for(var d=document.cookie,d=d?d.split(";"):[],c,f=0,j=d.length;f<j;f++)if(c=b.trim(d[f]).split("="),c[0]==a)return decodeURIComponent(c[1]);return null},write:function(a,d,c){var f="",j="",h=!1;c=c||{};var p=c.expires||null,x=b.type(p);"date"===x?j=p:"string"===x&&0<p&&(p=parseInt(p,10),x="number");"number"===x&&(j=new Date,0<p?j.setDate(j.getDate()+p):(j.setFullYear(1970),h=!0));j&&(f+=";expires="+
|
||||
j.toUTCString());c.path&&(f+=";path="+c.path);c.domain&&(f+=";domain="+c.domain);c.secure&&(f+=";secure");document.cookie=a+"="+(h?"":encodeURIComponent(d))+f},clear:function(a){b.ui.cookie.write(a,"",{expires:-1})}};b.cookie||(b.cookie=function(a,d,c){var f=b.ui.cookie;if(null===d)f.clear(a);else{if(void 0===d)return f.read(a);f.write(a,d,c)}});b.layout.plugins.stateManagement=!0;b.layout.config.optionRootKeys.push("stateManagement");b.layout.defaults.stateManagement={enabled:!1,autoSave:!0,autoLoad:!0,
|
||||
animateLoad:!0,includeChildren:!0,stateKeys:"north.size,south.size,east.size,west.size,north.isClosed,south.isClosed,east.isClosed,west.isClosed,north.isHidden,south.isHidden,east.isHidden,west.isHidden",cookie:{name:"",domain:"",path:"",expires:"",secure:!1}};b.layout.optionsMap.layout.push("stateManagement");b.layout.state={saveCookie:function(a,d,c){var f=a.options,j=f.stateManagement;c=b.extend(!0,{},j.cookie,c||null);a=a.state.stateData=a.readState(d||j.stateKeys);b.ui.cookie.write(c.name||f.name||
|
||||
"Layout",b.layout.state.encodeJSON(a),c);return b.extend(!0,{},a)},deleteCookie:function(a){a=a.options;b.ui.cookie.clear(a.stateManagement.cookie.name||a.name||"Layout")},readCookie:function(a){a=a.options;return(a=b.ui.cookie.read(a.stateManagement.cookie.name||a.name||"Layout"))?b.layout.state.decodeJSON(a):{}},loadCookie:function(a){var d=b.layout.state.readCookie(a);d&&(a.state.stateData=b.extend(!0,{},d),a.loadState(d));return d},loadState:function(a,d,c){if(b.isPlainObject(d)&&!b.isEmptyObject(d))if(d=
|
||||
a.state.stateData=b.layout.transformData(d),c=b.extend({animateLoad:!1,includeChildren:a.options.stateManagement.includeChildren},c),a.state.initialized){var f=!c.animateLoad,j,h,p,x;b.each(b.layout.config.borderPanes,function(c,G){S=d[G];b.isPlainObject(S)&&(s=S.size,j=S.initClosed,h=S.initHidden,ar=S.autoResize,p=a.state[G],x=p.isVisible,ar&&(p.autoResize=ar),x||a._sizePane(G,s,!1,!1,!1),!0===h?a.hide(G,f):!0===j?a.close(G,!1,f):!1===j?a.open(G,!1,f):!1===h&&a.show(G,!1,f),x&&a._sizePane(G,s,!1,
|
||||
!1,f))});if(c.includeChildren){var I,T;b.each(a.children,function(a,c){(I=d[a]?d[a].children:0)&&c&&b.each(c,function(a,b){T=I[a];b&&T&&b.loadState(T)})})}}else{var S=b.extend(!0,{},d);b.each(b.layout.config.allPanes,function(a,b){S[b]&&delete S[b].children});b.extend(!0,a.options,S)}},readState:function(a,d){"string"===b.type(d)&&(d={keys:d});d||(d={});var c=a.options.stateManagement,f=d.includeChildren,f=void 0!==f?f:c.includeChildren,c=d.stateKeys||c.stateKeys,j={isClosed:"initClosed",isHidden:"initHidden"},
|
||||
h=a.state,p=b.layout.config.allPanes,x={},I,T,S,X,G,k;b.isArray(c)&&(c=c.join(","));for(var c=c.replace(/__/g,".").split(","),Q=0,O=c.length;Q<O;Q++)I=c[Q].split("."),T=I[0],I=I[1],0>b.inArray(T,p)||(S=h[T][I],void 0!=S&&("isClosed"==I&&h[T].isSliding&&(S=!0),(x[T]||(x[T]={}))[j[I]?j[I]:I]=S));f&&b.each(p,function(c,d){G=a.children[d];X=h.stateData[d];b.isPlainObject(G)&&!b.isEmptyObject(G)&&(k=x[d]||(x[d]={}),k.children||(k.children={}),b.each(G,function(a,c){c.state.initialized?k.children[a]=b.layout.state.readState(c):
|
||||
X&&(X.children&&X.children[a])&&(k.children[a]=b.extend(!0,{},X.children[a]))}))});return x},encodeJSON:function(a){function d(a){var f=[],j=0,h,p,x,I=b.isArray(a);for(h in a)p=a[h],x=typeof p,"string"==x?p='"'+p+'"':"object"==x&&(p=d(p)),f[j++]=(!I?'"'+h+'":':"")+p;return(I?"[":"{")+f.join(",")+(I?"]":"}")}return d(a)},decodeJSON:function(a){try{return b.parseJSON?b.parseJSON(a):window.eval("("+a+")")||{}}catch(d){return{}}},_create:function(a){var d=b.layout.state,c=a.options.stateManagement;b.extend(a,
|
||||
{readCookie:function(){return d.readCookie(a)},deleteCookie:function(){d.deleteCookie(a)},saveCookie:function(b,c){return d.saveCookie(a,b,c)},loadCookie:function(){return d.loadCookie(a)},loadState:function(b,c){d.loadState(a,b,c)},readState:function(b){return d.readState(a,b)},encodeJSON:d.encodeJSON,decodeJSON:d.decodeJSON});a.state.stateData={};if(c.autoLoad)if(b.isPlainObject(c.autoLoad))b.isEmptyObject(c.autoLoad)||a.loadState(c.autoLoad);else if(c.enabled)if(b.isFunction(c.autoLoad)){var f=
|
||||
{};try{f=c.autoLoad(a,a.state,a.options,a.options.name||"")}catch(j){}f&&(b.isPlainObject(f)&&!b.isEmptyObject(f))&&a.loadState(f)}else a.loadCookie()},_unload:function(a){var d=a.options.stateManagement;if(d.enabled&&d.autoSave)if(b.isFunction(d.autoSave))try{d.autoSave(a,a.state,a.options,a.options.name||"")}catch(c){}else a.saveCookie()}};b.layout.onCreate.push(b.layout.state._create);b.layout.onUnload.push(b.layout.state._unload);b.layout.plugins.buttons=!0;b.layout.defaults.autoBindCustomButtons=
|
||||
!1;b.layout.optionsMap.layout.push("autoBindCustomButtons");b.layout.buttons={init:function(a){var d=a.options.name||"",c;b.each("toggle open close pin toggle-slide open-slide".split(" "),function(f,j){b.each(b.layout.config.borderPanes,function(f,p){b(".ui-layout-button-"+j+"-"+p).each(function(){c=b(this).data("layoutName")||b(this).attr("layoutName");(void 0==c||c===d)&&a.bindButton(this,j,p)})})})},get:function(a,d,c,f){var j=b(d);a=a.options;var h=a.errors.addButtonError;j.length?0>b.inArray(c,
|
||||
b.layout.config.borderPanes)?(b.layout.msg(h+" "+a.errors.pane+": "+c,!0),j=b("")):(d=a[c].buttonClass+"-"+f,j.addClass(d+" "+d+"-"+c).data("layoutName",a.name)):b.layout.msg(h+" "+a.errors.selector+": "+d,!0);return j},bind:function(a,d,c,f){var j=b.layout.buttons;switch(c.toLowerCase()){case "toggle":j.addToggle(a,d,f);break;case "open":j.addOpen(a,d,f);break;case "close":j.addClose(a,d,f);break;case "pin":j.addPin(a,d,f);break;case "toggle-slide":j.addToggle(a,d,f,!0);break;case "open-slide":j.addOpen(a,
|
||||
d,f,!0)}return a},addToggle:function(a,d,c,f){b.layout.buttons.get(a,d,c,"toggle").click(function(b){a.toggle(c,!!f);b.stopPropagation()});return a},addOpen:function(a,d,c,f){b.layout.buttons.get(a,d,c,"open").attr("title",a.options[c].tips.Open).click(function(b){a.open(c,!!f);b.stopPropagation()});return a},addClose:function(a,d,c){b.layout.buttons.get(a,d,c,"close").attr("title",a.options[c].tips.Close).click(function(b){a.close(c);b.stopPropagation()});return a},addPin:function(a,d,c){var f=b.layout.buttons,
|
||||
j=f.get(a,d,c,"pin");if(j.length){var h=a.state[c];j.click(function(d){f.setPinState(a,b(this),c,h.isSliding||h.isClosed);h.isSliding||h.isClosed?a.open(c):a.close(c);d.stopPropagation()});f.setPinState(a,j,c,!h.isClosed&&!h.isSliding);h.pins.push(d)}return a},setPinState:function(a,b,c,f){var j=b.attr("pin");if(!(j&&f===("down"==j))){a=a.options[c];var j=a.buttonClass+"-pin",h=j+"-"+c;c=j+"-up "+h+"-up";j=j+"-down "+h+"-down";b.attr("pin",f?"down":"up").attr("title",f?a.tips.Unpin:a.tips.Pin).removeClass(f?
|
||||
c:j).addClass(f?j:c)}},syncPinBtns:function(a,d,c){b.each(a.state[d].pins,function(f,j){b.layout.buttons.setPinState(a,b(j),d,c)})},_load:function(a){var d=b.layout.buttons;b.extend(a,{bindButton:function(b,c,h){return d.bind(a,b,c,h)},addToggleBtn:function(b,c,h){return d.addToggle(a,b,c,h)},addOpenBtn:function(b,c,h){return d.addOpen(a,b,c,h)},addCloseBtn:function(b,c){return d.addClose(a,b,c)},addPinBtn:function(b,c){return d.addPin(a,b,c)}});for(var c=0;4>c;c++)a.state[b.layout.config.borderPanes[c]].pins=
|
||||
[];a.options.autoBindCustomButtons&&d.init(a)},_unload:function(){}};b.layout.onLoad.push(b.layout.buttons._load);b.layout.plugins.browserZoom=!0;b.layout.defaults.browserZoomCheckInterval=1E3;b.layout.optionsMap.layout.push("browserZoomCheckInterval");b.layout.browserZoom={_init:function(a){!1!==b.layout.browserZoom.ratio()&&b.layout.browserZoom._setTimer(a)},_setTimer:function(a){if(!a.destroyed){var d=a.options,c=a.state,f=a.hasParentLayout?5E3:Math.max(d.browserZoomCheckInterval,100);setTimeout(function(){if(!a.destroyed&&
|
||||
d.resizeWithWindow){var f=b.layout.browserZoom.ratio();f!==c.browserZoom&&(c.browserZoom=f,a.resizeAll());b.layout.browserZoom._setTimer(a)}},f)}},ratio:function(){function a(a,b){return(100*(parseInt(a,10)/parseInt(b,10))).toFixed()}var d=window,c=screen,f=document,j=f.documentElement||f.body,h=b.layout.browser,p=h.version,x,I,T;return h.msie&&8<p||!h.msie?!1:c.deviceXDPI&&c.systemXDPI?a(c.deviceXDPI,c.systemXDPI):h.webkit&&(x=f.body.getBoundingClientRect)?a(x.left-x.right,f.body.offsetWidth):h.webkit&&
|
||||
(I=d.outerWidth)?a(I,d.innerWidth):(I=c.width)&&(T=j.clientWidth)?a(I,T):!1}};b.layout.onReady.push(b.layout.browserZoom._init)})(jQuery);
|
||||
20
libs/plasio/vendor/jquery.nouislider.min.js
vendored
Normal file
20
libs/plasio/vendor/jquery.nouislider.min.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
(function(f){if(f.zepto&&!f.fn.removeData)throw new ReferenceError("Zepto is loaded without the data module.");f.fn.noUiSlider=function(C,D){function s(a,b){return 100*b/(a[1]-a[0])}function E(a,b){return b*(a[1]-a[0])/100+a[0]}function t(a){return a instanceof f||f.zepto&&f.zepto.isZ(a)}function n(a){return!isNaN(parseFloat(a))&&isFinite(a)}function r(a,b){f.isArray(a)||(a=[a]);f.each(a,function(){"function"===typeof this&&this.call(b)})}function F(a,b){return function(){var c=[null,null];c[b]=f(this).val();
|
||||
a.val(c,!0)}}function G(a,b){a=a.toFixed(b.decimals);0===parseFloat(a)&&(a=a.replace("-0","0"));return a.replace(".",b.serialization.mark)}function u(a){return parseFloat(a.toFixed(7))}function p(a,b,c,d){var e=d.target;a=a.replace(/\s/g,h+" ")+h;b.on(a,function(a){var b=e.attr("disabled");if(e.hasClass("noUi-state-tap")||void 0!==b&&null!==b)return!1;var g;a.preventDefault();var b=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),l=0===a.type.indexOf("pointer"),v,H=a;0===a.type.indexOf("MSPointer")&&
|
||||
(l=!0);a.originalEvent&&(a=a.originalEvent);b&&(g=a.changedTouches[0].pageX,v=a.changedTouches[0].pageY);if(h||l)l||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),g=a.clientX+window.pageXOffset,v=a.clientY+window.pageYOffset;g=f.extend(H,{pointX:g,pointY:v,cursor:h});c(g,d,e.data("base").data("options"))})}function I(a){var b=this.target;if(void 0===a)return this.element.data("value");!0===a?a=this.element.data("value"):
|
||||
this.element.data("value",a);void 0!==a&&f.each(this.elements,function(){if("function"===typeof this)this.call(b,a);else this[0][this[1]](a)})}function J(a,b,c){if(t(b)){var d=[],e=a.data("target");a.data("options").direction&&(c=c?0:1);b.each(function(){f(this).on("change"+h,F(e,c));d.push([f(this),"val"])});return d}"string"===typeof b&&(b=[f('<input type="hidden" name="'+b+'">').appendTo(a).addClass(g[3]).change(function(a){a.stopPropagation()}),"val"]);return[b]}function K(a,b,c){var d=[];f.each(c.to[b],
|
||||
function(e){d=d.concat(J(a,c.to[b][e],b))});return{element:a,elements:d,target:a.data("target"),val:I}}function L(a,b){var c=a.data("target");c.hasClass(g[14])||(b||(c.addClass(g[15]),setTimeout(function(){c.removeClass(g[15])},450)),c.addClass(g[14]),r(a.data("options").h,c))}function w(a,b){var c=a.data("options");b=u(b);a.data("target").removeClass(g[14]);a.css(c.style,b+"%").data("pct",b);a.is(":first-child")&&a.toggleClass(g[13],50<b);c.direction&&(b=100-b);a.data("store").val(G(E(c.range,b),
|
||||
c))}function x(a,b){var c=a.data("base"),d=c.data("options"),c=c.data("handles"),e=0,k=100;if(!n(b))return!1;if(d.step){var m=d.step;b=Math.round(b/m)*m}1<c.length&&(a[0]!==c[0][0]?e=u(c[0].data("pct")+d.margin):k=u(c[1].data("pct")-d.margin));b=Math.min(Math.max(b,e),0>k?100:k);if(b===a.data("pct"))return[e?e:!1,100===k?!1:k];w(a,b);return!0}function A(a,b,c,d){a.addClass(g[5]);setTimeout(function(){a.removeClass(g[5])},300);x(b,c);r(d,a.data("target"));a.data("target").change()}function M(a,b,c){var d=
|
||||
b.a,e=a[b.d]-b.start[b.d],e=100*e/b.size;if(1===d.length){if(a=x(d[0],b.c[0]+e),!0!==a){0<=f.inArray(d[0].data("pct"),a)&&L(b.b,!c.margin);return}}else{var k,m;c.step&&(a=c.step,e=Math.round(e/a)*a);a=k=b.c[0]+e;e=m=b.c[1]+e;0>a?(e+=-1*a,a=0):100<e&&(a-=e-100,e=100);if(0>k&&!a&&!d[0].data("pct")||100===e&&100<m&&100===d[1].data("pct"))return;w(d[0],a);w(d[1],e)}r(c.slide,b.target)}function N(a,b,c){1===b.a.length&&b.a[0].data("grab").removeClass(g[4]);a.cursor&&y.css("cursor","").off(h);z.off(h);
|
||||
b.target.removeClass(g[14]+" "+g[20]).change();r(c.set,b.target)}function B(a,b,c){1===b.a.length&&b.a[0].data("grab").addClass(g[4]);a.stopPropagation();p(q.move,z,M,{start:a,b:b.b,target:b.target,a:b.a,c:[b.a[0].data("pct"),b.a[b.a.length-1].data("pct")],d:c.orientation?"pointY":"pointX",size:c.orientation?b.b.height():b.b.width()});p(q.end,z,N,{target:b.target,a:b.a});a.cursor&&(y.css("cursor",f(a.target).css("cursor")),1<b.a.length&&b.target.addClass(g[20]),y.on("selectstart"+h,function(){return!1}))}
|
||||
function O(a,b,c){b=b.b;var d,e;a.stopPropagation();c.orientation?(a=a.pointY,e=b.height()):(a=a.pointX,e=b.width());d=b.data("handles");var k=a,m=c.style;1===d.length?d=d[0]:(m=d[0].offset()[m]+d[1].offset()[m],d=d[k<m/2?0:1]);a=100*(a-b.offset()[c.style])/e;A(b,d,a,[c.slide,c.set])}function P(a,b,c){var d=b.b.data("handles"),e;e=c.orientation?a.pointY:a.pointX;a=(e=e<b.b.offset()[c.style])?0:100;e=e?0:d.length-1;A(b.b,d[e],a,[c.slide,c.set])}function Q(a,b){function c(a){if(2!==a.length)return!1;
|
||||
a=[parseFloat(a[0]),parseFloat(a[1])];return!n(a[0])||!n(a[1])||a[1]<a[0]?!1:a}var d={f:function(a,b){switch(a){case 1:case 0.1:case 0.01:case 0.001:case 1E-4:case 1E-5:a=a.toString().split(".");b.decimals="1"===a[0]?0:a[1].length;break;case void 0:b.decimals=2;break;default:return!1}return!0},e:function(a,b,c){if(!a)return b[c].mark=".",!0;switch(a){case ".":case ",":return!0;default:return!1}},g:function(a,b,c){function d(a){return t(a)||"string"===typeof a||"function"===typeof a||!1===a||t(a[0])&&
|
||||
"function"===typeof a[0][a[1]]}function g(a){var b=[[],[]];d(a)?b[0].push(a):f.each(a,function(a,e){1<a||(d(e)?b[a].push(e):b[a]=b[a].concat(e))});return b}if(a){var l,h;a=g(a);b.direction&&a[1].length&&a.reverse();for(l=0;l<b.handles;l++)for(h=0;h<a[l].length;h++){if(!d(a[l][h]))return!1;a[l][h]||a[l].splice(h,1)}b[c].to=a}else b[c].to=[[],[]];return!0}};f.each({handles:{r:!0,t:function(a){a=parseInt(a,10);return 1===a||2===a}},range:{r:!0,t:function(a,b,d){b[d]=c(a);return b[d]&&b[d][0]!==b[d][1]}},
|
||||
start:{r:!0,t:function(a,b,d){if(1===b.handles)return f.isArray(a)&&(a=a[0]),a=parseFloat(a),b.start=[a],n(a);b[d]=c(a);return!!b[d]}},connect:{r:!0,t:function(a,b,c){if("lower"===a)b[c]=1;else if("upper"===a)b[c]=2;else if(!0===a)b[c]=3;else if(!1===a)b[c]=0;else return!1;return!0}},orientation:{t:function(a,b,c){switch(a){case "horizontal":b[c]=0;break;case "vertical":b[c]=1;break;default:return!1}return!0}},margin:{r:!0,t:function(a,b,c){a=parseFloat(a);b[c]=s(b.range,a);return n(a)}},direction:{r:!0,
|
||||
t:function(a,b,c){switch(a){case "ltr":b[c]=0;break;case "rtl":b[c]=1;b.connect=[0,2,1,3][b.connect];break;default:return!1}return!0}},behaviour:{r:!0,t:function(a,b,c){b[c]={tap:a!==(a=a.replace("tap","")),extend:a!==(a=a.replace("extend","")),drag:a!==(a=a.replace("drag","")),fixed:a!==(a=a.replace("fixed",""))};return!a.replace("none","").replace(/\-/g,"")}},serialization:{r:!0,t:function(a,b,c){return d.g(a.to,b,c)&&d.f(a.resolution,b)&&d.e(a.mark,b,c)}},slide:{t:function(a){return f.isFunction(a)}},
|
||||
set:{t:function(a){return f.isFunction(a)}},block:{t:function(a){return f.isFunction(a)}},step:{t:function(a,b,c){a=parseFloat(a);b[c]=s(b.range,a);return n(a)}}},function(c,d){var f=a[c],g=void 0!==f;if(d.r&&!g||g&&!d.t(f,a,c))throw console&&console.log&&console.group&&(console.group("Invalid noUiSlider initialisation:"),console.log("Option:\t",c),console.log("Value:\t",f),console.log("Slider(s):\t",b),console.groupEnd()),new RangeError("noUiSlider");})}function R(a){this.data("options",f.extend(!0,
|
||||
{},a));a=f.extend({handles:2,margin:0,connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},a);a.serialization=a.serialization||{};Q(a,this);a.style=a.orientation?"top":"left";return this.each(function(){var b=f(this),c,d=[],e,k=f("<div/>").appendTo(b);if(b.data("base"))throw Error("Slider was already initialized.");b.data("base",k).addClass([g[6],g[16+a.direction],g[10+a.orientation]].join(" "));for(c=0;c<a.handles;c++)e=f("<div><div/></div>").appendTo(k),e.addClass(g[1]),e.children().addClass([g[2],
|
||||
g[2]+g[7+a.direction+(a.direction?-1*c:c)]].join(" ")),e.data({base:k,target:b,options:a,grab:e.children(),pct:-1}).attr("data-style",a.style),e.data({store:K(e,c,a.serialization)}),d.push(e);switch(a.connect){case 1:b.addClass(g[9]);d[0].addClass(g[12]);break;case 3:d[1].addClass(g[12]);case 2:d[0].addClass(g[9]);case 0:b.addClass(g[12])}k.addClass(g[0]).data({target:b,options:a,handles:d});b.val(a.start);if(!a.behaviour.fixed)for(c=0;c<d.length;c++)p(q.start,d[c].children(),B,{b:k,target:b,a:[d[c]]});
|
||||
a.behaviour.tap&&p(q.start,k,O,{b:k,target:b});a.behaviour.extend&&(b.addClass(g[19]),a.behaviour.tap&&p(q.start,b,P,{b:k,target:b}));a.behaviour.drag&&(c=k.find("."+g[9]).addClass(g[18]),a.behaviour.fixed&&(c=c.add(k.children().not(c).data("grab"))),p(q.start,c,B,{b:k,target:b,a:d}))})}function S(){var a=f(this).data("base"),b=[];f.each(a.data("handles"),function(){b.push(f(this).data("store").val())});return 1===b.length?b[0]:a.data("options").direction?b.reverse():b}function T(a,b){f.isArray(a)||
|
||||
(a=[a]);return this.each(function(){var c=f(this).data("base"),d,e=Array.prototype.slice.call(c.data("handles"),0),g=c.data("options");1<e.length&&(e[2]=e[0]);g.direction&&a.reverse();for(c=0;c<e.length;c++)if(d=a[c%2],null!==d&&void 0!==d){"string"===f.type(d)&&(d=d.replace(",","."));var h=g.range;d=parseFloat(d);d=s(h,0>h[0]?d+Math.abs(h[0]):d-h[0]);g.direction&&(d=100-d);!0!==x(e[c],d)&&e[c].data("store").val(!0);!0===b&&r(g.set,f(this))}})}function U(a){var b=[[a,""]];f.each(a.data("base").data("handles"),
|
||||
function(){b=b.concat(f(this).data("store").elements)});f.each(b,function(){1<this.length&&this[0].off(h)});a.removeClass(g.join(" "));a.empty().removeData("base options")}function V(a){return this.each(function(){var b=f(this).val()||!1,c=f(this).data("options"),d=f.extend({},c,a);!1!==b&&U(f(this));a&&(f(this).noUiSlider(d),!1!==b&&d.start===c.start&&f(this).val(b))})}var z=f(document),y=f("body"),h=".nui",W=f.fn.val,g="noUi-base noUi-origin noUi-handle noUi-input noUi-active noUi-state-tap noUi-target -lower -upper noUi-connect noUi-horizontal noUi-vertical noUi-background noUi-stacking noUi-block noUi-state-blocked noUi-ltr noUi-rtl noUi-dragable noUi-extended noUi-state-drag".split(" "),
|
||||
q=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"};f.fn.val=function(){return this.hasClass(g[6])?arguments.length?T.apply(this,arguments):S.apply(this):W.apply(this,arguments)};return(D?V:R).call(this,C)}})(window.jQuery||window.Zepto);
|
||||
6
libs/plasio/vendor/jquery.ui.js
vendored
Normal file
6
libs/plasio/vendor/jquery.ui.js
vendored
Normal file
File diff suppressed because one or more lines are too long
34
libs/plasio/vendor/laz-perf.js
vendored
Normal file
34
libs/plasio/vendor/laz-perf.js
vendored
Normal file
File diff suppressed because one or more lines are too long
792
libs/plasio/vendor/loaders/BinaryLoader.js
vendored
Normal file
792
libs/plasio/vendor/loaders/BinaryLoader.js
vendored
Normal file
@ -0,0 +1,792 @@
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
THREE.BinaryLoader = function ( showStatus ) {
|
||||
|
||||
THREE.Loader.call( this, showStatus );
|
||||
|
||||
};
|
||||
|
||||
THREE.BinaryLoader.prototype = Object.create( THREE.Loader.prototype );
|
||||
|
||||
// Load models generated by slim OBJ converter with BINARY option (converter_obj_three_slim.py -t binary)
|
||||
// - binary models consist of two files: JS and BIN
|
||||
// - parameters
|
||||
// - url (required)
|
||||
// - callback (required)
|
||||
// - texturePath (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
|
||||
// - binaryPath (optional: if not specified, binary file will be assumed to be in the same folder as JS model file)
|
||||
|
||||
THREE.BinaryLoader.prototype.load = function ( url, callback, texturePath, binaryPath, progressCB ) {
|
||||
|
||||
// todo: unify load API to for easier SceneLoader use
|
||||
|
||||
texturePath = texturePath || this.extractUrlBase( url );
|
||||
binaryPath = binaryPath || this.extractUrlBase( url );
|
||||
|
||||
var callbackProgress = progressCB;
|
||||
|
||||
this.onLoadStart();
|
||||
|
||||
// #1 load JS part via web worker
|
||||
|
||||
this.loadAjaxJSON( this, url, callback, texturePath, binaryPath, callbackProgress );
|
||||
|
||||
};
|
||||
|
||||
THREE.BinaryLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, binaryPath, callbackProgress ) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
texturePath = texturePath && ( typeof texturePath === "string" ) ? texturePath : this.extractUrlBase( url );
|
||||
binaryPath = binaryPath && ( typeof binaryPath === "string" ) ? binaryPath : this.extractUrlBase( url );
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
|
||||
if ( xhr.readyState == 4 ) {
|
||||
|
||||
if ( xhr.status == 200 || xhr.status == 0 ) {
|
||||
|
||||
var json = JSON.parse( xhr.responseText );
|
||||
context.loadAjaxBuffers( json, callback, binaryPath, texturePath, callbackProgress );
|
||||
|
||||
} else {
|
||||
|
||||
console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
xhr.open( "GET", url, true );
|
||||
xhr.send( null );
|
||||
|
||||
};
|
||||
|
||||
THREE.BinaryLoader.prototype.loadAjaxBuffers = function ( json, callback, binaryPath, texturePath, callbackProgress ) {
|
||||
|
||||
var xhr = new XMLHttpRequest(),
|
||||
url = binaryPath + json.buffers;
|
||||
|
||||
xhr.addEventListener( 'load', function ( event ) {
|
||||
|
||||
var buffer = xhr.response;
|
||||
|
||||
if ( buffer === undefined ) {
|
||||
|
||||
// IEWEBGL needs this
|
||||
buffer = ( new Uint8Array( xhr.responseBody ) ).buffer;
|
||||
|
||||
}
|
||||
|
||||
if ( buffer.byteLength == 0 ) { // iOS and other XMLHttpRequest level 1
|
||||
|
||||
var buffer = new ArrayBuffer( xhr.responseText.length );
|
||||
|
||||
var bufView = new Uint8Array( buffer );
|
||||
|
||||
for ( var i = 0, l = xhr.responseText.length; i < l; i ++ ) {
|
||||
|
||||
bufView[ i ] = xhr.responseText.charCodeAt( i ) & 0xff;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
THREE.BinaryLoader.prototype.createBinModel( buffer, callback, texturePath, json.materials );
|
||||
|
||||
}, false );
|
||||
|
||||
if ( callbackProgress !== undefined ) {
|
||||
|
||||
xhr.addEventListener( 'progress', function ( event ) {
|
||||
|
||||
if ( event.lengthComputable ) {
|
||||
|
||||
callbackProgress( event );
|
||||
|
||||
}
|
||||
|
||||
}, false );
|
||||
|
||||
}
|
||||
|
||||
xhr.addEventListener( 'error', function ( event ) {
|
||||
|
||||
console.error( "THREE.BinaryLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
|
||||
|
||||
}, false );
|
||||
|
||||
|
||||
xhr.open( "GET", url, true );
|
||||
xhr.responseType = "arraybuffer";
|
||||
if ( xhr.overrideMimeType ) xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
|
||||
xhr.send( null );
|
||||
|
||||
};
|
||||
|
||||
// Binary AJAX parser
|
||||
|
||||
THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texturePath, jsonMaterials ) {
|
||||
|
||||
var Model = function ( texturePath ) {
|
||||
|
||||
var scope = this,
|
||||
currentOffset = 0,
|
||||
md,
|
||||
normals = [],
|
||||
uvs = [],
|
||||
start_tri_flat, start_tri_smooth, start_tri_flat_uv, start_tri_smooth_uv,
|
||||
start_quad_flat, start_quad_smooth, start_quad_flat_uv, start_quad_smooth_uv,
|
||||
tri_size, quad_size,
|
||||
len_tri_flat, len_tri_smooth, len_tri_flat_uv, len_tri_smooth_uv,
|
||||
len_quad_flat, len_quad_smooth, len_quad_flat_uv, len_quad_smooth_uv;
|
||||
|
||||
|
||||
THREE.Geometry.call( this );
|
||||
|
||||
md = parseMetaData( data, currentOffset );
|
||||
|
||||
currentOffset += md.header_bytes;
|
||||
/*
|
||||
md.vertex_index_bytes = Uint32Array.BYTES_PER_ELEMENT;
|
||||
md.material_index_bytes = Uint16Array.BYTES_PER_ELEMENT;
|
||||
md.normal_index_bytes = Uint32Array.BYTES_PER_ELEMENT;
|
||||
md.uv_index_bytes = Uint32Array.BYTES_PER_ELEMENT;
|
||||
*/
|
||||
// buffers sizes
|
||||
|
||||
tri_size = md.vertex_index_bytes * 3 + md.material_index_bytes;
|
||||
quad_size = md.vertex_index_bytes * 4 + md.material_index_bytes;
|
||||
|
||||
len_tri_flat = md.ntri_flat * ( tri_size );
|
||||
len_tri_smooth = md.ntri_smooth * ( tri_size + md.normal_index_bytes * 3 );
|
||||
len_tri_flat_uv = md.ntri_flat_uv * ( tri_size + md.uv_index_bytes * 3 );
|
||||
len_tri_smooth_uv = md.ntri_smooth_uv * ( tri_size + md.normal_index_bytes * 3 + md.uv_index_bytes * 3 );
|
||||
|
||||
len_quad_flat = md.nquad_flat * ( quad_size );
|
||||
len_quad_smooth = md.nquad_smooth * ( quad_size + md.normal_index_bytes * 4 );
|
||||
len_quad_flat_uv = md.nquad_flat_uv * ( quad_size + md.uv_index_bytes * 4 );
|
||||
len_quad_smooth_uv = md.nquad_smooth_uv * ( quad_size + md.normal_index_bytes * 4 + md.uv_index_bytes * 4 );
|
||||
|
||||
// read buffers
|
||||
|
||||
currentOffset += init_vertices( currentOffset );
|
||||
|
||||
currentOffset += init_normals( currentOffset );
|
||||
currentOffset += handlePadding( md.nnormals * 3 );
|
||||
|
||||
currentOffset += init_uvs( currentOffset );
|
||||
|
||||
start_tri_flat = currentOffset;
|
||||
start_tri_smooth = start_tri_flat + len_tri_flat + handlePadding( md.ntri_flat * 2 );
|
||||
start_tri_flat_uv = start_tri_smooth + len_tri_smooth + handlePadding( md.ntri_smooth * 2 );
|
||||
start_tri_smooth_uv = start_tri_flat_uv + len_tri_flat_uv + handlePadding( md.ntri_flat_uv * 2 );
|
||||
|
||||
start_quad_flat = start_tri_smooth_uv + len_tri_smooth_uv + handlePadding( md.ntri_smooth_uv * 2 );
|
||||
start_quad_smooth = start_quad_flat + len_quad_flat + handlePadding( md.nquad_flat * 2 );
|
||||
start_quad_flat_uv = start_quad_smooth + len_quad_smooth + handlePadding( md.nquad_smooth * 2 );
|
||||
start_quad_smooth_uv= start_quad_flat_uv + len_quad_flat_uv + handlePadding( md.nquad_flat_uv * 2 );
|
||||
|
||||
// have to first process faces with uvs
|
||||
// so that face and uv indices match
|
||||
|
||||
init_triangles_flat_uv( start_tri_flat_uv );
|
||||
init_triangles_smooth_uv( start_tri_smooth_uv );
|
||||
|
||||
init_quads_flat_uv( start_quad_flat_uv );
|
||||
init_quads_smooth_uv( start_quad_smooth_uv );
|
||||
|
||||
// now we can process untextured faces
|
||||
|
||||
init_triangles_flat( start_tri_flat );
|
||||
init_triangles_smooth( start_tri_smooth );
|
||||
|
||||
init_quads_flat( start_quad_flat );
|
||||
init_quads_smooth( start_quad_smooth );
|
||||
|
||||
this.computeCentroids();
|
||||
this.computeFaceNormals();
|
||||
|
||||
function handlePadding( n ) {
|
||||
|
||||
return ( n % 4 ) ? ( 4 - n % 4 ) : 0;
|
||||
|
||||
};
|
||||
|
||||
function parseMetaData( data, offset ) {
|
||||
|
||||
var metaData = {
|
||||
|
||||
'signature' :parseString( data, offset, 12 ),
|
||||
'header_bytes' :parseUChar8( data, offset + 12 ),
|
||||
|
||||
'vertex_coordinate_bytes' :parseUChar8( data, offset + 13 ),
|
||||
'normal_coordinate_bytes' :parseUChar8( data, offset + 14 ),
|
||||
'uv_coordinate_bytes' :parseUChar8( data, offset + 15 ),
|
||||
|
||||
'vertex_index_bytes' :parseUChar8( data, offset + 16 ),
|
||||
'normal_index_bytes' :parseUChar8( data, offset + 17 ),
|
||||
'uv_index_bytes' :parseUChar8( data, offset + 18 ),
|
||||
'material_index_bytes' :parseUChar8( data, offset + 19 ),
|
||||
|
||||
'nvertices' :parseUInt32( data, offset + 20 ),
|
||||
'nnormals' :parseUInt32( data, offset + 20 + 4*1 ),
|
||||
'nuvs' :parseUInt32( data, offset + 20 + 4*2 ),
|
||||
|
||||
'ntri_flat' :parseUInt32( data, offset + 20 + 4*3 ),
|
||||
'ntri_smooth' :parseUInt32( data, offset + 20 + 4*4 ),
|
||||
'ntri_flat_uv' :parseUInt32( data, offset + 20 + 4*5 ),
|
||||
'ntri_smooth_uv' :parseUInt32( data, offset + 20 + 4*6 ),
|
||||
|
||||
'nquad_flat' :parseUInt32( data, offset + 20 + 4*7 ),
|
||||
'nquad_smooth' :parseUInt32( data, offset + 20 + 4*8 ),
|
||||
'nquad_flat_uv' :parseUInt32( data, offset + 20 + 4*9 ),
|
||||
'nquad_smooth_uv' :parseUInt32( data, offset + 20 + 4*10 )
|
||||
|
||||
};
|
||||
/*
|
||||
console.log( "signature: " + metaData.signature );
|
||||
|
||||
console.log( "header_bytes: " + metaData.header_bytes );
|
||||
console.log( "vertex_coordinate_bytes: " + metaData.vertex_coordinate_bytes );
|
||||
console.log( "normal_coordinate_bytes: " + metaData.normal_coordinate_bytes );
|
||||
console.log( "uv_coordinate_bytes: " + metaData.uv_coordinate_bytes );
|
||||
|
||||
console.log( "vertex_index_bytes: " + metaData.vertex_index_bytes );
|
||||
console.log( "normal_index_bytes: " + metaData.normal_index_bytes );
|
||||
console.log( "uv_index_bytes: " + metaData.uv_index_bytes );
|
||||
console.log( "material_index_bytes: " + metaData.material_index_bytes );
|
||||
|
||||
console.log( "nvertices: " + metaData.nvertices );
|
||||
console.log( "nnormals: " + metaData.nnormals );
|
||||
console.log( "nuvs: " + metaData.nuvs );
|
||||
|
||||
console.log( "ntri_flat: " + metaData.ntri_flat );
|
||||
console.log( "ntri_smooth: " + metaData.ntri_smooth );
|
||||
console.log( "ntri_flat_uv: " + metaData.ntri_flat_uv );
|
||||
console.log( "ntri_smooth_uv: " + metaData.ntri_smooth_uv );
|
||||
|
||||
console.log( "nquad_flat: " + metaData.nquad_flat );
|
||||
console.log( "nquad_smooth: " + metaData.nquad_smooth );
|
||||
console.log( "nquad_flat_uv: " + metaData.nquad_flat_uv );
|
||||
console.log( "nquad_smooth_uv: " + metaData.nquad_smooth_uv );
|
||||
|
||||
var total = metaData.header_bytes
|
||||
+ metaData.nvertices * metaData.vertex_coordinate_bytes * 3
|
||||
+ metaData.nnormals * metaData.normal_coordinate_bytes * 3
|
||||
+ metaData.nuvs * metaData.uv_coordinate_bytes * 2
|
||||
+ metaData.ntri_flat * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes )
|
||||
+ metaData.ntri_smooth * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.normal_index_bytes*3 )
|
||||
+ metaData.ntri_flat_uv * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.uv_index_bytes*3 )
|
||||
+ metaData.ntri_smooth_uv * ( metaData.vertex_index_bytes*3 + metaData.material_index_bytes + metaData.normal_index_bytes*3 + metaData.uv_index_bytes*3 )
|
||||
+ metaData.nquad_flat * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes )
|
||||
+ metaData.nquad_smooth * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 )
|
||||
+ metaData.nquad_flat_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.uv_index_bytes*4 )
|
||||
+ metaData.nquad_smooth_uv * ( metaData.vertex_index_bytes*4 + metaData.material_index_bytes + metaData.normal_index_bytes*4 + metaData.uv_index_bytes*4 );
|
||||
console.log( "total bytes: " + total );
|
||||
*/
|
||||
|
||||
return metaData;
|
||||
|
||||
};
|
||||
|
||||
function parseString( data, offset, length ) {
|
||||
|
||||
var charArray = new Uint8Array( data, offset, length );
|
||||
|
||||
var text = "";
|
||||
|
||||
for ( var i = 0; i < length; i ++ ) {
|
||||
|
||||
text += String.fromCharCode( charArray[ offset + i ] );
|
||||
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
};
|
||||
|
||||
function parseUChar8( data, offset ) {
|
||||
|
||||
var charArray = new Uint8Array( data, offset, 1 );
|
||||
|
||||
return charArray[ 0 ];
|
||||
|
||||
};
|
||||
|
||||
function parseUInt32( data, offset ) {
|
||||
|
||||
var intArray = new Uint32Array( data, offset, 1 );
|
||||
|
||||
return intArray[ 0 ];
|
||||
|
||||
};
|
||||
|
||||
function init_vertices( start ) {
|
||||
|
||||
var nElements = md.nvertices;
|
||||
|
||||
var coordArray = new Float32Array( data, start, nElements * 3 );
|
||||
|
||||
var i, x, y, z;
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
x = coordArray[ i * 3 ];
|
||||
y = coordArray[ i * 3 + 1 ];
|
||||
z = coordArray[ i * 3 + 2 ];
|
||||
|
||||
vertex( scope, x, y, z );
|
||||
|
||||
}
|
||||
|
||||
return nElements * 3 * Float32Array.BYTES_PER_ELEMENT;
|
||||
|
||||
};
|
||||
|
||||
function init_normals( start ) {
|
||||
|
||||
var nElements = md.nnormals;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var normalArray = new Int8Array( data, start, nElements * 3 );
|
||||
|
||||
var i, x, y, z;
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
x = normalArray[ i * 3 ];
|
||||
y = normalArray[ i * 3 + 1 ];
|
||||
z = normalArray[ i * 3 + 2 ];
|
||||
|
||||
normals.push( x/127, y/127, z/127 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nElements * 3 * Int8Array.BYTES_PER_ELEMENT;
|
||||
|
||||
};
|
||||
|
||||
function init_uvs( start ) {
|
||||
|
||||
var nElements = md.nuvs;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var uvArray = new Float32Array( data, start, nElements * 2 );
|
||||
|
||||
var i, u, v;
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
u = uvArray[ i * 2 ];
|
||||
v = uvArray[ i * 2 + 1 ];
|
||||
|
||||
uvs.push( u, v );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nElements * 2 * Float32Array.BYTES_PER_ELEMENT;
|
||||
|
||||
};
|
||||
|
||||
function init_uvs3( nElements, offset ) {
|
||||
|
||||
var i, uva, uvb, uvc, u1, u2, u3, v1, v2, v3;
|
||||
|
||||
var uvIndexBuffer = new Uint32Array( data, offset, 3 * nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
uva = uvIndexBuffer[ i * 3 ];
|
||||
uvb = uvIndexBuffer[ i * 3 + 1 ];
|
||||
uvc = uvIndexBuffer[ i * 3 + 2 ];
|
||||
|
||||
u1 = uvs[ uva*2 ];
|
||||
v1 = uvs[ uva*2 + 1 ];
|
||||
|
||||
u2 = uvs[ uvb*2 ];
|
||||
v2 = uvs[ uvb*2 + 1 ];
|
||||
|
||||
u3 = uvs[ uvc*2 ];
|
||||
v3 = uvs[ uvc*2 + 1 ];
|
||||
|
||||
uv3( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3 );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_uvs4( nElements, offset ) {
|
||||
|
||||
var i, uva, uvb, uvc, uvd, u1, u2, u3, u4, v1, v2, v3, v4;
|
||||
|
||||
var uvIndexBuffer = new Uint32Array( data, offset, 4 * nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
uva = uvIndexBuffer[ i * 4 ];
|
||||
uvb = uvIndexBuffer[ i * 4 + 1 ];
|
||||
uvc = uvIndexBuffer[ i * 4 + 2 ];
|
||||
uvd = uvIndexBuffer[ i * 4 + 3 ];
|
||||
|
||||
u1 = uvs[ uva*2 ];
|
||||
v1 = uvs[ uva*2 + 1 ];
|
||||
|
||||
u2 = uvs[ uvb*2 ];
|
||||
v2 = uvs[ uvb*2 + 1 ];
|
||||
|
||||
u3 = uvs[ uvc*2 ];
|
||||
v3 = uvs[ uvc*2 + 1 ];
|
||||
|
||||
u4 = uvs[ uvd*2 ];
|
||||
v4 = uvs[ uvd*2 + 1 ];
|
||||
|
||||
uv4( scope.faceVertexUvs[ 0 ], u1, v1, u2, v2, u3, v3, u4, v4 );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_faces3_flat( nElements, offsetVertices, offsetMaterials ) {
|
||||
|
||||
var i, a, b, c, m;
|
||||
|
||||
var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 3 * nElements );
|
||||
var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
a = vertexIndexBuffer[ i * 3 ];
|
||||
b = vertexIndexBuffer[ i * 3 + 1 ];
|
||||
c = vertexIndexBuffer[ i * 3 + 2 ];
|
||||
|
||||
m = materialIndexBuffer[ i ];
|
||||
|
||||
f3( scope, a, b, c, m );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_faces4_flat( nElements, offsetVertices, offsetMaterials ) {
|
||||
|
||||
var i, a, b, c, d, m;
|
||||
|
||||
var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 4 * nElements );
|
||||
var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
a = vertexIndexBuffer[ i * 4 ];
|
||||
b = vertexIndexBuffer[ i * 4 + 1 ];
|
||||
c = vertexIndexBuffer[ i * 4 + 2 ];
|
||||
d = vertexIndexBuffer[ i * 4 + 3 ];
|
||||
|
||||
m = materialIndexBuffer[ i ];
|
||||
|
||||
f4( scope, a, b, c, d, m );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_faces3_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) {
|
||||
|
||||
var i, a, b, c, m;
|
||||
var na, nb, nc;
|
||||
|
||||
var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 3 * nElements );
|
||||
var normalIndexBuffer = new Uint32Array( data, offsetNormals, 3 * nElements );
|
||||
var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
a = vertexIndexBuffer[ i * 3 ];
|
||||
b = vertexIndexBuffer[ i * 3 + 1 ];
|
||||
c = vertexIndexBuffer[ i * 3 + 2 ];
|
||||
|
||||
na = normalIndexBuffer[ i * 3 ];
|
||||
nb = normalIndexBuffer[ i * 3 + 1 ];
|
||||
nc = normalIndexBuffer[ i * 3 + 2 ];
|
||||
|
||||
m = materialIndexBuffer[ i ];
|
||||
|
||||
f3n( scope, normals, a, b, c, m, na, nb, nc );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_faces4_smooth( nElements, offsetVertices, offsetNormals, offsetMaterials ) {
|
||||
|
||||
var i, a, b, c, d, m;
|
||||
var na, nb, nc, nd;
|
||||
|
||||
var vertexIndexBuffer = new Uint32Array( data, offsetVertices, 4 * nElements );
|
||||
var normalIndexBuffer = new Uint32Array( data, offsetNormals, 4 * nElements );
|
||||
var materialIndexBuffer = new Uint16Array( data, offsetMaterials, nElements );
|
||||
|
||||
for( i = 0; i < nElements; i ++ ) {
|
||||
|
||||
a = vertexIndexBuffer[ i * 4 ];
|
||||
b = vertexIndexBuffer[ i * 4 + 1 ];
|
||||
c = vertexIndexBuffer[ i * 4 + 2 ];
|
||||
d = vertexIndexBuffer[ i * 4 + 3 ];
|
||||
|
||||
na = normalIndexBuffer[ i * 4 ];
|
||||
nb = normalIndexBuffer[ i * 4 + 1 ];
|
||||
nc = normalIndexBuffer[ i * 4 + 2 ];
|
||||
nd = normalIndexBuffer[ i * 4 + 3 ];
|
||||
|
||||
m = materialIndexBuffer[ i ];
|
||||
|
||||
f4n( scope, normals, a, b, c, d, m, na, nb, nc, nd );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_triangles_flat( start ) {
|
||||
|
||||
var nElements = md.ntri_flat;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetMaterials = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
init_faces3_flat( nElements, start, offsetMaterials );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_triangles_flat_uv( start ) {
|
||||
|
||||
var nElements = md.ntri_flat_uv;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetUvs = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
|
||||
init_faces3_flat( nElements, start, offsetMaterials );
|
||||
init_uvs3( nElements, offsetUvs );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_triangles_smooth( start ) {
|
||||
|
||||
var nElements = md.ntri_smooth;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
var offsetMaterials = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
|
||||
init_faces3_smooth( nElements, start, offsetNormals, offsetMaterials );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_triangles_smooth_uv( start ) {
|
||||
|
||||
var nElements = md.ntri_smooth_uv;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
var offsetUvs = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 3;
|
||||
|
||||
init_faces3_smooth( nElements, start, offsetNormals, offsetMaterials );
|
||||
init_uvs3( nElements, offsetUvs );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_quads_flat( start ) {
|
||||
|
||||
var nElements = md.nquad_flat;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetMaterials = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
init_faces4_flat( nElements, start, offsetMaterials );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_quads_flat_uv( start ) {
|
||||
|
||||
var nElements = md.nquad_flat_uv;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetUvs = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
|
||||
init_faces4_flat( nElements, start, offsetMaterials );
|
||||
init_uvs4( nElements, offsetUvs );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_quads_smooth( start ) {
|
||||
|
||||
var nElements = md.nquad_smooth;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
var offsetMaterials = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
|
||||
init_faces4_smooth( nElements, start, offsetNormals, offsetMaterials );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function init_quads_smooth_uv( start ) {
|
||||
|
||||
var nElements = md.nquad_smooth_uv;
|
||||
|
||||
if ( nElements ) {
|
||||
|
||||
var offsetNormals = start + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
var offsetUvs = offsetNormals + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
var offsetMaterials = offsetUvs + nElements * Uint32Array.BYTES_PER_ELEMENT * 4;
|
||||
|
||||
init_faces4_smooth( nElements, start, offsetNormals, offsetMaterials );
|
||||
init_uvs4( nElements, offsetUvs );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
function vertex ( scope, x, y, z ) {
|
||||
|
||||
scope.vertices.push( new THREE.Vector3( x, y, z ) );
|
||||
|
||||
};
|
||||
|
||||
function f3 ( scope, a, b, c, mi ) {
|
||||
|
||||
scope.faces.push( new THREE.Face3( a, b, c, null, null, mi ) );
|
||||
|
||||
};
|
||||
|
||||
function f4 ( scope, a, b, c, d, mi ) {
|
||||
|
||||
scope.faces.push( new THREE.Face3( a, b, d, null, null, mi ) );
|
||||
scope.faces.push( new THREE.Face3( b, c, d, null, null, mi ) );
|
||||
|
||||
};
|
||||
|
||||
function f3n ( scope, normals, a, b, c, mi, na, nb, nc ) {
|
||||
|
||||
var nax = normals[ na*3 ],
|
||||
nay = normals[ na*3 + 1 ],
|
||||
naz = normals[ na*3 + 2 ],
|
||||
|
||||
nbx = normals[ nb*3 ],
|
||||
nby = normals[ nb*3 + 1 ],
|
||||
nbz = normals[ nb*3 + 2 ],
|
||||
|
||||
ncx = normals[ nc*3 ],
|
||||
ncy = normals[ nc*3 + 1 ],
|
||||
ncz = normals[ nc*3 + 2 ];
|
||||
|
||||
scope.faces.push( new THREE.Face3( a, b, c,
|
||||
[new THREE.Vector3( nax, nay, naz ),
|
||||
new THREE.Vector3( nbx, nby, nbz ),
|
||||
new THREE.Vector3( ncx, ncy, ncz )],
|
||||
null,
|
||||
mi ) );
|
||||
|
||||
};
|
||||
|
||||
function f4n ( scope, normals, a, b, c, d, mi, na, nb, nc, nd ) {
|
||||
|
||||
var nax = normals[ na*3 ],
|
||||
nay = normals[ na*3 + 1 ],
|
||||
naz = normals[ na*3 + 2 ],
|
||||
|
||||
nbx = normals[ nb*3 ],
|
||||
nby = normals[ nb*3 + 1 ],
|
||||
nbz = normals[ nb*3 + 2 ],
|
||||
|
||||
ncx = normals[ nc*3 ],
|
||||
ncy = normals[ nc*3 + 1 ],
|
||||
ncz = normals[ nc*3 + 2 ],
|
||||
|
||||
ndx = normals[ nd*3 ],
|
||||
ndy = normals[ nd*3 + 1 ],
|
||||
ndz = normals[ nd*3 + 2 ];
|
||||
|
||||
scope.faces.push( new THREE.Face3( a, b, d, [
|
||||
new THREE.Vector3( nax, nay, naz ),
|
||||
new THREE.Vector3( nbx, nby, nbz ),
|
||||
new THREE.Vector3( ndx, ndy, ndz )
|
||||
], null, mi ) );
|
||||
|
||||
scope.faces.push( new THREE.Face3( b, c, d, [
|
||||
new THREE.Vector3( nbx, nby, nbz ),
|
||||
new THREE.Vector3( ncx, ncy, ncz ),
|
||||
new THREE.Vector3( ndx, ndy, ndz )
|
||||
], null, mi ) );
|
||||
|
||||
};
|
||||
|
||||
function uv3 ( where, u1, v1, u2, v2, u3, v3 ) {
|
||||
|
||||
where.push( [
|
||||
new THREE.Vector2( u1, v1 ),
|
||||
new THREE.Vector2( u2, v2 ),
|
||||
new THREE.Vector2( u3, v3 )
|
||||
] );
|
||||
|
||||
};
|
||||
|
||||
function uv4 ( where, u1, v1, u2, v2, u3, v3, u4, v4 ) {
|
||||
|
||||
where.push( [
|
||||
new THREE.Vector2( u1, v1 ),
|
||||
new THREE.Vector2( u2, v2 ),
|
||||
new THREE.Vector2( u4, v4 )
|
||||
] );
|
||||
|
||||
where.push( [
|
||||
new THREE.Vector2( u2, v2 ),
|
||||
new THREE.Vector2( u3, v3 ),
|
||||
new THREE.Vector2( u4, v4 )
|
||||
] );
|
||||
|
||||
};
|
||||
|
||||
Model.prototype = Object.create( THREE.Geometry.prototype );
|
||||
|
||||
var geometry = new Model( texturePath );
|
||||
var materials = this.initMaterials( jsonMaterials, texturePath );
|
||||
|
||||
if ( this.needsTangents( materials ) ) geometry.computeTangents();
|
||||
|
||||
callback( geometry, materials );
|
||||
|
||||
};
|
||||
56
libs/plasio/vendor/lodash.min.js
vendored
Normal file
56
libs/plasio/vendor/lodash.min.js
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @license
|
||||
* Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||
* Build: `lodash modern -o ./dist/lodash.js`
|
||||
*/
|
||||
;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:m+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=true;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:m+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=true
|
||||
}}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.m,r=t.m,u=-1,o=e.length;++u<o;){var i=e[u],a=r[u];if(i!==a){if(i>a||typeof i=="undefined")return 1;if(i<a||typeof a=="undefined")return-1}}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[r/2|0],i=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&i&&typeof i=="object")return false;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=false,o=f(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function i(n){return"\\"+U[n]
|
||||
}function a(){return h.pop()||[]}function f(){return g.pop()||{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function l(n){n.length=0,h.length<_&&h.push(n)}function c(n){var t=n.l;t&&c(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,g.length<_&&g.push(n)}function p(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function s(e){function h(n,t,e){if(!n||!V[typeof n])return n;
|
||||
t=t&&typeof e=="undefined"?t:tt(t,e,3);for(var r=-1,u=V[typeof n]&&Fe(n),o=u?u.length:0;++r<o&&(e=u[r],false!==t(n[e],e,n)););return n}function g(n,t,e){var r;if(!n||!V[typeof n])return n;t=t&&typeof e=="undefined"?t:tt(t,e,3);for(r in n)if(false===t(n[r],r,n))break;return n}function _(n,t,e){var r,u=n,o=u;if(!u)return o;for(var i=arguments,a=0,f=typeof e=="number"?2:i.length;++a<f;)if((u=i[a])&&V[typeof u])for(var l=-1,c=V[typeof u]&&Fe(u),p=c?c.length:0;++l<p;)r=c[l],"undefined"==typeof o[r]&&(o[r]=u[r]);
|
||||
return o}function U(n,t,e){var r,u=n,o=u;if(!u)return o;var i=arguments,a=0,f=typeof e=="number"?2:i.length;if(3<f&&"function"==typeof i[f-2])var l=tt(i[--f-1],i[f--],2);else 2<f&&"function"==typeof i[f-1]&&(l=i[--f]);for(;++a<f;)if((u=i[a])&&V[typeof u])for(var c=-1,p=V[typeof u]&&Fe(u),s=p?p.length:0;++c<s;)r=p[c],o[r]=l?l(o[r],u[r]):u[r];return o}function H(n){var t,e=[];if(!n||!V[typeof n])return e;for(t in n)me.call(n,t)&&e.push(t);return e}function J(n){return n&&typeof n=="object"&&!Te(n)&&me.call(n,"__wrapped__")?n:new Q(n)
|
||||
}function Q(n,t){this.__chain__=!!t,this.__wrapped__=n}function X(n){function t(){if(r){var n=p(r);be.apply(n,arguments)}if(this instanceof t){var o=nt(e.prototype),n=e.apply(o,n||arguments);return wt(n)?n:o}return e.apply(u,n||arguments)}var e=n[0],r=n[2],u=n[4];return $e(t,n),t}function Z(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!wt(n))return n;var i=ce.call(n);if(!K[i])return n;var f=Ae[i];switch(i){case T:case F:return new f(+n);case W:case P:return new f(n);case z:return o=f(n.source,C.exec(n)),o.lastIndex=n.lastIndex,o
|
||||
}if(i=Te(n),t){var c=!r;r||(r=a()),u||(u=a());for(var s=r.length;s--;)if(r[s]==n)return u[s];o=i?f(n.length):{}}else o=i?p(n):U({},n);return i&&(me.call(n,"index")&&(o.index=n.index),me.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(i?St:h)(n,function(n,i){o[i]=Z(n,t,e,r,u)}),c&&(l(r),l(u)),o):o}function nt(n){return wt(n)?ke(n):{}}function tt(n,t,e){if(typeof n!="function")return Ut;if(typeof t=="undefined"||!("prototype"in n))return n;var r=n.__bindData__;if(typeof r=="undefined"&&(De.funcNames&&(r=!n.name),r=r||!De.funcDecomp,!r)){var u=ge.call(n);
|
||||
De.funcNames||(r=!O.test(u)),r||(r=E.test(u),$e(n,r))}if(false===r||true!==r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)}}return Mt(n,t)}function et(n){function t(){var n=f?i:this;if(u){var h=p(u);be.apply(h,arguments)}return(o||c)&&(h||(h=p(arguments)),o&&be.apply(h,o),c&&h.length<a)?(r|=16,et([e,s?r:-4&r,h,null,i,a])):(h||(h=arguments),l&&(e=n[v]),this instanceof t?(n=nt(e.prototype),h=e.apply(n,h),wt(h)?h:n):e.apply(n,h))
|
||||
}var e=n[0],r=n[1],u=n[2],o=n[3],i=n[4],a=n[5],f=1&r,l=2&r,c=4&r,s=8&r,v=e;return $e(t,n),t}function rt(e,r){var u=-1,i=st(),a=e?e.length:0,f=a>=b&&i===n,l=[];if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++u<a;)p=e[u],0>i(r,p)&&l.push(p);return f&&c(r),l}function ut(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r<u;){var i=n[r];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Te(i)||yt(i))){t||(i=ut(i,t,e));var a=-1,f=i.length,l=o.length;for(o.length+=f;++a<f;)o[l++]=i[a]}else e||o.push(i)}return o
|
||||
}function ot(n,t,e,r,u,o){if(e){var i=e(n,t);if(typeof i!="undefined")return!!i}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&V[typeof n]||t&&V[typeof t]))return false;if(null==n||null==t)return n===t;var f=ce.call(n),c=ce.call(t);if(f==D&&(f=q),c==D&&(c=q),f!=c)return false;switch(f){case T:case F:return+n==+t;case W:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case z:case P:return n==oe(t)}if(c=f==$,!c){var p=me.call(n,"__wrapped__"),s=me.call(t,"__wrapped__");if(p||s)return ot(p?n.__wrapped__:n,s?t.__wrapped__:t,e,r,u,o);
|
||||
if(f!=q)return false;if(f=n.constructor,p=t.constructor,f!=p&&!(dt(f)&&f instanceof f&&dt(p)&&p instanceof p)&&"constructor"in n&&"constructor"in t)return false}for(f=!u,u||(u=a()),o||(o=a()),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,i=true;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,(i=v==p)||r)for(;v--;)if(c=p,s=t[v],r)for(;c--&&!(i=ot(n[c],s,e,r,u,o)););else if(!(i=ot(n[v],s,e,r,u,o)))break}else g(t,function(t,a,f){return me.call(f,a)?(v++,i=me.call(n,a)&&ot(n[a],t,e,r,u,o)):void 0}),i&&!r&&g(n,function(n,t,e){return me.call(e,t)?i=-1<--v:void 0
|
||||
});return u.pop(),o.pop(),f&&(l(u),l(o)),i}function it(n,t,e,r,u){(Te(t)?St:h)(t,function(t,o){var i,a,f=t,l=n[o];if(t&&((a=Te(t))||Pe(t))){for(f=r.length;f--;)if(i=r[f]==t){l=u[f];break}if(!i){var c;e&&(f=e(l,t),c=typeof f!="undefined")&&(l=f),c||(l=a?Te(l)?l:[]:Pe(l)?l:{}),r.push(t),u.push(l),c||it(l,t,e,r,u)}}else e&&(f=e(l,t),typeof f=="undefined"&&(f=t)),typeof f!="undefined"&&(l=f);n[o]=l})}function at(n,t){return n+he(Re()*(t-n+1))}function ft(e,r,u){var i=-1,f=st(),p=e?e.length:0,s=[],v=!r&&p>=b&&f===n,h=u||v?a():s;
|
||||
for(v&&(h=o(h),f=t);++i<p;){var g=e[i],y=u?u(g,i,e):g;(r?!i||h[h.length-1]!==y:0>f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r<o;){var i=t[r];n(u,i,e(i,r,t),t)}else h(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function ct(n,t,e,r,u,o){var i=1&t,a=4&t,f=16&t,l=32&t;if(!(2&t||dt(n)))throw new ie;f&&!e.length&&(t&=-17,f=e=false),l&&!r.length&&(t&=-33,l=r=false);
|
||||
var c=n&&n.__bindData__;return c&&true!==c?(c=p(c),c[2]&&(c[2]=p(c[2])),c[3]&&(c[3]=p(c[3])),!i||1&c[1]||(c[4]=u),!i&&1&c[1]&&(t|=8),!a||4&c[1]||(c[5]=o),f&&be.apply(c[2]||(c[2]=[]),e),l&&we.apply(c[3]||(c[3]=[]),r),c[1]|=t,ct.apply(null,c)):(1==t||17===t?X:et)([n,t,e,r,u,o])}function pt(n){return Be[n]}function st(){var t=(t=J.indexOf)===Wt?n:t;return t}function vt(n){return typeof n=="function"&&pe.test(n)}function ht(n){var t,e;return n&&ce.call(n)==q&&(t=n.constructor,!dt(t)||t instanceof t)?(g(n,function(n,t){e=t
|
||||
}),typeof e=="undefined"||me.call(n,e)):false}function gt(n){return We[n]}function yt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==D||false}function mt(n,t,e){var r=Fe(n),u=r.length;for(t=tt(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function bt(n){var t=[];return g(n,function(n,e){dt(n)&&t.push(e)}),t.sort()}function _t(n){for(var t=-1,e=Fe(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function dt(n){return typeof n=="function"}function wt(n){return!(!n||!V[typeof n])
|
||||
}function jt(n){return typeof n=="number"||n&&typeof n=="object"&&ce.call(n)==W||false}function kt(n){return typeof n=="string"||n&&typeof n=="object"&&ce.call(n)==P||false}function xt(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;)u[t]=n[e[t]];return u}function Ct(n,t,e){var r=-1,u=st(),o=n?n.length:0,i=false;return e=(0>e?Ie(0,o+e):e)||0,Te(n)?i=-1<u(n,t,e):typeof o=="number"?i=-1<(kt(n)?n.indexOf(t,e):u(n,t,e)):h(n,function(n){return++r<e?void 0:!(i=n===t)}),i}function Ot(n,t,e){var r=true;t=J.createCallback(t,e,3),e=-1;
|
||||
var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else h(n,function(n,e,u){return r=!!t(n,e,u)});return r}function Nt(n,t,e){var r=[];t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}else h(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function It(n,t,e){t=J.createCallback(t,e,3),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return h(n,function(n,e,r){return t(n,e,r)?(u=n,false):void 0}),u}for(;++e<r;){var o=n[e];
|
||||
if(t(o,e,n))return o}}function St(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof u=="number")for(;++r<u&&false!==t(n[r],r,n););else h(n,t);return n}function Et(n,t,e){var r=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof r=="number")for(;r--&&false!==t(n[r],r,n););else{var u=Fe(n),r=u.length;h(n,function(n,e,o){return e=u?u[--r]:--r,t(o[e],e,o)})}return n}function Rt(n,t,e){var r=-1,u=n?n.length:0;if(t=J.createCallback(t,e,3),typeof u=="number")for(var o=Xt(u);++r<u;)o[r]=t(n[r],r,n);
|
||||
else o=[],h(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function At(n,t,e){var u=-1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a>o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Dt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=J.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else h(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)
|
||||
});return e}function $t(n,t,e,r){var u=3>arguments.length;return t=J.createCallback(t,r,4),Et(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function Tt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=at(0,++t);r[t]=r[e],r[e]=n}),r}function Ft(n,t,e){var r;t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else h(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Bt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;
|
||||
for(t=J.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[0]:v;return p(n,0,Se(Ie(0,r),u))}function Wt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Ie(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=J.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Ie(0,t);return p(n,r)}function zt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?J.createCallback(e,r,1):Ut,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;
|
||||
return u}function Pt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(e=J.createCallback(e,r,3)),ft(n,t,e)}function Kt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?At(Ve(n,"length")):0,r=Xt(0>e?0:e);++t<e;)r[t]=Ve(n,t);return r}function Lt(n,t){var e=-1,r=n?n.length:0,u={};for(t||!r||Te(n[0])||(t=[]);++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?ct(n,17,p(arguments,2),null,t):ct(n,1,null,null,t)
|
||||
}function Vt(n,t,e){function r(){c&&ve(c),i=c=p=v,(g||h!==t)&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null))}function u(){var e=t-(Ue()-f);0<e?c=_e(u,e):(i&&ve(i),e=p,i=c=p=v,e&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null)))}var o,i,a,f,l,c,p,s=0,h=false,g=true;if(!dt(n))throw new ie;if(t=Ie(0,t)||0,true===e)var y=true,g=false;else wt(e)&&(y=e.leading,h="maxWait"in e&&(Ie(t,e.maxWait)||0),g="trailing"in e?e.trailing:g);return function(){if(o=arguments,f=Ue(),l=this,p=g&&(c||!y),false===h)var e=y&&!c;else{i||y||(s=f);var v=h-(f-s),m=0>=v;
|
||||
m?(i&&(i=ve(i)),s=f,a=n.apply(l,o)):i||(i=_e(r,v))}return m&&c?c=ve(c):c||t===h||(c=_e(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Ut(n){return n}function Gt(n,t,e){var r=true,u=t&&bt(t);t&&(e||u.length)||(null==e&&(e=t),o=Q,t=n,n=J,u=bt(t)),false===e?r=false:wt(e)&&"chain"in e&&(r=e.chain);var o=n,i=dt(o);St(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(be.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&wt(i))return this;
|
||||
i=new o(i),i.__chain__=t}return i})})}function Ht(){}function Jt(n){return function(t){return t[n]}}function Qt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var Xt=e.Array,Yt=e.Boolean,Zt=e.Date,ne=e.Function,te=e.Math,ee=e.Number,re=e.Object,ue=e.RegExp,oe=e.String,ie=e.TypeError,ae=[],fe=re.prototype,le=e._,ce=fe.toString,pe=ue("^"+oe(ce).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),se=te.ceil,ve=e.clearTimeout,he=te.floor,ge=ne.prototype.toString,ye=vt(ye=re.getPrototypeOf)&&ye,me=fe.hasOwnProperty,be=ae.push,_e=e.setTimeout,de=ae.splice,we=ae.unshift,je=function(){try{var n={},t=vt(t=re.defineProperty)&&t,e=t(n,n,n)&&t
|
||||
}catch(r){}return e}(),ke=vt(ke=re.create)&&ke,xe=vt(xe=Xt.isArray)&&xe,Ce=e.isFinite,Oe=e.isNaN,Ne=vt(Ne=re.keys)&&Ne,Ie=te.max,Se=te.min,Ee=e.parseInt,Re=te.random,Ae={};Ae[$]=Xt,Ae[T]=Yt,Ae[F]=Zt,Ae[B]=ne,Ae[q]=re,Ae[W]=ee,Ae[z]=ue,Ae[P]=oe,Q.prototype=J.prototype;var De=J.support={};De.funcDecomp=!vt(e.a)&&E.test(s),De.funcNames=typeof ne.name=="string",J.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:J}},ke||(nt=function(){function n(){}return function(t){if(wt(t)){n.prototype=t;
|
||||
var r=new n;n.prototype=null}return r||e.Object()}}());var $e=je?function(n,t){M.value=t,je(n,"__bindData__",M)}:Ht,Te=xe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==$||false},Fe=Ne?function(n){return wt(n)?Ne(n):[]}:H,Be={"&":"&","<":"<",">":">",'"':""","'":"'"},We=_t(Be),qe=ue("("+Fe(We).join("|")+")","g"),ze=ue("["+Fe(Be).join("")+"]","g"),Pe=ye?function(n){if(!n||ce.call(n)!=q)return false;var t=n.valueOf,e=vt(t)&&(e=ye(t))&&ye(e);return e?n==e||ye(n)==e:ht(n)
|
||||
}:ht,Ke=lt(function(n,t,e){me.call(n,e)?n[e]++:n[e]=1}),Le=lt(function(n,t,e){(me.call(n,e)?n[e]:n[e]=[]).push(t)}),Me=lt(function(n,t,e){n[e]=t}),Ve=Rt,Ue=vt(Ue=Zt.now)&&Ue||function(){return(new Zt).getTime()},Ge=8==Ee(d+"08")?Ee:function(n,t){return Ee(kt(n)?n.replace(I,""):n,t||0)};return J.after=function(n,t){if(!dt(t))throw new ie;return function(){return 1>--n?t.apply(this,arguments):void 0}},J.assign=U,J.at=function(n){for(var t=arguments,e=-1,r=ut(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);++e<t;)u[e]=n[r[e]];
|
||||
return u},J.bind=Mt,J.bindAll=function(n){for(var t=1<arguments.length?ut(arguments,true,false,1):bt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=ct(n[u],1,null,null,n)}return n},J.bindKey=function(n,t){return 2<arguments.length?ct(t,19,p(arguments,2),null,n):ct(t,3,null,null,n)},J.chain=function(n){return n=new Q(n),n.__chain__=true,n},J.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},J.compose=function(){for(var n=arguments,t=n.length;t--;)if(!dt(n[t]))throw new ie;
|
||||
return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},J.constant=function(n){return function(){return n}},J.countBy=Ke,J.create=function(n,t){var e=nt(n);return t?U(e,t):e},J.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return tt(n,t,e);if("object"!=r)return Jt(n);var u=Fe(n),o=u[0],i=n[o];return 1!=u.length||i!==i||wt(i)?function(t){for(var e=u.length,r=false;e--&&(r=ot(t[u[e]],n[u[e]],null,true)););return r}:function(n){return n=n[o],i===n&&(0!==i||1/i==1/n)
|
||||
}},J.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,ct(n,4,null,null,null,t)},J.debounce=Vt,J.defaults=_,J.defer=function(n){if(!dt(n))throw new ie;var t=p(arguments,1);return _e(function(){n.apply(v,t)},1)},J.delay=function(n,t){if(!dt(n))throw new ie;var e=p(arguments,2);return _e(function(){n.apply(v,e)},t)},J.difference=function(n){return rt(n,ut(arguments,true,true,1))},J.filter=Nt,J.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(n=Rt(n,e,r)),ut(n,t)
|
||||
},J.forEach=St,J.forEachRight=Et,J.forIn=g,J.forInRight=function(n,t,e){var r=[];g(n,function(n,t){r.push(t,n)});var u=r.length;for(t=tt(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},J.forOwn=h,J.forOwnRight=mt,J.functions=bt,J.groupBy=Le,J.indexBy=Me,J.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return p(n,0,Se(Ie(0,u-r),u))},J.intersection=function(){for(var e=[],r=-1,u=arguments.length,i=a(),f=st(),p=f===n,s=a();++r<u;){var v=arguments[r];
|
||||
(Te(v)||yt(v))&&(e.push(v),i.push(p&&v.length>=b&&o(r?e[r]:s)))}var p=e[0],h=-1,g=p?p.length:0,y=[];n:for(;++h<g;){var m=i[0],v=p[h];if(0>(m?t(m,v):f(s,v))){for(r=u,(m||s).push(v);--r;)if(m=i[r],0>(m?t(m,v):f(e[r],v)))continue n;y.push(v)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},J.invert=_t,J.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=Xt(typeof o=="number"?o:0);return St(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},J.keys=Fe,J.map=Rt,J.mapValues=function(n,t,e){var r={};
|
||||
return t=J.createCallback(t,e,3),h(n,function(n,e,u){r[e]=t(n,e,u)}),r},J.max=At,J.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return me.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!dt(n))throw new ie;return e.cache={},e},J.merge=function(n){var t=arguments,e=2;if(!wt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=tt(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=p(arguments,1,e),u=-1,o=a(),i=a();++u<e;)it(n,t[u],r,o,i);
|
||||
return l(o),l(i),n},J.min=function(n,t,e){var u=1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a<o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)});return o},J.omit=function(n,t,e){var r={};if(typeof t!="function"){var u=[];g(n,function(n,t){u.push(t)});for(var u=rt(u,ut(arguments,true,false,1)),o=-1,i=u.length;++o<i;){var a=u[o];r[a]=n[a]}}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)||(r[e]=n)
|
||||
});return r},J.once=function(n){var t,e;if(!dt(n))throw new ie;return function(){return t?e:(t=true,e=n.apply(this,arguments),n=null,e)}},J.pairs=function(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u},J.partial=function(n){return ct(n,16,p(arguments,1))},J.partialRight=function(n){return ct(n,32,null,p(arguments,1))},J.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=ut(arguments,true,false,1),i=wt(n)?o.length:0;++u<i;){var a=o[u];a in n&&(r[a]=n[a])
|
||||
}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},J.pluck=Ve,J.property=Jt,J.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,i=t[e];++o<u;)n[o]===i&&(de.call(n,o--,1),u--);return n},J.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Ie(0,se((t-n)/(e||1)));for(var u=Xt(t);++r<t;)u[r]=n,n+=e;return u},J.reject=function(n,t,e){return t=J.createCallback(t,e,3),Nt(n,function(n,e,r){return!t(n,e,r)
|
||||
})},J.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=J.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),de.call(n,r--,1),u--);return o},J.rest=qt,J.shuffle=Tt,J.sortBy=function(n,t,e){var r=-1,o=Te(t),i=n?n.length:0,p=Xt(typeof i=="number"?i:0);for(o||(t=J.createCallback(t,e,3)),St(n,function(n,e,u){var i=p[++r]=f();o?i.m=Rt(t,function(t){return n[t]}):(i.m=a())[0]=t(n,e,u),i.n=r,i.o=n}),i=p.length,p.sort(u);i--;)n=p[i],p[i]=n.o,o||l(n.m),c(n);return p},J.tap=function(n,t){return t(n),n
|
||||
},J.throttle=function(n,t,e){var r=true,u=true;if(!dt(n))throw new ie;return false===e?r=false:wt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),L.leading=r,L.maxWait=t,L.trailing=u,Vt(n,t,L)},J.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Xt(n);for(t=tt(t,e,1);++r<n;)u[r]=t(r);return u},J.toArray=function(n){return n&&typeof n.length=="number"?p(n):xt(n)},J.transform=function(n,t,e,r){var u=Te(n);if(null==e)if(u)e=[];else{var o=n&&n.constructor;e=nt(o&&o.prototype)}return t&&(t=J.createCallback(t,r,4),(u?St:h)(n,function(n,r,u){return t(e,n,r,u)
|
||||
})),e},J.union=function(){return ft(ut(arguments,true,true))},J.uniq=Pt,J.values=xt,J.where=Nt,J.without=function(n){return rt(n,p(arguments,1))},J.wrap=function(n,t){return ct(t,16,[n])},J.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var e=arguments[n];if(Te(e)||yt(e))var r=r?ft(rt(r,e).concat(rt(e,r))):e}return r||[]},J.zip=Kt,J.zipObject=Lt,J.collect=Rt,J.drop=qt,J.each=St,J.eachRight=Et,J.extend=U,J.methods=bt,J.object=Lt,J.select=Nt,J.tail=qt,J.unique=Pt,J.unzip=Kt,Gt(J),J.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=false),Z(n,t,typeof e=="function"&&tt(e,r,1))
|
||||
},J.cloneDeep=function(n,t,e){return Z(n,true,typeof t=="function"&&tt(t,e,1))},J.contains=Ct,J.escape=function(n){return null==n?"":oe(n).replace(ze,pt)},J.every=Ot,J.find=It,J.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=J.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},J.findKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),h(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.findLast=function(n,t,e){var r;return t=J.createCallback(t,e,3),Et(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0
|
||||
}),r},J.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=J.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},J.findLastKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),mt(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.has=function(n,t){return n?me.call(n,t):false},J.identity=Ut,J.indexOf=Wt,J.isArguments=yt,J.isArray=Te,J.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ce.call(n)==T||false},J.isDate=function(n){return n&&typeof n=="object"&&ce.call(n)==F||false
|
||||
},J.isElement=function(n){return n&&1===n.nodeType||false},J.isEmpty=function(n){var t=true;if(!n)return t;var e=ce.call(n),r=n.length;return e==$||e==P||e==D||e==q&&typeof r=="number"&&dt(n.splice)?!r:(h(n,function(){return t=false}),t)},J.isEqual=function(n,t,e,r){return ot(n,t,typeof e=="function"&&tt(e,r,2))},J.isFinite=function(n){return Ce(n)&&!Oe(parseFloat(n))},J.isFunction=dt,J.isNaN=function(n){return jt(n)&&n!=+n},J.isNull=function(n){return null===n},J.isNumber=jt,J.isObject=wt,J.isPlainObject=Pe,J.isRegExp=function(n){return n&&typeof n=="object"&&ce.call(n)==z||false
|
||||
},J.isString=kt,J.isUndefined=function(n){return typeof n=="undefined"},J.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Ie(0,r+e):Se(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},J.mixin=Gt,J.noConflict=function(){return e._=le,this},J.noop=Ht,J.now=Ue,J.parseInt=Ge,J.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Re(),Se(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):at(n,t)
|
||||
},J.reduce=Dt,J.reduceRight=$t,J.result=function(n,t){if(n){var e=n[t];return dt(e)?n[t]():e}},J.runInContext=s,J.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Fe(n).length},J.some=Ft,J.sortedIndex=zt,J.template=function(n,t,e){var r=J.templateSettings;n=oe(n||""),e=_({},e,r);var u,o=_({},e.imports,r.imports),r=Fe(o),o=xt(o),a=0,f=e.interpolate||S,l="__p+='",f=ue((e.escape||S).source+"|"+f.source+"|"+(f===N?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(R,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t
|
||||
}),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ne(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},J.unescape=function(n){return null==n?"":oe(n).replace(qe,gt)},J.uniqueId=function(n){var t=++y;return oe(null==n?"":n)+t
|
||||
},J.all=Ot,J.any=Ft,J.detect=It,J.findWhere=It,J.foldl=Dt,J.foldr=$t,J.include=Ct,J.inject=Dt,Gt(function(){var n={};return h(J,function(t,e){J.prototype[e]||(n[e]=t)}),n}(),false),J.first=Bt,J.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return p(n,Ie(0,u-r))},J.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=xt(n)),null==t||e?n?n[at(0,n.length-1)]:v:(n=Tt(n),n.length=Se(Ie(0,t),n.length),n)
|
||||
},J.take=Bt,J.head=Bt,h(J,function(n,t){var e="sample"!==t;J.prototype[t]||(J.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new Q(o,u):o})}),J.VERSION="2.4.1",J.prototype.chain=function(){return this.__chain__=true,this},J.prototype.toString=function(){return oe(this.__wrapped__)},J.prototype.value=Qt,J.prototype.valueOf=Qt,St(["join","pop","shift"],function(n){var t=ae[n];J.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);
|
||||
return n?new Q(e,n):e}}),St(["push","reverse","sort","unshift"],function(n){var t=ae[n];J.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),St(["concat","slice","splice"],function(n){var t=ae[n];J.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments),this.__chain__)}}),J}var v,h=[],g=[],y=0,m=+new Date+"",b=75,_=40,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",w=/\b__p\+='';/g,j=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,I=RegExp("^["+d+"]*0+(?=.$)"),S=/($^)/,E=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,A="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),D="[object Arguments]",$="[object Array]",T="[object Boolean]",F="[object Date]",B="[object Function]",W="[object Number]",q="[object Object]",z="[object RegExp]",P="[object String]",K={};
|
||||
K[B]=false,K[D]=K[$]=K[T]=K[F]=K[W]=K[q]=K[z]=K[P]=true;var L={leading:false,maxWait:0,trailing:false},M={configurable:false,enumerable:false,value:null,writable:false},V={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},U={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=V[typeof window]&&window||this,H=V[typeof exports]&&exports&&!exports.nodeType&&exports,J=V[typeof module]&&module&&!module.nodeType&&module,Q=J&&J.exports===H&&H,X=V[typeof global]&&global;!X||X.global!==X&&X.window!==X||(G=X);
|
||||
var Y=s();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(G._=Y, define(function(){return Y})):H&&J?Q?(J.exports=Y)._=Y:H._=Y:G._=Y}).call(this);
|
||||
37760
libs/plasio/vendor/three.js
vendored
Normal file
37760
libs/plasio/vendor/three.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
135
libs/plasio/workers/laz-loader-worker.js
Normal file
135
libs/plasio/workers/laz-loader-worker.js
Normal file
@ -0,0 +1,135 @@
|
||||
// laz-loader-worker.js
|
||||
//
|
||||
|
||||
//importScripts('laz-perf.js');
|
||||
|
||||
var instance = null; // laz-perf instance
|
||||
|
||||
function readAs(buf, Type, offset, count) {
|
||||
count = (count === undefined || count === 0 ? 1 : count);
|
||||
var sub = buf.slice(offset, offset + Type.BYTES_PER_ELEMENT * count);
|
||||
|
||||
var r = new Type(sub);
|
||||
if (count === undefined || count === 1)
|
||||
return r[0];
|
||||
|
||||
var ret = [];
|
||||
for (var i = 0 ; i < count ; i ++) {
|
||||
ret.push(r[i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function parseLASHeader(arraybuffer) {
|
||||
var o = {};
|
||||
|
||||
o.pointsOffset = readAs(arraybuffer, Uint32Array, 32*3);
|
||||
o.pointsFormatId = readAs(arraybuffer, Uint8Array, 32*3+8);
|
||||
o.pointsStructSize = readAs(arraybuffer, Uint16Array, 32*3+8+1);
|
||||
o.pointsCount = readAs(arraybuffer, Uint32Array, 32*3 + 11);
|
||||
|
||||
|
||||
var start = 32*3 + 35;
|
||||
o.scale = readAs(arraybuffer, Float64Array, start, 3); start += 24; // 8*3
|
||||
o.offset = readAs(arraybuffer, Float64Array, start, 3); start += 24;
|
||||
|
||||
var bounds = readAs(arraybuffer, Float64Array, start, 6); start += 48; // 8*6;
|
||||
o.maxs = [bounds[0], bounds[2], bounds[4]];
|
||||
o.mins = [bounds[1], bounds[3], bounds[5]];
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
function handleEvent(msg) {
|
||||
switch(msg.type) {
|
||||
case "open":
|
||||
try {
|
||||
instance = new Module.LASZip();
|
||||
var abInt = new Uint8Array(msg.arraybuffer);
|
||||
var buf = Module._malloc(msg.arraybuffer.byteLength);
|
||||
|
||||
instance.arraybuffer = msg.arraybuffer;
|
||||
instance.buf = buf;
|
||||
Module.HEAPU8.set(abInt, buf);
|
||||
instance.open(buf, msg.arraybuffer.byteLength);
|
||||
|
||||
instance.readOffset = 0;
|
||||
|
||||
postMessage({ type: "open", status: 1});
|
||||
}
|
||||
catch(e) {
|
||||
postMessage({ type: "open", status: 0, details: e });
|
||||
}
|
||||
break;
|
||||
|
||||
case "header":
|
||||
if (!instance)
|
||||
throw new Error("You need to open the file before trying to read header");
|
||||
|
||||
|
||||
|
||||
var header = parseLASHeader(instance.arraybuffer);
|
||||
header.pointsFormatId &= 0x3f;
|
||||
instance.header = header;
|
||||
postMessage({type: "header", status: 1, header: header});
|
||||
break;
|
||||
|
||||
case "read":
|
||||
if (!instance)
|
||||
throw new Error("You need to open the file before trying to read stuff");
|
||||
|
||||
var start = msg.start, count = msg.count, skip = msg.skip;
|
||||
var o = instance;
|
||||
|
||||
if (!o.header)
|
||||
throw new Error("You need to query header before reading, I maintain state that way, sorry :(");
|
||||
|
||||
var pointsToRead = Math.min(count * skip, o.header.pointsCount - o.readOffset);
|
||||
var bufferSize = Math.ceil(pointsToRead / skip);
|
||||
var pointsRead = 0;
|
||||
|
||||
var this_buf = new Uint8Array(bufferSize * o.header.pointsStructSize);
|
||||
var buf_read = Module._malloc(o.header.pointsStructSize);
|
||||
for (var i = 0 ; i < pointsToRead ; i ++) {
|
||||
o.getPoint(buf_read);
|
||||
|
||||
if (i % skip === 0) {
|
||||
var a = new Uint8Array(Module.HEAPU8.buffer, buf_read, o.header.pointsStructSize);
|
||||
this_buf.set(a, pointsRead * o.header.pointsStructSize, o.header.pointsStructSize);
|
||||
pointsRead ++;
|
||||
}
|
||||
|
||||
o.readOffset ++;
|
||||
}
|
||||
|
||||
postMessage({
|
||||
type: 'header',
|
||||
status: 1,
|
||||
buffer: this_buf.buffer,
|
||||
count: pointsRead,
|
||||
hasMoreData: o.readOffset < o.header.pointsCount
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "close":
|
||||
if (instance !== null) {
|
||||
instance.delete();
|
||||
instance = null;
|
||||
}
|
||||
postMessage({ type: "close", status: 1});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onmessage = function(event) {
|
||||
try {
|
||||
handleEvent(event.data);
|
||||
} catch(e) {
|
||||
postMessage({type: event.data.type, status: 0, details: e});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
34
libs/plasio/workers/laz-perf.js
Normal file
34
libs/plasio/workers/laz-perf.js
Normal file
File diff suppressed because one or more lines are too long
23
package.json
Normal file
23
package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "potree",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"description": "WebGL point cloud viewer",
|
||||
"dependencies": {
|
||||
"gulp": "*",
|
||||
"gulp-size": "*",
|
||||
"gulp-concat": "*",
|
||||
"gulp-uglify": "*",
|
||||
"gulp-rename": "*"
|
||||
},
|
||||
"author": {},
|
||||
"license": "",
|
||||
"devDependencies": {
|
||||
"gulp": "~3.5.2",
|
||||
"gulp-rename": "~1.0.0",
|
||||
"gulp-concat": "~2.1.7",
|
||||
"gulp-uglify": "~0.2.1",
|
||||
"gulp-util": "~2.2.20",
|
||||
"through": "~2.3.4"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user