summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2024-01-11 06:59:52 +0100
committerkdx <kikoodx@paranoici.org>2024-01-11 06:59:52 +0100
commit382cc075654935ebed6d503102291240a8a129df (patch)
tree6ca03ecf1589b37754994674ab571e8a0d4d3b44
parente208461e278ee4f0482dccd342935ad8a80ce59a (diff)
download008-382cc075654935ebed6d503102291240a8a129df.tar.gz
simplify spikes model
-rw-r--r--res/spike.mesh32
-rw-r--r--src/main.c4
-rw-r--r--src/mesh.c19
3 files changed, 28 insertions, 27 deletions
diff --git a/res/spike.mesh b/res/spike.mesh
index 466d30d..7875c34 100644
--- a/res/spike.mesh
+++ b/res/spike.mesh
@@ -1,26 +1,26 @@
-TRIANGLES
+LINES
- 0.0 0.0 0.0
+ 0.0 -0.3 0.0
-0.5 0.5 -0.5
0.5 0.5 -0.5
-0.5 0.5 0.5
0.5 0.5 0.5
- 0.0 0.0 -1.0
+ 0.0 -0.3 -1.0
-0.5 0.5 -1.5
0.5 0.5 -1.5
- 0.0 0.0 1.0
+ 0.0 -0.3 1.0
-0.5 0.5 1.5
0.5 0.5 1.5
-0 1 2
-0 3 4
-0 1 3
-0 2 4
-5 6 7
-5 1 2
-5 6 1
-5 7 2
-8 3 4
-8 10 10
-8 3 9
-8 4 10
+0 1
+0 2
+0 3
+0 4
+5 1
+5 2
+5 6
+5 7
+8 3
+8 4
+8 9
+8 10
diff --git a/src/main.c b/src/main.c
index fe94334..73cfea4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -75,8 +75,8 @@ _main_loop([[maybe_unused]] void *udata)
m = mat4_dot(m, mat4_translating(-7.5 - x, -7.5 - y, -256));
Mat4 m_spike = mat4_identity();
- m_spike = mat4_dot(m_spike, mat4_scaling(0.9, 0.9, 16));
- m_spike = mat4_dot(m_spike, mat4_translating(-7.5 - x, -7.5 - y, -256));
+ m_spike = mat4_dot(m_spike, mat4_scaling(0.9, 1.0, 16));
+ m_spike = mat4_dot(m_spike, mat4_translating(-7.5 - x, -7.45 - y, -256));
TZR_DrawSetColor(1, 0, 0);
repeat (y, 16) {
diff --git a/src/mesh.c b/src/mesh.c
index 10b4a16..5d8d3a1 100644
--- a/src/mesh.c
+++ b/src/mesh.c
@@ -131,12 +131,13 @@ _draw_line(Mesh *this, u8 idx1, u8 idx2)
static void
_mesh_draw_lines(Mesh *this)
{
- u8 pre = 255;
- rfor (i, 0u, this->indices->size) {
- const auto idx = this->indices->p[i];
- if (pre != 255)
- _draw_line(this, pre, idx);
- pre = idx;
+ assert(this->indices->size % 2 == 0);
+ for (size_t i = 0; i < this->indices->size; i += 2) {
+ const u8 idx[2] = {
+ this->indices->p[i],
+ this->indices->p[i + 1],
+ };
+ _draw_line(this, idx[0], idx[1]);
}
}
@@ -195,9 +196,9 @@ mesh_draw(Mesh *this, Mat4 transform)
vertex = point_transform(vertex, transform);
vertex = point_transform(vertex, g_projection);
vertex = point_screenspace(vertex);
- vertex = point_add(vertex,point(randf() * 1.2,
- randf() * 1.2,
- randf() * 1.2));
+ //vertex = point_add(vertex,point(randf() * 1.2,
+ // randf() * 1.2,
+ // randf() * 1.2));
this->transformed->p[i] = vertex;
}