` currently only accepts 1 string flag from the user. Using only flags means the system relies solely on us predicting users' needs and implementing a \"mode\" for them.\r\nAccepting only a single flag means we can't have a compound policy, e.g., \"rerender if advance or invalidate were called or the window resized. Afaik, this currently leads to cases where manual is the mode – the canvas will be blank if the window is resized, until invalidate is called.\r\n\r\n\r\n\r\n### Suggested solution\r\n\r\nEncapsulate the logic for \"Should the next tick update/render?\" in a module – maybe `src/core/renderPolicy.ts`?\r\nLet the render policy be specified via functions/objects as follows:\r\n\r\n```ts\r\nimport { createRenderPolicy, manual } from '...'\r\nconst policy = createRenderPolicy(manual)\r\nconst { invalidate } = policy\r\n...\r\n\u003CTresCanvas :render-policy=\"policy\" />\r\n```\r\n\r\nAbove, \r\n\r\n- manual is \"rule\" function that contains its own state, tracking if invalidate() was called since the last update.\r\n- policy is an object that relays calls to invalidate and advance to its rules, then asks the rules if the next tick should update/render or not.\r\n\r\nIn this way, we could have compound policies. E.g.,\r\n\r\n```ts\r\n// NOTE: This policy will approve the next tick of jobs if ...\r\n// - `invalidate()` was called\r\n// - the window was resized\r\n// but cancel if ...\r\n// - the canvas is off-screen\r\nconst { shouldUpdate, invalidate } = createRenderPolicy([manual, windowResize, cancelIfOffScreen])\r\nshouldUpdate() // false\r\ninvalidate()\r\nshouldUpdate() // true\r\n```\r\n\r\nRules would be evaluated in FILO order, with the result of lower ranking rules being passed to higher ranking rules, so this ...\r\n\r\n```\r\ncreateRenderPolicy([manual, cancelIfOffScreen, windowResize])\r\n```\r\n\r\n... cancels true from windowResize if the canvas is offscreen. But if the canvas is off-screen, manual's advance(n) will still take precedence.\r\n\r\nWhereas here ...\r\n\r\n```\r\ncreateRenderPolicy([cancelIfOffScreen, manual, windowResize])\r\n```\r\n\r\n... `cancelIfOffScreen` takes precedence over the other 2 rules and cancels both if the canvas is off-screen. \r\n----\r\n\r\nRules are relatively simple to write and users could supply their own rules, if we surface that in the API. Here's a \"complicated\" rule – `windowResize` – in its current form:\r\n\r\n```ts\r\nexport const windowResize: CreateUpdateRule = () => {\r\n let invalidated = true\r\n const invalidate = () => { invalidated = true }\r\n window.addEventListener('resize', invalidate)\r\n return {\r\n shouldUpdate: (lowRankResult: boolean) => {\r\n const result = invalidated\r\n invalidated = false\r\n return result || lowRankResult\r\n },\r\n dispose: () => {\r\n window.removeEventListener('resize', invalidate)\r\n }\r\n }\r\n}\r\n```\r\nHere's manual:\r\n\r\n```ts\r\nexport const manual: CreateUpdateRule = () => {\r\n let numFramesToAdvance = 0\r\n return {\r\n advance: (numFrames = 1) => {\r\n numFramesToAdvance = Math.max(numFramesToAdvance, numFrames)\r\n },\r\n shouldUpdate: (lowRankResult: boolean) => {\r\n const result = numFramesToAdvance > 0\r\n numFramesToAdvance = Math.max(0, numFramesToAdvance - 1)\r\n return result || lowRankResult\r\n }\r\n }\r\n}\r\n```\r\n\r\n### Alternative\r\n\r\n_No response_\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/tres/blob/main/CODE_OF_CONDUCT.md)\r\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/tres/blob/main/CONTRIBUTING.md).\r\n- [X] Read the [docs](https://tresjs.org/guide).\r\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/tres/issues) that reports the same bug to avoid creating a duplicate.\r\n\r\nEdit (andretchen0): fixed formatting ",[2867,2870],{"name":2868,"color":2869},"feature","c2e0c6",{"name":2871,"color":2872},"pending-triage","97A4FE",689,"Tresjs","tres","open","Render mode policies","2024-05-24T14:21:03Z","https://github.com/Tresjs/tres/issues/689",0.7630411,{"description":2882,"labels":2883,"number":2887,"owner":2874,"repository":2888,"state":2876,"title":2889,"updated_at":2890,"url":2891,"score":2892},"The current API is far from ideal, we initially followed the same DX as https://github.com/pmndrs/leva \r\nbut encountered number of issues\"\r\n\r\n- Need to use `value.value` for multiple controls #92 \r\n- Shared `useControls` composable, impossible to have multiple distinct instances #98 \r\n\r\nI will copy the different suggestions from @andretchen0 \r\n\r\n## Example: Tweakpane\r\n\r\n[Tweakpane | Bindings](https://tweakpane.github.io/docs/input-bindings/)\r\n\r\nTweakpane uses `.addBinding(stateObject, key, params)`.\r\n\r\n```ts\r\nconst PARAMS = {\r\n speed: 50,\r\n};\r\n\r\nconst pane = new Pane();\r\npane.addBinding(PARAMS, 'speed', {\r\n min: 0,\r\n max: 100,\r\n});\r\n```\r\n\r\nWith this setup, there's no need for a `watch` and so no `value.value`. The value is already being \"watched\" with the configuration above.\r\n\r\n## Example: v-tweakpane\r\n\r\nA variation of Tweakpane, this time with Vue. Like Tweakpane, it uses a specific method for creating a widget and binding at the same time. This avoids the need to `watch` and avoids `.value.value`.\r\n\r\n```ts\r\nconst onPaneTwoCreated = (pane: any) => {\r\n pane.registerPlugin(CamerakitPlugin);\r\n const PARAMS = {\r\n flen: 55,\r\n fnum: 1.8,\r\n iso: 100,\r\n };\r\n pane.addInput(PARAMS, 'flen', {\r\n view: 'cameraring',\r\n series: 0,\r\n unit: { pixels: 50, ticks: 10, value: 0.2 },\r\n min: 1,\r\n step: 0.02,\r\n });\r\n```\r\n\r\nThe [example](https://github.com/vinayakkulkarni/v-tweakpane/blob/main/example/src/App.vue) uses some callbacks for setup, which Leches doesn't need. Personally, I'd like to avoid having those.\r\n\r\n## Example: Vuetify\r\n\r\nIn this [Vuetify example](https://vuetifyjs.com/en/components/sliders/#min-and-max), most of the config that Leches does in `\u003Csetup>` is handled in `\u003Ctemplate>`. Bindings are created using `v-model` in the `\u003Ctemplate>`.\r\n\r\n```html\r\n\u003Ctemplate>\r\n \u003Cv-slider\r\n v-model=\"slider\"\r\n class=\"align-center\"\r\n :max=\"max\"\r\n :min=\"min\"\r\n hide-details\r\n >\r\n \u003Ctemplate v-slot:append>\r\n \u003Cv-text-field\r\n v-model=\"slider\"\r\n hide-details\r\n single-line\r\n density=\"compact\"\r\n type=\"number\"\r\n style=\"width: 70px\"\r\n >\u003C/v-text-field>\r\n \u003C/template>\r\n \u003C/v-slider>\r\n\u003C/template>\r\n\r\n\u003Cscript>\r\n export default {\r\n data () {\r\n return {\r\n min: -50,\r\n max: 90,\r\n slider: 40,\r\n }\r\n },\r\n }\r\n\u003C/script>\r\n```",[2884],{"name":2885,"color":2886},"enhancement","a2eeef",104,"leches","Rethink API and DX","2024-04-27T19:31:44Z","https://github.com/Tresjs/leches/issues/104",0.7733847,{"description":2894,"labels":2895,"number":2905,"owner":2874,"repository":2875,"state":2906,"title":2907,"updated_at":2908,"url":2909,"score":2910},"**Describe the bug**\r\nThe following props are not being properly updated:\r\n\r\n- `enabled`.\r\n- `showX`, `showY`, `showZ`\r\n- `axis`.\r\n\r\n**Reproduction**\r\n[Stackblitz](https://stackblitz.com/edit/tresjs-transform-controls?file=src%2Fcomponents%2FTheExperience.vue,package.json) \r\n\r\n**Steps**\r\nSteps to reproduce the behavior:\r\n1. Go to[ '...'](https://stackblitz.com/edit/tresjs-transform-controls?file=src%2Fcomponents%2FTheExperience.vue,package.json)\r\n2. Play with props on the panel top right\r\n\r\n**Expected behavior**\r\nAll props work\r\n\r\n\r\n**System Info**\r\nOutput of `npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers` \r\n\r\n```\r\n System:\r\n OS: Linux 5.0 undefined\r\n CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz\r\n Memory: 0 Bytes / 0 Bytes\r\n Shell: 1.0 - /bin/jsh\r\n Binaries:\r\n Node: 16.14.2 - /usr/local/bin/node\r\n Yarn: 1.22.19 - /usr/local/bin/yarn\r\n npm: 7.17.0 - /usr/local/bin/npm\r\n npmPackages:\r\n @tresjs/cientos: ^1.3.0 => 1.3.0 \r\n @tresjs/core: ^1.4.0 => 1.4.0 \r\n vite: ^3.2.4 => 3.2.4 \r\n```\r\n\r\n**Additional context**\r\nMost probably is because this properties doesn't use a `set` function\r\n",[2896,2899,2902],{"name":2897,"color":2898},"bug","d73a4a",{"name":2900,"color":2901},"good first issue","7057ff",{"name":2903,"color":2904},"help wanted","008672",63,"closed","TransformControls cientos props without set method not updating","2023-01-07T18:45:57Z","https://github.com/Tresjs/tres/issues/63",0.7029373,{"description":2912,"labels":2913,"number":2915,"owner":2874,"repository":2875,"state":2906,"title":2916,"updated_at":2917,"url":2918,"score":2919},"**Is your feature request related to a problem? Please describe.**\r\n\r\nTresJS is intended to be as simple and verbose as possible, but we can add an optional \"preset\" configuration for example for realistic scenes\r\n\r\n**Describe the solution you'd like**\r\n\r\n```\r\n\u003CTresCanvas preset=\"realistic\" />\r\n```\r\n\r\nWould set the following properties to the render\r\n\r\n```\r\nrenderer.physicallyCorrectLights = true // real lights\r\nrenderer.outputEncoding = THREE.sRGBEncoding // gama correction\r\nrenderer.toneMapping = THREE.ACESFilmicToneMapping\r\nrenderer.toneMappingExposure = 3\r\nrenderer.shadowMap.enabled = true\r\nrenderer.shadowMap.type = THREE.PCFSoftShadowMap\r\n```\r\n\r\n",[2914],{"name":2900,"color":2901},109,"Renderer presets","2023-02-19T13:59:01Z","https://github.com/Tresjs/tres/issues/109",0.7180842,{"description":2921,"labels":2922,"number":2923,"owner":2874,"repository":2924,"state":2906,"title":2925,"updated_at":2926,"url":2927,"score":2928},"### Describe the bug\n\nI am trying to use a TresCanvas that is known to work when using in a staticly declared way\r\nbut if I use it in a component that is dynamicly loaded using \r\n\r\n`defineAsyncComponent(() => import('@/components/pageBuilder/component.vue'))`\r\n\r\nit doesn't render the canvas the most I can get is the following\r\n\r\n`\u003Cdiv window-size=\"\" clear-color=\"#241246\" shadows=\"\" data-v-3789b801=\"\">\u003Ccanvas style=\"\">\u003C/canvas>\u003C/div>`\r\n\r\n## Recent findings\r\n\r\njust having the TresCanvas in a component that is nested 2 levels deep doesn't work.\r\nno idea why or what is causing this. \r\n\r\nI've provided a reproduction of this\r\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/tresjs-basic-z2g8yk?file=src%2Fcomponents%2FTheExperience.vue\n\n### Steps to reproduce\n\n_No response_\n\n### System Info\n\n_No response_\n\n### Used Package Manager\n\nnpm\n\n### Code of Conduct\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/tres/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/tres/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/tres/issues) that reports the same bug to avoid creating a duplicate.\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[],79,"nuxt","TresCanvas doesn't render in Dynamicly loaded components or deeply nested components","2024-01-26T12:08:01Z","https://github.com/Tresjs/nuxt/issues/79",0.7357733,{"description":2930,"labels":2931,"number":2932,"owner":2874,"repository":2933,"state":2906,"title":2934,"updated_at":2935,"url":2936,"score":2937},"The Manual Post Processing demo doesn't change when changing the various post-processing options.\r\n\r\n\u003Cimg width=\"1489\" alt=\"Screenshot 2023-09-20 at 01 10 01\" src=\"https://github.com/Tresjs/playground/assets/20469369/f9fb0fee-e6a7-45d8-afeb-4788da9b04b2\">\r\n\r\n----\r\n\r\n## Description\r\n\r\n* Expected: When changing the [post-processing dropdown here](https://deploy-preview-62--tresjs-playground.netlify.app/experiments/post-processing-manual), the content of the canvas should show the post-processing effect.\r\n* What happens: Nothing happens. The post-processing effect is not shown.\r\n\r\n----\r\n\r\n## Diagnosis\r\n\r\nThe demo watches a ref called `context`. It expects that the ref here `\u003CTresCanvas ref=\"content\">` will have a renderer in its value, when its updated:\r\n\r\n```\r\nwatchEffect(() => {\r\n if (context.value) {\r\n context.value.renderer.setSize(width.value, height.value)\r\n context.value.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))\r\n effectComposer = new EffectComposer(context.value.renderer)\r\n effectComposer.addPass(new RenderPass(context.value.scene, context.value.camera))\r\n\r\n onLoop(() => {\r\n effectComposer.render()\r\n })\r\n }\r\n})\r\n```\r\n\r\n[Source](https://github.com/Tresjs/playground/blob/215b94708fe765c80b073f75798fc441db913fd6/components/content/post-processing-manual/index.vue#L62)\r\n\r\n... but it doesn't. Here's the browser error message:\r\n\r\n```\r\nTypeError: a.value.renderer is undefined\r\n```\r\n\r\n----\r\n\r\nChecking the [Tres documentation for `Renderer`](https://tresjs.org/api/renderer.html), it doesn't appear that adding a ref on `\u003CTresCanvas />` is a documented way to access the renderer, so I didn't file an issue there.\r\n\r\n----\r\n\r\n## System Info\r\n\r\nMac M1\r\nMac OS 13.1\r\nFirefox 117.0.1 ",[],68,"lab","Manual Post Processing demo: canvas ref doesn't contain renderer","2023-09-23T14:22:58Z","https://github.com/Tresjs/lab/issues/68",0.7384281,{"description":2939,"labels":2940,"number":2941,"owner":2874,"repository":2942,"state":2906,"title":2943,"updated_at":2944,"url":2945,"score":2946},"### Describe the bug\n\nHi! \r\nTLDR;\r\nI was wondering if there is a way to make the Precipitation component animate after using disableRender on the main TresCanvas.\r\n\r\nWhole story:\r\nI currently playing with custom shaders and wanted to try them inside Tres, I created a function that extracts the context of the TresCanvas component from a ref to create the RenderPass:\r\n\r\n```const addRenderPasses = () => {\r\n // render pass\r\n const renderPass = new RenderPass(\r\n tresCanvas.value.context.scene.value,\r\n tresCanvas.value.context.camera.value\r\n )\r\n\r\n // Distortion pass\r\n distortPass.value = new ShaderPass(LensDistortionShader)\r\n distortPass.value.material.defines.CHROMA_SAMPLES = 10\r\n\r\n // compopser\r\n composer.value = new EffectComposer(tresCanvas.value.context.renderer.value)\r\n composer.value.setSize(window.innerWidth, window.innerHeight)\r\n composer.value.setPixelRatio(window.devicePixelRatio * 1.3)\r\n\r\n // output pass\r\n const outputPass = new OutputPass()\r\n\r\n // add the passes\r\n composer.value.addPass(renderPass)\r\n composer.value.addPass(distortPass.value)\r\n composer.value.addPass(outputPass)\r\n}\r\n```\r\n\r\nThe thing here is that for me to apply the RenderPass to the TresCanvas we need to disable the default renderer, which means that the Precipitation component from cientos no longer animates, I'm no master at three.js, but if you can guide me on where to thinker, I might be able to sort this. If you have any ideas or advice on how to make this run I am all ears! Other than that, I'm loving Tres.js and its companion libraries (Cientos, Leches and Post Processing)!\r\n\r\nLet me know if you need more context or info!\r\n\r\nCheers!\r\n\r\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/tresjs-basic-5sm94z\n\n### Steps to reproduce\n\nDescribed above and clear on the stackblitz example\n\n### System Info\n\n```shell\nUsing Stackblitz\n```\n\n\n### Used Package Manager\n\nnpm\n\n### Code of Conduct\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/cientos/blob/main/CODE_OF_CONDUCT.md)\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/cientos/blob/main/CONTRIBUTING.md).\n- [X] Read the [docs](https://cientos.tresjs.org/guide).\n- [X] Check that there isn't [already an issue](https://github.com/Tresjs/cientos/issues) that reports the same bug to avoid creating a duplicate.\n- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.",[],276,"cientos","How to animate the Precipitation component when using \"disableRender\" on the TresCanvas","2023-11-03T19:38:52Z","https://github.com/Tresjs/cientos/issues/276",0.7387205,{"description":2948,"labels":2949,"number":2952,"owner":2874,"repository":2942,"state":2906,"title":2953,"updated_at":2954,"url":2955,"score":2956},"### Description\r\n\r\nAs a developer using TresJS, I want \r\n- Environment props to be reactive\r\n- More presets other than 'sunset' (city, etc)\r\n\r\n so that:\r\n- I can dynamically configure the preset or toggle the `background` property\r\n\r\n### Suggested solution\r\n\r\nModify the `useEnvironment/component.ts` component so:\r\n\r\n- Convert to vue file SFC\r\n- texture should be a ref\r\n- Set the default for the props here.\r\n\r\nModify the `useEnvironment/index.ts` composable so:\r\n\r\n- Reacts to prop changes (Using watchers and computed)\r\n- Return the texture as a ref\r\n\r\n \r\n\r\n### Alternative\r\n\r\n_No response_\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/cientos/blob/main/CODE_OF_CONDUCT.md)\r\n- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/cientos/blob/main/CONTRIBUTING.md).\r\n- [X] Read the [docs](https://cientos.tresjs.org/guide).\r\n- [X] Check that there isn't [already an issue](https://github.com/tresjs/cientos/issues) that reports the same bug to avoid creating a duplicate.",[2950,2951],{"name":2900,"color":2901},{"name":2903,"color":2904},147,"Enhance Environment and useEnvironment abstractions","2023-10-09T17:33:47Z","https://github.com/Tresjs/cientos/issues/147",0.7457974,{"description":2958,"labels":2959,"number":2952,"owner":2874,"repository":2967,"state":2906,"title":2968,"updated_at":2969,"url":2970,"score":2956},"Attempting to use the 1.0.0 release with Nuxt, I get an error on the `nuxt prepare` step. This is reproducible within this repo's nuxt playground if you update the dependency to 1.0.0.\r\n\r\n```\r\n ERROR ENOENT: no such file or directory, open '/Users/.../.../post-processing/playground-nuxt/@tresjs/post-processing' 10:29:39 AM\r\n ```\r\n\r\nThis does not happen when using `1.0.0-next.1`.\r\n\r\n```\r\n- Operating System: Darwin\r\n- Node Version: v20.10.0\r\n- Nuxt Version: 3.14.1592\r\n- CLI Version: 3.15.0\r\n- Nitro Version: 2.10.4\r\n- Package Manager: npm@10.8.3\r\n- Builder: -\r\n- User Config: default\r\n- Runtime Modules: @nuxt/eslint@0.7.2, @pinia/nuxt@0.7.0, @nuxtjs/supabase@1.4.3, @primevue/nuxt-module@4.2.4, @nuxtjs/tailwindcss@6.12.2, nuxt-lodash@2.5.3, @nuxt/icon@1.8.2, @tresjs/nuxt@3.0.7\r\n- Build Modules: -\r\n```\r\n\r\nThanks for maintaining this project!",[2960,2961,2964],{"name":2897,"color":2898},{"name":2962,"color":2963},"p4-important-bug","D93F0B",{"name":2965,"color":2966},"types","5C076E","post-processing","Broken imports in v1.0.0 w/ Nuxt","2025-01-03T09:37:19Z","https://github.com/Tresjs/post-processing/issues/147",{"description":2972,"labels":2973,"number":2978,"owner":2874,"repository":2875,"state":2906,"title":2979,"updated_at":2980,"url":2981,"score":2982},"**Describe the bug**\r\nWith the new updates of TresJs/Core you can assign the setAttributes('position', BufferGeo)...\r\nLike this...\r\n``` \r\n \u003CTresPoints>\r\n \u003CTresBufferGeometry :position=\"[positionArray, 3]\" :a-scale=\"[scaleArray, 1]\" />\r\n \u003CTresShaderMaterial v-bind=\"shader\" />\r\n \u003C/TresPoints>\r\n\r\n```\r\nBefore this work, this broke the \"Stars\" abstraction in cientos, and also other examples (with the TresPoints)\r\n\r\nI am doing ... What I expect is ... What actually happening is\r\n\r\n**Reproduction**\r\nPlease provide a link using this template on [Stackblitz](https://stackblitz.com/edit/tresjs-basic?file=README.md) \r\n\r\n**Steps**\r\nSteps to reproduce the behavior:\r\n1. Install the last version of cientos and tres\r\n2. Try to use \u003CStars /> component\r\n\r\n**Expected behavior**\r\nCorrect assign of the attributes in TresBufferGeometry \r\n\r\n**Screenshots**\r\nThis is the current error (screenshots take for playground portal-journey experiment) last version Tresjs\r\n\r\n\r\n",[2974,2975],{"name":2897,"color":2898},{"name":2976,"color":2977},"needs reproduction","511ECF",229,"TresBufferGeometry get broken with the last Tresjs update (Attributes assign)","2023-04-25T07:11:58Z","https://github.com/Tresjs/tres/issues/229",0.75547814,["Reactive",2984],{},["Set"],["ShallowReactive",2987],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fkYPbVseYArfnsD9xcFD0s-ZLSERIUycr2Mcos0C-Z4I":-1},"/Tresjs/tres/52"]