Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/troika-3d-ui/src/facade/UIImage3DFacade.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UIImage3DFacade extends Object3DFacade {
}

afterUpdate() {
const {offsetLeft, offsetTop, offsetWidth, offsetHeight, src, threeObject:mesh} = this
const {offsetLeft, offsetTop, offsetWidth, offsetHeight, src, threeObject:mesh, transparent} = this
const material = mesh.material
const hasLayout = !!(offsetWidth && offsetHeight)
if (hasLayout) {
Expand All @@ -36,6 +36,7 @@ class UIImage3DFacade extends Object3DFacade {
material.map.dispose()
}
material.map = texture
if (transparent) material.transparent = true;
this.aspectRatio = texture.image.width / texture.image.height
this.afterUpdate()
this.requestRender()
Expand Down
5 changes: 3 additions & 2 deletions packages/troika-3d/src/facade/World3DFacade.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WorldBaseFacade, utils } from 'troika-core'
import { WebGLRenderer, Raycaster, Color, Vector2, Vector3, LinearEncoding, NoToneMapping } from 'three'
import { WebGLRenderer, Raycaster, Color, Vector2, Vector3, LinearSRGBColorSpace, NoToneMapping } from 'three'
import Scene3DFacade from './Scene3DFacade.js'
import {PerspectiveCamera3DFacade} from './Camera3DFacade.js'
import {BoundingSphereOctree} from '../BoundingSphereOctree.js'
Expand Down Expand Up @@ -53,7 +53,8 @@ class World3DFacade extends WorldBaseFacade {
this._bgColor = backgroundColor
}

renderer.outputEncoding = this.outputEncoding || LinearEncoding
renderer.outputColorSpace = this.outputColorSpace || LinearSRGBColorSpace;
renderer.colorSpace = this.colorSpace || LinearSRGBColorSpace;
renderer.toneMapping = this.toneMapping || NoToneMapping

// Update render canvas size
Expand Down