Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sub modules for pmndrs and native components #123

Merged
merged 61 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e191856
added EffectComposer and some debugging files
Tinoooo Jul 13, 2024
6e3cf34
wip
Tinoooo Jul 14, 2024
d277639
added composable
Tinoooo Aug 18, 2024
b70f78c
cleanup
Tinoooo Aug 18, 2024
dba098d
added more props to native pixelation effect
Tinoooo Sep 4, 2024
82d2b32
restructured playground
Tinoooo Sep 4, 2024
3126c09
added glitch Effect
Tinoooo Sep 4, 2024
00f8b52
added glitch effect
Tinoooo Sep 4, 2024
d32515b
renamed folder
Tinoooo Sep 4, 2024
377a650
added check to prevent console warning
Tinoooo Sep 5, 2024
37f1ab6
added smaa effect
Tinoooo Sep 5, 2024
5d3b1c3
added output pass
Tinoooo Sep 5, 2024
546c044
moved injectionKey
Tinoooo Sep 5, 2024
653b738
added prop to EffectComposer
Tinoooo Sep 5, 2024
a7efcc2
added halftone effect
Tinoooo Sep 5, 2024
8f51ca2
added unreal bloom effect
Tinoooo Sep 5, 2024
25fb3e8
removed obsolete computed
Tinoooo Sep 5, 2024
b3c0ad6
added on demand rendering support
Tinoooo Sep 6, 2024
147578d
lint fixes
Tinoooo Sep 8, 2024
09252e8
added enabled prop to effect composer component
Tinoooo Sep 8, 2024
a0db261
removed obsolete code
Tinoooo Sep 8, 2024
cf6e56a
eslint stuff
Tinoooo Sep 8, 2024
683a958
rebuilt pnpm lock file
Tinoooo Sep 8, 2024
8828ff6
moved files
Tinoooo Sep 8, 2024
7beca03
type fixes and removed dependency
Tinoooo Sep 8, 2024
b09de6b
Merge remote-tracking branch 'origin/main' into feature/113-native-th…
Tinoooo Sep 8, 2024
37a398f
seperated builds
Tinoooo Sep 9, 2024
dede696
fixed playground
Tinoooo Sep 9, 2024
4f58d63
adjusted imports in docs
Tinoooo Sep 9, 2024
ecd07d7
adjusted more imports
Tinoooo Sep 9, 2024
a85df87
added pkg pr workflow
Tinoooo Sep 10, 2024
6743b03
added repository url to package.json
Tinoooo Sep 10, 2024
ab80355
omitted compact option from pkg-pr-new
Tinoooo Sep 10, 2024
af81538
renamed import
Tinoooo Sep 10, 2024
2f27668
adjusted vite config
Tinoooo Sep 10, 2024
6d3e9ed
Merge branch 'main' into feature/122-sub-modules-for-pmndrs-and-nativ…
alvarosabu Sep 11, 2024
d484912
added HalftoneShape enum
Tinoooo Sep 12, 2024
8e9c534
added invalidation on pass changes for native three effects
Tinoooo Sep 12, 2024
76c2a7f
added invalidation on prop change for pmndrs effects
Tinoooo Sep 12, 2024
eae5045
added renderer invalidation to glitch effects
Tinoooo Sep 22, 2024
5e6c82c
removed disableRender prop
Tinoooo Sep 22, 2024
a1dce75
tiny readme update
Tinoooo Sep 26, 2024
73fb84d
Merge remote-tracking branch 'origin/main' into feature/122-sub-modul…
Tinoooo Sep 26, 2024
d087c66
auto created files update
Tinoooo Sep 26, 2024
b741cd2
lint fix
Tinoooo Sep 26, 2024
dba4a70
lint fix
Tinoooo Sep 26, 2024
b812099
docs: fixed broken docs, added new structure
alvarosabu Sep 28, 2024
141847a
docs: three glitch guide
alvarosabu Oct 4, 2024
09ba0af
docs: pixelation three
alvarosabu Oct 4, 2024
b683fa0
docs: correct glitch demo component name
alvarosabu Oct 4, 2024
3755b76
docs: halftone
alvarosabu Oct 4, 2024
9f29687
docs: smaa
alvarosabu Oct 4, 2024
1250852
docs: unreal bloom
alvarosabu Oct 4, 2024
ab4531c
added some links to threejs examples
Tinoooo Oct 12, 2024
e825cbb
added output pass docs
Tinoooo Oct 12, 2024
b199839
eslint ignored a console output
Tinoooo Oct 12, 2024
1e51111
dependency updates
Tinoooo Oct 12, 2024
d414f5c
Update docs/guide/three/glitch.md
alvarosabu Oct 12, 2024
8fd88e0
Update docs/guide/three/glitch.md
alvarosabu Oct 12, 2024
9ebb62f
docs: remove redundant info
alvarosabu Oct 12, 2024
c7cfabb
Merge branch 'feature/122-sub-modules-for-pmndrs-and-native-component…
alvarosabu Oct 12, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Any Commit
on:
push:
branches:
- '**'
tags:
- '!**'

