diff --git a/apps/cientos-docs-vitepress/guide/abstractions/edges.md b/apps/cientos-docs-vitepress/guide/abstractions/edges.md index 26ae86f01..fac2bdf9f 100644 --- a/apps/cientos-docs-vitepress/guide/abstractions/edges.md +++ b/apps/cientos-docs-vitepress/guide/abstractions/edges.md @@ -42,21 +42,3 @@ import { Box, Edges } from '@tresjs/cientos' | :---------------- | :--------------------------------------------------- | ------------------------- | | **color** | `THREE.Color` — Color of the edges.
More informations : [TresColor](https://docs.tresjs.org/api/instances-arguments-and-props.html#colors) — [THREE.Color](https://threejs.org/docs/#api/en/math/Color) | `#ff0000` | | **threshold** | `number` — An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value | `1` | - -## Exposed properties - -| Event | Description | -| :---------- | :--------------------------------------------------------------- | -| `instance` | Instance reference — Inheritance of [LineSegments](https://threejs.org/docs/#api/en/objects/LineSegments).| - -```typescript{1} -const edgesRef = shallowRef(null) - -console.log(edgesRef.value.instance) // instance properties -``` - -```vue{2} - -``` diff --git a/apps/cientos-docs/.data/content/contents.sqlite b/apps/cientos-docs/.data/content/contents.sqlite index 25c49c660..2bf06fb58 100644 Binary files a/apps/cientos-docs/.data/content/contents.sqlite and b/apps/cientos-docs/.data/content/contents.sqlite differ diff --git a/apps/cientos-docs/.editorconfig b/apps/cientos-docs/.editorconfig new file mode 100644 index 000000000..00ab93732 --- /dev/null +++ b/apps/cientos-docs/.editorconfig @@ -0,0 +1,11 @@ +# EditorConfig is awesome: https://EditorConfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/apps/cientos-docs/.gitignore b/apps/cientos-docs/.gitignore new file mode 100644 index 000000000..4a7f73a2e --- /dev/null +++ b/apps/cientos-docs/.gitignore @@ -0,0 +1,24 @@ +# Nuxt dev/build outputs +.output +.data +.nuxt +.nitro +.cache +dist + +# Node dependencies +node_modules + +# Logs +logs +*.log + +# Misc +.DS_Store +.fleet +.idea + +# Local env files +.env +.env.* +!.env.example diff --git a/apps/cientos-docs/.npmrc b/apps/cientos-docs/.npmrc new file mode 100644 index 000000000..bf2e7648b --- /dev/null +++ b/apps/cientos-docs/.npmrc @@ -0,0 +1 @@ +shamefully-hoist=true diff --git a/apps/cientos-docs/CLAUDE.md b/apps/cientos-docs/CLAUDE.md new file mode 100644 index 000000000..7398be60e --- /dev/null +++ b/apps/cientos-docs/CLAUDE.md @@ -0,0 +1,281 @@ +# Cientos docs - CLAUDE.md + +This is a documentation app built with Nuxt v4 and Nuxt UI v4. It serves as a reference implementation for creating new documentation sites in the TresJS ecosystem. + +## Overview + +This docs provides a complete setup for creating documentation sites with: + +- Nuxt v4 with compatibility mode enabled +- Nuxt UI v4 for beautiful, accessible components +- Nuxt Content for markdown-based content +- TresJS integration for 3D examples +- Full-text search functionality +- Dark mode support +- SEO optimization + +## Architecture + +### App Structure + +``` +app/ +├── app.config.ts # UI theme and app configuration +├── app.vue # Root application component +├── error.vue # Error page component +├── assets/css/ # Global styles +├── components/ # Vue components +│ ├── content/ # MDC prose components +│ └── diagrams/ # Custom diagram components +├── composables/ # Composable functions (useNavigation) +├── layouts/ # Page layouts (docs.vue) +├── pages/ # Route pages +│ ├── index.vue # Landing page +│ └── [...slug].vue # Dynamic docs pages +└── utils/ # Utility functions +``` + +### Content Structure + +Content is organized in numbered directories for ordering: + +``` +content/ +├── index.md # Landing page content +├── 1.getting-started/ # Getting started section +├── 2.guide/ # Guide section +└── 3.api/ # API reference section +``` + +## Key Features + +### Nuxt UI v4 + +- Uses Nuxt UI v4 components (`UApp`, `UPage`, `UMain`, etc.) +- Custom theme configuration in `app.config.ts` +- Teal color scheme as primary +- Custom CSS variables for patterns and gradients + +### Nuxt Content + +- Markdown with MDC (Markdown Components) syntax +- Collection-based content management +- Automatic table of contents generation +- Search integration + +### TresJS Integration + +- Vue template compiler options configured for TresJS +- Support for 3D scene components +- Ready for interactive 3D examples + +### SEO & Meta + +- Configured SEO meta tags +- Open Graph and Twitter card support +- Dynamic titles and descriptions +- Sitemap generation ready + +## Configuration + +### Theme Customization + +Edit `app/app.config.ts` to customize: + +``` +ui: { + colors: { + primary: 'teal', // Change primary color + neutral: 'zinc' // Change neutral color + }, +} +``` + +### Navigation + +Edit `app/composables/useNavigation.ts` to modify header navigation links. + +### Content Collections + +Content is organized using Nuxt Content collections defined in `content.config.ts`: + +- `landing` - Landing page (index.md) +- `docs` - All documentation pages + +### LLM Documentation + +The `nuxt-llms` module is configured to generate LLM-friendly documentation at `/llms.txt` and `/llms-full.txt`. + +## Components + +### Layout Components + +- **AppHeader** - Site header with navigation, search, and color mode toggle +- **AppFooter** - Footer with links and copyright +- **AppSide** - Sidebar navigation for docs layout + +### Content Components + +- **ProseA** - Enhanced anchor links in markdown content + +### Diagram Components + +Custom SVG diagram components for technical documentation. + +## Development + +### Prerequisites + +- Node.js 18+ +- pnpm package manager + +### Commands + +```bash +# Install dependencies +pnpm install + +# Development server +pnpm dev + +# Build for production +pnpm build + +# Preview production build +pnpm preview + +# Lint code +pnpm lint + +# Type checking +pnpm typecheck +``` + +## Styling + +### CSS Architecture + +- **Tailwind CSS v4** via `@import 'tailwindcss'` +- **Nuxt UI** styles via `@import '@nuxt/ui'` +- Custom theme variables in `main.css` +- Pattern backgrounds (`.pattern-bg`, `.pattern-dot-bg`) + +### Color Palette + +Two custom color palettes are defined: + +- **Teal** (50-950) - Primary brand color +- **Yellow/Brown** (50-950) - Accent color + +### Dark Mode + +Automatic dark mode with theme-aware pattern backgrounds and custom favicon switching. + +## Content Writing + +### Markdown Format + +```md +--- +title: Page Title +description: Page description for SEO +--- + +# Heading + +Content here with **bold** and *italic* text. + +::callout +Custom MDC component +:: +``` + +### MDC Components + +Use Vue components directly in markdown: + +```md +::block-hero +--- +cta: + - Get started + - /getting-started +--- + +#title +Hero Title + +#description +Hero description +:: +``` + +## Deployment + +### Static Site Generation + +Configured for static site generation with Nitro prerendering: + +``` +nitro: { + prerender: { + routes: ['/'], + crawlLinks: true, + }, +} +``` + +### Environment Variables + +Create `.env` file for environment-specific configuration (use `.env.example` as reference). + +## Best Practices + +1. **Content Organization** - Use numbered prefixes for ordering +2. **Component Naming** - Use PascalCase for components +3. **MDC Syntax** - Leverage MDC for rich content +4. **Accessibility** - All UI components are accessible by default +5. **Performance** - Images are optimized via @nuxt/image +6. **SEO** - Always include title and description frontmatter + +## Extending the Boilerplate + +### Adding New Sections + +1. Create new directory in `content/` +2. Add index page with navigation +3. Update `useNavigation.ts` if needed +4. Update `llms` configuration in `nuxt.config.ts` + +### Custom Components + +1. Add components in `app/components/` +2. MDC components go in `app/components/content/` +3. Auto-imported by Nuxt + +### Styling Customization + +1. Update theme variables in `app.config.ts` +2. Add custom CSS in `app/assets/css/main.css` +3. Use Tailwind utilities for component styles + +## Troubleshooting + +### Build Issues + +- Ensure Node.js 18+ is installed +- Clear `.nuxt` and `node_modules`, reinstall +- Check `pnpm-workspace.yaml` includes `apps/*` + +### Content Not Rendering + +- Check frontmatter syntax +- Verify collection configuration in `content.config.ts` +- Ensure files use `.md` extension + +## Resources + +- [Nuxt Documentation](https://nuxt.com) +- [Nuxt UI Documentation](https://ui.nuxt.com) +- [Nuxt Content Documentation](https://content.nuxt.com) +- [TresJS Documentation](https://docs.tresjs.org) diff --git a/apps/cientos-docs/README.md b/apps/cientos-docs/README.md new file mode 100644 index 000000000..e1fb321c8 --- /dev/null +++ b/apps/cientos-docs/README.md @@ -0,0 +1,120 @@ +# Cientos docs + +A modern documentation site built with Nuxt v4 and Nuxt UI v4. + +## Features + +- 🚀 **Nuxt v4** - Latest Nuxt framework with improved performance +- 🎨 **Nuxt UI v4** - Beautiful, accessible UI components +- 📝 **Nuxt Content** - File-based CMS for markdown content +- 🔍 **Full-text Search** - Built-in search functionality +- 🌙 **Dark Mode** - Automatic dark mode support +- 📱 **Responsive** - Mobile-first responsive design +- ⚡ **Fast** - Optimized for performance +- 🎯 **SEO Optimized** - Built-in SEO best practices + +## Project Structure + +``` +apps/cientos-docs/ +├── app/ # Nuxt app directory +│ ├── assets/ # Styles and static assets +│ ├── components/ # Vue components +│ │ ├── content/ # MDC components +│ │ └── diagrams/ # Diagram components +│ ├── composables/ # Composable functions +│ ├── layouts/ # Page layouts +│ ├── pages/ # Route pages +│ └── utils/ # Utility functions +├── content/ # Markdown content +│ ├── 1.getting-started/ # Getting started docs +│ ├── 2.guide/ # Guide section +│ └── 3.api/ # API reference +├── public/ # Public static files +└── nuxt.config.ts # Nuxt configuration +``` + +## Getting Started + +### Prerequisites + +- Node.js 24+ +- pnpm package manager + +### Installation + +Install dependencies: + +```bash +pnpm install --frozen-lockfile +``` + +### Development + +Start the development server: + +```bash +pnpm dev +``` + +The site will be available at `http://localhost:3000`. + +### Build + +Build for production: + +```bash +pnpm build +``` + +### Preview + +Preview the production build: + +```bash +pnpm preview +``` + +## Content + +Content is written in Markdown with MDC (Markdown Components) syntax support. Add your content files in the `content/` directory. + +### Content Structure + +- `content/index.md` - Landing page +- `content/1.getting-started/` - Getting started section +- `content/2.guide/` - Guide section +- `content/3.api/` - API reference section + +## Configuration + +### App Configuration + +Edit `app/app.config.ts` to customize: + +- UI theme colors +- Header links +- Footer links +- SEO metadata + +### Nuxt Configuration + +Edit `nuxt.config.ts` to configure: + +- Nuxt modules +- Build settings +- Runtime config +- SEO settings + +## Components + +The site includes several pre-built components: + +- **AppHeader** - Site header with navigation +- **AppFooter** - Site footer with links +- **AppSide** - Sidebar navigation +- **ProseA** - Enhanced link component for content + +## License + +MIT diff --git a/apps/cientos-docs/app/app.config.ts b/apps/cientos-docs/app/app.config.ts new file mode 100644 index 000000000..73a65ba4f --- /dev/null +++ b/apps/cientos-docs/app/app.config.ts @@ -0,0 +1,89 @@ +import type { AppConfigInput } from 'nuxt/schema' + +const newLocal = { + ui: { + colors: { + primary: 'yellow', + neutral: 'zinc', + }, + card: { + slots: { + root: 'hover:bg-linear-[115deg,#272727 .06%,#171717]', + body: 'p-2 sm:p-3', + }, + }, + footer: { + slots: { + root: 'border-t border-default', + left: 'text-sm text-muted', + }, + }, + }, + seo: { + siteName: 'Cientos docs', + }, + header: { + title: '', + to: '/', + logo: { + alt: '', + light: '', + dark: '', + }, + search: true, + colorMode: true, + links: [ + { + icon: 'i-simple-icons-github', + to: 'https://github.com/tresjs/tres', + target: '_blank', + ariaLabel: 'GitHub', + }, + ], + }, + footer: { + credits: `Copyright © ${new Date().getFullYear()}`, + colorMode: false, + links: [{ + 'icon': 'i-lucide-globe', + 'to': 'https://tresjs.org', + 'target': '_blank', + 'aria-label': 'TresJS Website', + }, { + 'icon': 'i-simple-icons-discord', + 'to': 'https://tresjs.org/discord', + 'target': '_blank', + 'aria-label': 'TresJS on Discord', + }, { + 'icon': 'i-simple-icons-x', + 'to': 'https://x.com/tresjs_dev', + 'target': '_blank', + 'aria-label': 'TresJS on X', + }, { + 'icon': 'i-simple-icons-github', + 'to': 'https://github.com/tresjs/tres', + 'target': '_blank', + 'aria-label': 'TresJS on GitHub', + }], + }, + toc: { + title: 'Table of Contents', + bottom: { + title: 'Community', + edit: 'https://github.com/edit/main/docs/content', + links: [{ + icon: 'i-lucide-heart', + label: 'Become a sponsor', + to: 'https://github.com/sponsors/tresjs', + target: '_blank', + }, { + icon: 'i-lucide-star', + label: 'Star on GitHub', + to: 'https://github.com/tresjs/tres', + target: '_blank', + }], + }, + }, +} satisfies AppConfigInput + +export default defineAppConfig(newLocal) diff --git a/apps/cientos-docs/app/app.vue b/apps/cientos-docs/app/app.vue new file mode 100644 index 000000000..b68064b03 --- /dev/null +++ b/apps/cientos-docs/app/app.vue @@ -0,0 +1,56 @@ + + + diff --git a/apps/cientos-docs/app/assets/css/main.css b/apps/cientos-docs/app/assets/css/main.css new file mode 100644 index 000000000..a74e3b22a --- /dev/null +++ b/apps/cientos-docs/app/assets/css/main.css @@ -0,0 +1,70 @@ +@import 'tailwindcss'; +@import '@nuxt/ui'; + +@source "../../../content/**/*"; + +@theme static { + --font-display: 'Manrope', sans-serif; + --font-sans: 'Inter', sans-serif; + --font-mono: 'JetBrains Mono', monospace; + --breakpoint-3xl: 1920px; + --ui-pattern-fg: color-mix(in oklab, var(--ui-text) 5%, transparent); + --ui-pattern-bg: repeating-linear-gradient( + 315deg, + var(--ui-pattern-fg) 0, + var(--ui-pattern-fg) 1px, + transparent 0, + transparent 50% + ); + --ui-pattern-dot-fg: color-mix(in oklab, oklch(0.18 0.04 266.75) 5%, transparent); + --ui-pattern-dot-bg: radial-gradient(var(--ui-pattern-dot-fg) 1px, transparent 0); + --ui-header-height: 3rem; + /* Technical blueprint styles */ + --ui-line-gap: 5px; + --ui-line-width: 1px; + --ui-line-offset: 172px; + --ui-line-color: var(--color-gray-200); + + /* Teal Palette */ + --color-teal-50: #f2fbf8; + --color-teal-100: #d3f4ea; + --color-teal-200: #a6e9d6; + --color-teal-300: #82dbc5; + --color-teal-400: #44bda2; + --color-teal-500: #2ba189; + --color-teal-600: #20816f; + --color-teal-700: #1d685b; + --color-teal-800: #1c534b; + --color-teal-900: #1b463f; + --color-teal-950: #0a2925; + + /* Yellow/Brown Palette */ + --color-yellow-50: #fff8eb; + --color-yellow-100: #feeac7; + --color-yellow-200: #fdd48a; + --color-yellow-300: #fbb03b; + --color-yellow-400: #fa9e25; + --color-yellow-500: #f47a0c; + --color-yellow-600: #b85607; + --color-yellow-700: #b3390a; + --color-yellow-800: #922b0e; + --color-yellow-900: #78250f; + --color-yellow-950: #451003; +} + +.dark { + --ui-line-color: var(--color-gray-800); + --ui-pattern-dot-fg: color-mix(in oklab, var(--color-gray-200) 5%, transparent); +} + +.pattern-bg { + background-image: var(--ui-pattern-bg); + background-size: 10px 10px; + background-attachment: fixed; +} + +.pattern-dot-bg { + background-image: var(--ui-pattern-dot-bg); + background-size: 10px 10px; + background-attachment: fixed; +} diff --git a/apps/cientos-docs/app/components/ApiList.vue b/apps/cientos-docs/app/components/ApiList.vue new file mode 100644 index 000000000..d093e0c3f --- /dev/null +++ b/apps/cientos-docs/app/components/ApiList.vue @@ -0,0 +1,23 @@ + + + diff --git a/apps/cientos-docs/app/components/AppFooter.vue b/apps/cientos-docs/app/components/AppFooter.vue new file mode 100644 index 000000000..a13a72945 --- /dev/null +++ b/apps/cientos-docs/app/components/AppFooter.vue @@ -0,0 +1,25 @@ + + + diff --git a/apps/cientos-docs/app/components/AppHeader.vue b/apps/cientos-docs/app/components/AppHeader.vue new file mode 100644 index 000000000..813e4aee7 --- /dev/null +++ b/apps/cientos-docs/app/components/AppHeader.vue @@ -0,0 +1,106 @@ + + + diff --git a/apps/cientos-docs/app/components/AppSide.vue b/apps/cientos-docs/app/components/AppSide.vue new file mode 100644 index 000000000..937a93aba --- /dev/null +++ b/apps/cientos-docs/app/components/AppSide.vue @@ -0,0 +1,32 @@ + + + diff --git a/apps/cientos-docs/app/components/DottedDiagram.vue b/apps/cientos-docs/app/components/DottedDiagram.vue new file mode 100644 index 000000000..7b7b50774 --- /dev/null +++ b/apps/cientos-docs/app/components/DottedDiagram.vue @@ -0,0 +1,9 @@ + + + diff --git a/apps/cientos-docs/app/components/GithubMagicLink.vue b/apps/cientos-docs/app/components/GithubMagicLink.vue new file mode 100644 index 000000000..578735408 --- /dev/null +++ b/apps/cientos-docs/app/components/GithubMagicLink.vue @@ -0,0 +1,182 @@ + + + diff --git a/apps/cientos-docs/app/components/HomeScene.vue b/apps/cientos-docs/app/components/HomeScene.vue new file mode 100644 index 000000000..8355b1e2a --- /dev/null +++ b/apps/cientos-docs/app/components/HomeScene.vue @@ -0,0 +1,20 @@ + + + diff --git a/apps/cientos-docs/app/components/IntroScene.vue b/apps/cientos-docs/app/components/IntroScene.vue new file mode 100644 index 000000000..84a68a50c --- /dev/null +++ b/apps/cientos-docs/app/components/IntroScene.vue @@ -0,0 +1,63 @@ + + + diff --git a/apps/cientos-docs/app/components/ReadMore.vue b/apps/cientos-docs/app/components/ReadMore.vue new file mode 100644 index 000000000..eb0feb818 --- /dev/null +++ b/apps/cientos-docs/app/components/ReadMore.vue @@ -0,0 +1,41 @@ + + + diff --git a/apps/cientos-docs/app/components/RecipesList.vue b/apps/cientos-docs/app/components/RecipesList.vue new file mode 100644 index 000000000..9ea8fb4fb --- /dev/null +++ b/apps/cientos-docs/app/components/RecipesList.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/SceneControlsWrapper.vue b/apps/cientos-docs/app/components/SceneControlsWrapper.vue new file mode 100644 index 000000000..8f4a419f5 --- /dev/null +++ b/apps/cientos-docs/app/components/SceneControlsWrapper.vue @@ -0,0 +1,20 @@ + + + diff --git a/apps/cientos-docs/app/components/SceneWrapper.vue b/apps/cientos-docs/app/components/SceneWrapper.vue new file mode 100644 index 000000000..0a6af07d9 --- /dev/null +++ b/apps/cientos-docs/app/components/SceneWrapper.vue @@ -0,0 +1,13 @@ + + + diff --git a/apps/cientos-docs/app/components/TheGraph.vue b/apps/cientos-docs/app/components/TheGraph.vue new file mode 100644 index 000000000..864c6da6d --- /dev/null +++ b/apps/cientos-docs/app/components/TheGraph.vue @@ -0,0 +1,336 @@ + + + + + diff --git a/apps/cientos-docs/app/components/TheLogo.vue b/apps/cientos-docs/app/components/TheLogo.vue new file mode 100644 index 000000000..6c7b7930b --- /dev/null +++ b/apps/cientos-docs/app/components/TheLogo.vue @@ -0,0 +1,14 @@ + diff --git a/apps/cientos-docs/app/components/abstractions/Align.vue b/apps/cientos-docs/app/components/abstractions/Align.vue new file mode 100644 index 000000000..7c7141d38 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Align.vue @@ -0,0 +1,32 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Billboard.vue b/apps/cientos-docs/app/components/abstractions/Billboard.vue new file mode 100644 index 000000000..3256e6e9d --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Billboard.vue @@ -0,0 +1,35 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/CameraShake.vue b/apps/cientos-docs/app/components/abstractions/CameraShake.vue new file mode 100644 index 000000000..a6751ae57 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/CameraShake.vue @@ -0,0 +1,55 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Edges.vue b/apps/cientos-docs/app/components/abstractions/Edges.vue new file mode 100644 index 000000000..3b17f60bc --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Edges.vue @@ -0,0 +1,36 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Fit.vue b/apps/cientos-docs/app/components/abstractions/Fit.vue new file mode 100644 index 000000000..86d42fb77 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Fit.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Levioso.vue b/apps/cientos-docs/app/components/abstractions/Levioso.vue new file mode 100644 index 000000000..0cf501700 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Levioso.vue @@ -0,0 +1,43 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Mask.vue b/apps/cientos-docs/app/components/abstractions/Mask.vue new file mode 100644 index 000000000..5a0f791dd --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Mask.vue @@ -0,0 +1,44 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Outline.vue b/apps/cientos-docs/app/components/abstractions/Outline.vue new file mode 100644 index 000000000..8acc35a41 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Outline.vue @@ -0,0 +1,35 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/Sampler.vue b/apps/cientos-docs/app/components/abstractions/Sampler.vue new file mode 100644 index 000000000..4ac5b6bb3 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/Sampler.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/ScreenSizer.vue b/apps/cientos-docs/app/components/abstractions/ScreenSizer.vue new file mode 100644 index 000000000..b481e0087 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/ScreenSizer.vue @@ -0,0 +1,22 @@ + + + diff --git a/apps/cientos-docs/app/components/abstractions/ScreenSpace.vue b/apps/cientos-docs/app/components/abstractions/ScreenSpace.vue new file mode 100644 index 000000000..ca8d09884 --- /dev/null +++ b/apps/cientos-docs/app/components/abstractions/ScreenSpace.vue @@ -0,0 +1,58 @@ + + + diff --git a/apps/cientos-docs/app/components/content/ProseA.vue b/apps/cientos-docs/app/components/content/ProseA.vue new file mode 100644 index 000000000..c68e17602 --- /dev/null +++ b/apps/cientos-docs/app/components/content/ProseA.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/CameraControls.vue b/apps/cientos-docs/app/components/controls/CameraControls.vue new file mode 100644 index 000000000..cb5328ed2 --- /dev/null +++ b/apps/cientos-docs/app/components/controls/CameraControls.vue @@ -0,0 +1,51 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/KeyboardControls.vue b/apps/cientos-docs/app/components/controls/KeyboardControls.vue new file mode 100644 index 000000000..bb7021b49 --- /dev/null +++ b/apps/cientos-docs/app/components/controls/KeyboardControls.vue @@ -0,0 +1,24 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/MapControls.vue b/apps/cientos-docs/app/components/controls/MapControls.vue new file mode 100644 index 000000000..806cdc00b --- /dev/null +++ b/apps/cientos-docs/app/components/controls/MapControls.vue @@ -0,0 +1,58 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/OrbitControls.vue b/apps/cientos-docs/app/components/controls/OrbitControls.vue new file mode 100644 index 000000000..3452d5969 --- /dev/null +++ b/apps/cientos-docs/app/components/controls/OrbitControls.vue @@ -0,0 +1,58 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/PointerLockControls.vue b/apps/cientos-docs/app/components/controls/PointerLockControls.vue new file mode 100644 index 000000000..7373329e8 --- /dev/null +++ b/apps/cientos-docs/app/components/controls/PointerLockControls.vue @@ -0,0 +1,29 @@ + + + diff --git a/apps/cientos-docs/app/components/controls/TransformControls.vue b/apps/cientos-docs/app/components/controls/TransformControls.vue new file mode 100644 index 000000000..9f7ea75e6 --- /dev/null +++ b/apps/cientos-docs/app/components/controls/TransformControls.vue @@ -0,0 +1,89 @@ + + + diff --git a/apps/cientos-docs/app/components/debug-performance/Helper.vue b/apps/cientos-docs/app/components/debug-performance/Helper.vue new file mode 100644 index 000000000..d6889d183 --- /dev/null +++ b/apps/cientos-docs/app/components/debug-performance/Helper.vue @@ -0,0 +1,18 @@ + + + diff --git a/apps/cientos-docs/app/components/debug-performance/Lod.vue b/apps/cientos-docs/app/components/debug-performance/Lod.vue new file mode 100644 index 000000000..65bb41315 --- /dev/null +++ b/apps/cientos-docs/app/components/debug-performance/Lod.vue @@ -0,0 +1,62 @@ + + + diff --git a/apps/cientos-docs/app/components/diagrams/RenderLoop.vue b/apps/cientos-docs/app/components/diagrams/RenderLoop.vue new file mode 100644 index 000000000..d2184a246 --- /dev/null +++ b/apps/cientos-docs/app/components/diagrams/RenderLoop.vue @@ -0,0 +1,611 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/AccumulativeShadows.vue b/apps/cientos-docs/app/components/light-shadow/AccumulativeShadows.vue new file mode 100644 index 000000000..5d1f94b95 --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/AccumulativeShadows.vue @@ -0,0 +1,47 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/BakeShadows.vue b/apps/cientos-docs/app/components/light-shadow/BakeShadows.vue new file mode 100644 index 000000000..fa82834e1 --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/BakeShadows.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/CircleShadow.vue b/apps/cientos-docs/app/components/light-shadow/CircleShadow.vue new file mode 100644 index 000000000..a67c8e42f --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/CircleShadow.vue @@ -0,0 +1,29 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/ContactShadow.vue b/apps/cientos-docs/app/components/light-shadow/ContactShadow.vue new file mode 100644 index 000000000..1b2204e2b --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/ContactShadow.vue @@ -0,0 +1,45 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/Lensflare.vue b/apps/cientos-docs/app/components/light-shadow/Lensflare.vue new file mode 100644 index 000000000..0cd75109a --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/Lensflare.vue @@ -0,0 +1,48 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/RandomizedLights.vue b/apps/cientos-docs/app/components/light-shadow/RandomizedLights.vue new file mode 100644 index 000000000..35b78b742 --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/RandomizedLights.vue @@ -0,0 +1,35 @@ + + + diff --git a/apps/cientos-docs/app/components/light-shadow/SoftShadows.vue b/apps/cientos-docs/app/components/light-shadow/SoftShadows.vue new file mode 100644 index 000000000..422b176f6 --- /dev/null +++ b/apps/cientos-docs/app/components/light-shadow/SoftShadows.vue @@ -0,0 +1,29 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/fbx.vue b/apps/cientos-docs/app/components/loaders/fbx.vue new file mode 100644 index 000000000..332cb0c8b --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/fbx.vue @@ -0,0 +1,42 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/gltf.vue b/apps/cientos-docs/app/components/loaders/gltf.vue new file mode 100644 index 000000000..5229af450 --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/gltf.vue @@ -0,0 +1,17 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/useSvg.vue b/apps/cientos-docs/app/components/loaders/useSvg.vue new file mode 100644 index 000000000..1bee9d615 --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/useSvg.vue @@ -0,0 +1,21 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/useTexture.vue b/apps/cientos-docs/app/components/loaders/useTexture.vue new file mode 100644 index 000000000..39fa68031 --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/useTexture.vue @@ -0,0 +1,19 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/useTextures.vue b/apps/cientos-docs/app/components/loaders/useTextures.vue new file mode 100644 index 000000000..df9f8f8e9 --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/useTextures.vue @@ -0,0 +1,82 @@ + + + diff --git a/apps/cientos-docs/app/components/loaders/useVideoTexture.vue b/apps/cientos-docs/app/components/loaders/useVideoTexture.vue new file mode 100644 index 000000000..624271dbc --- /dev/null +++ b/apps/cientos-docs/app/components/loaders/useVideoTexture.vue @@ -0,0 +1,25 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/CustomShaderMaterial.vue b/apps/cientos-docs/app/components/materials/CustomShaderMaterial.vue new file mode 100644 index 000000000..bb95450b5 --- /dev/null +++ b/apps/cientos-docs/app/components/materials/CustomShaderMaterial.vue @@ -0,0 +1,59 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/GlassMaterial.vue b/apps/cientos-docs/app/components/materials/GlassMaterial.vue new file mode 100644 index 000000000..e6ab60da8 --- /dev/null +++ b/apps/cientos-docs/app/components/materials/GlassMaterial.vue @@ -0,0 +1,21 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/HolographicMaterial.vue b/apps/cientos-docs/app/components/materials/HolographicMaterial.vue new file mode 100644 index 000000000..7ed5c1320 --- /dev/null +++ b/apps/cientos-docs/app/components/materials/HolographicMaterial.vue @@ -0,0 +1,40 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/MeshReflectionMaterial.vue b/apps/cientos-docs/app/components/materials/MeshReflectionMaterial.vue new file mode 100644 index 000000000..cbee4a2de --- /dev/null +++ b/apps/cientos-docs/app/components/materials/MeshReflectionMaterial.vue @@ -0,0 +1,56 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/PointMaterial.vue b/apps/cientos-docs/app/components/materials/PointMaterial.vue new file mode 100644 index 000000000..e96eaa7e0 --- /dev/null +++ b/apps/cientos-docs/app/components/materials/PointMaterial.vue @@ -0,0 +1,16 @@ + + + diff --git a/apps/cientos-docs/app/components/materials/WobbleMaterial.vue b/apps/cientos-docs/app/components/materials/WobbleMaterial.vue new file mode 100644 index 000000000..fffc67893 --- /dev/null +++ b/apps/cientos-docs/app/components/materials/WobbleMaterial.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/miscellaneous/Bounds.vue b/apps/cientos-docs/app/components/miscellaneous/Bounds.vue new file mode 100644 index 000000000..e8b1eb64d --- /dev/null +++ b/apps/cientos-docs/app/components/miscellaneous/Bounds.vue @@ -0,0 +1,25 @@ + + + diff --git a/apps/cientos-docs/app/components/miscellaneous/MouseParallax.vue b/apps/cientos-docs/app/components/miscellaneous/MouseParallax.vue new file mode 100644 index 000000000..8cf84fb6a --- /dev/null +++ b/apps/cientos-docs/app/components/miscellaneous/MouseParallax.vue @@ -0,0 +1,25 @@ + + + diff --git a/apps/cientos-docs/app/components/miscellaneous/PositionalAudio.vue b/apps/cientos-docs/app/components/miscellaneous/PositionalAudio.vue new file mode 100644 index 000000000..717b7dc1b --- /dev/null +++ b/apps/cientos-docs/app/components/miscellaneous/PositionalAudio.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/AnimatedSprite.vue b/apps/cientos-docs/app/components/objects/AnimatedSprite.vue new file mode 100644 index 000000000..805b52c11 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/AnimatedSprite.vue @@ -0,0 +1,35 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/CubeCamera.vue b/apps/cientos-docs/app/components/objects/CubeCamera.vue new file mode 100644 index 000000000..49702592c --- /dev/null +++ b/apps/cientos-docs/app/components/objects/CubeCamera.vue @@ -0,0 +1,54 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/Fbo.vue b/apps/cientos-docs/app/components/objects/Fbo.vue new file mode 100644 index 000000000..debce8006 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/Fbo.vue @@ -0,0 +1,41 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/GradientTexture.vue b/apps/cientos-docs/app/components/objects/GradientTexture.vue new file mode 100644 index 000000000..2372fe034 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/GradientTexture.vue @@ -0,0 +1,19 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/Html.vue b/apps/cientos-docs/app/components/objects/Html.vue new file mode 100644 index 000000000..a0d2822af --- /dev/null +++ b/apps/cientos-docs/app/components/objects/Html.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlIframeDemo.vue b/apps/cientos-docs/app/components/objects/HtmlIframeDemo.vue new file mode 100644 index 000000000..2f75012b2 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlIframeDemo.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlOccludeBlendingDemo.vue b/apps/cientos-docs/app/components/objects/HtmlOccludeBlendingDemo.vue new file mode 100644 index 000000000..33bb4c62f --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlOccludeBlendingDemo.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlOccludeComplexDemo.vue b/apps/cientos-docs/app/components/objects/HtmlOccludeComplexDemo.vue new file mode 100644 index 000000000..2ef22efcd --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlOccludeComplexDemo.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlOcclusion.vue b/apps/cientos-docs/app/components/objects/HtmlOcclusion.vue new file mode 100644 index 000000000..7a9910f34 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlOcclusion.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlSingleOccluder.vue b/apps/cientos-docs/app/components/objects/HtmlSingleOccluder.vue new file mode 100644 index 000000000..1191a9874 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlSingleOccluder.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/apps/cientos-docs/app/components/objects/HtmlTransitionDemo.vue b/apps/cientos-docs/app/components/objects/HtmlTransitionDemo.vue new file mode 100644 index 000000000..4e4d32dd5 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/HtmlTransitionDemo.vue @@ -0,0 +1,100 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/Image.vue b/apps/cientos-docs/app/components/objects/Image.vue new file mode 100644 index 000000000..e9d1908de --- /dev/null +++ b/apps/cientos-docs/app/components/objects/Image.vue @@ -0,0 +1,39 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/MarchingCubes.vue b/apps/cientos-docs/app/components/objects/MarchingCubes.vue new file mode 100644 index 000000000..6963ee10f --- /dev/null +++ b/apps/cientos-docs/app/components/objects/MarchingCubes.vue @@ -0,0 +1,55 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/Reflector.vue b/apps/cientos-docs/app/components/objects/Reflector.vue new file mode 100644 index 000000000..8dfccc343 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/Reflector.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/objects/Text.vue b/apps/cientos-docs/app/components/objects/Text.vue new file mode 100644 index 000000000..f995701f9 --- /dev/null +++ b/apps/cientos-docs/app/components/objects/Text.vue @@ -0,0 +1,79 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Box.vue b/apps/cientos-docs/app/components/shapes/Box.vue new file mode 100644 index 000000000..a19e6afc2 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Box.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/CatmullRomCurve3.vue b/apps/cientos-docs/app/components/shapes/CatmullRomCurve3.vue new file mode 100644 index 000000000..330049207 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/CatmullRomCurve3.vue @@ -0,0 +1,20 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Circle.vue b/apps/cientos-docs/app/components/shapes/Circle.vue new file mode 100644 index 000000000..855c1c226 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Circle.vue @@ -0,0 +1,28 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Cone.vue b/apps/cientos-docs/app/components/shapes/Cone.vue new file mode 100644 index 000000000..ff2825adf --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Cone.vue @@ -0,0 +1,31 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/CubicBezierLine.vue b/apps/cientos-docs/app/components/shapes/CubicBezierLine.vue new file mode 100644 index 000000000..584fc7633 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/CubicBezierLine.vue @@ -0,0 +1,22 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Cylinder.vue b/apps/cientos-docs/app/components/shapes/Cylinder.vue new file mode 100644 index 000000000..2745f5b9b --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Cylinder.vue @@ -0,0 +1,32 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Dodecahedron.vue b/apps/cientos-docs/app/components/shapes/Dodecahedron.vue new file mode 100644 index 000000000..64d933d57 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Dodecahedron.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Grid.vue b/apps/cientos-docs/app/components/shapes/Grid.vue new file mode 100644 index 000000000..4a3e2df8b --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Grid.vue @@ -0,0 +1,42 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Icosahedron.vue b/apps/cientos-docs/app/components/shapes/Icosahedron.vue new file mode 100644 index 000000000..3252ab847 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Icosahedron.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Line2.vue b/apps/cientos-docs/app/components/shapes/Line2.vue new file mode 100644 index 000000000..f3269f4f2 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Line2.vue @@ -0,0 +1,24 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Octahedron.vue b/apps/cientos-docs/app/components/shapes/Octahedron.vue new file mode 100644 index 000000000..56a484870 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Octahedron.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Plane.vue b/apps/cientos-docs/app/components/shapes/Plane.vue new file mode 100644 index 000000000..a0e69b976 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Plane.vue @@ -0,0 +1,28 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/QuadraticBezierLine.vue b/apps/cientos-docs/app/components/shapes/QuadraticBezierLine.vue new file mode 100644 index 000000000..017e24e0d --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/QuadraticBezierLine.vue @@ -0,0 +1,18 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Ring.vue b/apps/cientos-docs/app/components/shapes/Ring.vue new file mode 100644 index 000000000..d091df1fc --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Ring.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/RoundedBox.vue b/apps/cientos-docs/app/components/shapes/RoundedBox.vue new file mode 100644 index 000000000..fca30da5d --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/RoundedBox.vue @@ -0,0 +1,29 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/ScreenQuad.vue b/apps/cientos-docs/app/components/shapes/ScreenQuad.vue new file mode 100644 index 000000000..ba562eaf6 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/ScreenQuad.vue @@ -0,0 +1,16 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Sphere.vue b/apps/cientos-docs/app/components/shapes/Sphere.vue new file mode 100644 index 000000000..e1addd3ff --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Sphere.vue @@ -0,0 +1,31 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/SuperFormula.vue b/apps/cientos-docs/app/components/shapes/SuperFormula.vue new file mode 100644 index 000000000..3e3e6dc0b --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/SuperFormula.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Tetrahedron.vue b/apps/cientos-docs/app/components/shapes/Tetrahedron.vue new file mode 100644 index 000000000..183ca2795 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Tetrahedron.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Torus.vue b/apps/cientos-docs/app/components/shapes/Torus.vue new file mode 100644 index 000000000..a0dc4ac39 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Torus.vue @@ -0,0 +1,29 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/TorusKnot.vue b/apps/cientos-docs/app/components/shapes/TorusKnot.vue new file mode 100644 index 000000000..d3829013a --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/TorusKnot.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/cientos-docs/app/components/shapes/Tube.vue b/apps/cientos-docs/app/components/shapes/Tube.vue new file mode 100644 index 000000000..07ca00e80 --- /dev/null +++ b/apps/cientos-docs/app/components/shapes/Tube.vue @@ -0,0 +1,39 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Backdrop.vue b/apps/cientos-docs/app/components/staging/Backdrop.vue new file mode 100644 index 000000000..4283cad1b --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Backdrop.vue @@ -0,0 +1,99 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Environment.vue b/apps/cientos-docs/app/components/staging/Environment.vue new file mode 100644 index 000000000..6c09bec39 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Environment.vue @@ -0,0 +1,66 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Lightformer.vue b/apps/cientos-docs/app/components/staging/Lightformer.vue new file mode 100644 index 000000000..a8f62fb12 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Lightformer.vue @@ -0,0 +1,68 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Ocean.vue b/apps/cientos-docs/app/components/staging/Ocean.vue new file mode 100644 index 000000000..5188539b5 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Ocean.vue @@ -0,0 +1,24 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Precipitation.vue b/apps/cientos-docs/app/components/staging/Precipitation.vue new file mode 100644 index 000000000..4ab068438 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Precipitation.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Sky.vue b/apps/cientos-docs/app/components/staging/Sky.vue new file mode 100644 index 000000000..cc36701dc --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Sky.vue @@ -0,0 +1,34 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Smoke.vue b/apps/cientos-docs/app/components/staging/Smoke.vue new file mode 100644 index 000000000..1efe4aab4 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Smoke.vue @@ -0,0 +1,104 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Stage.vue b/apps/cientos-docs/app/components/staging/Stage.vue new file mode 100644 index 000000000..6806a5da3 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Stage.vue @@ -0,0 +1,26 @@ + + + diff --git a/apps/cientos-docs/app/components/staging/Stars.vue b/apps/cientos-docs/app/components/staging/Stars.vue new file mode 100644 index 000000000..b5697efe2 --- /dev/null +++ b/apps/cientos-docs/app/components/staging/Stars.vue @@ -0,0 +1,34 @@ + + + diff --git a/apps/cientos-docs/app/composables/useNavigation.ts b/apps/cientos-docs/app/composables/useNavigation.ts new file mode 100644 index 000000000..47efe667a --- /dev/null +++ b/apps/cientos-docs/app/composables/useNavigation.ts @@ -0,0 +1,35 @@ +import { createSharedComposable } from '@vueuse/core' + +export interface HeaderLink { + label: string + description: string + icon: string + to: string + search?: boolean + children?: HeaderLink[] +} + +function _useHeaderLinks() { + const route = useRoute() + const headerLinks = computed(() => { + const to = '' + + return [{ + label: 'Get Started', + description: 'Learn how to get started.', + icon: 'i-lucide-rocket', + to: `${to}/getting-started`, + active: route.path.startsWith(`${to}/getting-started`), + }, { + label: 'API', + description: 'Explore the API reference.', + icon: 'i-lucide-code-xml', + to: `${to}/api`, + active: route.path.startsWith(`${to}/api`), + }] + }) + + return { headerLinks } +} + +export const useHeaderLinks = import.meta.client ? createSharedComposable(_useHeaderLinks) : _useHeaderLinks diff --git a/apps/cientos-docs/app/error.vue b/apps/cientos-docs/app/error.vue new file mode 100644 index 000000000..35ec260ca --- /dev/null +++ b/apps/cientos-docs/app/error.vue @@ -0,0 +1,42 @@ + + + diff --git a/apps/cientos-docs/app/layouts/docs.vue b/apps/cientos-docs/app/layouts/docs.vue new file mode 100644 index 000000000..c0e62a08e --- /dev/null +++ b/apps/cientos-docs/app/layouts/docs.vue @@ -0,0 +1,16 @@ + + + diff --git a/apps/cientos-docs/app/pages/[...slug].vue b/apps/cientos-docs/app/pages/[...slug].vue new file mode 100644 index 000000000..4e7b9a588 --- /dev/null +++ b/apps/cientos-docs/app/pages/[...slug].vue @@ -0,0 +1,100 @@ + + + diff --git a/apps/cientos-docs/app/pages/index.vue b/apps/cientos-docs/app/pages/index.vue new file mode 100644 index 000000000..6dc542237 --- /dev/null +++ b/apps/cientos-docs/app/pages/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/cientos-docs/app/utils/content.ts b/apps/cientos-docs/app/utils/content.ts new file mode 100644 index 000000000..4e83d6142 --- /dev/null +++ b/apps/cientos-docs/app/utils/content.ts @@ -0,0 +1,18 @@ +import type { ContentNavigationItem } from '@nuxt/content' + +export const navigationInjectionKey: InjectionKey> = Symbol('navigation') + +export function navPageFromPath(path: string, tree: ContentNavigationItem[]): ContentNavigationItem | undefined { + for (const file of tree) { + if (file.path === path) { + return file + } + + if (file.children) { + const result = navPageFromPath(path, file.children) + if (result) { + return result + } + } + } +} diff --git a/apps/cientos-docs/content.config.ts b/apps/cientos-docs/content.config.ts new file mode 100644 index 000000000..8760af561 --- /dev/null +++ b/apps/cientos-docs/content.config.ts @@ -0,0 +1,25 @@ +import { defineCollection, defineContentConfig, z } from '@nuxt/content' + +export default defineContentConfig({ + collections: { + landing: defineCollection({ + type: 'page', + source: 'index.md', + }), + docs: defineCollection({ + type: 'page', + source: { + include: '**', + exclude: ['index.md'], + }, + schema: z.object({ + links: z.array(z.object({ + label: z.string(), + icon: z.string(), + to: z.string(), + target: z.string().optional(), + })).optional(), + }), + }), + }, +}) diff --git a/apps/cientos-docs/content/1.getting-started/1.index.md b/apps/cientos-docs/content/1.getting-started/1.index.md new file mode 100644 index 000000000..e1c4555e8 --- /dev/null +++ b/apps/cientos-docs/content/1.getting-started/1.index.md @@ -0,0 +1,20 @@ +--- +title: Getting Started +description: Learn how to get started with cientos +--- + +Cientos (Spanish word for "hundreds", pronounced `/θjentos/`) is a collection of useful ready-to-go helpers and components that are not part of the **core** package. The name uses the word in Spanish to multiply by 100, to refer to the potential reach of the package to hold amazing abstractions. + +::prose-note +The cientos package uses three-stdlib module under the hood instead of the `three/examples/jsm` module. This means that you don't need to extend the catalogue of components using the extend method, cientos does it for you +:: + +It just works. 💯 + +## Next Steps + +Continue your journey: + +- [Installation](/getting-started/installation) +- [Usage](/getting-started/usage) +- [Upgrade guide](/getting-started/upgrade-guide) diff --git a/apps/cientos-docs/content/1.getting-started/2.installation.md b/apps/cientos-docs/content/1.getting-started/2.installation.md new file mode 100644 index 000000000..661917b9c --- /dev/null +++ b/apps/cientos-docs/content/1.getting-started/2.installation.md @@ -0,0 +1,52 @@ +--- +title: Installation Guide +description: Get started with cientos +--- + +## Manual installation + +If you prefer to set up Cientos manually or add it to an existing [Tres.js](https://tresjs.org/) project + + ::code-group +```bash [pnpm] +pnpm add @tresjs/cientos +``` + +```bash [npm] +npm install @tresjs/cientos +``` + +```bash [yarn] +yarn add @tresjs/cientos +``` +:: + +## Via `create-tres` wizard + +When using `create-tres` to create a new project, the cli will prompt you to install cientos. + +::code-group +```bash [npm] +npx create-tres my-tres-project +``` + +```bash [yarn] +yarn create tres my-tres-project +``` + +```bash [pnpm] +pnpm create tres my-tres-project +``` +:: + +::read-more{to="https://docs.tresjs.org/getting-started/installation#quick-start-recommended"} +For more information about the `create-tres` wizard please refer to this link. +:: + +## Nuxt + +If you're using nuxt, installing our nuxt module will detect automatically cientos. + +::read-more{to="https://docs.tresjs.org/getting-started/installation#nuxt-project"} +For more information about the Nuxt module please refer to this link. +:: diff --git a/apps/cientos-docs/content/1.getting-started/3.usage.md b/apps/cientos-docs/content/1.getting-started/3.usage.md new file mode 100644 index 000000000..7be4f516f --- /dev/null +++ b/apps/cientos-docs/content/1.getting-started/3.usage.md @@ -0,0 +1,95 @@ +--- +title: Usage +description: Learn how to get use cientos here +--- + +## Basic Usage + +All instance of cientos provide one (or many) examples of how to use it, similar to this one: + +```js +import { OrbitControls } from '@tresjs/cientos' +``` + +Now you can use the `OrbitControls` component in your scene. +```vue + +``` + +::prose-note +Note that you don’t need to include the **Tres** prefix (for example, ``) to use the component. +:: + +### Props + +All the props are listed with their respective instance and in case is not specified all the props are, **reactive**, for example: + +```vue{3,15-16} + + + +``` +::prose-note +All the props and properties are **Reactive** unless the docs of the instance says the contrary. +:: + +### Events + +Some instance emit events which you can listen as you normally do using vue [emits](https://vuejs.org/guide/components/events.html#emitting-and-listening-to-events), for example: + +```vue{3,5,11} + + + +``` + +### Exposed properties + +All instances expose a `instance` property by default which contains the base of the of its abstractions. For example + +```vue{2} + + + +``` + +This behavior caused confusion and resulted in a poor developer experience. To address it properly, we needed to introduce a breaking change, and we felt this was the right moment to do so. + +The new implementation remains very similar conceptually. However, instead of having two ambiguous `value` references, we’ve standardized all components around `instance`. To access the component, you should now use: + +``` +// Correct in v4 ✅ +console.log(starsRef.value.instance) +``` + +### Remove TweakPane from deps + +We removed the built-in `useTweakPane` integration because it was adding overhead and friction: + +- Incompatible with [Tweakpane v4](https://tweakpane.github.io/docs/) +- Large bundle impact +- Repetitive boilerplate and not very intuitive + +If you still want to use Tweakpane with Tres, follow the cookbook recipe: https://docs.tresjs.org/cookbook/tweakpane.html + +### Move directives to core + +Community adoption of directives has been solid, so they now live in the core package. Import them from `@tresjs/core`: + +```ts +// Correct ✅ +import { vLog } from '@tresjs/core' +``` + +Instead of: + +```ts +// Wrong ❌ +import { vLog } from '@tresjs/cientos' +``` + +### Changes in KeyboardControls + +`KeyboardControls` was redesigned to provide floating controls similar to Unreal Engine, which better matches the component’s intent. We also bundled `PointerLockControls` inside `KeyboardControls`, so you don’t need to wire it manually anymore. + +Learn more: https://cientos.tresjs.org/guide/controls/keyboard-controls diff --git a/apps/cientos-docs/content/2.api/1.abstractions/align.md b/apps/cientos-docs/content/2.api/1.abstractions/align.md new file mode 100644 index 000000000..e74f6a92c --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/align.md @@ -0,0 +1,77 @@ +--- +title: Align +description: Calculate and align children within their parent using bounding boxes. +--- + +::SceneControlsWrapper + ::AbstractionsAlign + :: +:: + +Calculates a bounding box around its children and aligns them as a group within their parent. The component measures its contents and realigns on every frame unless `cacheKey` is set. + +## Usage + +```vue{2,13,18} + + + + +``` + +## Props + +All props are optional. + +| Prop | Description | Default | +| ------------ | ----------------------------------- | ------- | +| `top` | If `true`, aligns bounding box bottom to `0` on the y-axis | `false` | +| `bottom` | If `true`, aligns bounding box top to `0` on the y-axis. | `false` | +| `left` | If `true`, aligns bounding box right to `0` on the x-axis. | `false` | +| `right` | If `true`, aligns bounding box left to `0` on the x-axis. | `false` | +| `front` | If `true`, aligns bounding box back to `0` on the z-axis. | `false` | +| `back` | If `true`, aligns bounding box front to `0` on the z-axis. | `false` | +| `disable` | If `true`, disables alignment on all axes. | `false` | +| `disableX` | If `true`, disables alignment on the x-axis. | `false` | +| `disableY` | If `true`, disables alignment on the y-axis. | `false` | +| `disableZ` | If `true`, disables alignment on the z-axis. | `false` | +| `precise` | See [Box3.setFromObject](https://threejs.org/docs/index.html?q=box3#api/en/math/Box3.setFromObject). | `true` | +| `onAlign` | Callback that fires when updating, after measurement. | | +| `cacheKey` | If set, component will only update when `cacheKey`'s value changes. If unset, component will update every frame. | `undefined` | + +## AlignCallbackOptions + +```ts +export interface AlignCallbackOptions { + /** The next parent above */ + parent: Object3D + /** The outmost container group of the component */ + container: Object3D + width: number + height: number + depth: number + boundingBox: Box3 + boundingSphere: Sphere + center: Vector3 + verticalAlignment: number + horizontalAlignment: number + depthAlignment: number +} +``` diff --git a/apps/cientos-docs/content/2.api/1.abstractions/billboard.md b/apps/cientos-docs/content/2.api/1.abstractions/billboard.md new file mode 100644 index 000000000..b053547fc --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/billboard.md @@ -0,0 +1,42 @@ +--- +title: Billboard +description: Make objects always face the camera automatically. +--- + +::SceneControlsWrapper + ::AbstractionsBillboard + :: +:: + +Adds a `THREE.Group` that always faces the camera. + +## Usage + +```vue{2,10,14} + + + + +``` + +## 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/apps/cientos-docs/content/2.api/1.abstractions/camera-shake.md b/apps/cientos-docs/content/2.api/1.abstractions/camera-shake.md new file mode 100644 index 000000000..1ece691ab --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/camera-shake.md @@ -0,0 +1,58 @@ +--- +title: Camera Shake +description: Apply smooth camera shake to the active camera. +--- + +::SceneControlsWrapper + ::AbstractionsCameraShake + :: +:: + +`` is a component that adds **natural**, *noise-driven motion* to the **active camera**. +It offers **per-axis control**, **adjustable intensity**, and *optional decay* — perfect for *handheld feel*, *footsteps*, *impacts*, or *engine rumble* — and is based on the [Drei `CameraShake` component](https://drei.docs.pmnd.rs/staging/camera-shake#camerashake). + +## Usage + +```vue{2,11,16} + + + +``` + +::prose-note +`` is fully compatible with **``**. +To ensure it works *as expected*, make sure to add the **`make-default`** prop: + +```vue + +``` +:: + +## Props + +| Prop | Description | Default | +| ------------------ | ----------------------------------------------------- | ------- | +| `intensity` | The intensity of the shake (0–1). | `1` | +| `decay` | If `true`, intensity decays over time. | `false` | +| `decayRate` | How fast intensity changes when `decay` is enabled. | `0.65` | +| `maxYaw` | Maximum yaw angle in radians. | `0.01` | +| `maxPitch` | Maximum pitch angle in radians. | `0.01` | +| `maxRoll` | Maximum roll angle in radians. | `0.01` | +| `yawFrequency` | Frequency of yaw oscillation. | `0.1` | +| `pitchFrequency` | Frequency of pitch oscillation. | `0.1` | +| `rollFrequency` | Frequency of roll oscillation. | `0.1` | diff --git a/apps/cientos-docs/content/2.api/1.abstractions/edges.md b/apps/cientos-docs/content/2.api/1.abstractions/edges.md new file mode 100644 index 000000000..8def0ee8b --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/edges.md @@ -0,0 +1,40 @@ +--- +title: Edges +description: Render visible edges of objects with enhanced visual quality. +--- + +::SceneControlsWrapper + ::AbstractionsEdges + :: +:: + +The `cientos` package provides an abstraction of [EdgesGeometry](https://threejs.org/docs/#api/en/geometries/EdgesGeometry) from Three.js, `` is specifically designed for rendering visible edges of objects in a scene graph. This enhances the visual quality by highlighting contours and providing a stylized appearance which contributes to the artistic aspect of 3D visualizations. + +## Usage + +```vue{3,12} + + + +``` + +## Props + +`` is based on [LineSegments](https://threejs.org/docs/#api/en/objects/LineSegments) & [Line](https://threejs.org/docs/#api/en/objects/Line) and supports all of its props. + +| Prop | Description | Default | +| :---------------- | :--------------------------------------------------- | ------------------------- | +| **color** | `THREE.Color` — Color of the edges.
More informations : [TresColor](https://docs.tresjs.org/api/instances-arguments-and-props.html#colors) — [THREE.Color](https://threejs.org/docs/#api/en/math/Color) | `#ff0000` | +| **threshold** | `number` — An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value | `1` | diff --git a/apps/cientos-docs/content/2.api/1.abstractions/fit.md b/apps/cientos-docs/content/2.api/1.abstractions/fit.md new file mode 100644 index 000000000..bb8c790df --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/fit.md @@ -0,0 +1,58 @@ +--- +title: Fit +description: Uniformly scale and position children to fit into a defined space. +--- + +::SceneWrapper + ::AbstractionsFit + :: +:: + +`` uniformly scales and positions its children as a group. By default, it fits its children into a 1 × 1 × 1 box at the world origin. + +Alternatively, the children can be fit into a `Box3` or an `Object3D`. + +Or the children can simply be resized. With `` the children are scaled relative to the center of their calculated bounding box. + +## Usage + +```vue{2,20,27} + + + + +``` + +## Props + +| Name | Description | +| :--- | :---------- | +| **into** | If `into` is:
  • omitted or explicitly `undefined`: position/scale children to fit into a 1 × 1 × 1 `Box3` at world origin.
  • `null`: turn off ``; reset scale/position of children.
  • `number`: convert argument to `Vector3(number, number, number)`.
  • `[number, number, number]`: convert argument to `Vector3`.
  • `Vector3`: position/scale children to fit inside a `Box3` of size `Vector3` at target objects' cumulative center.
  • `Box3`: position/scale children to fit inside `Box3`.
  • `Object3D`: position/scale children to fit inside calculated `Box3`. [See `THREE.Box3.setFromObject`](https://threejs.org/docs/#api/en/math/Box3.setFromObject). `` must not contain the `Object3D` and vice-versa.

default:
`new Box3(new Vector3(-0.5, -0.5, -0.5), new Vector3(0.5, 0.5, 0.5))` | +| **precise** | [See `precise` argument in `THREE.Box3.setFromObject`](https://threejs.org/docs/index.html?q=box3#api/en/math/Box3.setFromObject)

default:
`false` | diff --git a/apps/cientos-docs/content/2.api/1.abstractions/index.md b/apps/cientos-docs/content/2.api/1.abstractions/index.md new file mode 100644 index 000000000..c1449fcf3 --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/index.md @@ -0,0 +1,7 @@ +--- +title: Abstractions +description: UI components reference +--- + +::ApiList{listName="abstraction-list"} +:: diff --git a/apps/cientos-docs/content/2.api/1.abstractions/levioso.md b/apps/cientos-docs/content/2.api/1.abstractions/levioso.md new file mode 100644 index 000000000..b660abfdf --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/levioso.md @@ -0,0 +1,46 @@ +--- +title: Levioso (Float) +description: Make content float like magic with smooth animations. +--- + +::SceneControlsWrapper + ::AbstractionsLevioso + :: +:: + +![Leviosa](https://media.giphy.com/media/HaCFT5ghY6L1m/giphy.gif) + +The `cientos` package provides a `` wrapper that makes its content … float, just like Magic 🪄✨ + +## Usage + +```vue{3,11,13} + + + + +``` + +## Props + +| Prop | Description | Default | +| :--------------- | :--------------------------------------------------- | ------------- | +| `speed` | Floating speed, higher it rocks more 🤘. | `1` | +| `rotationFactor` | Factor for Euler rotation. | `1` | +| `floatFactor` | Factor for Up/down movement. | `1` | +| `range` | Range of y-axis values the object will float within. | `[-0.1, 0.1]` | diff --git a/apps/cientos-docs/content/2.api/1.abstractions/mask.md b/apps/cientos-docs/content/2.api/1.abstractions/mask.md new file mode 100644 index 000000000..1a32a7b10 --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/mask.md @@ -0,0 +1,80 @@ +--- +title: Mask +description: Cut out areas of the screen using the stencil buffer. +--- + +::SceneControlsWrapper + ::AbstractionsMask + :: +:: + +`` uses the stencil buffer to cut out areas of the screen. + +::prose-warning +To use `` you *must* add `:stencil="true"` to your ``. + +`` relies on the [`stencil buffer`](https://threejs.org/docs/#api/en/renderers/WebGLRenderer). In recent versions of THREE.js, by default, the stencil buffer is not created. +:: + +## Usage + +```vue{2, 16-19} + + + + +``` + +## Props + +| Prop | Description | Default | +| :------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | +| **`id`** | Id of the stencil buffer to use. Each mask must have a `number` id. Multiple masks can refer to the same id. | | +| **`colorWrite`** | Whether the colors of the mask's own material will leak through. | `false` | +| **`depthWrite`** | Whether the depth of the mask's own material will leak through. | `false` | + +## useMask + +Composable that returns the stencil configuration to apply a mask to a material. Use it with `v-bind` on materials that should be affected by the mask. + +**Parameters:** +- `id` - The mask id to use (number or Ref) +- `inverse` - Whether to invert the mask (boolean or Ref), defaults to `false` + +```vue + +``` diff --git a/apps/cientos-docs/content/2.api/1.abstractions/outline.md b/apps/cientos-docs/content/2.api/1.abstractions/outline.md new file mode 100644 index 000000000..214831835 --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/outline.md @@ -0,0 +1,51 @@ +--- +title: Outline +description: Create inverted-hull outlines using parent geometry. +--- + +::SceneControlsWrapper + ::AbstractionsOutline + :: +:: + +`` creates an inverted-hull outline using its parent's geometry. Supported parents are `` and ``. + +## Usage + +```vue{3,15,20} + + + + +``` + +## Props + +| Props | Description | Default | +|--------------|--------------------------------------------------------------------| ------- | +| color | Outline color | `'black'` | +| screenspace | Whether line thickness is independent of zoom | `false` | +| opacity | Outline opacity | `1` | +| transparent | Outline transparency | `false` | +| thickness | Outline thickness | `0.05` | +| angle | Geometry crease angle (`0` is no crease). See [BufferGeometryUtils.toCreasedNormals](https://threejs.org/docs/#examples/en/utils/BufferGeometryUtils.toCreasedNormals) | `Math.PI` | diff --git a/apps/cientos-docs/content/2.api/1.abstractions/sampler.md b/apps/cientos-docs/content/2.api/1.abstractions/sampler.md new file mode 100644 index 000000000..b1a82f131 --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/sampler.md @@ -0,0 +1,90 @@ +--- +title: Sampler +description: Distribute instances on mesh surfaces using MeshSurfaceSampler. +--- + +::SceneControlsWrapper + ::AbstractionsSampler + :: +:: + +Declarative abstraction around MeshSurfaceSampler & InstancedMesh. It samples points from the passed mesh and transforms an InstancedMesh's matrix to distribute instances on the points. + +## Usage + +```vue{2,11-20} + + + + +``` + +## Props + +| Props | Description | +|--------------|--------------------------------------------------------------------| +| mesh | **Mesh** Surface mesh from which to sample | +| count | **Number** Number of samples | +| instanceMesh | **InstanceMesh** InstanceMesh to scatter | +| weight | **String** A vertex attribute to be used as a weight when sampling | +| transform | **Function** A function that can be used as a custom sampling | + +## useSurfaceSampler + +A hook to obtain the result of the as a buffer. Useful for driving anything other than InstancedMesh via the Sampler. + +```vue{2,10} + + + +``` diff --git a/apps/cientos-docs/content/2.api/1.abstractions/screen-sizer.md b/apps/cientos-docs/content/2.api/1.abstractions/screen-sizer.md new file mode 100644 index 000000000..da634ab5b --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/screen-sizer.md @@ -0,0 +1,44 @@ +--- +title: ScreenSizer +description: Scale objects to screen space where 1 unit equals 1 pixel. +--- + +::SceneWrapper + ::AbstractionsScreenSizer + :: +:: + +Adds a `` wrapper that scales to "screen space". By default `1` THREE world unit will be translated to 1 screen pixel. + +E.g. a BoxGeometry with a height, width, and depth of 100 each, will be scaled to 100 screen pixels in each dimension. + +## Usage + +```vue{3,10,15} + + + +``` + +## Props + +Inherits all props from `THREE.Object3D`. diff --git a/apps/cientos-docs/content/2.api/1.abstractions/screen-space.md b/apps/cientos-docs/content/2.api/1.abstractions/screen-space.md new file mode 100644 index 000000000..de4287d9d --- /dev/null +++ b/apps/cientos-docs/content/2.api/1.abstractions/screen-space.md @@ -0,0 +1,49 @@ +--- +title: ScreenSpace +description: Position objects in front of the camera with CSS-like positioning. +--- + +::SceneControlsWrapper + ::AbstractionsScreenSpace + :: +:: + +`` wraps its children in a `` and positions them in front of the active camera at `:depth`. + +Additionally, the `top`, `bottom`, `left`, `right` props can be used to position them similarly to CSS `position: absolute` property when using a `PerspectiveCamera` or an `OrtographicCamera`. + +## Usage + +```vue{2,11,16} + + + + +``` + +## Props + +| Prop | Description | Default | +| :------- | :---------------------------------------------------------- | --------------------------------------- | +| `depth` | Distance from the camera | `-1` | +| `top` | Similar to CSS `top` property. Cannot be used with `bottom` | `0.5` (vertical center of the screen) | +| `bottom` | Similar to CSS `bottom` property. Cannot be used with `top` | | +| `left` | Similar to CSS `left` property. Cannot be used with `right` | `0.5` (horizontal center of the screen) | +| `right` | Similar to CSS `right` property. Cannot be used with `left` | | diff --git a/apps/cientos-docs/content/2.api/2.controls/camera-controls.md b/apps/cientos-docs/content/2.api/2.controls/camera-controls.md new file mode 100644 index 000000000..699e9ed36 --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/camera-controls.md @@ -0,0 +1,124 @@ +--- +title: Camera Controls +description: Is similar to OrbitControls yet supports smooth transitions and more features. +--- + +::SceneControlsWrapper + ::ControlsCameraControls + :: +:: + +[CameraControls](https://github.com/yomotsu/camera-controls) is a camera controller similar to [OrbitControls](/api/controls/orbit-controls) yet supports smooth transitions and more features. + +However, it is thirty party library for ThreeJS. So to use it you would need to install and import using [npm](https://www.npmjs.com/package/camera-controls). + +## Usage + +```vue{7} + + +``` + +::prose-warning +Is really important that the Perspective camera is set first in the canvas. Otherwise might break. +:: + +## Props + +Certainly! Here's the properties of the object in raw markdown table format: + +| Prop | Description | Default | +| :------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | +| **makeDefault** | Whether to make this the default controls. | `false` | +| **camera** | The camera to control. | `undefined` | +| **domElement** | The DOM element to listen to. | `undefined` | +| **minPolarAngle** | Minimum vertical angle in radians. | `0` | +| **maxPolarAngle** | Maximum vertical angle in radians. | `Math.PI` | +| **minAzimuthAngle** | Minimum horizontal angle in radians. | `-Infinity` | +| **maxAzimuthAngle** | Maximum horizontal angle in radians. | `Infinity` | +| **distance** | Current distance. | `camera.position.z` | +| **minDistance** | Minimum distance for dolly. PerspectiveCamera only. | `Number.EPSILON` | +| **maxDistance** | Maximum distance for dolly. PerspectiveCamera only. | `Infinity` | +| **infinityDolly** | `true` to enable Infinity Dolly for wheel and pinch. | `false` | +| **minZoom** | Minimum camera zoom. | `0.01` | +| **maxZoom** | Maximum camera zoom. | `Infinity` | +| **smoothTime** | Approximate time in seconds to reach the target. A smaller value will reach the target faster. | `0.25` | +| **draggingSmoothTime** | The smoothTime while dragging. | `0.125` | +| **maxSpeed** | Max transition speed in units per second. | `Infinity` | +| **azimuthRotateSpeed** | Speed of azimuth (horizontal) rotation. | `1.0` | +| **polarRotateSpeed** | Speed of polar (vertical) rotation. | `1.0` | +| **dollySpeed** | Speed of mouse-wheel dollying. | `1.0` | +| **dollyDragInverted** | `true` to invert direction when dollying or zooming via drag. | `false` | +| **truckSpeed** | Speed of drag for truck and pedestal. | `2.0` | +| **dollyToCursor** | `true` to enable Dolly-in to the mouse cursor coords. | `false` | +| **dragToOffset** | Whether to drag to offset. | `false` | +| **verticalDragToForward** | The same as `.screenSpacePanning` in three.js's OrbitControls. | `false` | +| **boundaryFriction** | Friction ratio of the boundary. | `0.0` | +| **restThreshold** | Controls how soon the `rest` event fires as the camera slows. | `0.01` | +| **colliderMeshes** | An array of Meshes to collide with the camera. Be aware colliderMeshes may decrease performance. The collision test uses 4 raycasters from the camera since the near plane has 4 corners. | `[]` | +| **mouseButtons** | Configuration of actions on mouse input. | See [`User input config`](#user-input-config) for details | +| **touches** | Configuration of actions on touch. | See [`User input config`](#user-input-config) for details | + +## User input config + +You can easily override the default user input config by defining `mouseButtons` and/or `touches` props that correspond to [`camera-controls` settings](https://github.com/yomotsu/camera-controls?#user-input-config). For ease of use, we're re-exporting the `CameraControls` class as `BaseCameraControls` which gives you access to the `ACTION` enum. + +```vue + + + +``` + +### Mouse buttons + +| Button to assign | Options | Default | +| ----------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | +| `mouseButtons.left` | `ROTATE` \| `TRUCK` \| `OFFSET` \| `DOLLY` \| `ZOOM` \| `NONE` | `ROTATE` | +| `mouseButtons.right` | `ROTATE` \| `TRUCK` \| `OFFSET` \| `DOLLY` \| `ZOOM` \| `NONE` | `TRUCK` | +| `mouseButtons.wheel` ¹ | `ROTATE` \| `TRUCK` \| `OFFSET` \| `DOLLY` \| `ZOOM` \| `NONE` | `DOLLY` for Perspective camera, `ZOOM` for Orthographic camera. | +| `mouseButtons.middle` ² | `ROTATE` \| `TRUCK` \| `OFFSET` \| `DOLLY` \| `ZOOM` \| `NONE` | `DOLLY` | + +1. Mouse wheel event for scroll "up/down", on mac "up/down/left/right". +2. Mouse wheel "button" click event. + +### Touches + +| Fingers to assign | Options | Default | +| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `touches.one` | `TOUCH_ROTATE` \| `TOUCH_TRUCK` \| `TOUCH_OFFSET` \| `DOLLY` \| `ZOOM` \| `NONE` | `TOUCH_ROTATE` | +| `touches.two` | `TOUCH_DOLLY_TRUCK` \| `TOUCH_DOLLY_OFFSET` \| `TOUCH_DOLLY_ROTATE` \| `TOUCH_ZOOM_TRUCK` \| `TOUCH_ZOOM_OFFSET` \| `TOUCH_ZOOM_ROTATE` \| `TOUCH_DOLLY` \| `TOUCH_ZOOM` \| `TOUCH_ROTATE` \| `TOUCH_TRUCK` \| `TOUCH_OFFSET` \| `NONE` | `TOUCH_DOLLY_TRUCK` for Perspective camera, `TOUCH_ZOOM_TRUCK` for Othographic camera. | +| `touches.three` | `TOUCH_DOLLY_TRUCK` \| `TOUCH_DOLLY_OFFSET` \| `TOUCH_DOLLY_ROTATE` \| `TOUCH_ZOOM_TRUCK` \| `TOUCH_ZOOM_OFFSET` \| `TOUCH_ZOOM_ROTATE` \| `TOUCH_ROTATE` \| `TOUCH_TRUCK` \| `TOUCH_OFFSET` \| `NONE` | `TOUCH_TRUCK` | + +## Events + +```vue + +``` + +| Event | Description | +| :--------- | :-------------------------------------------- | +| **start** | Dispatched when the control starts to change. | +| **change** | Dispatched when the control changes. | +| **end** | Dispatched when the control ends to change. | diff --git a/apps/cientos-docs/content/2.api/2.controls/index.md b/apps/cientos-docs/content/2.api/2.controls/index.md new file mode 100644 index 000000000..0367f6ddd --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/index.md @@ -0,0 +1,7 @@ +--- +title: Controls +description: All controls +--- + +::ApiList{listName="control-list"} +:: diff --git a/apps/cientos-docs/content/2.api/2.controls/keyboard-controls.md b/apps/cientos-docs/content/2.api/2.controls/keyboard-controls.md new file mode 100644 index 000000000..9d767690c --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/keyboard-controls.md @@ -0,0 +1,61 @@ +--- +title: Keyboard Controls +description: WASD on QWERTY keyboards or equivalent keys on non-QWERTY keyboards +--- + +::SceneControlsWrapper + ::ControlsKeyboardControls + :: +:: + +`` is a simple keyboard controller for the camera. The camera's movements are bound to: + +* WASD on QWERTY keyboards or equivalent keys on non-QWERTY keyboards +* Arrow keys + +::prose-note +`KeyboardControls` uses `PointerLockControls` under the hood. You can use [PointerLockControls props and events](pointer-lock-controls#props). +:: + +## Usage + +```vue{3,10} + + + +``` + +::prose-warning +Is really important that the Perspective camera is set first in the canvas. Otherwise might break. +:: + +## Props + +| Prop | Description | Default | +| :-------------- | :----------------------------------- | ------- | +| **moveSpeed** | Speed movement. | 0.2 | +| **makeDefault** | If `true`, the controls will be set as the default controls for the scene. | `true` | +| **camera** | The camera to control. | `undefined` | +| **domElement** | The DOM element to listen to. | `undefined` | +| **selector** | Accept an id element as string. If set, the new element will be used as the trigger | `undefined` | + +## Events + +```vue + +``` + +| Event | Description | +| :--------- | :--------------------------------------------------------------- | +| **isLock** | Return `true` if "lock", `false` if "unlock" events are triggered. | +| **change** | Dispatched when the control changes. | diff --git a/apps/cientos-docs/content/2.api/2.controls/map-controls.md b/apps/cientos-docs/content/2.api/2.controls/map-controls.md new file mode 100644 index 000000000..b0d848ce3 --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/map-controls.md @@ -0,0 +1,47 @@ +--- +title: Map Controls +description: similar to OrbitControls but for map views +--- + +::SceneControlsWrapper + ::ControlsMapControls + :: +:: + +[MapControls](https://threejs.org/docs/index.html?q=controls#examples/en/controls/MapControls) similar to OrbitControls, this control is intended for transforming a camera over a map from bird's eye perspective, but uses a specific preset for mouse/touch interaction and disables screen space panning by default. + +## Usage + +```vue{7} + + +``` + +::prose-warning +Is really important that the Perspective camera is set first in the canvas. Otherwise might break. +:: + +## Props + +| Prop | Description | Default | +| :---------------- | :--------------------------------------------------------------------------------------------------------------- | ----------- | +| **makeDefault** | If `true`, the controls will be set as the default controls for the scene. | `false` | +| **camera** | The camera to control. | `undefined` | +| **domElement** | The dom element to listen to. | `undefined` | + +::prose-note +All the Orbit-Controls props works here too. +:: diff --git a/apps/cientos-docs/content/2.api/2.controls/orbit-controls.md b/apps/cientos-docs/content/2.api/2.controls/orbit-controls.md new file mode 100644 index 000000000..1f6ae6b76 --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/orbit-controls.md @@ -0,0 +1,76 @@ +--- +title: Orbit Controls +description: Allows you to orbit around the scene +--- + +::SceneControlsWrapper + ::ControlsOrbitControls + :: +:: +[OrbitControls](https://threejs.org/docs/index.html?q=orbit#examples/en/controls/OrbitControls) is a camera controller that allows you to orbit around a target. It's a great way to explore your scene. + +## Usage + +```vue{7} + + +``` + +::prose-warning +Is really important that the Perspective camera is set first in the canvas. Otherwise might break. +:: + +## Props + +| Prop | Description | Default | +| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| **makeDefault** | If `true`, the controls will be set as the default controls for the scene. | `false` | +| **camera** | The camera to control. | `undefined` | +| **domElement** | The dom element to listen to. | `undefined` | +| **target** | The target to orbit around. | `undefined` | +| **enableDamping** | If `true`, the controls will use damping (inertia), which can be used to give a sense of weight to the controls. | `true` | +| **dampingFactor** | The damping inertia used if `.enableDamping` is set to true. | `0.05` | +| **autoRotate** | Set to true to automatically rotate around the target. | `false` | +| **autoRotateSpeed** | How fast to rotate around the target if `.autoRotate` is true. | `2` | +| **enablePan** | Whether to enable panning. | `true` | +| **keyPanSpeed** | How fast to pan the camera when the keyboard is used. Default is 7.0 pixels per keypress. | `7.0` | +| **keys** | This object contains references to the keycodes for controlling camera panning. Default is the 4 arrow keys. | `{ LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }` | +| **maxAzimuthAngle** | How far you can orbit horizontally, upper limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity. | `Infinity` | +| **minAzimuthAngle** | How far you can orbit horizontally, lower limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is - Infinity. | `-Infinity` | +| **maxPolarAngle** | How far you can orbit vertically, upper limit. Range is 0 to Math.PI radians, and default is Math.PI. | `Math.PI` | +| **minPolarAngle** | How far you can orbit vertically, lower limit. Range is 0 to Math.PI radians, and default is 0. | `0` | +| **minDistance** | The minimum distance of the camera to the target. Default is 0. | `0` | +| **maxDistance** | The maximum distance of the camera to the target. Default is Infinity. | `Infinity` | +| **minZoom** | The minimum field of view angle, in radians. Default is 0. | `0` | +| **maxZoom** | The maximum field of view angle, in radians. ( OrthographicCamera only ). Default is Infinity. | `Infinity` | +| **touches** | This object contains references to the touch actions used by the controls. | `{ ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }` | +| **mouseButtons** | This object contains references to the mouse actions used by the controls. LEFT: Rotate around the target, MIDDLE: Zoom the camera, RIGHT: Pan the camera. | `{ LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }` | +| **enableZoom** | Whether to enable zooming. | `true` | +| **zoomSpeed** | How fast to zoom in and out. Default is 1. | `1` | +| **enableRotate** | Whether to enable rotating. | `true` | +| **rotateSpeed** | How fast to rotate around the target. Default is 1. | `1` | + +## Events + +```vue + +``` + +| Event | Description | +| :--------- | :-------------------------------------------- | +| **start** | Dispatched when the control starts to change. | +| **change** | Dispatched when the control changes. | +| **end** | Dispatched when the control ends to change. | diff --git a/apps/cientos-docs/content/2.api/2.controls/pointer-lock-controls.md b/apps/cientos-docs/content/2.api/2.controls/pointer-lock-controls.md new file mode 100644 index 000000000..3f50f5767 --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/pointer-lock-controls.md @@ -0,0 +1,58 @@ +--- +title: PointerLock Controls +description: Allows you to capture the mouse movement and simulate a first person camera +--- + +::SceneControlsWrapper + ::ControlsPointerLockControls + :: +:: + +[PointerLockControls](https://threejs.org/docs/index.html?q=pointe#examples/en/controls/PointerLockControls) is a camera controller that allows you to capture the mouse movement and simulate a first person camera. It is a perfect choice for first person 3D games. + +::prose-warning +This control uses the [`Pointer Lock API`](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API), the same rules are applied, for example, you need to interact with the browser to "lock" or start the event. +In addition, you need to wait 1 second between canceling and re-starting the event +:: + +## Usage + +```vue{3,10} + + + +``` + +::prose-warning +Is really important that the Perspective camera is set first in the canvas. Otherwise might break. +:: + +## Props + +| Prop | Description | Default | +| :-------------- | :---------------------------------------------------------------------------------------- | ----------- | +| **makeDefault** | If `true`, the controls will be set as the default controls for the scene. | `false` | +| **camera** | The camera to control. | `undefined` | +| **domElement** | The dom element to listen to. | `undefined` | +| **selector** | Accept an id element as string, if it is set, the new element will be used as the trigger | `undefined` | + +## Events + +```vue + +``` + +| Event | Description | +| :--------- | :--------------------------------------------------------------- | +| **isLock** | Return `true` if "lock", `false` if "unlock" events are trigger. | +| **change** | Dispatched when the control changes. | diff --git a/apps/cientos-docs/content/2.api/2.controls/transform-controls.md b/apps/cientos-docs/content/2.api/2.controls/transform-controls.md new file mode 100644 index 000000000..9e8e6bfc7 --- /dev/null +++ b/apps/cientos-docs/content/2.api/2.controls/transform-controls.md @@ -0,0 +1,106 @@ +--- +title: Transform Controls +description: Set of three gizmos that can be used to translate, rotate and scale objects +--- + +The [Transform Controls](https://threejs.org/docs/#examples/en/controls/TransformControls) are a set of three gizmos that can be used to translate, rotate and scale objects in the scene. It adapts a similar interaction model of DCC tools like Blender + +::SceneControlsWrapper + ::ControlsTransformControls + :: +:: + +## Usage + +To use the Transform Controls, simply add the `TransformControls` component to your scene. You can pass the `templateRef`of the instance you want to control as a prop. + +```vue{7,8} + + +``` + +::prose-warning +If you are using other controls OrbitControls they will interfere with each other when dragging. To avoid this, you can set the `makeDefault` prop to `true` on the **OrbitControls**. +:: + +## Modes + +The Transform Controls can be used in three different modes: + +### Translate + +![Translate](/cientos/transform-controls-translate.png) + +The default mode allows you to move the object around the scene. + +```vue + +``` + +### Rotate + +![Rotate](/cientos/transform-controls-rotate.png) + +The rotate mode allows you to rotate the object around the scene. + +```vue + +``` + +### Scale + +![Scale](/cientos/transform-controls-scale.png) + +The scale mode allows you to scale the object around the scene. + +```vue + +``` + +## Props + +| Prop | Description | Default | +| :------------------ | :-------------------------------------------------------------------------------------------- | ----------- | +| **object** | The instance [Object3D](https://threejs.org/docs/index.html#api/en/core/Object3D) to control. | `null` | +| **mode** | The mode of the controls. Can be `translate`, `rotate` or `scale`. | `translate` | +| **enabled** | If `true`, the controls will be enabled. | `true` | +| **axis** | The axis to use for the controls. Can be `X`, `Y`, `Z`, `XY`, `YZ`, `XZ`, `XYZ`. | `XYZ` | +| **space** | The space to use for the controls. Can be `local` or `world`. | `local` | +| **size** | The size of the controls. | `1` | +| **translationSnap** | The distance to snap to when translating. (World units) | `null` | +| **rotationSnap** | The angle to snap to when rotating. (Radians) | `null` | +| **scaleSnap** | The scale to snap to when scaling. | `null` | +| **showX** | If `true`, the X-axis helper will be shown. | `true` | +| **showY** | If `true`, the Y-axis helper will be shown. | `true` | +| **showZ** | If `true`, the Z-axis helper will be shown. | `true` | + +## Events + +| Event | Description | +| :--------------- | :------------------------------------------------------------- | +| **dragging** | Fired when the user starts or stops dragging the controls. | +| **change** | Fired when the user changes the controls. | +| **mouseDown** | Fired when the user clicks on the controls. | +| **mouseUp** | Fired when the user releases the mouse button on the controls. | +| **objectChange** | Fired when the user changes the object. | + + diff --git a/apps/cientos-docs/content/2.api/3.loaders/1.use-gltf.md b/apps/cientos-docs/content/2.api/3.loaders/1.use-gltf.md new file mode 100644 index 000000000..d3f45a473 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/1.use-gltf.md @@ -0,0 +1,92 @@ +--- +title: useGLTF +description: A composable to load GLTF models in TresJS scenes. +--- + +::SceneWrapper + ::LoadersGltf + :: +:: + +A composable that allows you to easily load glb/glTF models into your **TresJS** scene. + +## Usage + +::code-group +```vue{2,5} [TheModel.vue] + + + +``` + +```vue [app.vue] + + + +``` +:: + +An advantage of using `useGLTF` is that you can pass a `draco` prop to enable [Draco compression](https://threejs.org/docs/index.html?q=drac#examples/en/loaders/DRACOLoader) for the model. This will reduce the size of the model and improve performance. + +```ts +import { useGLTF } from '@tresjs/cientos' + +const { state, nodes, materials } = useGLTF('/models/AkuAku.gltf', { draco: true }) +``` + +## Return Values + +| Name | Type | Description | +| :----------- | --------- | ---------------------------------------------- | +| **state** | `GLTF` | The loaded GLTF model state | +| **nodes** | `object` | Computed object containing all nodes in the scene | +| **materials**| `object` | Computed object containing all materials in the scene | +| **isLoading**| `boolean` | Whether the model is currently loading | +| **progress** | `number` | The progress of the model loading | +| **load** | `() => Promise` | Function to reload the model | + +## Options + +| Name | Type | Default | Description | +| :-------------- | ---------- | ----------- | ------------------------------------ | +| **draco** | `boolean` | `false` | Whether to enable Draco compression. | +| **decoderPath** | `string` | `'https://www.gstatic.com/draco/versioned/decoders/1.5.6/'` | Path to the Draco decoder. | +| **traverse** | `Function` | | A traverse function applied to the scene upon loading the model. | + +## Accessing Nodes and Materials + +The composable provides computed properties to easily access nodes and materials in your scene: + +```ts +const { nodes, materials } = useGLTF('/model.glb') + +// Access a specific node +const mesh = nodes.value.MeshName + +// Access a specific material +const material = materials.value.MaterialName +``` + +This makes it easier to manipulate specific parts of your model or apply materials programmatically. diff --git a/apps/cientos-docs/content/2.api/3.loaders/2.gltf-model.md b/apps/cientos-docs/content/2.api/3.loaders/2.gltf-model.md new file mode 100644 index 000000000..4042234df --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/2.gltf-model.md @@ -0,0 +1,83 @@ +--- +title: GLTFModel +description: A component based on useGLTF to load models in TresJS scenes. +--- + +::SceneWrapper + ::LoadersGltf + :: +:: + +The `GLTFModel` component is a wrapper around [`useGLTF`](./use-gltf.md) composable and accepts the same options as props. + +## Usage + +::code-group +```vue{2,8} [TheModel.vue] + + + +``` + +```vue [app.vue] + + + +``` +:: + +## Model reference + +You can access the model reference by passing a `ref` to the `model` prop and then using to get the object. + +```vue + + + +``` + +## Props + +| Prop | Description | Default | +| :------------ | :-------------------------------------------------------------------------------------------------------------------- | ----------- | +| `path` | Path to the model file. | `undefined` | +| `draco` | Enable [Draco compression](https://threejs.org/docs/index.html?q=drac#examples/en/loaders/DRACOLoader) for the model. | `false` | +| `decoderPath` | Path to a local Draco decoder. | `undefined` | +| `castShadow` | Apply `cast-shadow` to all meshes inside your model. | `false` | +| `receiveShadow` | Apply `receive-shadow` to all meshes inside your model. | `false` | diff --git a/apps/cientos-docs/content/2.api/3.loaders/3.use-fbx.md b/apps/cientos-docs/content/2.api/3.loaders/3.use-fbx.md new file mode 100644 index 000000000..f0b6f3932 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/3.use-fbx.md @@ -0,0 +1,82 @@ +--- +title: useFBX +description: A composable to load FBX models in TresJS scenes. +--- + +::SceneWrapper + ::LoadersFbx + :: +:: + +A composable that allows you to easily load FBX models into your **TresJS** scene. + +## Usage + +::code-group +```vue{2,6} [TheModel.vue] + + + +``` + +```vue [app.vue] + + + +``` +:: + +## Return Values + +| Name | Type | Description | +| :----------- | --------- | ---------------------------------------------- | +| **state** | `Group` | The loaded FBX model state | +| **nodes** | `object` | Computed object containing all nodes in the scene | +| **materials**| `object` | Computed object containing all materials in the scene | +| **isLoading**| `boolean` | Whether the model is currently loading | +| **execute** | `() => Promise` | Function to reload the model | + +## Options + +| Name | Type | Description | +| :-------------- | ---------- | ------------------------------------------ | +| **traverse** | `Function` | A traverse function applied to the scene upon loading the model. | + +## Accessing Nodes and Materials + +The composable provides computed properties to easily access nodes and materials in your scene: + +```ts +const { nodes, materials } = useFBX('/model.fbx') + +// Access a specific node +const mesh = nodes.value.MeshName + +// Access a specific material +const material = materials.value.MaterialName +``` + +This makes it easier to manipulate specific parts of your model or apply materials programmatically. diff --git a/apps/cientos-docs/content/2.api/3.loaders/4.fbx-model.md b/apps/cientos-docs/content/2.api/3.loaders/4.fbx-model.md new file mode 100644 index 000000000..a167ab286 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/4.fbx-model.md @@ -0,0 +1,81 @@ +--- +title: FBXModel +description: A component based on useFBX to load models in TresJS scenes. +--- + +::SceneWrapper + ::LoadersFbx + :: +:: + +The `FBXModel` component is a wrapper around [`useFBX`](./use-fbx.md) composable and accepts the same options as props. + +## Usage + +::code-group +```vue{2,8} [TheModel.vue] + + + +``` + +```vue [app.vue] + + + +``` +:: + +## Model reference + +You can access the model reference by passing a `ref` to the `FBXModel` component and then using it to get the object. + +```vue + + + +``` + +## Props + +| Prop | Description | Default | +| :------------- | :--------------------------------------------------------- | ----------- | +| `path` | Path to the model file. | `undefined` | +| `castShadow` | Apply `cast-shadow` to all meshes inside your model. | `false` | +| `receiveShadow`| Apply `receive-shadow` to all meshes inside your model. | `false` | diff --git a/apps/cientos-docs/content/2.api/3.loaders/5.use-texture.md b/apps/cientos-docs/content/2.api/3.loaders/5.use-texture.md new file mode 100644 index 000000000..445362da7 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/5.use-texture.md @@ -0,0 +1,77 @@ +--- +title: useTexture +description: A composable to load textures in TresJS scenes. +--- + +::SceneWrapper + ::LoadersUseTexture + :: +:: + +A composable that allows you to load textures using the [THREE.js texture loader](https://threejs.org/docs/#api/en/loaders/TextureLoader) into your **TresJS** scene. + +## Usage + +```vue{2,4,10} + + + +``` + +## Options + +| Name | Type | Default | Description | +| :-------------- | --------- | ----------- | ------------------------------------ | +| **path** | `string` | `undefined` | The path to the texture. | +| **manager** | `THREE.LoadingManager` | `undefined` | The loading manager to use for the texture. | + +## Return Values + +| Name | Type | Description | +| :--- | :--- | :--- | +| `state` | `Texture \| null` | The loaded texture | +| `isLoading` | `boolean` | Whether the texture is loading | +| `error` | `string \| null` | Error message if loading failed | + +## Component Usage + +You can also use the `UseTexture` component directly in your template: + +```vue{2,16-21,26} + + + +``` diff --git a/apps/cientos-docs/content/2.api/3.loaders/6.use-textures.md b/apps/cientos-docs/content/2.api/3.loaders/6.use-textures.md new file mode 100644 index 000000000..2abcb2df8 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/6.use-textures.md @@ -0,0 +1,140 @@ +--- +title: useTextures +description: A composable to load multiple textures efficiently in TresJS scenes. +--- + +::SceneWrapper + ::LoadersUseTextures + :: +:: + +A composable that allows you to load multiple textures at once using the [THREE.js texture loader](https://threejs.org/docs/#api/en/loaders/TextureLoader) into your **TresJS** scene. + +## Usage + +```vue{2,12,19-21} + + + +``` + +## PBR Textures Example + +Here's a more advanced example showing how to load and apply PBR (Physically Based Rendering) textures to a material: + +```vue [PBRTextures.vue] + + + +``` + +## API + +### Parameters + +| Name | Type | Default | Description | +| :-------------- | --------- | ----------- | ------------------------------------ | +| **paths** | `string[]` | `undefined` | Array of paths to the textures. | + +### Returns + +| Name | Type | Description | +| :-------------- | --------- | ------------------------------------ | +| **textures** | `Texture[]` | Array of loaded textures. | +| **isLoading** | `boolean` | Whether any textures are still loading. | +| **error** | `Error[] \| null` | Array of errors if any occurred during loading. | + +## Benefits + +- **Simplified API**: Load multiple textures with a single function call +- **Consolidated loading state**: Track loading state for all textures at once +- **Unified error handling**: Collect and report errors from all texture loads +- **Type safety**: Proper TypeScript typing throughout the implementation diff --git a/apps/cientos-docs/content/2.api/3.loaders/7.use-svg.md b/apps/cientos-docs/content/2.api/3.loaders/7.use-svg.md new file mode 100644 index 000000000..87c84de54 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/7.use-svg.md @@ -0,0 +1,376 @@ +--- +title: useSVG +description: A composable to load and render SVG files as 3D geometry in TresJS scenes. +--- + +::SceneWrapper + ::LoadersUseSVG + :: +:: + +Load and display SVG elements in your **TresJS** scene. This guide covers both the `useSVG` composable for advanced use cases and the `SVG` component for simple declarative rendering. + +## useSVG Composable + +The `useSVG` composable provides direct access to processed SVG layers, giving you full control over the resulting geometries and materials. + +### Usage + +::code-group +```vue{2,5-8} [TheModel.vue] + + + +``` + +```vue [app.vue] + + + +``` +:: + +The `useSVG` composable provides direct access to processed SVG layers, giving you full control over how they're rendered. This is particularly useful when you need to: + +- Manually control layer rendering +- Apply custom animations to individual layers +- Access geometry data programmatically +- Implement complex material logic + +### SVG Data Sources + +The composable accepts both file paths and inline SVG strings: + +```ts +import { useSVG } from '@tresjs/cientos' + +// From file +const { layers } = useSVG('/path/to/file.svg') + +// Inline SVG string +const svgString = ` + +` +const { layers } = useSVG(svgString) +``` + +### Return Values + +| Name | Type | Description | +| :----------- | ------------- | ---------------------------------------------- | +| **state** | `SVGResult` | The loaded SVG state from SVGLoader | +| **layers** | `SVGLayer[]` | Computed array of processed geometries and materials | +| **isLoading**| `boolean` | Whether the SVG is currently loading | +| **dispose** | `() => void` | Function to dispose of all geometries | + +### Options + +| Name | Type | Default | Description | +| :---------------- | ----------------------------------------- | ------------- | ------------------------------------ | +| **skipStrokes** | `boolean` | `false` | Whether to skip rendering strokes | +| **skipFills** | `boolean` | `false` | Whether to skip rendering fills | +| **fillMaterial** | `MeshBasicMaterialParameters` | `{}` | Material properties for fill layers | +| **strokeMaterial**| `MeshBasicMaterialParameters` | `{}` | Material properties for stroke layers | +| **depth** | `'renderOrder' \| 'flat' \| 'offsetZ' \| number` | `'renderOrder'` | How layers should be rendered in 3D space | + +### Working with Layers + +The `layers` computed property returns an array of processed SVG elements, each containing: + +```ts +interface SVGLayer { + geometry: BufferGeometry // Three.js geometry for the layer + material: MeshBasicMaterialParameters // Material properties + isStroke: boolean // Whether this layer is a stroke or fill +} +``` + +#### Accessing Individual Layers + +```vue{2,4} + + + +``` + +### Depth Handling + +The `depth` option controls how SVG layers are rendered in 3D space. It accepts the following values: + +#### `'renderOrder'` (Default) + +**Use case: Lone SVGs or applications that don't rely on stacked SVGs** + +This is the default `depth` option. + +This value sets the materials' `depthWrite` to `false` and increments the mesh layers [`renderOrder`](https://threejs.org/docs/?q=mesh#api/en/core/Object3D.renderOrder). This makes the SVG layers render dependably regardless of perspective. + +**Disadvantage**: Scene objects may render out of order. + +SVG layers with higher [`renderOrder`](https://threejs.org/docs/?q=mesh#api/en/core/Object3D.renderOrder) will be rendered after (i.e., sometimes "on top of") other objects in the scene graph with a lower [`renderOrder`](https://threejs.org/docs/?q=mesh#api/en/core/Object3D.renderOrder). Depending on their settings, those other objects may render behind the SVG, even if they are closer to the camera. + +```ts +const { layers } = useSVG('/icon.svg', { depth: 'renderOrder' }) +``` + +#### flat + +**Use case: simple SVGs** + +This option sets the materials [`depthWrite`](https://threejs.org/docs/?q=mesh#api/en/materials/Material.depthWrite) to `false`. + +**Disadvantage**: SVG layers may render out of order. + +Overlapping layers in an SVG may be drawn out of order, depending on viewing perspective. + +```ts +const { layers } = useSVG('/icon.svg', { depth: 'flat' }) +``` + +#### offsetZ + +**Use case: unscaled SVGs seen from the front** + +When this value is passed, the result is a 3D "stack" of mesh layers. A small space is added between each mesh layer in the "stack". + +**Disadvantage**: "Bottom" of the "stack" is visible; layers may z-fight. + +When seen from behind, the "bottom" of the mesh layer "stack" is visible. The space between the layers may be noticeable depending on viewing perspective and scale. The layers may [z-fight](https://en.wikipedia.org/wiki/Z-fighting), particularly if the SVG is scaled down. + +```ts +const { layers } = useSVG('/icon.svg', { depth: 'offsetZ' }) +``` + +#### `number` + +**Use case: SVGs seen from the front** + +This is the same as `'offsetZ'` but allows you to specify how much space is added between each layer, in order to eliminate [z-fighting](https://en.wikipedia.org/wiki/Z-fighting). For most use cases, this should be a value greater than 0.025 and less than 1. + +**Disadvantage**: "Bottom" of the "stack" is visible. + +```ts +const { layers } = useSVG('/icon.svg', { depth: 0.1 }) +``` + +### Memory Management + +Always dispose of geometries when the component unmounts: + +```vue + +``` + +### Advanced Usage + +#### Conditional Layer Rendering + +```vue + + + +``` + +#### Material Customization per Layer + +```vue + + + +``` + +## UseSVG Component + +For simple, declarative SVG rendering without the need for programmatic control, you can use the `UseSVG` component: + +```vue + + + +``` + +### Props + +| Prop | Type | Description | Default | +| :------------------ | -------------------------------------------------| :----------------------------------------------------------------- | ------------- | +| **src** | `string` | Either a path to an SVG *or* an SVG string | | +| **skipStrokes** | `boolean` | If `true`, the SVG strokes will not be rendered. | `false` | +| **skipFills** | `boolean` | If `true`, the SVG fills will not be rendered. | `false` | +| **strokeMaterial** | `MeshBasicMaterialParameters` | Props to assign to the stroke materials of the resulting meshes. | `undefined` | +| **fillMaterial** | `MeshBasicMaterialParameters` | Props to assign to the fill materials of the resulting meshes. | `undefined` | +| **strokeMeshProps** | `TresOptions` | Props to assign to the resulting stroke meshes. | `undefined` | +| **fillMeshProps** | `TresOptions` | Props to assign to the resulting fill meshes. | `undefined` | +| **depth** | `'renderOrder' \| 'flat' \| 'offsetZ' \| number` | Specify how SVG layers are to be rendered. ([See "Depth"](#depth-handling)) | `renderOrder` | + +## Troubleshooting + +::alert{type="warning"} +This is not a general-purpose SVG renderer. Many SVG features are unsupported. +:: + +Here are some things to try if you run into problems: + +### Error: "XML Parsing Error: unclosed token" + +* In the SVG source, convert hex colors to rgb, e.g., convert `#ff0000` to `rgb(255, 0, 0)`. + +### Parts of the SVG render in the wrong order or disappear, depending on viewing angle + +* In your `useSVG` options, [change the `depth` option](#depth-handling). +* In the SVG source, use `fill="none"` rather than `fill-opacity="0"`. + +### Parts of the SVG ["z-fight"](https://en.wikipedia.org/wiki/Z-fighting) + +* In your `useSVG` options, [change the `depth` option](#depth-handling). +* Increase the distance between the SVG and other on-screen elements. + +### The SVG is not visible + +* If importing an SVG, make sure the path is correct – check the console for loading errors. +* Try scaling the SVG down, e.g., wrap it in a `TresGroup` with `:scale="0.01"`. +* Try moving the SVG up (+y), e.g., `:position="[0,2,0]"`. +* Check that `layers.length > 0` before rendering. + +### Performance issues with many layers + +* Use the `dispose()` function when components unmount to clean up geometries. +* Consider using `skipStrokes` or `skipFills` to reduce the number of rendered layers. +* For complex SVGs with many layers, consider simplifying the SVG source. + +## When to Use `useSVG` vs `SVG` Component + +**Use `useSVG` when you need:** +- Direct access to individual SVG layers +- Custom rendering logic +- Layer-specific animations +- Programmatic geometry manipulation +- Advanced material customization per layer + +**Use the `SVG` component when you need:** +- Simple, declarative SVG rendering +- Quick prototyping +- Standard SVG display without custom logic +- Less code and setup diff --git a/apps/cientos-docs/content/2.api/3.loaders/index.md b/apps/cientos-docs/content/2.api/3.loaders/index.md new file mode 100644 index 000000000..a3a8be4d2 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/index.md @@ -0,0 +1,7 @@ +--- +title: Loaders +description: Asset loading composables for TresJS scenes. +--- + +::ApiList{listName="loaders-list"} +:: diff --git a/apps/cientos-docs/content/2.api/3.loaders/use-progress.md b/apps/cientos-docs/content/2.api/3.loaders/use-progress.md new file mode 100644 index 000000000..e5d332348 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/use-progress.md @@ -0,0 +1,65 @@ +--- +title: useProgress +description: A composable to track loading progress of assets in TresJS scenes. +--- + +A composable to convenience wrap `THREE.DefaultLoadingManager` and returns the progress of the loading assets into the scene. + +This comes handy to show an HTML loading bar or a spinner while the assets are being loaded. + +## Usage + +```ts +import { useProgress } from '@tresjs/cientos' + +const { hasFinishLoading, progress, items } = await useProgress() +``` + +Then you can use the `progress` value to show a loading bar or a spinner: + +```vue + +``` + +::alert{type="warning"} +This component use top level await. Please check the [Suspense API](https://vuejs.org/guide/built-ins/suspense.html#suspense) for more info +:: + +## Return Values + +| Name | Type | Description | +| :--- | :--- | :--- | +| `hasFinishLoading` | `boolean` | Whether all items have finished loading | +| `progress` | `number` | Loading progress as percentage (0-100) | +| `items` | `Array` | Array of loading items with their status | + +::prose-warning +This component use top level await it needs to be wrapped on a [`Suspense`](https://vuejs.org/guide/built-ins/suspense.html#suspense). Please check the [`Suspense API`](https://vuejs.org/guide/built-ins/suspense.html#suspense) for more info +:: diff --git a/apps/cientos-docs/content/2.api/3.loaders/use-video-texture.md b/apps/cientos-docs/content/2.api/3.loaders/use-video-texture.md new file mode 100644 index 000000000..b44782fa0 --- /dev/null +++ b/apps/cientos-docs/content/2.api/3.loaders/use-video-texture.md @@ -0,0 +1,72 @@ +--- +title: useVideoTexture +description: A composable to load video textures in TresJS scenes. +--- + +::SceneWrapper + ::LoadersUseVideoTexture + :: +:: + +A composable to easily use videos as textures in your meshes. + +This composable is based on the Drei [useVideoTexture](https://github.com/pmndrs/drei/tree/master#usevideotexture) + +## Usage + +::code-group +```vue [app.vue] + + + +``` + +```vue{3,8,13} [TheVideoTexture.vue] + + + +``` +:: + +## Props + +| Prop | Description | Default | +| :------------ | :----------------------------------------------------------------------- | ---------------- | +| `src` | Path to the video. | `undefined` | +| `unsuspend` | Path to the model file. | `loadedmetadata` | +| `crossOrigin` | Whether to use CORS to fetch the related video. | `Anonymous` | +| `muted` | Whether to set the audio silenced. | true | +| `loop` | Automatically seek back to the start upon reaching the end of the video. | true | +| `start` | To play to the video once loaded or not. | true | +| `playsInline` | To be play the video inline or not. | true | + +- Any other attribute for a `