diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 3689f806..daed9210 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -61,6 +61,7 @@ export default defineConfig({ { text: 'Hue & Saturation', link: '/guide/pmndrs/hue-saturation' }, { text: 'Lens Distortion', link: '/guide/pmndrs/lens-distortion' }, { text: 'Grid', link: '/guide/pmndrs/grid' }, + { text: 'ASCII', link: '/guide/pmndrs/ascii' }, { text: 'FXAA', link: '/guide/pmndrs/fxaa' }, { text: 'SMAA', link: '/guide/pmndrs/smaa' }, { text: 'Kuwahara', link: '/guide/pmndrs/kuwahara' }, diff --git a/docs/.vitepress/theme/components/pmdrs/ASCIIDemo.vue b/docs/.vitepress/theme/components/pmdrs/ASCIIDemo.vue new file mode 100644 index 00000000..ef9239a9 --- /dev/null +++ b/docs/.vitepress/theme/components/pmdrs/ASCIIDemo.vue @@ -0,0 +1,96 @@ + + + diff --git a/docs/components.d.ts b/docs/components.d.ts index 680367d8..4f521f37 100644 --- a/docs/components.d.ts +++ b/docs/components.d.ts @@ -7,6 +7,7 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + ASCIIDemo: typeof import('./.vitepress/theme/components/pmdrs/ASCIIDemo.vue')['default'] BarrelBlurDemo: typeof import('./.vitepress/theme/components/pmdrs/BarrelBlurDemo.vue')['default'] BlenderCube: typeof import('./.vitepress/theme/components/BlenderCube.vue')['default'] BloomDemo: typeof import('./.vitepress/theme/components/pmdrs/BloomDemo.vue')['default'] diff --git a/docs/guide/pmndrs/ascii.md b/docs/guide/pmndrs/ascii.md new file mode 100644 index 00000000..b33748c5 --- /dev/null +++ b/docs/guide/pmndrs/ascii.md @@ -0,0 +1,71 @@ +# ASCII + + + + + +
+ Demo code + + <<< @/.vitepress/theme/components/pmdrs/ASCIIDemo.vue{0} +
+ +The `ASCIIEffect` effect is part of the [`postprocessing`](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/ASCIIEffect.js~ASCIIEffect.html) package. +This effect transforms the visual output into a grid of ASCII characters, offering a unique and artistic way to display 3D content. The ASCII characters used can be customized, allowing for a wide range of creative possibilities. + +## Usage + +The `` component is straightforward to integrate and offers a variety of customizable properties, allowing you to adapt it to diverse artistic and visual requirements. + +```vue{2,12-17,29-33} + + + +``` + +## Props + +| Prop | Description | Default | +| -------------- | ----------------------------------------------------------------------------------------------- | --------------------------- | +| blendFunction | Defines how the effect blends with the original scene. See the [`BlendFunction`](https://pmndrs.github.io/postprocessing/public/docs/variable/index.html#static-variable-BlendFunction) options. | `BlendFunction.NORMAL` | +| opacity | The opacity of the effect. | `1.0` | +| cellSize | The size of the ASCII grid cells. | `16` | +| inverted | Controls whether the effect should be inverted. | `false` | +| color | The color of the effect. Can be a [`Color`](https://threejs.org/docs/#api/en/math/Color), `string`, `number`, or `null`. If set to `null`, the colors of the scene will be used. | `null` | +| useSceneColor | Controls whether the effect should use the scene color. If `true`, overrides the `color` prop. | `false` | +| asciiTexture | Options for creating an ASCIITexture instance. | See the [`ASCIITexture`](https://pmndrs.github.io/postprocessing/public/docs/class/src/textures/ASCIITexture.js~ASCIITexture.html) documentation. | + +## Further Reading +For more details, see the [ASCIIEffect documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/ASCIIEffect.js~ASCIIEffect.html) diff --git a/package.json b/package.json index 35cb1081..12990611 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ }, "dependencies": { "@vueuse/core": "^12.5.0", - "postprocessing": "^6.36.6" + "postprocessing": "^6.37.2" }, "devDependencies": { "@release-it/conventional-changelog": "^10.0.0", diff --git a/playground/src/pages/postprocessing/ascii.vue b/playground/src/pages/postprocessing/ascii.vue new file mode 100644 index 00000000..c334ab89 --- /dev/null +++ b/playground/src/pages/postprocessing/ascii.vue @@ -0,0 +1,79 @@ + + + diff --git a/playground/src/router.ts b/playground/src/router.ts index adf6eda2..696e1e76 100644 --- a/playground/src/router.ts +++ b/playground/src/router.ts @@ -52,6 +52,7 @@ export const postProcessingRoutes = [ makeRoute('Scanline', '📽️', false), makeRoute('Color Depth', '🔳', false), makeRoute('Grid', '#️⃣', false), + makeRoute('ASCII', '🔡', false), makeRoute('SMAA', '📐', false), makeRoute('FXAA', '📐', false), makeRoute('Shock Wave', '🌊', false), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 26e1b16b..f730fc7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^12.5.0 version: 12.5.0(typescript@5.7.3) postprocessing: - specifier: ^6.36.6 - version: 6.36.6(three@0.173.0) + specifier: ^6.37.2 + version: 6.37.2(three@0.173.0) devDependencies: '@release-it/conventional-changelog': specifier: ^10.0.0 @@ -3565,10 +3565,10 @@ packages: resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==} engines: {node: ^10 || ^12 || >=14} - postprocessing@6.36.6: - resolution: {integrity: sha512-mjJjoXbC97XMV6iQVhOZYNjD5X93o3+/zpYm9oRmsyjP3LjfwedT8PgusECTk+s5DZeZoJ8vA9htdWuH8JH+mQ==} + postprocessing@6.37.2: + resolution: {integrity: sha512-Xm3n1Usgk2eBkufb1ssYDNGb3EXmV2wdQQIRGAWD9yppOYwsHpb8/w/+Opvnx6uEOFyt3US1dFbET5DTSyrRiA==} peerDependencies: - three: '>= 0.157.0 < 0.173.0' + three: '>= 0.157.0 < 0.176.0' potpack@1.0.2: resolution: {integrity: sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==} @@ -8373,7 +8373,7 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - postprocessing@6.36.6(three@0.173.0): + postprocessing@6.37.2(three@0.173.0): dependencies: three: 0.173.0 diff --git a/src/core/pmndrs/ASCIIPmndrs.vue b/src/core/pmndrs/ASCIIPmndrs.vue new file mode 100644 index 00000000..755fab40 --- /dev/null +++ b/src/core/pmndrs/ASCIIPmndrs.vue @@ -0,0 +1,128 @@ + diff --git a/src/core/pmndrs/index.ts b/src/core/pmndrs/index.ts index b6da7b84..0ad9e9f3 100644 --- a/src/core/pmndrs/index.ts +++ b/src/core/pmndrs/index.ts @@ -30,6 +30,7 @@ import FishEyePmndrs, { type FishEyePmndrsProps } from './FishEyePmndrs.vue' import BrightnessContrastPmndrs, { type BrightnessContrastPmndrsProps } from './BrightnessContrastPmndrs.vue' import SMAAPmndrs, { type SMAAPmndrsProps } from './SMAAPmndrs.vue' import FXAAPmndrs, { type FXAAPmndrsProps } from './FXAAPmndrs.vue' +import ASCIIPmndrs, { type ASCIIPmndrsProps } from './ASCIIPmndrs.vue' export { BloomPmndrs, @@ -62,6 +63,7 @@ export { BrightnessContrastPmndrs, SMAAPmndrs, FXAAPmndrs, + ASCIIPmndrs, BloomPmndrsProps, DepthOfFieldPmndrsProps, EffectComposerPmndrsProps, @@ -91,4 +93,5 @@ export { BrightnessContrastPmndrsProps, SMAAPmndrsProps, FXAAPmndrsProps, + ASCIIPmndrsProps, }