Colorful circle
This commit is contained in:
parent
64c94fd1b8
commit
7c97adabbe
10
src/main.zig
10
src/main.zig
@ -25,7 +25,7 @@ export fn init() void {
|
|||||||
std.log.info("Vertex buffers len: {}", .{state.bind.vertex_buffers.len});
|
std.log.info("Vertex buffers len: {}", .{state.bind.vertex_buffers.len});
|
||||||
|
|
||||||
const vertexCount = 8;
|
const vertexCount = 8;
|
||||||
const radius: f32 = 0.4;
|
const radius: f32 = 0.7;
|
||||||
|
|
||||||
const cX: f32 = 0;
|
const cX: f32 = 0;
|
||||||
const cY: f32 = 0;
|
const cY: f32 = 0;
|
||||||
@ -36,6 +36,9 @@ export fn init() void {
|
|||||||
|
|
||||||
const angleDiff: f32 = 1 / @as(f32, @floatFromInt(vertexCount));
|
const angleDiff: f32 = 1 / @as(f32, @floatFromInt(vertexCount));
|
||||||
|
|
||||||
|
var pcg = std.Random.Pcg.init(123);
|
||||||
|
const rand = pcg.random();
|
||||||
|
|
||||||
for (0..vertexCount) |i| {
|
for (0..vertexCount) |i| {
|
||||||
const pi: f32 = @floatCast(std.math.pi);
|
const pi: f32 = @floatCast(std.math.pi);
|
||||||
const angle: f32 = @as(f32, @floatFromInt(i)) * angleDiff * pi * 2;
|
const angle: f32 = @as(f32, @floatFromInt(i)) * angleDiff * pi * 2;
|
||||||
@ -47,6 +50,11 @@ export fn init() void {
|
|||||||
triangleVerts[si + 0] = x;
|
triangleVerts[si + 0] = x;
|
||||||
triangleVerts[si + 1] = y;
|
triangleVerts[si + 1] = y;
|
||||||
triangleVerts[si + 2] = 0.5;
|
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{
|
// var triangleVerts = [_]f32{
|
||||||
|
Loading…
Reference in New Issue
Block a user