Colorful circle

This commit is contained in:
nothke 2024-06-12 01:26:06 +02:00
parent 64c94fd1b8
commit 7c97adabbe

View File

@ -25,7 +25,7 @@ export fn init() void {
std.log.info("Vertex buffers len: {}", .{state.bind.vertex_buffers.len});
const vertexCount = 8;
const radius: f32 = 0.4;
const radius: f32 = 0.7;
const cX: f32 = 0;
const cY: f32 = 0;
@ -36,6 +36,9 @@ export fn init() void {
const angleDiff: f32 = 1 / @as(f32, @floatFromInt(vertexCount));
var pcg = std.Random.Pcg.init(123);
const rand = pcg.random();
for (0..vertexCount) |i| {
const pi: f32 = @floatCast(std.math.pi);
const angle: f32 = @as(f32, @floatFromInt(i)) * angleDiff * pi * 2;
@ -47,6 +50,11 @@ export fn init() void {
triangleVerts[si + 0] = x;
triangleVerts[si + 1] = y;
triangleVerts[si + 2] = 0.5;
triangleVerts[si + 3] = rand.float(f32);
triangleVerts[si + 4] = rand.float(f32);
triangleVerts[si + 5] = rand.float(f32);
triangleVerts[si + 6] = 1;
}
// var triangleVerts = [_]f32{