isometric illusion using billboard function

This commit is contained in:
Tony Bark 2024-05-06 16:19:11 -04:00
parent 31ad180d66
commit 6c42a20204
3 changed files with 12 additions and 8 deletions

BIN
resources/items/dorms/table_3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
resources/items/dorms/table_4.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -24,14 +24,15 @@ pub fn main() anyerror!void {
var frame_counter: i32 = 0; var frame_counter: i32 = 0;
var camera = rl.Camera3D{ 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), .target = rl.Vector3.init(0, 0.0, 0),
.up = rl.Vector3.init(0, 1.0, 0), .up = rl.Vector3.init(0, 1.0, 0),
.fovy = 60, .fovy = 30,
.projection = rl.CameraProjection.camera_perspective, .projection = rl.CameraProjection.camera_perspective,
}; };
const floorLevel = rl.Vector3.init(0.0, 0.0, 0.0); 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); // const planePosition = rl.Vector3.init(0.0, 0.0, 0.0);
@ -46,8 +47,10 @@ pub fn main() anyerror!void {
// defer rl.closeAudioDevice(); // defer rl.closeAudioDevice();
const logo = rl.Texture.init("resources/logo.png"); const logo = rl.Texture.init("resources/logo.png");
const splash = rl.Texture.init("resources/tsosplash.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(splash);
defer rl.unloadTexture(logo); defer rl.unloadTexture(logo);
defer rl.unloadTexture(table4);
while (!rl.windowShouldClose()) { while (!rl.windowShouldClose()) {
@ -59,14 +62,13 @@ pub fn main() anyerror!void {
.login => { .login => {
frame_counter += 1; frame_counter += 1;
if (frame_counter > 120) current_screen = .world; if (frame_counter > 120) current_screen = .lot;
}, },
// //
.cas => {}, .cas => {},
.map => {}, .map => {},
.lot => { .lot => {
camera.update(rl.CameraMode.camera_third_person); // camera.update(rl.CameraMode.camera_custom);
try world.load_floors("resources/empty_lot_mysim.json");
}, },
} }
// ------------------ // ------------------
@ -87,15 +89,17 @@ pub fn main() anyerror!void {
}, },
// Skip this for now // Skip this for now
.cas => {}, .cas => {},
.map => {},
// "World" (i.e. lot view) // "World" (i.e. lot view)
.lot => { .lot => {
rl.clearBackground(rl.Color.ray_white); rl.clearBackground(rl.Color.sky_blue);
camera.begin(); camera.begin();
defer camera.end(); defer camera.end();
rl.drawPlane(floorLevel, rl.Vector2.init(2, 2), rl.Color.green); rl.drawPlane(floorLevel, rl.Vector2.init(64, 64), rl.Color.dark_green);
rl.drawGrid(64, 1.0); rl.drawBillboard(camera, table4, itemStatic, 2.0, rl.Color.white);
// rl.drawGrid(64, 1.0);
}, },
} }