yum/demomo
A graphics engine built on wgpu.
git clone https://git.yummers.dev/yum/demomo
8debfd1
master
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.
1# demomo 2 3demomo is my webGPU-based engine. I forked it out of 4[vfft]( https://git.yummers.dev/yum/vfft) once I decided to start working on 5graphical tasks. 6 7**Demomo is not ready for general use. It currently exists solely to serve 8[vfft]( https://git.yummers.dev/yum/vfft) .** Over time I expect that it will 9mature enough to be of use to others. I will delete this disclaimer once I 10believe it has reached that point. 11 12## Conventions 13 14Right is +x, up is +y, near is +z. 15 16If you declare these globals, the engine will plumb them for you: 17 18``` glsl 19public ConstantBuffer < Camera > camera ; 20public ConstantBuffer < Transform > transform ; 21public ConstantBuffer < Light > light ; 22``` 23 24See their definitions in demomo.slang. 25 26Put all user-defined uniforms in a struct, and declare a global called`cfg` : 27 28``` glsl 29public struct MyUniforms { 30float3 foo ; 31uint bar ; 32float4x4 baz ; 33... 34} ; 35public ConstantBuffer < MyUniforms > cfg ; 36``` 37 38The engine will automatically generate a UI for it, allowing you to manipulate 39them without recompiling the shader. 40 41Vertex shaders must take a single struct input. Its inputs must conform to 42these names and types: 43 44* `float3 objPos` : vertex position in object space. 45* `float3 normal` : vertex normal vector in object space. 46* `float2 uv0` : 0th UV coordinate. 47* `float3 normal` : normal vector in object space. 48* `float4 tangent` : tangent vector in object space. 49* `float3 bitangent` : bitangent vector in object space. 50 51## Building apps 52 53Write your wgpu app, then build like so: 54 55``` bash 56# Set this to any path you want. The slang compiler will be cloned and built 57# here. If you don't set this, then every time you change configs, you'll 58# have to reacquire and recompile slang, which takes ~5-10 minutes. 59$ export DMM_SLANG=$HOME /Documents/slang 60# Include --dev if you want useful stack traces in browser console. 61$ wasm-pack build . --target web --dev 62``` 63 64## AI Disclosure 65 66This source code was written by a human and checked for errors with an 67LLM. 68 69## License. 70 71MIT License.