deyihu-maptalks.three
Advanced tools
Comparing version 0.23.0 to 0.24.0
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -111,2 +111,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
get bloom(): boolean; | ||
fire(eventType: string, param: any): this; | ||
@@ -113,0 +114,0 @@ config(): this; |
@@ -10,3 +10,4 @@ import * as THREE from 'three'; | ||
maxZoom: 30, | ||
asynchronous: false | ||
asynchronous: false, | ||
bloom: false | ||
}; | ||
@@ -377,2 +378,5 @@ /** | ||
} | ||
get bloom() { | ||
return this.getOptions().bloom; | ||
} | ||
fire(eventType, param) { | ||
@@ -379,0 +383,0 @@ this._fire(eventType, param); |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -289,2 +289,3 @@ import * as THREE from 'three'; | ||
_initRaycaster(): this; | ||
getRaycaster(): THREE.Raycaster; | ||
/** | ||
@@ -291,0 +292,0 @@ * |
@@ -738,2 +738,5 @@ // import './dist/worker'; | ||
} | ||
getRaycaster() { | ||
return this._raycaster; | ||
} | ||
/** | ||
@@ -761,2 +764,3 @@ * | ||
this._initRaycaster(); | ||
this.fire('identify', { coordinate, options }); | ||
const raycaster = this._raycaster, mouse = this._mouse, camera = this.getCamera(), scene = this.getScene(), size = this.getMap().getSize(); | ||
@@ -771,2 +775,3 @@ //fix Errors will be reported when the layer is not initialized | ||
raycaster.setFromCamera(mouse, camera); | ||
raycaster.layers.enableAll(); | ||
//set linePrecision for THREE.Line | ||
@@ -804,2 +809,3 @@ setRaycasterLinePrecision(raycaster, this._getLinePrecision(this.getMap().getResolution())); | ||
baseObject.index = intersect.index; | ||
baseObject.intersect = intersect; | ||
if (maptalks.Util.isNumber(instanceId)) { | ||
@@ -1147,8 +1153,9 @@ baseObject.instanceId = instanceId; | ||
renderScene(context) { | ||
const time = maptalks.Util.now(); | ||
// const time = maptalks.Util.now(); | ||
// Make sure to execute only once in a frame | ||
if (time - this._renderTime >= 16) { | ||
this.layer._callbackBaseObjectAnimation(); | ||
this._renderTime = time; | ||
} | ||
// if (time - this._renderTime >= 16) { | ||
// this.layer._callbackBaseObjectAnimation(); | ||
// this._renderTime = time; | ||
// } | ||
this.layer._callbackBaseObjectAnimation(); | ||
this._syncCamera(); | ||
@@ -1180,2 +1187,34 @@ // 把 WebglRenderTarget 中的 framebuffer 替换为 GroupGLLayer 中的 fbo | ||
this.context.setRenderTarget(this._renderTarget); | ||
const bloomEnable = context.bloom === 1 && context.sceneFilter; | ||
const object3ds = this.scene.children || []; | ||
//reset all object3ds layers | ||
for (let i = 0, len = object3ds.length; i < len; i++) { | ||
if (!object3ds[i] || !object3ds[i].layers) { | ||
continue; | ||
} | ||
object3ds[i].layers.set(0); | ||
} | ||
if (bloomEnable) { | ||
const sceneFilter = context.sceneFilter; | ||
//符合当前渲染帧的条件的分组到layer=1 | ||
for (let i = 0, len = object3ds.length; i < len; i++) { | ||
if (!object3ds[i] || !object3ds[i].layers) { | ||
continue; | ||
} | ||
const parent = object3ds[i]['__parent']; | ||
object3ds[i]['bloom'] = false; | ||
//判断当前ojbect3d是否开启bloom | ||
if (parent) { | ||
object3ds[i]['bloom'] = parent.bloom; | ||
} | ||
let layer = 0; | ||
//当object3d找不到parent(baseobject)时,也加入当前渲染帧,这种情况的一般都是灯光对象 | ||
//sceneFilter 用来过滤符合当前模式的meshes | ||
if (object3ds[i] && sceneFilter(object3ds[i]) || !parent) { | ||
layer = 1; | ||
} | ||
object3ds[i].layers.set(layer); | ||
} | ||
} | ||
this.camera.layers.set(bloomEnable ? 1 : 0); | ||
this.context.render(this.scene, this.camera); | ||
@@ -1182,0 +1221,0 @@ renderTargetProps[KEY_FBO] = threeCreatedFBO; |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -62,4 +62,7 @@ import * as THREE from 'three'; | ||
_setPickObject3d(): void; | ||
/** | ||
* | ||
* @param {*} baseObjects | ||
*/ | ||
isAdd: boolean; | ||
object3d: any; | ||
/** | ||
@@ -69,10 +72,15 @@ * | ||
*/ | ||
object3d: any; | ||
options: import("./type").BaseObjectOptionType; | ||
toolTip: any; | ||
infoWindow: any; | ||
_mouseover: boolean; | ||
_showPlayer: any; /** | ||
/** | ||
* | ||
* @param {*} baseObjects | ||
*/ | ||
_mouseover: boolean; /** | ||
* | ||
* @param {*} baseObjects | ||
*/ | ||
_showPlayer: any; | ||
_visible: boolean; | ||
@@ -104,7 +112,3 @@ _zoomVisible: boolean; | ||
getMap(): any; | ||
getCenter(): any; /** | ||
* show or hide monomer | ||
* @param {*} baseObject | ||
* @param {*} isHide | ||
*/ | ||
getCenter(): any; | ||
getAltitude(): number; | ||
@@ -134,2 +138,3 @@ setAltitude(altitude: number): any; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -136,0 +141,0 @@ config(): any; |
@@ -92,2 +92,3 @@ import * as THREE from 'three'; | ||
isAsynchronous(): boolean; | ||
readonly bloom: boolean; | ||
fire(eventType: string, param: any): any; | ||
@@ -94,0 +95,0 @@ config(): any; |
@@ -32,2 +32,3 @@ import * as THREE from 'three'; | ||
heightEnable?: boolean; | ||
bloom?: boolean; | ||
}; | ||
@@ -34,0 +35,0 @@ export declare type BarOptionType = BaseObjectOptionType & { |
{ | ||
"name": "deyihu-maptalks.three", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "A maptalks Layer to render with THREE.js.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3309827
33164