mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
15 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd969f3594 | ||
|
|
fb87d7c0b3 | ||
|
|
a69fc87940 | ||
|
|
e481e1d73e | ||
|
|
6c0eed1b2b | ||
|
|
a6c67fdf9f | ||
|
|
03f838e37e | ||
|
|
e21fa4a910 | ||
|
|
46889ed453 | ||
|
|
882fcc152c | ||
|
|
a41902bd46 | ||
|
|
a6af32dafd | ||
|
|
d6dfb83be7 | ||
|
|
597429cf41 | ||
|
|
5ea074a1fd |
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: adb3e413ec...e456555cf1
24
Documentation/donate.md
Normal file
24
Documentation/donate.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Developers donation page
|
||||||
|
|
||||||
|
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
||||||
|
|
||||||
|
### [a1batross](https://github.com/a1batross)
|
||||||
|
|
||||||
|
* Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
||||||
|
* Boosty page: https://boosty.to/a1ba
|
||||||
|
|
||||||
|
### [nekonomicon](https://github.com/nekonomicon)
|
||||||
|
|
||||||
|
* [hlsdk-portable](https://github.com/FWGS/hlsdk-portable), [mdldec](../utils/mdldec), [opensource-mods.md](opensource-mods.md) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=nekonomicon) (*BSD/clang port, PNG support, etc).
|
||||||
|
* Boosty page: https://boosty.to/nekonomicon
|
||||||
|
|
||||||
|
### [Velaron](https://github.com/Velaron)
|
||||||
|
* [cs16-client](https://github.com/Velaron/cs16-client) & [tf15-client](https://github.com/Velaron/tf15-client) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=Velaron) (Android port, voice chat, etc).
|
||||||
|
* BuyMeACoffee page: https://www.buymeacoffee.com/velaron
|
||||||
|
|
||||||
|
### [SNMetamorph](https://github.com/SNMetamorph)
|
||||||
|
* [PrimeXT](https://github.com/SNMetamorph/PrimeXT) & [GoldSrc Monitor](https://github.com/SNMetamorph/goldsrc-monitor) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=SNMetamorph) (Windows port, voice chat, etc).
|
||||||
|
* BTC: `16GAzK3qei5AwBW7sggXp3yNcFHBtdpxXj`
|
||||||
|
* ETH (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
|
* USDT (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
|
* USDC (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
40
README.md
40
README.md
@@ -1,33 +1,27 @@
|
|||||||
# Xash3D FWGS Engine
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
|
|
||||||
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
|
|
||||||
```
|
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
||||||
Xash3D is a game engine, aimed to provide compatibility with Half-Life Engine,
|
|
||||||
as well as to give game developers well known workflow and extend it.
|
## Donate
|
||||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
[](Documentation/donate.md) \
|
||||||
```
|
If you like Xash3D FWGS, consider supporting individual engine maintainers. By supporting us, you help to continue developing this game engine further. The sponsorship links are available in [documentation](Documentation/donate.md).
|
||||||
|
|
||||||
## Fork features
|
## Fork features
|
||||||
* HLSDK 2.4 support.
|
* Steam Half-Life (HLSDK 2.4) support.
|
||||||
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
|
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
|
||||||
* Modern compilers support: say no more to MSVC6.
|
* Better multiplayer support: multiple master servers, headless dedicated server, voice chat and IPv6 support.
|
||||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
|
||||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
* Advanced virtual filesystem: `.pk3` and `.pk3dir` support, compatibility with GoldSrc FS module, fast case-insensitivity emulation for crossplatform.
|
||||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
* Mobility API: better game integration on mobile devices (vibration, touch controls)
|
||||||
|
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
||||||
* TrueType font rendering, as a part of mainui_cpp.
|
* TrueType font rendering, as a part of mainui_cpp.
|
||||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software.
|
* External VGUI support module.
|
||||||
* Voice support.
|
* PNG & KTX2 image format support.
|
||||||
* External filesystem module like in GoldSrc engine.
|
* [A set of small improvements](Documentation/), without broken compatibility.
|
||||||
* External vgui support module.
|
|
||||||
* PNG image format support.
|
|
||||||
* A set of small improvements, without broken compatibility.
|
|
||||||
|
|
||||||
## Planned fork features
|
|
||||||
* Virtual Reality support and game API.
|
|
||||||
* Vulkan renderer.
|
|
||||||
|
|
||||||
## Installation & Running
|
## Installation & Running
|
||||||
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ typedef struct dll_info_s
|
|||||||
} dll_info_t;
|
} dll_info_t;
|
||||||
|
|
||||||
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
||||||
|
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
||||||
|
|
||||||
// config strings are a general means of communication from
|
// config strings are a general means of communication from
|
||||||
// the server to all connected clients.
|
// the server to all connected clients.
|
||||||
|
|||||||
@@ -982,7 +982,7 @@ pfnCheckGameDll
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT pfnCheckGameDll( void )
|
int GAME_EXPORT pfnCheckGameDll( void )
|
||||||
{
|
{
|
||||||
#if XASH_INTERNAL_GAMELIBS
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
string dllpath;
|
string dllpath;
|
||||||
|
|||||||
@@ -87,15 +87,6 @@ static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b
|
|||||||
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *pfnGetNativeObject( const char *obj )
|
|
||||||
{
|
|
||||||
if( !obj )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// Backend should consider that obj is case-sensitive
|
|
||||||
return Platform_GetNativeObject( obj );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnTouch_HideButtons( const char *name, byte state )
|
static void pfnTouch_HideButtons( const char *name, byte state )
|
||||||
{
|
{
|
||||||
Touch_HideButtons( name, state, true );
|
Touch_HideButtons( name, state, true );
|
||||||
@@ -124,7 +115,7 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
|||||||
Touch_ResetDefaultButtons,
|
Touch_ResetDefaultButtons,
|
||||||
pfnDrawScaledCharacter,
|
pfnDrawScaledCharacter,
|
||||||
Sys_Warn,
|
Sys_Warn,
|
||||||
pfnGetNativeObject,
|
Sys_GetNativeObject,
|
||||||
ID_SetCustomClientID,
|
ID_SetCustomClientID,
|
||||||
pfnParseFileSafe
|
pfnParseFileSafe
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CVAR_DEFINE_AUTO( gl_msaa_samples, "0", FCVAR_GLCONFIG, "samples number for mult
|
|||||||
CVAR_DEFINE_AUTO( gl_clear, "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
CVAR_DEFINE_AUTO( gl_clear, "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
||||||
CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
||||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||||
|
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||||
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||||
{
|
{
|
||||||
@@ -519,6 +520,7 @@ static qboolean R_LoadRenderer( const char *refopt )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cvar_FullSet( "r_refdll_loaded", refopt, FCVAR_READ_ONLY );
|
||||||
Con_Reportf( "Renderer %s initialized\n", refdll );
|
Con_Reportf( "Renderer %s initialized\n", refdll );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -610,6 +612,7 @@ qboolean R_Init( void )
|
|||||||
Cvar_RegisterVariable( &gl_clear );
|
Cvar_RegisterVariable( &gl_clear );
|
||||||
Cvar_RegisterVariable( &r_showtree );
|
Cvar_RegisterVariable( &r_showtree );
|
||||||
Cvar_RegisterVariable( &r_refdll );
|
Cvar_RegisterVariable( &r_refdll );
|
||||||
|
Cvar_RegisterVariable( &r_refdll_loaded );
|
||||||
|
|
||||||
// cvars that are expected to exist
|
// cvars that are expected to exist
|
||||||
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ typedef void (*xcommand_t)( void );
|
|||||||
qboolean FS_LoadProgs( void );
|
qboolean FS_LoadProgs( void );
|
||||||
void FS_Init( void );
|
void FS_Init( void );
|
||||||
void FS_Shutdown( void );
|
void FS_Shutdown( void );
|
||||||
|
void *FS_GetNativeObject( const char *obj );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cmd.c
|
// cmd.c
|
||||||
|
|||||||
@@ -23,8 +23,17 @@ GNU General Public License for more details.
|
|||||||
fs_api_t g_fsapi;
|
fs_api_t g_fsapi;
|
||||||
fs_globals_t *FI;
|
fs_globals_t *FI;
|
||||||
|
|
||||||
|
static pfnCreateInterface_t fs_pfnCreateInterface;
|
||||||
static HINSTANCE fs_hInstance;
|
static HINSTANCE fs_hInstance;
|
||||||
|
|
||||||
|
void *FS_GetNativeObject( const char *obj )
|
||||||
|
{
|
||||||
|
if( fs_pfnCreateInterface )
|
||||||
|
return fs_pfnCreateInterface( obj, NULL );
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void FS_Rescan_f( void )
|
static void FS_Rescan_f( void )
|
||||||
{
|
{
|
||||||
FS_Rescan();
|
FS_Rescan();
|
||||||
@@ -53,7 +62,7 @@ static fs_interface_t fs_memfuncs =
|
|||||||
_Mem_Realloc,
|
_Mem_Realloc,
|
||||||
_Mem_Free,
|
_Mem_Free,
|
||||||
|
|
||||||
Platform_GetNativeObject,
|
Sys_GetNativeObject,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void FS_UnloadProgs( void )
|
static void FS_UnloadProgs( void )
|
||||||
@@ -98,6 +107,13 @@ qboolean FS_LoadProgs( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !( fs_pfnCreateInterface = (pfnCreateInterface_t)COM_GetProcAddress( fs_hInstance, "CreateInterface" )))
|
||||||
|
{
|
||||||
|
FS_UnloadProgs();
|
||||||
|
Host_Error( "FS_LoadProgs: can't find CreateInterface entry point in %s\n", name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Con_DPrintf( "FS_LoadProgs: filesystem_stdio successfully loaded\n" );
|
Con_DPrintf( "FS_LoadProgs: filesystem_stdio successfully loaded\n" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1020,7 +1020,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof( host.rootdir ));
|
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof( host.rootdir ));
|
||||||
#elif XASH_ANDROID && XASH_SDL
|
#elif XASH_ANDROID && XASH_SDL
|
||||||
Q_strncpy( host.rootdir, SDL_AndroidGetExternalStoragePath, sizeof( host.rootdir ));
|
Q_strncpy( host.rootdir, SDL_AndroidGetExternalStoragePath(), sizeof( host.rootdir ));
|
||||||
#elif XASH_PSVITA
|
#elif XASH_PSVITA
|
||||||
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir )))
|
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir )))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2012,6 +2012,20 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qboolean Mod_LooksLikeWaterTexture( const char *name )
|
||||||
|
{
|
||||||
|
if(( name[0] == '*' && Q_stricmp( name, REF_DEFAULT_TEXTURE )) || name[0] == '!' )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if( !Host_IsQuakeCompatible( ))
|
||||||
|
{
|
||||||
|
if( !Q_strncmp( name, "water", 5 ) || !Q_strnicmp( name, "laser", 5 ))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureIndex )
|
static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureIndex )
|
||||||
{
|
{
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
@@ -2032,6 +2046,10 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd
|
|||||||
if( FBitSet( host.features, ENGINE_IMPROVED_LINETRACE ) && mipTex->name[0] == '{' )
|
if( FBitSet( host.features, ENGINE_IMPROVED_LINETRACE ) && mipTex->name[0] == '{' )
|
||||||
SetBits( txFlags, TF_KEEP_SOURCE ); // Paranoia2 texture alpha-tracing
|
SetBits( txFlags, TF_KEEP_SOURCE ); // Paranoia2 texture alpha-tracing
|
||||||
|
|
||||||
|
// check if this is water to keep the source texture and expand it to RGBA (so ripple effect works)
|
||||||
|
if( Mod_LooksLikeWaterTexture( mipTex->name ))
|
||||||
|
SetBits( txFlags, TF_KEEP_SOURCE | TF_EXPAND_SOURCE );
|
||||||
|
|
||||||
usesCustomPalette = Mod_CalcMipTexUsesCustomPalette( mod, bmod, textureIndex );
|
usesCustomPalette = Mod_CalcMipTexUsesCustomPalette( mod, bmod, textureIndex );
|
||||||
|
|
||||||
// check for multi-layered sky texture (quake1 specific)
|
// check for multi-layered sky texture (quake1 specific)
|
||||||
@@ -2449,15 +2467,9 @@ static void Mod_LoadSurfaces( model_t *mod, dbspmodel_t *bmod )
|
|||||||
if( !Q_strncmp( tex->name, "sky", 3 ))
|
if( !Q_strncmp( tex->name, "sky", 3 ))
|
||||||
SetBits( out->flags, SURF_DRAWSKY );
|
SetBits( out->flags, SURF_DRAWSKY );
|
||||||
|
|
||||||
if(( tex->name[0] == '*' && Q_stricmp( tex->name, REF_DEFAULT_TEXTURE )) || tex->name[0] == '!' )
|
if( Mod_LooksLikeWaterTexture( tex->name ))
|
||||||
SetBits( out->flags, SURF_DRAWTURB );
|
SetBits( out->flags, SURF_DRAWTURB );
|
||||||
|
|
||||||
if( !Host_IsQuakeCompatible( ))
|
|
||||||
{
|
|
||||||
if( !Q_strncmp( tex->name, "water", 5 ) || !Q_strnicmp( tex->name, "laser", 5 ))
|
|
||||||
SetBits( out->flags, SURF_DRAWTURB );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !Q_strncmp( tex->name, "scroll", 6 ))
|
if( !Q_strncmp( tex->name, "scroll", 6 ))
|
||||||
SetBits( out->flags, SURF_CONVEYOR );
|
SetBits( out->flags, SURF_CONVEYOR );
|
||||||
|
|
||||||
|
|||||||
@@ -649,3 +649,31 @@ qboolean Sys_NewInstance( const char *gamedir )
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
Sys_GetNativeObject
|
||||||
|
|
||||||
|
Get platform-specific native object
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void *Sys_GetNativeObject( const char *obj )
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
if( !COM_CheckString( obj ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ptr = FS_GetNativeObject( obj );
|
||||||
|
|
||||||
|
if( ptr )
|
||||||
|
return ptr;
|
||||||
|
|
||||||
|
// Backend should consider that obj is case-sensitive
|
||||||
|
#if XASH_ANDROID
|
||||||
|
ptr = Android_GetNativeObject( obj );
|
||||||
|
#endif // XASH_ANDROID
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void Sys_InitLog( void );
|
|||||||
void Sys_CloseLog( void );
|
void Sys_CloseLog( void );
|
||||||
void Sys_Quit( void ) NORETURN;
|
void Sys_Quit( void ) NORETURN;
|
||||||
qboolean Sys_NewInstance( const char *gamedir );
|
qboolean Sys_NewInstance( const char *gamedir );
|
||||||
|
void *Sys_GetNativeObject( const char *obj );
|
||||||
|
|
||||||
//
|
//
|
||||||
// sys_con.c
|
// sys_con.c
|
||||||
|
|||||||
@@ -139,17 +139,6 @@ static inline void Platform_Shutdown( void )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *Platform_GetNativeObject( const char *name )
|
|
||||||
{
|
|
||||||
void *ptr = NULL;
|
|
||||||
|
|
||||||
#if XASH_ANDROID
|
|
||||||
ptr = Android_GetNativeObject( name );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -158,7 +147,6 @@ static inline void *Platform_GetNativeObject( const char *name )
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
void Platform_Vibrate( float life, char flags );
|
void Platform_Vibrate( float life, char flags );
|
||||||
void*Platform_GetNativeObject( const char *name );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|||||||
@@ -150,6 +150,4 @@ public:
|
|||||||
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" // never change this!
|
|
||||||
|
|
||||||
#endif // VFILESYSTEM009_H
|
#endif // VFILESYSTEM009_H
|
||||||
|
|||||||
@@ -1386,7 +1386,7 @@ static void _Sys_Error( const char *fmt, ... )
|
|||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *_Platform_GetNativeObject_stub( const char *object )
|
static void *Sys_GetNativeObject_stub( const char *object )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -2841,7 +2841,7 @@ fs_interface_t g_engfuncs =
|
|||||||
_Mem_Alloc,
|
_Mem_Alloc,
|
||||||
_Mem_Realloc,
|
_Mem_Realloc,
|
||||||
_Mem_Free,
|
_Mem_Free,
|
||||||
_Platform_GetNativeObject_stub
|
Sys_GetNativeObject_stub
|
||||||
};
|
};
|
||||||
|
|
||||||
static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
||||||
@@ -2883,9 +2883,9 @@ static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
|||||||
Con_Reportf( "filesystem_stdio: custom memory allocation functions found\n" );
|
Con_Reportf( "filesystem_stdio: custom memory allocation functions found\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( engfuncs->_Platform_GetNativeObject )
|
if( engfuncs->_Sys_GetNativeObject )
|
||||||
{
|
{
|
||||||
g_engfuncs._Platform_GetNativeObject = engfuncs->_Platform_GetNativeObject;
|
g_engfuncs._Sys_GetNativeObject = engfuncs->_Sys_GetNativeObject;
|
||||||
Con_Reportf( "filesystem_stdio: custom platform-specific functions found\n" );
|
Con_Reportf( "filesystem_stdio: custom platform-specific functions found\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ extern "C"
|
|||||||
|
|
||||||
#define FS_API_VERSION 2 // not stable yet!
|
#define FS_API_VERSION 2 // not stable yet!
|
||||||
#define FS_API_CREATEINTERFACE_TAG "XashFileSystem002" // follow FS_API_VERSION!!!
|
#define FS_API_CREATEINTERFACE_TAG "XashFileSystem002" // follow FS_API_VERSION!!!
|
||||||
|
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" // never change this!
|
||||||
|
|
||||||
// search path flags
|
// search path flags
|
||||||
enum
|
enum
|
||||||
@@ -210,7 +211,7 @@ typedef struct fs_interface_t
|
|||||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||||
|
|
||||||
// platform
|
// platform
|
||||||
void *(*_Platform_GetNativeObject)( const char *object );
|
void *(*_Sys_GetNativeObject)( const char *object );
|
||||||
} fs_interface_t;
|
} fs_interface_t;
|
||||||
|
|
||||||
typedef int (*FSAPI)( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *interface );
|
typedef int (*FSAPI)( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *interface );
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ extern const fs_archive_t g_archives[];
|
|||||||
#define Con_DPrintf (*g_engfuncs._Con_DPrintf)
|
#define Con_DPrintf (*g_engfuncs._Con_DPrintf)
|
||||||
#define Con_Reportf (*g_engfuncs._Con_Reportf)
|
#define Con_Reportf (*g_engfuncs._Con_Reportf)
|
||||||
#define Sys_Error (*g_engfuncs._Sys_Error)
|
#define Sys_Error (*g_engfuncs._Sys_Error)
|
||||||
#define Platform_GetNativeObject (*g_engfuncs._Platform_GetNativeObject)
|
#define Sys_GetNativeObject (*g_engfuncs._Sys_GetNativeObject)
|
||||||
|
|
||||||
//
|
//
|
||||||
// filesystem.c
|
// filesystem.c
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ typedef void *HMODULE;
|
|||||||
|
|
||||||
HMODULE g_hModule;
|
HMODULE g_hModule;
|
||||||
FSAPI g_pfnGetFSAPI;
|
FSAPI g_pfnGetFSAPI;
|
||||||
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
|
||||||
pfnCreateInterface_t g_pfnCreateInterface;
|
pfnCreateInterface_t g_pfnCreateInterface;
|
||||||
fs_api_t g_fs;
|
fs_api_t g_fs;
|
||||||
fs_globals_t *g_nullglobals;
|
fs_globals_t *g_nullglobals;
|
||||||
|
|||||||
@@ -342,6 +342,8 @@ void R_SetTextureParameters( void )
|
|||||||
// change all the existing mipmapped texture objects
|
// change all the existing mipmapped texture objects
|
||||||
for( i = 0; i < gl_numTextures; i++ )
|
for( i = 0; i < gl_numTextures; i++ )
|
||||||
GL_UpdateTextureParams( i );
|
GL_UpdateTextureParams( i );
|
||||||
|
|
||||||
|
R_UpdateRippleTexParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2317,6 +2319,7 @@ void R_InitImages( void )
|
|||||||
// validate cvars
|
// validate cvars
|
||||||
R_SetTextureParameters();
|
R_SetTextureParameters();
|
||||||
GL_CreateInternalTextures();
|
GL_CreateInternalTextures();
|
||||||
|
R_InitRipples();
|
||||||
|
|
||||||
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,6 +489,11 @@ void R_ClearSkyBox( void );
|
|||||||
void R_DrawSkyBox( void );
|
void R_DrawSkyBox( void );
|
||||||
void R_DrawClouds( void );
|
void R_DrawClouds( void );
|
||||||
void EmitWaterPolys( msurface_t *warp, qboolean reverse );
|
void EmitWaterPolys( msurface_t *warp, qboolean reverse );
|
||||||
|
void R_InitRipples( void );
|
||||||
|
void R_ResetRipples( void );
|
||||||
|
void R_AnimateRipples( void );
|
||||||
|
void R_UpdateRippleTexParams( void );
|
||||||
|
void R_UploadRipples( texture_t *image );
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_vgui.c
|
// gl_vgui.c
|
||||||
@@ -750,6 +755,9 @@ extern convar_t r_vbo;
|
|||||||
extern convar_t r_vbo_dlightmode;
|
extern convar_t r_vbo_dlightmode;
|
||||||
extern convar_t r_studio_sort_textures;
|
extern convar_t r_studio_sort_textures;
|
||||||
extern convar_t r_studio_drawelements;
|
extern convar_t r_studio_drawelements;
|
||||||
|
extern convar_t r_ripple;
|
||||||
|
extern convar_t r_ripple_updatetime;
|
||||||
|
extern convar_t r_ripple_spawntime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// engine shared convars
|
// engine shared convars
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models"
|
|||||||
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
||||||
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
||||||
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple, "0", FCVAR_GLCONFIG, "enable software-like water texture ripple simulation" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple_updatetime, "0.05", FCVAR_GLCONFIG, "how fast ripple simulation is" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple_spawntime, "0.1", FCVAR_GLCONFIG, "how fast new ripples spawn" );
|
||||||
|
|
||||||
|
|
||||||
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
||||||
|
|
||||||
@@ -1186,6 +1190,9 @@ void GL_InitCommands( void )
|
|||||||
gEngfuncs.Cvar_RegisterVariable( &r_traceglow );
|
gEngfuncs.Cvar_RegisterVariable( &r_traceglow );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
|
gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );
|
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple_updatetime );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple_spawntime );
|
||||||
|
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_extensions );
|
gEngfuncs.Cvar_RegisterVariable( &gl_extensions );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest );
|
gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest );
|
||||||
|
|||||||
@@ -969,6 +969,8 @@ void R_RenderScene( void )
|
|||||||
|
|
||||||
R_MarkLeaves();
|
R_MarkLeaves();
|
||||||
R_DrawFog ();
|
R_DrawFog ();
|
||||||
|
if( RI.drawWorld )
|
||||||
|
R_AnimateRipples();
|
||||||
|
|
||||||
R_CheckGLFog();
|
R_CheckGLFog();
|
||||||
R_DrawWorld();
|
R_DrawWorld();
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ void R_NewMap( void )
|
|||||||
|
|
||||||
GL_BuildLightmaps ();
|
GL_BuildLightmaps ();
|
||||||
R_GenerateVBO();
|
R_GenerateVBO();
|
||||||
|
R_ResetRipples();
|
||||||
|
|
||||||
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
||||||
gEngfuncs.drawFuncs->R_NewMap();
|
gEngfuncs.drawFuncs->R_NewMap();
|
||||||
|
|||||||
@@ -1135,14 +1135,15 @@ void R_RenderBrushPoly( msurface_t *fa, int cull_type )
|
|||||||
|
|
||||||
t = R_TextureAnimation( fa );
|
t = R_TextureAnimation( fa );
|
||||||
|
|
||||||
GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
|
||||||
|
|
||||||
if( FBitSet( fa->flags, SURF_DRAWTURB ))
|
if( FBitSet( fa->flags, SURF_DRAWTURB ))
|
||||||
{
|
{
|
||||||
|
R_UploadRipples( t );
|
||||||
|
|
||||||
// warp texture, no lightmaps
|
// warp texture, no lightmaps
|
||||||
EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE));
|
EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
||||||
|
|
||||||
if( t->fb_texturenum )
|
if( t->fb_texturenum )
|
||||||
{
|
{
|
||||||
@@ -1411,7 +1412,7 @@ void R_DrawWaterSurfaces( void )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// set modulate mode explicitly
|
// set modulate mode explicitly
|
||||||
GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
R_UploadRipples( t );
|
||||||
|
|
||||||
for( ; s; s = s->texturechain )
|
for( ; s; s = s->texturechain )
|
||||||
EmitWaterPolys( s, false );
|
EmitWaterPolys( s, false );
|
||||||
|
|||||||
225
ref/gl/gl_warp.c
225
ref/gl/gl_warp.c
@@ -62,6 +62,29 @@ static float r_turbsin[] =
|
|||||||
#include "warpsin.h"
|
#include "warpsin.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define RIPPLES_CACHEWIDTH_BITS 7
|
||||||
|
#define RIPPLES_CACHEWIDTH ( 1 << RIPPLES_CACHEWIDTH_BITS )
|
||||||
|
#define RIPPLES_CACHEWIDTH_MASK (( RIPPLES_CACHEWIDTH ) - 1 )
|
||||||
|
#define RIPPLES_TEXSIZE ( RIPPLES_CACHEWIDTH * RIPPLES_CACHEWIDTH )
|
||||||
|
#define RIPPLES_TEXSIZE_MASK ( RIPPLES_TEXSIZE - 1 )
|
||||||
|
|
||||||
|
STATIC_ASSERT( RIPPLES_TEXSIZE == 0x4000, "fix the algorithm to work with custom resolution" );
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
double time;
|
||||||
|
double oldtime;
|
||||||
|
|
||||||
|
short *curbuf, *oldbuf;
|
||||||
|
short buf[2][RIPPLES_TEXSIZE];
|
||||||
|
qboolean update;
|
||||||
|
|
||||||
|
uint32_t texture[RIPPLES_TEXSIZE];
|
||||||
|
int gl_texturenum;
|
||||||
|
int rippletexturenum;
|
||||||
|
float texturescale; // not all textures are 128x128, scale the texcoords down
|
||||||
|
} g_ripple;
|
||||||
|
|
||||||
static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
|
static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
|
||||||
{
|
{
|
||||||
const char *skybox_ext[3] = { "dds", "tga", "bmp" };
|
const char *skybox_ext[3] = { "dds", "tga", "bmp" };
|
||||||
@@ -799,10 +822,18 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
os = v[3];
|
os = v[3];
|
||||||
ot = v[4];
|
ot = v[4];
|
||||||
|
|
||||||
|
if( !r_ripple.value )
|
||||||
|
{
|
||||||
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||||
s *= ( 1.0f / SUBDIVIDE_SIZE );
|
|
||||||
|
|
||||||
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = os / g_ripple.texturescale;
|
||||||
|
t = ot / g_ripple.texturescale;
|
||||||
|
}
|
||||||
|
|
||||||
|
s *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||||
t *= ( 1.0f / SUBDIVIDE_SIZE );
|
t *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||||
|
|
||||||
pglTexCoord2f( s, t );
|
pglTexCoord2f( s, t );
|
||||||
@@ -822,3 +853,193 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
|
|
||||||
GL_SetupFogColorForSurfaces();
|
GL_SetupFogColorForSurfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
HALF-LIFE SOFTWARE WATER
|
||||||
|
|
||||||
|
============================================================
|
||||||
|
*/
|
||||||
|
void R_ResetRipples( void )
|
||||||
|
{
|
||||||
|
g_ripple.curbuf = g_ripple.buf[0];
|
||||||
|
g_ripple.oldbuf = g_ripple.buf[1];
|
||||||
|
g_ripple.time = g_ripple.oldtime = gpGlobals->time - 0.1;
|
||||||
|
memset( g_ripple.buf, 0, sizeof( g_ripple.buf ));
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_InitRipples( void )
|
||||||
|
{
|
||||||
|
rgbdata_t pic = { 0 };
|
||||||
|
|
||||||
|
pic.width = pic.height = RIPPLES_CACHEWIDTH;
|
||||||
|
pic.depth = 1;
|
||||||
|
pic.flags = IMAGE_HAS_COLOR;
|
||||||
|
pic.buffer = (byte *)g_ripple.texture;
|
||||||
|
pic.type = PF_RGBA_32;
|
||||||
|
pic.size = sizeof( g_ripple.texture );
|
||||||
|
pic.numMips = 1;
|
||||||
|
memset( pic.buffer, 0, pic.size );
|
||||||
|
|
||||||
|
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SwapBufs( void )
|
||||||
|
{
|
||||||
|
short *tempbufp = g_ripple.curbuf;
|
||||||
|
g_ripple.curbuf = g_ripple.oldbuf;
|
||||||
|
g_ripple.oldbuf = tempbufp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SpawnNewRipple( int x, int y, short val )
|
||||||
|
{
|
||||||
|
#define PIXEL( x, y ) ((( x ) & RIPPLES_CACHEWIDTH_MASK ) + ((( y ) & RIPPLES_CACHEWIDTH_MASK) << 7 ))
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y )] += val;
|
||||||
|
|
||||||
|
val >>= 2;
|
||||||
|
g_ripple.oldbuf[PIXEL( x + 1, y )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x - 1, y )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y + 1 )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y - 1 )] += val;
|
||||||
|
#undef PIXEL
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_RunRipplesAnimation( const short *oldbuf, short *pbuf )
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
const int w = RIPPLES_CACHEWIDTH;
|
||||||
|
const int m = RIPPLES_TEXSIZE_MASK;
|
||||||
|
|
||||||
|
for( i = w; i < m + w; i++, pbuf++ )
|
||||||
|
{
|
||||||
|
*pbuf = (
|
||||||
|
( (int)oldbuf[( i - ( w * 2 )) & m]
|
||||||
|
+ (int)oldbuf[( i - ( w + 1 )) & m]
|
||||||
|
+ (int)oldbuf[( i - ( w - 1 )) & m]
|
||||||
|
+ (int)oldbuf[( i ) & m]) >> 1 ) - (int)*pbuf;
|
||||||
|
|
||||||
|
*pbuf -= ( *pbuf >> 6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MostSignificantBit( unsigned int v )
|
||||||
|
{
|
||||||
|
#if __GNUC__
|
||||||
|
return 31 - __builtin_clz( v );
|
||||||
|
#else
|
||||||
|
int i;
|
||||||
|
for( i = 0, v >>= 1; v; v >>= 1, i++ );
|
||||||
|
return i;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_AnimateRipples( void )
|
||||||
|
{
|
||||||
|
double frametime = gpGlobals->time - g_ripple.time;
|
||||||
|
|
||||||
|
g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value;
|
||||||
|
|
||||||
|
if( !g_ripple.update )
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_ripple.time = gpGlobals->time;
|
||||||
|
|
||||||
|
R_SwapBufs();
|
||||||
|
|
||||||
|
if( g_ripple.time - g_ripple.oldtime > r_ripple_spawntime.value )
|
||||||
|
{
|
||||||
|
int x, y, val;
|
||||||
|
|
||||||
|
g_ripple.oldtime = g_ripple.time;
|
||||||
|
|
||||||
|
x = rand() & 0x7fff;
|
||||||
|
y = rand() & 0x7fff;
|
||||||
|
val = rand() & 0x3ff;
|
||||||
|
|
||||||
|
R_SpawnNewRipple( x, y, val );
|
||||||
|
}
|
||||||
|
|
||||||
|
R_RunRipplesAnimation( g_ripple.oldbuf, g_ripple.curbuf );
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_UpdateRippleTexParams( void )
|
||||||
|
{
|
||||||
|
gl_texture_t *tex = R_GetTexture( g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
if( gl_texture_nearest.value )
|
||||||
|
{
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_UploadRipples( texture_t *image )
|
||||||
|
{
|
||||||
|
gl_texture_t *glt;
|
||||||
|
uint32_t *pixels;
|
||||||
|
int wbits, wmask, wshft;
|
||||||
|
|
||||||
|
// discard unuseful textures
|
||||||
|
if( !r_ripple.value || image->width > RIPPLES_CACHEWIDTH || image->width != image->height )
|
||||||
|
{
|
||||||
|
GL_Bind( XASH_TEXTURE0, image->gl_texturenum );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glt = R_GetTexture( image->gl_texturenum );
|
||||||
|
if( !glt || !glt->original || !glt->original->buffer || !FBitSet( glt->flags, TF_EXPAND_SOURCE ))
|
||||||
|
{
|
||||||
|
GL_Bind( XASH_TEXTURE0, image->gl_texturenum );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
// no updates this frame
|
||||||
|
if( !g_ripple.update && image->gl_texturenum == g_ripple.gl_texturenum )
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_ripple.gl_texturenum = image->gl_texturenum;
|
||||||
|
if( r_ripple.value == 1.0f )
|
||||||
|
{
|
||||||
|
g_ripple.texturescale = Q_max( 1.0f, image->width / 64.0f );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_ripple.texturescale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pixels = (uint32_t *)glt->original->buffer;
|
||||||
|
wbits = MostSignificantBit( image->width );
|
||||||
|
wshft = 7 - wbits;
|
||||||
|
wmask = image->width - 1;
|
||||||
|
|
||||||
|
for( int y = 0; y < image->height; y++ )
|
||||||
|
{
|
||||||
|
int ry = y << ( 7 + wshft );
|
||||||
|
|
||||||
|
for( int x = 0; x < image->width; x++ )
|
||||||
|
{
|
||||||
|
int rx = x << wshft;
|
||||||
|
int val = g_ripple.curbuf[ry + rx] >> 4;
|
||||||
|
|
||||||
|
int py = (y - val) & wmask;
|
||||||
|
int px = (x + val) & wmask;
|
||||||
|
int p = ( py << wbits ) + px;
|
||||||
|
|
||||||
|
g_ripple.texture[(y << wbits) + x] = pixels[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, image->width, image->width, 0,
|
||||||
|
GL_RGBA, GL_UNSIGNED_BYTE, g_ripple.texture );
|
||||||
|
}
|
||||||
|
|||||||
2
wscript
2
wscript
@@ -471,7 +471,7 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
|||||||
if conf.check_cfg(package='opus', uselib_store='opus', args='opus >= 1.4 --cflags --libs', mandatory=False):
|
if conf.check_cfg(package='opus', uselib_store='opus', args='opus >= 1.4 --cflags --libs', mandatory=False):
|
||||||
# now try to link with export that only exists with CUSTOM_MODES defined
|
# now try to link with export that only exists with CUSTOM_MODES defined
|
||||||
frag='''#include <opus_custom.h>
|
frag='''#include <opus_custom.h>
|
||||||
int main(void) { return !opus_custom_encoder_init(0, 0, 0); }'''
|
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''
|
||||||
|
|
||||||
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
|
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
|
||||||
conf.env.HAVE_SYSTEM_OPUS = True
|
conf.env.HAVE_SYSTEM_OPUS = True
|
||||||
|
|||||||
Reference in New Issue
Block a user