2019-02-18 19:25:26 +01:00
|
|
|
/*
|
|
|
|
ref_common.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
|
2019-03-06 15:14:25 +01:00
|
|
|
#if !defined REF_COMMON_H && !defined REF_DLL
|
2019-02-18 19:25:26 +01:00
|
|
|
#define REF_COMMON_H
|
|
|
|
|
|
|
|
#include "ref_api.h"
|
|
|
|
|
|
|
|
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( cl.playernum + 1 ) && e->player )
|
|
|
|
|
|
|
|
struct ref_state_s
|
|
|
|
{
|
|
|
|
qboolean initialized;
|
|
|
|
|
|
|
|
HINSTANCE hInstance;
|
|
|
|
ref_interface_t dllFuncs;
|
2019-08-09 02:39:24 +02:00
|
|
|
|
2023-03-23 23:52:14 +01:00
|
|
|
// depends on build configuration
|
2019-08-09 02:39:24 +02:00
|
|
|
int numRenderers;
|
2023-03-23 23:52:14 +01:00
|
|
|
const char **shortNames;
|
|
|
|
const char **readableNames;
|
2019-02-18 19:25:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct ref_state_s ref;
|
|
|
|
extern ref_globals_t refState;
|
|
|
|
|
|
|
|
// handy API wrappers
|
|
|
|
void R_GetTextureParms( int *w, int *h, int texnum );
|
2019-03-22 14:36:46 +01:00
|
|
|
#define REF_GET_PARM( parm, arg ) ref.dllFuncs.RefGetParm( (parm), (arg) )
|
2019-04-15 00:43:43 +02:00
|
|
|
#define GL_LoadTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), false )
|
|
|
|
#define GL_UpdateTextureInternal( name, pic, flags ) ref.dllFuncs.GL_LoadTextureFromBuffer( (name), (pic), (flags), true )
|
|
|
|
#define R_GetBuiltinTexture( name ) ref.dllFuncs.GL_LoadTexture( (name), 0, 0, 0 )
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2019-05-12 02:09:40 +02:00
|
|
|
void GL_RenderFrame( const struct ref_viewpass_s *rvp );
|
2019-03-28 16:17:26 +01:00
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
// common engine and renderer cvars
|
|
|
|
extern convar_t *r_decals;
|
|
|
|
extern convar_t *r_adjust_fov;
|
2019-06-17 07:37:34 +02:00
|
|
|
extern convar_t *gl_clear;
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2019-03-06 14:23:33 +01:00
|
|
|
qboolean R_Init( void );
|
2019-02-23 19:49:46 +01:00
|
|
|
void R_Shutdown( void );
|
2020-09-14 13:32:46 +02:00
|
|
|
void R_UpdateRefState( void );
|
2021-12-10 01:42:38 +01:00
|
|
|
const ref_device_t *R_GetRenderDevice( unsigned int idx );
|
2019-02-18 19:25:26 +01:00
|
|
|
|
2021-03-07 01:40:01 +01:00
|
|
|
extern triangleapi_t gTriApi;
|
|
|
|
|
2019-02-18 19:25:26 +01:00
|
|
|
#endif // REF_COMMON_H
|