Sfoglia il codice sorgente

ContactShadowGroundPlugin setDirty fix

master
Palash Bansal 11 mesi fa
parent
commit
8a48f32364
Nessun account collegato all'indirizzo email del committer

+ 4
- 3
src/plugins/base/BaseGroundPlugin.ts Vedi File

useModelBounds = false useModelBounds = false


protected _refreshTransform() { protected _refreshTransform() {
if (!this._mesh) return
if (!this._viewer) return
if (!this._mesh) return false
if (!this._viewer) return false
let updated = false let updated = false
if (this.visible !== this._mesh.visible) { if (this.visible !== this._mesh.visible) {
this._mesh.visible = this.visible this._mesh.visible = this.visible
} }
if (this.isDisabled()) { if (this.isDisabled()) {
if (updated) this._viewer?.scene.setDirty() if (updated) this._viewer?.scene.setDirty()
return
return false
} }
if (this.autoAdjustTransform) { if (this.autoAdjustTransform) {
this._mesh.userData.bboxVisible = false this._mesh.userData.bboxVisible = false
// this._viewer.scene.setDirty() // this._viewer.scene.setDirty()
} }
this._transformNeedRefresh = false this._transformNeedRefresh = false
return true
} }





+ 5
- 4
src/plugins/extras/ContactShadowGroundPlugin.ts Vedi File



const target = getOrCall(this._depthPass.target) const target = getOrCall(this._depthPass.target)
if (!target) return if (!target) return
const blurTarget = this._viewer.renderManager.getTempTarget<IRenderTarget & WebGLRenderTarget>({ const blurTarget = this._viewer.renderManager.getTempTarget<IRenderTarget & WebGLRenderTarget>({
type: UnsignedByteType, type: UnsignedByteType,
format: RGBAFormat, format: RGBAFormat,
} }


protected _refreshTransform() { 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.position.copy(this._mesh.getWorldPosition(new Vector3()))
this.shadowCamera.setRotationFromEuler(new Euler(Math.PI / 2., 0, 0)) this.shadowCamera.setRotationFromEuler(new Euler(Math.PI / 2., 0, 0))
this._refreshShadowCameraFrustum() this._refreshShadowCameraFrustum()


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


private _refreshShadowCameraFrustum() { private _refreshShadowCameraFrustum() {

Loading…
Annulla
Salva