2019-02-18 19:25:26 +01:00
|
|
|
/*
|
|
|
|
ref_api.h - Xash3D render dll API
|
|
|
|
Copyright (C) 2019 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.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef REF_API
|
|
|
|
#define REF_API
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
2019-02-23 19:49:46 +01:00
|
|
|
#include "com_image.h"
|
2019-02-18 19:25:26 +01:00
|
|
|
#include "vgui_api.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"
|
2019-03-11 15:37:58 +01:00
|
|
|
#include "com_image.h"
|
2022-07-01 18:37:21 +02:00
|
|
|
#include "filesystem.h"
|
2023-12-28 20:19:28 +01:00
|
|
|
#include "common/protocol.h"
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2022-07-01 18:37:21 +02:00
|
|
|
// RefAPI changelog:
|
|
|
|
// 1. Initial release
|
|
|
|
// 2. FS functions are removed, instead we have full fs_api_t
|
2023-02-13 03:23:13 +01:00
|
|
|
// 3. SlerpBones, CalcBonePosition/Quaternion calls were moved to libpublic/mathlib
|
2023-03-28 19:42:14 +02:00
|
|
|
// 4. R_StudioEstimateFrame now has time argument
|
2023-12-05 08:43:28 +01:00
|
|
|
// 5. Removed GetSomethingByIndex calls, renderers are supposed to cache pointer values
|
2023-11-02 01:06:07 +01:00
|
|
|
// Removed previously unused calls
|
2023-12-05 08:43:28 +01:00
|
|
|
// Simplified remapping calls
|
2023-12-05 11:16:01 +01:00
|
|
|
// GetRefAPI is now expected to return REF_API_VERSION
|
2023-12-28 20:19:46 +01:00
|
|
|
// 6. Removed timing from ref_globals_t.
|
|
|
|
// Renderers are supposed to migrate to ref_client_t/ref_host_t using PARM_GET_CLIENT_PTR and PARM_GET_HOST_PTR
|
|
|
|
// Removed functions to get internal engine structions. Use PARM_GET_*_PTR instead.
|
2024-01-06 16:54:21 +01:00
|
|
|
// 7. Gamma fixes.
|
2024-06-11 05:18:09 +02:00
|
|
|
// 8. Moved common code to engine.
|
|
|
|
// Removed REF_{SOLID,ALPHA}SKY_TEXTURE. Replaced R_InitSkyClouds by R_SetSkyCloudsTextures.
|
|
|
|
// Skybox loading is now done at engine side.
|
|
|
|
// R_SetupSky callback accepts a pointer to an array of 6 integers representing box side textures.
|
|
|
|
// Restored texture replacement from old Xash3D.
|
|
|
|
// PARM_SKY_SPHERE and PARM_SURF_SAMPLESIZE are now handled at engine side.
|
|
|
|
// VGUI rendering code is mostly moved back to engine.
|
|
|
|
// Implemented texture replacement.
|
2024-11-02 19:22:56 +01:00
|
|
|
// 9. Removed gamma functions. Renderer is supposed to get them through PARM_GET_*_PTR.
|
|
|
|
// Move hulls rendering back to engine
|
|
|
|
#define REF_API_VERSION 9
|
2019-02-23 19:49:46 +01:00
|
|
|
|
2024-01-29 03:59:06 +01:00
|
|
|
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP|TF_ALLOW_NEAREST)
|
|
|
|
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP|TF_ALLOW_NEAREST)
|
2019-02-23 19:49:46 +01:00
|
|
|
#define TF_IMAGE (TF_NOMIPMAP|TF_CLAMP)
|
|
|
|
#define TF_DECAL (TF_CLAMP)
|
|
|
|
|
2019-03-16 12:15:05 +01:00
|
|
|
#define FCONTEXT_CORE_PROFILE BIT( 0 )
|
|
|
|
#define FCONTEXT_DEBUG_ARB BIT( 1 )
|
|
|
|
|
2019-02-23 19:49:46 +01:00
|
|
|
// screenshot types
|
|
|
|
#define VID_SCREENSHOT 0
|
|
|
|
#define VID_LEVELSHOT 1
|
|
|
|
#define VID_MINISHOT 2
|
|
|
|
#define VID_MAPSHOT 3 // special case for overview layer
|
|
|
|
#define VID_SNAPSHOT 4 // save screenshot into root dir and no gamma correction
|
|
|
|
|
2019-02-24 16:45:27 +01:00
|
|
|
// model flags (stored in model_t->flags)
|
|
|
|
#define MODEL_CONVEYOR BIT( 0 )
|
|
|
|
#define MODEL_HAS_ORIGIN BIT( 1 )
|
|
|
|
#define MODEL_LIQUID BIT( 2 ) // model has only point hull
|
|
|
|
#define MODEL_TRANSPARENT BIT( 3 ) // have transparent surfaces
|
|
|
|
#define MODEL_COLORED_LIGHTING BIT( 4 ) // lightmaps stored as RGB
|
|
|
|
#define MODEL_WORLD BIT( 29 ) // it's a worldmodel
|
|
|
|
#define MODEL_CLIENT BIT( 30 ) // client sprite
|
|
|
|
|
|
|
|
// goes into world.flags
|
|
|
|
#define FWORLD_SKYSPHERE BIT( 0 )
|
|
|
|
#define FWORLD_CUSTOM_SKYBOX BIT( 1 )
|
|
|
|
#define FWORLD_WATERALPHA BIT( 2 )
|
|
|
|
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
2019-02-23 19:49:46 +01:00
|
|
|
|
2023-01-05 04:07:56 +01:00
|
|
|
// special rendermode for screenfade modulate
|
|
|
|
// (probably will be expanded at some point)
|
|
|
|
#define kRenderScreenFadeModulate 0x1000
|
|
|
|
|
2024-06-10 21:48:59 +02:00
|
|
|
#define SKYBOX_MAX_SIDES 6 // a box can only have 6 sides
|
|
|
|
|
2019-03-16 05:15:06 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
DEMO_INACTIVE = 0,
|
|
|
|
DEMO_XASH3D,
|
|
|
|
DEMO_QUAKE1
|
|
|
|
} demo_mode;
|
|
|
|
|
2019-02-27 00:23:03 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
msurface_t *surf;
|
|
|
|
int cull;
|
|
|
|
} sortedface_t;
|
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
typedef struct ref_globals_s
|
|
|
|
{
|
|
|
|
qboolean developer;
|
|
|
|
|
|
|
|
// viewport width and height
|
|
|
|
int width;
|
|
|
|
int height;
|
2019-10-30 19:36:07 +01:00
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
qboolean fullScreen;
|
|
|
|
qboolean wideScreen;
|
|
|
|
|
|
|
|
vec3_t vieworg;
|
|
|
|
vec3_t viewangles;
|
|
|
|
|
2019-02-27 00:23:03 +01:00
|
|
|
// todo: fill this without engine help
|
|
|
|
// move to local
|
|
|
|
|
|
|
|
// translucent sorted array
|
|
|
|
sortedface_t *draw_surfaces; // used for sorting translucent surfaces
|
|
|
|
int max_surfaces; // max surfaces per submodel (for all models)
|
|
|
|
size_t visbytes; // cluster size
|
2019-10-26 03:37:01 +02:00
|
|
|
|
|
|
|
int desktopBitsPixel;
|
2019-02-18 19:25:26 +01:00
|
|
|
} ref_globals_t;
|
|
|
|
|
2023-12-28 20:19:28 +01:00
|
|
|
typedef struct ref_client_s
|
|
|
|
{
|
|
|
|
double time;
|
|
|
|
double oldtime;
|
|
|
|
int viewentity;
|
|
|
|
int playernum;
|
|
|
|
int maxclients;
|
|
|
|
int nummodels;
|
|
|
|
model_t *models[MAX_MODELS+1];
|
|
|
|
qboolean paused;
|
|
|
|
vec3_t simorg;
|
|
|
|
} ref_client_t;
|
|
|
|
|
|
|
|
typedef struct ref_host_s
|
|
|
|
{
|
|
|
|
double realtime;
|
|
|
|
double frametime;
|
|
|
|
int features;
|
|
|
|
} ref_host_t;
|
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GL_KEEP_UNIT = -1,
|
|
|
|
XASH_TEXTURE0 = 0,
|
|
|
|
XASH_TEXTURE1,
|
|
|
|
XASH_TEXTURE2,
|
|
|
|
XASH_TEXTURE3, // g-cont. 4 units should be enough
|
|
|
|
MAX_TEXTURE_UNITS = 32 // can't access to all over units without GLSL or cg
|
|
|
|
};
|
|
|
|
|
|
|
|
enum // r_speeds counters
|
|
|
|
{
|
|
|
|
RS_ACTIVE_TENTS = 0,
|
|
|
|
};
|
|
|
|
|
2019-04-15 00:43:43 +02:00
|
|
|
// refdll must expose this default textures using this names
|
|
|
|
#define REF_DEFAULT_TEXTURE "*default"
|
|
|
|
#define REF_GRAY_TEXTURE "*gray"
|
|
|
|
#define REF_WHITE_TEXTURE "*white"
|
|
|
|
#define REF_BLACK_TEXTURE "*black"
|
2019-07-27 12:27:40 +02:00
|
|
|
#define REF_PARTICLE_TEXTURE "*particle"
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2019-03-22 14:36:46 +01:00
|
|
|
typedef enum connstate_e
|
2019-03-06 14:23:33 +01:00
|
|
|
{
|
2019-03-22 14:36:46 +01:00
|
|
|
ca_disconnected = 0,// not talking to a server
|
|
|
|
ca_connecting, // sending request packets to the server
|
|
|
|
ca_connected, // netchan_t established, waiting for svc_serverdata
|
|
|
|
ca_validate, // download resources, validating, auth on server
|
|
|
|
ca_active, // game views should be displayed
|
|
|
|
ca_cinematic, // playing a cinematic, not connected to a server
|
|
|
|
} connstate_t;
|
2019-03-06 14:23:33 +01:00
|
|
|
|
2019-03-11 15:37:58 +01:00
|
|
|
enum ref_defaultsprite_e
|
|
|
|
{
|
|
|
|
REF_DOT_SPRITE, // cl_sprite_dot
|
|
|
|
REF_CHROME_SPRITE // cl_sprite_shell
|
|
|
|
};
|
|
|
|
|
2019-04-04 22:13:55 +02:00
|
|
|
// the order of first three is important!
|
|
|
|
// so you can use this value in IEngineStudio.StudioIsHardware
|
2019-03-16 03:15:32 +01:00
|
|
|
enum ref_graphic_apis_e
|
|
|
|
{
|
|
|
|
REF_SOFTWARE, // hypothetical: just make a surface to draw on, in software
|
2019-04-04 22:13:55 +02:00
|
|
|
REF_GL, // create GL context
|
|
|
|
REF_D3D, // Direct3D
|
2019-03-16 03:15:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SAFE_NO = 0,
|
|
|
|
SAFE_NOMSAA, // skip msaa
|
|
|
|
SAFE_NOACC, // don't set acceleration flag
|
|
|
|
SAFE_NOSTENCIL, // don't set stencil bits
|
|
|
|
SAFE_NOALPHA, // don't set alpha bits
|
|
|
|
SAFE_NODEPTH, // don't set depth bits
|
|
|
|
SAFE_NOCOLOR, // don't set color bits
|
2019-08-03 18:01:35 +02:00
|
|
|
SAFE_DONTCARE, // ignore everything, let SDL/EGL decide
|
|
|
|
SAFE_LAST, // must be last
|
2019-03-16 03:15:32 +01:00
|
|
|
} ref_safegl_context_t;
|
|
|
|
|
|
|
|
enum // OpenGL configuration attributes
|
|
|
|
{
|
|
|
|
REF_GL_RED_SIZE,
|
|
|
|
REF_GL_GREEN_SIZE,
|
|
|
|
REF_GL_BLUE_SIZE,
|
|
|
|
REF_GL_ALPHA_SIZE,
|
2019-06-29 19:40:23 +02:00
|
|
|
REF_GL_DOUBLEBUFFER,
|
2019-03-16 03:15:32 +01:00
|
|
|
REF_GL_DEPTH_SIZE,
|
|
|
|
REF_GL_STENCIL_SIZE,
|
2019-06-29 19:40:23 +02:00
|
|
|
REF_GL_MULTISAMPLEBUFFERS,
|
2019-03-16 03:15:32 +01:00
|
|
|
REF_GL_MULTISAMPLESAMPLES,
|
|
|
|
REF_GL_ACCELERATED_VISUAL,
|
2019-06-29 19:40:23 +02:00
|
|
|
REF_GL_CONTEXT_MAJOR_VERSION,
|
2019-03-16 03:15:32 +01:00
|
|
|
REF_GL_CONTEXT_MINOR_VERSION,
|
|
|
|
REF_GL_CONTEXT_EGL,
|
|
|
|
REF_GL_CONTEXT_FLAGS,
|
|
|
|
REF_GL_CONTEXT_PROFILE_MASK,
|
|
|
|
REF_GL_SHARE_WITH_CURRENT_CONTEXT,
|
|
|
|
REF_GL_FRAMEBUFFER_SRGB_CAPABLE,
|
|
|
|
REF_GL_CONTEXT_RELEASE_BEHAVIOR,
|
|
|
|
REF_GL_CONTEXT_RESET_NOTIFICATION,
|
2019-05-12 02:06:01 +02:00
|
|
|
REF_GL_CONTEXT_NO_ERROR,
|
|
|
|
REF_GL_ATTRIBUTES_COUNT,
|
2019-03-16 03:15:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
REF_GL_CONTEXT_PROFILE_CORE = 0x0001,
|
|
|
|
REF_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
|
|
|
|
REF_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */
|
|
|
|
};
|
|
|
|
|
2019-05-12 02:06:01 +02:00
|
|
|
// binary compatible with SDL and EGL_KHR_create_context(0x0007 mask)
|
2019-03-16 03:15:32 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
REF_GL_CONTEXT_DEBUG_FLAG = 0x0001,
|
|
|
|
REF_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
|
|
|
|
REF_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
|
|
|
|
REF_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
|
|
|
|
};
|
|
|
|
|
2019-11-04 14:27:46 +01:00
|
|
|
typedef enum ref_screen_rotation_e
|
|
|
|
{
|
|
|
|
REF_ROTATE_NONE = 0,
|
|
|
|
REF_ROTATE_CW = 1,
|
|
|
|
REF_ROTATE_UD = 2,
|
|
|
|
REF_ROTATE_CCW = 3,
|
|
|
|
} ref_screen_rotation_t;
|
|
|
|
|
2019-03-16 05:15:06 +01:00
|
|
|
typedef struct remap_info_s
|
|
|
|
{
|
|
|
|
unsigned short textures[MAX_SKINS];// alias textures
|
|
|
|
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
|
|
|
|
short numtextures; // textures count
|
|
|
|
short topcolor; // cached value
|
|
|
|
short bottomcolor; // cached value
|
|
|
|
model_t *model; // for catch model changes
|
|
|
|
} remap_info_t;
|
|
|
|
|
2023-05-20 19:20:14 +02:00
|
|
|
typedef struct convar_s convar_t;
|
2019-03-22 14:36:46 +01:00
|
|
|
struct con_nprint_s;
|
|
|
|
struct engine_studio_api_s;
|
|
|
|
struct r_studio_interface_s;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PARM_DEV_OVERVIEW = -1,
|
|
|
|
PARM_THIRDPERSON = -2,
|
|
|
|
PARM_QUAKE_COMPATIBLE = -3,
|
2023-12-28 20:19:46 +01:00
|
|
|
PARM_GET_CLIENT_PTR = -4, // ref_client_t
|
|
|
|
PARM_GET_HOST_PTR = -5, // ref_host_t
|
2019-03-22 14:36:46 +01:00
|
|
|
PARM_CONNSTATE = -6, // cls.state
|
|
|
|
PARM_PLAYING_DEMO = -7, // cls.demoplayback
|
|
|
|
PARM_WATER_LEVEL = -8, // cl.local.water_level
|
2023-12-28 20:19:46 +01:00
|
|
|
PARM_GET_WORLD_PTR = -9, // world
|
2019-03-22 14:36:46 +01:00
|
|
|
PARM_LOCAL_HEALTH = -10, // cl.local.health
|
|
|
|
PARM_LOCAL_GAME = -11,
|
|
|
|
PARM_NUMENTITIES = -12, // local game only
|
2023-12-28 20:19:46 +01:00
|
|
|
PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars
|
|
|
|
PARM_GET_PALETTE_PTR = -14, // clgame.palette
|
|
|
|
PARM_GET_VIEWENT_PTR = -15, // clgame.viewent
|
2024-01-25 03:43:51 +01:00
|
|
|
|
2024-11-02 20:11:22 +01:00
|
|
|
PARM_GET_TEXGAMMATABLE_PTR = -16,
|
|
|
|
PARM_GET_LIGHTGAMMATABLE_PTR = -17,
|
|
|
|
PARM_GET_SCREENGAMMATABLE_PTR = -18,
|
|
|
|
PARM_GET_LINEARGAMMATABLE_PTR = -19,
|
|
|
|
|
2024-11-02 20:50:15 +01:00
|
|
|
PARM_GET_LIGHTSTYLES_PTR = -20,
|
|
|
|
PARM_GET_DLIGHTS_PTR = -21,
|
|
|
|
PARM_GET_ELIGHTS_PTR = -22,
|
|
|
|
|
2024-01-25 03:43:51 +01:00
|
|
|
// implemented by ref_dll
|
|
|
|
|
|
|
|
// returns non-null integer if filtering is enabled for texture
|
|
|
|
// pass -1 to query global filtering settings
|
2024-06-11 05:18:09 +02:00
|
|
|
PARM_TEX_FILTERING = -0x10000,
|
2019-03-22 14:36:46 +01:00
|
|
|
} ref_parm_e;
|
2019-02-24 16:45:27 +01:00
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
typedef struct ref_api_s
|
|
|
|
{
|
2022-09-20 17:06:19 +02:00
|
|
|
intptr_t (*EngineGetParm)( int parm, int arg ); // generic
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// cvar handlers
|
2019-03-16 12:15:05 +01:00
|
|
|
cvar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );
|
|
|
|
cvar_t *(*pfnGetCvarPointer)( const char *name, int ignore_flags );
|
2019-02-24 16:45:27 +01:00
|
|
|
float (*pfnGetCvarFloat)( const char *szName );
|
|
|
|
const char *(*pfnGetCvarString)( const char *szName );
|
2019-03-06 15:14:25 +01:00
|
|
|
void (*Cvar_SetValue)( const char *name, float value );
|
2019-03-16 02:17:56 +01:00
|
|
|
void (*Cvar_Set)( const char *name, const char *value );
|
2023-05-20 19:20:14 +02:00
|
|
|
void (*Cvar_RegisterVariable)( convar_t *var );
|
2019-03-11 15:37:58 +01:00
|
|
|
void (*Cvar_FullSet)( const char *var_name, const char *value, int flags );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// command handlers
|
|
|
|
int (*Cmd_AddCommand)( const char *cmd_name, void (*function)(void), const char *description );
|
2019-03-22 14:36:46 +01:00
|
|
|
void (*Cmd_RemoveCommand)( const char *cmd_name );
|
2019-02-24 16:45:27 +01:00
|
|
|
int (*Cmd_Argc)( void );
|
|
|
|
const char *(*Cmd_Argv)( int arg );
|
2019-03-16 02:17:56 +01:00
|
|
|
const char *(*Cmd_Args)( void );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// cbuf
|
|
|
|
void (*Cbuf_AddText)( const char *commands );
|
|
|
|
void (*Cbuf_InsertText)( const char *commands );
|
|
|
|
void (*Cbuf_Execute)( void );
|
|
|
|
|
|
|
|
// logging
|
2022-05-28 16:58:17 +02:00
|
|
|
void (*Con_Printf)( const char *fmt, ... ) _format( 1 ); // typical console allowed messages
|
|
|
|
void (*Con_DPrintf)( const char *fmt, ... ) _format( 1 ); // -dev 1
|
|
|
|
void (*Con_Reportf)( const char *fmt, ... ) _format( 1 ); // -dev 2
|
2019-03-06 14:23:33 +01:00
|
|
|
|
|
|
|
// debug print
|
2022-05-28 16:58:17 +02:00
|
|
|
void (*Con_NPrintf)( int pos, const char *fmt, ... ) _format( 2 );
|
|
|
|
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) _format( 2 );
|
2019-03-22 14:36:46 +01:00
|
|
|
void (*CL_CenterPrint)( const char *s, float y );
|
2019-03-06 14:23:33 +01:00
|
|
|
void (*Con_DrawStringLen)( const char *pText, int *length, int *height );
|
|
|
|
int (*Con_DrawString)( int x, int y, const char *string, rgba_t setColor );
|
2019-10-05 01:07:49 +02:00
|
|
|
void (*CL_DrawCenterPrint)( void );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// entity management
|
|
|
|
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
2019-05-02 18:05:09 +02:00
|
|
|
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
2019-03-06 14:23:33 +01:00
|
|
|
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// brushes
|
2023-12-02 15:25:18 +01:00
|
|
|
int (*Mod_SampleSizeForFace)( const struct msurface_s *surf );
|
2019-02-24 16:45:27 +01:00
|
|
|
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
2019-03-06 14:23:33 +01:00
|
|
|
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
2024-11-02 19:22:56 +01:00
|
|
|
void (*R_DrawWorldHull)( void );
|
|
|
|
void (*R_DrawModelHull)( model_t *mod );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// studio models
|
|
|
|
void *(*R_StudioGetAnim)( studiohdr_t *m_pStudioHeader, model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
|
2019-03-11 15:37:58 +01:00
|
|
|
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// efx
|
|
|
|
void (*CL_DrawEFX)( float time, qboolean fTrans );
|
2019-03-06 14:23:33 +01:00
|
|
|
void (*CL_ThinkParticle)( double frametime, particle_t *p );
|
2019-02-24 16:45:27 +01:00
|
|
|
void (*R_FreeDeadParticles)( particle_t **ppparticles );
|
2019-03-06 15:14:25 +01:00
|
|
|
particle_t *(*CL_AllocParticleFast)( void ); // unconditionally give new particle pointer from cl_free_particles
|
2019-03-11 15:37:58 +01:00
|
|
|
struct dlight_s *(*CL_AllocElight)( int key );
|
|
|
|
struct model_s *(*GetDefaultSprite)( enum ref_defaultsprite_e spr );
|
2019-03-17 17:14:53 +01:00
|
|
|
void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// model management
|
|
|
|
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
|
|
|
void *(*Mod_Extradata)( int type, model_t *model );
|
|
|
|
|
2019-03-06 14:23:33 +01:00
|
|
|
// remap
|
2023-12-05 08:43:28 +01:00
|
|
|
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
2019-03-06 14:23:33 +01:00
|
|
|
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// utils
|
|
|
|
void (*CL_ExtraUpdate)( void );
|
2022-08-05 17:05:15 +02:00
|
|
|
void (*Host_Error)( const char *fmt, ... ) _format( 1 );
|
2019-03-06 15:14:25 +01:00
|
|
|
void (*COM_SetRandomSeed)( int lSeed );
|
2019-02-24 16:45:27 +01:00
|
|
|
float (*COM_RandomFloat)( float rmin, float rmax );
|
|
|
|
int (*COM_RandomLong)( int rmin, int rmax );
|
|
|
|
struct screenfade_s *(*GetScreenFade)( void );
|
2019-03-06 14:23:33 +01:00
|
|
|
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
2019-03-06 15:14:25 +01:00
|
|
|
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
2019-03-16 03:15:32 +01:00
|
|
|
int (*Sys_CheckParm)( const char *flag );
|
2019-03-06 14:23:33 +01:00
|
|
|
|
|
|
|
// studio interface
|
|
|
|
player_info_t *(*pfnPlayerInfo)( int index );
|
|
|
|
entity_state_t *(*pfnGetPlayerState)( int index );
|
2019-03-11 15:37:58 +01:00
|
|
|
void *(*Mod_CacheCheck)( struct cache_user_s *c );
|
|
|
|
void (*Mod_LoadCacheFile)( const char *path, struct cache_user_s *cu );
|
|
|
|
void *(*Mod_Calloc)( int number, size_t size );
|
|
|
|
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
|
|
|
// memory
|
2024-09-30 00:10:42 +02:00
|
|
|
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline )
|
|
|
|
WARN_UNUSED_RESULT;
|
2021-06-01 18:28:52 +02:00
|
|
|
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
2024-09-30 00:10:42 +02:00
|
|
|
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline )
|
|
|
|
ALLOC_CHECK( 2 ) WARN_UNUSED_RESULT;
|
|
|
|
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline )
|
|
|
|
ALLOC_CHECK( 3 ) WARN_UNUSED_RESULT;
|
2019-02-24 16:45:27 +01:00
|
|
|
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
|
|
|
|
|
|
|
// library management
|
2019-03-16 02:17:56 +01:00
|
|
|
void *(*COM_LoadLibrary)( const char *name, int build_ordinals_table, qboolean directpath );
|
2019-02-24 16:45:27 +01:00
|
|
|
void (*COM_FreeLibrary)( void *handle );
|
|
|
|
void *(*COM_GetProcAddress)( void *handle, const char *name );
|
|
|
|
|
2019-03-16 03:15:32 +01:00
|
|
|
// video init
|
|
|
|
// try to create window
|
|
|
|
// will call GL_SetupAttributes in case of REF_GL
|
2019-07-27 23:13:40 +02:00
|
|
|
qboolean (*R_Init_Video)( int type ); // will also load and execute renderer config(see R_GetConfigName)
|
2019-03-16 03:15:32 +01:00
|
|
|
void (*R_Free_Video)( void );
|
|
|
|
|
2019-02-24 16:45:27 +01:00
|
|
|
// GL
|
|
|
|
int (*GL_SetAttribute)( int attr, int value );
|
2019-03-16 03:15:32 +01:00
|
|
|
int (*GL_GetAttribute)( int attr, int *value );
|
2019-02-24 16:45:27 +01:00
|
|
|
void *(*GL_GetProcAddress)( const char *name );
|
2019-10-05 01:07:49 +02:00
|
|
|
void (*GL_SwapBuffers)( void );
|
2019-02-24 16:45:27 +01:00
|
|
|
|
2019-03-24 21:24:31 +01:00
|
|
|
// SW
|
|
|
|
qboolean (*SW_CreateBuffer)( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
|
2019-10-05 01:07:49 +02:00
|
|
|
void *(*SW_LockBuffer)( void );
|
|
|
|
void (*SW_UnlockBuffer)( void );
|
2019-03-24 21:24:31 +01:00
|
|
|
|
2019-02-27 00:23:03 +01:00
|
|
|
// renderapi
|
|
|
|
lightstyle_t* (*GetLightStyle)( int number );
|
2019-03-06 14:23:33 +01:00
|
|
|
dlight_t* (*GetDynamicLight)( int number );
|
|
|
|
dlight_t* (*GetEntityLight)( int number );
|
2019-02-27 00:23:03 +01:00
|
|
|
int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
|
|
|
const struct ref_overview_s *( *GetOverviewParms )( void );
|
2019-03-16 02:17:56 +01:00
|
|
|
double (*pfnTime)( void ); // Sys_DoubleTime
|
2019-02-27 00:23:03 +01:00
|
|
|
|
2019-03-06 14:23:33 +01:00
|
|
|
// event api
|
|
|
|
struct physent_s *(*EV_GetPhysent)( int idx );
|
|
|
|
struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend );
|
|
|
|
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
|
|
|
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
|
|
|
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
|
|
|
|
|
|
|
// imagelib
|
|
|
|
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
2019-03-11 15:37:58 +01:00
|
|
|
void (*Image_SetForceFlags)( uint flags );
|
|
|
|
void (*Image_ClearForceFlags)( void );
|
2019-03-06 15:14:25 +01:00
|
|
|
qboolean (*Image_CustomPalette)( void );
|
2021-12-07 07:04:16 +01:00
|
|
|
qboolean (*Image_Process)( rgbdata_t **pix, int width, int height, uint flags, float reserved );
|
2019-03-06 15:14:25 +01:00
|
|
|
rgbdata_t *(*FS_LoadImage)( const char *filename, const byte *buffer, size_t size );
|
|
|
|
qboolean (*FS_SaveImage)( const char *filename, rgbdata_t *pix );
|
|
|
|
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
|
|
|
|
void (*FS_FreeImage)( rgbdata_t *pack );
|
2019-03-11 15:37:58 +01:00
|
|
|
void (*Image_SetMDLPointer)( byte *p );
|
2019-03-22 14:36:46 +01:00
|
|
|
const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );
|
2019-03-06 14:23:33 +01:00
|
|
|
|
2019-02-27 00:23:03 +01:00
|
|
|
// client exports
|
|
|
|
void (*pfnDrawNormalTriangles)( void );
|
|
|
|
void (*pfnDrawTransparentTriangles)( void );
|
2019-03-16 02:17:56 +01:00
|
|
|
render_interface_t *drawFuncs;
|
2022-07-01 18:37:21 +02:00
|
|
|
|
|
|
|
// filesystem exports
|
|
|
|
fs_api_t *fsapi;
|
2019-02-18 19:25:26 +01:00
|
|
|
} ref_api_t;
|
|
|
|
|
|
|
|
struct mip_s;
|
|
|
|
|
|
|
|
// render callbacks
|
|
|
|
typedef struct ref_interface_s
|
|
|
|
{
|
|
|
|
// construct, destruct
|
2019-03-15 19:23:59 +01:00
|
|
|
qboolean (*R_Init)( void ); // context is true if you need context management
|
|
|
|
// const char *(*R_GetInitError)( void );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*R_Shutdown)( void );
|
2019-07-27 23:13:40 +02:00
|
|
|
const char *(*R_GetConfigName)( void ); // returns config name without extension
|
2019-11-04 14:27:46 +01:00
|
|
|
qboolean (*R_SetDisplayTransform)( ref_screen_rotation_t rotate, int x, int y, float scale_x, float scale_y );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2019-04-13 19:34:32 +02:00
|
|
|
// only called for GL contexts
|
2019-03-16 03:15:32 +01:00
|
|
|
void (*GL_SetupAttributes)( int safegl );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*GL_InitExtensions)( void );
|
|
|
|
void (*GL_ClearExtensions)( void );
|
|
|
|
|
2023-12-05 11:36:06 +01:00
|
|
|
// scene rendering
|
2024-01-06 16:38:53 +01:00
|
|
|
void (*R_GammaChanged)( qboolean do_reset_gamma );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*R_BeginFrame)( qboolean clearScene );
|
|
|
|
void (*R_RenderScene)( void );
|
|
|
|
void (*R_EndFrame)( void );
|
|
|
|
void (*R_PushScene)( void );
|
|
|
|
void (*R_PopScene)( void );
|
|
|
|
void (*GL_BackendStartFrame)( void );
|
|
|
|
void (*GL_BackendEndFrame)( void );
|
|
|
|
|
|
|
|
void (*R_ClearScreen)( void ); // clears color buffer on GL
|
|
|
|
void (*R_AllowFog)( qboolean allow );
|
|
|
|
void (*GL_SetRenderMode)( int renderMode );
|
|
|
|
|
2019-03-15 19:23:59 +01:00
|
|
|
qboolean (*R_AddEntity)( struct cl_entity_s *clent, int type );
|
2019-02-23 19:49:46 +01:00
|
|
|
void (*CL_AddCustomBeam)( cl_entity_t *pEnvBeam );
|
2023-12-05 11:36:06 +01:00
|
|
|
void (*R_ProcessEntData)( qboolean allocate, cl_entity_t *entities, unsigned int max_entities );
|
|
|
|
void (*R_Flush)( unsigned int flush_flags );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// debug
|
|
|
|
void (*R_ShowTextures)( void );
|
|
|
|
|
|
|
|
// texture management
|
2019-02-24 16:45:27 +01:00
|
|
|
const byte *(*R_GetTextureOriginalBuffer)( unsigned int idx ); // not always available
|
2019-02-18 19:25:26 +01:00
|
|
|
int (*GL_LoadTextureFromBuffer)( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
|
|
|
|
void (*GL_ProcessTexture)( int texnum, float gamma, int topColor, int bottomColor );
|
2024-06-10 21:48:59 +02:00
|
|
|
void (*R_SetupSky)( int *skyboxTextures );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// 2D
|
|
|
|
void (*R_Set2DMode)( qboolean enable );
|
|
|
|
void (*R_DrawStretchRaw)( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
|
|
|
void (*R_DrawStretchPic)( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
2019-02-24 16:45:27 +01:00
|
|
|
void (*R_DrawTileClear)( int texnum, int x, int y, int w, int h );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*FillRGBA)( float x, float y, float w, float h, int r, int g, int b, int a ); // in screen space
|
|
|
|
void (*FillRGBABlend)( float x, float y, float w, float h, int r, int g, int b, int a ); // in screen space
|
2021-10-30 17:49:27 +02:00
|
|
|
int (*WorldToScreen)( const vec3_t world, vec3_t screen ); // Returns 1 if it's z clipped
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// screenshot, cubemapshot
|
|
|
|
qboolean (*VID_ScreenShot)( const char *filename, int shot_type );
|
|
|
|
qboolean (*VID_CubemapShot)( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
|
|
|
|
|
|
|
// light
|
|
|
|
colorVec (*R_LightPoint)( const float *p );
|
|
|
|
|
|
|
|
// decals
|
|
|
|
// Shoots a decal onto the surface of the BSP. position is the center of the decal in world coords
|
|
|
|
void (*R_DecalShoot)( int textureIndex, int entityIndex, int modelIndex, vec3_t pos, int flags, float scale );
|
|
|
|
void (*R_DecalRemoveAll)( int texture );
|
|
|
|
int (*R_CreateDecalList)( struct decallist_s *pList );
|
|
|
|
void (*R_ClearAllDecals)( void );
|
|
|
|
|
|
|
|
// studio interface
|
2023-03-28 19:42:14 +02:00
|
|
|
float (*R_StudioEstimateFrame)( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*R_StudioLerpMovement)( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
|
2019-02-23 19:49:46 +01:00
|
|
|
void (*CL_InitStudioAPI)( void );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// bmodel
|
2024-06-10 21:00:44 +02:00
|
|
|
void (*R_SetSkyCloudsTextures)( int solidskyTexture, int alphaskyTexture );
|
2023-10-28 14:20:52 +02:00
|
|
|
void (*GL_SubdivideSurface)( model_t *mod, msurface_t *fa );
|
2019-02-23 19:49:46 +01:00
|
|
|
void (*CL_RunLightStyles)( void );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// sprites
|
|
|
|
void (*R_GetSpriteParms)( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite );
|
2019-03-17 17:41:11 +01:00
|
|
|
int (*R_GetSpriteTexture)( const model_t *m_pSpriteModel, int frame );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// model management
|
|
|
|
// flags ignored for everything except spritemodels
|
|
|
|
void (*Mod_LoadMapSprite)( struct model_s *mod, const void *buffer, size_t size, qboolean *loaded );
|
2019-03-17 15:19:24 +01:00
|
|
|
qboolean (*Mod_ProcessRenderData)( model_t *mod, qboolean create, const byte *buffer );
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*Mod_StudioLoadTextures)( model_t *mod, void *data );
|
|
|
|
|
2019-02-23 19:49:46 +01:00
|
|
|
// efx implementation
|
2019-03-11 15:37:58 +01:00
|
|
|
void (*CL_DrawParticles)( double frametime, particle_t *particles, float partsize );
|
2019-02-23 19:49:46 +01:00
|
|
|
void (*CL_DrawTracers)( double frametime, particle_t *tracers );
|
|
|
|
void (*CL_DrawBeams)( int fTrans , BEAM *beams );
|
|
|
|
qboolean (*R_BeamCull)( const vec3_t start, const vec3_t end, qboolean pvsOnly );
|
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
// Xash3D Render Interface
|
2019-03-15 19:23:59 +01:00
|
|
|
// Get renderer info (doesn't changes engine state at all)
|
2019-03-22 14:36:46 +01:00
|
|
|
int (*RefGetParm)( int parm, int arg ); // generic
|
2019-03-15 19:23:59 +01:00
|
|
|
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
|
|
|
|
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
|
|
|
|
float (*GetFrameTime)( void );
|
|
|
|
|
|
|
|
// Set renderer info (tell engine about changes)
|
|
|
|
void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel
|
|
|
|
void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged
|
|
|
|
|
|
|
|
// Texture tools
|
|
|
|
int (*GL_FindTexture)( const char *name );
|
|
|
|
const char* (*GL_TextureName)( unsigned int texnum );
|
|
|
|
const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL
|
|
|
|
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags );
|
|
|
|
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, texFlags_t flags );
|
|
|
|
int (*GL_LoadTextureArray)( const char **names, int flags );
|
|
|
|
int (*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
|
|
|
|
void (*GL_FreeTexture)( unsigned int texnum );
|
2024-06-11 05:16:21 +02:00
|
|
|
void (*R_OverrideTextureSourceSize)( unsigned int texnum, unsigned int srcWidth, unsigned int srcHeight ); // used to override decal size for texture replacement
|
2019-03-15 19:23:59 +01:00
|
|
|
|
|
|
|
// Decals manipulating (draw & remove)
|
|
|
|
void (*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa );
|
|
|
|
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
|
|
|
|
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
|
|
|
|
|
|
|
|
// AVI
|
|
|
|
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
|
|
|
|
|
|
|
|
// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)
|
|
|
|
void (*GL_Bind)( int tmu, unsigned int texnum );
|
|
|
|
void (*GL_SelectTexture)( int tmu );
|
|
|
|
void (*GL_LoadTextureMatrix)( const float *glmatrix );
|
|
|
|
void (*GL_TexMatrixIdentity)( void );
|
|
|
|
void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units
|
|
|
|
void (*GL_TexGen)( unsigned int coord, unsigned int mode );
|
|
|
|
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
|
|
|
|
void (*GL_TexCoordArrayMode)( unsigned int texmode );
|
|
|
|
void (*GL_UpdateTexSize)( int texnum, int width, int height, int depth ); // recalc statistics
|
|
|
|
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
|
|
|
|
void (*GL_Reserved1)( void );
|
|
|
|
|
|
|
|
// Misc renderer functions
|
|
|
|
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );
|
|
|
|
colorVec (*LightVec)( const float *start, const float *end, float *lightspot, float *lightvec );
|
|
|
|
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
|
|
|
|
|
|
|
|
// passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer)
|
2019-05-12 17:02:59 +02:00
|
|
|
void (*GL_RenderFrame)( const struct ref_viewpass_s *rvp );
|
2019-03-15 19:23:59 +01:00
|
|
|
// setup map bounds for ortho-projection when we in dev_overview mode
|
|
|
|
void (*GL_OrthoBounds)( const float *mins, const float *maxs );
|
|
|
|
// grab r_speeds message
|
|
|
|
qboolean (*R_SpeedsMessage)( char *out, size_t size );
|
|
|
|
// get visdata for current frame from custom renderer
|
|
|
|
byte* (*Mod_GetCurrentVis)( void );
|
|
|
|
// tell the renderer what new map is started
|
|
|
|
void (*R_NewMap)( void );
|
|
|
|
// clear the render entities before each frame
|
|
|
|
void (*R_ClearScene)( void );
|
2020-02-25 06:55:57 +01:00
|
|
|
// GL_GetProcAddress for client renderer
|
|
|
|
void* (*R_GetProcAddress)( const char *name );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
|
|
|
// TriAPI Interface
|
|
|
|
// NOTE: implementation isn't required to be compatible
|
|
|
|
void (*TriRenderMode)( int mode );
|
|
|
|
void (*Begin)( int primitiveCode );
|
|
|
|
void (*End)( void );
|
2019-03-28 16:17:26 +01:00
|
|
|
void (*Color4f)( float r, float g, float b, float a ); // real glColor4f
|
|
|
|
void (*Color4ub)( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); // real glColor4ub
|
2019-02-18 19:25:26 +01:00
|
|
|
void (*TexCoord2f)( float u, float v );
|
|
|
|
void (*Vertex3fv)( const float *worldPnt );
|
|
|
|
void (*Vertex3f)( float x, float y, float z );
|
|
|
|
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
|
|
|
|
void (*ScreenToWorld)( const float *screen, float *world );
|
|
|
|
void (*GetMatrix)( const int pname, float *matrix );
|
|
|
|
void (*FogParams)( float flDensity, int iFogSkybox );
|
|
|
|
void (*CullFace)( TRICULLSTYLE mode );
|
|
|
|
|
|
|
|
// vgui drawing implementation
|
2024-06-11 01:00:18 +02:00
|
|
|
void (*VGUI_SetupDrawing)( qboolean rect );
|
|
|
|
void (*VGUI_UploadTextureBlock)( int drawX, int drawY, const byte *rgba, int blockWidth, int blockHeight );
|
2019-02-18 19:25:26 +01:00
|
|
|
} ref_interface_t;
|
|
|
|
|
|
|
|
typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t* engfuncs, ref_globals_t *pGlobals );
|
2019-08-09 02:39:24 +02:00
|
|
|
#define GET_REF_API "GetRefAPI"
|
|
|
|
|
2021-12-06 02:57:32 +01:00
|
|
|
#ifdef REF_DLL
|
|
|
|
#define DEFINE_ENGINE_SHARED_CVAR( x, y ) cvar_t *x = NULL;
|
|
|
|
#define DECLARE_ENGINE_SHARED_CVAR( x, y ) extern cvar_t *x;
|
|
|
|
#define RETRIEVE_ENGINE_SHARED_CVAR( x, y ) \
|
|
|
|
if(!( x = gEngfuncs.pfnGetCvarPointer( #y, 0 ) )) \
|
2023-05-19 04:55:06 +02:00
|
|
|
gEngfuncs.Host_Error( S_ERROR "engine didn't gave us %s cvar pointer\n", #y );
|
2021-12-06 02:57:32 +01:00
|
|
|
#define ENGINE_SHARED_CVAR_NAME( f, x, y ) f( x, y )
|
|
|
|
#define ENGINE_SHARED_CVAR( f, x ) ENGINE_SHARED_CVAR_NAME( f, x, x )
|
|
|
|
|
|
|
|
// cvars that's logic is shared between renderer and engine
|
|
|
|
// actually, they are just created on engine side for convinience
|
|
|
|
// and must be retrieved by renderer side
|
|
|
|
// sometimes it's done to standartize cvars to make it easier for users
|
|
|
|
#define ENGINE_SHARED_CVAR_LIST( f ) \
|
|
|
|
ENGINE_SHARED_CVAR_NAME( f, vid_gamma, gamma ) \
|
|
|
|
ENGINE_SHARED_CVAR_NAME( f, vid_brightness, brightness ) \
|
2024-01-06 16:54:21 +01:00
|
|
|
ENGINE_SHARED_CVAR_NAME( f, v_lightgamma, lightgamma ) \
|
|
|
|
ENGINE_SHARED_CVAR_NAME( f, v_direct, direct ) \
|
2023-05-19 04:55:06 +02:00
|
|
|
ENGINE_SHARED_CVAR( f, r_showtextures ) \
|
2021-12-06 02:57:32 +01:00
|
|
|
ENGINE_SHARED_CVAR( f, r_speeds ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_fullbright ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_norefresh ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_lightmap ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_dynamic ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_drawentities ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_decals ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_showhull ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, gl_vsync ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, gl_clear ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, cl_himodels ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, cl_lightstyle_lerping ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, tracerred ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, tracergreen ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, tracerblue ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, traceralpha ) \
|
2021-12-06 03:17:25 +01:00
|
|
|
ENGINE_SHARED_CVAR( f, r_sprite_lerping ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_sprite_lighting ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_drawviewmodel ) \
|
|
|
|
ENGINE_SHARED_CVAR( f, r_glowshellfreq ) \
|
2024-06-11 05:16:21 +02:00
|
|
|
ENGINE_SHARED_CVAR( f, host_allow_materials ) \
|
2021-12-06 02:57:32 +01:00
|
|
|
|
|
|
|
#define DECLARE_ENGINE_SHARED_CVAR_LIST() \
|
|
|
|
ENGINE_SHARED_CVAR_LIST( DECLARE_ENGINE_SHARED_CVAR )
|
|
|
|
|
|
|
|
#define DEFINE_ENGINE_SHARED_CVAR_LIST() \
|
|
|
|
ENGINE_SHARED_CVAR_LIST( DEFINE_ENGINE_SHARED_CVAR )
|
|
|
|
|
|
|
|
#define RETRIEVE_ENGINE_SHARED_CVAR_LIST() \
|
|
|
|
ENGINE_SHARED_CVAR_LIST( RETRIEVE_ENGINE_SHARED_CVAR )
|
|
|
|
#endif
|
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
#endif // REF_API
|