` 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 ",[2884,2885],{"name":2868,"color":2869},{"name":2886,"color":2887},"pending-triage","97A4FE",689,"tres","Render mode policies","2024-05-24T14:21:03Z","https://github.com/Tresjs/tres/issues/689",0.77682954,{"description":2895,"labels":2896,"number":2900,"owner":2874,"repository":2889,"state":2901,"title":2902,"updated_at":2903,"url":2904,"score":2905},"### Description\n\nAs a developer using TresJS I want to have better documentation about primitives so that I can understand it's functionality better\n\n### Suggested solution\n\nAdd dedicated guide to primitives\n\n### Alternative\n\n_No response_\n\n### Additional context\n\nRequested by community\n\n### Validations\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.",[2897],{"name":2898,"color":2899},"docs","0075ca",349,"closed","Extended guide about primitives on docs","2023-09-18T08:02:56Z","https://github.com/Tresjs/tres/issues/349",0.7421725,{"description":2907,"labels":2908,"number":2915,"owner":2874,"repository":2889,"state":2901,"title":2916,"updated_at":2917,"url":2918,"score":2919},"### Description\n\nAs a TresJS developer, I would like to have better type support and IntelliSense. The idea would be to replace the current approach of generating the types on the build.\n\n### Suggested solution\n\nCody from Pmndrs gave me a hint on how R3F is tackling the typing. https://github.com/pmndrs/react-three-fiber/blob/v9/packages/fiber/src/three-types.ts\r\n\r\n```ts\r\ntype ThreeExports = typeof THREE\r\ntype ThreeElementsImpl = {\r\n [K in keyof ThreeExports as Uncapitalize\u003CK>]: ThreeExports[K] extends ConstructorRepresentation\r\n ? ThreeElement\u003CThreeExports[K]>\r\n : never\r\n}\r\n```\n\n### Alternative\n\n_No response_\n\n### Additional context\n\n_No response_\n\n### Validations\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.",[2909,2912],{"name":2910,"color":2911},"dx","1576AD",{"name":2913,"color":2914},"types","5C076E",268,"Refactor typescript support from build to runtime","2023-05-21T09:05:02Z","https://github.com/Tresjs/tres/issues/268",0.7489519,{"description":2921,"labels":2922,"number":2929,"owner":2874,"repository":2875,"state":2901,"title":2930,"updated_at":2931,"url":2932,"score":2933},"### 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.",[2923,2926],{"name":2924,"color":2925},"good first issue","7057ff",{"name":2927,"color":2928},"help wanted","008672",147,"Enhance Environment and useEnvironment abstractions","2023-10-09T17:33:47Z","https://github.com/Tresjs/cientos/issues/147",0.7534365,{"description":2935,"labels":2936,"number":2929,"owner":2874,"repository":2944,"state":2901,"title":2945,"updated_at":2946,"url":2947,"score":2933},"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!",[2937,2940,2943],{"name":2938,"color":2939},"bug","d73a4a",{"name":2941,"color":2942},"p4-important-bug","D93F0B",{"name":2913,"color":2914},"post-processing","Broken imports in v1.0.0 w/ Nuxt","2025-01-03T09:37:19Z","https://github.com/Tresjs/post-processing/issues/147",{"description":2949,"labels":2950,"number":2951,"owner":2874,"repository":2889,"state":2901,"title":2952,"updated_at":2953,"url":2954,"score":2955},"### Description\n\nIt would be nice to have the utility function which are used inside tres available. Right now it is only `normalizeColor` that is tres-related.\n\n### Suggested solution\n\nexport `normalizeColor`\n\n### Alternative\n\n_No response_\n\n### Additional context\n\n_No response_\n\n### Validations\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.",[],314,"export utility functions","2023-06-22T09:45:39Z","https://github.com/Tresjs/tres/issues/314",0.76305807,{"description":2957,"labels":2958,"number":2961,"owner":2874,"repository":2889,"state":2901,"title":2962,"updated_at":2963,"url":2964,"score":2965},"**Describe the bug**\r\nI was working on #116 and while I was implementing color shorthand for material, I duplicate and commented the old one. I expected the code to ignore the commented material and what actually happening is an error that crash the app.\r\n\r\n**Reproduction**\r\n[Stackblitz](https://stackblitz.com/edit/tresjs-basic-548wt4?file=src%2Fcomponents%2FTheExperience.vue) \r\n\r\n**Steps**\r\nSteps to reproduce the behavior:\r\n1. Go to a file with a `\u003CTresMesh>` component\r\n2. Create a comment inside the component\r\n3. See error\r\n\r\n**Expected behavior**\r\nThe application should not crash and ignore the comment\r\n\r\n**Screenshots**\r\n\r\n\r\n\r\n\r\n**System Info**\r\n``` \r\nSystem:\r\n OS: macOS 13.1\r\n CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz\r\n Memory: 708.17 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node\r\n Yarn: 1.22.19 - ~/.yarn/bin/yarn\r\n npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm\r\n Browsers:\r\n Brave Browser: 91.1.26.74\r\n Chrome: 110.0.5481.100\r\n Chrome Canary: 112.0.5609.1\r\n Firefox: 110.0\r\n Firefox Developer Edition: 110.0\r\n Safari: 16.2\r\n Safari Technology Preview: 16.4\r\n npmPackages:\r\n @tresjs/cientos: workspace:^1.7.0 => 1.7.0\r\n @tresjs/core: workspace:^1.7.0 => 1.7.0\r\n```\r\n",[2959,2960],{"name":2938,"color":2939},{"name":2927,"color":2928},120,"Allow comments inside components like `TresMesh`","2023-02-26T21:56:59Z","https://github.com/Tresjs/tres/issues/120",0.7779343,{"description":2967,"labels":2968,"number":2969,"owner":2874,"repository":2970,"state":2901,"title":2971,"updated_at":2972,"url":2973,"score":2974},"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.7779775,{"description":2976,"labels":2977,"number":382,"owner":2874,"repository":2889,"state":2901,"title":2979,"updated_at":2980,"url":2981,"score":2982},"Package to support `EffectComposer` https://github.com/pmndrs/react-postprocessing",[2978],{"name":2868,"color":2869},"Postprocessing package","2023-04-19T10:52:44Z","https://github.com/Tresjs/tres/issues/8",0.7804298,["Reactive",2984],{},["Set"],["ShallowReactive",2987],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fsQ8uroCEW8WSqzZ3F6gIBAUiuL-vF7wFbqNyLcIjyd8":-1},"/Tresjs/post-processing/50"]