21typedef struct suffixinfo_s
24 qbool flipx, flipy, flipdiagonal;
30 {
"px",
false,
false,
false},
31 {
"nx",
false,
false,
false},
32 {
"py",
false,
false,
false},
33 {
"ny",
false,
false,
false},
34 {
"pz",
false,
false,
false},
35 {
"nz",
false,
false,
false}
38 {
"posx",
false,
false,
false},
39 {
"negx",
false,
false,
false},
40 {
"posy",
false,
false,
false},
41 {
"negy",
false,
false,
false},
42 {
"posz",
false,
false,
false},
43 {
"negz",
false,
false,
false}
46 {
"rt",
false,
false,
true},
47 {
"lf",
true,
true,
true},
48 {
"bk",
false,
true,
false},
49 {
"ft",
true,
false,
false},
50 {
"up",
false,
false,
true},
51 {
"dn",
false,
false,
true}
103 unsigned char *image_buffer;
130 skyboxskinframe[
i] =
R_SkinFrame_LoadInternalBGRA(
va(vabuf,
sizeof(vabuf),
"skyboxside%d",
i),
TEXF_CLAMP | (
gl_texturecompression_sky.
integer ?
TEXF_COMPRESS : 0), temp,
image_width,
image_height, 0, 0, 0,
vid.
sRGB3D);
308 RSurf_ActiveCustomEntity(&
skymatrix, &
skyinversematrix, 0, 0, 1, 1, 1, 1, 6*4,
skyboxvertex3f,
skyboxtexcoord2f,
NULL,
NULL,
NULL,
NULL, 6*2,
skyboxelement3i,
skyboxelement3s,
false,
false);
309 for (
i = 0;
i < 6;
i++)
315#define skygridx1 (skygridx + 1)
316#define skygridxrecip (1.0f / (skygridx))
318#define skygridy1 (skygridy + 1)
319#define skygridyrecip (1.0f / (skygridy))
320#define skysphere_numverts (skygridx1 * skygridy1)
321#define skysphere_numtriangles (skygridx * skygridy * 2)
331 float a,
b,
x, ax, ay,
v[3],
length, *vertex3f, *texcoord2f;
379 static qbool skysphereinitialized =
false;
381 if (!skysphereinitialized)
383 skysphereinitialized =
true;
391 speedscale -=
floor(speedscale);
395 speedscale -=
floor(speedscale);
398 RSurf_ActiveCustomEntity(&
skymatrix, &
skyinversematrix, 0, 0, 1, 1, 1, 1,
skysphere_numverts,
skysphere_vertex3f,
skysphere_texcoord2f,
NULL,
NULL,
NULL,
NULL,
skysphere_numtriangles,
skysphere_element3i,
skysphere_element3s,
false,
false);
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
char * va(char *buf, size_t buflen, const char *format,...)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
void GL_Scissor(int x, int y, int width, int height)
void GL_ScissorTest(int state)
void R_DrawCustomSurface(skinframe_t *skinframe, const matrix4x4_t *texmatrix, int materialflags, int firstvertex, int numvertices, int firsttriangle, int numtriangles, qbool writedepth, qbool prepass, qbool ui)
skinframe_t * R_SkinFrame_LoadInternalBGRA(const char *name, int textureflags, const unsigned char *skindata, int width, int height, int comparewidth, int compareheight, int comparecrc, qbool sRGB)
void R_SkinFrame_PurgeSkinFrame(skinframe_t *s)
static suffixinfo_t suffix[3][6]
void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inversematrix, int entflags, double shadertime, float r, float g, float b, float a, int numvertices, const float *vertex3f, const float *texcoord2f, const float *normal3f, const float *svector3f, const float *tvector3f, const float *color4f, int numtriangles, const int *element3i, const unsigned short *element3s, qbool wantnormals, qbool wanttangents)
void R_FreeTexturePool(rtexturepool_t **rtexturepool)
cvar_t gl_texturecompression_sky
rtexturepool_t * R_AllocTexturePool(void)
GLenum GLuint GLenum GLsizei length
GLsizei GLenum const GLvoid * indices
void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qbool inputflipx, qbool inputflipy, qbool inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices)
unsigned char * loadimagepixelsbgra(const char *filename, qbool complain, qbool allowFixtrans, qbool convertsRGB, int *miplevel)
void Matrix4x4_CreateTranslate(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
const matrix4x4_t identitymatrix
#define MATERIALFLAG_FULLBRIGHT
#define MATERIALFLAG_ALPHA
#define MATERIALFLAG_BLENDED
#define MATERIALFLAG_NODEPTHTEST
#define MATERIALFLAG_NOCULLFACE
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
#define MAX_QPATH
max length of a quake game pathname
void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
static rtexturepool_t * skytexturepool
static skinframe_t * skyboxskinframe[6]
static char skyname[MAX_QPATH]
static void r_sky_newmap(void)
static float skysphere_texcoord2f[skysphere_numverts *2]
static matrix4x4_t skymatrix
static void R_SkyBox(void)
static const suffixinfo_t suffix[3][6]
static const float skyboxvertex3f[6 *4 *3]
static const float skyboxtexcoord2f[6 *4 *2]
#define skysphere_numtriangles
static void skyspherecalc(void)
static matrix4x4_t skyinversematrix
#define skysphere_numverts
static int skyrendersphere
static const unsigned short skyboxelement3s[6 *2 *3]
static unsigned short skysphere_element3s[skysphere_numtriangles *3]
static void r_sky_shutdown(void)
static float skysphere_vertex3f[skysphere_numverts *3]
static void R_SkySphere(void)
static void r_sky_start(void)
static const int skyboxelement3i[6 *2 *3]
static void R_UnloadSkyBox(void)
static int R_LoadSkyBox(void)
static int skysphere_element3i[skysphere_numtriangles *3]
void R_SkyStartFrame(void)
int R_SetSkyBox(const char *sky)
static void LoadSky_f(cmd_state_t *cmd)
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
struct skinframe_s * alphaskyskinframe
struct skinframe_s * solidskyskinframe
model_t * worldmodel
same as worldentity->model
double time
(client gameworld) time for rendering time based effects
r_viewport_t viewport
note: if r_viewscale is used, the viewport.width and viewport.height may be less than width and heigh...
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
viddef_t vid
global video state
#define Mem_Alloc(pool, size)