update to Zig 2024.1.0-mach
Related to hexops/mach#1145 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
5bea00d997
commit
b5531f84cb
5 changed files with 40 additions and 44 deletions
|
|
@ -144,7 +144,7 @@ pub fn reserve(self: *Atlas, alloc: Allocator, width: u32, height: u32) !Region
|
|||
if (width == 0 and height == 0) return region;
|
||||
|
||||
// Find the location in our nodes list to insert the new node for this region.
|
||||
var best_idx: usize = best_idx: {
|
||||
const best_idx: usize = best_idx: {
|
||||
var best_height: u32 = std.math.maxInt(u32);
|
||||
var best_width: u32 = best_height;
|
||||
var chosen: ?usize = null;
|
||||
|
|
@ -256,11 +256,8 @@ pub fn set(self: *Atlas, reg: Region, data: []const u8) void {
|
|||
while (i < reg.height) : (i += 1) {
|
||||
const tex_offset = (((reg.y + i) * self.size) + reg.x) * depth;
|
||||
const data_offset = i * reg.width * depth;
|
||||
std.mem.copy(
|
||||
u8,
|
||||
self.data[tex_offset..],
|
||||
data[data_offset .. data_offset + (reg.width * depth)],
|
||||
);
|
||||
const src = data[data_offset .. data_offset + (reg.width * depth)];
|
||||
@memcpy(self.data[tex_offset .. tex_offset + src.len], src);
|
||||
}
|
||||
|
||||
self.modified = true;
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ test "Mat2x2_mulVec_vec2_ident" {
|
|||
const v = math.Vec2.splat(1);
|
||||
const ident = math.Mat2x2.ident;
|
||||
const expected = v;
|
||||
var m = math.Mat2x2.mulVec(&ident, &v);
|
||||
const m = math.Mat2x2.mulVec(&ident, &v);
|
||||
|
||||
try testing.expect(math.Vec2, expected).eql(m);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ pub fn Ray(comptime Vec3P: type) type {
|
|||
vc: *const Vec3P,
|
||||
backface_culling: bool,
|
||||
) ?Hit {
|
||||
var kz: u8 = maxDim([3]P{
|
||||
const kz: u8 = maxDim([3]P{
|
||||
@abs(ray.direction.v[0]),
|
||||
@abs(ray.direction.v[1]),
|
||||
@abs(ray.direction.v[2]),
|
||||
|
|
@ -110,25 +110,25 @@ pub fn Ray(comptime Vec3P: type) type {
|
|||
|
||||
var u: P = cx * by - cy * bx;
|
||||
var v: P = ax * cy - ay * cx;
|
||||
var w: P = bx * ay - by * ax;
|
||||
const w: P = bx * ay - by * ax;
|
||||
|
||||
// Double precision fallback
|
||||
if (u == 0.0 or v == 0.0 or w == 0.0) {
|
||||
const cxby: PP = @as(PP, @floatCast(cx)) *
|
||||
@as(PP, @floatCast(by));
|
||||
var cybx: PP = @as(PP, @floatCast(cy)) *
|
||||
const cybx: PP = @as(PP, @floatCast(cy)) *
|
||||
@as(PP, @floatCast(bx));
|
||||
u = @floatCast(cxby - cybx);
|
||||
|
||||
var axcy: PP = @as(PP, @floatCast(ax)) *
|
||||
const axcy: PP = @as(PP, @floatCast(ax)) *
|
||||
@as(PP, @floatCast(cy));
|
||||
var aycx: PP = @as(PP, @floatCast(ay)) *
|
||||
const aycx: PP = @as(PP, @floatCast(ay)) *
|
||||
@as(PP, @floatCast(cx));
|
||||
v = @floatCast(axcy - aycx);
|
||||
|
||||
var bxay: PP = @as(PP, @floatCast(bx)) *
|
||||
const bxay: PP = @as(PP, @floatCast(bx)) *
|
||||
@as(PP, @floatCast(ay));
|
||||
var byax: PP = @as(PP, @floatCast(by)) *
|
||||
const byax: PP = @as(PP, @floatCast(by)) *
|
||||
@as(PP, @floatCast(ax));
|
||||
v = @floatCast(bxay - byax);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue