From 8334695522502cc937ef1f7cc9aad91bd45daed7 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 12 Apr 2026 15:52:33 +0500 Subject: [PATCH] ref: common: draft new static library, containing shared code for ref_gl and ref_soft --- engine/ref_api.h | 6 +- ref/common/ref_common.h | 45 ++++++ ref/common/ref_context.c | 38 +++++ ref/{soft/r_math.c => common/ref_math.c} | 29 +++- ref/common/wscript | 19 +++ ref/gl/gl_context.c | 22 +-- ref/gl/gl_local.h | 25 +-- ref/gl/gl_rmath.c | 189 ----------------------- ref/gl/wscript | 2 +- ref/soft/r_context.c | 22 +-- ref/soft/r_local.h | 26 +--- ref/soft/wscript | 2 +- wscript | 1 + 13 files changed, 136 insertions(+), 290 deletions(-) create mode 100644 ref/common/ref_common.h create mode 100644 ref/common/ref_context.c rename ref/{soft/r_math.c => common/ref_math.c} (89%) create mode 100644 ref/common/wscript delete mode 100644 ref/gl/gl_rmath.c diff --git a/engine/ref_api.h b/engine/ref_api.h index 43f2a793..580b01dc 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -19,11 +19,11 @@ GNU General Public License for more details. #include #include "com_image.h" #include "vgui_api.h" +#include "const.h" +#include "com_model.h" +#include "cl_entity.h" #include "render_api.h" #include "triangleapi.h" -#include "const.h" -#include "cl_entity.h" -#include "com_model.h" #include "studio.h" #include "r_efx.h" #include "filesystem.h" diff --git a/ref/common/ref_common.h b/ref/common/ref_common.h new file mode 100644 index 00000000..8e7b70ec --- /dev/null +++ b/ref/common/ref_common.h @@ -0,0 +1,45 @@ +/* +ref_common.h - shared renderer code +Copyright (C) 2010 Uncle Mike + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +*/ + +#ifndef REF_COMMON_H +#define REF_COMMON_H + +#include "xash3d_mathlib.h" +#include "ref_api.h" + +// +// ref_context.c +// +extern ref_api_t gEngfuncs; +extern ref_globals_t *gpGlobals; +extern ref_client_t *gp_cl; +extern ref_host_t *gp_host; +extern const ref_interface_t gReffuncs; + +#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm) +#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( (parm), 0 ) + +// +// ref_math.c +// +void Matrix4x4_Concat( matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2 ); +void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z ); +void Matrix4x4_ConcatRotate( matrix4x4 out, float angle, float x, float y, float z ); +void Matrix4x4_CreateProjection( matrix4x4 out, float xMax, float xMin, float yMax, float yMin, float zNear, float zFar ); +void Matrix4x4_CreateOrtho( matrix4x4 m, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar ); +void Matrix4x4_CreateModelview( matrix4x4 out ); +void Matrix4x4_ToArrayFloatGL( const matrix4x4 in, float out[16] ); + +#endif // REF_COMMON_H diff --git a/ref/common/ref_context.c b/ref/common/ref_context.c new file mode 100644 index 00000000..8ad3e3f3 --- /dev/null +++ b/ref/common/ref_context.c @@ -0,0 +1,38 @@ +/* +ref_context.c - shared renderer context +Copyright (C) 2018 a1batross + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +*/ + +#include "ref_common.h" + +ref_api_t gEngfuncs; +ref_globals_t *gpGlobals; +ref_client_t *gp_cl; +ref_host_t *gp_host; + +int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ); +int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) +{ + if( version != REF_API_VERSION ) + return 0; + + // fill in our callbacks + *funcs = gReffuncs; + gEngfuncs = *engfuncs; + gpGlobals = globals; + + gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR ); + gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR ); + + return REF_API_VERSION; +} diff --git a/ref/soft/r_math.c b/ref/common/ref_math.c similarity index 89% rename from ref/soft/r_math.c rename to ref/common/ref_math.c index a73bf088..1527e3fc 100644 --- a/ref/soft/r_math.c +++ b/ref/common/ref_math.c @@ -1,5 +1,5 @@ /* -gl_rmath.c - renderer mathlib +ref_math.c - renderer mathlib Copyright (C) 2010 Uncle Mike This program is free software: you can redistribute it and/or modify @@ -13,8 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -#include "r_local.h" -#include "xash3d_mathlib.h" +#include "ref_common.h" /* ======================================================================== @@ -99,7 +98,27 @@ void Matrix4x4_CreateModelview( matrix4x4 out ) out[1][2] = 1.0f; } -void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z ) +void Matrix4x4_ToArrayFloatGL( const matrix4x4 in, float out[16] ) +{ + out[ 0] = in[0][0]; + out[ 1] = in[1][0]; + out[ 2] = in[2][0]; + out[ 3] = in[3][0]; + out[ 4] = in[0][1]; + out[ 5] = in[1][1]; + out[ 6] = in[2][1]; + out[ 7] = in[3][1]; + out[ 8] = in[0][2]; + out[ 9] = in[1][2]; + out[10] = in[2][2]; + out[11] = in[3][2]; + out[12] = in[0][3]; + out[13] = in[1][3]; + out[14] = in[2][3]; + out[15] = in[3][3]; +} + +static void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z ) { out[0][0] = 1.0f; out[0][1] = 0.0f; @@ -119,7 +138,7 @@ void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z ) out[3][3] = 1.0f; } -void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float z ) +static void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float z ) { float len, c, s; diff --git a/ref/common/wscript b/ref/common/wscript new file mode 100644 index 00000000..fec2b45b --- /dev/null +++ b/ref/common/wscript @@ -0,0 +1,19 @@ +#! /usr/bin/env python +# encoding: utf-8 + +top = '.' + +def options(opt): + pass + +def configure(conf): + pass + +def build(bld): + bld.stlib(source = bld.path.ant_glob('*.c'), + target = 'ref_common', + includes = '.', + export_includes = '.', + use = 'engine_includes public werror', + subsystem = bld.env.MSVC_SUBSYSTEM + ) diff --git a/ref/gl/gl_context.c b/ref/gl/gl_context.c index bee22475..c8ba60df 100644 --- a/ref/gl/gl_context.c +++ b/ref/gl/gl_context.c @@ -22,10 +22,6 @@ GNU General Public License for more details. #include "gl4es/include/gl4esinit.h" #endif -ref_api_t gEngfuncs; -ref_globals_t *gpGlobals; -ref_client_t *gp_cl; -ref_host_t *gp_host; void _Mem_Free( void *data, const char *filename, int fileline ) { @@ -427,7 +423,7 @@ static const char *R_GetConfigName( void ) return "opengl"; } -static const ref_interface_t gReffuncs = +const ref_interface_t gReffuncs = { R_Init, R_Shutdown, @@ -561,19 +557,3 @@ static const ref_interface_t gReffuncs = VGUI_UploadTextureBlock, }; -int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ); -int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) -{ - if( version != REF_API_VERSION ) - return 0; - - // fill in our callbacks - *funcs = gReffuncs; - gEngfuncs = *engfuncs; - gpGlobals = globals; - - gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR ); - gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR ); - - return REF_API_VERSION; -} diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index 143c858d..cc4b372f 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -15,17 +15,12 @@ GNU General Public License for more details. #ifndef GL_LOCAL_H #define GL_LOCAL_H +#include "ref_common.h" #include "port.h" #include "xash3d_types.h" #include "cvardef.h" -#include "const.h" -#include "com_model.h" -#include "cl_entity.h" -#include "render_api.h" #include "protocol.h" #include "gl_frustum.h" -#include "ref_api.h" -#include "xash3d_mathlib.h" #include "ref_params.h" #include "enginefeatures.h" #include "com_strings.h" @@ -407,17 +402,6 @@ void R_PopScene( void ); void R_DrawFog( void ); int CL_FxBlend( cl_entity_t *e ); -// -// gl_rmath.c -// -void Matrix4x4_ToArrayFloatGL( const matrix4x4 in, float out[16] ); -void Matrix4x4_Concat( matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2 ); -void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z ); -void Matrix4x4_ConcatRotate( matrix4x4 out, float angle, float x, float y, float z ); -void Matrix4x4_CreateProjection(matrix4x4 out, float xMax, float xMin, float yMax, float yMin, float zNear, float zFar); -void Matrix4x4_CreateOrtho(matrix4x4 m, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar); -void Matrix4x4_CreateModelview( matrix4x4 out ); - // // gl_rmisc.c // @@ -697,13 +681,6 @@ extern glconfig_t glConfig; extern glstate_t glState; // move to engine extern glwstate_t glw_state; -extern ref_api_t gEngfuncs; -extern ref_globals_t *gpGlobals; -extern ref_client_t *gp_cl; -extern ref_host_t *gp_host; - -#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm) -#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( ( parm ), 0 ) // // helper funcs diff --git a/ref/gl/gl_rmath.c b/ref/gl/gl_rmath.c deleted file mode 100644 index 1a18fc36..00000000 --- a/ref/gl/gl_rmath.c +++ /dev/null @@ -1,189 +0,0 @@ -/* -gl_rmath.c - renderer mathlib -Copyright (C) 2010 Uncle Mike - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -*/ - -#include "gl_local.h" -#include "xash3d_mathlib.h" - -/* -======================================================================== - - Matrix4x4 operations (private to renderer) - -======================================================================== -*/ -void Matrix4x4_Concat( matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2 ) -{ - out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0] + in1[0][3] * in2[3][0]; - out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1] + in1[0][3] * in2[3][1]; - out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2] + in1[0][3] * in2[3][2]; - out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3] * in2[3][3]; - out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0] + in1[1][3] * in2[3][0]; - out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1] + in1[1][3] * in2[3][1]; - out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2] + in1[1][3] * in2[3][2]; - out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3] * in2[3][3]; - out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0] + in1[2][3] * in2[3][0]; - out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1] + in1[2][3] * in2[3][1]; - out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2] + in1[2][3] * in2[3][2]; - out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3] * in2[3][3]; - out[3][0] = in1[3][0] * in2[0][0] + in1[3][1] * in2[1][0] + in1[3][2] * in2[2][0] + in1[3][3] * in2[3][0]; - out[3][1] = in1[3][0] * in2[0][1] + in1[3][1] * in2[1][1] + in1[3][2] * in2[2][1] + in1[3][3] * in2[3][1]; - out[3][2] = in1[3][0] * in2[0][2] + in1[3][1] * in2[1][2] + in1[3][2] * in2[2][2] + in1[3][3] * in2[3][2]; - out[3][3] = in1[3][0] * in2[0][3] + in1[3][1] * in2[1][3] + in1[3][2] * in2[2][3] + in1[3][3] * in2[3][3]; -} - -/* -================ -Matrix4x4_CreateProjection - -NOTE: produce quake style world orientation -================ -*/ -void Matrix4x4_CreateProjection( matrix4x4 out, float xMax, float xMin, float yMax, float yMin, float zNear, float zFar ) -{ - out[0][0] = ( 2.0f * zNear ) / ( xMax - xMin ); - out[1][1] = ( 2.0f * zNear ) / ( yMax - yMin ); - out[2][2] = -( zFar + zNear ) / ( zFar - zNear ); - out[3][3] = out[0][1] = out[1][0] = out[3][0] = out[0][3] = out[3][1] = out[1][3] = 0.0f; - - out[2][0] = 0.0f; - out[2][1] = 0.0f; - out[0][2] = ( xMax + xMin ) / ( xMax - xMin ); - out[1][2] = ( yMax + yMin ) / ( yMax - yMin ); - out[3][2] = -1.0f; - out[2][3] = -( 2.0f * zFar * zNear ) / ( zFar - zNear ); -} - -void Matrix4x4_CreateOrtho( matrix4x4 out, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar ) -{ - out[0][0] = 2.0f / (xRight - xLeft); - out[1][1] = 2.0f / (yTop - yBottom); - out[2][2] = -2.0f / (zFar - zNear); - out[3][3] = 1.0f; - out[0][1] = out[0][2] = out[1][0] = out[1][2] = out[3][0] = out[3][1] = out[3][2] = 0.0f; - - out[2][0] = 0.0f; - out[2][1] = 0.0f; - out[0][3] = -(xRight + xLeft) / (xRight - xLeft); - out[1][3] = -(yTop + yBottom) / (yTop - yBottom); - out[2][3] = -(zFar + zNear) / (zFar - zNear); -} - -/* -================ -Matrix4x4_CreateModelview - -NOTE: produce quake style world orientation -================ -*/ -void Matrix4x4_CreateModelview( matrix4x4 out ) -{ - out[0][0] = out[1][1] = out[2][2] = 0.0f; - out[3][0] = out[0][3] = 0.0f; - out[3][1] = out[1][3] = 0.0f; - out[3][2] = out[2][3] = 0.0f; - out[3][3] = 1.0f; - out[1][0] = out[0][2] = out[2][1] = 0.0f; - out[2][0] = out[0][1] = -1.0f; - out[1][2] = 1.0f; -} - -void Matrix4x4_ToArrayFloatGL( const matrix4x4 in, float out[16] ) -{ - out[ 0] = in[0][0]; - out[ 1] = in[1][0]; - out[ 2] = in[2][0]; - out[ 3] = in[3][0]; - out[ 4] = in[0][1]; - out[ 5] = in[1][1]; - out[ 6] = in[2][1]; - out[ 7] = in[3][1]; - out[ 8] = in[0][2]; - out[ 9] = in[1][2]; - out[10] = in[2][2]; - out[11] = in[3][2]; - out[12] = in[0][3]; - out[13] = in[1][3]; - out[14] = in[2][3]; - out[15] = in[3][3]; -} - -static void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z ) -{ - out[0][0] = 1.0f; - out[0][1] = 0.0f; - out[0][2] = 0.0f; - out[0][3] = x; - out[1][0] = 0.0f; - out[1][1] = 1.0f; - out[1][2] = 0.0f; - out[1][3] = y; - out[2][0] = 0.0f; - out[2][1] = 0.0f; - out[2][2] = 1.0f; - out[2][3] = z; - out[3][0] = 0.0f; - out[3][1] = 0.0f; - out[3][2] = 0.0f; - out[3][3] = 1.0f; -} - -static void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float z ) -{ - float len, c, s; - - len = x * x + y * y + z * z; - if( len != 0.0f ) len = 1.0f / sqrt( len ); - x *= len; - y *= len; - z *= len; - - angle *= (-M_PI_F / 180.0f); - SinCos( angle, &s, &c ); - - out[0][0]=x * x + c * (1 - x * x); - out[0][1]=x * y * (1 - c) + z * s; - out[0][2]=z * x * (1 - c) - y * s; - out[0][3]=0.0f; - out[1][0]=x * y * (1 - c) - z * s; - out[1][1]=y * y + c * (1 - y * y); - out[1][2]=y * z * (1 - c) + x * s; - out[1][3]=0.0f; - out[2][0]=z * x * (1 - c) + y * s; - out[2][1]=y * z * (1 - c) - x * s; - out[2][2]=z * z + c * (1 - z * z); - out[2][3]=0.0f; - out[3][0]=0.0f; - out[3][1]=0.0f; - out[3][2]=0.0f; - out[3][3]=1.0f; -} - -void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z ) -{ - matrix4x4 base, temp; - - Matrix4x4_Copy( base, out ); - Matrix4x4_CreateTranslate( temp, x, y, z ); - Matrix4x4_Concat( out, base, temp ); -} - -void Matrix4x4_ConcatRotate( matrix4x4 out, float angle, float x, float y, float z ) -{ - matrix4x4 base, temp; - - Matrix4x4_Copy( base, out ); - Matrix4x4_CreateRotate( temp, angle, x, y, z ); - Matrix4x4_Concat( out, base, temp ); -} diff --git a/ref/gl/wscript b/ref/gl/wscript index 0f7cc81b..f085da6d 100644 --- a/ref/gl/wscript +++ b/ref/gl/wscript @@ -25,7 +25,7 @@ def configure(conf): conf.check_cc(lib='log') def build(bld): - libs = [ 'engine_includes', 'werror' ] + libs = [ 'ref_common', 'engine_includes', 'werror' ] # on PSVita do not link any libraries that are already in the main executable, but add the includes target if bld.env.DEST_OS == 'psvita': libs += [ 'sdk_includes', 'vgl_shim' ] diff --git a/ref/soft/r_context.c b/ref/soft/r_context.c index 4f5b3dcf..9a3febd4 100644 --- a/ref/soft/r_context.c +++ b/ref/soft/r_context.c @@ -15,10 +15,6 @@ GNU General Public License for more details. #include "r_local.h" -ref_api_t gEngfuncs; -ref_globals_t *gpGlobals; -ref_client_t *gp_cl; -ref_host_t *gp_host; gl_globals_t tr; ref_speeds_t r_stats; poolhandle_t r_temppool; @@ -413,7 +409,7 @@ static void * GAME_EXPORT R_GetProcAddress( const char *name ) return gEngfuncs.GL_GetProcAddress( name ); } -static const ref_interface_t gReffuncs = +const ref_interface_t gReffuncs = { R_Init, R_Shutdown, @@ -547,19 +543,3 @@ static const ref_interface_t gReffuncs = VGUI_UploadTextureBlock, }; -int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ); -int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) -{ - if( version != REF_API_VERSION ) - return 0; - - // fill in our callbacks - *funcs = gReffuncs; - gEngfuncs = *engfuncs; - gpGlobals = globals; - - gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR ); - gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR ); - - return REF_API_VERSION; -} diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index b1f7b306..870af6b4 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -15,16 +15,11 @@ GNU General Public License for more details. #ifndef GL_LOCAL_H #define GL_LOCAL_H +#include "ref_common.h" #include "port.h" #include "xash3d_types.h" #include "cvardef.h" -#include "const.h" -#include "com_model.h" -#include "cl_entity.h" -#include "render_api.h" #include "protocol.h" -#include "ref_api.h" -#include "xash3d_mathlib.h" #include "ref_params.h" #include "enginefeatures.h" #include "com_strings.h" @@ -419,18 +414,6 @@ void R_PushScene( void ); void R_PopScene( void ); void R_DrawFog( void ); -// -// gl_rmath.c -// -void Matrix4x4_Concat( matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2 ); -void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z ); -void Matrix4x4_ConcatRotate( matrix4x4 out, float angle, float x, float y, float z ); -void Matrix4x4_CreateTranslate( matrix4x4 out, float x, float y, float z ); -void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float z ); -void Matrix4x4_CreateProjection( matrix4x4 out, float xMax, float xMin, float yMax, float yMin, float zNear, float zFar ); -void Matrix4x4_CreateOrtho( matrix4x4 m, float xLeft, float xRight, float yBottom, float yTop, float zNear, float zFar ); -void Matrix4x4_CreateModelview( matrix4x4 out ); - // // gl_rpart.c // @@ -551,13 +534,6 @@ void TriFogParams( float flDensity, int iFogSkybox ); void TriCullFace( TRICULLSTYLE mode ); void TriBrightness( float brightness ); -#define ENGINE_GET_PARM_ ( *gEngfuncs.EngineGetParm ) -#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_(( parm ), 0 ) - -extern ref_api_t gEngfuncs; -extern ref_globals_t *gpGlobals; -extern ref_client_t *gp_cl; -extern ref_host_t *gp_host; DECLARE_ENGINE_SHARED_CVAR_LIST() diff --git a/ref/soft/wscript b/ref/soft/wscript index 95e37ec6..4ed21aad 100644 --- a/ref/soft/wscript +++ b/ref/soft/wscript @@ -14,7 +14,7 @@ def configure(conf): return def build(bld): - libs = [ 'engine_includes', 'werror' ] + libs = [ 'ref_common', 'engine_includes', 'werror' ] # on PSVita do not link any libraries that are already in the main executable, but add the includes target if bld.env.DEST_OS == 'psvita': libs += [ 'sdk_includes' ] diff --git a/wscript b/wscript index 34981f72..11f7983e 100644 --- a/wscript +++ b/wscript @@ -91,6 +91,7 @@ SUBDIRS = [ Subproject('3rdparty/nanogl', lambda x: x.env.CLIENT and x.env.NANOGL), Subproject('3rdparty/gl-wes-v2', lambda x: x.env.CLIENT and x.env.GLWES), Subproject('3rdparty/gl4es', lambda x: x.env.CLIENT and x.env.GL4ES), + Subproject('ref/common', lambda x: x.env.CLIENT), Subproject('ref/gl', lambda x: x.env.CLIENT and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES or x.env.GLES3COMPAT)), Subproject('ref/soft', lambda x: x.env.CLIENT and x.env.SOFT), Subproject('ref/null', lambda x: x.env.CLIENT and x.env.NULL),