Commit graph

534 commits

Author SHA1 Message Date
Stephen Gutekanst
3d27836318 mach: atlas: add UV calculation helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-04 10:29:30 -07:00
Stephen Gutekanst
a1b4c03f9d mach: add mach.Atlas implementation from Mitchell Hashimoto
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-04 08:25:14 -07:00
Stephen Gutekanst
0e1b79969f mach: remove ResourceManager for now
needs much more thought

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-30 20:40:30 -07:00
Stephen Gutekanst
4bc32adeb8 all: update to latest Zig APIs (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-29 09:54:32 -07:00
Stephen Gutekanst
29964c99bb update to latest Zig (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-25 00:01:55 -07:00
Răzvan C. Rădulescu
7866d3fd10 mach: update gfx2d-Sprite2D with optional texture view 2023-06-13 09:54:46 -07:00
Julian Rachele
eefe74fc06
gfx2d: align Uniforms struct on 16 bytes (#805) 2023-06-13 09:53:46 -07:00
Stephen Gutekanst
816b5101b3 core: use mach-sysjs via package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-05-19 08:21:31 -07:00
Grant Morris
33e27d9bf1
mach: fix deprecated mem.set() call (#770)
Updating to the @memset builtin fixes the cubemap and pbr-basic examples
assuming zigimg is also up to date

mem.set() appears to have been deprecated -
2023-05-18 20:49:42 -07:00
Stephen Gutekanst
a2d222072e mach: gfx2d: fix imports
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-05-17 20:38:10 -07:00
Stephen Gutekanst
8d2d31f6cb mach: add gfx2d / Sprite2D ECS module
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-05-17 20:34:28 -07:00
Stephen Gutekanst
03fe3d02a9 mach: add new mach.math module
https://machengine.org/next/engine/math/

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-05-17 20:32:57 -07:00
Stephen Gutekanst
1fbd36199a mach: depend on mach-ecs and mach-earcut standalone repositories
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-04-28 16:04:45 -07:00
Stephen Gutekanst
4ebf238c5e mach: use a minimal core App, with a module implementing everything
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
f41b1b4f7b mach: use type safe module wrapper/helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
353cf6144b mach: update to latest ECS module layout
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
85ffb37156 mach: handle exit via module globals
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
f153133c30 {mach,ecs}: pass World to ECS event handlers
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
15e6f81df8 mach: prepare to handle ECS init via modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
2879ad58b0 ecs: replace world.tick() with generic world.send(.tick) message passing
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
3ff4bcc2a3 mach: finish splitting Core and Engine
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-24 18:14:52 -07:00
Stephen Gutekanst
9bbada90b2 {mach,core}: move core sources to libs/core
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-24 18:14:52 -07:00
Ali Chraghi
192cacb85d mach: put logFn function to std_options 2023-01-20 14:53:22 -07:00
Stephen Gutekanst
0eaa56b4ad mach: platform/libmach: update to latest mach/core API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Stephen Gutekanst
a15b9bb5f6 mach: platform/wasm: correct return signature
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Stephen Gutekanst
8082228186 mach: eliminate heap allocation of Core
Prior to this change `mach.Core.init` would heap allocate the structure, returning `*Core`:

```zig
app.core = try mach.Core.init(allocator, .{});
```

This was obviously not ideal, but wasn't possible to eliminate before due to how Core was
entangled with the platform abstraction. Now that it has been removed, we can reduce Core
initialization to take a `*Core` to initialize. In practice this means initialization looks
something like this:

```zig
try mach.Core.init(&app.core, alloctor, .{});
```

Or more simply:

```zig
try app.core.init(allocator, .{});
```

And we eliminate the `*Core` allocation entirely in most cases.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Ali Chraghi
2fd8e876fd mach: re-create swapchain on vsync mode change 2023-01-15 09:45:17 -07:00
Ali Chraghi
10d5f344e3 {glfw,mach}: remove dead code 2023-01-15 08:31:26 -07:00
Ali Chraghi
a52c6e5f5c gpu: update interface to latest webgpu headers 2023-01-14 12:12:00 -07:00
Ali Chraghi
a97a33334c {mach, gpu-dawn}: don't hardcode linux window manager to X11 2023-01-12 10:51:16 -07:00
Ali Chraghi
1d7cd4be80 mach: fundamental changes
- Core doesn't depend to `App` anymore
 - `setOptions` has replaced with some new functions (`setTitle`,
   `setSize`, etc)
   - and more
2023-01-12 01:54:48 -07:00
Lue
91a53807ab mach: fix outdated reference to glfw.Error 2023-01-10 20:52:41 -07:00
Lue
eed2be4591 glfw: refactor getError and related functions
`getError()` now returns a struct `Error` containing `error_code` and
`description`. Rationale: retrieving the error code with the previous
implementation of `getError()` caused `getErrorString()` to return
null (the reverse is also true). The new implementation allows both
values to be retrieved at once.

The previous `getError()` function has been renamed to
`getErrorCode()` to reflect the fact that it returns a simple Zig
error rather than the `Error` struct. The error set returned by
`getErrorCode()` is now named `ErrorCode` rather than `Error`.

The behavior of the `getError()` family of functions clearing the
stored error is unchanged. However, since all code that used
`defer glfw.getError() catch {}` to explicitly clear errors had to be
refactored, a new `glfw.clearError()` function that returns void is
now available to make this operation more explicit.

Additionally, `mustGetError()` is now `mustGetErrorCode()`, and new
functions `mustGetError()` and `mustGetErrorString()` have been added
which wrap `getError()` and `getErrorString()` but panic if no error
is actually available.

Tests and API documentation had to be refactored across all of
`mach/glfw`. This commit also takes the opportunity to skip tests
involving window creation on CI so that other tests may still execute
normally.
2023-01-10 20:52:41 -07:00
Stephen Gutekanst
2cd4ce12f2 mach: update to latest GLFW error handling approach
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-08 18:21:11 -07:00
Ali Chraghi
b8deaf8010 mach: add borderless_window option 2022-12-28 11:47:51 -07:00
Ali Chraghi
c26592ea89 mach: render during resize 2022-12-28 11:47:51 -07:00
Beau McCartney
7d04252126
mach: remove compiler error for missing field in app (upstream issue fixed) (#647)
* platform: allow fieldless App
* platform: remove unused field

Co-authored-by: Beau McCartney <beau@beaumccartney.xyz>
2022-12-25 13:37:23 -07:00
citruslee
0e67b92676
mach: fix compiler error about missing field_type (#644) 2022-12-22 11:50:26 -07:00
Ali Chraghi
457986bb33 mach: fix compilation on latest zig 2022-12-18 18:02:31 -07:00
BratishkaErik
b1191cbeb5
{mach,gpu}: more undef/nul -> undefined/null renames (#638)
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2022-12-14 18:20:11 -07:00
Eric Joldasov
e832784e6b mach: use null and undefined in enums
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2022-12-14 02:18:21 -07:00
Keith Chambers
c151222011
mach: VertexWriter fixes (#633)
* mach: VertexWriter fixes
* mach: Reference decls in gfx
* remove comptime block from refAllDecls as is redundant
2022-11-30 09:27:00 -07:00
Keith Chambers
f331597bc2
mach: gfx: Add VertexWriter (#630) 2022-11-28 22:29:50 -07:00
dasimmet
caafb26fe4
mach: add option to set the monitor index on fullscreen (#611)
* add option to set the monitor index on fullscreen
* make monitor index optional

Co-authored-by: Tobias Simetsreiter <tobias.simetsreiter@meliot.de>
2022-11-14 15:46:42 -07:00
Stephen Gutekanst
212c902747 mach: test ResourceManager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-05 14:12:56 -07:00
Stephen Gutekanst
030cbf71a1 mach: resource: update function pointer declarations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-05 13:32:18 -07:00
Stephen Gutekanst
6a45971c6f trimesh2d: remove in favor of mach/earcut library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00
Stephen Gutekanst
96c2e35ab3 all: integrate earcut library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00
Ali Chraghi
a27121c00a mach: implement setCursorMode for wasm 2022-10-21 07:43:34 -07:00
Stephen Gutekanst
af357c0a8a mach: expose trimesh2d package
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-19 07:30:11 -07:00