env:
PNPM_CACHE_FOLDER: .pnpm-store

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- run: pnpm dlx pkg-pr-new publish --pnpm
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ And then to run the development server on http://localhost:5173
pnpm run playground
```

### Test

TODO...

### Docs

To run de docs in dev mode
Expand Down
3 changes: 0 additions & 3 deletions docs/.eslintrc.json

This file was deleted.

31 changes: 21 additions & 10 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,25 @@ export default defineConfig({
items: [{ text: 'Introduction', link: '/guide/' }],
},
{
text: 'Effects',
text: 'Pmndrs',
items: [
{ text: 'Bloom', link: '/guide/effects/bloom' },
{ text: 'Depth of Field', link: '/guide/effects/depth-of-field' },
{ text: 'Glitch', link: '/guide/effects/glitch' },
{ text: 'Noise', link: '/guide/effects/noise' },
{ text: 'Outline', link: '/guide/effects/outline' },
{ text: 'Pixelation', link: '/guide/effects/pixelation' },
{ text: 'Vignette', link: '/guide/effects/vignette' },
{ text: 'Bloom', link: '/guide/pmndrs/bloom' },
{ text: 'Depth of Field', link: '/guide/pmndrs/depth-of-field' },
{ text: 'Glitch', link: '/guide/pmndrs/glitch' },
{ text: 'Noise', link: '/guide/pmndrs/noise' },
{ text: 'Outline', link: '/guide/pmndrs/outline' },
{ text: 'Pixelation', link: '/guide/pmndrs/pixelation' },
{ text: 'Vignette', link: '/guide/pmndrs/vignette' },
],
},
{
text: 'Three',
items: [
{ text: 'Glitch', link: '/guide/three/glitch' },
{ text: 'Halftone', link: '/guide/three/halftone' },
{ text: 'SMAA', link: '/guide/three/smaa' },
{ text: 'Pixelation', link: '/guide/three/pixelation' },
{ text: 'Unreal Bloom', link: '/guide/three/unreal-bloom' },
],
},
],
Expand All @@ -78,9 +88,10 @@ export default defineConfig({
},
resolve: {
alias: {
'@tresjs/post-processing': resolve(__dirname, '../../dist/tres-postprocessing.js'),
'@tresjs/post-processing/three': resolve(__dirname, '../../src/core/three'),
'@tresjs/post-processing/pmndrs': resolve(__dirname, '../../src/core/pmndrs'),
},
dedupe: ['three'],
dedupe: ['three', '@tresjs/core'],
},
},
vue: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { Bloom, EffectComposer } from '@tresjs/post-processing'
import { Bloom, EffectComposer } from '@tresjs/post-processing/pmndrs'
import { BlendFunction } from 'postprocessing'
import { Color } from 'three'
import { reactive } from 'vue'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

const gl = {
clearColor: '#121212',
Expand All @@ -19,7 +19,6 @@ const bloomParams = reactive({
mipmapBlur: true,
intensity: 8,
radius: 0.5,
disableRender: true,
blendFunction: BlendFunction.ADD,
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts" setup>
import { TresCanvas } from '@tresjs/core'
import { DepthOfField, EffectComposer } from '@tresjs/post-processing'
import { DepthOfField, EffectComposer } from '@tresjs/post-processing/pmndrs'
import { gsap } from 'gsap'
import { ref } from 'vue'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

const dofEffect = ref<InstanceType<typeof DepthOfField> | null>(null)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<script setup lang="ts">
import { Text3D } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { EffectComposer, Glitch } from '@tresjs/post-processing'
import { EffectComposer, Glitch } from '@tresjs/post-processing/pmndrs'

import { Color } from 'three'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

const gl = {
clearColor: '#121212',
shadows: true,
alpha: false,
disableRender: true,
}

// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components
Expand All @@ -22,7 +21,7 @@ const { effectComposer } = useRouteDisposal()
<TresCanvas v-bind="gl">
<TresPerspectiveCamera
:position="[0, 1, 5]"
:look-at="[0, 0, 0]"
:look-at="[0, 1, 0]"
/>
<Suspense>
<Text3D
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { EffectComposer, Noise } from '@tresjs/post-processing'
import { EffectComposer, Noise } from '@tresjs/post-processing/pmndrs'
import { BlendFunction } from 'postprocessing'
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

const gl = {
clearColor: '#82DBC5',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<script lang="ts" setup>
import type { Intersection, Object3D } from 'three'
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { TresLeches, useControls } from '@tresjs/leches'
import { EffectComposer, Outline } from '@tresjs/post-processing'
import { EffectComposer, Outline } from '@tresjs/post-processing/pmndrs'
import { KernelSize } from 'postprocessing'
import { NoToneMapping } from 'three'

import { ref } from 'vue'
import { useRouteDisposal } from '../composables/useRouteDisposal'

import { useRouteDisposal } from '../../composables/useRouteDisposal'

import '@tresjs/leches/styles'

const gl = {
clearColor: '#121212',
toneMapping: NoToneMapping,
disableRender: true,
}

const { effectComposer } = useRouteDisposal()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { EffectComposer, Pixelation } from '@tresjs/post-processing'
import { EffectComposer, Pixelation } from '@tresjs/post-processing/pmndrs'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components
const { effectComposer } = useRouteDisposal()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { DepthOfField, EffectComposer, Vignette } from '@tresjs/post-processing'
import { DepthOfField, EffectComposer, Vignette } from '@tresjs/post-processing/pmndrs'
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'

import { useRouteDisposal } from '../composables/useRouteDisposal'
import { useRouteDisposal } from '../../composables/useRouteDisposal'

import BlenderCube from './BlenderCube.vue'
import BlenderCube from '../BlenderCube.vue'

const gl = {
clearColor: '#4f4f4f',
Expand All @@ -30,15 +30,8 @@ const { effectComposer } = useRouteDisposal()
<BlenderCube />
</Suspense>
<EffectComposer ref="effectComposer">
<DepthOfField
:focus-distance="0"
:focal-length="0.02"
:bokeh-scale="2"
/>
<Vignette
:darkness="0.9"
:offset="0.3"
/>
<DepthOfField :focus-distance="0" :focal-length="0.02" :bokeh-scale="2" />
<Vignette :darkness="0.9" :offset="0.3" />
</EffectComposer>
<TresAmbientLight :intensity="1" />
</TresCanvas>
Expand Down
52 changes: 52 additions & 0 deletions docs/.vitepress/theme/components/three/GlitchThreeDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<script setup lang="ts">
import { Text3D } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { EffectComposer, Glitch } from '@tresjs/post-processing/three'

import { Color } from 'three'

import { useRouteDisposal } from '../../composables/useRouteDisposal'

const gl = {
clearColor: '#121212',
shadows: true,
alpha: false,
}

// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components
const { effectComposer } = useRouteDisposal()
</script>

<template>
<TresCanvas v-bind="gl">
<TresPerspectiveCamera
:position="[0, 1, 5]"
:look-at="[0, 1, 0]"
/>
<Suspense>
<Text3D
:position="[0, 1, 0]"
text="Three glitch"
font="https://raw.githubusercontent.com/Tresjs/assets/main/fonts/FiraCodeRegular.json"
>
<TresMeshStandardMaterial
color="hotpink"
:emissive="new Color('hotpink')"
:emissive-intensity="1.2"
/>
</Text3D>
</Suspense>
<TresGridHelper />

<TresAmbientLight :intensity="2" />
<TresDirectionalLight
:position="[3, 3, 3]"
:intensity="1"
/>
<Suspense>
<EffectComposer ref="effectComposer">
<Glitch />
</EffectComposer>
</Suspense>
</TresCanvas>
</template>
54 changes: 54 additions & 0 deletions docs/.vitepress/theme/components/three/HalftoneThreeDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<script lang="ts" setup>
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { EffectComposer, Halftone } from '@tresjs/post-processing/three'

import { useRouteDisposal } from '../../composables/useRouteDisposal'

// Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components
const { effectComposer } = useRouteDisposal()
</script>

<template>
<TresCanvas
clear-color="#121212"
:alpha="false"
:shadows="true"
>
<TresPerspectiveCamera
:position="[3, 2, 4]"
:look-at="[0, 0, 0]"
/>
<OrbitControls />
<TresMesh
:position="[1, 0.5, 1]"
>
<TresBoxGeometry />
<TresMeshStandardMaterial
color="hotpink"
/>
</TresMesh>
<TresMesh
:position="[-1.5, 0.75, 0]"
>
<TresConeGeometry :args="[1, 1.5, 4, 1, false, Math.PI * 0.25]" />
<TresMeshNormalMaterial />
<TresMeshStandardMaterial
color="aqua"
/>
</TresMesh>

<TresGridHelper />
<TresAmbientLight :intensity="0.9" />
<TresDirectionalLight
:position="[-10, 5, 8]"
:intensity="2"
/>

<Suspense>
<EffectComposer ref="effectComposer">
<Halftone :shape="1" :radius="4" :rotateR="Math.PI / 12" :rotateG="Math.PI / 3" :rotateB="Math.PI / 6" :scatter="0" :blending="1" :greyscale="false" />
</EffectComposer>
</Suspense>
</TresCanvas>
</template>
Loading