// Useful info on THREE.Plane not covered in Three.js docs: // https://www.columbia.edu/~njn2118/journal/2019/2/18.html import {signal} from 'classy-solid' import {booleanAttribute, element, type ElementAttributes, stringAttribute} from '@lume/element' import {createEffect} from 'solid-js' import {OrthographicCamera} from 'three/src/cameras/OrthographicCamera.js' import {Element3D, type Element3DAttributes} from '../core/Element3D.js' import {autoDefineElements} from '../LumeConfig.js' import type {Fitment} from '@lume/three-projected-material/dist/ProjectedMaterial.js' import type {PerspectiveCamera} from 'three/src/cameras/PerspectiveCamera.js' export type TextureProjectorAttributes = Element3DAttributes | 'src' | 'fitment' // | 'frontFacesOnly' /** * @class TextureProjector * * Element: `` * * An non-rendered plane that can be placed anywhere in 3D space to project a * texture onto mesh elements that have `projected-material` behaviors. * * For now only one `` can be associated to a mesh, and * only with an orthographic projection (perpendicular to the plane, i.e. along * the direction the plane is facing). Later on we'll support perspective * projection and multiple projections. * * To project a texture onto a mesh element, add a * [`projected-material`](../behaviors/mesh-behaviors/ProjectedMaterialBehavior) * behavior to the element using the `has=""` attribute, then assign an array of * `` elements, or a string of comma-separated CSS * selectors, to the element's `projectedTextures` property. The equivalent * dash-case attribute accepts only the string of selectors. Only the first * texture is used, for now. * * * * * @extends Element3D */ export @element('lume-texture-projector', autoDefineElements) class TextureProjector extends Element3D { // This element is only a data and camera container, and // ProjectedMaterialBehavior reacts to the properties. // TODO selector or ref to