Skip to content

Commit 6131e41

Browse files
committedMar 14, 2024
feat(cientos/positional-audio): start writing documentation
1 parent a036caa commit 6131e41

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
 

‎docs/.vitepress/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default defineConfig({
6565
{ text: 'useFBO', link: '/guide/abstractions/use-fbo' },
6666
{ text: 'useSurfaceSampler', link: '/guide/abstractions/use-surface-sampler' },
6767
{ text: 'Sampler', link: '/guide/abstractions/sampler' },
68+
{ text: 'Positional Audio', link: '/guide/abstractions/positional-audio' },
6869
],
6970
},
7071
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
import { TresCanvas } from '@tresjs/core'
3+
import { OrbitControls } from '@tresjs/cientos'
4+
</script>
5+
6+
<template>
7+
<TresCanvas clear-color="#F78B3D">
8+
<TresPerspectiveCamera :position="[3, 2, 5]" />
9+
<OrbitControls />
10+
11+
<TresAmbientLight :intensity="1" />
12+
</TresCanvas>
13+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Positional Audio
2+
3+
<DocsDemo>
4+
<PositionalAudioDemo />
5+
</DocsDemo>
6+
7+
The `cientos` package provides an abstraction of the [PositionalAudio](https://threejs.org/docs/index.html?q=posi#api/en/audio/PositionalAudio), `<PositionalAudio>` is an object specifically designed for controlling sound in a scene graph space. This allows for the simulation of various audio environments, creating a more immersive user experience.
8+
9+
`<PositionalAudio>` includes a helper 🛠️ that allows you to view the directional cone of te audio. The helper is based on the [PositionalAudioHelper](https://threejs.org/docs/#examples/en/helpers/PositionalAudioHelper) class.
10+
11+
::: info
12+
This component is still under development, so please report any problems or suggestions on the [@tresjs/cientos](https://github.com/Tresjs/cientos) repository on GitHub.
13+
:::
14+
15+
## Usage
16+
17+
::: info
18+
19+
:::
20+
21+
::: warning
22+
23+
:::
24+
25+
### Minimal
26+
27+
The minimal version is very easy to set up: you just need to insert a `<Decal>` component with a map props for the Texture and a call to `v-bind`.
28+
29+
*The default material is [MeshBasicMaterial](https://threejs.org/docs/#api/en/materials/MeshBasicMaterial)*.
30+
31+
<DocsDemo>
32+
<PositionalAudioDemo />
33+
</DocsDemo>
34+
35+
<<< @/.vitepress/theme/components/PositionalAudioDemo.vue{3-4,6-7,16-17}
36+
37+
See [decalsDatas](#decal-datas) part to see the contents of the Decal's datas object of the demo.
38+
39+
### V-For
40+
Description
41+
42+
Demo
43+
44+
Code
45+
46+
## Props
47+
48+
| Prop | Description | Default |
49+
| :---------------- | :--------------------------------------------------- | ------------------------- |
50+
| **debug** | `boolean` — Debug mode (Useful for positioning Decal) | `false` |
51+
| **map** | [`Texture`](https://threejs.org/docs/#api/en/textures/Texture) or `null` — The color map. The map should be applied to the `<Decal>` when no material is applied as a child. (See [usages](#usage) for more details) | `null` |
52+
| **mesh** | [`Mesh`](https://threejs.org/docs/#api/en/objects/Mesh) or `null` — Define the surface to which the decal must attach using the mesh prop. (See [Mesh Prop](#mesh-prop) part for more details) | `null` |
53+
| **position** | `number[]` — Position of the decal. Transformed into [`Vector3`](https://threejs.org/docs/#api/en/math/Vector3) | `[-9999,-9999,-9999]` |
54+
| **orientation** | `number[]` — Orientation of the decal. Transformed into [`Euler`](https://threejs.org/docs/#api/en/math/Euler) | `[0,0,0]` |
55+
| **size** | `number[]` — Size of the decal. Transformed into [`Vector3`](https://threejs.org/docs/#api/en/math/Vector3) | `[1,1,1]` |
56+
| **normal** | `number[]` — Normal of the decal. Transformed into [`Vector3`](https://threejs.org/docs/#api/en/math/Vector3) | `[0,0,0]` |
57+
| **polygonOffsetFactor** | `number` — Sets the polygon offset factor | `-10` |
58+
| **depthTest** | `boolean` — Whether to have depth test enabled when rendering this material. | `true` |
59+
| **depthWrite** | `boolean` — Whether rendering this material has any effect on the depth buffer. | `false` |
60+
| **order** | `number` — This value allows the default rendering order of scene graph objects to be overridden although opaque and transparent objects remain sorted independently. <br /> **Sorting is from lowest to highest.** | `Math.round(Math.random() * 100)` |

0 commit comments

Comments
 (0)
Please sign in to comment.