Use inline namespace dsx for similar/arch/ogl/

This commit is contained in:
Kp 2015-12-13 18:00:48 +00:00
parent d4857f4257
commit 09eba7f48a
8 changed files with 76 additions and 11 deletions

View file

@ -100,9 +100,12 @@ typedef std::unique_ptr<grs_subcanvas> grs_subcanvas_ptr;
class grs_main_bitmap;
typedef std::unique_ptr<grs_main_bitmap> grs_bitmap_ptr;
uint_fast32_t gr_list_modes(array<screen_mode, 50> &modes);
}
uint_fast32_t gr_list_modes(array<screen_mode, 50> &modes);
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
inline namespace dsx {
int gr_set_mode(screen_mode mode);
int gr_init();
@ -110,6 +113,8 @@ int gr_init();
void gr_set_attributes();
#endif
void gr_close();
}
#endif
inline namespace dcx {
@ -343,9 +348,11 @@ void gr_palette_step_up(int r, int g, int b);
// best matches the input.
color_t gr_find_closest_color(int r, int g, int b);
int gr_find_closest_color_15bpp(int rgb);
void gr_flip();
}
void gr_flip();
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
inline namespace dsx {
/*
* must return 0 if windowed, 1 if fullscreen
@ -357,9 +364,14 @@ int gr_check_fullscreen();
* check_fullscreen immediatly after)
*/
void gr_toggle_fullscreen();
}
#endif
inline namespace dcx {
void ogl_do_palfx();
void ogl_init_pixel_buffers(unsigned w, unsigned h);
void ogl_close_pixel_buffers();
}
void ogl_cache_polymodel_textures(int model_num);;
#endif

View file

@ -21,9 +21,11 @@ void ogl_init_texture_list_internal(void);
void ogl_smash_texture_list_internal(void);
void ogl_vivify_texture_list_internal(void);
inline namespace dcx {
extern int linedotscale;
extern int GL_TEXTURE_2D_enabled;
}
#define OGL_SET_FEATURE_STATE(G,V,F) static_cast<void>(G != V && (G = V, F, 0))
#define OGL_ENABLE(a) OGL_SET_FEATURE_STATE(GL_##a##_enabled, 1, glEnable(GL_##a))
@ -35,6 +37,7 @@ extern int GL_TEXTURE_2D_enabled;
//#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m));
//#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m))
inline namespace dcx {
extern unsigned last_width,last_height;
static inline void OGL_VIEWPORT(const unsigned x, const unsigned y, const unsigned w, const unsigned h)
{
@ -45,10 +48,17 @@ static inline void OGL_VIEWPORT(const unsigned x, const unsigned y, const unsign
last_height=h;
}
}
}
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
inline namespace dsx {
//platform specific funcs
extern void ogl_swap_buffers_internal(void);
}
#endif
//whee
#define CPAL2Tr(c) ((gr_current_pal[c].r)/63.0)
#define CPAL2Tg(c) ((gr_current_pal[c].g)/63.0)

View file

@ -78,11 +78,9 @@ void ogl_init_texture(ogl_texture &t, int w, int h, int flags);
void ogl_init_shared_palette(void);
extern int active_texture_unit;
inline namespace dcx {
extern GLfloat ogl_maxanisotropy;
void ogl_setActiveTexture(int t);
#define OGL_FLAG_MIPMAP (1 << 0)
#define OGL_FLAG_NOCOLOR (1 << 1)
#define OGL_FLAG_ALPHA (1 << 31) // not required for ogl_loadbmtexture, since it uses the BM_FLAG_TRANSPARENT, but is needed for ogl_init_texture.
@ -92,7 +90,6 @@ void ogl_freebmtexture(grs_bitmap &bm);
void ogl_start_frame(void);
void ogl_end_frame(void);
void ogl_set_screen_mode(void);
void ogl_cache_level_textures(void);
void ogl_urect(int left, int top, int right, int bot);
bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap &bm,int c, int scale);
@ -101,6 +98,12 @@ bool ogl_ubitblt(unsigned w, unsigned h, unsigned dx, unsigned dy, unsigned sx,
void ogl_upixelc(int x, int y, int c);
unsigned char ogl_ugpixel(const grs_bitmap &bitmap, unsigned x, unsigned y);
void ogl_ulinec(int left, int top, int right, int bot, int c);
}
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
inline namespace dsx {
void ogl_cache_level_textures();
}
#endif
#include "3d.h"
void _g3_draw_tmap_2(unsigned nv, const g3s_point *const *const pointlist, const g3s_uvl *uvl_list, const g3s_lrgb *light_rgb, grs_bitmap *bmbot, grs_bitmap *bm, int orient);
@ -117,9 +120,11 @@ static inline void g3_draw_tmap_2(unsigned nv, const array<cg3s_point *, N> &poi
}
void ogl_draw_vertex_reticle(int cross,int primary,int secondary,int color,int alpha,int size_offs);
inline namespace dcx {
void ogl_toggle_depth_test(int enable);
void ogl_set_blending();
unsigned pow2ize(unsigned x);//from ogl.c
}
#endif

