ReGameDLL_CS/regamedll/common/r_studioint.h

205 lines
6.5 KiB
C
Raw Normal View History

2015-09-16 23:19:21 +03:00
/*
*
* 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 2 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef R_STUDIOINT_H
2015-06-30 12:46:07 +03:00
#define R_STUDIOINT_H
2015-09-16 23:19:21 +03:00
#ifdef _WIN32
2015-06-30 12:46:07 +03:00
#pragma once
#endif
#define STUDIO_INTERFACE_VERSION 1
typedef struct engine_studio_api_s
{
// Allocate number*size bytes and zero it
2015-09-16 23:19:21 +03:00
void *(*Mem_Calloc)(int number, size_t size);
2015-06-30 12:46:07 +03:00
// Check to see if pointer is in the cache
2015-09-16 23:19:21 +03:00
void *(*Cache_Check)(struct cache_user_s *c);
// Load file into cache (can be swapped out on demand)
void (*LoadCacheFile)(char *path, struct cache_user_s *cu);
2015-06-30 12:46:07 +03:00
// Retrieve model pointer for the named model
2015-09-16 23:19:21 +03:00
struct model_s *(*Mod_ForName)(const char *name, int crash_if_missing);
2015-06-30 12:46:07 +03:00
// Retrieve pointer to studio model data block from a model
2015-09-16 23:19:21 +03:00
void *(*Mod_Extradata)(struct model_s *mod);
2015-06-30 12:46:07 +03:00
// Retrieve indexed model from client side model precache list
2015-09-16 23:19:21 +03:00
struct model_s *(*GetModelByIndex)(int index);
2015-06-30 12:46:07 +03:00
// Get entity that is set for rendering
2015-09-16 23:19:21 +03:00
struct cl_entity_s * (*GetCurrentEntity)(void);
2015-06-30 12:46:07 +03:00
// Get referenced player_info_t
2015-09-16 23:19:21 +03:00
struct player_info_s *(*PlayerInfo)(int index);
2015-06-30 12:46:07 +03:00
// Get most recently received player state data from network system
2015-09-16 23:19:21 +03:00
struct entity_state_s *(*GetPlayerState)(int index);
2015-06-30 12:46:07 +03:00
// Get viewentity
2015-09-16 23:19:21 +03:00
struct cl_entity_s * (*GetViewEntity)(void);
2015-06-30 12:46:07 +03:00
// Get current frame count, and last two timestampes on client
2015-09-16 23:19:21 +03:00
void (*GetTimes)(int *framecount, double *current, double *old);
2015-06-30 12:46:07 +03:00
// Get a pointer to a cvar by name
2015-09-16 23:19:21 +03:00
struct cvar_s *(*GetCvar)(const char *name);
// Get current render origin and view vectors (up, right and vpn)
void (*GetViewInfo)(float *origin, float *upv, float *rightv, float *vpnv);
2015-06-30 12:46:07 +03:00
// Get sprite model used for applying chrome effect
2015-09-16 23:19:21 +03:00
struct model_s *(*GetChromeSprite)(void);
2015-06-30 12:46:07 +03:00
// Get model counters so we can incement instrumentation
2015-09-16 23:19:21 +03:00
void (*GetModelCounters)(int **s, int **a);
2015-06-30 12:46:07 +03:00
// Get software scaling coefficients
2015-09-16 23:19:21 +03:00
void (*GetAliasScale)(float *x, float *y);
2015-06-30 12:46:07 +03:00
// Get bone, light, alias, and rotation matrices
2015-09-16 23:19:21 +03:00
float ****(*StudioGetBoneTransform) (void);
float ****(*StudioGetLightTransform)(void);
float ***(*StudioGetAliasTransform) (void);
float ***(*StudioGetRotationMatrix) (void);
2015-06-30 12:46:07 +03:00
// Set up body part, and get submodel pointers
2015-09-16 23:19:21 +03:00
void (*StudioSetupModel)(int bodypart, void **ppbodypart, void **ppsubmodel);
2015-06-30 12:46:07 +03:00
// Check if entity's bbox is in the view frustum
2015-09-16 23:19:21 +03:00
int (*StudioCheckBBox)(void);
2015-06-30 12:46:07 +03:00
// Apply lighting effects to model
2015-09-16 23:19:21 +03:00
void (*StudioDynamicLight)(struct cl_entity_s *ent, struct alight_s *plight);
void (*StudioEntityLight)(struct alight_s *plight);
void (*StudioSetupLighting)(struct alight_s *plighting);
2015-06-30 12:46:07 +03:00
// Draw mesh vertices
2015-09-16 23:19:21 +03:00
void (*StudioDrawPoints)(void);
2015-06-30 12:46:07 +03:00
// Draw hulls around bones
2015-09-16 23:19:21 +03:00
void (*StudioDrawHulls)(void);
2015-06-30 12:46:07 +03:00
// Draw bbox around studio models
2015-09-16 23:19:21 +03:00
void (*StudioDrawAbsBBox)(void);
2015-06-30 12:46:07 +03:00
// Draws bones
2015-09-16 23:19:21 +03:00
void (*StudioDrawBones)(void);
2015-06-30 12:46:07 +03:00
// Loads in appropriate texture for model
2015-09-16 23:19:21 +03:00
void (*StudioSetupSkin)(void *ptexturehdr, int index);
2015-06-30 12:46:07 +03:00
// Sets up for remapped colors
2015-09-16 23:19:21 +03:00
void (*StudioSetRemapColors)(int top, int bottom);
2015-06-30 12:46:07 +03:00
// Set's player model and returns model pointer
2015-09-16 23:19:21 +03:00
struct model_s *(*SetupPlayerModel)(int index);
2015-06-30 12:46:07 +03:00
// Fires any events embedded in animation
2015-09-16 23:19:21 +03:00
void (*StudioClientEvents)(void);
2015-06-30 12:46:07 +03:00
// Retrieve/set forced render effects flags
2015-09-16 23:19:21 +03:00
int (*GetForceFaceFlags)(void);
void (*SetForceFaceFlags)(int flags);
2015-06-30 12:46:07 +03:00
// Tell engine the value of the studio model header
2015-09-16 23:19:21 +03:00
void (*StudioSetHeader)(void *header);
2015-06-30 12:46:07 +03:00
// Tell engine which model_t * is being renderered
2015-09-16 23:19:21 +03:00
void (*SetRenderModel)(struct model_s *model);
2015-06-30 12:46:07 +03:00
// Final state setup and restore for rendering
2015-09-16 23:19:21 +03:00
void (*SetupRenderer)(int rendermode);
void (*RestoreRenderer)(void);
2015-06-30 12:46:07 +03:00
// Set render origin for applying chrome effect
2015-09-16 23:19:21 +03:00
void (*SetChromeOrigin)(void);
2015-06-30 12:46:07 +03:00
// True if using D3D/OpenGL
2015-09-16 23:19:21 +03:00
int (*IsHardware)(void);
2015-06-30 12:46:07 +03:00
// Only called by hardware interface
2015-09-16 23:19:21 +03:00
void (*GL_StudioDrawShadow)(void);
void (*GL_SetRenderMode)(int mode);
void (*StudioSetRenderamt)(int iRenderamt); //!!!CZERO added for rendering glass on viewmodels
void (*StudioSetCullState)(int iCull);
void (*StudioRenderShadow)(int iSprite, float *p1, float *p2, float *p3, float *p4);
2015-06-30 12:46:07 +03:00
} engine_studio_api_t;
typedef struct server_studio_api_s
{
// Allocate number*size bytes and zero it
2015-09-16 23:19:21 +03:00
void *(*Mem_Calloc)(int number, size_t size);
2015-06-30 12:46:07 +03:00
// Check to see if pointer is in the cache
2015-09-16 23:19:21 +03:00
void *(*Cache_Check)(struct cache_user_s *c);
// Load file into cache (can be swapped out on demand)
void (*LoadCacheFile)(char *path, struct cache_user_s *cu);
2015-06-30 12:46:07 +03:00
// Retrieve pointer to studio model data block from a model
2015-09-16 23:19:21 +03:00
void *(*Mod_Extradata)(struct model_s *mod);
2015-06-30 12:46:07 +03:00
} server_studio_api_t;
// client blending
typedef struct r_studio_interface_s
{
2015-09-16 23:19:21 +03:00
int version;
int (*StudioDrawModel)(int flags);
int (*StudioDrawPlayer)(int flags, struct entity_state_s *pplayer);
2015-06-30 12:46:07 +03:00
} r_studio_interface_t;
extern r_studio_interface_t *pStudioAPI;
// server blending
#define SV_BLENDING_INTERFACE_VERSION 1
typedef struct sv_blending_interface_s
{
2015-09-16 23:19:21 +03:00
int version;
void (*SV_StudioSetupBones)(struct model_s *pModel,
2015-06-30 12:46:07 +03:00
float frame,
int sequence,
2015-09-16 23:19:21 +03:00
const vec_t *angles,
const vec_t *origin,
2015-06-30 12:46:07 +03:00
const byte *pcontroller,
const byte *pblending,
int iBone,
2015-09-16 23:19:21 +03:00
const edict_t *pEdict);
2015-06-30 12:46:07 +03:00
} sv_blending_interface_t;
#endif // R_STUDIOINT_H