init
Parameters
- allocator:std.mem.Allocator
- std.mem.Allocator
- vtx_count:usize
- usize
- idx_count:usize
- usize
Source
Implementation
pub fn init(allocator: std.mem.Allocator, vtx_count: usize, idx_count: usize) std.mem.Allocator.Error!Builder {
std.debug.assert(vtx_count >= 3);
std.debug.assert(idx_count % 3 == 0);
var vtx: @FieldType(Builder, "vertexes") = try .initCapacity(allocator, vtx_count);
errdefer vtx.deinit(allocator);
return .{
.vertexes = vtx,
.indices = try .initCapacity(allocator, idx_count),
};
}