update examples and readme; polishing & minor fixes
This commit is contained in:
parent
6c4db70939
commit
abde7f1eb5
31
README.md
31
README.md
@ -1,9 +1,7 @@
|
||||
|
||||
# About
|
||||
|
||||
Potree is a free open-source WebGL based point cloud renderer for large point clouds.
|
||||
It is based on the [TU Wien Scanopy project](https://www.cg.tuwien.ac.at/research/projects/Scanopy/)
|
||||
and it was part of the [Harvest4D Project](https://harvest4d.org/).
|
||||
Potree is a free open-source WebGL based point cloud renderer for large point clouds. It is based on the [TU Wien Scanopy project](https://www.cg.tuwien.ac.at/research/projects/Scanopy/) and research projects [Harvest4D](https://harvest4d.org/), [GCD Doctoral College](https://gcd.tuwien.ac.at/) and [Superhumans](https://www.cg.tuwien.ac.at/research/projects/Superhumans/).
|
||||
|
||||
|
||||
<a href="http://potree.org/wp/demo/" target="_blank">  </a>
|
||||
@ -46,7 +44,8 @@ Copy the converted directory into <potreeDirectory>/pointclouds/data_conve
|
||||
|
||||
# Downloads
|
||||
|
||||
[PotreeConverter source and Win64 binaries](https://github.com/potree/PotreeConverter/releases)
|
||||
* [Potree](https://github.com/potree/potree/releases)
|
||||
* [PotreeConverter ](https://github.com/potree/PotreeConverter/releases)
|
||||
|
||||
# Examples
|
||||
|
||||
@ -224,7 +223,29 @@ Take a look at the [potree showcase](http://potree.org/wp/demo/) for more exampl
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Donations
|
||||
# Funding
|
||||
|
||||
Potree is funded by a combination of research projects, companies and institutions.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Project Name</th>
|
||||
<th>Funding Agency</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://harvest4d.org/">Harvest4D</a></td>
|
||||
<td>EU 7th Framework Program 323567</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://gcd.tuwien.ac.at/">GCD Doctoral College</a></td>
|
||||
<td>TU Wien</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://www.cg.tuwien.ac.at/research/projects/Superhumans/">Superhumans</a></td>
|
||||
<td>FWF</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
We would like to thank our sponsors for their financial contributions that keep this project up and running!
|
||||
|
||||
|
||||
@ -71,8 +71,8 @@
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
viewer.scene.view.setView(
|
||||
[2652364.047, 1248873.748, 405.037],
|
||||
[2652371.019, 1248889.536, 396.834],
|
||||
[2652381.103, 1249049.447, 411.636],
|
||||
[2652364.407, 1249077.205, 399.696],
|
||||
);
|
||||
|
||||
run();
|
||||
|
||||
@ -44,6 +44,10 @@
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setDescription(`
|
||||
Create a new animation path via "Tools -> Navigation -> Camera Animation"<br>
|
||||
Modify and play animation via "Scene -> Objects -> Other -> [animation object]".
|
||||
`);
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
<a href="http://potree.org/potree/examples/oriented_images.html" target="_blank">
|
||||
<img src="examples/thumbnails/oriented_images.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/360.html" target="_blank">
|
||||
<img src="examples/thumbnails/360.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/geopackage.html" target="_blank">
|
||||
<img src="examples/thumbnails/geopackage.jpg" width="100%" />
|
||||
@ -21,16 +25,16 @@
|
||||
<a href="http://potree.org/potree/examples/camera_animation.html" target="_blank">
|
||||
<img src="examples/thumbnails/camera_animation.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/load_project.html" target="_blank">
|
||||
<img src="examples/thumbnails/load_project.jpg" width="100%" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Basic Viewer</th><th>Oriented Images</th><th>Geopackage</th><th>Classifications</th><th>Camera Animation</th><th>Load Project</th>
|
||||
<th>Basic Viewer</th><th>Oriented Images</th><th>360 images</th><th>Geopackage</th><th>Classifications</th><th>Camera Animation</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/load_project.html" target="_blank">
|
||||
<img src="examples/thumbnails/load_project.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/toolbar.html" target="_blank">
|
||||
<img src="examples/thumbnails/toolbar.jpg" width="100%" />
|
||||
</a>
|
||||
@ -50,16 +54,16 @@
|
||||
<a href="http://potree.org/potree/examples/lion.html" target="_blank">
|
||||
<img src="examples/thumbnails/lion.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/lion_las.html" target="_blank">
|
||||
<img src="examples/thumbnails/lion_las.png" width="100%" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Toolbar</th><th>Matcap</th><th>Virtual Reality</th><th>Heidentor</th><th>Lion</th><th>Lion LAS</th>
|
||||
<th>Load Project</th><th>Toolbar</th><th>Matcap</th><th>Virtual Reality</th><th>Heidentor</th><th>Lion</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/lion_las.html" target="_blank">
|
||||
<img src="examples/thumbnails/lion_las.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/lion_laz.html" target="_blank">
|
||||
<img src="examples/thumbnails/lion_las.png" width="100%" />
|
||||
</a>
|
||||
@ -79,16 +83,16 @@
|
||||
<a href="http://potree.org/potree/examples/clipping_volume.html" target="_blank">
|
||||
<img src="examples/thumbnails/clipping_volume.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/ca13.html" target="_blank">
|
||||
<img src="examples/thumbnails/ca13.png" width="100%" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Lion LAZ</th><th>EPT</th><th>EPT Binary</th><th>EPT zstandard</th><th>Clipping Volume</th><th>CA13</th>
|
||||
<th>Lion LAS</th><th>Lion LAZ</th><th>EPT</th><th>EPT Binary</th><th>EPT zstandard</th><th>Clipping Volume</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/ca13.html" target="_blank">
|
||||
<img src="examples/thumbnails/ca13.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/elevation_profile.html" target="_blank">
|
||||
<img src="examples/thumbnails/elevation_profile.png" width="100%" />
|
||||
</a>
|
||||
@ -108,16 +112,16 @@
|
||||
<a href="http://potree.org/potree/examples/features_sorvilier.html" target="_blank">
|
||||
<img src="examples/thumbnails/features_sorvilier.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/features_ca13.html" target="_blank">
|
||||
<img src="examples/thumbnails/features_ca13.png" width="100%" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Elevation Profile</th><th>Measurements</th><th>Meshes</th><th>Multiple Point Clouds</th><th>Features (Sorvilier)</th><th>Features (CA13)</th>
|
||||
<th>CA13</th><th>Elevation Profile</th><th>Measurements</th><th>Meshes</th><th>Multiple Point Clouds</th><th>Features (Sorvilier)</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/features_ca13.html" target="_blank">
|
||||
<img src="examples/thumbnails/features_ca13.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/annotations.html" target="_blank">
|
||||
<img src="examples/thumbnails/annotations.png" width="100%" />
|
||||
</a>
|
||||
@ -137,16 +141,16 @@
|
||||
<a href="http://potree.org/potree/examples/cesium_ca13.html" target="_blank">
|
||||
<img src="examples/thumbnails/cesium_ca13.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/cesium_retz.html" target="_blank">
|
||||
<img src="examples/thumbnails/cesium_retz.png" width="100%" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Annotations</th><th>Hierarchical Annotations</th><th>Animation Path</th><th>Shapefiles</th><th>Cesium CA13</th><th>Cesium Retz</th>
|
||||
<th>Features (CA13)</th><th>Annotations</th><th>Hierarchical Annotations</th><th>Animation Path</th><th>Shapefiles</th><th>Cesium CA13</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/cesium_retz.html" target="_blank">
|
||||
<img src="examples/thumbnails/cesium_retz.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/cesium_sorvilier.html" target="_blank">
|
||||
<img src="examples/thumbnails/cesium_sorvilier.png" width="100%" />
|
||||
</a>
|
||||
@ -165,6 +169,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Cesium Sorvilier</th><th>Custom Sidebar Section</th><th>Embedded Iframe</th><th>Gradient Colors</th>
|
||||
<th>Cesium Retz</th><th>Cesium Sorvilier</th><th>Custom Sidebar Section</th><th>Embedded Iframe</th><th>Gradient Colors</th>
|
||||
</tr>
|
||||
</table>
|
||||
@ -29,7 +29,6 @@
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');"></div>
|
||||
@ -46,7 +45,7 @@
|
||||
viewer.setPointBudget(3_000_000);
|
||||
|
||||
viewer.setDescription(`
|
||||
Use Potree.OrientedImages.load(...) to populate the scene with captured images.
|
||||
Use Potree.OrientedImageLoader.load(...) to populate the scene with captured images.
|
||||
Clicking an image will move the scene camera towards the image and overlay it over the point cloud.
|
||||
You can use the measurement tools while the scene camera is bound to an image. Zoom in and out of the image via the mouse wheel.
|
||||
Go back to 3D mode by clicking the button on the bottom right.
|
||||
|
||||
@ -2,40 +2,41 @@
|
||||
"examples": [
|
||||
{"thumb": "thumbnails/viewer.png", "label": "Basic Viewer", "url": "viewer.html"},
|
||||
{"thumb": "thumbnails/oriented_images.jpg", "label": "Oriented Images", "url": "oriented_images.html"},
|
||||
{"thumb": "thumbnails/360.jpg", "label": "360 images", "url": "360.html"},
|
||||
{"thumb": "thumbnails/geopackage.jpg", "label": "Geopackage", "url": "geopackage.html"},
|
||||
{"thumb": "thumbnails/classifications.jpg", "label": "Classifications", "url": "classifications.html"},
|
||||
{"thumb": "thumbnails/camera_animation.jpg", "label": "Camera Animation", "url": "camera_animation.html"},
|
||||
{"thumb": "thumbnails/load_project.jpg", "label": "Load Project", "url": "load_project.html"},
|
||||
{"thumb": "thumbnails/toolbar.jpg", "label": "Toolbar", "url": "toolbar.html"},
|
||||
|
||||
{"thumb": "thumbnails/toolbar.jpg", "label": "Toolbar", "url": "toolbar.html"},
|
||||
{"thumb": "thumbnails/matcap.jpg", "label": "Matcap", "url": "matcap.html"},
|
||||
{"thumb": "thumbnails/vr.jpg", "label": "Virtual Reality", "url": "vr.html"},
|
||||
{"thumb": "thumbnails/heidentor.png", "label": "Heidentor", "url": "heidentor.html"},
|
||||
{"thumb": "thumbnails/lion.png", "label": "Lion", "url": "lion.html"},
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "Lion LAS", "url": "lion_las.html"},
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "Lion LAZ", "url": "lion_laz.html"},
|
||||
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "Lion LAZ", "url": "lion_laz.html"},
|
||||
{"thumb": "thumbnails/lion.png", "label": "EPT", "url": "ept.html"},
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "EPT Binary", "url": "ept_binary.html"},
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "EPT zstandard", "url": "ept_zstandard.html"},
|
||||
{"thumb": "thumbnails/clipping_volume.png", "label": "Clipping Volume", "url": "clipping_volume.html"},
|
||||
{"thumb": "thumbnails/ca13.png", "label": "CA13", "url": "ca13.html"},
|
||||
{"thumb": "thumbnails/elevation_profile.png", "label": "Elevation Profile", "url": "elevation_profile.html"},
|
||||
|
||||
{"thumb": "thumbnails/elevation_profile.png", "label": "Elevation Profile", "url": "elevation_profile.html"},
|
||||
{"thumb": "thumbnails/measurements.png", "label": "Measurements", "url": "measurements.html"},
|
||||
{"thumb": "thumbnails/meshes.png", "label": "Meshes", "url": "meshes.html"},
|
||||
{"thumb": "thumbnails/multiple_point_clouds.png", "label": "Multiple Point Clouds", "url": "multiple_pointclouds.html"},
|
||||
{"thumb": "thumbnails/features_sorvilier.png", "label": "Features (Sorvilier)", "url": "features_sorvilier.html"},
|
||||
{"thumb": "thumbnails/features_ca13.png", "label": "Features (CA13)", "url": "features_ca13.html"},
|
||||
{"thumb": "thumbnails/annotations.png", "label": "Annotations", "url": "annotations.html"},
|
||||
|
||||
{"thumb": "thumbnails/annotations.png", "label": "Annotations", "url": "annotations.html"},
|
||||
{"thumb": "thumbnails/annotation_hierarchy.png", "label": "Hierarchical Annotations", "url": "annotation_hierarchy.html"},
|
||||
{"thumb": "thumbnails/animation_paths.png", "label": "Animation Path", "url": "animation_paths.html"},
|
||||
{"thumb": "thumbnails/shapefiles.png", "label": "Shapefiles", "url": "shapefiles.html"},
|
||||
{"thumb": "thumbnails/cesium_ca13.png", "label": "Cesium CA13", "url": "cesium_ca13.html"},
|
||||
{"thumb": "thumbnails/cesium_retz.png", "label": "Cesium Retz", "url": "cesium_retz.html"},
|
||||
{"thumb": "thumbnails/cesium_sorvilier.png", "label": "Cesium Sorvilier", "url": "cesium_sorvilier.html"},
|
||||
|
||||
{"thumb": "thumbnails/cesium_sorvilier.png", "label": "Cesium Sorvilier", "url": "cesium_sorvilier.html"},
|
||||
{"thumb": "thumbnails/custom_sidebar_section.png", "label": "Custom Sidebar Section", "url": "custom_sidebar_section.html"},
|
||||
{"thumb": "thumbnails/embedded_iframe.png", "label": "Embedded Iframe", "url": "embedded_iframe.html"},
|
||||
{"thumb": "thumbnails/gradient_colors.png", "label": "Gradient Colors", "url": "gradient_colors.html"}
|
||||
|
||||
BIN
examples/thumbnails/360.jpg
Normal file
BIN
examples/thumbnails/360.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Binary Heap implementation in Javascript
|
||||
** From: http://eloquentjavascript.net/1st_edition/appendix2.htmlt
|
||||
** From: http://eloquentjavascript.net/1st_edition/appendix2.html
|
||||
**
|
||||
** Copyright (c) 2007 Marijn Haverbeke, last modified on November 28 2013.
|
||||
**
|
||||
|
||||
@ -1,945 +0,0 @@
|
||||
/*
|
||||
** Copyright (c) 2012 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are 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 Materials.
|
||||
**
|
||||
** THE MATERIALS ARE 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
// Various functions for helping debug WebGL apps.
|
||||
|
||||
WebGLDebugUtils = function() {
|
||||
|
||||
/**
|
||||
* Wrapped logging function.
|
||||
* @param {string} msg Message to log.
|
||||
*/
|
||||
var log = function(msg) {
|
||||
if (window.console && window.console.log) {
|
||||
window.console.log(msg);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Wrapped error logging function.
|
||||
* @param {string} msg Message to log.
|
||||
*/
|
||||
var error = function(msg) {
|
||||
if (window.console && window.console.error) {
|
||||
window.console.error(msg);
|
||||
} else {
|
||||
log(msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Which arguments are enums based on the number of arguments to the function.
|
||||
* So
|
||||
* 'texImage2D': {
|
||||
* 9: { 0:true, 2:true, 6:true, 7:true },
|
||||
* 6: { 0:true, 2:true, 3:true, 4:true },
|
||||
* },
|
||||
*
|
||||
* means if there are 9 arguments then 6 and 7 are enums, if there are 6
|
||||
* arguments 3 and 4 are enums
|
||||
*
|
||||
* @type {!Object.<number, !Object.<number, string>}
|
||||
*/
|
||||
var glValidEnumContexts = {
|
||||
// Generic setters and getters
|
||||
|
||||
'enable': {1: { 0:true }},
|
||||
'disable': {1: { 0:true }},
|
||||
'getParameter': {1: { 0:true }},
|
||||
|
||||
// Rendering
|
||||
|
||||
'drawArrays': {3:{ 0:true }},
|
||||
'drawElements': {4:{ 0:true, 2:true }},
|
||||
|
||||
// Shaders
|
||||
|
||||
'createShader': {1: { 0:true }},
|
||||
'getShaderParameter': {2: { 1:true }},
|
||||
'getProgramParameter': {2: { 1:true }},
|
||||
'getShaderPrecisionFormat': {2: { 0: true, 1:true }},
|
||||
|
||||
// Vertex attributes
|
||||
|
||||
'getVertexAttrib': {2: { 1:true }},
|
||||
'vertexAttribPointer': {6: { 2:true }},
|
||||
|
||||
// Textures
|
||||
|
||||
'bindTexture': {2: { 0:true }},
|
||||
'activeTexture': {1: { 0:true }},
|
||||
'getTexParameter': {2: { 0:true, 1:true }},
|
||||
'texParameterf': {3: { 0:true, 1:true }},
|
||||
'texParameteri': {3: { 0:true, 1:true, 2:true }},
|
||||
'texImage2D': {
|
||||
9: { 0:true, 2:true, 6:true, 7:true },
|
||||
6: { 0:true, 2:true, 3:true, 4:true }
|
||||
},
|
||||
'texSubImage2D': {
|
||||
9: { 0:true, 6:true, 7:true },
|
||||
7: { 0:true, 4:true, 5:true }
|
||||
},
|
||||
'copyTexImage2D': {8: { 0:true, 2:true }},
|
||||
'copyTexSubImage2D': {8: { 0:true }},
|
||||
'generateMipmap': {1: { 0:true }},
|
||||
'compressedTexImage2D': {7: { 0: true, 2:true }},
|
||||
'compressedTexSubImage2D': {8: { 0: true, 6:true }},
|
||||
|
||||
// Buffer objects
|
||||
|
||||
'bindBuffer': {2: { 0:true }},
|
||||
'bufferData': {3: { 0:true, 2:true }},
|
||||
'bufferSubData': {3: { 0:true }},
|
||||
'getBufferParameter': {2: { 0:true, 1:true }},
|
||||
|
||||
// Renderbuffers and framebuffers
|
||||
|
||||
'pixelStorei': {2: { 0:true, 1:true }},
|
||||
'readPixels': {7: { 4:true, 5:true }},
|
||||
'bindRenderbuffer': {2: { 0:true }},
|
||||
'bindFramebuffer': {2: { 0:true }},
|
||||
'checkFramebufferStatus': {1: { 0:true }},
|
||||
'framebufferRenderbuffer': {4: { 0:true, 1:true, 2:true }},
|
||||
'framebufferTexture2D': {5: { 0:true, 1:true, 2:true }},
|
||||
'getFramebufferAttachmentParameter': {3: { 0:true, 1:true, 2:true }},
|
||||
'getRenderbufferParameter': {2: { 0:true, 1:true }},
|
||||
'renderbufferStorage': {4: { 0:true, 1:true }},
|
||||
|
||||
// Frame buffer operations (clear, blend, depth test, stencil)
|
||||
|
||||
'clear': {1: { 0: { 'enumBitwiseOr': ['COLOR_BUFFER_BIT', 'DEPTH_BUFFER_BIT', 'STENCIL_BUFFER_BIT'] }}},
|
||||
'depthFunc': {1: { 0:true }},
|
||||
'blendFunc': {2: { 0:true, 1:true }},
|
||||
'blendFuncSeparate': {4: { 0:true, 1:true, 2:true, 3:true }},
|
||||
'blendEquation': {1: { 0:true }},
|
||||
'blendEquationSeparate': {2: { 0:true, 1:true }},
|
||||
'stencilFunc': {3: { 0:true }},
|
||||
'stencilFuncSeparate': {4: { 0:true, 1:true }},
|
||||
'stencilMaskSeparate': {2: { 0:true }},
|
||||
'stencilOp': {3: { 0:true, 1:true, 2:true }},
|
||||
'stencilOpSeparate': {4: { 0:true, 1:true, 2:true, 3:true }},
|
||||
|
||||
// Culling
|
||||
|
||||
'cullFace': {1: { 0:true }},
|
||||
'frontFace': {1: { 0:true }},
|
||||
|
||||
// ANGLE_instanced_arrays extension
|
||||
|
||||
'drawArraysInstancedANGLE': {4: { 0:true }},
|
||||
'drawElementsInstancedANGLE': {5: { 0:true, 2:true }},
|
||||
|
||||
// EXT_blend_minmax extension
|
||||
|
||||
'blendEquationEXT': {1: { 0:true }}
|
||||
};
|
||||
|
||||
/**
|
||||
* Map of numbers to names.
|
||||
* @type {Object}
|
||||
*/
|
||||
var glEnums = null;
|
||||
|
||||
/**
|
||||
* Map of names to numbers.
|
||||
* @type {Object}
|
||||
*/
|
||||
var enumStringToValue = null;
|
||||
|
||||
/**
|
||||
* Initializes this module. Safe to call more than once.
|
||||
* @param {!WebGLRenderingContext} ctx A WebGL context. If
|
||||
* you have more than one context it doesn't matter which one
|
||||
* you pass in, it is only used to pull out constants.
|
||||
*/
|
||||
function init(ctx) {
|
||||
if (glEnums == null) {
|
||||
glEnums = { };
|
||||
enumStringToValue = { };
|
||||
for (var propertyName in ctx) {
|
||||
if (typeof ctx[propertyName] == 'number') {
|
||||
glEnums[ctx[propertyName]] = propertyName;
|
||||
enumStringToValue[propertyName] = ctx[propertyName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the utils have been initialized.
|
||||
*/
|
||||
function checkInit() {
|
||||
if (glEnums == null) {
|
||||
throw 'WebGLDebugUtils.init(ctx) not called';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true or false if value matches any WebGL enum
|
||||
* @param {*} value Value to check if it might be an enum.
|
||||
* @return {boolean} True if value matches one of the WebGL defined enums
|
||||
*/
|
||||
function mightBeEnum(value) {
|
||||
checkInit();
|
||||
return (glEnums[value] !== undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an string version of an WebGL enum.
|
||||
*
|
||||
* Example:
|
||||
* var str = WebGLDebugUtil.glEnumToString(ctx.getError());
|
||||
*
|
||||
* @param {number} value Value to return an enum for
|
||||
* @return {string} The string version of the enum.
|
||||
*/
|
||||
function glEnumToString(value) {
|
||||
checkInit();
|
||||
var name = glEnums[value];
|
||||
return (name !== undefined) ? ("gl." + name) :
|
||||
("/*UNKNOWN WebGL ENUM*/ 0x" + value.toString(16) + "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string version of a WebGL argument.
|
||||
* Attempts to convert enum arguments to strings.
|
||||
* @param {string} functionName the name of the WebGL function.
|
||||
* @param {number} numArgs the number of arguments passed to the function.
|
||||
* @param {number} argumentIndx the index of the argument.
|
||||
* @param {*} value The value of the argument.
|
||||
* @return {string} The value as a string.
|
||||
*/
|
||||
function glFunctionArgToString(functionName, numArgs, argumentIndex, value) {
|
||||
var funcInfo = glValidEnumContexts[functionName];
|
||||
if (funcInfo !== undefined) {
|
||||
var funcInfo = funcInfo[numArgs];
|
||||
if (funcInfo !== undefined) {
|
||||
if (funcInfo[argumentIndex]) {
|
||||
if (typeof funcInfo[argumentIndex] === 'object' &&
|
||||
funcInfo[argumentIndex]['enumBitwiseOr'] !== undefined) {
|
||||
var enums = funcInfo[argumentIndex]['enumBitwiseOr'];
|
||||
var orResult = 0;
|
||||
var orEnums = [];
|
||||
for (var i = 0; i < enums.length; ++i) {
|
||||
var enumValue = enumStringToValue[enums[i]];
|
||||
if ((value & enumValue) !== 0) {
|
||||
orResult |= enumValue;
|
||||
orEnums.push(glEnumToString(enumValue));
|
||||
}
|
||||
}
|
||||
if (orResult === value) {
|
||||
return orEnums.join(' | ');
|
||||
} else {
|
||||
return glEnumToString(value);
|
||||
}
|
||||
} else {
|
||||
return glEnumToString(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (value === null) {
|
||||
return "null";
|
||||
} else if (value === undefined) {
|
||||
return "undefined";
|
||||
} else {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the arguments of a WebGL function to a string.
|
||||
* Attempts to convert enum arguments to strings.
|
||||
*
|
||||
* @param {string} functionName the name of the WebGL function.
|
||||
* @param {number} args The arguments.
|
||||
* @return {string} The arguments as a string.
|
||||
*/
|
||||
function glFunctionArgsToString(functionName, args) {
|
||||
// apparently we can't do args.join(",");
|
||||
var argStr = "";
|
||||
var numArgs = args.length;
|
||||
for (var ii = 0; ii < numArgs; ++ii) {
|
||||
argStr += ((ii == 0) ? '' : ', ') +
|
||||
glFunctionArgToString(functionName, numArgs, ii, args[ii]);
|
||||
}
|
||||
return argStr;
|
||||
};
|
||||
|
||||
|
||||
function makePropertyWrapper(wrapper, original, propertyName) {
|
||||
//log("wrap prop: " + propertyName);
|
||||
wrapper.__defineGetter__(propertyName, function() {
|
||||
return original[propertyName];
|
||||
});
|
||||
// TODO(gmane): this needs to handle properties that take more than
|
||||
// one value?
|
||||
wrapper.__defineSetter__(propertyName, function(value) {
|
||||
//log("set: " + propertyName);
|
||||
original[propertyName] = value;
|
||||
});
|
||||
}
|
||||
|
||||
// Makes a function that calls a function on another object.
|
||||
function makeFunctionWrapper(original, functionName) {
|
||||
//log("wrap fn: " + functionName);
|
||||
var f = original[functionName];
|
||||
return function() {
|
||||
//log("call: " + functionName);
|
||||
var result = f.apply(original, arguments);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a WebGL context returns a wrapped context that calls
|
||||
* gl.getError after every command and calls a function if the
|
||||
* result is not gl.NO_ERROR.
|
||||
*
|
||||
* @param {!WebGLRenderingContext} ctx The webgl context to
|
||||
* wrap.
|
||||
* @param {!function(err, funcName, args): void} opt_onErrorFunc
|
||||
* The function to call when gl.getError returns an
|
||||
* error. If not specified the default function calls
|
||||
* console.log with a message.
|
||||
* @param {!function(funcName, args): void} opt_onFunc The
|
||||
* function to call when each webgl function is called.
|
||||
* You can use this to log all calls for example.
|
||||
* @param {!WebGLRenderingContext} opt_err_ctx The webgl context
|
||||
* to call getError on if different than ctx.
|
||||
*/
|
||||
function makeDebugContext(ctx, opt_onErrorFunc, opt_onFunc, opt_err_ctx) {
|
||||
opt_err_ctx = opt_err_ctx || ctx;
|
||||
init(ctx);
|
||||
opt_onErrorFunc = opt_onErrorFunc || function(err, functionName, args) {
|
||||
// apparently we can't do args.join(",");
|
||||
var argStr = "";
|
||||
var numArgs = args.length;
|
||||
for (var ii = 0; ii < numArgs; ++ii) {
|
||||
argStr += ((ii == 0) ? '' : ', ') +
|
||||
glFunctionArgToString(functionName, numArgs, ii, args[ii]);
|
||||
}
|
||||
error("WebGL error "+ glEnumToString(err) + " in "+ functionName +
|
||||
"(" + argStr + ")");
|
||||
};
|
||||
|
||||
// Holds booleans for each GL error so after we get the error ourselves
|
||||
// we can still return it to the client app.
|
||||
var glErrorShadow = { };
|
||||
|
||||
// Makes a function that calls a WebGL function and then calls getError.
|
||||
function makeErrorWrapper(ctx, functionName) {
|
||||
return function() {
|
||||
if (opt_onFunc) {
|
||||
opt_onFunc(functionName, arguments);
|
||||
}
|
||||
var result = ctx[functionName].apply(ctx, arguments);
|
||||
var err = opt_err_ctx.getError();
|
||||
if (err != 0) {
|
||||
glErrorShadow[err] = true;
|
||||
opt_onErrorFunc(err, functionName, arguments);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
// Make a an object that has a copy of every property of the WebGL context
|
||||
// but wraps all functions.
|
||||
var wrapper = {};
|
||||
for (var propertyName in ctx) {
|
||||
if (typeof ctx[propertyName] == 'function') {
|
||||
if (propertyName != 'getExtension') {
|
||||
wrapper[propertyName] = makeErrorWrapper(ctx, propertyName);
|
||||
} else {
|
||||
var wrapped = makeErrorWrapper(ctx, propertyName);
|
||||
wrapper[propertyName] = function () {
|
||||
var result = wrapped.apply(ctx, arguments);
|
||||
return makeDebugContext(result, opt_onErrorFunc, opt_onFunc, opt_err_ctx);
|
||||
};
|
||||
}
|
||||
} else {
|
||||
makePropertyWrapper(wrapper, ctx, propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
// Override the getError function with one that returns our saved results.
|
||||
wrapper.getError = function() {
|
||||
for (var err in glErrorShadow) {
|
||||
if (glErrorShadow.hasOwnProperty(err)) {
|
||||
if (glErrorShadow[err]) {
|
||||
glErrorShadow[err] = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ctx.NO_ERROR;
|
||||
};
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function resetToInitialState(ctx) {
|
||||
var numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
|
||||
var tmp = ctx.createBuffer();
|
||||
ctx.bindBuffer(ctx.ARRAY_BUFFER, tmp);
|
||||
for (var ii = 0; ii < numAttribs; ++ii) {
|
||||
ctx.disableVertexAttribArray(ii);
|
||||
ctx.vertexAttribPointer(ii, 4, ctx.FLOAT, false, 0, 0);
|
||||
ctx.vertexAttrib1f(ii, 0);
|
||||
}
|
||||
ctx.deleteBuffer(tmp);
|
||||
|
||||
var numTextureUnits = ctx.getParameter(ctx.MAX_TEXTURE_IMAGE_UNITS);
|
||||
for (var ii = 0; ii < numTextureUnits; ++ii) {
|
||||
ctx.activeTexture(ctx.TEXTURE0 + ii);
|
||||
ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, null);
|
||||
ctx.bindTexture(ctx.TEXTURE_2D, null);
|
||||
}
|
||||
|
||||
ctx.activeTexture(ctx.TEXTURE0);
|
||||
ctx.useProgram(null);
|
||||
ctx.bindBuffer(ctx.ARRAY_BUFFER, null);
|
||||
ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, null);
|
||||
ctx.bindFramebuffer(ctx.FRAMEBUFFER, null);
|
||||
ctx.bindRenderbuffer(ctx.RENDERBUFFER, null);
|
||||
ctx.disable(ctx.BLEND);
|
||||
ctx.disable(ctx.CULL_FACE);
|
||||
ctx.disable(ctx.DEPTH_TEST);
|
||||
ctx.disable(ctx.DITHER);
|
||||
ctx.disable(ctx.SCISSOR_TEST);
|
||||
ctx.blendColor(0, 0, 0, 0);
|
||||
ctx.blendEquation(ctx.FUNC_ADD);
|
||||
ctx.blendFunc(ctx.ONE, ctx.ZERO);
|
||||
ctx.clearColor(0, 0, 0, 0);
|
||||
ctx.clearDepth(1);
|
||||
ctx.clearStencil(-1);
|
||||
ctx.colorMask(true, true, true, true);
|
||||
ctx.cullFace(ctx.BACK);
|
||||
ctx.depthFunc(ctx.LESS);
|
||||
ctx.depthMask(true);
|
||||
ctx.depthRange(0, 1);
|
||||
ctx.frontFace(ctx.CCW);
|
||||
ctx.hint(ctx.GENERATE_MIPMAP_HINT, ctx.DONT_CARE);
|
||||
ctx.lineWidth(1);
|
||||
ctx.pixelStorei(ctx.PACK_ALIGNMENT, 4);
|
||||
ctx.pixelStorei(ctx.UNPACK_ALIGNMENT, 4);
|
||||
ctx.pixelStorei(ctx.UNPACK_FLIP_Y_WEBGL, false);
|
||||
ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
||||
// TODO: Delete this IF.
|
||||
if (ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL) {
|
||||
ctx.pixelStorei(ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL, ctx.BROWSER_DEFAULT_WEBGL);
|
||||
}
|
||||
ctx.polygonOffset(0, 0);
|
||||
ctx.sampleCoverage(1, false);
|
||||
ctx.scissor(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.stencilFunc(ctx.ALWAYS, 0, 0xFFFFFFFF);
|
||||
ctx.stencilMask(0xFFFFFFFF);
|
||||
ctx.stencilOp(ctx.KEEP, ctx.KEEP, ctx.KEEP);
|
||||
ctx.viewport(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT | ctx.STENCIL_BUFFER_BIT);
|
||||
|
||||
// TODO: This should NOT be needed but Firefox fails with 'hint'
|
||||
while(ctx.getError());
|
||||
}
|
||||
|
||||
function makeLostContextSimulatingCanvas(canvas) {
|
||||
var unwrappedContext_;
|
||||
var wrappedContext_;
|
||||
var onLost_ = [];
|
||||
var onRestored_ = [];
|
||||
var wrappedContext_ = {};
|
||||
var contextId_ = 1;
|
||||
var contextLost_ = false;
|
||||
var resourceId_ = 0;
|
||||
var resourceDb_ = [];
|
||||
var numCallsToLoseContext_ = 0;
|
||||
var numCalls_ = 0;
|
||||
var canRestore_ = false;
|
||||
var restoreTimeout_ = 0;
|
||||
|
||||
// Holds booleans for each GL error so can simulate errors.
|
||||
var glErrorShadow_ = { };
|
||||
|
||||
canvas.getContext = function(f) {
|
||||
return function() {
|
||||
var ctx = f.apply(canvas, arguments);
|
||||
// Did we get a context and is it a WebGL context?
|
||||
if (ctx instanceof WebGLRenderingContext) {
|
||||
if (ctx != unwrappedContext_) {
|
||||
if (unwrappedContext_) {
|
||||
throw "got different context"
|
||||
}
|
||||
unwrappedContext_ = ctx;
|
||||
wrappedContext_ = makeLostContextSimulatingContext(unwrappedContext_);
|
||||
}
|
||||
return wrappedContext_;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
}(canvas.getContext);
|
||||
|
||||
function wrapEvent(listener) {
|
||||
if (typeof(listener) == "function") {
|
||||
return listener;
|
||||
} else {
|
||||
return function(info) {
|
||||
listener.handleEvent(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var addOnContextLostListener = function(listener) {
|
||||
onLost_.push(wrapEvent(listener));
|
||||
};
|
||||
|
||||
var addOnContextRestoredListener = function(listener) {
|
||||
onRestored_.push(wrapEvent(listener));
|
||||
};
|
||||
|
||||
|
||||
function wrapAddEventListener(canvas) {
|
||||
var f = canvas.addEventListener;
|
||||
canvas.addEventListener = function(type, listener, bubble) {
|
||||
switch (type) {
|
||||
case 'webglcontextlost':
|
||||
addOnContextLostListener(listener);
|
||||
break;
|
||||
case 'webglcontextrestored':
|
||||
addOnContextRestoredListener(listener);
|
||||
break;
|
||||
default:
|
||||
f.apply(canvas, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
wrapAddEventListener(canvas);
|
||||
|
||||
canvas.loseContext = function() {
|
||||
if (!contextLost_) {
|
||||
contextLost_ = true;
|
||||
numCallsToLoseContext_ = 0;
|
||||
++contextId_;
|
||||
while (unwrappedContext_.getError());
|
||||
clearErrors();
|
||||
glErrorShadow_[unwrappedContext_.CONTEXT_LOST_WEBGL] = true;
|
||||
var event = makeWebGLContextEvent("context lost");
|
||||
var callbacks = onLost_.slice();
|
||||
setTimeout(function() {
|
||||
//log("numCallbacks:" + callbacks.length);
|
||||
for (var ii = 0; ii < callbacks.length; ++ii) {
|
||||
//log("calling callback:" + ii);
|
||||
callbacks[ii](event);
|
||||
}
|
||||
if (restoreTimeout_ >= 0) {
|
||||
setTimeout(function() {
|
||||
canvas.restoreContext();
|
||||
}, restoreTimeout_);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
canvas.restoreContext = function() {
|
||||
if (contextLost_) {
|
||||
if (onRestored_.length) {
|
||||
setTimeout(function() {
|
||||
if (!canRestore_) {
|
||||
throw "can not restore. webglcontestlost listener did not call event.preventDefault";
|
||||
}
|
||||
freeResources();
|
||||
resetToInitialState(unwrappedContext_);
|
||||
contextLost_ = false;
|
||||
numCalls_ = 0;
|
||||
canRestore_ = false;
|
||||
var callbacks = onRestored_.slice();
|
||||
var event = makeWebGLContextEvent("context restored");
|
||||
for (var ii = 0; ii < callbacks.length; ++ii) {
|
||||
callbacks[ii](event);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
canvas.loseContextInNCalls = function(numCalls) {
|
||||
if (contextLost_) {
|
||||
throw "You can not ask a lost contet to be lost";
|
||||
}
|
||||
numCallsToLoseContext_ = numCalls_ + numCalls;
|
||||
};
|
||||
|
||||
canvas.getNumCalls = function() {
|
||||
return numCalls_;
|
||||
};
|
||||
|
||||
canvas.setRestoreTimeout = function(timeout) {
|
||||
restoreTimeout_ = timeout;
|
||||
};
|
||||
|
||||
function isWebGLObject(obj) {
|
||||
//return false;
|
||||
return (obj instanceof WebGLBuffer ||
|
||||
obj instanceof WebGLFramebuffer ||
|
||||
obj instanceof WebGLProgram ||
|
||||
obj instanceof WebGLRenderbuffer ||
|
||||
obj instanceof WebGLShader ||
|
||||
obj instanceof WebGLTexture);
|
||||
}
|
||||
|
||||
function checkResources(args) {
|
||||
for (var ii = 0; ii < args.length; ++ii) {
|
||||
var arg = args[ii];
|
||||
if (isWebGLObject(arg)) {
|
||||
return arg.__webglDebugContextLostId__ == contextId_;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function clearErrors() {
|
||||
var k = Object.keys(glErrorShadow_);
|
||||
for (var ii = 0; ii < k.length; ++ii) {
|
||||
delete glErrorShadow_[k];
|
||||
}
|
||||
}
|
||||
|
||||
function loseContextIfTime() {
|
||||
++numCalls_;
|
||||
if (!contextLost_) {
|
||||
if (numCallsToLoseContext_ == numCalls_) {
|
||||
canvas.loseContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Makes a function that simulates WebGL when out of context.
|
||||
function makeLostContextFunctionWrapper(ctx, functionName) {
|
||||
var f = ctx[functionName];
|
||||
return function() {
|
||||
// log("calling:" + functionName);
|
||||
// Only call the functions if the context is not lost.
|
||||
loseContextIfTime();
|
||||
if (!contextLost_) {
|
||||
//if (!checkResources(arguments)) {
|
||||
// glErrorShadow_[wrappedContext_.INVALID_OPERATION] = true;
|
||||
// return;
|
||||
//}
|
||||
var result = f.apply(ctx, arguments);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function freeResources() {
|
||||
for (var ii = 0; ii < resourceDb_.length; ++ii) {
|
||||
var resource = resourceDb_[ii];
|
||||
if (resource instanceof WebGLBuffer) {
|
||||
unwrappedContext_.deleteBuffer(resource);
|
||||
} else if (resource instanceof WebGLFramebuffer) {
|
||||
unwrappedContext_.deleteFramebuffer(resource);
|
||||
} else if (resource instanceof WebGLProgram) {
|
||||
unwrappedContext_.deleteProgram(resource);
|
||||
} else if (resource instanceof WebGLRenderbuffer) {
|
||||
unwrappedContext_.deleteRenderbuffer(resource);
|
||||
} else if (resource instanceof WebGLShader) {
|
||||
unwrappedContext_.deleteShader(resource);
|
||||
} else if (resource instanceof WebGLTexture) {
|
||||
unwrappedContext_.deleteTexture(resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeWebGLContextEvent(statusMessage) {
|
||||
return {
|
||||
statusMessage: statusMessage,
|
||||
preventDefault: function() {
|
||||
canRestore_ = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return canvas;
|
||||
|
||||
function makeLostContextSimulatingContext(ctx) {
|
||||
// copy all functions and properties to wrapper
|
||||
for (var propertyName in ctx) {
|
||||
if (typeof ctx[propertyName] == 'function') {
|
||||
wrappedContext_[propertyName] = makeLostContextFunctionWrapper(
|
||||
ctx, propertyName);
|
||||
} else {
|
||||
makePropertyWrapper(wrappedContext_, ctx, propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap a few functions specially.
|
||||
wrappedContext_.getError = function() {
|
||||
loseContextIfTime();
|
||||
if (!contextLost_) {
|
||||
var err;
|
||||
while (err = unwrappedContext_.getError()) {
|
||||
glErrorShadow_[err] = true;
|
||||
}
|
||||
}
|
||||
for (var err in glErrorShadow_) {
|
||||
if (glErrorShadow_[err]) {
|
||||
delete glErrorShadow_[err];
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return wrappedContext_.NO_ERROR;
|
||||
};
|
||||
|
||||
var creationFunctions = [
|
||||
"createBuffer",
|
||||
"createFramebuffer",
|
||||
"createProgram",
|
||||
"createRenderbuffer",
|
||||
"createShader",
|
||||
"createTexture"
|
||||
];
|
||||
for (var ii = 0; ii < creationFunctions.length; ++ii) {
|
||||
var functionName = creationFunctions[ii];
|
||||
wrappedContext_[functionName] = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return null;
|
||||
}
|
||||
var obj = f.apply(ctx, arguments);
|
||||
obj.__webglDebugContextLostId__ = contextId_;
|
||||
resourceDb_.push(obj);
|
||||
return obj;
|
||||
};
|
||||
}(ctx[functionName]);
|
||||
}
|
||||
|
||||
var functionsThatShouldReturnNull = [
|
||||
"getActiveAttrib",
|
||||
"getActiveUniform",
|
||||
"getBufferParameter",
|
||||
"getContextAttributes",
|
||||
"getAttachedShaders",
|
||||
"getFramebufferAttachmentParameter",
|
||||
"getParameter",
|
||||
"getProgramParameter",
|
||||
"getProgramInfoLog",
|
||||
"getRenderbufferParameter",
|
||||
"getShaderParameter",
|
||||
"getShaderInfoLog",
|
||||
"getShaderSource",
|
||||
"getTexParameter",
|
||||
"getUniform",
|
||||
"getUniformLocation",
|
||||
"getVertexAttrib"
|
||||
];
|
||||
for (var ii = 0; ii < functionsThatShouldReturnNull.length; ++ii) {
|
||||
var functionName = functionsThatShouldReturnNull[ii];
|
||||
wrappedContext_[functionName] = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return null;
|
||||
}
|
||||
return f.apply(ctx, arguments);
|
||||
}
|
||||
}(wrappedContext_[functionName]);
|
||||
}
|
||||
|
||||
var isFunctions = [
|
||||
"isBuffer",
|
||||
"isEnabled",
|
||||
"isFramebuffer",
|
||||
"isProgram",
|
||||
"isRenderbuffer",
|
||||
"isShader",
|
||||
"isTexture"
|
||||
];
|
||||
for (var ii = 0; ii < isFunctions.length; ++ii) {
|
||||
var functionName = isFunctions[ii];
|
||||
wrappedContext_[functionName] = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return false;
|
||||
}
|
||||
return f.apply(ctx, arguments);
|
||||
}
|
||||
}(wrappedContext_[functionName]);
|
||||
}
|
||||
|
||||
wrappedContext_.checkFramebufferStatus = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return wrappedContext_.FRAMEBUFFER_UNSUPPORTED;
|
||||
}
|
||||
return f.apply(ctx, arguments);
|
||||
};
|
||||
}(wrappedContext_.checkFramebufferStatus);
|
||||
|
||||
wrappedContext_.getAttribLocation = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return -1;
|
||||
}
|
||||
return f.apply(ctx, arguments);
|
||||
};
|
||||
}(wrappedContext_.getAttribLocation);
|
||||
|
||||
wrappedContext_.getVertexAttribOffset = function(f) {
|
||||
return function() {
|
||||
loseContextIfTime();
|
||||
if (contextLost_) {
|
||||
return 0;
|
||||
}
|
||||
return f.apply(ctx, arguments);
|
||||
};
|
||||
}(wrappedContext_.getVertexAttribOffset);
|
||||
|
||||
wrappedContext_.isContextLost = function() {
|
||||
return contextLost_;
|
||||
};
|
||||
|
||||
return wrappedContext_;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
* Initializes this module. Safe to call more than once.
|
||||
* @param {!WebGLRenderingContext} ctx A WebGL context. If
|
||||
* you have more than one context it doesn't matter which one
|
||||
* you pass in, it is only used to pull out constants.
|
||||
*/
|
||||
'init': init,
|
||||
|
||||
/**
|
||||
* Returns true or false if value matches any WebGL enum
|
||||
* @param {*} value Value to check if it might be an enum.
|
||||
* @return {boolean} True if value matches one of the WebGL defined enums
|
||||
*/
|
||||
'mightBeEnum': mightBeEnum,
|
||||
|
||||
/**
|
||||
* Gets an string version of an WebGL enum.
|
||||
*
|
||||
* Example:
|
||||
* WebGLDebugUtil.init(ctx);
|
||||
* var str = WebGLDebugUtil.glEnumToString(ctx.getError());
|
||||
*
|
||||
* @param {number} value Value to return an enum for
|
||||
* @return {string} The string version of the enum.
|
||||
*/
|
||||
'glEnumToString': glEnumToString,
|
||||
|
||||
/**
|
||||
* Converts the argument of a WebGL function to a string.
|
||||
* Attempts to convert enum arguments to strings.
|
||||
*
|
||||
* Example:
|
||||
* WebGLDebugUtil.init(ctx);
|
||||
* var str = WebGLDebugUtil.glFunctionArgToString('bindTexture', 2, 0, gl.TEXTURE_2D);
|
||||
*
|
||||
* would return 'TEXTURE_2D'
|
||||
*
|
||||
* @param {string} functionName the name of the WebGL function.
|
||||
* @param {number} numArgs The number of arguments
|
||||
* @param {number} argumentIndx the index of the argument.
|
||||
* @param {*} value The value of the argument.
|
||||
* @return {string} The value as a string.
|
||||
*/
|
||||
'glFunctionArgToString': glFunctionArgToString,
|
||||
|
||||
/**
|
||||
* Converts the arguments of a WebGL function to a string.
|
||||
* Attempts to convert enum arguments to strings.
|
||||
*
|
||||
* @param {string} functionName the name of the WebGL function.
|
||||
* @param {number} args The arguments.
|
||||
* @return {string} The arguments as a string.
|
||||
*/
|
||||
'glFunctionArgsToString': glFunctionArgsToString,
|
||||
|
||||
/**
|
||||
* Given a WebGL context returns a wrapped context that calls
|
||||
* gl.getError after every command and calls a function if the
|
||||
* result is not NO_ERROR.
|
||||
*
|
||||
* You can supply your own function if you want. For example, if you'd like
|
||||
* an exception thrown on any GL error you could do this
|
||||
*
|
||||
* function throwOnGLError(err, funcName, args) {
|
||||
* throw WebGLDebugUtils.glEnumToString(err) +
|
||||
* " was caused by call to " + funcName;
|
||||
* };
|
||||
*
|
||||
* ctx = WebGLDebugUtils.makeDebugContext(
|
||||
* canvas.getContext("webgl"), throwOnGLError);
|
||||
*
|
||||
* @param {!WebGLRenderingContext} ctx The webgl context to wrap.
|
||||
* @param {!function(err, funcName, args): void} opt_onErrorFunc The function
|
||||
* to call when gl.getError returns an error. If not specified the default
|
||||
* function calls console.log with a message.
|
||||
* @param {!function(funcName, args): void} opt_onFunc The
|
||||
* function to call when each webgl function is called. You
|
||||
* can use this to log all calls for example.
|
||||
*/
|
||||
'makeDebugContext': makeDebugContext,
|
||||
|
||||
/**
|
||||
* Given a canvas element returns a wrapped canvas element that will
|
||||
* simulate lost context. The canvas returned adds the following functions.
|
||||
*
|
||||
* loseContext:
|
||||
* simulates a lost context event.
|
||||
*
|
||||
* restoreContext:
|
||||
* simulates the context being restored.
|
||||
*
|
||||
* lostContextInNCalls:
|
||||
* loses the context after N gl calls.
|
||||
*
|
||||
* getNumCalls:
|
||||
* tells you how many gl calls there have been so far.
|
||||
*
|
||||
* setRestoreTimeout:
|
||||
* sets the number of milliseconds until the context is restored
|
||||
* after it has been lost. Defaults to 0. Pass -1 to prevent
|
||||
* automatic restoring.
|
||||
*
|
||||
* @param {!Canvas} canvas The canvas element to wrap.
|
||||
*/
|
||||
'makeLostContextSimulatingCanvas': makeLostContextSimulatingCanvas,
|
||||
|
||||
/**
|
||||
* Resets a context to the initial state.
|
||||
* @param {!WebGLRenderingContext} ctx The webgl context to
|
||||
* reset.
|
||||
*/
|
||||
'resetToInitialState': resetToInitialState
|
||||
};
|
||||
|
||||
}();
|
||||
@ -44,7 +44,9 @@
|
||||
"perspective_camera_control": "Perspective camera",
|
||||
"orthographic_camera_control": "Orthographic camera",
|
||||
"navigation_cube_control": "Navigation cube",
|
||||
"remove_all_clipping_volumes": "Remove all clipping volumes"
|
||||
"remove_all_clipping_volumes": "Remove all clipping volumes",
|
||||
"compass": "Compass",
|
||||
"camera_animation": "Camera Animation"
|
||||
},
|
||||
"appearance": {
|
||||
"nb_max_pts": "Point budget",
|
||||
|
||||
@ -86,7 +86,7 @@ export class CameraAnimationPanel{
|
||||
let elNewKeyframe = $(`
|
||||
<div style="display: flex; margin: 0.2em 0em">
|
||||
<span style="flex-grow: 1"></span>
|
||||
<input type="button" name="add" value="create control point" />
|
||||
<input type="button" name="add" value="insert control point" />
|
||||
<span style="flex-grow: 1"></span>
|
||||
</div>
|
||||
`);
|
||||
|
||||
@ -413,10 +413,15 @@ export class PropertiesPanel{
|
||||
let selectedValue = attributeSelection.selectmenu().val();
|
||||
material.activeAttributeName = selectedValue;
|
||||
|
||||
const attribute = pointcloud.getAttribute(selectedValue);
|
||||
let attribute = pointcloud.getAttribute(selectedValue);
|
||||
|
||||
const isIntensity = attribute !== null
|
||||
&& (attribute.name === "intensity" || attribute.name === "intensity gradient");
|
||||
if(selectedValue === "intensity gradient"){
|
||||
attribute = pointcloud.getAttribute("intensity");
|
||||
}
|
||||
|
||||
|
||||
|
||||
const isIntensity = ["intensity", "intensity gradient"].includes(attribute.name);
|
||||
if(isIntensity){
|
||||
if(pointcloud.material.intensityRange[0] === Infinity){
|
||||
pointcloud.material.intensityRange = attribute.range;
|
||||
|
||||
@ -176,24 +176,48 @@
|
||||
<li>License: <a target="_blank" href="http://potree.org/wp/potree_license/">FreeBSD (2-clause BSD)<a></li>
|
||||
<li>Libraries:
|
||||
<ul>
|
||||
<li><a target="_blank" href="http://threejs.org/">three.js</a></li>
|
||||
<li><a target="_blank" href="https://cesium.com/">Cesium</a></li>
|
||||
<li><a target="_blank" href="https://d3js.org/">D3.js</a></li>
|
||||
<li><a target="_blank" href="https://entwine.io/entwine-point-tile.html/">Entwine / EPT</a></li>
|
||||
<li><a target="_blank" href="https://github.com/ngageoint/geopackage-js/">geopackage-js</a></li>
|
||||
<li><a target="_blank" href="https://www.i18next.com/">i18next</a></li>
|
||||
<li><a target="_blank" href="https://jquery.com/">Jquery</a></li>
|
||||
<li><a target="_blank" href="http://www.laszip.org/">laszip</a></li>
|
||||
<li><a target="_blank" href="https://github.com/verma/plasio">Plas.io (laslaz) </a></li>
|
||||
<li><a target="_blank" href="https://jqueryui.com/">jQuery user interface</a></li>
|
||||
<li><a target="_blank" href="https://www.jstree.com/">jstree</a></li>
|
||||
<li><a target="_blank" href="https://www.clicktorelease.com/code/THREE.MeshLine/demo/index.html/">MeshLine</a></li>
|
||||
<li><a target="_blank" href="http://openlayers.org/">OpenLayers3</a></li>
|
||||
<li><a target="_blank" href="https://eloquentjavascript.net/1st_edition/appendix2.html/">BinaryHeap</a></li>
|
||||
<li><a target="_blank" href="https://github.com/dataarts/dat.gui/">dat.gui</a></li>
|
||||
<li><a target="_blank" href="https://github.com/mrdoob/stats.js/">stats.js</a></li>
|
||||
<li><a target="_blank" href="https://github.com/verma/plasio">Plas.io (laslaz) </a></li>
|
||||
<li><a target="_blank" href="http://proj4js.org/">proj4js</a></li>
|
||||
<li><a target="_blank" href="https://github.com/mbostock/shapefile/">shapefile</a></li>
|
||||
<li><a target="_blank" href="http://bgrins.github.io/spectrum/">Spectrum</a></li>
|
||||
<li><a target="_blank" href="https://github.com/sql-js/sql.js/">sql.js</a></li>
|
||||
<li><a target="_blank" href="http://threejs.org/">three.js</a></li>
|
||||
<li><a target="_blank" href="https://github.com/tweenjs/tween.js/">tween</a></li>
|
||||
<li><a target="_blank" href="https://github.com/i18next/i18next/">i18next</a></li>
|
||||
<li><a target="_blank" href="http://www.laszip.org/">laszip</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li>Donators:
|
||||
<ul>
|
||||
<li><a target="_blank" href="http://www.ne.ch/autorites/DDTE/SGRF/SITN/Pages/accueil.aspx/">SITN</a></li>
|
||||
<li><a target="_blank" href="http://www.synth3d.co/">Synth3D</a></li>
|
||||
<li><a target="_blank" href="http://www.geocue.com/">GeoCue</a></li>
|
||||
<li><a target="_blank" href="http://rapidlasso.com/">rapidlasso</a></li>
|
||||
|
||||
<li><a target="_blank" href="https://www.bart.gov/">BART</a></li>
|
||||
|
||||
<li><a target="_blank" href="https://georepublic.info/en/">georepublic</a></li>
|
||||
<li><a target="_blank" href="http://sitn.ne.ch/">sitn</a></li>
|
||||
|
||||
<li><a target="_blank" href="http://www.helimap.com">Helimap</a></li>
|
||||
<li><a target="_blank" href="http://www.vevey.ch">Vevey</a></li>
|
||||
<li><a target="_blank" href="https://www.yverdon-les-bains.ch">Yverdon-les-Bains</a></li>
|
||||
<li><a target="_blank" href="http://archpro.lbg.ac.at/">LBI ArchPro</a></li>
|
||||
<li><a target="_blank" href="http://www.kts.co.jp/">KTS</a></li>
|
||||
<li><a target="_blank" href="http://www.veesus.com/veesus/index.php">Veesus</a></li>
|
||||
<li><a target="_blank" href="http://sigeom.ch/">sigeom sa</a></li>
|
||||
<li><a target="_blank" href="http://archpro.lbg.ac.at/">LBI ArchPro</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Credits:
|
||||
|
||||
@ -1381,7 +1381,7 @@ export class Sidebar{
|
||||
|
||||
elNavigation.append(this.createToolIcon(
|
||||
Potree.resourcePath + "/images/compas.svg",
|
||||
"Compass",
|
||||
"[title]tt.compass",
|
||||
() => {
|
||||
const visible = !this.viewer.compass.isVisible();
|
||||
this.viewer.compass.setVisible(visible);
|
||||
@ -1390,7 +1390,7 @@ export class Sidebar{
|
||||
|
||||
elNavigation.append(this.createToolIcon(
|
||||
Potree.resourcePath + "/icons/camera_animation.svg",
|
||||
"Camera Animation",
|
||||
"[title]tt.camera_animation",
|
||||
() => {
|
||||
const animation = CameraAnimation.defaultFromView(this.viewer);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user