Commit graph

108 commits

Author SHA1 Message Date
Stephen Gutekanst
01f88df397 examples/gkurve: make orthographic view use pixel (not subpixel) units
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-22 09:12:53 -07:00
PiergiorgioZagaria
1e8ad533e2
examples: gkurve added shapes and textures (#284) 2022-05-22 08:52:40 -07:00
iddev5
f4de00d8b5 examples: boids: use std.log.info instead of std.debug.print
std.debug.print uses IO which depends on file system and thus needs
support from OS, which dont have in freestanding targets (like WASM).
2022-05-22 08:26:56 -07:00
Stephen Gutekanst
ff5636c6f6 examples/gkurve: adjust frag shader to show barycentric coordinates
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-21 12:40:29 -07:00
Stephen Gutekanst
2b2ba15332 examples/gkurve: correct triangle coordinates (one was inverted horizontally)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-21 12:18:10 -07:00
Stephen Gutekanst
2d4d856e55 examples/gkurve: fix bug in barycentric coordinates
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-21 12:14:05 -07:00
Stephen Gutekanst
2b718c6de1 examples/gkurve: explain frag_bary coordinates intent
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-21 11:26:54 -07:00
Stephen Gutekanst
eae2a090c6 examples/gkurve: border rendering, non-linear field
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-20 12:26:43 -07:00
iddev5
58709070dd examples: remove commented out old code in advanced-gen-texture-light 2022-05-20 09:14:32 -07:00
iddev5
02b9048734 examples: update to new event-based input method 2022-05-20 09:14:32 -07:00
Stephen Gutekanst
92028a11ef examples/gkurve: take into account high density displays
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-20 08:56:47 -07:00
PiergiorgioZagaria
a4e8de2a83 examples: fix depth texture recreation 2022-05-20 08:52:14 -07:00
iddev5
3bb45c75a1 mach: introduce cross platform Timer abstraction
This Timer uses std.time.Timer as backing timer in native platforms, and
will use custom timers for special platforms (wasm, android?, ios?).

Unlike std.time.Timer, its primary API is focused on floats. Also meant
to provides some convenient functions alongside base ones.

Follows std.time.Timer API, but methods by default return f32 i.e
non-precise variant with precise variants available returning u64.
2022-05-17 23:56:41 -07:00
Stephen Gutekanst
be935c64ef examples/gkurve: change window size to default 2022-05-15 10:36:08 -07:00
iddev5
657091ed65 mach: Reorganised native backend files, moved structs and fixed circular
dependency
2022-05-15 10:36:08 -07:00
PiergiorgioZagaria
2df0bc2786
examples/gkurve: moved vertex uniform data to vertex buffer and added view (#277) 2022-05-15 10:34:09 -07:00
Stephen Gutekanst
34e019a212 examples/gkurve: use equadistant triangles for easier debugging
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-15 02:55:23 -07:00
Stephen Gutekanst
e35b86ad25 examples/gkurve: calculate barycentric vertex coordinates in shader
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-15 02:55:23 -07:00
Stephen Gutekanst
dae283734f examples/gkurve: cleanup code formatting
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-15 02:55:23 -07:00
Stephen Gutekanst
1562232871 examples/gkurve: use orthographic projection + pixel units
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-15 02:55:23 -07:00
Stephen Gutekanst
af608151e9 examples/gkurve: simplify fragment shader, use barycentric coordinates
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-14 13:23:45 -07:00
iddev5
8b46f46cf8 mach: Create binding methods for all glfw methods in use and update
examples
2022-05-13 16:17:18 -07:00
iddev5
9106a9839d examples: remove global state workaround in advanced-gen-texture-light 2022-05-09 08:08:01 -07:00
iddev5
1f95bd48df examples: use engine.core.setKeyCallback() instead of accessing glfw directly 2022-05-09 08:08:01 -07:00
PiergiorgioZagaria
a1daf399a3 examples: created gkurve example 2022-05-08 15:02:39 -07:00
PiergiorgioZagaria
ddf8704559 examples: fixed uniform buffer release and unused var 2022-05-08 09:48:05 -07:00
d3m1gd
09f3adf2b4 examples: fix typo 2022-05-04 11:53:16 -07:00
iddev5
2b978a6883 examples: fix unwanted fractal cube resource releases causing validation error 2022-05-01 11:46:43 -07:00
Lee Cannon
4570838304
Update to latest Zig master (0.10.0-dev.2017+a0a2ce92c) (#261)
* use `@ceil` instead of `std.math.ceil`
* `ChildProcess.init` does not allocate anymore
* update CI zig version
* examples: temporarily switch to fork of zigimg compatible with zig-master

Commands executed:

```
git submodule set-url -- examples/libs/zigimg https://github.com/slimsag/zigimg
git submodule set-branch --branch zig-master -- examples/libs/zigimg
git submodule update --init --remote examples/libs/zigimg
```

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-01 11:44:27 -07:00
iddev5
218a6a5c08 examples: port to new API 2022-04-29 13:06:34 -07:00
iddev5
5249e72408 example: finalize triangle example to new API 2022-04-29 12:48:47 -07:00
iddev5
2aedc4ca01 mach: implement App struct in terms of unified entry point 2022-04-29 12:48:47 -07:00
iddev5
3e87b383d2 examples: workaround fix for testing unified entry point 2022-04-29 12:48:47 -07:00
iddev5
ffcd5dfaa8 examples: fix incorrect release of resources in fractal-cube 2022-04-29 12:45:04 -07:00
PiergiorgioZagaria
d6dad96059 examples: added fractal-cube example 2022-04-24 23:24:34 +00:00
Stephen Gutekanst
d0d0db8725 examples: add textured-cube example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-24 16:07:59 +00:00
Stephen Gutekanst
99de6a5b11 examples: add assets submodule
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-24 16:07:59 +00:00
Stephen Gutekanst
77e86f22c5 examples/libs: add zigimg dependency
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-24 16:07:59 +00:00
Stephen Gutekanst
8d574e772c examples: rename texture-light -> advanced-gen-texture-light
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-21 04:39:24 -07:00
Stephen Gutekanst
417ec654df examples: texture-light: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-21 04:39:24 -07:00
Stephen Gutekanst
9ec8553cf8 examples: texture-light: more instances, rotate camera by default, make movement independent of frame-rate
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-21 04:39:24 -07:00
Stephen Gutekanst
e7609c76a2 examples: texture-light: don't crash on window resize (recreate depth buffer)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-21 04:39:24 -07:00
Stephen Gutekanst
7daff572f3 examples: correct texture size for running on macOS
```
mach: found Metal backend on Discrete GPU adapter: Apple M1, Metal driver on macOS Version 12.1 (Build 21C52)
gpu: validation error: Attachment [TextureView] size (width: 640, height: 480) does not match the size of the other attachments (width: 1280, height: 960).
 - While validating depthStencilAttachment.
 - While encoding [CommandEncoder].BeginRenderPass([RenderPassDescriptor]).
```

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-21 04:39:24 -07:00
d3m1gd
45df76bdd8 example: texture and light 2022-04-21 04:39:24 -07:00
Stephen Gutekanst
8137f1a914 examples: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-20 23:01:30 -07:00
Johan Forsberg
3b86aa08cc
examples: add instanced-cube example (#246)
add example based on webgpu-samples' instancedCube sample.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-20 23:00:02 -07:00
PiergiorgioZagaria
8f7a20d2e6
examples: fix BlendState for rotating-cube and two-cubes (#244) 2022-04-20 10:59:40 -07:00
d3m1gd
6300c85e79
examples: fix blend mode in triangle example (#240)
Co-authored-by: d3m1gd <mach+d3m1gd@users.noreply.github.com>
2022-04-18 23:50:23 -07:00
PiergiorgioZagaria
3fb59a1e34
examples: add ported two-cubes example (#228) 2022-04-17 14:31:52 -07:00
PiergiorgioZagaria
f96bbb453e
examples: add ported rotating-cube example (#227) 2022-04-17 13:50:25 -07:00