u32 j = 0;
r_color final_color;
struct u_vec2 t = u_tile_to_screen(x, y);
- t = u_screen_to_camera(&t_main_camera, t);
+ struct u_vec2 te = u_tile_to_screen(x+1, y+1);
/* do not draw if tile is not visible at all */
- if (!t_camera_is_visible_world(&t_main_camera, t.x, t.y)
- && !t_camera_is_visible_world(&t_main_camera, t.x + R_TILE_W, t.y + R_TILE_H)) {
+ if (!t_camera_is_visible_screen(&t_main_camera, t.x, t.y)
+ && !t_camera_is_visible_screen(&t_main_camera, te.x, te.y)) {
return;
}
+ t = u_screen_to_camera(&t_main_camera, t);
/* converted origin point in isometric space */
}
lrts_bool t_camera_is_visible_screen(struct t_camera *c, i32 x, i32 y) {
- return u_point_in_rect(x, y, c->x, c->y, c->x + c->viewport_x, c->y + c->viewport_y);
-}
-
-lrts_bool t_camera_is_visible_world(struct t_camera *c, i32 x, i32 y) {
- struct u_vec2 t = u_point_to_screen(c->x, c->y);
-
- return u_point_in_rect(x, y, t.x, t.y, t.x + c->viewport_x, t.y + c->viewport_y);
+ return u_point_in_rect(x, y, c->x, c->y, c->viewport_x, c->viewport_y);
}
/* tests if a point is visible in screen sapce */
lrts_bool t_camera_is_visible_screen(struct t_camera *c, i32 x, i32 y);
-/* tests if a point is visible in world space */
-lrts_bool t_camera_is_visible_world(struct t_camera *c, i32 x, i32 y);
#endif