yum/demomo
A graphics engine built on wgpu.
git clone https://git.yummers.dev/yum/demomo
7bc7aa9
master
files
| .zed/ | |
| demos/hello-web/ | |
| shaders/ | |
| src/ | |
| .gitignore | 76 B |
| Cargo.toml | 1.3 KiB |
| LICENSE | 1.0 KiB |
| README.md | 2.0 KiB |
| build.rs | 210 B |
demomo
demomo is my webGPU-based engine. I forked it out of vfft once I decided to start working on graphical tasks.
Demomo is not ready for general use. It currently exists solely to serve vfft. Over time I expect that it will mature enough to be of use to others. I will delete this disclaimer once I believe it has reached that point.
Conventions
Right is +x, up is +y, near is +z.
If you declare these globals, the engine will plumb them for you:
public ConstantBuffer < Camera > camera ; public ConstantBuffer < Transform > transform ; public ConstantBuffer < Light > light ;
See their definitions in demomo.slang.
Put all user-defined uniforms in a struct, and declare a global called cfg:
public struct MyUniforms { float3 foo ; uint bar ; float4x4 baz ; ... } ; public ConstantBuffer < MyUniforms > cfg ;
The engine will automatically generate a UI for it, allowing you to manipulate them without recompiling the shader.
Vertex shaders must take a single struct input. Its inputs must conform to these names and types:
float3 objPos: vertex position in object space.float3 normal: vertex normal vector in object space.float2 uv0: 0th UV coordinate.float3 normal: normal vector in object space.float4 tangent: tangent vector in object space.float3 bitangent: bitangent vector in object space.
Building apps
Write your wgpu app, then build like so:
# Set this to any path you want. The slang compiler will be cloned and built # here. If you don't set this, then every time you change configs, you'll # have to reacquire and recompile slang, which takes ~5-10 minutes. $ export DMM_SLANG=$HOME /Documents/slang# Include --dev if you want useful stack traces in browser console. $ wasm-pack build . --target web --dev
AI Disclosure
This source code was written by a human and checked for errors with an LLM.
License.
MIT License.