OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
tr_public.h
1/*
2===========================================================================
3Copyright (C) 1999-2005 Id Software, Inc.
4
5This file is part of Quake III Arena source code.
6
7Quake III Arena source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12Quake III Arena source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with Foobar; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22#pragma once
23
24#include "../renderercommon/tr_public.h"
25#include "../renderercommon/iqm.h"
26#include "../renderercommon/qgl.h"
27
28#if 0
29
30#include "../cgame/tr_types.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define REF_API_VERSION 14
37
38typedef struct dtiki_s dtiki_t;
39typedef struct skelAnimFrame_s skelAnimFrame_t;
40
41//
42// these are the functions exported by the refresh module
43//
44typedef struct {
45 // called before the library is unloaded
46 // if the system is just reconfiguring, pass destroyWindow = qfalse,
47 // which will keep the screen from flashing to the desktop.
48 void (*Shutdown)( qboolean destroyWindow );
49
50 // All data that will be used in a level should be
51 // registered before rendering any frames to prevent disk hits,
52 // but they can still be registered at a later time
53 // if necessary.
54 //
55 // BeginRegistration makes any existing media pointers invalid
56 // and returns the current gl configuration, including screen width
57 // and height, which can be used by the client to intelligently
58 // size display elements
59 void (*BeginRegistration)(glconfig_t* glConfigOut);
60 qhandle_t(*RegisterModel)(const char* name);
61 qhandle_t(*SpawnEffectModel)(const char* name, vec3_t pos, vec3_t axis[3]);
62 qhandle_t(*RegisterServerModel)(const char* name);
63 void (*UnregisterServerModel)(qhandle_t model);
64 qhandle_t (*RegisterShader)(const char* name);
65 qhandle_t (*RegisterShaderNoMip)(const char* name);
66 qhandle_t (*RefreshShaderNoMip)(const char* name);
67
68 // EndRegistration will draw a tiny polygon with each texture, forcing
69 // them to be loaded into card memory
70 void (*EndRegistration)();
71 void (*FreeModels)();
72
73 // the vis data is a large enough block of data that we go to the trouble
74 // of sharing it with the clipmodel subsystem
75 void (*SetWorldVisData)( const byte *vis );
76
77 void (*LoadWorld)(const char* name);
78 void (*PrintBSPFileSizes)();
79 int (*MapVersion)();
80
81 // a scene is built up by calls to R_ClearScene and the various R_Add functions.
82 // Nothing is drawn until R_RenderScene is called.
83 void (*ClearScene)(void);
84 void (*AddRefEntityToScene)(const refEntity_t* re, int parentEntityNumber);
85 void (*AddRefSpriteToScene)(const refEntity_t* ent);
86 qboolean (*AddPolyToScene)( qhandle_t hShader , int numVerts, const polyVert_t *verts, int renderfx);
87 void (*AddTerrainMarkToScene)(int terrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx);
88 void (*AddLightToScene)( const vec3_t org, float intensity, float r, float g, float b, int type );
89 void (*RenderScene)( const refdef_t *fd );
90
91 refEntity_t* (*GetRenderEntity)(int entityNumber);
92 void (*SavePerformanceCounters)();
93 void (*SetColor)( const float *rgba ); // NULL = 1,1,1,1
94 void (*Set2DWindow)(int x, int y, int w, int h, float left, float right, float bottom, float top, float n, float f);
95 void (*DrawStretchPic) ( float x, float y, float w, float h,
96 float s1, float t1, float s2, float t2, qhandle_t hShader ); // 0 = white
97
98 void (*DrawTilePic)(float x, float y, float w, float h, qhandle_t hShader);
99 void (*DrawTilePicOffset)(float x, float y, float w, float h, qhandle_t hShader, int offsetX, int offsetY);
100 void (*DrawTrianglePic)(vec2_t* points, vec2_t* texCoords, qhandle_t hShader);
101 void (*DrawBackground)(int cols, int rows, int bgr, uint8_t* data);
102
103 // Draw images for cinematic rendering, pass as 32 bit rgba
104 void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, int components, const byte* data);
105 void (*DebugLine)(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha);
106 void (*DrawBox)(float x, float y, float w, float h);
107 void (*AddBox)(float x, float y, float w, float h);
108
109 void (*BeginFrame)(stereoFrame_t stereoFrame);
110 void (*Scissor)(int x, int y, int width, int height);
111 void (*DrawLineLoop)(const vec2_t* points, int count, int stippleFactor, int stippleMask);
112
113 // if the pointers are not NULL, timing info will be returned
114 void (*EndFrame)( int *frontEndMsec, int *backEndMsec );
115
116
117 int (*MarkFragments)( int numPoints, const vec3_t *points, const vec3_t projection,
118 int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer, float fRadiusSquared);
119 int (*MarkFragmentsForInlineModel)(clipHandle_t bmodel, const vec3_t angles, const vec3_t origin, int numPoints,
120 const vec3_t* points, const vec3_t projection, int maxPoints, vec3_t pointBuffer,
121 int maxFragments, markFragment_t* fragmentBuffer, float radiusSquared);
122
123 void (*GetInlineModelBounds)(int index, vec3_t mins, vec3_t maxs);
124 void (*GetLightingForDecal)(vec3_t light, vec3_t facing, vec3_t origin);
125 void (*GetLightingForSmoke)(vec3_t light, vec3_t origin);
126 int (*R_GatherLightSources)(const vec3_t pos, vec3_t* lightPos, vec3_t* lightIntensity, int maxLights);
127
128 void (*ModelBounds)( qhandle_t model, vec3_t mins, vec3_t maxs );
129 float (*ModelRadius)(qhandle_t handle);
130
131 dtiki_t* (*R_Model_GetHandle)(qhandle_t handle);
132 void (*DrawString)(fontheader_t* font, const char* text, float x, float y, int maxLen, qboolean virtualScreen);
133 float (*GetFontHeight)(const fontheader_t* font);
134 float (*GetFontStringWidth)(const fontheader_t* font, const char* string);
135 fontheader_t* (*LoadFont)(const char* name);
136 void (*SwipeBegin)(float thisTime, float life, qhandle_t hShader);
137 void (*SwipePoint)(vec3_t point1, vec3_t point2, float time);
138 void (*SwipeEnd)();
139 void (*SetRenderTime)(int t);
140 float (*Noise)(float x, float y, float z, float t);
141 qboolean (*SetMode)(int mode, const glconfig_t* glConfig);
142 void (*SetFullscreen)(qboolean fullScreen);
143 int (*GetShaderWidth)(qhandle_t hShader);
144 int (*GetShaderHeight)(qhandle_t hShader);
145 const char* (*GetGraphicsInfo)();
146 void (*ForceUpdatePose)(refEntity_t* model);
147 orientation_t (*TIKI_Orientation)(refEntity_t* model, int tagNum);
148 qboolean (*TIKI_IsOnGround)(refEntity_t* model, int tagNum, float threshold);
149 void (*SetFrameNumber)(int frameNumber);
151
152//
153// these are the functions imported by the refresh module
154//
155typedef struct {
156 // print message on the local console
157 void (QDECL *Printf)( int printLevel, const char *fmt, ...);
158
159 // abort the game
160 void (QDECL *Error)( int errorLevel, const char *fmt, ...);
161
162 // milliseconds should only be used for profiling, never
163 // for anything game related. Get time from the refdef
164 int (*Milliseconds)( void );
165
166 char* (*LV_ConvertString)(char* string);
167 void (*Hunk_Clear)();
168
169 // stack based memory allocation for per-level things that
170 // won't be freed
171#ifdef HUNK_DEBUG
172 void *(*Hunk_AllocDebug)(size_t size, const char *label, const char *file, int line);
173#else
174 void *(*Hunk_Alloc)(size_t size );
175#endif
176 void *(*Hunk_AllocateTempMemory)(size_t size );
177 void (*Hunk_FreeTempMemory)( void *block );
178
179 // dynamic memory allocator for things that need to be freed
180 void *(*Malloc)(size_t bytes );
181 void (*Free)( void *buf );
182 void (*Clear)();
183
184 cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
185 void (*Cvar_Set)( const char *name, const char *value );
186 void (*Cvar_SetDefault)(cvar_t* var, const char* varValue);
187
188 void (*Cmd_AddCommand)( const char *name, xcommand_t command );
189 void (*Cmd_RemoveCommand)( const char *name );
190
191 int (*Cmd_Argc) (void);
192 char *(*Cmd_Argv) (int i);
193
194 void (*Cmd_ExecuteText) (cbufExec_t exec_when, const char *text);
195
196 // visualization for debugging collision detection
197 void (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) );
198
199 // a -1 return means the file does not exist
200 // NULL can be passed for buf to just determine existance
201 int (*FS_OpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
202 size_t (*FS_Read)(void* buffer, size_t len, fileHandle_t fileHandle);
203 void (*FS_CloseFile)(fileHandle_t fileHandle);
204 int (*FS_Seek)(fileHandle_t fileHandle, long offset, int origin);
205 int (*FS_FileIsInPAK)( const char *name, int *pCheckSum );
206 int (*FS_ReadFile)(const char* name, void** buf);
207 int (*FS_ReadFileEx)(const char* qpath, void** buffer, qboolean quiet);
208 void (*FS_FreeFile)( void *buf );
209 char ** (*FS_ListFiles)( const char *name, const char* extension, qboolean wantSubs, int* numFiles);
210 void (*FS_FreeFileList)( char **filelist );
211 int (*FS_WriteFile)( const char *qpath, const void *buffer, int size );
212 qboolean (*FS_FileExists)( const char *file );
213
214 void (*CM_BoxTrace)(trace_t* results, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, int model, int brushMask, int cylinder);
215 int (*CM_TerrainSquareType)(int terrainPatch, int i, int j);
216 char* (*CM_EntityString)();
217 const char* (*CM_MapTime)();
218 int (*CG_PermanentMark)(const vec3_t origin, const vec3_t dir, float orientation, float sScale, float tScale, float red, float green, float blue, float alpha, qboolean doLighting, float sCenter, float tCenter, markFragment_t* markFragments, void* polyVerts);
219 int (*CG_PermanentTreadMarkDecal)(treadMark_t* treadMark, qboolean startSegment, qboolean doLighting, markFragment_t* markFragments, void* polyVerts);
220 int (*CG_PermanentUpdateTreadMark)(treadMark_t* treadMark, float alpha, float minSegment, float maxSegment, float maxOffset, float texScale);
221 void (*CG_ProcessInitCommands)(dtiki_t* tiki, refEntity_t* ent);
222 void (*CG_EndTiki)(dtiki_t* tiki);
223 void (*SetPerformanceCounters)(int totalTris, int totalVerts, int totalTexels, int worldTris, int worldVerts, int characterLights);
224
225 debugline_t** DebugLines;
226 int* numDebugLines;
227 debugstring_t** DebugStrings;
228 int* numDebugStrings;
229
230 orientation_t (*TIKI_OrientationInternal)(dtiki_t* tiki, int entNum, int tagNum, float scale);
231 qboolean(*TIKI_IsOnGroundInternal)(dtiki_t* tiki, int entNum, int tagNum, float thresHold);
232 void (*TIKI_SetPoseInternal)(void* skeletor, const frameInfo_t* frameInfo, const int* boneTag, const vec4_t *boneQuat, float actionWeight);
233 void* (*TIKI_Alloc)(size_t size);
234 float (*GetRadiusInternal)(dtiki_t* tiki, int entNum, float scale);
235 float (*GetCentroidRadiusInternal)(dtiki_t* tiki, int entNum, float scale, vec3_t centroid);
236 void (*GetFrameInternal)(dtiki_t* tiki, int entNum, skelAnimFrame_t* newFrame);
237
239
240
241// this is the only function actually exported at the linker level
242// If the module can't init to a valid rendering state, NULL will be
243// returned.
244refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp );
245
246#ifdef __cplusplus
247}
248#endif
249
250#endif
@ string
string value
Definition json.hpp:2859
Definition q_shared.h:2095
Definition q_shared.h:2105
Definition tiki_shared.h:176
Definition q_shared.h:1493
Definition q_shared.h:1524
Definition tr_types.h:95
Definition tr_public.h:40
Definition tr_public.h:186
Definition skeletor.h:42
Definition q_shared.h:1452