{"id":25601403,"url":"https://github.com/magnusthor/demolishedrenderer","last_synced_at":"2025-11-11T13:31:22.347Z","repository":{"id":42930103,"uuid":"224855413","full_name":"MagnusThor/demolishedRenderer","owner":"MagnusThor","description":"Tiny multipass ( buffer ) rendering engine for WebGL Shaders with 1-n texture support + texture generator.","archived":false,"fork":false,"pushed_at":"2023-12-19T14:13:16.000Z","size":8132,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-12-19T17:38:59.694Z","etag":null,"topics":["glsl","shaders","webgl"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MagnusThor.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-29T13:02:40.000Z","updated_at":"2022-05-30T13:43:14.000Z","dependencies_parsed_at":"2023-11-24T16:31:04.873Z","dependency_job_id":"6fa36e7f-99c5-48bb-aaeb-df026ddf310b","html_url":"https://github.com/MagnusThor/demolishedRenderer","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusThor%2FdemolishedRenderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusThor%2FdemolishedRenderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusThor%2FdemolishedRenderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusThor%2FdemolishedRenderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagnusThor","download_url":"https://codeload.github.com/MagnusThor/demolishedRenderer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240045013,"owners_count":19739184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glsl","shaders","webgl"],"created_at":"2025-02-21T15:54:26.327Z","updated_at":"2025-11-11T13:31:22.319Z","avatar_url":"https://github.com/MagnusThor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# demolishedRenderer\n\n## About\n\ndemolishedRenderar is a lightweight high-performance, easy to use multi-pass (1-n shader programs/buffers) rendering engine that supports 1-n textures,custom uniforms.\n\nDR is written mainly for a demo-scene purpose. \n\n## Install\n\n    npm install demolishedrenderer\n\n## Get started \n\n### Create an instance of the renderer \n\n     constructor(canvas: HTMLCanvasElement, mainVertexShader: string, mainFragmentShader: string, customUniforms?: ICu);\n\n## Methods\n\n###  addAssets (aA)\n\nAdd assets shared, global assets that can be used 1-n buffers \n\n    aA(assets: any, cb: () =\u003e void): DR;\n\n### addBuffer (aB)\n\nCreate a render buffer, shader that produces a texture that can be use for output etc within main fragment.\n\n       aB(name: string, vertex: string, fragment: string, textures?: Array\u003cstring\u003e, customUniforms?: ICu): DR;\n \n ### R(time:number)\n\n Render a frame based on time \n\n ### run(startTime:number,fps:number)\n\nStart a render loop at startTime, fps sets a maximum frame rate (FPS)\n\n### sP(key: string, state: boolean):void \n\nEnable or disable a buffer/program. Can be toggled during render loop.\n\n## Texture's \u0026 Custom Uniforms\n\nPass 1-n textures to the engines as an `Array\u003cItx\u003e` , textures is shared among 1-n buffers / shader programs. When adding a buffer you need to specify with textures to use.\n\n       aB(\"myByffer,vertexShader,fragmentShader\",[\"myTexture1\",\"myTexture2],cU):\n\n\n## Texture (ITx)\n\n    interface ITx {\n        src?: any,\n        fn?(currentProgram:WebGLProgram,src:any): Function\n    }\n\n### example\n\n    let textures = [\n        {\n             \"myTexture1\": {\n               src: \"/test/assets/texture.jpg\"\n            },\n        },\n        {\n             \"myTexture2\": {\n                (gl,c) =\u003e {\n                        // do stuff with your gl program texture...\n                }\n            },\n        }\n\n    ]\n\n\n### Custom Uniform's\n\nBulit in uniforms are , this are updated for each frame, this also applies to customUniforms,\n\n    uniform float time; \n    uniform int frame;\n    uniform int deltaTime; \n    uniform vec2 resolution;\n    uniform sampler2D {bufferName}; // bufferName = the name of your buffer, contains previous frame.  ( applies to main fragment shader)\n\n\n### Add custom uniform(s)\n\n    const customUniforms = {\n            \"fRnd\": (location, currentGlProgram, mainGlProgram, renderTime) =\u003e { \n\n                currentGlProgram.uniform1f(location,Math.random()); \n            \n            },\n            ....\n\n\nCustom uniforms can be passed to each buffer as well as the main program. \n\n\nKind regards,\n    Magnus 'Bagzy' Thor\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusthor%2Fdemolishedrenderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnusthor%2Fdemolishedrenderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusthor%2Fdemolishedrenderer/lists"}