{"id":37041198,"url":"https://github.com/simulation-tree/rendering","last_synced_at":"2026-01-14T04:52:16.571Z","repository":{"id":314532883,"uuid":"824416976","full_name":"simulation-tree/rendering","owner":"simulation-tree","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-22T03:08:00.000Z","size":200,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T05:28:42.042Z","etag":null,"topics":["csharp","dotnet","graphics","rendering"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simulation-tree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-05T05:11:42.000Z","updated_at":"2025-09-22T03:08:04.000Z","dependencies_parsed_at":"2025-09-13T03:29:26.589Z","dependency_job_id":"9f4795a1-8415-40be-b211-7272764e5875","html_url":"https://github.com/simulation-tree/rendering","commit_stats":null,"previous_names":["simulation-tree/rendering"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/simulation-tree/rendering","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Frendering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Frendering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Frendering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Frendering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simulation-tree","download_url":"https://codeload.github.com/simulation-tree/rendering/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Frendering/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csharp","dotnet","graphics","rendering"],"created_at":"2026-01-14T04:52:16.104Z","updated_at":"2026-01-14T04:52:16.565Z","avatar_url":"https://github.com/simulation-tree.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rendering\nDefines the types needed for 3D rendering implementations.\n\n### Destinations\nThese are entities that are known to be rendered to, and are referenced by cameras. They're expected\nto be implemented with individual window libraries, like in [`windows`](https://github.com/simulation-tree/windows).\n\nDestinations are then presented separately from appearing. They also require a label on them, with that label's handler registered with the `RenderEngineSystem`. The render engine system then updates upon the `RenderUpdate` event (which should be submitted last) and draws all enabled destinations:\n```cs\nusing RenderEngineSystem renderEngine = new(world);\nrenderEngine.RegisterSystem\u003cCustomRenderer\u003e();\n```\n\n### Cameras\nCameras are used by individual renderer entities, and they must always point towards a destination.\n```cs\nDestination destination = new(\"customRenderer\", ...).AsDestination();\nCamera camera = new(world, destination, CameraFieldOfView.FromDegrees(90f));\ncamera.SetPosition(0, 0, -10);\n```\nWhenever they get updated, they will have a `CameraProjection` component added to them to reflect\nthe view and projection matrices.\n\n### Binding data to shaders\nIts the materials entities that contain information about how to bind entity or texture data to [`shaders`](https://github.com/simulation-tree/shaders):\n```cs\nShader shader = new(world, \"Assets/Shaders/shader.vert.glsl\", \"Assets/Shaders/shader.frag.glsl\");\nTexture texture = new(world, \"Assets/Textures/texture.png\");\nMaterial material = new(world, shader);\nmaterial.AddPushBinding\u003cColor\u003e(); //component expected on the renderer entity\nmaterial.AddComponentBinding\u003cCameraProjection\u003e(0, 0, camera);\nmaterial.AddTextureBinding(1, 0, texture);\n```\nWhere the shader has these uniform buffers and push constants defined:\n```glsl\nlayout(push_constant) uniform EntityData {\n    vec4 color; //bound to Color, from the renderer\n} entity;\n\nlayout(binding = 0) uniform CameraInfo { //bound to CameraProjection, from the camera\n\tmat4 proj;\n    mat4 view;\n} cameraInfo;\n```\n```glsl\nlayout(binding = 1) uniform sampler2D textureSampler; //bound to the texture entity\n```\n\n### Loading materials from files\nThe included method expects material files to be json, with a \"vertex\" and \"fragment\" key pointing\nto shader addresses:\n```cs\nMaterial material = new(world, \"*/Materials/Unlit.material.json\");\n```\n```json\n{\n    \"vertex\": \"Assets/Shaders/unlit.vert.glsl\",\n    \"fragment\": \"Assets/Shaders/unlit.frag.glsl\"\n}\n```\n\n### Renderers\nFinally the entities that cause rendering. They reference the previously mentioned materials\nand cameras, as well as [`meshes`](https://github.com/simulation-tree/meshes).\n```cs\nMesh mesh = ...\nRenderer renderer = new(world, mesh, material, camera);\nrenderer.AddComponent(Color.Yellow); //the push binding requires a `Color`\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Frendering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimulation-tree%2Frendering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Frendering/lists"}