Merge branch 'develop' of github.com:potree/potree into develop
Conflicts:
@ -10,5 +10,8 @@ Use the PotreeConverter to convert your own point clouds into the potree format.
|
||||
PotreeConverter binaries for windows are available here:
|
||||
http://potree.org/downloads/PotreeConverter_2014.01.22.zip
|
||||
|
||||
PotreeConverter source is available here:
|
||||
https://github.com/potree/PotreeConverter
|
||||
|
||||
## License
|
||||
Potree is available under the FreeBSD license.
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
# Documentation
|
||||
|
||||
* [File Format Description](./file_format.md)
|
||||
* [Materials and Rendermodes](./materials_and_rendermodes.md)
|
||||
* [How Does Loading Nodes Work?](./how_does_loading_nodes_work.md)
|
||||
|
||||
## Introduction
|
||||
## Introduction
|
||||
|
||||
Potree is a WebGL based viewer for large point clouds. The idea is that, similar to Google Maps, only visible parts up to a certain level of detail
|
||||
will be loaded and displayed. In order to achieve this, points are partitioned into an octree.
|
||||
The root node r contains a sparse subset of the data. All of its children contain another sparse subset which, combined, will gradualy increase
|
||||
the level of detail.
|
||||
the level of detail.
|
||||
|
||||
|  |  |  |  |
|
||||
| ------------- |:-------------:| -----:| --- |
|
||||
|
||||
@ -34,7 +34,7 @@ Stores information about the pointcloud in JSON format.
|
||||
|
||||
The property "pointAttributes" indicates how each point is stored. At the moment, you should stick to the format given in the example below. "POSITION_CARTESIAN" and "COLOR_PACKED" means that each point is stored as 3 32bit floats for x,y and z coordinates and 4 unsigned bytes for r,g,b and a colors.
|
||||
|
||||
The hierarchy property contains all nodes and the number of points in each node. The nodes must be stored top to bottom, i.e. root at the beginning and leafs at the end.
|
||||
The hierarchy property contains all nodes and the number of points in each node. The nodes must be stored top to bottom, i.e. root at the beginning and leaf-nodes at the end.
|
||||
|
||||
{
|
||||
"octreeDir": "data",
|
||||
|
||||
@ -1,4 +1,91 @@
|
||||
|
||||
# How Does Loading Nodes Work?
|
||||
|
||||
TODO
|
||||
Relevant classes are:
|
||||
|
||||
* <b>PointCloudOctree</b> <br>
|
||||
Manages the octree. Contains methods that finds currently visible nodes for rendering
|
||||
or loading.
|
||||
* <b>PointCloudOctreeNode</b><br>
|
||||
The hierarchy consists of instances of this class. Contains methods to load or unload
|
||||
point cloud data.
|
||||
* <b>PointCloudOctreeSceneNode</b><br>
|
||||
A subclass of SceneNode that can be attached to the scenegraph.
|
||||
Contains the PointCloudOctree instance.
|
||||
* <b>POCLoader</b><br>
|
||||
Loads the point cloud hierarchy from a file.
|
||||
|
||||
## Loading Data
|
||||
|
||||
At first, <b>POCLoader.load(file)</b> reads the point cloud hierarchy from cloud.js and
|
||||
builds a graph of _PointcloudOctreeNode_ instances.
|
||||
This graph will be attached to a _PointCloudOctree_ instance.
|
||||
During rendering, <b>PointCloudOctree.prepareRender()</b> traverses through nodes that
|
||||
are visible from the current point of view. If it encounters a node whose point cloud data
|
||||
has not been loaded, it will stop traversing further down the hierarchy and schedule
|
||||
it for loading by adding it to _loadQueue_.
|
||||
|
||||
// schedule loading of missing point cloud data
|
||||
if (shouldBeRendered && current.pointCloud == null) {
|
||||
if(!current.isLoading){
|
||||
this.loadQueue.push(current);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
The last step of _prepareRender() is a call to <b>PointcloudOctree.processLoadQueue()</b>.
|
||||
Nodes in _loadQueue_ are sorted by their size and we want to load larger nodes first so
|
||||
_processLoadQueue()_ will tell the first few nodes in _loadQueue_ to start loading
|
||||
point cloud data by calling _PointcloudOctreeNode.loadCloudAjax(node)_.
|
||||
The remaining nodes in the queue will be ignored.
|
||||
They'll be loaded at a later time once all their ancestors have been loaded.
|
||||
Additionaly, there are checks to make sure that the size of all loaded nodes does not
|
||||
exceed the point cloud memory limit and that no more than _loadingNodesLimit_
|
||||
nodes are loaded at a time.
|
||||
|
||||
// process the first x nodes in the queue.
|
||||
if(this.loadQueue.length > 0 ){
|
||||
for(var i = 0; i < Math.min(x, this.loadQueue.length); i++){
|
||||
if(lru.byteSize + this.loadQueue[i].sizeInBytes() < PointcloudOctreeNode.memoryThreshold){
|
||||
if(this.nodesBeeingLoaded.length < this.loadingNodesLimit){
|
||||
PointcloudOctreeNode.loadCloudAjax(this.loadQueue[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<b>PointcloudOctreeNode.loadCloudAjax(node)</b> creates an asynchronous XMLHttpRequest
|
||||
to read the point cloud data from the corresponding file in _./data_.
|
||||
Once the request is finished, _PointcloudOctreeNode.loadCloudData(node, buffer, url)_
|
||||
is called to send the data directly to the GPU.
|
||||
|
||||
## Cleanup Data
|
||||
|
||||
Pointcloud data can be very large and often it might be necessary to unload some data
|
||||
to create space for new data.
|
||||
_PointcloudOctreeNode.memoryThreshold_ defines a limit for how much point cloud data
|
||||
potree will load. If loading a new node exceeds this limit, potree will first remove
|
||||
some old nodes that weren't rendered in a while.
|
||||
<b>PointcloudOctreeNode.lruNodes</b> (least-recently-used nodes) contains a list of all loaded nodes, ordered by
|
||||
the last time they've been rendered. Recently rendered nodes are at the end of the list.
|
||||
<b>PointcloudOctree.cleanupCache(bytesNeeded, exceptionsRenderQueue)</b>
|
||||
checks if the byte size of all currently loaded nodes, plus the additional size of
|
||||
_bytesNeeded_ exceeds the limit. If it does, it will remove the first few nodes
|
||||
of _lruNodes_, except nodes contained in _exceptionsRenderQueue_.
|
||||
This is done to avoid removing nodes that were scheduled to be rendered.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
docs/images/filtered_spats_sum_of_weights.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
docs/images/filtered_splats_normalized.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
docs/images/filtered_splats_overlapping.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
docs/images/filtered_splats_weighted_sum.png
Normal file
|
After Width: | Height: | Size: 183 KiB |
BIN
docs/images/lion_filtered_splats.jpg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
docs/images/lion_fixed_circles.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
docs/images/lion_weighted_circles.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
77
docs/materials_and_rendermodes.md
Normal file
@ -0,0 +1,77 @@
|
||||
# Materials And Rendermodes
|
||||
|
||||
The default material for point clouds is an instance of PointCloudMaterial with the name "pointCloud".
|
||||
In order to change its attributes, you have to retrieve it by calling:
|
||||
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
|
||||
There are 3 rendermodes available:
|
||||
|
||||
* <b>FIXED_CIRCLE</b>
|
||||
Render points as circles with a fixed size. The pointSize attribute indicates the pixel diameter.
|
||||
* <b>WEIGHTED_CIRCLE</b>
|
||||
Render points as circles with a size depending on the distance to the viewer.
|
||||
* <b>FILTERED_SPLAT</b>
|
||||
Interpolates between overlapping points. High quality but very slow.
|
||||
|
||||
You can change the render mode by calling
|
||||
|
||||
material.renderMode = PointCloudRenderMode.FIXED_CIRCLE;
|
||||
|
||||
|  |  |  |
|
||||
| --------------------------------------- | ------------------------------------------ | ----------------------------------------- |
|
||||
| FIXED_CIRCLES with point-size 2. All points have pixel diameter 2.| WEIGHTED_CIRCLES with point-size 1. Size varies depending on distance from camera. | FILTERED_SPLATS with point-size 1. In this mode, points have the same size as with WEIGHTED_CIRCLES, but overlapping points are interpolated. |
|
||||
|
||||
|
||||
## PointCloudMaterial
|
||||
|
||||
PointCloudMaterial is actually a combination of other materials.
|
||||
It dispatches render calls to the material in use.
|
||||
|
||||
## FixedPointSizeMaterial
|
||||
|
||||
Used when rendermode is set to FIXED_CIRCLE.
|
||||
The _render(sceneNode, renderer)_ function extracts extracts all pointCloud from sceneNode,
|
||||
that should be rendered. The _renderPointClouds()_ function invokes the WebGL
|
||||
draw calls.
|
||||
|
||||
## WeightedPointSizeMaterial
|
||||
|
||||
Used when rendermode is set to WEIGHTED_CIRCLE.
|
||||
It works the same way as FixedPointSizeMaterial, except with a different vertex shader
|
||||
that adjusts the point size according to the distance from the viewer.
|
||||
|
||||
## FilteredSplatsMaterial
|
||||
|
||||
Used when rendermode is set to FILTERED_SPLATS.
|
||||
This material is based on the paper [High Quality Splatting on Today's GPUs](http://graphics.ucsd.edu/~matthias/Papers/HighQualitySplattingOnGPUs.pdf).
|
||||
|
||||
The idea is, that overlapping points should be blended together, if their distance to the viewer is roughly the same.
|
||||
Simple point rendering usualy leads to overlapping points:<br>
|
||||

|
||||
|
||||
This material consists of 3 passes:
|
||||
|
||||
1. <b>Depth-Pass</b> Renders the point cloud into a depth buffer. Depth values are pushed away from the viewer with an offset given by uBlendDepth.
|
||||
Fragments within this offset-range will be blended together. Fragments that are farther away will be discarded during the depth test.
|
||||
2. <b>Attribute-Pass</b> Renders the point cloud with weighted attributes and blend mode set to ADD.
|
||||
The weight function gives fragments that are closer to the center a higher weight.<br>
|
||||
The result of this pass is a weighted sum of overlapping attributes, stored in the RGB component:<br>
|
||||

|
||||
And the sum of weights, stored in the alpha component:<br>
|
||||

|
||||
3. <b>Normalization-Pass</b> In this pass, the output of the previous pass is normalized by
|
||||
dividing the weighted sum of colors in the RGB component by the sum of weights in the alpha component.
|
||||
It's essentially a screen-space filter so this time, not the point cloud is rendered but
|
||||
a rectangle that spans the whole screen with the output of the previous pass
|
||||
as the its texture. This is one possible result:<br>
|
||||
<br>
|
||||
The smoothness of the transition depends on the weight function. By adjusting the weight function, you can get
|
||||
very smooth or relatively sharp borders.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="resources/style/potree.css" />
|
||||
<script type="text/javascript" src="src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("./");</script>
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/potree.css" />
|
||||
<script type="text/javascript" src="../src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("..");</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -23,35 +23,40 @@ DemoKeyListener.prototype.invokeKeyDown = function(){}
|
||||
DemoKeyListener.prototype.invokeKeyUp = function(){}
|
||||
|
||||
function init() {
|
||||
|
||||
// init potree
|
||||
var canvas = document.getElementById("canvas");
|
||||
Potree.shaderDir = "../resources/shader";
|
||||
var success = Potree.init(canvas);
|
||||
if(!success){
|
||||
return;
|
||||
}
|
||||
|
||||
// load point cloud
|
||||
var scene = Potree.currentScene;
|
||||
var cloudURL = "resources/pointclouds/lion_takanawa/cloud.js";
|
||||
|
||||
var cloudURL = "../resources/pointclouds/lion_takanawa/cloud.js";
|
||||
var pcoNode = POCLoader.load(cloudURL);
|
||||
scene.rootNode.addChild(pcoNode);
|
||||
|
||||
// mirror point cloud along a-axis
|
||||
pcoNode.transform = [1, 0, 0, 0,
|
||||
0, -1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1];
|
||||
|
||||
// transform camera
|
||||
var cam = scene.activeCamera;
|
||||
cam.rotateY(Math.PI/2);
|
||||
cam.translate(-1,-1,-1);
|
||||
|
||||
// set point size
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
// material.renderMode = PointCloudRenderMode.FILTERED_SPLAT;
|
||||
material.pointSize = 1;
|
||||
|
||||
// set Level of Detail
|
||||
Potree.Settings.LODMultiplicator = 20.0;
|
||||
MaterialManager.getMaterial("pointCloud").pointSize = 1;
|
||||
|
||||
KeyListener.addListener(new DemoKeyListener(material));
|
||||
|
||||
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
|
||||
105
examples/procedural_patch.html
Normal file
@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/potree.css" />
|
||||
<script type="text/javascript" src="../src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("..");</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function generatePointCloud(){
|
||||
var uStart = -Math.PI;
|
||||
var uEnd = Math.PI;
|
||||
var uSteps = 150;
|
||||
var vStart = -Math.PI;
|
||||
var vEnd = Math.PI;
|
||||
var vSteps = 150;
|
||||
var numPoints = uSteps * vSteps;
|
||||
|
||||
var buffer = new ArrayBuffer(numPoints*16);
|
||||
var floatView = new Float32Array(buffer);
|
||||
var byteView = new Uint8Array(buffer);
|
||||
var pointAttributes = new PointAttributes();
|
||||
pointAttributes.add(PointAttribute.POSITION_CARTESIAN);
|
||||
pointAttributes.add(PointAttribute.RGBA_PACKED);
|
||||
|
||||
var offset = 0;
|
||||
for(var i = 0; i < uSteps; i++){
|
||||
for(var j = 0; j < vSteps; j++){
|
||||
var u = uStart + (uEnd - uStart) * (i/uSteps);
|
||||
var v = vStart + (vEnd - vStart) * (j/vSteps);
|
||||
|
||||
var x = u;
|
||||
var y = Math.cos(2*v) * Math.sin(2*u);
|
||||
var z = v;
|
||||
|
||||
var p = (v - vStart) / (vEnd-vStart);
|
||||
var q = (u - uStart) / (uEnd-uStart);
|
||||
var r = 255*p * (y+1.3)/2.3;
|
||||
var g = 255*q * (y+1.3)/2.3;
|
||||
var b = 0;
|
||||
|
||||
|
||||
floatView[4*offset+0] = x;
|
||||
floatView[4*offset+1] = y;
|
||||
floatView[4*offset+2] = z;
|
||||
byteView[16*offset+12] = r;
|
||||
byteView[16*offset+13] = g;
|
||||
byteView[16*offset+14] = b;
|
||||
byteView[16*offset+15] = 255;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
var pointCloud = new PointCloud("cloud", pointAttributes);
|
||||
pointCloud.setVertexBufferData(buffer);
|
||||
pointCloud.size = numPoints;
|
||||
|
||||
return pointCloud;
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
// init potree
|
||||
var canvas = document.getElementById("canvas");
|
||||
Potree.shaderDir = "../resources/shader";
|
||||
var success = Potree.init(canvas);
|
||||
if(!success){
|
||||
return;
|
||||
}
|
||||
|
||||
// load point cloud
|
||||
var scene = Potree.currentScene;
|
||||
var pointcloud = generatePointCloud();
|
||||
var pcoNode = new PointCloudSceneNode("pointcloud", scene.rootNode, pointcloud);
|
||||
pcoNode.scale(0.6, 0.6, 0.6);
|
||||
|
||||
// transform camera
|
||||
var cam = scene.activeCamera;
|
||||
cam.translate(0,-0.2,4);
|
||||
cam.rotateX(-0.7);
|
||||
cam.rotateY(0.8);
|
||||
|
||||
|
||||
// set point size
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
material.pointSize = 2;
|
||||
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="init()" class="claro" style="font-size: 62.5%;">
|
||||
|
||||
<div id="workarea" style="width: 100%; height: 100%">
|
||||
<canvas id="canvas" width="800" height="600" tabIndex="1">
|
||||
Your Browser does not support WebGL. Try the newest version of Firefox or Google Chrome.
|
||||
</canvas>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
105
examples/procedural_shell.html
Normal file
@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/potree.css" />
|
||||
<script type="text/javascript" src="../src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("..");</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function generatePointCloud(){
|
||||
var uStart = 0;
|
||||
var uEnd = 2*Math.PI;
|
||||
var uSteps = 100;
|
||||
var vStart = -15;
|
||||
var vEnd = 6;
|
||||
var vSteps = 300;
|
||||
var numPoints = uSteps * vSteps;
|
||||
|
||||
var buffer = new ArrayBuffer(numPoints*16);
|
||||
var floatView = new Float32Array(buffer);
|
||||
var byteView = new Uint8Array(buffer);
|
||||
var pointAttributes = new PointAttributes();
|
||||
pointAttributes.add(PointAttribute.POSITION_CARTESIAN);
|
||||
pointAttributes.add(PointAttribute.RGBA_PACKED);
|
||||
|
||||
var offset = 0;
|
||||
for(var i = 0; i < uSteps; i++){
|
||||
for(var j = 0; j < vSteps; j++){
|
||||
var u = uStart + (uEnd - uStart) * (i/uSteps);
|
||||
var v = vStart + (vEnd - vStart) * (j/vSteps);
|
||||
|
||||
var x = Math.pow(1.16,v) * Math.cos(v) * (1 + Math.cos(u));
|
||||
var y = -Math.pow(1.16,v) * Math.sin(v) * (1 + Math.cos(u));
|
||||
var z = -2*Math.pow(1.16,v) * (1 + Math.sin(u));
|
||||
|
||||
var p = (v - vStart) / (vEnd-vStart);
|
||||
var q = (u - uStart) / (uEnd-uStart);
|
||||
var r = (q + 0.5)*255;
|
||||
var g = 0;
|
||||
var b = p*255;
|
||||
|
||||
floatView[4*offset+0] = x;
|
||||
floatView[4*offset+1] = y;
|
||||
floatView[4*offset+2] = z;
|
||||
byteView[16*offset+12] = r;
|
||||
byteView[16*offset+13] = g;
|
||||
byteView[16*offset+14] = b;
|
||||
byteView[16*offset+15] = 255;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(floatView);
|
||||
|
||||
var pointCloud = new PointCloud("cloud", pointAttributes);
|
||||
pointCloud.setVertexBufferData(buffer);
|
||||
pointCloud.size = numPoints;
|
||||
|
||||
return pointCloud;
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
// init potree
|
||||
var canvas = document.getElementById("canvas");
|
||||
Potree.shaderDir = "../resources/shader";
|
||||
var success = Potree.init(canvas);
|
||||
if(!success){
|
||||
return;
|
||||
}
|
||||
|
||||
// load point cloud
|
||||
var scene = Potree.currentScene;
|
||||
var pointcloud = generatePointCloud();
|
||||
var pcoNode = new PointCloudSceneNode("pointcloud", scene.rootNode, pointcloud);
|
||||
pcoNode.scale(0.2, 0.2, 0.2);
|
||||
|
||||
// transform camera
|
||||
var cam = scene.activeCamera;
|
||||
|
||||
cam.translate(0.2,0,2);
|
||||
cam.rotateY(0.8);
|
||||
|
||||
// set point size
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
material.pointSize = 0.5;
|
||||
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="init()" class="claro" style="font-size: 62.5%;">
|
||||
|
||||
<div id="workarea" style="width: 100%; height: 100%">
|
||||
<canvas id="canvas" width="800" height="600" tabIndex="1">
|
||||
Your Browser does not support WebGL. Try the newest version of Firefox or Google Chrome.
|
||||
</canvas>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
105
examples/procedural_sphere.html
Normal file
@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../resources/css/potree.css" />
|
||||
<script type="text/javascript" src="../src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("..");</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function generatePointCloud(){
|
||||
var uStart = -Math.PI;
|
||||
var uEnd = Math.PI;
|
||||
var uSteps = 500;
|
||||
var vStart = -Math.PI;
|
||||
var vEnd = Math.PI;
|
||||
var vSteps = 40;
|
||||
var numPoints = uSteps * vSteps;
|
||||
|
||||
var buffer = new ArrayBuffer(numPoints*16);
|
||||
var floatView = new Float32Array(buffer);
|
||||
var byteView = new Uint8Array(buffer);
|
||||
var pointAttributes = new PointAttributes();
|
||||
pointAttributes.add(PointAttribute.POSITION_CARTESIAN);
|
||||
pointAttributes.add(PointAttribute.RGBA_PACKED);
|
||||
|
||||
var offset = 0;
|
||||
for(var i = 0; i < uSteps; i++){
|
||||
for(var j = 0; j < vSteps; j++){
|
||||
var u = uStart + (uEnd - uStart) * (i/uSteps);
|
||||
var v = vStart + (vEnd - vStart) * (j/vSteps);
|
||||
|
||||
var x = Math.sin(u)*Math.sin(v);
|
||||
var y = Math.cos(u)*Math.sin(v);
|
||||
var z = Math.cos(v);
|
||||
|
||||
var p = (v - vStart) / (vEnd-vStart);
|
||||
var q = (u - uStart) / (uEnd-uStart);
|
||||
var r = 255*(x+1)/2;
|
||||
var g = 150*(y+1)/2;
|
||||
var b = 0;
|
||||
|
||||
|
||||
floatView[4*offset+0] = x;
|
||||
floatView[4*offset+1] = y;
|
||||
floatView[4*offset+2] = z;
|
||||
byteView[16*offset+12] = r;
|
||||
byteView[16*offset+13] = g;
|
||||
byteView[16*offset+14] = b;
|
||||
byteView[16*offset+15] = 255;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(floatView);
|
||||
|
||||
var pointCloud = new PointCloud("cloud", pointAttributes);
|
||||
pointCloud.setVertexBufferData(buffer);
|
||||
pointCloud.size = numPoints;
|
||||
|
||||
return pointCloud;
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
// init potree
|
||||
var canvas = document.getElementById("canvas");
|
||||
Potree.shaderDir = "../resources/shader";
|
||||
var success = Potree.init(canvas);
|
||||
if(!success){
|
||||
return;
|
||||
}
|
||||
|
||||
// load point cloud
|
||||
var scene = Potree.currentScene;
|
||||
var pointcloud = generatePointCloud();
|
||||
var pcoNode = new PointCloudSceneNode("pointcloud", scene.rootNode, pointcloud);
|
||||
pcoNode.scale(0.6, 0.6, 0.6);
|
||||
|
||||
// transform camera
|
||||
var cam = scene.activeCamera;
|
||||
cam.translate(0,0.1,2);
|
||||
cam.rotateY(0.8);
|
||||
|
||||
// set point size
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
material.pointSize = 0.4;
|
||||
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="init()" class="claro" style="font-size: 62.5%;">
|
||||
|
||||
<div id="workarea" style="width: 100%; height: 100%">
|
||||
<canvas id="canvas" width="800" height="600" tabIndex="1">
|
||||
Your Browser does not support WebGL. Try the newest version of Firefox or Google Chrome.
|
||||
</canvas>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
77
lion.html
@ -1,77 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="resources/style/potree.css" />
|
||||
<script type="text/javascript" src="src/Potree.js"></script>
|
||||
<script type="text/javascript" >Potree.importScripts("./");</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function DemoKeyListener(material){
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
DemoKeyListener.prototype.invokeKeyPress = function(event){
|
||||
console.log(event.keyCode);
|
||||
if(event.keyCode == KeyCodes.NUMBER_1){
|
||||
this.material.renderMode = PointCloudRenderMode.WEIGHTED_CIRCLE;
|
||||
}else if(event.keyCode == KeyCodes.NUMBER_2){
|
||||
this.material.renderMode = PointCloudRenderMode.FILTERED_SPLAT;
|
||||
}
|
||||
}
|
||||
DemoKeyListener.prototype.invokeKeyDown = function(){}
|
||||
DemoKeyListener.prototype.invokeKeyUp = function(){}
|
||||
|
||||
function init() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
var success = Potree.init(canvas);
|
||||
if(!success){
|
||||
return;
|
||||
}
|
||||
|
||||
var scene = Potree.currentScene;
|
||||
var cloudURL = "resources/pointclouds/lion_takanawa/cloud.js";
|
||||
|
||||
var pcoNode = POCLoader.load(cloudURL);
|
||||
scene.rootNode.addChild(pcoNode);
|
||||
|
||||
pcoNode.transform = [1, 0, 0, 0,
|
||||
0, -1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1];
|
||||
|
||||
var cam = scene.activeCamera;
|
||||
cam.rotateY(Math.PI/2);
|
||||
cam.translate(-1,-1,-1);
|
||||
|
||||
var material = MaterialManager.getMaterial("pointCloud");
|
||||
// material.renderMode = PointCloudRenderMode.FILTERED_SPLAT;
|
||||
Potree.Settings.LODMultiplicator = 20.0;
|
||||
MaterialManager.getMaterial("pointCloud").pointSize = 1;
|
||||
|
||||
KeyListener.addListener(new DemoKeyListener(material));
|
||||
|
||||
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="init()" class="claro" style="font-size: 62.5%;">
|
||||
|
||||
<div id="workarea" style="width: 100%; height: 100%">
|
||||
<canvas id="canvas" width="800" height="600" tabIndex="1">
|
||||
Your Browser does not support WebGL. Try the newest version of Firefox or Google Chrome.
|
||||
</canvas>
|
||||
</div>
|
||||
|
||||
<div id="infos" style="top: 0; bottom: 0; left: 10; right: 0; position: absolute; z-index: 100; font-size: 150%; background: #fff; top: 10px; width: 300px; height: 70px; padding: 10px 10px 15px 10px; border-radius: 4px">
|
||||
a,s,d,w: move through scene<br>
|
||||
drag mouse: rotate camera<br>
|
||||
1: default rendermode<br>
|
||||
2: filtered splats
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
// gauss kernel, r = 3: 0.034793, 0.102006, 0.216137, 0.294128, 0.216137, 0.102006, 0.034793
|
||||
// gauss kernel, r = 5: 0.0216149, 0.0439554, 0.0778778, 0.118718, 0.153857, 0.167953, 0.153857, 0.118718, 0.0778778, 0.0439554, 0.0216149
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
precision highp float;
|
||||
|
||||
|
||||
@ -7,10 +7,10 @@ function PointCloudSceneNode(name, parent, pointCloud){
|
||||
SceneNode.call(this, name, parent);
|
||||
this.pointCloud = pointCloud;
|
||||
|
||||
if(MaterialManager.getMaterial("pointCloudMat") == null){
|
||||
this.material = new PointCloudMaterial("pointCloudMat");
|
||||
if(MaterialManager.getMaterial("pointCloud") == null){
|
||||
this.material = new PointCloudMaterial("pointCloud");
|
||||
}else{
|
||||
this.material = MaterialManager.getMaterial("pointCloudMat");
|
||||
this.material = MaterialManager.getMaterial("pointCloud");
|
||||
}
|
||||
|
||||
var attributes = pointCloud.pointAttributes;
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
/**
|
||||
* potree.js
|
||||
* http://potree.org
|
||||
*
|
||||
* Copyright 2012, Markus Schütz
|
||||
* Licensed under the GPL Version 2 or later.
|
||||
* - http://potree.org/wp/?page_id=7
|
||||
* - http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Used for some evil javascript inheritance magic.
|
||||
|
||||