Commit graph

1382 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
Stephen Gutekanst
a7e7dc800d mach: expose window size (pixel units, vs. framebuffer subpixel units)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-22 09:12:48 -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
iddev5
2b994d6b24 gpu: Fix build in 32-bit platforms
Because of the use of u64, this currently fails to build in 32-bit
platforms like wasm. usize is platform dependent but safe enough for
most use cases.
2022-05-21 23:00:38 -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
7bd841a638 mach: free EventNode(s) after poping from queue 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
iddev5
f1e7c10fbb mach: remove Action enum and all references to it 2022-05-20 09:14:32 -07:00
iddev5
7486b0ebea mach: Implement key input handling as event loop
This commit changes the former callback based design to handle key input
(GLFW-like) to an event loop based design (SDL-like). This uses a
TailQueue to store the events from inside of standard glfw callbacks.
This Queue is then popped while polling, thereby emulating event loop.

Removes from Engine the function: ``setKeyCallback`` and adds the
function: ``pollEvent`` which may return an event or null.

This change was done for two reasons:
1) Removing dependence of Engine on App. This was a circular dependency
   and a genuine bad design.
2) Solve the recent regression due to the same which was (i) preventing
   using types declared in Engine.zig and (ii) preventing usage of
   multiple source files in an application.

Currently only key press and release events are implemented as these are
the ones currently used in examples.
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
iddev5
5396769227 mach: implement all glfw -> mach key mappings 2022-05-09 08:08:01 -07:00
iddev5
71b7473ee7 mach: implement key press/release callback 2022-05-09 08:08:01 -07:00
iddev5
7a392b2780 mach: Add enums for keys and actions 2022-05-09 08:08:01 -07:00
Michal Ziulek
5a2aebb14b
gpu: correct sending of pointer to a local var to a callback function (#271) 2022-05-08 15:04:25 -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
Stephen Gutekanst
f97af80410
README: fix typo
Closes #268
2022-05-07 09:18:19 -07:00
Stephen Gutekanst
7ea0d84218 Revert "gpu-dawn: update to latest binary release" (CI broken)
This reverts commit c02424c435.
2022-05-05 12:35:35 -07:00
Release automation
c02424c435 gpu-dawn: update to latest binary release 2022-05-04 19:55:25 +00:00
iddev5
5861893752 CI: check compilation of all examples 2022-05-04 11:53:37 -07:00
d3m1gd
09f3adf2b4 examples: fix typo 2022-05-04 11:53:16 -07:00
iddev5
8904536632 mach: comptime interface-like implementation of engine cores 2022-05-01 17:07:29 -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
Michal Ziulek
0e64b9608c
gpu: 'dynamic_offsets' should be '?[] const u32' everywhere. (#260) 2022-04-30 08:57:10 -07:00
iddev5
e1192877c3 build: compile examples and applications on demand
Without this change, anytime a dependency is modified, all the examples
and applications are rebuilt before tring to run any of them. The
problem with this approach is that it leads to long compile times which
will keep on increasing as more and more examples are added.
2022-04-30 01:10:56 -07:00
Silver
ea76aa0268 gpu: fix store_op 2022-04-29 13:10:04 -07:00
iddev5
7c518f7bd6 shaderexp: port to new API 2022-04-29 13:06:42 -07:00
iddev5
218a6a5c08 examples: port to new API 2022-04-29 13:06:34 -07:00
iddev5
5c984d9795 mach: finalizing changes for now 2022-04-29 12:48:47 -07:00
iddev5
5249e72408 example: finalize triangle example to new API 2022-04-29 12:48:47 -07:00