|
1 |
| -import { Color, WebGLRenderer } from 'three' |
2 |
| -import { shallowRef, watchEffect, onUnmounted, type MaybeRef, computed, watch, nextTick } from 'vue' |
| 1 | +import { ACESFilmicToneMapping, Color, WebGLRenderer } from 'three' |
| 2 | +import { shallowRef, watchEffect, onUnmounted, type MaybeRef, computed, watch } from 'vue' |
| 3 | + |
3 | 4 | import {
|
4 | 5 | toValue,
|
5 | 6 | unrefElement,
|
@@ -77,7 +78,7 @@ export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRen
|
77 | 78 | * CineonToneMapping, ACESFilmicToneMapping,
|
78 | 79 | * CustomToneMapping
|
79 | 80 | *
|
80 |
| - * @default NoToneMapping |
| 81 | + * @default ACESFilmicToneMapping |
81 | 82 | */
|
82 | 83 | toneMapping?: MaybeRefOrGetter<ToneMapping>
|
83 | 84 |
|
@@ -124,14 +125,12 @@ export function useRenderer(
|
124 | 125 | ) {
|
125 | 126 |
|
126 | 127 | const webGLRendererConstructorParameters = computed<WebGLRendererParameters>(() => ({
|
127 |
| - alpha: toValue(options.alpha), |
| 128 | + alpha: toValue(options.alpha) ?? true, |
128 | 129 | depth: toValue(options.depth),
|
129 | 130 | canvas: unrefElement(canvas),
|
130 | 131 | context: toValue(options.context),
|
131 | 132 | stencil: toValue(options.stencil),
|
132 |
| - antialias: toValue(options.antialias) === undefined // an opinionated default of tres |
133 |
| - ? true |
134 |
| - : toValue(options.antialias), |
| 133 | + antialias: toValue(options.antialias) ?? true, |
135 | 134 | precision: toValue(options.precision),
|
136 | 135 | powerPreference: toValue(options.powerPreference),
|
137 | 136 | premultipliedAlpha: toValue(options.premultipliedAlpha),
|
@@ -273,7 +272,7 @@ export function useRenderer(
|
273 | 272 | set(renderer.value, pathInThree, getValue(option, pathInThree))
|
274 | 273 |
|
275 | 274 | setValueOrDefault(options.shadows, 'shadowMap.enabled')
|
276 |
| - setValueOrDefault(options.toneMapping, 'toneMapping') |
| 275 | + setValueOrDefault(options.toneMapping ?? ACESFilmicToneMapping, 'toneMapping') |
277 | 276 | setValueOrDefault(options.shadowMapType, 'shadowMap.type')
|
278 | 277 |
|
279 | 278 | if (revision < 150)
|
|
0 commit comments