make depth buffer creation configurable

This commit is contained in:
Sebastian Krzyszkowiak 2018-11-27 03:06:43 +01:00
parent 9611be3267
commit 48189e7715
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
3 changed files with 7 additions and 2 deletions

View file

@ -500,7 +500,9 @@ SYMBOL_INTERNAL void ClearScreen(struct Game* game) {
al_set_target_backbuffer(game->display); al_set_target_backbuffer(game->display);
al_reset_clipping_rectangle(); al_reset_clipping_rectangle();
al_clear_to_color(al_map_rgb(0, 0, 0)); al_clear_to_color(al_map_rgb(0, 0, 0));
al_clear_depth_buffer(1.0); if (game->viewport_config.depth_buffer) {
al_clear_depth_buffer(1.0);
}
al_set_clipping_rectangle(game->_priv.clip_rect.x, game->_priv.clip_rect.y, game->_priv.clip_rect.w, game->_priv.clip_rect.h); al_set_clipping_rectangle(game->_priv.clip_rect.x, game->_priv.clip_rect.y, game->_priv.clip_rect.w, game->_priv.clip_rect.h);
} }

View file

@ -204,7 +204,9 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT, ALLEGRO_SUGGEST); al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT, ALLEGRO_SUGGEST);
#endif #endif
al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 24, ALLEGRO_SUGGEST); if (viewport.depth_buffer) {
al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 24, ALLEGRO_SUGGEST);
}
#ifdef ALLEGRO_WINDOWS #ifdef ALLEGRO_WINDOWS
al_set_new_window_position(20, 40); // workaround nasty Windows bug with window being created off-screen al_set_new_window_position(20, 40); // workaround nasty Windows bug with window being created off-screen

View file

@ -81,6 +81,7 @@ struct Viewport {
float aspect; /*!< When set instead of width/height pair, makes the viewport side fluid; when non-zero, locks its aspect ratio. */ float aspect; /*!< When set instead of width/height pair, makes the viewport side fluid; when non-zero, locks its aspect ratio. */
bool integer_scaling; /*!< Ensure that the viewport is zoomed only with integer factors. */ bool integer_scaling; /*!< Ensure that the viewport is zoomed only with integer factors. */
bool pixel_perfect; /*!< Ensure that the resulting image is really viewport-sized and (potentially) rescaled afterwards, as opposed to default transformation-based scaling. */ bool pixel_perfect; /*!< Ensure that the resulting image is really viewport-sized and (potentially) rescaled afterwards, as opposed to default transformation-based scaling. */
bool depth_buffer; /*!< Request a depth buffer for the framebuffer's render target. */
}; };
/*! \brief Main struct of the game. */ /*! \brief Main struct of the game. */