|
@@ -10,6 +10,7 @@ export class ViewerBase extends THREE.EventDispatcher{
|
|
|
this.name = args.name
|
|
|
this.renderArea = domElement
|
|
|
this.oldResolution = new THREE.Vector2()
|
|
|
+ this.oldResolution2 = new THREE.Vector2()
|
|
|
|
|
|
this.screenSizeInfo = {
|
|
|
W:0, H:0, pixelRatio:1 , windowWidth:0, windowHeight:0
|
|
@@ -190,18 +191,18 @@ export class ViewerBase extends THREE.EventDispatcher{
|
|
|
}
|
|
|
|
|
|
|
|
|
- /* if(!onlyForTarget){//因为onlyForTarget不传递devicePixelRatio所以不发送了
|
|
|
- this.emitResizeMsg({viewport:this.viewports[0], deviceRatio:devicePixelRatio})
|
|
|
- } */
|
|
|
+ if(!onlyForTarget){//因为onlyForTarget不传递devicePixelRatio所以不发送了
|
|
|
+ this.ifEmitResize({viewport:this.viewports[0], deviceRatio:devicePixelRatio})
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
- emitResizeMsg(e){//切换viewport渲染时就发送一次, 通知一些材质更新resolution。
|
|
|
- //if(!e.viewport.resolution.equals(this.oldResolution)||!e.viewport.resolution2.equals(this.oldResolution2)){
|
|
|
- this.dispatchEvent($.extend(e, {type:'resize'}))
|
|
|
- /* this.oldResolution.copy(e.viewport.resolution)
|
|
|
- this.oldResolution2.copy(e.viewport.resolution2) */
|
|
|
- //}
|
|
|
+ ifEmitResize(e){//切换viewport渲染时, 若这些viewport大小不同就发送一次, 通知一些材质更新resolution。
|
|
|
+ if(!e.viewport.resolution.equals(this.oldResolution)||!e.viewport.resolution2.equals(this.oldResolution2)){
|
|
|
+ this.dispatchEvent($.extend(e, {type:'resize'}))
|
|
|
+ this.oldResolution.copy(e.viewport.resolution)
|
|
|
+ this.oldResolution2.copy(e.viewport.resolution2)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -230,7 +231,7 @@ export class ViewerBase extends THREE.EventDispatcher{
|
|
|
//}
|
|
|
viewport.needRender = true //直接写这咯
|
|
|
if(changeInfo.resolutionChanged){
|
|
|
- this.emitResizeMsg({viewport})
|
|
|
+ this.dispatchEvent( {type:'resize', viewport})
|
|
|
}
|
|
|
|
|
|
}
|