|
@@ -649,7 +649,7 @@
|
|
|
|
|
|
clickMaxDragDis:5,
|
|
clickMaxDragDis:5,
|
|
clickMaxPressTime:500, //ms
|
|
clickMaxPressTime:500, //ms
|
|
-
|
|
|
|
|
|
+ doubleClickTime:200,//双击间隔时间
|
|
|
|
|
|
|
|
|
|
background: '#232323',
|
|
background: '#232323',
|
|
@@ -778,13 +778,14 @@
|
|
|
|
|
|
|
|
|
|
useDepthTex: true,//使用深度贴图,但不代表一定有(得到的intersect更快速准确和稳定) SS-t-7DUfWAUZ3V
|
|
useDepthTex: true,//使用深度贴图,但不代表一定有(得到的intersect更快速准确和稳定) SS-t-7DUfWAUZ3V
|
|
-
|
|
|
|
|
|
+ matUseDepth:false,
|
|
//panoEdit:
|
|
//panoEdit:
|
|
datasetsPanos:{},
|
|
datasetsPanos:{},
|
|
|
|
|
|
//mergeModel:
|
|
//mergeModel:
|
|
boundAddObjs:false,
|
|
boundAddObjs:false,
|
|
intersectOnObjs:false,
|
|
intersectOnObjs:false,
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -56724,7 +56725,9 @@ void main() {
|
|
};
|
|
};
|
|
|
|
|
|
let defines = {};
|
|
let defines = {};
|
|
- if(o.useDepth && Features.EXT_DEPTH.isSupported())defines.useDepth = '';
|
|
|
|
|
|
+
|
|
|
|
+ let useDepth = o.useDepth && Features.EXT_DEPTH.isSupported() && Potree.settings.matUseDepth;
|
|
|
|
+ if(useDepth )defines.useDepth = '';
|
|
if(o.map)defines.use_map = '';
|
|
if(o.map)defines.use_map = '';
|
|
super({
|
|
super({
|
|
uniforms,
|
|
uniforms,
|
|
@@ -56740,7 +56743,7 @@ void main() {
|
|
this.opacity = o.opacity;
|
|
this.opacity = o.opacity;
|
|
}
|
|
}
|
|
|
|
|
|
- if(o.useDepth && Features.EXT_DEPTH.isSupported()) this.useDepth_ = true;
|
|
|
|
|
|
+ if(useDepth) this.useDepth_ = true;
|
|
|
|
|
|
|
|
|
|
let setSize = (e)=>{//如果出现横条状的异常,往往是viewportOffset出错
|
|
let setSize = (e)=>{//如果出现横条状的异常,往往是viewportOffset出错
|
|
@@ -59512,15 +59515,15 @@ void main() {
|
|
//默认
|
|
//默认
|
|
lineWidth : 5,
|
|
lineWidth : 5,
|
|
color:0xffffff,
|
|
color:0xffffff,
|
|
- transparent : true, depthWrite:false, depthTest:false,
|
|
|
|
|
|
+ transparent : true, depthWrite:true, depthTest:true,
|
|
dashSize : 0.1, gapSize:0.1,
|
|
dashSize : 0.1, gapSize:0.1,
|
|
}, o, {
|
|
}, o, {
|
|
//修正覆盖:
|
|
//修正覆盖:
|
|
dashed: o.dashWithDepth ? supportExtDepth && !!o.dashed : !!o.dashed ,
|
|
dashed: o.dashWithDepth ? supportExtDepth && !!o.dashed : !!o.dashed ,
|
|
dashWithDepth:!!o.dashWithDepth,//只在被遮住的部分显示虚线
|
|
dashWithDepth:!!o.dashWithDepth,//只在被遮住的部分显示虚线
|
|
- useDepth: !!o.useDepth,
|
|
|
|
|
|
+ useDepth: Potree.settings.matUseDepth && !!o.useDepth,
|
|
supportExtDepth,
|
|
supportExtDepth,
|
|
-
|
|
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -61224,7 +61227,7 @@ void main() {
|
|
gapSize: 0.04,
|
|
gapSize: 0.04,
|
|
transparent: true,
|
|
transparent: true,
|
|
opacity: config$1.measure.default.opacity,
|
|
opacity: config$1.measure.default.opacity,
|
|
- depthTestWhenPick:true,
|
|
|
|
|
|
+ depthTestWhenPick:true,
|
|
}),
|
|
}),
|
|
edgeSelect: LineDraw.createFatLineMat({
|
|
edgeSelect: LineDraw.createFatLineMat({
|
|
color: config$1.measure.highlight.color,//'#f0ff00',
|
|
color: config$1.measure.highlight.color,//'#f0ff00',
|
|
@@ -61233,6 +61236,7 @@ void main() {
|
|
lineWidth: config$1.measure.lineWidth ,
|
|
lineWidth: config$1.measure.lineWidth ,
|
|
transparent: true,
|
|
transparent: true,
|
|
opacity: config$1.measure.highlight.opacity
|
|
opacity: config$1.measure.highlight.opacity
|
|
|
|
+
|
|
}),
|
|
}),
|
|
guide: LineDraw.createFatLineMat({
|
|
guide: LineDraw.createFatLineMat({
|
|
color:config$1.measure.guide.color,
|
|
color:config$1.measure.guide.color,
|
|
@@ -63766,11 +63770,9 @@ void main() {
|
|
modelEditing.updateMatrixWorld()
|
|
modelEditing.updateMatrixWorld()
|
|
let boundCenter = modelEditing.boundingBox.getCenter(new THREE.Vector3).applyMatrix4(modelEditing.matrixWorld);
|
|
let boundCenter = modelEditing.boundingBox.getCenter(new THREE.Vector3).applyMatrix4(modelEditing.matrixWorld);
|
|
*/
|
|
*/
|
|
- MergeEditor.moveBoundCenter(new Vector2$1(x,y, model.boundCenter.z)); //使模型中心的xy在鼠标所在位置
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- model.dispatchEvent("position_changed");
|
|
|
|
-
|
|
|
|
|
|
+ MergeEditor.moveBoundCenterTo(modelEditing,new Vector3(x,y, modelEditing.boundCenter.z)); //使模型中心的xy在鼠标所在位置
|
|
|
|
+
|
|
|
|
+ modelEditing.dispatchEvent("position_changed");
|
|
|
|
|
|
};
|
|
};
|
|
let cancelMove = ()=>{
|
|
let cancelMove = ()=>{
|
|
@@ -63779,7 +63781,7 @@ void main() {
|
|
viewer.removeEventListener('global_click', confirmPos);
|
|
viewer.removeEventListener('global_click', confirmPos);
|
|
};
|
|
};
|
|
let confirmPos = ()=>{
|
|
let confirmPos = ()=>{
|
|
- MergeEditor.focusOnSelect(modelEditing);
|
|
|
|
|
|
+ MergeEditor.focusOn(modelEditing);
|
|
cancelMove();
|
|
cancelMove();
|
|
return {stopContinue:true}
|
|
return {stopContinue:true}
|
|
};
|
|
};
|
|
@@ -63804,18 +63806,20 @@ void main() {
|
|
{//transform
|
|
{//transform
|
|
let updateBound = ()=>{
|
|
let updateBound = ()=>{
|
|
model.updateMatrixWorld();
|
|
model.updateMatrixWorld();
|
|
- viewer.updateModelBound();
|
|
|
|
- model.dispatchEvent('transformChanged');
|
|
|
|
|
|
+ viewer.updateModelBound();
|
|
};
|
|
};
|
|
let maintainBtmZAndCenter = ()=>{
|
|
let maintainBtmZAndCenter = ()=>{
|
|
MergeEditor.maintainBoundXY(model);
|
|
MergeEditor.maintainBoundXY(model);
|
|
MergeEditor.setModelBtmHeight(model);
|
|
MergeEditor.setModelBtmHeight(model);
|
|
updateBound();
|
|
updateBound();
|
|
|
|
+ model.dispatchEvent('transformChanged');
|
|
};
|
|
};
|
|
model.addEventListener('position_changed', ()=>{
|
|
model.addEventListener('position_changed', ()=>{
|
|
- MergeEditor.getBoundCenter(model);//更新boundcenter
|
|
|
|
updateBound();
|
|
updateBound();
|
|
- });
|
|
|
|
|
|
+ MergeEditor.getBoundCenter(model);//更新boundcenter
|
|
|
|
+ MergeEditor.computeBtmHeight(model);
|
|
|
|
+ model.dispatchEvent('transformChanged');
|
|
|
|
+ });
|
|
model.addEventListener("orientation_changed", maintainBtmZAndCenter );
|
|
model.addEventListener("orientation_changed", maintainBtmZAndCenter );
|
|
model.addEventListener("scale_changed", maintainBtmZAndCenter );
|
|
model.addEventListener("scale_changed", maintainBtmZAndCenter );
|
|
|
|
|
|
@@ -85321,9 +85325,10 @@ void main() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let desc = this.getEventDesc(e,isTouch);
|
|
//if(!clickElement){
|
|
//if(!clickElement){
|
|
this.viewer.dispatchEvent($.extend(
|
|
this.viewer.dispatchEvent($.extend(
|
|
- this.getEventDesc(e,isTouch),
|
|
|
|
|
|
+ desc,
|
|
{
|
|
{
|
|
type: 'global_click',
|
|
type: 'global_click',
|
|
pressDistance
|
|
pressDistance
|
|
@@ -85335,18 +85340,20 @@ void main() {
|
|
|
|
|
|
//增加 单击:
|
|
//增加 单击:
|
|
this.needSingleClick = true;
|
|
this.needSingleClick = true;
|
|
- this.doubleClickTime = 200; //双击间隔时间
|
|
|
|
|
|
+
|
|
|
|
+
|
|
setTimeout(()=>{
|
|
setTimeout(()=>{
|
|
if(this.needSingleClick){
|
|
if(this.needSingleClick){
|
|
this.viewer.dispatchEvent($.extend(
|
|
this.viewer.dispatchEvent($.extend(
|
|
- this.getEventDesc(e,isTouch),
|
|
|
|
|
|
+ desc,
|
|
{
|
|
{
|
|
type: 'global_single_click',
|
|
type: 'global_single_click',
|
|
- pressDistance
|
|
|
|
|
|
+ pressDistance,
|
|
|
|
+ clickElement
|
|
}
|
|
}
|
|
));
|
|
));
|
|
}
|
|
}
|
|
- }, this.doubleClickTime+1);
|
|
|
|
|
|
+ }, Potree.config.doubleClickTime+1);
|
|
|
|
|
|
//自行执行双击:
|
|
//自行执行双击:
|
|
|
|
|
|
@@ -85577,13 +85584,13 @@ void main() {
|
|
this.hoverViewport = viewport;
|
|
this.hoverViewport = viewport;
|
|
if(!viewport)return//刚变化viewport时会找不到
|
|
if(!viewport)return//刚变化viewport时会找不到
|
|
|
|
|
|
-
|
|
|
|
|
|
+ let isFlying = this.viewer.viewports.some(e=>e.view.isFlying());
|
|
let intersectPoint;
|
|
let intersectPoint;
|
|
|
|
|
|
|
|
|
|
if(e.onlyGetIntersect || !this.drag || this.drag.object || viewport.alignment ){ //没有拖拽物体,但按下鼠标了的话,不intersect
|
|
if(e.onlyGetIntersect || !this.drag || this.drag.object || viewport.alignment ){ //没有拖拽物体,但按下鼠标了的话,不intersect
|
|
|
|
|
|
- let dontIntersectPointcloud = this.drag && viewport.alignment && Potree.settings.editType == 'pano' || viewer.images360.flying; // flying 时可能卡顿
|
|
|
|
|
|
+ let dontIntersectPointcloud = this.drag && viewport.alignment && Potree.settings.editType == 'pano' || isFlying;/* viewer.images360.flying */ // flying 时可能卡顿
|
|
//console.log('dontIntersectPointcloud',dontIntersectPointcloud)
|
|
//console.log('dontIntersectPointcloud',dontIntersectPointcloud)
|
|
intersectPoint = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, dontIntersectPointcloud, e.whichPointcloud); //数据集多的时候卡顿
|
|
intersectPoint = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, dontIntersectPointcloud, e.whichPointcloud); //数据集多的时候卡顿
|
|
//console.log('intersectPoint', intersectPoint)
|
|
//console.log('intersectPoint', intersectPoint)
|
|
@@ -85649,10 +85656,13 @@ void main() {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
if(!isTouch || e.touches.length == 1){
|
|
if(!isTouch || e.touches.length == 1){
|
|
|
|
|
|
- if(!this.drag || this.drag.notPressMouse ){
|
|
|
|
- let hoveredElements = this.getHoveredElements();
|
|
|
|
|
|
+ if((!this.drag || this.drag.notPressMouse || Potree.settings.intersectOnObjs && this.drag.object) && !isFlying){
|
|
|
|
+
|
|
|
|
+ /* let blacklist = this.drag && this.drag */
|
|
|
|
+ let hoveredElements = this.getHoveredElements( );
|
|
if(hoveredElements.length > 0){
|
|
if(hoveredElements.length > 0){
|
|
let names = hoveredElements.map(h => h.object.name).join(", ");
|
|
let names = hoveredElements.map(h => h.object.name).join(", ");
|
|
if (this.logMessages) console.log(`${this.constructor.name}: onMouseMove; hovered: '${names}'`);
|
|
if (this.logMessages) console.log(`${this.constructor.name}: onMouseMove; hovered: '${names}'`);
|
|
@@ -115087,8 +115097,10 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
viewer.addEventListener('global_single_click',(e)=>{
|
|
viewer.addEventListener('global_single_click',(e)=>{
|
|
- if(viewer.inputHandler.selection[0] ||//正在平移和旋转,不允许更换
|
|
|
|
- viewer.scene.cameraAnimations.length //正在播放
|
|
|
|
|
|
+ if(/* viewer.inputHandler.selection[0] ||//正在平移和旋转,不允许更换 */
|
|
|
|
+ viewer.scene.cameraAnimations.length || //正在播放
|
|
|
|
+ e.drag && e.drag.notPressMouse //在加测量线
|
|
|
|
+ //e.clickElement && e.clickElement != e.intersect.object
|
|
){
|
|
){
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -115106,6 +115118,10 @@ ENDSEC
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+
|
|
|
|
+ viewer.ssaaRenderPass.enabled = false;
|
|
|
|
+ viewer.outlinePass.enabled = true;
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
@@ -115143,7 +115159,7 @@ ENDSEC
|
|
viewer.objs.remove(model);
|
|
viewer.objs.remove(model);
|
|
},
|
|
},
|
|
|
|
|
|
- selectModel(model, state=true, ifFocus, by2d){
|
|
|
|
|
|
+ selectModel(model, state=true, fitBound, by2d){
|
|
if(!model) {
|
|
if(!model) {
|
|
model = this.selected;
|
|
model = this.selected;
|
|
state = false;
|
|
state = false;
|
|
@@ -115152,10 +115168,13 @@ ENDSEC
|
|
if(state){
|
|
if(state){
|
|
if(this.selected){
|
|
if(this.selected){
|
|
if(this.selected == model) return
|
|
if(this.selected == model) return
|
|
- else this.selectModel(this.selected, false, ifFocus, by2d);
|
|
|
|
|
|
+ else this.selectModel(this.selected, false, fitBound, by2d);
|
|
}
|
|
}
|
|
this.selected = model;
|
|
this.selected = model;
|
|
- ifFocus && MergeEditor.focusOn(model); //通过在场景里点击模型的话,不focus
|
|
|
|
|
|
+
|
|
|
|
+ MergeEditor.focusOn(model, 500, !!fitBound); //通过在场景里点击模型的话,不focus
|
|
|
|
+
|
|
|
|
+
|
|
viewer.outlinePass.selectedObjects = [model];
|
|
viewer.outlinePass.selectedObjects = [model];
|
|
|
|
|
|
if(model.isPointcloud){
|
|
if(model.isPointcloud){
|
|
@@ -115200,15 +115219,21 @@ ENDSEC
|
|
}) //setView can cancel bump
|
|
}) //setView can cancel bump
|
|
|
|
|
|
}, */
|
|
}, */
|
|
- focusOn(objects, duration = 400){
|
|
|
|
|
|
+ focusOn(objects, duration = 400, fitBound=true){
|
|
if(!(objects instanceof Array)){
|
|
if(!(objects instanceof Array)){
|
|
objects = [objects];
|
|
objects = [objects];
|
|
}
|
|
}
|
|
let boundingBox = new Box3;
|
|
let boundingBox = new Box3;
|
|
objects.forEach(object=>{
|
|
objects.forEach(object=>{
|
|
boundingBox.union(object.boundingBox.clone().applyMatrix4(object.matrixWorld));
|
|
boundingBox.union(object.boundingBox.clone().applyMatrix4(object.matrixWorld));
|
|
- });
|
|
|
|
- viewer.focusOnObject({boundingBox}, 'boundingBox', duration );
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if(fitBound){
|
|
|
|
+ viewer.focusOnObject({boundingBox}, 'boundingBox', duration);
|
|
|
|
+ }else {
|
|
|
|
+ viewer.focusOnObject({position: boundingBox.getCenter(new Vector3)}, 'point', duration, {dontChangePos: true});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
@@ -115227,6 +115252,13 @@ ENDSEC
|
|
model.position.z += (hopeZ - center.z);
|
|
model.position.z += (hopeZ - center.z);
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ computeBtmHeight(model){ //位移之后重新计算btmHeight
|
|
|
|
+ model.updateMatrixWorld();
|
|
|
|
+ let boundingBox2 = model.boundingBox.clone().applyMatrix4(model.matrixWorld);
|
|
|
|
+ let size = boundingBox2.getSize(new Vector3);
|
|
|
|
+ let center = boundingBox2.getCenter(new Vector3);
|
|
|
|
+ model.btmHeight = center.z - size.z / 2;
|
|
|
|
+ },
|
|
|
|
|
|
maintainBoundXY(model){ //在旋转和缩放后,立即执行这个函数,使boundCenter保持原位
|
|
maintainBoundXY(model){ //在旋转和缩放后,立即执行这个函数,使boundCenter保持原位
|
|
|
|
|
|
@@ -115621,7 +115653,7 @@ ENDSEC
|
|
this.forbitTex = texLoader$9.load(Potree.resourcePath+'/textures/pic-forbid.png');
|
|
this.forbitTex = texLoader$9.load(Potree.resourcePath+'/textures/pic-forbid.png');
|
|
|
|
|
|
//this.layers.set(0/* RenderLayers.RETICULE */);
|
|
//this.layers.set(0/* RenderLayers.RETICULE */);
|
|
- this.renderOrder = 0;
|
|
|
|
|
|
+ this.renderOrder = 100;
|
|
this.layers.set(Potree.config.renderLayers.marker);
|
|
this.layers.set(Potree.config.renderLayers.marker);
|
|
|
|
|
|
|
|
|
|
@@ -115826,7 +115858,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- this.position.copy(location);/* .add(normal.clone().multiplyScalar(.01)); */
|
|
|
|
|
|
+ this.position.copy(location);/* .add(normal.clone().multiplyScalar(.01)); */
|
|
this.updateMatrix(); //lookAt之前要保证得到matrix
|
|
this.updateMatrix(); //lookAt之前要保证得到matrix
|
|
this.lookAt(this.position.clone().add(this.direction));
|
|
this.lookAt(this.position.clone().add(this.direction));
|
|
|
|
|
|
@@ -118759,16 +118791,15 @@ ENDSEC
|
|
if(data) {
|
|
if(data) {
|
|
animation.name = data.name;
|
|
animation.name = data.name;
|
|
animation.duration = data.duration;
|
|
animation.duration = data.duration;
|
|
- //animation.t = data.t;
|
|
|
|
- //animation.curveType = data.curveType;
|
|
|
|
- //animation.visible = data.visible;
|
|
|
|
|
|
+ animation.useDurSlice = data.useDurSlice;
|
|
|
|
+
|
|
for(const cpdata of data.points){
|
|
for(const cpdata of data.points){
|
|
/* const position = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.position, datasetId: Potree.settings.originDatasetId })
|
|
/* const position = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.position, datasetId: Potree.settings.originDatasetId })
|
|
const target = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.target, datasetId: Potree.settings.originDatasetId })
|
|
const target = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.target, datasetId: Potree.settings.originDatasetId })
|
|
*/
|
|
*/
|
|
const position = new Vector3().copy(cpdata.position);
|
|
const position = new Vector3().copy(cpdata.position);
|
|
const target = new Vector3().copy(cpdata.target);
|
|
const target = new Vector3().copy(cpdata.target);
|
|
- const duration = cpdata.duration;
|
|
|
|
|
|
+ const duration = cpdata.time;
|
|
const cp = animation.createControlPoint(null, {position, target, duration});
|
|
const cp = animation.createControlPoint(null, {position, target, duration});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -121656,7 +121687,7 @@ ENDSEC
|
|
addPass: function (pass){
|
|
addPass: function (pass){
|
|
this.childPass = pass;
|
|
this.childPass = pass;
|
|
},
|
|
},
|
|
- render: function (scene, camera, renderer, writeBuffer, readBuffer, maskActive, renderFun ) {
|
|
|
|
|
|
+ render: function (scene, camera, viewports, renderer, writeBuffer, readBuffer, maskActive, renderFun ) {
|
|
if(this.useCopy ){
|
|
if(this.useCopy ){
|
|
scene = this.copyPass.scene; camera = this.copyPass.camera;
|
|
scene = this.copyPass.scene; camera = this.copyPass.camera;
|
|
}
|
|
}
|
|
@@ -122004,28 +122035,24 @@ ENDSEC
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- render: function ( scene, camera, renderFun ) {
|
|
|
|
|
|
+ render: function ( scene, camera, viewports, renderFun ) {
|
|
|
|
|
|
var maskActive = false;
|
|
var maskActive = false;
|
|
-
|
|
|
|
- var pass, i, il = this.passes.length;
|
|
|
|
|
|
+ let passes = this.passes.filter(e=>e.enabled);
|
|
|
|
+ var pass, i, il = passes.length;
|
|
|
|
|
|
if(this.readTarget){ //add 使用当前renderTarget中的像素
|
|
if(this.readTarget){ //add 使用当前renderTarget中的像素
|
|
- this.copyPass.render(scene,camera, this.renderer, this.readBuffer, this.renderer.getRenderTarget() );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ this.copyPass.render(scene, this.renderer, this.readBuffer, this.renderer.getRenderTarget() );
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
for ( i = 0; i < il; i ++ ) {
|
|
for ( i = 0; i < il; i ++ ) {
|
|
|
|
|
|
- pass = this.passes[ i ];
|
|
|
|
-
|
|
|
|
- if ( pass.enabled === false ) continue;
|
|
|
|
-
|
|
|
|
|
|
+ pass = passes[ i ];
|
|
|
|
+
|
|
|
|
|
|
//if(i == il-1)pass.renderToScreen = true//
|
|
//if(i == il-1)pass.renderToScreen = true//
|
|
|
|
|
|
- pass.render( scene, camera, this.renderer, this.writeBuffer, this.readBuffer, maskActive, renderFun );
|
|
|
|
|
|
+ pass.render( scene, camera, viewports, this.renderer, this.writeBuffer, this.readBuffer, maskActive, renderFun );
|
|
|
|
|
|
if ( pass.needsSwap ) {
|
|
if ( pass.needsSwap ) {
|
|
|
|
|
|
@@ -122730,7 +122757,7 @@ ENDSEC
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- render: function (scenes, camera, renderer, writeBuffer, readBuffer, maskActive, renderFun ) {
|
|
|
|
|
|
+ render: function (scenes, camera, viewports, renderer, writeBuffer, readBuffer, maskActive, renderFun ) {
|
|
if(!(scenes instanceof Array))scenes = [scenes];
|
|
if(!(scenes instanceof Array))scenes = [scenes];
|
|
if ( this.selectedObjects.length > 0 ) {
|
|
if ( this.selectedObjects.length > 0 ) {
|
|
|
|
|
|
@@ -122743,9 +122770,10 @@ ENDSEC
|
|
scenes.forEach(scene=>renderer.render( scene, camera));
|
|
scenes.forEach(scene=>renderer.render( scene, camera));
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ viewports.forEach(e=> e.beforeRender = ()=>{
|
|
|
|
+ this.replaceDepthToViewZ( e.camera );
|
|
|
|
+ });
|
|
|
|
|
|
- //add
|
|
|
|
- this.replaceDepthToViewZ( camera );
|
|
|
|
|
|
|
|
this.oldClearColor.copy( renderer.getClearColor(new Color) );
|
|
this.oldClearColor.copy( renderer.getClearColor(new Color) );
|
|
this.oldClearAlpha = renderer.getClearAlpha();
|
|
this.oldClearAlpha = renderer.getClearAlpha();
|
|
@@ -122773,12 +122801,19 @@ ENDSEC
|
|
//renderer.setRenderTarget(this.renderTargetDepthBuffer)
|
|
//renderer.setRenderTarget(this.renderTargetDepthBuffer)
|
|
//renderer.clear()
|
|
//renderer.clear()
|
|
//renderer.render( scene, camera/* , this.renderTargetDepthBuffer, true */);
|
|
//renderer.render( scene, camera/* , this.renderTargetDepthBuffer, true */);
|
|
-
|
|
|
|
|
|
+
|
|
// Make selected objects visible
|
|
// Make selected objects visible
|
|
this.changeVisibilityOfSelectedObjects( true );
|
|
this.changeVisibilityOfSelectedObjects( true );
|
|
|
|
|
|
- // Update Texture Matrix for Depth compare
|
|
|
|
- this.updateTextureMatrix(camera);
|
|
|
|
|
|
+
|
|
|
|
+ viewports.forEach(e=> e.beforeRender = ()=>{
|
|
|
|
+ // Update Texture Matrix for Depth compare
|
|
|
|
+ this.updateTextureMatrix(e.camera);
|
|
|
|
+ this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new Vector2$1( e.camera.near, e.camera.far );
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
// Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
|
|
// Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects
|
|
this.changeVisibilityOfNonSelectedObjects( false , scenes);
|
|
this.changeVisibilityOfNonSelectedObjects( false , scenes);
|
|
@@ -122789,7 +122824,6 @@ ENDSEC
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
- this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new Vector2$1( camera.near, camera.far );
|
|
|
|
this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture;
|
|
this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture;
|
|
this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix;
|
|
this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix;
|
|
|
|
|
|
@@ -122797,7 +122831,9 @@ ENDSEC
|
|
//renderer.clear()
|
|
//renderer.clear()
|
|
//renderer.render( scene, camera/* , this.renderTargetMaskBuffer, true */ );
|
|
//renderer.render( scene, camera/* , this.renderTargetMaskBuffer, true */ );
|
|
render2(this.renderTargetMaskBuffer);
|
|
render2(this.renderTargetMaskBuffer);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ viewports.forEach((e)=>{e.beforeRender = null;});
|
|
|
|
+
|
|
this.changeVisibilityOfNonSelectedObjects( true , scenes);
|
|
this.changeVisibilityOfNonSelectedObjects( true , scenes);
|
|
|
|
|
|
|
|
|
|
@@ -122807,21 +122843,7 @@ ENDSEC
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
- // 2. Downsample to Half resolution
|
|
|
|
- /*this.quad.material = this.materialCopy;
|
|
|
|
- this.copyUniforms[ "tDiffuse" ].value = this.renderTargetMaskBuffer.texture;
|
|
|
|
- renderer.render( this.scene, this.camera, this.renderTargetMaskDownSampleBuffer, true );
|
|
|
|
-
|
|
|
|
- this.tempPulseColor1.copy( this.visibleEdgeColor );
|
|
|
|
- this.tempPulseColor2.copy( this.hiddenEdgeColor );
|
|
|
|
-
|
|
|
|
- if ( this.pulsePeriod > 0 ) {
|
|
|
|
-
|
|
|
|
- var scalar = ( 1 + 0.25 ) / 2 + Math.cos( performance.now() * 0.01 / this.pulsePeriod ) * ( 1.0 - 0.25 ) / 2;
|
|
|
|
- this.tempPulseColor1.multiplyScalar( scalar );
|
|
|
|
- this.tempPulseColor2.multiplyScalar( scalar );
|
|
|
|
-
|
|
|
|
- } */
|
|
|
|
|
|
+
|
|
|
|
|
|
// 3. Apply Edge Detection Pass
|
|
// 3. Apply Edge Detection Pass
|
|
this.quad.material = this.edgeDetectionMaterial;
|
|
this.quad.material = this.edgeDetectionMaterial;
|
|
@@ -122839,36 +122861,24 @@ ENDSEC
|
|
if ( this.renderToScreen ) {
|
|
if ( this.renderToScreen ) {
|
|
this.quad.material.transparent = true;
|
|
this.quad.material.transparent = true;
|
|
buffer = null;
|
|
buffer = null;
|
|
- renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
|
|
|
|
|
|
+ renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
|
|
render2();
|
|
render2();
|
|
|
|
+
|
|
|
|
+ //绘制到全屏
|
|
|
|
+ let renderSize = renderer.getSize(new Vector2$1()); //是client大小
|
|
|
|
+ renderer.setViewport(0, 0, renderSize.x, renderSize.y); //规定视口,影响图形变换(画布的使用范围)
|
|
|
|
+ renderer.setScissorTest( false );
|
|
|
|
+
|
|
}else {
|
|
}else {
|
|
renderer.setClearColor( 0x000000, 0 );
|
|
renderer.setClearColor( 0x000000, 0 );
|
|
renderer.clear();
|
|
renderer.clear();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
renderer.setRenderTarget(buffer/* this.renderTargetEdgeBuffer1 */);
|
|
renderer.setRenderTarget(buffer/* this.renderTargetEdgeBuffer1 */);
|
|
|
|
|
|
renderer.render( this.scene, this.camera/* , this.renderTargetEdgeBuffer1, true */);
|
|
renderer.render( this.scene, this.camera/* , this.renderTargetEdgeBuffer1, true */);
|
|
-
|
|
|
|
- /*
|
|
|
|
- // 4. Apply Blur on Half res
|
|
|
|
- this.quad.material = this.separableBlurMaterial1;
|
|
|
|
- this.separableBlurMaterial1.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture;
|
|
|
|
- this.separableBlurMaterial1.uniforms[ "direction" ].value = OutlinePass.BlurDirectionX;
|
|
|
|
- this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = this.edgeThickness;
|
|
|
|
- renderer.render( this.scene, this.camera, this.renderTargetBlurBuffer1, true );
|
|
|
|
- this.separableBlurMaterial1.uniforms[ "colorTexture" ].value = this.renderTargetBlurBuffer1.texture;
|
|
|
|
- this.separableBlurMaterial1.uniforms[ "direction" ].value = OutlinePass.BlurDirectionY;
|
|
|
|
- renderer.render( this.scene, this.camera, this.renderTargetEdgeBuffer1, true );
|
|
|
|
-
|
|
|
|
- // Apply Blur on quarter res
|
|
|
|
- this.quad.material = this.separableBlurMaterial2;
|
|
|
|
- this.separableBlurMaterial2.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture;
|
|
|
|
- this.separableBlurMaterial2.uniforms[ "direction" ].value = OutlinePass.BlurDirectionX;
|
|
|
|
- renderer.render( this.scene, this.camera, this.renderTargetBlurBuffer2, true );
|
|
|
|
- this.separableBlurMaterial2.uniforms[ "colorTexture" ].value = this.renderTargetBlurBuffer2.texture;
|
|
|
|
- this.separableBlurMaterial2.uniforms[ "direction" ].value = OutlinePass.BlurDirectionY;
|
|
|
|
- renderer.render( this.scene, this.camera, this.renderTargetEdgeBuffer2, true );
|
|
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
|
|
//这次删掉
|
|
//这次删掉
|
|
/* // Blend it additively over the input texture
|
|
/* // Blend it additively over the input texture
|
|
@@ -123544,11 +123554,12 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
//add: for 截图时抗锯齿
|
|
//add: for 截图时抗锯齿
|
|
-
|
|
|
|
|
|
+
|
|
{
|
|
{
|
|
this.composer = new EffectComposer( this.renderer );
|
|
this.composer = new EffectComposer( this.renderer );
|
|
this.ssaaRenderPass = new SSAARenderPass(0x000000, 0);
|
|
this.ssaaRenderPass = new SSAARenderPass(0x000000, 0);
|
|
- //this.composer.addPass( this.ssaaRenderPass );
|
|
|
|
|
|
+ this.composer.addPass( this.ssaaRenderPass );
|
|
|
|
+
|
|
//this.ssaaRenderPass.useCopy = true
|
|
//this.ssaaRenderPass.useCopy = true
|
|
//this.ssaaRenderPass.renderToScreen = true;
|
|
//this.ssaaRenderPass.renderToScreen = true;
|
|
//this.ssaaRenderPass.needsSwap = false
|
|
//this.ssaaRenderPass.needsSwap = false
|
|
@@ -123593,6 +123604,7 @@ ENDSEC
|
|
|
|
|
|
let outlinePass = this.outlinePass = new OutlinePass( );
|
|
let outlinePass = this.outlinePass = new OutlinePass( );
|
|
outlinePass.renderToScreen = true; //这样更流畅,不用ssaa了,缺点是outline有锯齿
|
|
outlinePass.renderToScreen = true; //这样更流畅,不用ssaa了,缺点是outline有锯齿
|
|
|
|
+ outlinePass.enabled = false;
|
|
this.composer.addPass( outlinePass );
|
|
this.composer.addPass( outlinePass );
|
|
outlinePass.edgeStrength = 10;
|
|
outlinePass.edgeStrength = 10;
|
|
outlinePass.edgeGlow = 0;
|
|
outlinePass.edgeGlow = 0;
|
|
@@ -126346,7 +126358,7 @@ ENDSEC
|
|
render(params){//add params
|
|
render(params){//add params
|
|
if(Potree.measureTimings) performance.mark("render-start");
|
|
if(Potree.measureTimings) performance.mark("render-start");
|
|
if(this.outlinePass.selectedObjects.length){
|
|
if(this.outlinePass.selectedObjects.length){
|
|
- this.composer.render(this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud), this.mainViewport.camera, this.renderDefault.bind(this));
|
|
|
|
|
|
+ this.composer.render(this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud), null, this.viewports, this.renderDefault.bind(this));
|
|
}else {
|
|
}else {
|
|
this.renderDefault(params);
|
|
this.renderDefault(params);
|
|
}
|
|
}
|
|
@@ -126484,7 +126496,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ let mapViewport;
|
|
let mainViewport = this.mainViewport;
|
|
let mainViewport = this.mainViewport;
|
|
let viewports = [mainViewport];
|
|
let viewports = [mainViewport];
|
|
let oldStates = {
|
|
let oldStates = {
|
|
@@ -126492,7 +126504,7 @@ ENDSEC
|
|
pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null,
|
|
pano: Potree.settings.displayMode == 'showPanos' ? viewer.images360.currentPano : null,
|
|
};
|
|
};
|
|
if(useMap){
|
|
if(useMap){
|
|
- let mapViewport = this.mapViewer.viewports[0];
|
|
|
|
|
|
+ mapViewport = this.mapViewer.viewports[0];
|
|
viewports.push(mapViewport);
|
|
viewports.push(mapViewport);
|
|
oldStates.viewports.push(mapViewport.clone());
|
|
oldStates.viewports.push(mapViewport.clone());
|
|
oldStates.attachedToViewer = this.mapViewer.attachedToViewer;
|
|
oldStates.attachedToViewer = this.mapViewer.attachedToViewer;
|
|
@@ -126831,11 +126843,14 @@ ENDSEC
|
|
}
|
|
}
|
|
|
|
|
|
if(Potree.settings.displayMode == 'showPointCloud'){
|
|
if(Potree.settings.displayMode == 'showPointCloud'){
|
|
- dis = bestDistance;
|
|
|
|
- let dir = o.direction ? o.direction.clone().negate() : this.mainViewport.view.direction.negate();//new THREE.Vector3().subVectors(camera.position, target).normalize()
|
|
|
|
-
|
|
|
|
- position.copy(target).add(dir.multiplyScalar(dis));
|
|
|
|
-
|
|
|
|
|
|
+ if(o.dontChangePos){
|
|
|
|
+ position.copy(cameraPos);
|
|
|
|
+ }else {
|
|
|
|
+ dis = bestDistance;
|
|
|
|
+ let dir = o.direction ? o.direction.clone().negate() : this.mainViewport.view.direction.negate();//new THREE.Vector3().subVectors(camera.position, target).normalize()
|
|
|
|
+
|
|
|
|
+ position.copy(target).add(dir.multiplyScalar(dis));
|
|
|
|
+ }
|
|
/* if(o.checkIntersect){//识别被点云遮住的话
|
|
/* if(o.checkIntersect){//识别被点云遮住的话
|
|
let ifShelter
|
|
let ifShelter
|
|
|
|
|
|
@@ -127488,7 +127503,7 @@ ENDSEC
|
|
let onProgress = function ( xhr ) {
|
|
let onProgress = function ( xhr ) {
|
|
if ( xhr.lengthComputable ) {
|
|
if ( xhr.lengthComputable ) {
|
|
let percentComplete = xhr.loaded / xhr.total * 100;
|
|
let percentComplete = xhr.loaded / xhr.total * 100;
|
|
- console.log( Math.round(percentComplete, 2) + '% downloaded' );
|
|
|
|
|
|
+ //console.log( Math.round(percentComplete, 2) + '% downloaded' );
|
|
onProgress_ && onProgress_(percentComplete);
|
|
onProgress_ && onProgress_(percentComplete);
|
|
}
|
|
}
|
|
};
|
|
};
|