progress on composite material
This commit is contained in:
parent
01ff3e751d
commit
259a036ba9
@ -556,7 +556,7 @@ Potree.PointCloudOctree.prototype.nodesOnRay = function(nodes, ray){
|
||||
//var inverseWorld = new THREE.Matrix4().getInverse(node.matrixWorld);
|
||||
var sphere = node.getBoundingSphere().clone().applyMatrix4(node.sceneNode.matrixWorld);
|
||||
|
||||
if(_ray.isIntersectionSphere(sphere)){
|
||||
if(_ray.intersectsSphere(sphere)){
|
||||
nodesOnRay.push(node);
|
||||
}
|
||||
}
|
||||
@ -1101,7 +1101,6 @@ Potree.PointCloudOctree.prototype.pick = function(renderer, camera, ray, params)
|
||||
|
||||
gl.uniformMatrix4fv(uniforms["projectionMatrix"], false, camera.projectionMatrix.elements);
|
||||
gl.uniformMatrix4fv(uniforms["viewMatrix"], false, camera.matrixWorldInverse.elements);
|
||||
//gl.uniform1f(uniforms["clipBoxCount"], 0);
|
||||
|
||||
{
|
||||
if(glstate.textures.visibleNodes === undefined){
|
||||
@ -1130,16 +1129,6 @@ Potree.PointCloudOctree.prototype.pick = function(renderer, camera, ray, params)
|
||||
|
||||
}
|
||||
|
||||
//if(pickMaterial.uniforms.classificationLUT !== this.material.uniforms.classificationLUT){
|
||||
// pickMaterial.uniforms.classificationLUT = this.material.uniforms.classificationLUT;
|
||||
//
|
||||
// var slot = 2;
|
||||
// gl.uniform1i(uniforms["classificationLUT"], slot);
|
||||
// gl.activeTexture(gl.TEXTURE0 + slot );
|
||||
// gl.bindTexture( gl.TEXTURE_2D, textureProperties.__webglTexture );
|
||||
//
|
||||
//}
|
||||
|
||||
gl.uniform1f(uniforms["fov"], this.material.fov);
|
||||
gl.uniform1f(uniforms["screenWidth"], this.material.screenWidth);
|
||||
gl.uniform1f(uniforms["screenHeight"], this.material.screenHeight);
|
||||
@ -1197,25 +1186,9 @@ Potree.PointCloudOctree.prototype.pick = function(renderer, camera, ray, params)
|
||||
|
||||
gl.uniform1f(uniforms["pcIndex"], pickMaterial.pcIndex);
|
||||
|
||||
//if(node.getNumPoints() === 0){
|
||||
// console.log("wtf");
|
||||
//}else{
|
||||
gl.drawArrays( gl.POINTS, 0, node.getNumPoints());
|
||||
//}
|
||||
|
||||
gl.drawArrays( gl.POINTS, 0, node.getNumPoints());
|
||||
}
|
||||
|
||||
//{
|
||||
// var apPosition = gl.getAttribLocation(program, "position");
|
||||
// var apNormal = gl.getAttribLocation(program, "normal");
|
||||
// var apClassification = gl.getAttribLocation(program, "classification");
|
||||
// var apIndices = gl.getAttribLocation(program, "indices");
|
||||
// //gl.disableVertexAttribArray( apPosition );
|
||||
// //gl.disableVertexAttribArray( apNormal );
|
||||
// //gl.disableVertexAttribArray( apClassification );
|
||||
// //gl.disableVertexAttribArray( apIndices );
|
||||
//}
|
||||
|
||||
var pixelCount = pickWindowSize * pickWindowSize;
|
||||
var buffer = new ArrayBuffer(pixelCount*4);
|
||||
var pixels = new Uint8Array(buffer);
|
||||
|
||||
@ -37,7 +37,7 @@ Potree.Classification = {
|
||||
8: new THREE.Vector4(1.0, 0, 0.0, 1.0),
|
||||
9: new THREE.Vector4(0.0, 0.0, 1.0, 1.0),
|
||||
12: new THREE.Vector4(1.0, 1.0, 0.0, 1.0),
|
||||
"DEFAULT": new THREE.Vector4(0.3, 0.6, 0.6, 1.0)
|
||||
"DEFAULT": new THREE.Vector4(0.3, 0.6, 0.6, 0.5)
|
||||
}
|
||||
};
|
||||
|
||||
@ -70,7 +70,8 @@ Potree.PointColorType = {
|
||||
SOURCE: 10,
|
||||
NORMAL: 11,
|
||||
PHONG: 12,
|
||||
RGB_HEIGHT: 13
|
||||
RGB_HEIGHT: 13,
|
||||
COMPOSITE: 50
|
||||
};
|
||||
|
||||
Potree.ClipMode = {
|
||||
@ -158,6 +159,16 @@ Potree.PointCloudMaterial = function(parameters){
|
||||
depthMap: { type: "t", value: null },
|
||||
diffuse: { type: "fv", value: [1,1,1]},
|
||||
transition: { type: "f", value: 0.5 },
|
||||
intensityRange: { type: "fv", value: [0, 65000] },
|
||||
intensityGamma: { type: "f", value: 1 },
|
||||
intensityContrast: { type: "f", value: 1 },
|
||||
intensityBrightness:{ type: "f", value: 0 },
|
||||
wRGB: { type: "f", value: 1 },
|
||||
wIntensity: { type: "f", value: 0 },
|
||||
wElevation: { type: "f", value: 0 },
|
||||
wClassification: { type: "f", value: 0 },
|
||||
wReturnNumber: { type: "f", value: 0 },
|
||||
wSourceID: { type: "f", value: 0 },
|
||||
};
|
||||
|
||||
this.defaultAttributeValues.normal = [0,0,0];
|
||||
@ -277,6 +288,8 @@ Potree.PointCloudMaterial.prototype.getDefines = function(){
|
||||
defines += "#define color_type_phong\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.RGB_HEIGHT){
|
||||
defines += "#define color_type_rgb_height\n";
|
||||
}else if(this._pointColorType === Potree.PointColorType.COMPOSITE){
|
||||
defines += "#define color_type_composite\n";
|
||||
}
|
||||
|
||||
if(this.clipMode === Potree.ClipMode.DISABLED){
|
||||
@ -595,6 +608,24 @@ Object.defineProperty(Potree.PointCloudMaterial.prototype, "size", {
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Potree.PointCloudMaterial.prototype, "heightMin", {
|
||||
get: function(){
|
||||
return this.uniforms.heightMin.value;
|
||||
},
|
||||
set: function(value){
|
||||
this.uniforms.heightMin.value = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Potree.PointCloudMaterial.prototype, "heightMax", {
|
||||
get: function(){
|
||||
return this.uniforms.heightMax.value;
|
||||
},
|
||||
set: function(value){
|
||||
this.uniforms.heightMax.value = value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Generates a look-up texture for gradient values (height, intensity, ...)
|
||||
*
|
||||
|
||||
@ -50,7 +50,17 @@ uniform vec3 uColor;
|
||||
uniform float opacity;
|
||||
uniform float clipBoxCount;
|
||||
|
||||
uniform vec2 intensityRange;
|
||||
uniform float intensityGamma;
|
||||
uniform float intensityContrast;
|
||||
uniform float intensityBrightness;
|
||||
uniform float transition;
|
||||
uniform float wRGB;
|
||||
uniform float wIntensity;
|
||||
uniform float wElevation;
|
||||
uniform float wClassification;
|
||||
uniform float wReturnNumber;
|
||||
uniform float wSourceID;
|
||||
|
||||
|
||||
uniform sampler2D visibleNodes;
|
||||
@ -207,56 +217,82 @@ float getPointSizeAttenuation(){
|
||||
|
||||
#endif
|
||||
|
||||
// https://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
vec3 HSLtoRGB(vec3 hsl){
|
||||
float hd = hsl.r * 6.0;
|
||||
float c = hsl.g;
|
||||
float l = hsl.b;
|
||||
float getIntensity(){
|
||||
float w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);
|
||||
w = pow(w, intensityGamma);
|
||||
w = (w - 0.5) * intensityContrast + 0.5;
|
||||
w = w + intensityBrightness;
|
||||
w = clamp(w, 0.0, 1.0);
|
||||
|
||||
float x = c * (1.0 - abs(mod(hd, 2.0) - 1.0));
|
||||
|
||||
vec3 rgb;
|
||||
if(0.0 <= hd && hd <= 1.0){
|
||||
rgb = vec3(c, x, 0.0);
|
||||
}else if(1.0 <= hd && hd <= 2.0){
|
||||
rgb = vec3(x, c, 0.0);
|
||||
}else if(2.0 <= hd && hd <= 3.0){
|
||||
rgb = vec3(0.0, c, x);
|
||||
}else if(3.0 <= hd && hd <= 4.0){
|
||||
rgb = vec3(0.0, x, c);
|
||||
}else if(4.0 <= hd && hd <= 5.0){
|
||||
rgb = vec3(x, 0.0, c);
|
||||
}else if(5.0 <= hd && hd <= 6.0){
|
||||
rgb = vec3(c, 0.0, x);
|
||||
}else{
|
||||
rgb = vec3(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
float m = l - (0.3 * rgb.r + 0.59 * rgb.g + 0.11 * rgb.b);
|
||||
rgb = rgb + m;
|
||||
|
||||
return rgb;
|
||||
return w;
|
||||
}
|
||||
|
||||
vec3 combineInHSL(vec3 cMain, vec3 cTarget, float transition){
|
||||
vec3 getElevation(){
|
||||
vec4 world = modelMatrix * vec4( position, 1.0 );
|
||||
float w = (world.y - heightMin) / (heightMax-heightMin);
|
||||
vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
|
||||
vec2 xyMain = vec2(
|
||||
(2.0*cMain.r - cMain.g - cMain.b) / 2.0,
|
||||
(sqrt(3.0) / 2.0) * (cMain.g - cMain.b)
|
||||
);
|
||||
vec2 xyTarget = vec2(
|
||||
(2.0*cTarget.r - cTarget.g - cTarget.b) / 2.0,
|
||||
(sqrt(3.0) / 2.0) * (cTarget.g - cTarget.b)
|
||||
);
|
||||
return cElevation;
|
||||
}
|
||||
|
||||
vec4 getClassification(){
|
||||
float c = mod(classification, 16.0);
|
||||
vec2 uv = vec2(c / 255.0, 0.5);
|
||||
vec4 classColor = texture2D(classificationLUT, uv);
|
||||
|
||||
vec2 xy = (1.0 - transition) * xyMain + transition * xyTarget;
|
||||
return classColor;
|
||||
}
|
||||
|
||||
vec3 getReturnNumber(){
|
||||
if(numberOfReturns == 1.0){
|
||||
return vec3(1.0, 1.0, 0.0);
|
||||
}else{
|
||||
if(returnNumber == 1.0){
|
||||
return vec3(1.0, 0.0, 0.0);
|
||||
}else if(returnNumber == numberOfReturns){
|
||||
return vec3(0.0, 0.0, 1.0);
|
||||
}else{
|
||||
return vec3(0.0, 1.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vec3 getSourceID(){
|
||||
float w = mod(pointSourceID, 10.0) / 10.0;
|
||||
return texture2D(gradient, vec2(w,1.0 - w)).rgb;
|
||||
}
|
||||
|
||||
vec3 getColor(){
|
||||
vec3 c;
|
||||
float w;
|
||||
|
||||
c += wRGB * color;
|
||||
w += wRGB;
|
||||
|
||||
float h = (atan(-xy.y, -xy.x) + 3.1415) / (2.0 * 3.1415);
|
||||
float c = length(xy);
|
||||
vec3 rgb = (1.0 - transition) * cMain + transition * cTarget;
|
||||
float l = 0.3 * rgb.r + 0.59 * rgb.g + 0.11 * rgb.b;
|
||||
c += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);
|
||||
w += wIntensity;
|
||||
|
||||
return HSLtoRGB(vec3(h, c, l));
|
||||
c += wElevation * getElevation();
|
||||
w += wElevation;
|
||||
|
||||
c += wReturnNumber * getReturnNumber();
|
||||
w += wReturnNumber;
|
||||
|
||||
c += wSourceID * getSourceID();
|
||||
w += wSourceID;
|
||||
|
||||
vec4 cl = wClassification * getClassification();
|
||||
c += cl.a * cl.rgb;
|
||||
w += wClassification * cl.a;
|
||||
|
||||
c = c / w;
|
||||
|
||||
if(w == 0.0){
|
||||
//c = color;
|
||||
gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void main() {
|
||||
@ -273,72 +309,54 @@ void main() {
|
||||
// ---------------------
|
||||
// POINT COLOR
|
||||
// ---------------------
|
||||
vec4 cl = getClassification();
|
||||
|
||||
#ifdef color_type_rgb
|
||||
vColor = color;
|
||||
#elif defined color_type_height
|
||||
vec4 world = modelMatrix * vec4( position, 1.0 );
|
||||
float w = (world.y - heightMin) / (heightMax-heightMin);
|
||||
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
vColor = getElevation();
|
||||
#elif defined color_type_rgb_height
|
||||
vec4 world = modelMatrix * vec4( position, 1.0 );
|
||||
float w = (world.y - heightMin) / (heightMax-heightMin);
|
||||
vec3 cHeight = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
vColor = combineInHSL(color, cHeight, transition);
|
||||
vec3 cHeight = getElevation();
|
||||
vColor = (1.0 - transition) * color + transition * cHeight;
|
||||
#elif defined color_type_depth
|
||||
float linearDepth = -mvPosition.z ;
|
||||
float expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;
|
||||
vColor = vec3(linearDepth, expDepth, 0.0);
|
||||
#elif defined color_type_intensity
|
||||
float w = (intensity - intensityMin) / (intensityMax - intensityMin);
|
||||
float w = getIntensity();
|
||||
vColor = vec3(w, w, w);
|
||||
#elif defined color_type_intensity_gradient
|
||||
float w = (intensity - intensityMin) / intensityMax;
|
||||
float w = getIntensity();
|
||||
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
#elif defined color_type_color
|
||||
vColor = uColor;
|
||||
#elif defined color_type_lod
|
||||
float depth = getLOD();
|
||||
float w = depth / 10.0;
|
||||
//float w = mod(depth, 4.0) / 3.0;
|
||||
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
||||
#elif defined color_type_point_index
|
||||
vColor = indices.rgb;
|
||||
#elif defined color_type_classification
|
||||
float c = mod(classification, 16.0);
|
||||
vec2 uv = vec2(c / 255.0, 0.5);
|
||||
vec4 classColor = texture2D(classificationLUT, uv);
|
||||
vColor = classColor.rgb;
|
||||
vColor = cl.rgb;
|
||||
#elif defined color_type_return_number
|
||||
if(numberOfReturns == 1.0){
|
||||
vColor = vec3(1.0, 1.0, 0.0);
|
||||
}else{
|
||||
if(returnNumber == 1.0){
|
||||
vColor = vec3(1.0, 0.0, 0.0);
|
||||
}else if(returnNumber == numberOfReturns){
|
||||
vColor = vec3(0.0, 0.0, 1.0);
|
||||
}else{
|
||||
vColor = vec3(0.0, 1.0, 0.0);
|
||||
}
|
||||
}
|
||||
vColor = getReturnNumber();
|
||||
#elif defined color_type_source
|
||||
float w = mod(pointSourceID, 10.0) / 10.0;
|
||||
vColor = texture2D(gradient, vec2(w,1.0 - w)).rgb;
|
||||
vColor = getSourceID();
|
||||
#elif defined color_type_normal
|
||||
vColor = (modelMatrix * vec4(normal, 0.0)).xyz;
|
||||
#elif defined color_type_phong
|
||||
vColor = color;
|
||||
#elif defined color_type_composite
|
||||
vColor = getColor();
|
||||
#endif
|
||||
|
||||
{
|
||||
// TODO might want to combine with the define block above to avoid reading same LUT two times
|
||||
float c = mod(classification, 16.0);
|
||||
vec2 uv = vec2(c / 255.0, 0.5);
|
||||
|
||||
if(texture2D(classificationLUT, uv).a == 0.0){
|
||||
#if !defined color_type_composite
|
||||
if(cl.a == 0.0){
|
||||
gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------
|
||||
// POINT SIZE
|
||||
@ -399,7 +417,4 @@ void main() {
|
||||
|
||||
#endif
|
||||
|
||||
#if defined color_type_point_index
|
||||
//gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -227,6 +227,15 @@ body{
|
||||
flex-direction: row
|
||||
}
|
||||
|
||||
.pv-menu-list{
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pv-menu-list > *{
|
||||
margin: 8px 20px;
|
||||
}
|
||||
|
||||
|
||||
.pv-menu-list > li > .ui-slider{
|
||||
background-color: #7A8184 !important;
|
||||
@ -234,7 +243,7 @@ body{
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.panel-body > li > .ui-slider{
|
||||
.pv-menu-list > div > li > .ui-slider{
|
||||
background-color: #7A8184 !important;
|
||||
background: none;
|
||||
border: 1px solid black;
|
||||
@ -252,16 +261,28 @@ body{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.pv-menu-list .ui-selectmenu-button span.ui-selectmenu-text{
|
||||
line-height: 0.8em;
|
||||
}
|
||||
|
||||
.panel-body > li > .ui-slider{
|
||||
background-color: #7A8184 !important;
|
||||
background: none;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.panel-body > div > li > .ui-slider{
|
||||
background-color: #7A8184 !important;
|
||||
background: none;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.pv-select-label{
|
||||
margin: 1px;
|
||||
font-size: 90%;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.pv-menu-list .ui-selectmenu-button span.ui-selectmenu-text{
|
||||
line-height: 0.8em;
|
||||
}
|
||||
|
||||
.button-icon:hover{
|
||||
background-color: #09181C;
|
||||
}
|
||||
@ -297,15 +318,6 @@ body{
|
||||
.accordion > div{
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.pv-menu-list{
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pv-menu-list > li{
|
||||
margin: 8px 20px;
|
||||
}
|
||||
|
||||
#measurement_details .pv-menu-list > li{
|
||||
margin: 20px 10px;
|
||||
|
||||
@ -83,8 +83,29 @@
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
|
||||
<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div> </li>
|
||||
<div id="materials.elevation_container">
|
||||
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
|
||||
</div>
|
||||
|
||||
<div id="materials.transition_container">
|
||||
<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div> </li>
|
||||
</div>
|
||||
|
||||
<div id="materials.intensity_container">
|
||||
<li>Intensity Range: <span id="lblIntensityRange"></span> <div id="sldIntensityRange"></div> </li>
|
||||
<li>Gamma: <span id="lblIntensityGamma"></span> <div id="sldIntensityGamma"></div> </li>
|
||||
<li>Contrast: <span id="lblIntensityContrast"></span> <div id="sldIntensityContrast"></div> </li>
|
||||
<li>Brightness: <span id="lblIntensityBrightness"></span> <div id="sldIntensityBrightness"></div> </li>
|
||||
</div>
|
||||
|
||||
<div id="materials.composite_weight_container">
|
||||
<li>RGB: <span id="lblWeightRGB"></span> <div id="sldWeightRGB"></div> </li>
|
||||
<li>Intensity: <span id="lblWeightIntensity"></span> <div id="sldWeightIntensity"></div> </li>
|
||||
<li>Elevation: <span id="lblWeightElevation"></span> <div id="sldWeightElevation"></div> </li>
|
||||
<li>Classification: <span id="lblWeightClassification"></span> <div id="sldWeightClassification"></div> </li>
|
||||
<li>Return Number: <span id="lblWeightReturnNumber"></span> <div id="sldWeightReturnNumber"></div> </li>
|
||||
<li>Source ID: <span id="lblWeightSourceID"></span> <div id="sldWeightSourceID"></div> </li>
|
||||
</div>
|
||||
|
||||
</ul>
|
||||
<!--<ul id="materialList" class="pv-menu-list"></ul>-->
|
||||
@ -279,20 +300,108 @@ function initMaterials(){
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setMaterialTransition(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldIntensityRange" ).slider({
|
||||
range: true,
|
||||
min: 0,
|
||||
max: 1,
|
||||
values: [0, 1],
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {
|
||||
let min = (ui.values[0] == 0) ? 0 : parseInt(Math.pow(2, 16 * ui.values[0]));
|
||||
let max = parseInt(Math.pow(2, 16 * ui.values[1]));
|
||||
viewer.setIntensityRange(min, max);
|
||||
}
|
||||
});
|
||||
|
||||
$( "#sldIntensityGamma" ).slider({
|
||||
value: viewer.getIntensityGamma(),
|
||||
min: 0,
|
||||
max: 4,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setIntensityGamma(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldIntensityContrast" ).slider({
|
||||
value: viewer.getIntensityContrast(),
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setIntensityContrast(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldIntensityBrightness" ).slider({
|
||||
value: viewer.getIntensityBrightness(),
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setIntensityBrightness(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightRGB" ).slider({
|
||||
value: viewer.getWeightRGB(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightRGB(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightIntensity" ).slider({
|
||||
value: viewer.getWeightIntensity(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightIntensity(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightElevation" ).slider({
|
||||
value: viewer.getWeightElevation(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightElevation(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightClassification" ).slider({
|
||||
value: viewer.getWeightClassification(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightClassification(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightReturnNumber" ).slider({
|
||||
value: viewer.getWeightReturnNumber(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightReturnNumber(ui.value);}
|
||||
});
|
||||
|
||||
$( "#sldWeightSourceID" ).slider({
|
||||
value: viewer.getWeightSourceID(),
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setWeightSourceID(ui.value);}
|
||||
});
|
||||
|
||||
var updateHeightRange = function(){
|
||||
var box = viewer.getBoundingBox();
|
||||
var geoMin = viewer.toGeo(box.min).z;
|
||||
var geoMax = viewer.toGeo(box.max).z;
|
||||
let box = viewer.getBoundingBox();
|
||||
let geoMin = viewer.toGeo(box.min).z;
|
||||
let geoMax = viewer.toGeo(box.max).z;
|
||||
let width = geoMax - geoMin;
|
||||
geoMin = geoMin - 0.2 * width;
|
||||
geoMax = geoMax + 0.2 * width;
|
||||
|
||||
var hr = viewer.getHeightRange();
|
||||
var hrGeo = {
|
||||
let hr = viewer.getHeightRange();
|
||||
let hrGeo = {
|
||||
min: viewer.toGeo(new THREE.Vector3(0, hr.min, 0)).z,
|
||||
max: viewer.toGeo(new THREE.Vector3(0, hr.max, 0)).z,
|
||||
};
|
||||
|
||||
var vMin = hr.min ? hrGeo.min : geoMin;
|
||||
var vMax = hr.max ? hrGeo.max : geoMax;
|
||||
let vMin = hr.min ? hrGeo.min : geoMin;
|
||||
let vMax = hr.max ? hrGeo.max : geoMax;
|
||||
|
||||
$( '#lblHeightRange')[0].innerHTML = hrGeo.min.toFixed(2) + " to " + hrGeo.max.toFixed(2);
|
||||
$( "#sldHeightRange" ).slider({
|
||||
@ -302,29 +411,50 @@ function initMaterials(){
|
||||
});
|
||||
};
|
||||
|
||||
viewer.addEventListener("height_range_changed", function(event){
|
||||
updateHeightRange();
|
||||
var hr = viewer.getHeightRange();
|
||||
var hrGeo = {
|
||||
min: viewer.toGeo(new THREE.Vector3(0, hr.min, 0)).z,
|
||||
max: viewer.toGeo(new THREE.Vector3(0, hr.max, 0)).z,
|
||||
};
|
||||
let updateIntensityRange = function(){
|
||||
let range = viewer.getIntensityRange();
|
||||
let min = Math.log2(range[0]) / 16;
|
||||
let max = Math.log2(range[1]) / 16;
|
||||
|
||||
$( '#lblHeightRange')[0].innerHTML = hrGeo.min.toFixed(2) + " to " + hrGeo.max.toFixed(2);
|
||||
$( "#sldHeightRange" ).slider({values: [hrGeo.min, hrGeo.max]});
|
||||
$('#lblIntensityRange')[0].innerHTML =
|
||||
parseInt(viewer.getIntensityRange()[0]) + " to " +
|
||||
parseInt(viewer.getIntensityRange()[1]);
|
||||
$( "#sldIntensityRange" ).slider({
|
||||
values: [min, max]
|
||||
});
|
||||
};
|
||||
|
||||
viewer.addEventListener("height_range_changed", updateHeightRange);
|
||||
viewer.addEventListener("intensity_range_changed", updateIntensityRange);
|
||||
|
||||
viewer.addEventListener("intensity_gamma_changed", function(event){
|
||||
let gamma = viewer.getIntensityGamma();
|
||||
|
||||
$('#lblIntensityGamma')[0].innerHTML = gamma.toFixed(1);
|
||||
$("#sldIntensityGamma").slider({value: gamma});
|
||||
});
|
||||
|
||||
//viewer.addEventListener("material_transition_changed", function(event){
|
||||
// $( '#lblTransition')[0].innerHTML = viewer.getMaterialTransition().toFixed(2);
|
||||
// $( "#sldTransition" ).slider({value: viewer.getMaterialTransition()});
|
||||
//};
|
||||
viewer.addEventListener("intensity_contrast_changed", function(event){
|
||||
let contrast = viewer.getIntensityContrast();
|
||||
|
||||
$('#lblIntensityContrast')[0].innerHTML = contrast.toFixed(1);
|
||||
$("#sldIntensityContrast").slider({value: contrast});
|
||||
});
|
||||
|
||||
viewer.addEventListener("intensity_brightness_changed", function(event){
|
||||
let brightness = viewer.getIntensityBrightness();
|
||||
|
||||
$('#lblIntensityBrightness')[0].innerHTML = brightness.toFixed(1);
|
||||
$("#sldIntensityBrightness").slider({value: brightness});
|
||||
});
|
||||
|
||||
viewer.addEventListener("pointcloud_loaded", updateHeightRange);
|
||||
|
||||
updateHeightRange();
|
||||
|
||||
//var hr = viewer.getHeightRange();
|
||||
//$('#lblHeightRange')[0].innerHTML = hr.min.toFixed(2) + " to " + hr.max.toFixed(2);
|
||||
updateIntensityRange();
|
||||
$('#lblIntensityGamma')[0].innerHTML = viewer.getIntensityGamma().toFixed(1);
|
||||
$('#lblIntensityContrast')[0].innerHTML = viewer.getIntensityContrast().toFixed(1);
|
||||
$('#lblIntensityBrightness')[0].innerHTML = viewer.getIntensityBrightness().toFixed(1);
|
||||
|
||||
var options = [
|
||||
"RGB",
|
||||
@ -338,6 +468,7 @@ function initMaterials(){
|
||||
"Source",
|
||||
"Phong",
|
||||
"Level of Detail",
|
||||
"Composite",
|
||||
];
|
||||
|
||||
var elMaterialList = document.getElementById("optMaterial");
|
||||
@ -351,12 +482,48 @@ function initMaterials(){
|
||||
elMaterialList.appendChild(elOption);
|
||||
}
|
||||
|
||||
$("#optMaterial").val(viewer.getMaterialName()).selectmenu("refresh")
|
||||
$("#optMaterial").selectmenu({
|
||||
change: function(event, ui){
|
||||
viewer.setMaterial(ui.item.value);
|
||||
let updateMaterialPanel = function(event, ui){
|
||||
//viewer.setMaterial(ui.item.value);
|
||||
|
||||
let selectedValue = $("#optMaterial").selectmenu().val();
|
||||
viewer.setMaterial(selectedValue);
|
||||
|
||||
let blockWeights = $("#materials\\.composite_weight_container");
|
||||
let blockElevation = $("#materials\\.elevation_container");
|
||||
let blockIntensity = $("#materials\\.intensity_container");
|
||||
let blockTransition = $("#materials\\.transition_container");
|
||||
|
||||
blockIntensity.css("display", "none");
|
||||
blockElevation.css("display", "none");
|
||||
blockWeights.css("display", "none");
|
||||
blockTransition.css("display", "none");
|
||||
|
||||
if(selectedValue === "Composite"){
|
||||
blockIntensity.css("display", "block");
|
||||
blockElevation.css("display", "block");
|
||||
blockWeights.css("display", "block");
|
||||
}
|
||||
});
|
||||
|
||||
if(selectedValue === "Elevation"){
|
||||
blockElevation.css("display", "block");
|
||||
}
|
||||
|
||||
if(selectedValue === "RGB and Elevation"){
|
||||
blockElevation.css("display", "block");
|
||||
}
|
||||
|
||||
if(selectedValue === "Intensity"){
|
||||
blockIntensity.css("display", "block");
|
||||
}
|
||||
|
||||
if(selectedValue === "Intensity Gradient"){
|
||||
blockIntensity.css("display", "block");
|
||||
}
|
||||
};
|
||||
|
||||
$("#optMaterial").selectmenu({change: updateMaterialPanel});
|
||||
$("#optMaterial").val(viewer.getMaterialName()).selectmenu("refresh");
|
||||
updateMaterialPanel();
|
||||
}
|
||||
|
||||
function initClassificationList(){
|
||||
|
||||
@ -36,6 +36,17 @@ Potree.Viewer = function(domElement, args){
|
||||
this.heightMin = null;
|
||||
this.heightMax = null;
|
||||
this.materialTransition = 0.5;
|
||||
this.weightRGB = 1.0;
|
||||
this.weightIntensity = 0.0;
|
||||
this.weightElevation = 0.0;
|
||||
this.weightClassification = 0.0;
|
||||
this.weightReturnNumber = 0.0;
|
||||
this.weightSourceID = 0.0;
|
||||
this.intensityRange = [0, 65000];
|
||||
this.intensityGamma = 1;
|
||||
this.intensityContrast = 1;
|
||||
this.intensityBrightness = 0;
|
||||
|
||||
this.moveSpeed = 10;
|
||||
|
||||
this.showDebugInfos = false;
|
||||
@ -284,6 +295,51 @@ Potree.Viewer = function(domElement, args){
|
||||
return {min: scope.heightMin, max: scope.heightMax};
|
||||
};
|
||||
|
||||
this.setIntensityRange = function(min, max){
|
||||
if(scope.intensityRange[0] !== min || scope.intensityRange[1] !== max){
|
||||
scope.intensityRange[0] = min || scope.intensityRange[0];
|
||||
scope.intensityRange[1] = max || scope.intensityRange[1];
|
||||
scope.dispatchEvent({"type": "intensity_range_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getIntensityRange = function(){
|
||||
return scope.intensityRange;
|
||||
};
|
||||
|
||||
this.setIntensityGamma = function(value){
|
||||
if(scope.intensityGamma !== value){
|
||||
scope.intensityGamma = value;
|
||||
scope.dispatchEvent({"type": "intensity_gamma_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getIntensityGamma = function(){
|
||||
return scope.intensityGamma;
|
||||
};
|
||||
|
||||
this.setIntensityContrast = function(value){
|
||||
if(scope.intensityContrast !== value){
|
||||
scope.intensityContrast = value;
|
||||
scope.dispatchEvent({"type": "intensity_contrast_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getIntensityContrast = function(){
|
||||
return scope.intensityContrast;
|
||||
};
|
||||
|
||||
this.setIntensityBrightness = function(value){
|
||||
if(scope.intensityBrightness !== value){
|
||||
scope.intensityBrightness = value;
|
||||
scope.dispatchEvent({"type": "intensity_brightness_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getIntensityBrightness = function(){
|
||||
return scope.intensityBrightness;
|
||||
};
|
||||
|
||||
this.setMaterialTransition = function(t){
|
||||
if(scope.materialTransition !== t){
|
||||
scope.materialTransition = t;
|
||||
@ -295,6 +351,72 @@ Potree.Viewer = function(domElement, args){
|
||||
return scope.materialTransition;
|
||||
};
|
||||
|
||||
this.setWeightRGB = function(w){
|
||||
if(scope.weightRGB !== w){
|
||||
scope.weightRGB = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightRGB = function(){
|
||||
return scope.weightRGB;
|
||||
};
|
||||
|
||||
this.setWeightIntensity = function(w){
|
||||
if(scope.weightIntensity !== w){
|
||||
scope.weightIntensity = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightIntensity = function(){
|
||||
return scope.weightIntensity;
|
||||
};
|
||||
|
||||
this.setWeightElevation = function(w){
|
||||
if(scope.weightElevation !== w){
|
||||
scope.weightElevation = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightElevation = function(){
|
||||
return scope.weightElevation;
|
||||
};
|
||||
|
||||
this.setWeightClassification = function(w){
|
||||
if(scope.weightClassification !== w){
|
||||
scope.weightClassification = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightClassification = function(){
|
||||
return scope.weightClassification;
|
||||
};
|
||||
|
||||
this.setWeightReturnNumber = function(w){
|
||||
if(scope.weightReturnNumber !== w){
|
||||
scope.weightReturnNumber = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightReturnNumber = function(){
|
||||
return scope.weightReturnNumber;
|
||||
};
|
||||
|
||||
this.setWeightSourceID = function(w){
|
||||
if(scope.weightSourceID !== w){
|
||||
scope.weightSourceID = w;
|
||||
scope.dispatchEvent({"type": "attribute_weights_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWeightSourceID = function(){
|
||||
return scope.weightSourceID;
|
||||
};
|
||||
|
||||
this.setIntensityMax = function(max){
|
||||
if(scope.intensityMax !== max){
|
||||
scope.intensityMax = max;
|
||||
@ -561,6 +683,8 @@ Potree.Viewer = function(domElement, args){
|
||||
return Potree.PointColorType.PHONG;
|
||||
}else if(materialName === "RGB and Elevation"){
|
||||
return Potree.PointColorType.RGB_HEIGHT;
|
||||
}else if(materialName === "Composite"){
|
||||
return Potree.PointColorType.COMPOSITE;
|
||||
}
|
||||
};
|
||||
|
||||
@ -591,6 +715,8 @@ Potree.Viewer = function(domElement, args){
|
||||
return "Phong";
|
||||
}else if(materialID === Potree.PointColorType.RGB_HEIGHT){
|
||||
return "RGB and Elevation";
|
||||
}else if(materialID === Potree.PointColorType.COMPOSITE){
|
||||
return "Composite";
|
||||
}
|
||||
};
|
||||
|
||||
@ -1330,13 +1456,24 @@ Potree.Viewer = function(domElement, args){
|
||||
pointcloud.material.clipMode = scope.clipMode;
|
||||
pointcloud.material.heightMin = scope.heightMin;
|
||||
pointcloud.material.heightMax = scope.heightMax;
|
||||
pointcloud.material.intensityMin = 0;
|
||||
pointcloud.material.intensityMax = scope.intensityMax;
|
||||
//pointcloud.material.intensityMin = 0;
|
||||
//pointcloud.material.intensityMax = scope.intensityMax;
|
||||
pointcloud.material.uniforms.intensityRange.value = scope.getIntensityRange();
|
||||
pointcloud.material.uniforms.intensityGamma.value = scope.getIntensityGamma();
|
||||
pointcloud.material.uniforms.intensityContrast.value = scope.getIntensityContrast();
|
||||
pointcloud.material.uniforms.intensityBrightness.value = scope.getIntensityBrightness();
|
||||
pointcloud.showBoundingBox = scope.showBoundingBox;
|
||||
pointcloud.generateDEM = scope.useDEMCollisions;
|
||||
pointcloud.minimumNodePixelSize = scope.minNodeSize;
|
||||
pointcloud.material.uniforms.transition.value = scope.materialTransition;
|
||||
|
||||
pointcloud.material.uniforms.wRGB.value = scope.getWeightRGB();
|
||||
pointcloud.material.uniforms.wIntensity.value = scope.getWeightIntensity();
|
||||
pointcloud.material.uniforms.wElevation.value = scope.getWeightElevation();
|
||||
pointcloud.material.uniforms.wClassification.value = scope.getWeightClassification();
|
||||
pointcloud.material.uniforms.wReturnNumber.value = scope.getWeightReturnNumber();
|
||||
pointcloud.material.uniforms.wSourceID.value = scope.getWeightSourceID();
|
||||
|
||||
//if(!scope.freeze){
|
||||
// pointcloud.update(scope.camera, scope.renderer);
|
||||
//}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user