diff options
author | quou <quou@disroot.org> | 2024-07-22 20:21:34 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-07-22 20:21:34 +1000 |
commit | d2c76fd62fa735f3d4fc3ceb55a75d6f0b2dc758 (patch) | |
tree | 92351ab512c5ec914ec5cbd918a5d72ed60bc0b6 /3de.c | |
parent | cf193ce71bd1f13cebcafac718c124640c912060 (diff) |
sampling textures in game.
Diffstat (limited to '3de.c')
-rw-r--r-- | 3de.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -19,28 +19,28 @@ void draw_spinny(Renderer* r, Colour c) { a += 20; } -void draw_monkey(Renderer* r) { +void draw_gun(Renderer* r) { static int a = 0; - const Mesh* m = get_mesh(asset_id_monkey); - Bitmap tex = { (Colour*)tile_pixels, 16, 16 }; + const Mesh* m = get_mesh(asset_id_gun_mesh); + const Texture* tex = get_texture(asset_id_gun_texture); int p[] = { 0, 0, 0, f1 }; mtx_push_trans(p); /*mtx_push_rot_x(a); mtx_push_rot_y(a); mtx_push_rot_z(a);*/ - ren_mesh(r, m, &tex); + ren_mesh(r, m, tex); mtx_popn(1); a++; } void draw_tri(Renderer* r, int x, int y) { - Bitmap t = { (Colour*)tile_pixels, 16, 16 }; - int v0[] = { 100, 100, 0, 0, 0, f1, 0, 0 }; - int v1[] = { 200, 200, 0, f1, f1/2, 0, f1, 0 }; - int v2[] = { 150, 300, 0, 0, f1, 0, 0, f1 }; + const Texture* tex = get_texture(asset_id_gun_texture); + int v0[] = { 100, 100, 0, 0, 0, f1, f1, f1 }; + int v1[] = { 200, 200, 0, f1, f1/2, f1, f1, f1 }; + int v2[] = { 150, 300, 0, 0, f1, f1, f1, f1 }; v1[0] = x; v1[1] = y; - ren_tri(r, v0, v1, v2, &t); + ren_tri(r, v0, v1, v2, tex); } int entrypoint(int argc, const char** argv, Arena* a) { @@ -95,7 +95,7 @@ int entrypoint(int argc, const char** argv, Arena* a) { sprintf(buf, "MOUSE: %d, %d", app->mx, app->my); ren_texts(&r, blue, 3, 13, buf); push_player_cam(&p); - draw_monkey(&r); + draw_gun(&r); pop_player_cam(); /*draw_tri(&r, app->mx, app->my);*/ ren_end(&r); |