Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { Box, OrbitControls, Smoke } from '@tresjs/cientos'
import { Box, Smoke } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { NoToneMapping, SRGBColorSpace } from 'three'


const gl = {
clearColor: '#333',
alpha: true,
Expand All @@ -12,53 +13,22 @@ const gl = {
</script>

<template>
<TresCanvas
v-bind="gl"
>
<TresPerspectiveCamera :position="[0, 2, 5]" />
<Suspense>
<Smoke
:segments="4"
:width="1"
:position="[-4, -2, 0]"
/>
</Suspense>
<Suspense>
<Smoke
:segments="4"
:width="1"
:position="[-4, 2, 0]"
/>
</Suspense>
<Suspense>
<Smoke
:segments="4"
:width="1"
/>
</Suspense>
<Suspense>
<Smoke
:segments="4"
:width="1"
:position="[4, -2, 0]"
/>
</Suspense>
<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[0, 2, 5]" :look-at="[0,0,0]" />
<Suspense>
<Smoke
:segments="4"
:width="1"
:position="[4, 2, 0]"
:segments="10"
:depth-test="true"
:spreadY="2"
:spreadX="2"
:scale="5"
/>
</Suspense>
<Box :args="[2, 2]">
<TresMeshToonMaterial color="#82DBC5" />
<TresMeshToonMaterial color="#82DBC5" wireframe />
</Box>
<TresGridHelper :args="[10, 10]" />
<TresAmbientLight :intensity="1" />
<TresDirectionalLight
:intensity="1"
:position="[2, 2, 2]"
/>
<OrbitControls />
<TresDirectionalLight :intensity="1" :position="[2, 2, 2]" />
</TresCanvas>
</template>
31 changes: 22 additions & 9 deletions apps/cientos-docs-vitepress/guide/staging/smoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,25 @@ Notice that you can pass a texture in combination with props, to personalize yo
```
## Props

<table><thead><tr class="row-header"><th class="col-name">Name</th><th class="col-type">Type</th><th class="col-description">Description</th><th class="col-default">Default</th><th class="col-required">Required</th></tr></thead><tbody><tr class="row-color"><td class="col-name"><strong><nobr>color</nobr></strong></td><td class="col-type"><code>TresColor</code></td><td class="col-description">The color of the smoke.<br>
</td><td class="col-default"><code>'#ffffff'</code></td><td class="col-required">No</td></tr><tr class="row-opacity"><td class="col-name"><strong><nobr>opacity</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The strength of the opacity.<br>
</td><td class="col-default"><code>0.5</code></td><td class="col-required">No</td></tr><tr class="row-speed"><td class="col-name"><strong><nobr>speed</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The rotation speed of the smoke.<br>
</td><td class="col-default"><code>0.4</code></td><td class="col-required">No</td></tr><tr class="row-width"><td class="col-name"><strong><nobr>width</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The base width.<br>
</td><td class="col-default"><code>10</code></td><td class="col-required">No</td></tr><tr class="row-depth"><td class="col-name"><strong><nobr>depth</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The base depth.<br>
</td><td class="col-default"><code>1.5</code></td><td class="col-required">No</td></tr><tr class="row-segments"><td class="col-name"><strong><nobr>segments</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The number of smoke to render.<br>
</td><td class="col-default"><code>20</code></td><td class="col-required">No</td></tr><tr class="row-texture"><td class="col-name"><strong><nobr>texture</nobr></strong></td><td class="col-type"><code>string</code></td><td class="col-description">The texture of the smoke.<br>
</td><td class="col-default">default component texture</td><td class="col-required">No</td></tr><tr class="row-depth-test"><td class="col-name"><strong><nobr>depthTest</nobr></strong></td><td class="col-type"><code>boolean</code></td><td class="col-description">The depthTest.<br>
</td><td class="col-default"><code>true</code></td><td class="col-required">No</td></tr></tbody></table>
<table><thead><tr class="row-header"><th class="col-name">Name</th><th class="col-type">Type</th><th class="col-description">Description</th><th class="col-default">Default</th></tr></thead><tbody>
<tr class="row-color"><td class="col-name"><strong><nobr>color</nobr></strong></td><td class="col-type"><code>TresColor</code></td><td class="col-description">The color of the smoke.<br>
</td><td class="col-default"><code>'#f7f7f7'</code></td></tr>
<tr class="row-opacity"><td class="col-name"><strong><nobr>opacity</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The strength of the opacity.<br>
</td><td class="col-default"><code>0.5</code></td></tr>
<tr class="row-speed"><td class="col-name"><strong><nobr>speed</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The rotation speed of the smoke.<br>
</td><td class="col-default"><code>0.4</code></td></tr>
<tr class="row-depth"><td class="col-name"><strong><nobr>depth</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The base depth.<br>
</td><td class="col-default"><code>0.3</code></td></tr>
<tr class="row-segments"><td class="col-name"><strong><nobr>segments</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">The number of smoke to render.<br>
</td><td class="col-default"><code>10</code></td></tr>
<tr class="row-texture"><td class="col-name"><strong><nobr>texture</nobr></strong></td><td class="col-type"><code>string</code></td><td class="col-description">The texture of the smoke.<br>
</td><td class="col-default"><code> <a href="https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png" target="_blank" >link </a></code></td></tr>
<tr class="row-depth-test"><td class="col-name"><strong><nobr>depthTest</nobr></strong></td><td class="col-type"><code>boolean</code></td><td class="col-description">The depthTest.<br>
</td><td class="col-default"><code>false</code></td></tr>
<tr class="row-spread-y"><td class="col-name"><strong><nobr>spreadY</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">Spread on the Y axis.<br>
</td><td class="col-default"><code>0.1</code></td></tr>
<tr class="row-spread-x"><td class="col-name"><strong><nobr>spreadX</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">Spread on the X axis.<br>
</td><td class="col-default"><code>0.5</code></td></tr>
<tr class="row-scale"><td class="col-name"><strong><nobr>scale</nobr></strong></td><td class="col-type"><code>number</code></td><td class="col-description">Scale.<br>
</td><td class="col-default"><code>1</code></td></tr>
</tbody></table>
117 changes: 86 additions & 31 deletions apps/playground/src/pages/cientos/staging/SmokeDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,79 @@
import { Box, OrbitControls, Smoke } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { NoToneMapping, SRGBColorSpace } from 'three'
import { TresLeches, useControls } from '@tresjs/leches'

const {
segments,
opacity,
speed,
depth,
color,
depthTest,
spreadY,
spreadX,
scale,
} = useControls({
segments: {
label: 'Segments',
value: 5,
min: 1,
max: 20,
step: 1,
},
opacity: {
label: 'Opacity',
value: 0.5,
min: 0,
max: 1,
step: 0.1,
},
speed: {
label: 'Speed',
value: 0.4,
min: 0,
max: 1,
step: 0.1,
},
depth: {
label: 'Depth',
value: 0.3,
min: 0,
max: 1,
step: 0.1,
},
color: {
type: 'color',
label: 'Color',
value: '#f7f7f7',
},
depthTest: {
type: 'boolean',
label: 'Depth Test',
value: false,
},
spreadY: {
label: 'Spread Y',
value: 0.1,
min: 0,
max: 4,
step: 0.1,
},
spreadX: {
label: 'Spread X',
value: 0.5,
min: 0,
max: 4,
step: 0.1,
},
scale: {
label: 'Scale',
value: 1,
min: 0.1,
max: 4,
step: 0.1,
},
})

const gl = {
clearColor: '#333',
Expand All @@ -12,46 +85,28 @@ const gl = {
</script>

<template>
<TresCanvas
v-bind="gl"
>
<TresLeches />
<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[0, 2, 5]" />
<Suspense>
<Smoke
:position="[-4, -2, 0]"
:segments="8"
/>
</Suspense>
<Suspense>
<Smoke
:position="[-4, 2, 0]"
:segments="8"
/>
</Suspense>
<Suspense>
<Smoke :segments="8" />
</Suspense>
<Suspense>
<Smoke
:position="[4, -2, 0]"
:segments="8"
/>
</Suspense>
<Suspense>
<Smoke
:position="[4, 2, 0]"
:segments="8"
:segments="segments"
:opacity="opacity"
:speed="speed"
:depth="depth"
:color="color"
:depth-test="depthTest"
:spreadY="spreadY"
:spreadX="spreadX"
:scale="scale"
/>
</Suspense>
<Box :args="[2, 2]">
<TresMeshToonMaterial color="#82DBC5" />
<TresMeshToonMaterial color="#82DBC5" wireframe />
</Box>
<TresGridHelper :args="[10, 10]" />
<TresAmbientLight :intensity="1" />
<TresDirectionalLight
:intensity="1"
:position="[2, 2, 2]"
/>
<TresDirectionalLight :intensity="1" :position="[2, 2, 2]" />
<OrbitControls />
</TresCanvas>
</template>
Loading
Loading