900c18bbcf
* feat(viewer-lib): Adding outline rendering support for all/any pipeline: - Implemented EdgesPipeline as a standalone pipeline. Can be used as is, but it's mostly used by other pipelines to add outline rendering support - Moved the MRT/non-MRT versions for edge generation inside the EdgesPipeline. This removed a lot of redundant pipelines - Added optional outline rendering support for all relevant pipelines * feat(viewer-lib): Added optional edges to the TAA pipeline. * chore(viewer-lib): Renamed some of the pipelines to be more consistent with the names given by the frontend. Cleaned up older stuff * chore(viewer-lib): ViewportPass makes sure it requests renders until matcap texture finished loading * chore(frontend-2): Updated the frontend with the new view mode type changes * feat(viewer-lib): Some updates on view modes:Added support for outline thickness and color. Removed the background texture option from edges pass * feat(viewer-lib): Handles WEB-3147: - Outlines are now displayable on top of any dom element. - There is one asterisk. Pure black colored outlines (0) do not blend properly because of some browser weirdness * feat(viewer-lib): All pipelines besides pen now draw the outlines of transparent objects with a bunch of downsides * chore(viewer-lib): Fixed sandbox errors * feat(viewer-lib): Updated ViewModes extension to work with pipeline options. Defined EdgesPipelineOptions * chore(viewer-lib): Fixed sandbox compile errors * chore(sandbox): Viewer load not object loader only * chore(viewer-lib): Fixed linting issues. are now optional when setting view modes * feat(fe): View mode menu changes with no integration * feat(fe): Frontend view mode menu integration * fix(viewer-lib): Fixed the false gradient generated at the edges of the screen when in pen mode * fix(fe): Better naming. Parse line weight to number * chore(viewer-lib): A few updates: - ViewModes now caches it's current options so it can properly determine when to do a full pipeline change and when to just update options - Default pipeline options are now exported by the viewer - Default pipeline options have edges enabled * feat(fe): Design changes. Remove unneeded watch. Fix shortcuts * feat(fe): use dark mode colours. add colour controls * fix(fe): shortcuts and colours * fix(fe): reactive defaultColor * feat(fe): New descriptions. New hex colours. * feat(fe): add mixpanel. watch darkmode * fix(fe): fix dark mode watch --------- Co-authored-by: andrewwallacespeckle <andrew@speckle.systems>
140 lines
4.4 KiB
Vue
140 lines
4.4 KiB
Vue
<template>
|
|
<ViewerMenu
|
|
v-model:open="open"
|
|
tooltip="Light controls"
|
|
:disabled="!isLightingSupported"
|
|
:disabled-tooltip="'Light controls are only available in Default and Default with Edges view modes'"
|
|
>
|
|
<template #trigger-icon>
|
|
<SunIcon class="w-5 h-5" :class="{ 'text-foreground-3': !isLightingSupported }" />
|
|
</template>
|
|
<template #title>Light controls</template>
|
|
<div class="flex flex-col gap-1.5">
|
|
<div v-if="!isLightingSupported" class="-mb-1 p-2 pb-0">
|
|
<CommonAlert size="xs" color="info">
|
|
<template #title>
|
|
<span class="block text-body-2xs">Not available in current view mode.</span>
|
|
</template>
|
|
</CommonAlert>
|
|
</div>
|
|
<div class="px-2 py-1.5 border-b border-outline flex gap-2 items-center">
|
|
<FormSwitch
|
|
v-model="sunlightShadows"
|
|
name="sunShadows"
|
|
:show-label="false"
|
|
:disabled="!isLightingSupported"
|
|
/>
|
|
<span class="text-foreground text-body-2xs">Sun shadows</span>
|
|
</div>
|
|
<div class="px-2 pb-2 pt-1 flex flex-col gap-2">
|
|
<div class="flex items-center gap-1">
|
|
<input
|
|
id="intensity"
|
|
v-model="intensity"
|
|
class="w-24 sm:w-32 h-2 mr-2"
|
|
type="range"
|
|
name="intensity"
|
|
min="1"
|
|
max="10"
|
|
step="0.05"
|
|
:disabled="!isLightingSupported"
|
|
/>
|
|
<label class="text-body-2xs" for="intensity">Intensity</label>
|
|
</div>
|
|
<div class="flex items-center gap-1">
|
|
<input
|
|
id="elevation"
|
|
v-model="elevation"
|
|
class="w-24 sm:w-32 h-2 mr-2"
|
|
type="range"
|
|
name="elevation"
|
|
min="0"
|
|
:max="Math.PI"
|
|
step="0.05"
|
|
:disabled="!isLightingSupported"
|
|
/>
|
|
<label class="text-body-2xs" for="elevation">Elevation</label>
|
|
</div>
|
|
<div class="flex items-center gap-1">
|
|
<input
|
|
id="azimuth"
|
|
v-model="azimuth"
|
|
class="w-24 sm:w-32 h-2 mr-2"
|
|
type="range"
|
|
name="azimuth"
|
|
:min="-Math.PI * 0.5"
|
|
:max="Math.PI * 0.5"
|
|
step="0.05"
|
|
:disabled="!isLightingSupported"
|
|
/>
|
|
<label class="text-body-2xs" for="azimuth">Azimuth</label>
|
|
</div>
|
|
<div class="flex items-center gap-1">
|
|
<input
|
|
id="indirect"
|
|
v-model="indirectLightIntensity"
|
|
class="w-24 sm:w-32 h-2 mr-2"
|
|
type="range"
|
|
name="indirect"
|
|
min="0"
|
|
max="5"
|
|
step="0.05"
|
|
:disabled="!isLightingSupported"
|
|
/>
|
|
<label class="text-body-2xs" for="indirect">Indirect</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ViewerMenu>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ViewMode, type SunLightConfiguration } from '@speckle/viewer'
|
|
import { SunIcon } from '@heroicons/vue/24/outline'
|
|
import { useInjectedViewerState } from '~~/lib/viewer/composables/setup'
|
|
import { useMixpanel } from '~~/lib/core/composables/mp'
|
|
import { debounce } from 'lodash-es'
|
|
import { FormSwitch } from '@speckle/ui-components'
|
|
import { useViewModeUtilities } from '~/lib/viewer/composables/ui'
|
|
import { TIME_MS } from '@speckle/shared'
|
|
|
|
const open = defineModel<boolean>('open', { required: true })
|
|
|
|
const mp = useMixpanel()
|
|
const { currentViewMode } = useViewModeUtilities()
|
|
|
|
const isLightingSupported = computed(() => {
|
|
const supported = currentViewMode.value === ViewMode.DEFAULT
|
|
return supported
|
|
})
|
|
|
|
const debounceTrackLightConfigChange = debounce(() => {
|
|
mp.track('Viewer Action', {
|
|
type: 'action',
|
|
name: 'light-config-change'
|
|
})
|
|
}, TIME_MS.second)
|
|
|
|
const createLightConfigComputed = <K extends keyof SunLightConfiguration>(key: K) =>
|
|
computed({
|
|
get: () => lightConfig.value[key],
|
|
set: (newVal) => {
|
|
lightConfig.value = {
|
|
...lightConfig.value,
|
|
[key]: newVal
|
|
}
|
|
debounceTrackLightConfigChange()
|
|
}
|
|
})
|
|
|
|
const {
|
|
ui: { lightConfig }
|
|
} = useInjectedViewerState()
|
|
|
|
const intensity = createLightConfigComputed('intensity')
|
|
const elevation = createLightConfigComputed('elevation')
|
|
const azimuth = createLightConfigComputed('azimuth')
|
|
const indirectLightIntensity = createLightConfigComputed('indirectLightIntensity')
|
|
const sunlightShadows = createLightConfigComputed('castShadow')
|
|
</script>
|