Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
48 cvar_t *gl_dlight_falloff;
94 angle = DEG2RAD(
glr.
fd.fov_x / 2);
105 angle = DEG2RAD(
glr.
fd.fov_y / 2);
116 p->dist = DotProduct(
glr.
fd.vieworg, p->normal);
117 p->type = PLANE_NON_AXIAL;
132 for (i = 0; i < 4; i++) {
134 if (bits == BOX_BEHIND) {
137 if (bits != BOX_INFRONT) {
158 dist = PlaneDiff(
origin, p);
159 if (dist < -radius) {
162 if (dist <= radius) {
176 for (i = 0; i < 8; i++) {
177 VectorCopy(
origin, points[i]);
178 VectorMA(points[i], bounds[(i >> 0) & 1][0],
glr.
entaxis[0], points[i]);
179 VectorMA(points[i], bounds[(i >> 1) & 1][1],
glr.
entaxis[1], points[i]);
180 VectorMA(points[i], bounds[(i >> 2) & 1][2],
glr.
entaxis[2], points[i]);
203 for (j = 0; j < 8; j++) {
204 dot = DotProduct(points[j], p->normal);
205 if (dot >= p->dist) {
226 void GL_DrawBox(
const vec3_t
origin, vec3_t bounds[2])
228 static const int indices1[4] = { 0, 1, 3, 2 };
229 static const int indices2[4] = { 4, 5, 7, 6 };
230 static const int indices3[8] = { 0, 4, 1, 5, 2, 6, 3, 7 };
253 int w,
int h,
int *s,
int *t)
255 int i, j, k, x, y, max_inuse, min_inuse;
259 for (i = 0; i <
width - w; i++) {
261 for (j = 0; j < w; j++) {
263 if (k >= min_inuse) {
272 y = min_inuse = max_inuse;
280 for (i = 0; i < w; i++) {
281 inuse[x + i] = y + h;
294 for (i = 0; i < 4; i++) {
295 for (j = 0; j < 4; j++) {
297 a[0 * 4 + j] * b[i * 4 + 0] +
298 a[1 * 4 + j] * b[i * 4 + 1] +
299 a[2 * 4 + j] * b[i * 4 + 2] +
300 a[3 * 4 + j] * b[i * 4 + 3];
338 static const vec_t tcoords[8] = { 0, 1, 0, 0, 1, 1, 1, 0 };
340 mspriteframe_t *frame = &model->spriteframes[e->frame % model->numframes];
342 float alpha = (e->flags & RF_TRANSLUCENT) ? e->alpha : 1;
347 const vec3_t world_y = { 0.f, 0.f, 1.f };
350 if (image->flags & IF_TRANSPARENT) {
351 if (image->flags & IF_PALETTED) {
367 VectorScale(
glr.
viewaxis[1], frame->origin_x, left);
370 if (model->sprite_vertical)
372 VectorScale(world_y, -frame->origin_y, down);
373 VectorScale(world_y, frame->height - frame->origin_y,
up);
377 VectorScale(
glr.
viewaxis[2], -frame->origin_y, down);
378 VectorScale(
glr.
viewaxis[2], frame->height - frame->origin_y,
up);
381 VectorAdd3(e->origin, down, left, points[0]);
382 VectorAdd3(e->origin,
up, left, points[1]);
383 VectorAdd3(e->origin, down,
right, points[2]);
384 VectorAdd3(e->origin,
up,
right, points[3]);
393 static const uint32_t colors[6] = {
395 U32_GREEN, U32_GREEN,
401 VectorCopy(e->origin, points[0]);
402 VectorCopy(e->origin, points[2]);
403 VectorCopy(e->origin, points[4]);
405 VectorMA(e->origin, 16,
glr.
entaxis[0], points[1]);
406 VectorMA(e->origin, 16,
glr.
entaxis[1], points[3]);
407 VectorMA(e->origin, 16,
glr.
entaxis[2], points[5]);
420 entity_t *ent, *last;
428 for (ent =
glr.
fd.entities; ent != last; ent++) {
429 if (ent->flags & RF_BEAM) {
434 if ((ent->flags & RF_TRANSLUCENT) != mask) {
441 if (VectorEmpty(ent->angles)) {
452 if (ent->model & 0x80000000) {
454 int index = ~ent->model;
456 if (
glr.
fd.rdflags & RDF_NOWORLDMODEL) {
457 Com_Error(ERR_DROP,
"%s: inline model without world",
461 if (index < 1 || index >= bsp->nummodels) {
462 Com_Error(ERR_DROP,
"%s: inline model %d out of range",
476 switch (model->type) {
486 Com_Error(ERR_FATAL,
"%s: bad model type", __func__);
516 #define E(x) case GL_##x: str = "GL_"#x; break;
524 default: str =
"UNKNOWN ERROR";
543 if (
err == GL_NO_ERROR) {
561 Com_Error(ERR_FATAL,
"%s: NULL worldmodel", __func__);
571 glr.
fd.num_dlights = 0;
598 if (!(
glr.
fd.rdflags & RDF_NOWORLDMODEL)) {
621 if (gl_log->integer) {
622 QGL_LogComment(
"\n*** R_BeginFrame ***\n");
626 memset(&
c, 0,
sizeof(
c));
644 if (gl_showstats->integer) {
648 if (gl_showscrap->integer) {
668 if (gl_log->modified) {
673 gl_log->modified = qfalse;
685 Com_Printf(
"GL_RENDERER: %s\n",
qglGetString(GL_RENDERER));
686 Com_Printf(
"GL_VERSION: %s\n",
qglGetString(GL_VERSION));
687 Com_Printf(
"GL_EXTENSIONS: %s\n",
qglGetString(GL_EXTENSIONS));
691 Com_Printf(
"GL_PFD: color(%d-bit) Z(%d-bit) stencil(%d-bit)\n",
754 gl_dlight_falloff =
Cvar_Get(
"gl_dlight_falloff",
"1", 0);
774 gl_log =
Cvar_Get(
"gl_log",
"0", CVAR_CHEAT);
775 gl_showstats =
Cvar_Get(
"gl_showstats",
"0", 0);
776 gl_showscrap =
Cvar_Get(
"gl_showscrap",
"0", 0);
777 gl_nobind =
Cvar_Get(
"gl_nobind",
"0", CVAR_CHEAT);
778 gl_test =
Cvar_Get(
"gl_test",
"0", 0);
810 const char *version, *extensions;
817 if (!version || !*version) {
818 Com_EPrintf(
"OpenGL returned NULL version string\n");
823 if (!strncmp(version,
"OpenGL ES", 9)) {
825 if (version[0] ==
'-' && version[1] && version[2] && version[3] ==
' ') {
827 }
else if (version[0] ==
' ') {
830 Com_EPrintf(
"OpenGL returned invalid version string\n");
847 Com_EPrintf(
"OpenGL returned invalid version string\n");
853 Com_EPrintf(
"OpenGL version 1.1 or higher required\n");
858 p =
Cvar_Get(
"gl_versionoverride",
"", CVAR_REFRESH)->string;
874 Com_Printf(
"...enabling GL_EXT_compiled_vertex_array\n");
877 Com_Printf(
"GL_EXT_compiled_vertex_array not found\n");
884 Com_Printf(
"...enabling GL_ARB_multitexture (%d TMUs)\n", integer);
891 Com_Printf(
"...ignoring GL_ARB_multitexture,\n"
892 "%d TMU is not enough\n", integer);
895 Com_Printf(
"GL_ARB_multitexture not found\n");
900 qglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &value);
902 Com_Printf(
"...enabling GL_EXT_texture_filter_anisotropic (%.f max)\n", value);
906 Com_Printf(
"...ignoring GL_EXT_texture_filter_anisotropic,\n"
907 "%.f anisotropy is not enough\n", value);
910 Com_Printf(
"GL_EXT_texture_filter_anisotropic not found\n");
921 Com_EPrintf(
"OpenGL reports invalid maximum texture size\n");
925 if (integer & (integer - 1)) {
926 integer = npot32(integer) >> 1;
929 if (integer > MAX_TEXTURE_SIZE) {
930 integer = MAX_TEXTURE_SIZE;
959 for (i = 0; i < NUMVERTEXNORMALS; i++) {
962 lng = atan2(v[1], v[0]);
967 for (i = 0; i < 256; i++) {
980 Com_Printf(
"...enabling GL_ARB_vertex_buffer_object\n");
984 Com_Printf(
"...ignoring GL_ARB_vertex_buffer_object\n");
987 Com_Printf(
"GL_ARB_vertex_buffer_object not found\n");
988 Cvar_Set(
"gl_vertex_buffer_object",
"0");
1009 Com_DPrintf(
"GL_Init( %i )\n", total);
1016 Com_Printf(
"------- R_Init -------\n");
1017 Com_DPrintf(
"ref_gl " VERSION_STRING
", " __DATE__
"\n");
1039 if (gl_log->integer) {
1042 gl_log->modified = qfalse;
1052 Com_Printf(
"----------------------\n");
1070 Com_DPrintf(
"GL_Shutdown( %i )\n", total);
1107 char fullname[MAX_QPATH];
1112 memset(&
glr, 0,
sizeof(
glr));
1115 Q_concat(fullname,
sizeof(fullname),
"maps/", name,
".bsp", NULL);
byte * IMG_ReadPixels(int *width, int *height, int *rowbytes)
void(* R_TileClear)(int x, int y, int w, int h, qhandle_t pic)
void(* MOD_Reference)(model_t *model)
#define QGL_3_0_core_functions
void(* R_EndRegistration)(void)
cvar_t * Cvar_Set(const char *var_name, const char *value)
void R_SetAlphaScale_GL(float alpha)
void(* R_SetColor)(uint32_t color)
qboolean(* R_InterceptKey)(unsigned key, qboolean down)
cvar_t * gl_fragment_program
void GL_RotateForEntity(vec3_t origin, float scale)
void R_SetClipRect_GL(const clipRect_t *clip)
void GL_InitPrograms(void)
cvar_t * gl_modulate_world
void(* R_SetSky)(const char *name, float rotate, vec3_t axis)
void(* R_SetAlpha)(float clpha)
void R_RenderFrame_GL(refdef_t *fd)
static void GL_DrawTearing(void)
glCullResult_t GL_CullBox(vec3_t bounds[2])
model_t * MOD_ForHandle(qhandle_t h)
void Cmd_AddCommand(const char *name, xcommand_t function)
qerror_t MOD_LoadMD3_GL(model_t *model, const void *rawdata, size_t length)
void(* IMG_Load)(image_t *image, byte *pic)
static const char * GL_ErrorString(GLenum err)
void R_ModeChanged_GL(int width, int height, int flags, int rowbytes, void *pixels)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
void R_BeginRegistration_GL(const char *name)
glCullResult_t GL_CullLocalBox(const vec3_t origin, vec3_t bounds[2])
void IMG_Load_GL(image_t *image, byte *pic)
void(* R_ClearColor)(void)
void MOD_Reference_GL(model_t *model)
void(* R_LightPoint)(vec3_t origin, vec3_t light)
void GL_DrawParticles(void)
void R_ClearColor_GL(void)
static void GL_SetupFrustum(void)
void R_SetScale_GL(float scale)
#define qglDisableClientState
static void GL_Register(void)
static void make_box_points(const vec3_t origin, vec3_t bounds[2], vec3_t points[8])
void GL_BindTexture(GLuint tmu, GLuint texnum)
void R_BeginFrame_GL(void)
int R_DrawString_GL(int x, int y, int flags, size_t maxlen, const char *s, qhandle_t font)
void(* R_DrawFill8)(int x, int y, int w, int h, int c)
void GL_ShutdownPrograms(void)
void R_Shutdown(qboolean total)
void R_SetSky_GL(const char *name, float rotate, vec3_t axis)
void R_DrawPic_GL(int x, int y, qhandle_t pic)
qboolean infront(edict_t *self, edict_t *other)
static size_t GL_ViewCluster_m(char *buffer, size_t size)
static void gl_lightmap_changed(cvar_t *self)
void GL_DrawAlphaFaces(void)
static void GL_Strings_f(void)
cvar_t * gl_coloredlightmaps
static void GL_DrawNullModel(void)
void R_Shutdown_GL(qboolean total)
void MOD_FreeUnused(void)
void(* R_SetAlphaScale)(float alpha)
void R_DrawFill32_GL(int x, int y, int w, int h, uint32_t color)
static void GL_Unregister(void)
static void gl_modulate_entities_changed(cvar_t *self)
qerror_t MOD_LoadMD2_GL(model_t *model, const void *rawdata, size_t length)
qboolean R_Init(qboolean total)
void R_DrawChar_GL(int x, int y, int flags, int c, qhandle_t font)
static qboolean GL_SetupConfig(void)
void GL_ArrayBits(glArrayBits_t bits)
void Com_Error(error_type_t type, const char *fmt,...)
void Cmd_RemoveCommand(const char *name)
#define AT_LEAST_OPENGL_ES(major, minor)
cvar_t * gl_modulate_entities
qerror_t(* MOD_LoadMD2)(model_t *model, const void *rawdata, size_t length)
#define AT_LEAST_OPENGL(major, minor)
struct glStatic_t::@11 world
float Cvar_ClampValue(cvar_t *var, float min, float max)
cplane_t frustumPlanes[4]
void GL_MultMatrix(GLfloat *p, const GLfloat *a, const GLfloat *b)
void GL_RebuildLighting(void)
byte latlngtab[NUMVERTEXNORMALS][2]
void(* R_DrawPic)(int x, int y, qhandle_t pic)
static void GL_ColorBytePointer(GLint size, GLsizei stride, const GLubyte *pointer)
cvar_t * gl_vertex_buffer_object
void R_SetAlpha_GL(float alpha)
cvar_t * gl_doublelight_entities
void R_RenderFrame(refdef_t *fd)
static void gl_drawsky_changed(cvar_t *self)
static void GL_TexCoordPointer(GLint size, GLsizei stride, const GLfloat *pointer)
int(* R_DrawString)(int x, int y, int flags, size_t maxChars, const char *string, qhandle_t font)
void GL_DrawBspModel(mmodel_t *model)
qboolean GL_ShowErrors(const char *func)
void R_EndRegistration_GL(void)
#define qglEnableClientState
void QGL_ShutdownExtensions(unsigned mask)
void SetPlaneSignbits(cplane_t *plane)
void R_AddDecal(decal_t *d)
void(* R_DrawFill32)(int x, int y, int w, int h, uint32_t color)
void(* IMG_Unload)(image_t *image)
qboolean R_Init_GL(qboolean total)
void R_DrawStretchPic_GL(int x, int y, int w, int h, qhandle_t pic)
#define QGL_ARB_vertex_buffer_object
qboolean R_InterceptKey_GL(unsigned key, qboolean down)
void R_ModeChanged(int width, int height, int flags, int rowbytes, void *pixels)
void R_SetColor_GL(uint32_t color)
int registration_sequence
static void GL_VertexPointer(GLint size, GLsizei stride, const GLfloat *pointer)
void GL_ShutdownImages(void)
void GL_SetDefaultState(void)
void QGL_InitExtensions(unsigned mask)
void(* R_BeginRegistration)(const char *map)
static void GL_LoadMatrix(const GLfloat *matrix)
void(* R_SetClipRect)(const clipRect_t *clip)
void(* R_DrawStretchPic)(int x, int y, int w, int h, qhandle_t pic)
#define QGL_ARB_multitexture
unsigned QGL_ParseExtensionString(const char *s)
void R_AddDecal_GL(decal_t *d)
void(* R_SetScale)(float scale)
void R_DrawFill8_GL(int x, int y, int w, int h, int c)
glCullResult_t GL_CullSphere(const vec3_t origin, float radius)
static void gl_novis_changed(cvar_t *self)
void R_LightPoint_GL(vec3_t origin, vec3_t color)
#define QGL_EXT_texture_filter_anisotropic
void(* R_DrawChar)(int x, int y, int flags, int ch, qhandle_t font)
void Cmd_AddMacro(const char *name, xmacro_t function)
void IMG_FreeUnused(void)
size_t Q_concat(char *dest, size_t size,...)
const GLfloat * currentmatrix
void GL_LoadWorld(const char *name)
static void GL_PostInit(void)
const vec3_t bytedirs[NUMVERTEXNORMALS]
void IMG_Unload_GL(image_t *image)
byte * IMG_ReadPixels_GL(int *width, int *height, int *rowbytes)
qboolean GL_AllocBlock(int width, int height, int *inuse, int w, int h, int *s, int *t)
void GL_StateBits(glStateBits_t bits)
void QGL_ClearErrors(void)
static void GL_DrawSpriteModel(model_t *model)
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
void R_TileClear_GL(int x, int y, int w, int h, qhandle_t pic)
void GL_DrawAliasModel(model_t *model)
static void gl_modulate_changed(cvar_t *self)
static void GL_InitTables(void)
void R_RegisterFunctionsGL()
int BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, cplane_t *p)
#define QGL_EXT_compiled_vertex_array
static void GL_DrawEntities(int mask)