{"id":15100744,"url":"https://github.com/thetarnav/odin-wasm","last_synced_at":"2025-04-07T14:12:12.550Z","repository":{"id":216880790,"uuid":"739421063","full_name":"thetarnav/odin-wasm","owner":"thetarnav","description":"Odin + WASM = 💙","archived":false,"fork":false,"pushed_at":"2025-01-11T21:59:46.000Z","size":12220,"stargazers_count":94,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T04:13:08.819Z","etag":null,"topics":["javascript","odin","odin-lang","wasm","webgl"],"latest_commit_sha":null,"homepage":"https://thetarnav.github.io/odin-wasm/","language":"Odin","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/thetarnav.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}},"created_at":"2024-01-05T14:24:54.000Z","updated_at":"2025-03-25T00:03:55.000Z","dependencies_parsed_at":"2024-01-25T19:39:05.977Z","dependency_job_id":"3ded2353-b0a1-45a2-8011-84f2cb577452","html_url":"https://github.com/thetarnav/odin-wasm","commit_stats":{"total_commits":329,"total_committers":2,"mean_commits":164.5,"dds":0.006079027355623046,"last_synced_commit":"aceff0c25e149cd4b1c2437992f99f356da3c610"},"previous_names":["thetarnav/odin-wasm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thetarnav%2Fodin-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thetarnav%2Fodin-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thetarnav%2Fodin-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thetarnav%2Fodin-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thetarnav","download_url":"https://codeload.github.com/thetarnav/odin-wasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666014,"owners_count":20975788,"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":["javascript","odin","odin-lang","wasm","webgl"],"created_at":"2024-09-25T18:00:52.611Z","updated_at":"2025-04-07T14:12:12.508Z","avatar_url":"https://github.com/thetarnav.png","language":"Odin","funding_links":[],"categories":["Odin","Bindings"],"sub_categories":["Vendor"],"readme":"# Odin WASM\n\n**For using Odin and WASM together.**\n\n[![demo gif](https://raw.githubusercontent.com/thetarnav/odin-wasm/main/assets/camera.gif)](https://thetarnav.github.io/odin-wasm/#camera)\n\n## What is this?\n\n### 1. A library of WASM bindings\n\n[A library of wasm bindings](https://github.com/thetarnav/odin-wasm/tree/main/wasm) from [`Odin/vendor/wasm`](https://github.com/odin-lang/Odin/tree/master/vendor/wasm) implemented using modern JavaScript with ES modules and JSDoc.\n\nThe implementation is mostly the same as the original, here are the differences:\n\n- ESM - the bindings are written in multiple ES modules, mirroring Odin packages, so they need to be used in a modern JS environment, assuming that the user will use a bundler like [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/) to bundle the code, and tree-shake the unused parts.\n- JSDoc - the original bindings are witout types, so I added JSDoc comments to the functions for basic typechecking (and some autocompletion).\n- [Improvements to getting window position and size](https://github.com/thetarnav/odin-wasm/commit/abd015822d0667ae7ebec7c0b7d4508a489b9c44#diff-70784127da28e4d9d43c91e03af22f56c23f45ec12af76e4deed68c37f7776e4)\n- [ctx2d](https://github.com/thetarnav/odin-wasm/tree/main/wasm/ctx2d) - Bindings to the [2d canvas context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D), for drawing 2d graphics without webgl.\n- [ls](https://github.com/thetarnav/odin-wasm/tree/main/wasm/ls) - Bindings to the [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) API, for saving data in the browser.\n\n### 2. Odin + WASM example\n\n[thetarnav.github.io/odin-wasm](https://thetarnav.github.io/odin-wasm)\n\nIn [`example/`](https://github.com/thetarnav/odin-wasm/tree/main/example) you can find an example of how to use Odin and WASM together. Mainly focused on WebGL as I'm going through the [WebGL Fundamentals](https://webgl2fundamentals.org/) tutorial.\n\n### 3. A template repo\n\nFeel free to use this repo as a template for your own projects.\n\nThere are some convenience scripts in [`main.js`](https://github.com/thetarnav/odin-wasm/tree/main/main.js) for building and running the example. And a github action for building and deploying the example to github pages.\n\n### 4. GLSL utils codegen tool\n\nThe [`/shdc`](https://github.com/thetarnav/odin-wasm/tree/main/shdc) directory contains a cli tool for generating GLSL utils from parsing glsl shaders in the [`example/`](https://github.com/thetarnav/odin-wasm/tree/main/example) dir.\n\nIt can be ran with `npm run shdc`, or `odin run shdc`.\n\nThe generated file is committed to the repo, you can check it out in [`example/shaders_generated.odin`](https://github.com/thetarnav/odin-wasm/blob/main/example/shaders_generated.odin).\n\nThe tool is just an experiment of parsing glsl, and generating some boilerplate code, so that getting attribute and uniform locations, and setting the values is a bit easier.\n\n## Development\n\n### Dependencies\n\n- [Odin](https://odin-lang.org/docs/install/) (and [LLVM](https://apt.llvm.org/))\n- [Node 20](https://nodejs.org/)\n- [Chrome Devtools Support](https://chromewebstore.google.com/detail/cc++-devtools-support-dwa/pdcpmagijalfljmkmjngeonclgbbannb): for debugging *(optional)*\n\n### OLS\n\nAdd `js_wasm32` target to `ols.json` if you want to use [OLS](https://github.com/DanielGavin/ols).\n\n```json\n{\n    \"enable_format\": false,\n\t\"checker_args\": \"-target:js_wasm32 -vet-unused -vet-style -vet-semicolon -vet-cast -vet-tabs\",\n\t\"profile\": \"example\",\n\t\"profiles\": [{\n\t\t\"name\": \"example\",\n\t\t\"os\": \"js_wasm32\",\n\t\t\"checker_path\": [\"example\"]\n\t}, {\n\t\t\"name\": \"shdc\",\n\t\t\"checker_path\": [\"shdc\"]\n\t}, {\n\t\t\"name\": \"obj\",\n\t\t\"checker_path\": [\"obj\"]\n\t}]\n}\n```\n\n### Scripts\n\nTake look at [`package.json`](https://github.com/thetarnav/odin-wasm/tree/main/package.json) for all the available scripts.\n\n*(You need to run `npm i` beforehand)*\n\nThe most important ones are:\n\n- `npm run dev` - starts the server and watches for changes\n- `npm run build` - builds the example to `dist/`\n- `npm run preview` - starts a server to preview the built example\n- `npm run shdc` - generates shader utils from parsing glsl shaders","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthetarnav%2Fodin-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthetarnav%2Fodin-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthetarnav%2Fodin-wasm/lists"}