diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index a0c7f91ab..0492d96be 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,5 +1,6 @@ import { resolve } from 'pathe' import { defineConfig } from 'vitepress' +import components from '../component-list/components' const whitelist = ['TresCanvas', 'TresLeches', 'TresScene'] @@ -53,117 +54,7 @@ export default defineConfig({ { text: 'Examples', link: 'https://lab.tresjs.org/' }, ], - sidebar: [ - { - text: 'Guide', - items: [ - { text: 'Introduction', link: '/guide/' }, - { text: 'Migration from v3', link: '/guide/migrating-from-v3' }, - ], - }, - { - text: 'Abstractions', - items: [ - { text: 'Text3D', link: '/guide/abstractions/text-3d' }, - { text: 'Levioso (Float)', link: '/guide/abstractions/levioso' }, - { text: 'useAnimations', link: '/guide/abstractions/use-animations' }, - { text: 'MouseParallax', link: '/guide/abstractions/mouse-parallax' }, - { text: 'Lensflare', link: '/guide/abstractions/lensflare' }, - { text: 'Reflector', link: '/guide/abstractions/reflector' }, - { text: 'GlobalAudio', link: '/guide/abstractions/global-audio' }, - { text: 'Fbo', link: '/guide/abstractions/fbo' }, - { text: 'useFBO', link: '/guide/abstractions/use-fbo' }, - { text: 'useSurfaceSampler', link: '/guide/abstractions/use-surface-sampler' }, - { text: 'Sampler', link: '/guide/abstractions/sampler' }, - { text: 'AnimatedSprite', link: '/guide/abstractions/animated-sprite' }, - ], - }, - { - text: 'Controls', - items: [ - { text: 'OrbitControls', link: '/guide/controls/orbit-controls' }, - { text: 'CameraControls', link: '/guide/controls/camera-controls' }, - { text: 'TransformControls', link: '/guide/controls/transform-controls' }, - { text: 'PointerLockControls', link: '/guide/controls/pointer-lock-controls' }, - { text: 'KeyboardControls', link: '/guide/controls/keyboard-controls' }, - { text: 'ScrollControls', link: '/guide/controls/scroll-controls' }, - { text: 'MapControls', link: '/guide/controls/map-controls' }, - ], - }, - { - text: 'Loaders', - items: [ - { text: 'useProgress', link: '/guide/loaders/use-progress' }, - { text: 'useGLTF', link: '/guide/loaders/use-gltf' }, - { text: 'GLTFModel', link: '/guide/loaders/gltf-model' }, - { text: 'useFBX', link: '/guide/loaders/use-fbx' }, - { text: 'FBXModel', link: '/guide/loaders/fbx-model' }, - { text: 'useVideoTexture', link: '/guide/loaders/use-video-texture' }, - { text: 'SVG', link: '/guide/loaders/svg' }, - ], - }, - { - text: 'Materials', - collapsed: true, - items: [ - { text: 'WobbleMaterial', link: '/guide/materials/wobble-material' }, - { text: 'MeshGlassMaterial', link: '/guide/materials/glass-material' }, - { text: 'CustomShaderMaterial', link: '/guide/materials/custom-shader-material' }, - { text: 'MeshReflectionMaterial', link: '/guide/materials/mesh-reflection-material' }, - ], - }, - { - text: 'Shapes', - collapsed: true, - items: [ - { text: 'Box', link: '/guide/shapes/box' }, - { text: 'CatmullRomCurve3', link: '/guide/shapes/catmullromcurve3' }, - { text: 'Circle', link: '/guide/shapes/circle' }, - { text: 'Cone', link: '/guide/shapes/cone' }, - { text: 'Cylinder', link: '/guide/shapes/cylinder' }, - { text: 'Dodecahedron', link: '/guide/shapes/dodecahedron' }, - { text: 'Icosahedron', link: '/guide/shapes/icosahedron' }, - { text: 'Line2', link: '/guide/shapes/line2' }, - { text: 'Octahedron', link: '/guide/shapes/octahedron' }, - { text: 'Plane', link: '/guide/shapes/plane' }, - { text: 'Ring', link: '/guide/shapes/ring' }, - { text: 'RoundedBox', link: '/guide/shapes/rounded-box' }, - { text: 'Sphere', link: '/guide/shapes/sphere' }, - { text: 'Superformula', link: '/guide/shapes/superformula' }, - { text: 'Tetrahedron', link: '/guide/shapes/tetrahedron' }, - { text: 'Torus', link: '/guide/shapes/torus' }, - { text: 'TorusKnot', link: '/guide/shapes/torus-knot' }, - { text: 'Tube', link: '/guide/shapes/tube' }, - ], - }, - { - text: 'Staging', - items: [ - { text: 'Backdrop', link: '/guide/staging/backdrop' }, - { text: 'Environment', link: '/guide/staging/environment' }, - { text: 'useEnvironment', link: '/guide/staging/use-environment' }, - { text: 'Sky', link: '/guide/staging/sky' }, - { text: 'Stars', link: '/guide/staging/stars' }, - { text: 'Smoke', link: '/guide/staging/smoke' }, - { text: 'ContactShadows', link: '/guide/staging/contact-shadows' }, - { text: 'Precipitation', link: '/guide/staging/precipitation' }, - { text: 'Sparkles', link: '/guide/staging/sparkles' }, - { text: 'Ocean', link: '/guide/staging/ocean' }, - ], - }, - { - text: 'Misc', - collapsed: true, - items: [ - { text: 'Stats', link: '/guide/misc/stats' }, - { text: 'Html', link: '/guide/misc/html-component' }, - { text: 'StatsGl', link: '/guide/misc/stats-gl' }, - { text: 'useGLTFExporter', link: '/guide/misc/use-gltf-exporter' }, - { text: 'BakeShadows', link: '/guide/misc/bake-shadows' }, - ], - }, - ], - + sidebar: components, socialLinks: [ { icon: 'github', link: 'https://github.com/tresjs/cientos' }, { icon: 'twitter', link: 'https://twitter.com/tresjs_dev' }, diff --git a/docs/.vitepress/theme/components/BillboardDemo.vue b/docs/.vitepress/theme/components/BillboardDemo.vue new file mode 100644 index 000000000..079a88f29 --- /dev/null +++ b/docs/.vitepress/theme/components/BillboardDemo.vue @@ -0,0 +1,26 @@ + + + diff --git a/docs/component-list/components.ts b/docs/component-list/components.ts index ebc3cc8b7..a72793ebf 100644 --- a/docs/component-list/components.ts +++ b/docs/component-list/components.ts @@ -11,12 +11,11 @@ export default [ { text: 'GlobalAudio', link: '/guide/abstractions/global-audio' }, { text: 'Fbo', link: '/guide/abstractions/fbo' }, { text: 'useFBO', link: '/guide/abstractions/use-fbo' }, - { - text: 'useSurfaceSampler', - link: '/guide/abstractions/use-surface-sampler', - }, + { text: 'useSurfaceSampler', link: '/guide/abstractions/use-surface-sampler' }, { text: 'Sampler', link: '/guide/abstractions/sampler' }, { text: 'PositionalAudio', link: '/guide/abstractions/positional-audio' }, + { text: 'AnimatedSprite', link: '/guide/abstractions/animated-sprite' }, + { text: 'Billboard', link: '/guide/abstractions/billboard' }, ], }, { @@ -25,10 +24,7 @@ export default [ { text: 'OrbitControls', link: '/guide/controls/orbit-controls' }, { text: 'CameraControls', link: '/guide/controls/camera-controls' }, { text: 'TransformControls', link: '/guide/controls/transform-controls' }, - { - text: 'PointerLockControls', - link: '/guide/controls/pointer-lock-controls', - }, + { text: 'PointerLockControls', link: '/guide/controls/pointer-lock-controls' }, { text: 'KeyboardControls', link: '/guide/controls/keyboard-controls' }, { text: 'ScrollControls', link: '/guide/controls/scroll-controls' }, { text: 'MapControls', link: '/guide/controls/map-controls' }, @@ -48,21 +44,18 @@ export default [ }, { text: 'Materials', + collapsed: true, items: [ { text: 'WobbleMaterial', link: '/guide/materials/wobble-material' }, { text: 'MeshGlassMaterial', link: '/guide/materials/glass-material' }, - { - text: 'CustomShaderMaterial', - link: '/guide/materials/custom-shader-material', - }, - { - text: 'HolographicMaterial', - link: '/guide/materials/holographic-material', - }, + { text: 'CustomShaderMaterial', link: '/guide/materials/custom-shader-material' }, + { text: 'MeshReflectionMaterial', link: '/guide/materials/mesh-reflection-material' }, + { text: 'HolographicMaterial', link: '/guide/materials/holographic-material' }, ], }, { text: 'Shapes', + collapsed: true, items: [ { text: 'Box', link: '/guide/shapes/box' }, { text: 'CatmullRomCurve3', link: '/guide/shapes/catmullromcurve3' }, @@ -102,6 +95,7 @@ export default [ }, { text: 'Misc', + collapsed: true, items: [ { text: 'Stats', link: '/guide/misc/stats' }, { text: 'Html', link: '/guide/misc/html-component' }, @@ -112,6 +106,7 @@ export default [ }, { text: 'Directives', + collapsed: true, items: [ { text: 'v-log', link: '/guide/directives/v-log' }, { text: 'v-light-helper', link: '/guide/directives/v-light-helper' }, diff --git a/docs/guide/abstractions/billboard.md b/docs/guide/abstractions/billboard.md new file mode 100644 index 000000000..420bbd309 --- /dev/null +++ b/docs/guide/abstractions/billboard.md @@ -0,0 +1,20 @@ +# Billboard + + + + + +Adds a `THREE.Group` that faces the camera. + +## Usage + +<<< @/.vitepress/theme/components/BillboardDemo.vue + +## Props + +| Prop | Description | Default | +| :--------------- | :--------------------------------------------------- | ------------- | +| `autoUpdate` | Whether the `` should face the camera automatically on every frame. | `true` | +| `lockX` | Whether to lock the x-axis. | `false` | +| `lockY` | Whether to lock the y-axis. | `false` | +| `lockZ` | Whether to lock the z-axis. | `false` | diff --git a/playground/vue/src/pages/abstractions/BillboardDemo.vue b/playground/vue/src/pages/abstractions/BillboardDemo.vue new file mode 100644 index 000000000..5e4717669 --- /dev/null +++ b/playground/vue/src/pages/abstractions/BillboardDemo.vue @@ -0,0 +1,27 @@ + + + diff --git a/playground/vue/src/router/routes/abstractions.ts b/playground/vue/src/router/routes/abstractions.ts index 1c10a6f80..574fbdbef 100644 --- a/playground/vue/src/router/routes/abstractions.ts +++ b/playground/vue/src/router/routes/abstractions.ts @@ -59,4 +59,9 @@ export const abstractionsRoutes = [ name: 'AnimatedSprite', component: () => import('../../pages/abstractions/AnimatedSpriteDemo.vue'), }, + { + path: '/abstractions/billboard', + name: 'Billboard', + component: () => import('../../pages/abstractions/BillboardDemo.vue'), + }, ] diff --git a/src/core/abstractions/Billboard.vue b/src/core/abstractions/Billboard.vue new file mode 100644 index 000000000..ed17120d1 --- /dev/null +++ b/src/core/abstractions/Billboard.vue @@ -0,0 +1,75 @@ + + + diff --git a/src/core/abstractions/index.ts b/src/core/abstractions/index.ts index fc1e0bc52..61379fb9d 100644 --- a/src/core/abstractions/index.ts +++ b/src/core/abstractions/index.ts @@ -1,4 +1,5 @@ import AnimatedSprite from './AnimatedSprite/component.vue' +import Billboard from './Billboard.vue' import { GlobalAudio } from './GlobalAudio' import Lensflare from './Lensflare/component.vue' import Levioso from './Levioso.vue' @@ -15,6 +16,7 @@ export * from './useFBO/' export * from './useSurfaceSampler' export { AnimatedSprite, + Billboard, Fbo, GlobalAudio, Lensflare,