|
@@ -101094,7 +101094,7 @@ ENDSEC
|
|
|
pannel.find('li button[name="tag"]').on('click',(e)=>{
|
|
|
let $elem = $(e.target);
|
|
|
|
|
|
- viewer.TagTool.startInsertion();
|
|
|
+ viewer.tagTool.startInsertion();
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -102969,32 +102969,33 @@ ENDSEC
|
|
|
line: 0 ,
|
|
|
spot: 1,
|
|
|
};
|
|
|
-
|
|
|
+ const planeGeo$3 = new PlaneGeometry(1,1);
|
|
|
let texLoader$5 = new TextureLoader();
|
|
|
|
|
|
let lineMat = new LineBasicMaterial({
|
|
|
color: '#ffffff',
|
|
|
});
|
|
|
let spotMat;
|
|
|
-
|
|
|
+ const defaultLineLength = 0.6;
|
|
|
|
|
|
class Tag extends Object3D{
|
|
|
- constructor(){
|
|
|
+ constructor(o){
|
|
|
|
|
|
super();
|
|
|
|
|
|
+
|
|
|
+ this.lineLength = o.lineLength != void 0 ? o.lineLength : defaultLineLength;
|
|
|
+ this.position.copy(o.position);
|
|
|
+ this.normal = o.normal != void 0 ? o.normal : new Vector3(0,0,1);
|
|
|
+ this.root = o.root;
|
|
|
|
|
|
|
|
|
+ this.matrixAutoUpdate = false;
|
|
|
|
|
|
this.build();
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -103004,21 +103005,52 @@ ENDSEC
|
|
|
|
|
|
if(!spotMat){
|
|
|
spotMat = new MeshBasicMaterial({
|
|
|
+ transparent:true,
|
|
|
map: texLoader$5.load(Potree.resourcePath+'/textures/icon-fire.png' ),
|
|
|
});
|
|
|
}
|
|
|
+ let endPos = this.normal.clone().multiplyScalar(this.lineLength);
|
|
|
+
|
|
|
+ //this.spot = new Sprite({mat:spotMat})
|
|
|
+ this.spot = new Mesh(planeGeo$3, spotMat);
|
|
|
+ this.spot.position.copy(endPos);
|
|
|
+
|
|
|
+ this.line = LineDraw.createLine([
|
|
|
+ new Vector3(0,0,0),
|
|
|
+ endPos
|
|
|
+ ], {mat:lineMat});
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- this.spot = new Sprite$1({mat:spotMat});
|
|
|
this.titleLabel = new TextSprite({root: this.spot, text:'1'});
|
|
|
this.titleLabel.position.set(0,0,1);
|
|
|
this.add(this.spot);
|
|
|
this.add(this.line);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
viewer.scene.tags.add(this);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
+ updateMatrixWorld(){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.updateMatrix();
|
|
|
+
|
|
|
+
|
|
|
+ this.matrixWorld.multiplyMatrices( this.root.matrixWorld, this.matrix );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
class TagTool extends EventDispatcher{
|
|
@@ -103041,17 +103073,11 @@ ENDSEC
|
|
|
|
|
|
|
|
|
startInsertion (args = {}, callback, cancelFun) {
|
|
|
- let tag = new Tag({title: '1', position:new Vector3});
|
|
|
- tag.visible = false;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+
|
|
|
this.viewer.dispatchEvent({
|
|
|
- type: 'start_inserting_tag',
|
|
|
- tag
|
|
|
+ type: 'start_inserting_tag'
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|
|
@@ -103064,19 +103090,19 @@ ENDSEC
|
|
|
let click = (e)=>{
|
|
|
|
|
|
|
|
|
- var I = e.intersect && (e.intersect.orthoIntersect || e.intersect.location);
|
|
|
+ var I = e.intersect && (/* e.intersect.orthoIntersect || */e.intersect.location);
|
|
|
if(!I){
|
|
|
return
|
|
|
}
|
|
|
+ let tag = new Tag({
|
|
|
+ title: '1', position: I.clone(), normal:e.intersect.normal,
|
|
|
+ root: e.intersect.pointcloud || e.intersect.object}
|
|
|
+ );
|
|
|
|
|
|
- tag.position.copy(I);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- tag.visible = true;
|
|
|
-
|
|
|
-
|
|
|
end();
|
|
|
};
|
|
|
this.viewer.addEventListener('global_click', click);
|
|
@@ -107863,6 +107889,7 @@ ENDSEC
|
|
|
this.textureLoader = new ImageBitmapLoader( this.options.manager );
|
|
|
|
|
|
} else { */
|
|
|
+ //为了防止chrome出现报错 The source image could not be decoded. 导致reject,改用TextureLoader by xzw
|
|
|
|
|
|
this.textureLoader = new TextureLoader( this.options.manager );
|
|
|
|
|
@@ -108461,31 +108488,25 @@ ENDSEC
|
|
|
|
|
|
return new Promise( function ( resolve, reject ) {
|
|
|
|
|
|
- var onLoad = resolve;
|
|
|
+ /* var onLoad = resolve;
|
|
|
|
|
|
- if ( loader.isImageBitmapLoader === true ) {
|
|
|
-
|
|
|
- /* onLoad = function ( imageBitmap ) {
|
|
|
- //console.log('resolveURL onLoad',textureIndex )
|
|
|
- resolve( new CanvasTexture( imageBitmap ) );
|
|
|
-
|
|
|
- }; */
|
|
|
+ if ( loader.isImageBitmapLoader === true ) {
|
|
|
onLoad = function ( imageBitmap ) {
|
|
|
//console.log('resolveURL onLoad',textureIndex )
|
|
|
resolve( new CanvasTexture( imageBitmap ) );
|
|
|
|
|
|
};
|
|
|
}
|
|
|
+ */
|
|
|
|
|
|
+ //为了防止chrome出现报错 The source image could not be decoded. 导致reject,重新写贴图加载方式:
|
|
|
|
|
|
-
|
|
|
parser.textureLoader.load(sourceURI, (tex)=>{
|
|
|
tex.minFilter = THREE.LinearMipmapLinearFilter; //原本:NearestMipMapNearestFilter 闪烁
|
|
|
//tex.needsUpdate
|
|
|
resolve(tex);
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
return;
|
|
|
|
|
|
loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, (e,url)=>{
|
|
@@ -118446,7 +118467,7 @@ ENDSEC
|
|
|
const texLoader$b = new TextureLoader();
|
|
|
const arrowSpacing = 1; //间隔
|
|
|
const arrowSize = arrowSpacing * 0.5;
|
|
|
- const planeGeo$3 = new PlaneBufferGeometry(1,1);
|
|
|
+ const planeGeo$4 = new PlaneBufferGeometry(1,1);
|
|
|
|
|
|
const sphereSizeInfo = {
|
|
|
nearBound : 2, scale:arrowSize, restricMeshScale : true,
|
|
@@ -118540,7 +118561,7 @@ ENDSEC
|
|
|
|
|
|
let map = texLoader$b.load(Potree.resourcePath+'/textures/routePoint_panorama.png' );
|
|
|
map.anisotropy = 4; // 各向异性过滤 .防止倾斜模糊
|
|
|
- this.arrow = new Mesh(planeGeo$3, new MeshBasicMaterial({
|
|
|
+ this.arrow = new Mesh(planeGeo$4, new MeshBasicMaterial({
|
|
|
transparent:true,
|
|
|
depthTest:false,
|
|
|
map
|
|
@@ -118591,7 +118612,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- this.mapArrow = new Mesh( planeGeo$3, this.mapArrowMats.default);
|
|
|
+ this.mapArrow = new Mesh( planeGeo$4, this.mapArrowMats.default);
|
|
|
this.mapArrow.scale.set(arrowSize,arrowSize,arrowSize);
|
|
|
this.mapArrows = new Object3D;
|
|
|
this.mapArrows.name = 'mapArrows';
|
|
@@ -118639,7 +118660,7 @@ ENDSEC
|
|
|
|
|
|
var group = new Object3D;
|
|
|
group.name = 'pole_'+name;
|
|
|
- var shadow = new Mesh(planeGeo$3,polesMats.shadowMat);
|
|
|
+ var shadow = new Mesh(planeGeo$4,polesMats.shadowMat);
|
|
|
shadow.scale.set(shadowSize,shadowSize,shadowSize);
|
|
|
var sliceDis = height / (sphereCount+1);
|
|
|
group.add(shadow);
|
|
@@ -129597,14 +129618,14 @@ ENDSEC
|
|
|
}; */
|
|
|
|
|
|
//暂时用这种材质:
|
|
|
- //if(fileInfo.unlit && (!(child.material instanceof THREE.MeshBasicMaterial) || fileType == 'glb')){
|
|
|
+ if(fileInfo.unlit && (!(child.material instanceof MeshBasicMaterial) || fileType == 'glb')){
|
|
|
//let material = new THREE.MeshBasicMaterial({map:child.material.map})
|
|
|
let material = new BasicMaterial({map : child.material.map}); //很奇怪glb的图会使原本的MeshBasicMaterial 会偏暗,所以自己重新写
|
|
|
|
|
|
//child.material.dispose()
|
|
|
child.material = material;
|
|
|
|
|
|
- //}
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
} );
|