Explorar el Código

ContactShadowGroundPlugin setDirty fix

master
Palash Bansal hace 11 meses
padre
commit
8a48f32364
No account linked to committer's email address

+ 4
- 3
src/plugins/base/BaseGroundPlugin.ts Ver fichero

@@ -182,8 +182,8 @@ export class BaseGroundPlugin<TE extends AViewerPluginEventMap = AViewerPluginEv
useModelBounds = false

protected _refreshTransform() {
if (!this._mesh) return
if (!this._viewer) return
if (!this._mesh) return false
if (!this._viewer) return false
let updated = false
if (this.visible !== this._mesh.visible) {
this._mesh.visible = this.visible
@@ -191,7 +191,7 @@ export class BaseGroundPlugin<TE extends AViewerPluginEventMap = AViewerPluginEv
}
if (this.isDisabled()) {
if (updated) this._viewer?.scene.setDirty()
return
return false
}
if (this.autoAdjustTransform) {
this._mesh.userData.bboxVisible = false
@@ -221,6 +221,7 @@ export class BaseGroundPlugin<TE extends AViewerPluginEventMap = AViewerPluginEv
// this._viewer.scene.setDirty()
}
this._transformNeedRefresh = false
return true
}



+ 5
- 4
src/plugins/extras/ContactShadowGroundPlugin.ts Ver fichero

@@ -118,7 +118,7 @@ export class ContactShadowGroundPlugin extends BaseGroundPlugin {

const target = getOrCall(this._depthPass.target)
if (!target) return
const blurTarget = this._viewer.renderManager.getTempTarget<IRenderTarget & WebGLRenderTarget>({
type: UnsignedByteType,
format: RGBAFormat,
@@ -136,10 +136,10 @@ export class ContactShadowGroundPlugin extends BaseGroundPlugin {
}

protected _refreshTransform() {
super._refreshTransform()
if (!super._refreshTransform()) return false

if (!this._mesh) return
if (!this._viewer) return
if (!this._mesh) return false
if (!this._viewer) return false

this.shadowCamera.position.copy(this._mesh.getWorldPosition(new Vector3()))
this.shadowCamera.setRotationFromEuler(new Euler(Math.PI / 2., 0, 0))
@@ -147,6 +147,7 @@ export class ContactShadowGroundPlugin extends BaseGroundPlugin {
this._refreshShadowCameraFrustum()

this._mesh.scale.y = -this.size
return true
}

private _refreshShadowCameraFrustum() {

Cargando…
Cancelar
Guardar