rename tree depth render mode to Level of Detail (LOD) and fix performance / crash problems
This commit is contained in:
parent
5f2cd319a1
commit
2285d57d1c
@ -388,7 +388,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"// OCTREE",
|
||||
"// ---------------------",
|
||||
"",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_octree)",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_octree)",
|
||||
"/**",
|
||||
" * number of 1-bits up to inclusive index position",
|
||||
" * number is treated as if it were an integer in the range 0-255",
|
||||
@ -418,9 +418,9 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"",
|
||||
"",
|
||||
"/**",
|
||||
" * find the tree depth at the point position",
|
||||
" * find the LOD at the point position",
|
||||
" */",
|
||||
"float getLocalTreeDepth(){",
|
||||
"float getLOD(){",
|
||||
" vec3 offset = vec3(0.0, 0.0, 0.0);",
|
||||
" float iOffset = 0.0;",
|
||||
" float depth = 0.0;",
|
||||
@ -447,7 +447,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"}",
|
||||
"",
|
||||
"float getPointSizeAttenuation(){",
|
||||
" return pow(1.9, getLocalTreeDepth());",
|
||||
" return pow(1.9, getLOD());",
|
||||
"}",
|
||||
"",
|
||||
"",
|
||||
@ -458,9 +458,9 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"// KD-TREE",
|
||||
"// ---------------------",
|
||||
"",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_kdtree)",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_kdtree)",
|
||||
"",
|
||||
"float getLocalTreeDepth(){",
|
||||
"float getLOD(){",
|
||||
" vec3 offset = vec3(0.0, 0.0, 0.0);",
|
||||
" float iOffset = 0.0;",
|
||||
" float depth = 0.0;",
|
||||
@ -518,7 +518,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"}",
|
||||
"",
|
||||
"float getPointSizeAttenuation(){",
|
||||
" return pow(1.3, getLocalTreeDepth());",
|
||||
" return pow(1.3, getLOD());",
|
||||
"}",
|
||||
"",
|
||||
"#endif",
|
||||
@ -564,8 +564,8 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
|
||||
" #elif defined color_type_color",
|
||||
" vColor = uColor;",
|
||||
" #elif defined color_type_tree_depth",
|
||||
" float depth = getLocalTreeDepth();",
|
||||
" #elif defined color_type_lod",
|
||||
" float depth = getLOD();",
|
||||
" float w = depth / 10.0;",
|
||||
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
|
||||
" #elif defined color_type_point_index",
|
||||
@ -1992,7 +1992,7 @@ Potree.PointColorType = {
|
||||
HEIGHT: 3,
|
||||
INTENSITY: 4,
|
||||
INTENSITY_GRADIENT: 5,
|
||||
TREE_DEPTH: 6,
|
||||
LOD: 6,
|
||||
POINT_INDEX: 7,
|
||||
CLASSIFICATION: 8,
|
||||
RETURN_NUMBER: 9,
|
||||
@ -2222,8 +2222,8 @@ Potree.PointCloudMaterial.prototype.getDefines = function(){
|
||||
defines += "#define color_type_intensity\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.INTENSITY_GRADIENT){
|
||||
defines += "#define color_type_intensity_gradient\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.TREE_DEPTH){
|
||||
defines += "#define color_type_tree_depth\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.LOD){
|
||||
defines += "#define color_type_lod\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.POINT_INDEX){
|
||||
defines += "#define color_type_point_index\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.CLASSIFICATION){
|
||||
@ -5416,9 +5416,9 @@ Potree.PointCloudOctree.prototype.updateMaterial = function(material, visibleNod
|
||||
material.uniforms.octreeSize.value = this.pcoGeometry.boundingBox.size().x;
|
||||
|
||||
// update visibility texture
|
||||
if(material.pointSizeType){
|
||||
if(material.pointSizeType >= 0){
|
||||
if(material.pointSizeType === Potree.PointSizeType.ADAPTIVE
|
||||
|| material.pointColorType === Potree.PointColorType.OCTREE_DEPTH){
|
||||
|| material.pointColorType === Potree.PointColorType.LOD){
|
||||
|
||||
this.updateVisibilityTexture(material, visibleNodes);
|
||||
}
|
||||
@ -10110,7 +10110,7 @@ Potree.PointCloudArena4D.prototype.updateMaterial = function(material, visibleNo
|
||||
// update visibility texture
|
||||
if(material.pointSizeType){
|
||||
if(material.pointSizeType === Potree.PointSizeType.ADAPTIVE
|
||||
|| material.pointColorType === Potree.PointColorType.OCTREE_DEPTH){
|
||||
|| material.pointColorType === Potree.PointColorType.LOD){
|
||||
|
||||
this.updateVisibilityTexture(material, visibleNodes);
|
||||
}
|
||||
@ -11446,8 +11446,8 @@ Potree.Viewer = function(domElement, args){
|
||||
scope.pointColorType = Potree.PointColorType.RETURN_NUMBER;
|
||||
}else if(materialName === "Source"){
|
||||
scope.pointColorType = Potree.PointColorType.SOURCE;
|
||||
}else if(materialName === "Tree Depth"){
|
||||
scope.pointColorType = Potree.PointColorType.TREE_DEPTH;
|
||||
}else if(materialName === "Level of Detail"){
|
||||
scope.pointColorType = Potree.PointColorType.LOD;
|
||||
}else if(materialName === "Point Index"){
|
||||
scope.pointColorType = Potree.PointColorType.POINT_INDEX;
|
||||
}else if(materialName === "Normal"){
|
||||
@ -11474,8 +11474,8 @@ Potree.Viewer = function(domElement, args){
|
||||
return "Return Number";
|
||||
}else if(materialID === Potree.PointColorType.SOURCE){
|
||||
return "Source";
|
||||
}else if(materialID === Potree.PointColorType.TREE_DEPTH){
|
||||
return "Tree Depth";
|
||||
}else if(materialID === Potree.PointColorType.LOD){
|
||||
return "Level of Detail";
|
||||
}else if(materialID === Potree.PointColorType.POINT_INDEX){
|
||||
return "Point Index";
|
||||
}else if(materialID === Potree.PointColorType.NORMAL){
|
||||
|
||||
10
build/potree/potree.min.js
vendored
10
build/potree/potree.min.js
vendored
File diff suppressed because one or more lines are too long
@ -320,7 +320,7 @@ function initMaterials(){
|
||||
"Return Number",
|
||||
"Source",
|
||||
"Phong",
|
||||
"Tree Depth"
|
||||
"Level of Detail"
|
||||
];
|
||||
|
||||
var elMaterialList = document.getElementById("optMaterial");
|
||||
|
||||
@ -75,7 +75,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"// OCTREE",
|
||||
"// ---------------------",
|
||||
"",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_octree)",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_octree)",
|
||||
"/**",
|
||||
" * number of 1-bits up to inclusive index position",
|
||||
" * number is treated as if it were an integer in the range 0-255",
|
||||
@ -105,9 +105,9 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"",
|
||||
"",
|
||||
"/**",
|
||||
" * find the tree depth at the point position",
|
||||
" * find the LOD at the point position",
|
||||
" */",
|
||||
"float getLocalTreeDepth(){",
|
||||
"float getLOD(){",
|
||||
" vec3 offset = vec3(0.0, 0.0, 0.0);",
|
||||
" float iOffset = 0.0;",
|
||||
" float depth = 0.0;",
|
||||
@ -134,7 +134,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"}",
|
||||
"",
|
||||
"float getPointSizeAttenuation(){",
|
||||
" return pow(1.9, getLocalTreeDepth());",
|
||||
" return pow(1.9, getLOD());",
|
||||
"}",
|
||||
"",
|
||||
"",
|
||||
@ -145,9 +145,9 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"// KD-TREE",
|
||||
"// ---------------------",
|
||||
"",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_kdtree)",
|
||||
"#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_kdtree)",
|
||||
"",
|
||||
"float getLocalTreeDepth(){",
|
||||
"float getLOD(){",
|
||||
" vec3 offset = vec3(0.0, 0.0, 0.0);",
|
||||
" float iOffset = 0.0;",
|
||||
" float depth = 0.0;",
|
||||
@ -205,7 +205,7 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
"}",
|
||||
"",
|
||||
"float getPointSizeAttenuation(){",
|
||||
" return pow(1.3, getLocalTreeDepth());",
|
||||
" return pow(1.3, getLOD());",
|
||||
"}",
|
||||
"",
|
||||
"#endif",
|
||||
@ -251,8 +251,8 @@ Potree.Shaders["pointcloud.vs"] = [
|
||||
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
|
||||
" #elif defined color_type_color",
|
||||
" vColor = uColor;",
|
||||
" #elif defined color_type_tree_depth",
|
||||
" float depth = getLocalTreeDepth();",
|
||||
" #elif defined color_type_lod",
|
||||
" float depth = getLOD();",
|
||||
" float w = depth / 10.0;",
|
||||
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
|
||||
" #elif defined color_type_point_index",
|
||||
|
||||
@ -432,9 +432,9 @@ Potree.PointCloudOctree.prototype.updateMaterial = function(material, visibleNod
|
||||
material.uniforms.octreeSize.value = this.pcoGeometry.boundingBox.size().x;
|
||||
|
||||
// update visibility texture
|
||||
if(material.pointSizeType){
|
||||
if(material.pointSizeType >= 0){
|
||||
if(material.pointSizeType === Potree.PointSizeType.ADAPTIVE
|
||||
|| material.pointColorType === Potree.PointColorType.OCTREE_DEPTH){
|
||||
|| material.pointColorType === Potree.PointColorType.LOD){
|
||||
|
||||
this.updateVisibilityTexture(material, visibleNodes);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ Potree.PointCloudArena4D.prototype.updateMaterial = function(material, visibleNo
|
||||
// update visibility texture
|
||||
if(material.pointSizeType){
|
||||
if(material.pointSizeType === Potree.PointSizeType.ADAPTIVE
|
||||
|| material.pointColorType === Potree.PointColorType.OCTREE_DEPTH){
|
||||
|| material.pointColorType === Potree.PointColorType.LOD){
|
||||
|
||||
this.updateVisibilityTexture(material, visibleNodes);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ Potree.PointColorType = {
|
||||
HEIGHT: 3,
|
||||
INTENSITY: 4,
|
||||
INTENSITY_GRADIENT: 5,
|
||||
TREE_DEPTH: 6,
|
||||
LOD: 6,
|
||||
POINT_INDEX: 7,
|
||||
CLASSIFICATION: 8,
|
||||
RETURN_NUMBER: 9,
|
||||
@ -291,8 +291,8 @@ Potree.PointCloudMaterial.prototype.getDefines = function(){
|
||||
defines += "#define color_type_intensity\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.INTENSITY_GRADIENT){
|
||||
defines += "#define color_type_intensity_gradient\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.TREE_DEPTH){
|
||||
defines += "#define color_type_tree_depth\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.LOD){
|
||||
defines += "#define color_type_lod\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.POINT_INDEX){
|
||||
defines += "#define color_type_point_index\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.CLASSIFICATION){
|
||||
|
||||
@ -74,7 +74,7 @@ varying vec3 vNormal;
|
||||
// OCTREE
|
||||
// ---------------------
|
||||
|
||||
#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_octree)
|
||||
#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_octree)
|
||||
/**
|
||||
* number of 1-bits up to inclusive index position
|
||||
* number is treated as if it were an integer in the range 0-255
|
||||
@ -104,9 +104,9 @@ bool isBitSet(float number, float index){
|
||||
|
||||
|
||||
/**
|
||||
* find the tree depth at the point position
|
||||
* find the LOD at the point position
|
||||
*/
|
||||
float getLocalTreeDepth(){
|
||||
float getLOD(){
|
||||
vec3 offset = vec3(0.0, 0.0, 0.0);
|
||||
float iOffset = 0.0;
|
||||
float depth = 0.0;
|
||||
@ -133,7 +133,7 @@ float getLocalTreeDepth(){
|
||||
}
|
||||
|
||||
float getPointSizeAttenuation(){
|
||||
return pow(1.9, getLocalTreeDepth());
|
||||
return pow(1.9, getLOD());
|
||||
}
|
||||
|
||||
|
||||
@ -144,9 +144,9 @@ float getPointSizeAttenuation(){
|
||||
// KD-TREE
|
||||
// ---------------------
|
||||
|
||||
#if (defined(adaptive_point_size) || defined(color_type_tree_depth)) && defined(tree_type_kdtree)
|
||||
#if (defined(adaptive_point_size) || defined(color_type_lod)) && defined(tree_type_kdtree)
|
||||
|
||||
float getLocalTreeDepth(){
|
||||
float getLOD(){
|
||||
vec3 offset = vec3(0.0, 0.0, 0.0);
|
||||
float iOffset = 0.0;
|
||||
float depth = 0.0;
|
||||
@ -204,7 +204,7 @@ float getLocalTreeDepth(){
|
||||
}
|
||||
|
||||
float getPointSizeAttenuation(){
|
||||
return pow(1.3, getLocalTreeDepth());
|
||||
return pow(1.3, getLOD());
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -250,8 +250,8 @@ void main() {
|
||||
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
#elif defined color_type_color
|
||||
vColor = uColor;
|
||||
#elif defined color_type_tree_depth
|
||||
float depth = getLocalTreeDepth();
|
||||
#elif defined color_type_lod
|
||||
float depth = getLOD();
|
||||
float w = depth / 10.0;
|
||||
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
#elif defined color_type_point_index
|
||||
|
||||
@ -320,7 +320,7 @@ function initMaterials(){
|
||||
"Return Number",
|
||||
"Source",
|
||||
"Phong",
|
||||
"Tree Depth"
|
||||
"Level of Detail"
|
||||
];
|
||||
|
||||
var elMaterialList = document.getElementById("optMaterial");
|
||||
|
||||
@ -516,8 +516,8 @@ Potree.Viewer = function(domElement, args){
|
||||
scope.pointColorType = Potree.PointColorType.RETURN_NUMBER;
|
||||
}else if(materialName === "Source"){
|
||||
scope.pointColorType = Potree.PointColorType.SOURCE;
|
||||
}else if(materialName === "Tree Depth"){
|
||||
scope.pointColorType = Potree.PointColorType.TREE_DEPTH;
|
||||
}else if(materialName === "Level of Detail"){
|
||||
scope.pointColorType = Potree.PointColorType.LOD;
|
||||
}else if(materialName === "Point Index"){
|
||||
scope.pointColorType = Potree.PointColorType.POINT_INDEX;
|
||||
}else if(materialName === "Normal"){
|
||||
@ -544,8 +544,8 @@ Potree.Viewer = function(domElement, args){
|
||||
return "Return Number";
|
||||
}else if(materialID === Potree.PointColorType.SOURCE){
|
||||
return "Source";
|
||||
}else if(materialID === Potree.PointColorType.TREE_DEPTH){
|
||||
return "Tree Depth";
|
||||
}else if(materialID === Potree.PointColorType.LOD){
|
||||
return "Level of Detail";
|
||||
}else if(materialID === Potree.PointColorType.POINT_INDEX){
|
||||
return "Point Index";
|
||||
}else if(materialID === Potree.PointColorType.NORMAL){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user