Skip to content

Commit

Permalink
isometric illusion using billboard function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Bark committed May 6, 2024
1 parent 31ad180 commit 6c42a20
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Binary file added resources/items/dorms/table_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/items/dorms/table_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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()) {

Expand All @@ -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);
},
}
// ------------------
Expand All @@ -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);
},
}

Expand Down

0 comments on commit 6c42a20

Please sign in to comment.