From 621aad9bb8ea811fd17b6a88382a924bbf8ae416 Mon Sep 17 00:00:00 2001 From: Jaime A Torrealba C Date: Mon, 17 Jul 2023 19:15:44 -0400 Subject: [PATCH 01/14] feat: add reflector --- playground/components.d.ts | 1 + playground/src/components/ReflectorDemo.vue | 31 ++++++ playground/src/pages/index.vue | 2 +- src/core/materials/Reflector.vue | 101 ++++++++++++++++++++ src/core/materials/index.ts | 3 +- 5 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 playground/src/components/ReflectorDemo.vue create mode 100644 src/core/materials/Reflector.vue diff --git a/playground/components.d.ts b/playground/components.d.ts index 45ebd25d..3aa330dc 100644 --- a/playground/components.d.ts +++ b/playground/components.d.ts @@ -14,6 +14,7 @@ declare module 'vue' { LeviosoDemo: typeof import('./src/components/LeviosoDemo.vue')['default'] MapControlsDemo: typeof import('./src/components/MapControlsDemo.vue')['default'] ModelsDemo: typeof import('./src/components/ModelsDemo.vue')['default'] + ReflectorDemo: typeof import('./src/components/ReflectorDemo.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] ScrollDemo: typeof import('./src/components/ScrollDemo.vue')['default'] diff --git a/playground/src/components/ReflectorDemo.vue b/playground/src/components/ReflectorDemo.vue new file mode 100644 index 00000000..8caa10d5 --- /dev/null +++ b/playground/src/components/ReflectorDemo.vue @@ -0,0 +1,31 @@ + + + diff --git a/playground/src/pages/index.vue b/playground/src/pages/index.vue index 1e653a12..2304813f 100644 --- a/playground/src/pages/index.vue +++ b/playground/src/pages/index.vue @@ -1,5 +1,5 @@ diff --git a/src/core/materials/Reflector.vue b/src/core/materials/Reflector.vue new file mode 100644 index 00000000..6f019aa7 --- /dev/null +++ b/src/core/materials/Reflector.vue @@ -0,0 +1,101 @@ + + + diff --git a/src/core/materials/index.ts b/src/core/materials/index.ts index 3d35419e..d544ba0c 100644 --- a/src/core/materials/index.ts +++ b/src/core/materials/index.ts @@ -1,3 +1,4 @@ import MeshWobbleMaterial from './meshWobbleMaterial/index.vue' +import Reflector from './Reflector.vue' -export { MeshWobbleMaterial } +export { MeshWobbleMaterial, Reflector } From 307a6c427635ee51eea7762b4c3528b7f9038d40 Mon Sep 17 00:00:00 2001 From: Jaime A Torrealba C Date: Tue, 18 Jul 2023 11:30:15 -0400 Subject: [PATCH 02/14] docs: add docs for Reflector --- docs/.vitepress/config.ts | 5 +- docs/guide/materials/reflector.md | 117 ++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 docs/guide/materials/reflector.md diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index b2d64e16..7c2930d5 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -63,7 +63,10 @@ export default defineConfig({ { text: 'Materials', collapsed: true, - items: [{ text: 'WobbleMaterial', link: '/guide/materials/wobble-material' }], + items: [ + { text: 'WobbleMaterial', link: '/guide/materials/wobble-material' }, + { text: 'Reflector', link: '/guide/materials/reflector' } + ], }, { text: 'Shapes', diff --git a/docs/guide/materials/reflector.md b/docs/guide/materials/reflector.md new file mode 100644 index 00000000..09375f58 --- /dev/null +++ b/docs/guide/materials/reflector.md @@ -0,0 +1,117 @@ +# Reflector + +The `cientos` package provides an abstraction of the Reflector class, which creates a reflector material in real time of your scene `` component that makes a geometry as an argument to create a mirror. This Mesh extends from `Mesh` so all the default props can be passed as well: + +- `color` The base color that's combine with the mirror effect +- `textureWidth` the width of the texture to render on the mirror +- `textureHeight` the height of the texture to render on the mirror +- `clipBias` to use the clipBias property +- `multisample` how many samplers will be render (default is 4) + +## Usage + +```html + + + +``` + +## Custom mirror effect + +For more complex effect you can provide your own shaders, you could do this creating an object and pass the uniforms, vertexShaders or fragmentShaders: + +```vue{3} +