View file

@ -55,9 +55,9 @@ void copy_diminish_palette(palette_array_t &palette, const ubyte *p);
void diminish_palette(palette_array_t &palette);
extern void gr_palette_set_gamma( int gamma );
extern int gr_palette_get_gamma();
void gr_palette_load( palette_array_t &pal );
}
#endif
void gr_palette_load( palette_array_t &pal );
inline namespace dcx {
color_t gr_find_closest_color_current( int r, int g, int b );
}

View file

@ -159,9 +159,15 @@ extern void stop_time(void);
extern void start_time(void);
extern void reset_time(void); // called when starting level
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
inline namespace dsx {
// If automap_flag == 1, then call automap routine to write message.
extern void save_screen_shot(int automap_flag);
}
#endif
enum cockpit_mode_t
{
//valid modes for cockpit

View file

@ -80,6 +80,8 @@
using std::max;
inline namespace dcx {
static int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
#ifdef OGLES
@ -104,6 +106,8 @@ static int sdl_no_modeswitch;
enum { sdl_no_modeswitch = 0 };
#endif
}
#ifdef OGLES
static EGLDisplay eglDisplay=EGL_NO_DISPLAY;
static EGLConfig eglConfig;
@ -128,6 +132,8 @@ static bool TestEGLError(const char* pszLocation)
}
#endif
inline namespace dsx {
void ogl_swap_buffers_internal(void)
{
#ifdef OGLES
@ -571,6 +577,10 @@ static void ogl_get_verinfo(void)
#endif
}
}
inline namespace dcx {
// returns possible (fullscreen) resolutions if any.
uint_fast32_t gr_list_modes(array<screen_mode, 50> &gsmodes)
{
@ -614,6 +624,10 @@ uint_fast32_t gr_list_modes(array<screen_mode, 50> &gsmodes)
}
}
}
inline namespace dsx {
static int gr_check_mode(const screen_mode mode)
{
if (sdl_no_modeswitch == 0) {
@ -811,6 +825,10 @@ void gr_close()
#endif
}
}
inline namespace dcx {
void ogl_upixelc(int x, int y, int c)
{
GLfloat vertex_array[] = {
@ -960,8 +978,6 @@ void ogl_do_palfx(void)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
inline namespace dcx {
static int ogl_brightness_ok;
static int old_b_r, old_b_g, old_b_b;
@ -991,6 +1007,8 @@ void gr_palette_step_up(int r, int g, int b)
}
inline namespace dsx {
#undef min
using std::min;
@ -1093,3 +1111,5 @@ void save_screen_shot(int automap_flag)
write_bmp(savename, grd_curscreen->get_screen_width(), grd_curscreen->get_screen_height());
}
}

View file

@ -83,6 +83,8 @@ using std::max;
#define sinf(a) sin(a)
#endif
inline namespace dcx {
static std::unique_ptr<GLubyte[]> texbuf;
static palette_array_t *ogl_pal = &gr_palette;
@ -119,6 +121,8 @@ static void ogl_loadbmtexture(grs_bitmap &bm)
ogl_loadbmtexture_f(bm, GameCfg.TexFilt);
}
}
#ifdef OGLES
// Replacement for gluPerspective
static void perspective(double fovy, double aspect, double zNear, double zFar)
@ -382,6 +386,8 @@ static void ogl_cache_weapon_textures(int weapon_type)
}
}
inline namespace dsx {
void ogl_cache_level_textures(void)
{
int side;
@ -539,6 +545,8 @@ void ogl_cache_level_textures(void)
r_cachedtexcount = r_texcount;
}
}
inline namespace dcx {
void g3_draw_line(const g3s_point &p0,const g3s_point &p1)
@ -1127,8 +1135,6 @@ void g3_draw_bitmap(const vms_vector &pos, const fix iwidth, const fix iheight,
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
/*
* Movies
* Since this function will create a new texture each call, mipmapping can be very GPU intensive - so it has an optional setting for texture filtering.
@ -1773,3 +1779,5 @@ bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap &bm,int c, int scal
return 0;
}
}

View file

@ -49,6 +49,8 @@ void gr_flip()
SDL_Flip(screen);
}
inline namespace dcx {
// returns possible (fullscreen) resolutions if any.
uint_fast32_t gr_list_modes(array<screen_mode, 50> &gsmodes)
{
@ -85,6 +87,8 @@ uint_fast32_t gr_list_modes(array<screen_mode, 50> &gsmodes)
}
}
}
int gr_set_mode(screen_mode mode)
{
screen=NULL;