|
@@ -1,5 +1,6 @@
|
|
|
-import { Color, WebGLRenderer } from 'three'
|
|
|
-import { shallowRef, watchEffect, onUnmounted, type MaybeRef, computed, watch, nextTick } from 'vue'
|
|
|
+import { ACESFilmicToneMapping, Color, WebGLRenderer } from 'three'
|
|
|
+import { shallowRef, watchEffect, onUnmounted, type MaybeRef, computed, watch } from 'vue'
|
|
|
+
|
|
|
import {
|
|
|
toValue,
|
|
|
unrefElement,
|
|
@@ -77,7 +78,7 @@ export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRen
|
|
|
* CineonToneMapping, ACESFilmicToneMapping,
|
|
|
* CustomToneMapping
|
|
|
*
|
|
|
- * @default NoToneMapping
|
|
|
+ * @default ACESFilmicToneMapping
|
|
|
*/
|
|
|
toneMapping?: MaybeRefOrGetter<ToneMapping>
|
|
|
|
|
@@ -124,14 +125,12 @@ export function useRenderer(
|
|
|
) {
|
|
|
|
|
|
const webGLRendererConstructorParameters = computed<WebGLRendererParameters>(() => ({
|
|
|
- alpha: toValue(options.alpha),
|
|
|
+ alpha: toValue(options.alpha) ?? true,
|
|
|
depth: toValue(options.depth),
|
|
|
canvas: unrefElement(canvas),
|
|
|
context: toValue(options.context),
|
|
|
stencil: toValue(options.stencil),
|
|
|
- antialias: toValue(options.antialias) === undefined // an opinionated default of tres
|
|
|
- ? true
|
|
|
- : toValue(options.antialias),
|
|
|
+ antialias: toValue(options.antialias) ?? true,
|
|
|
precision: toValue(options.precision),
|
|
|
powerPreference: toValue(options.powerPreference),
|
|
|
premultipliedAlpha: toValue(options.premultipliedAlpha),
|
|
@@ -273,7 +272,7 @@ export function useRenderer(
|
|
|
set(renderer.value, pathInThree, getValue(option, pathInThree))
|
|
|
|
|
|
setValueOrDefault(options.shadows, 'shadowMap.enabled')
|
|
|
- setValueOrDefault(options.toneMapping, 'toneMapping')
|
|
|
+ setValueOrDefault(options.toneMapping ?? ACESFilmicToneMapping, 'toneMapping')
|
|
|
setValueOrDefault(options.shadowMapType, 'shadowMap.type')
|
|
|
|
|
|
if (revision < 150)
|