From 6c42a20204036a8ffd2607b54a9abe67978ade9b Mon Sep 17 00:00:00 2001 From: Tony Bark Date: Mon, 6 May 2024 16:19:11 -0400 Subject: [PATCH] isometric illusion using billboard function --- resources/items/dorms/table_3.png | Bin 0 -> 1981 bytes resources/items/dorms/table_4.png | Bin 0 -> 2279 bytes src/main.zig | 20 ++++++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100755 resources/items/dorms/table_3.png create mode 100755 resources/items/dorms/table_4.png diff --git a/resources/items/dorms/table_3.png b/resources/items/dorms/table_3.png new file mode 100755 index 0000000000000000000000000000000000000000..31904c19ea300d1aa7853a05b6983c1fef9430ba GIT binary patch literal 1981 zcmZ9M3se)=7KSGYLEZ)kQ7Ml=fd&d9s1#8k;nhF{LWCl*1Q0I|Bhng0N}o^$5Rzt8z+ttqC5 zeQc;_t_MMoVK6m-0je7aPaO=%iJ=p}KoCkv-y0dIW3!9P2Z0)3EnlQ5ViEt{{>8xTzx-eKK_Zn&C1R=C5V2HK zq+muWm&#;P;D&ne_PeY*^UfAIf?SXA$^&0L{5T_QAE>Cepx=VgQiIjj`3nOB10xL^ z)!>XZ;LQk|*LlwZU}n}yV56! zDC+;|TfcYu7DDdo{&#xIiWtU^d6GRFjCdrg)n-)@bgk~35V!M{x@NF2uKg7>( zEbLNr?3>UNu~|!=jhjE5t5VVoPxY)?cP&4>U^z8yV(R)ZSBZ>y?;L$O*>$qh@N+Oo zC)G#dv#+-;hTbckm2&Ytj0n4D%5dK|UQeXr!MKfH3m5ALcAgE99DFZeE{A8e7$`_wh27ivd-i9|;e`kv^P zSZ8;tJesqUXRGnUNJr;?Y9@*~X!q0gr`p=M6zBBxI}dF2;)jFYuO!&>6N&Q5i$3E& zV^2Swl`f84^T2=goa7#1WgoJ$g#dRSJ9KKTyyb>$-pc#VoSnxRnb6DBIRaPxW)g2@ zIeUE8w~Lfj_NFyoc(aa(4t1%519jc_IA_Z&x53=naREKPwxBwh(?%d2Oj#zlyX{XM zjnZc~@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qdCE?=>aW?W#LxkF4%`R$fu3RYp$I)3>qbmnv9&E1qomb;;be-)_FO z7A;A(g${e&w&eft*iom#(W|>&HS#2ea%kgYaw#6~#egD5d3Met4H@5YEz-PeH+rTeQbf-#8cAR%mABH1k>N;l&?w;-@ZYEpnLW?_C@( zHeh*qL|8dI+~gGUp~<+8ROjxfyWBsaJ~cFM-P^0$&_0Hi&7;tL$IjChyOM1VwUmUH zu6c@D>3bSjdx}lD$Nyr}y;oS@Sk(AjZ^n|a=o?lxN%kbJ0ZVLeee5PI@d&>-aevFY zx)WP&KB#SDXs6JV>;D(5|Pn*NdBS{j}A#wWkp+?Ym2lY5s7(raY~#`Jr4 z#q$!jV8>ppyfTOXVzYZ!!KHV@F@Y!SOgqdywLPl_|Rl3*o8x>ekT^{+*v}UTI$m3D#U(b$GOfK@1pJ6?-l%zeN;SX z8#{*mVgJi`0Ex3M;E%NRM^n=@e81v}TRe3jxjW=ay~|h%(}T4pH~j)b(&)M@VE@v96(s53>T~L=pNm?3k7QK_?h2mVsZ%~S5jmOk_o&ZBJ=tQ~ ztZh?`?q;Zk`gt#YHn_K2rMX+)o!|9(lU+wyvoe`=D|-9q*NHZ-a*dPI6`tK6sUv;; zpKH|pbwaDfCKfw0_5>-yNO{uBC3gq&w6DbXQ)lXVk13CyaSFC8DxTs8-F6U!*R6fE zeaGZMjiw{bphP*g_efRqr_vzV#N^OP@u=%aeAJZP(utp9a%w%M5^dhOEy$z#{fM@V z$GLV`9IhI literal 0 HcmV?d00001 diff --git a/src/main.zig b/src/main.zig index ec77b74..f39dede 100644 --- a/src/main.zig +++ b/src/main.zig @@ -24,14 +24,15 @@ pub fn main() anyerror!void { var frame_counter: i32 = 0; var camera = rl.Camera3D{ - .position = rl.Vector3.init(0.0, 10.0, 10.0), + .position = rl.Vector3.init(0.0, 20.0, 20.0), .target = rl.Vector3.init(0, 0.0, 0), .up = rl.Vector3.init(0, 1.0, 0), - .fovy = 60, + .fovy = 30, .projection = rl.CameraProjection.camera_perspective, }; const floorLevel = rl.Vector3.init(0.0, 0.0, 0.0); + const itemStatic = rl.Vector3.init(0.0, 2.0, 0.0); // const planePosition = rl.Vector3.init(0.0, 0.0, 0.0); @@ -46,8 +47,10 @@ pub fn main() anyerror!void { // defer rl.closeAudioDevice(); const logo = rl.Texture.init("resources/logo.png"); const splash = rl.Texture.init("resources/tsosplash.png"); + const table4 = rl.Texture.init("resources/items/dorms/table_4.png"); defer rl.unloadTexture(splash); defer rl.unloadTexture(logo); + defer rl.unloadTexture(table4); while (!rl.windowShouldClose()) { @@ -59,14 +62,13 @@ pub fn main() anyerror!void { .login => { frame_counter += 1; - if (frame_counter > 120) current_screen = .world; + if (frame_counter > 120) current_screen = .lot; }, // .cas => {}, .map => {}, .lot => { - camera.update(rl.CameraMode.camera_third_person); - try world.load_floors("resources/empty_lot_mysim.json"); + // camera.update(rl.CameraMode.camera_custom); }, } // ------------------ @@ -87,15 +89,17 @@ pub fn main() anyerror!void { }, // Skip this for now .cas => {}, + .map => {}, // "World" (i.e. lot view) .lot => { - rl.clearBackground(rl.Color.ray_white); + rl.clearBackground(rl.Color.sky_blue); camera.begin(); defer camera.end(); - rl.drawPlane(floorLevel, rl.Vector2.init(2, 2), rl.Color.green); - rl.drawGrid(64, 1.0); + rl.drawPlane(floorLevel, rl.Vector2.init(64, 64), rl.Color.dark_green); + rl.drawBillboard(camera, table4, itemStatic, 2.0, rl.Color.white); + // rl.drawGrid(64, 1.0); }, }