Quake II RTX doxygen
1.0 dev
|
|
Go to the source code of this file.
|
static void | adjust_color_f (vec_t *out, const vec_t *in, float modulate) |
|
static void | adjust_color_ub (byte *out, const vec_t *in) |
|
void | GL_AdjustColor (vec3_t color) |
|
static void | add_light_styles (mface_t *surf, int size) |
|
static void | update_dynamic_lightmap (mface_t *surf) |
|
void | GL_PushLights (mface_t *surf) |
|
static void | LM_InitBlock (void) |
|
static void | LM_UploadBlock (void) |
|
static void | build_style_map (int dynamic) |
|
static void | LM_BeginBuilding (void) |
|
static void | LM_EndBuilding (void) |
|
static void | build_primary_lightmap (mface_t *surf) |
|
static void | LM_BuildSurface (mface_t *surf, vec_t *vbo) |
|
static void | LM_RebuildSurfaces (void) |
|
static uint32_t | color_for_surface (mface_t *surf) |
|
static void | build_surface_poly (mface_t *surf, vec_t *vbo) |
|
static void | sample_surface_verts (mface_t *surf, vec_t *vbo) |
|
static void | build_surface_light (mface_t *surf, vec_t *vbo) |
|
static void | normalize_surface_lmtc (mface_t *surf, vec_t *vbo) |
|
static void | duplicate_surface_lmtc (mface_t *surf, vec_t *vbo) |
|
static qboolean | create_surface_vbo (size_t size) |
|
static void | upload_surface_vbo (int lastvert) |
|
static void | upload_world_surfaces (void) |
|
static void | set_world_size (void) |
|
void | GL_RebuildLighting (void) |
|
void | GL_FreeWorld (void) |
|
void | GL_LoadWorld (const char *name) |
|
◆ LM_AllocBlock
◆ MAX_BLOCKLIGHTS
◆ MAX_LIGHTMAP_EXTENTS
◆ MAX_SURFACE_EXTENTS
#define MAX_SURFACE_EXTENTS 2048 |
◆ add_light_styles()
static void add_light_styles |
( |
mface_t * |
surf, |
|
|
int |
size |
|
) |
| |
|
static |
Definition at line 177 of file surf.c.
184 if (!surf->numstyles) {
193 src = surf->lightmap;
195 if (style->white == 1) {
196 for (j = 0; j < size; j++) {
204 for (j = 0; j < size; j++) {
205 bl[0] = src[0] * style->rgb[0];
206 bl[1] = src[1] * style->rgb[1];
207 bl[2] = src[2] * style->rgb[2];
213 surf->stylecache[0] = style->white;
216 for (i = 1; i < surf->numstyles; i++) {
220 for (j = 0; j < size; j++) {
221 bl[0] += src[0] * style->rgb[0];
222 bl[1] += src[1] * style->rgb[1];
223 bl[2] += src[2] * style->rgb[2];
228 surf->stylecache[i] = style->white;
Referenced by build_primary_lightmap(), and update_dynamic_lightmap().
◆ adjust_color_f()
static void adjust_color_f |
( |
vec_t * |
out, |
|
|
const vec_t * |
in, |
|
|
float |
modulate |
|
) |
| |
|
inlinestatic |
◆ adjust_color_ub()
static void adjust_color_ub |
( |
byte * |
out, |
|
|
const vec_t * |
in |
|
) |
| |
|
inlinestatic |
◆ build_primary_lightmap()
static void build_primary_lightmap |
( |
mface_t * |
surf | ) |
|
|
static |
◆ build_style_map()
static void build_style_map |
( |
int |
dynamic | ) |
|
|
static |
◆ build_surface_light()
static void build_surface_light |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
Definition at line 640 of file surf.c.
642 int smax, tmax, size;
652 if (surf->drawflags & SURF_NOLM_MASK)
658 Com_EPrintf(
"%s: bad surface extents\n", __func__);
659 surf->lightmap = NULL;
668 Com_EPrintf(
"%s: MAX_BLOCKLIGHTS exceeded\n", __func__);
669 surf->lightmap = NULL;
675 src = surf->lightmap + surf->numstyles * size * 3;
676 ptr = bsp->lightmap + bsp->numlightmapbytes;
678 Com_EPrintf(
"%s: bad surface lightmap\n", __func__);
679 surf->lightmap = NULL;
Referenced by upload_world_surfaces().
◆ build_surface_poly()
static void build_surface_poly |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
Definition at line 530 of file surf.c.
532 msurfedge_t *src_surfedge;
535 mtexinfo_t *texinfo = surf->texinfo;
536 vec2_t scale, tc, mins, maxs;
537 int i, bmins[2], bmaxs[2];
540 surf->texnum[0] = texinfo->image->texnum;
547 if (!(surf->drawflags & SURF_COLOR_MASK)) {
551 if (surf->drawflags & SURF_WARP) {
555 if (surf->drawflags & SURF_TRANS_MASK) {
557 }
else if (surf->drawflags & SURF_ALPHATEST) {
561 if (surf->drawflags & SURF_FLOWING) {
566 scale[0] = 1.0f / texinfo->image->width;
567 scale[1] = 1.0f / texinfo->image->height;
569 mins[0] = mins[1] = 99999;
570 maxs[0] = maxs[1] = -99999;
572 src_surfedge = surf->firstsurfedge;
573 for (i = 0; i < surf->numsurfedges; i++) {
574 src_edge = src_surfedge->edge;
575 src_vert = src_edge->v[src_surfedge->vert];
579 VectorCopy(src_vert->point, vbo);
585 tc[0] = DotProduct(vbo, texinfo->axis[0]) + texinfo->offset[0];
586 tc[1] = DotProduct(vbo, texinfo->axis[1]) + texinfo->offset[1];
588 if (mins[0] > tc[0]) mins[0] = tc[0];
589 if (maxs[0] < tc[0]) maxs[0] = tc[0];
591 if (mins[1] > tc[1]) mins[1] = tc[1];
592 if (maxs[1] < tc[1]) maxs[1] = tc[1];
594 vbo[4] = tc[0] * scale[0];
595 vbo[5] = tc[1] * scale[1];
605 bmins[0] = floor(mins[0] / 16);
606 bmins[1] = floor(mins[1] / 16);
607 bmaxs[0] = ceil(maxs[0] / 16);
608 bmaxs[1] = ceil(maxs[1] / 16);
610 surf->texturemins[0] = bmins[0] << 4;
611 surf->texturemins[1] = bmins[1] << 4;
613 surf->extents[0] = (bmaxs[0] - bmins[0]) << 4;
614 surf->extents[1] = (bmaxs[1] - bmins[1]) << 4;
Referenced by upload_world_surfaces().
◆ color_for_surface()
static uint32_t color_for_surface |
( |
mface_t * |
surf | ) |
|
|
static |
Definition at line 516 of file surf.c.
518 if (surf->drawflags & SURF_TRANS33)
521 if (surf->drawflags & SURF_TRANS66)
524 if (surf->drawflags & SURF_WARP)
Referenced by build_surface_poly().
◆ create_surface_vbo()
static qboolean create_surface_vbo |
( |
size_t |
size | ) |
|
|
static |
◆ duplicate_surface_lmtc()
static void duplicate_surface_lmtc |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
◆ GL_AdjustColor()
void GL_AdjustColor |
( |
vec3_t |
color | ) |
|
◆ GL_FreeWorld()
◆ GL_LoadWorld()
void GL_LoadWorld |
( |
const char * |
name | ) |
|
Definition at line 876 of file surf.c.
878 char buffer[MAX_QPATH];
889 Com_Error(ERR_DROP,
"%s: couldn't load %s: %s",
895 for (i = 0; i < bsp->numtexinfo; i++) {
898 for (i = 0; i < bsp->numnodes; i++) {
899 bsp->nodes[i].visframe = 0;
901 for (i = 0; i < bsp->numleafs; i++) {
902 bsp->leafs[i].visframe = 0;
904 Com_DPrintf(
"%s: reused old world model\n", __func__);
918 for (i = 0, info = bsp->texinfo; i < bsp->numtexinfo; i++, info++) {
919 if (info->c.flags & SURF_WARP)
920 flags = IF_TURBULENT;
924 Q_concat(buffer,
sizeof(buffer),
"textures/", info->name,
".wal", NULL);
926 info->image =
IMG_Find(buffer, IT_WALL, flags);
931 for (i = 0, surf = bsp->faces; i < bsp->numfaces; i++, surf++) {
933 surf->drawflags |= surf->texinfo->c.flags & ~DSURF_PLANEBACK;
936 if (surf->drawflags & SURF_SKY)
939 size += surf->numsurfedges *
VERTEX_SIZE *
sizeof(vec_t);
944 Com_DPrintf(
"%s: %"PRIz
" bytes of vertex data as VBO\n", __func__, size);
950 Com_DPrintf(
"%s: %"PRIz
" bytes of vertex data on hunk\n", __func__, size);
Referenced by R_BeginRegistration_GL().
◆ GL_PushLights()
void GL_PushLights |
( |
mface_t * |
surf | ) |
|
Definition at line 271 of file surf.c.
276 if (!surf->lightmap) {
279 if (surf->drawflags & SURF_NOLM_MASK) {
282 if (!surf->texnum[1]) {
288 if (surf->dlightframe) {
295 for (i = 0; i < surf->numstyles; i++) {
297 if (style->white != surf->stylecache[i]) {
Referenced by GL_DrawBspModel(), and GL_DrawNode().
◆ GL_RebuildLighting()
◆ LM_BeginBuilding()
◆ LM_BuildSurface()
static void LM_BuildSurface |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
Definition at line 427 of file surf.c.
429 int smax, tmax, s, t;
437 Com_EPrintf(
"%s: LM_MAX_LIGHTMAPS exceeded\n", __func__);
442 Com_EPrintf(
"%s: LM_AllocBlock(%d, %d) failed\n",
443 __func__, smax, tmax);
Referenced by build_surface_light().
◆ LM_EndBuilding()
◆ LM_InitBlock()
◆ LM_RebuildSurfaces()
Definition at line 459 of file surf.c.
474 for (i = 0, surf = bsp->faces; i < bsp->numfaces; i++, surf++) {
475 if (!surf->lightmap) {
478 if (surf->drawflags & SURF_NOLM_MASK) {
481 if (!surf->texnum[1]) {
485 if (surf->texnum[1] != texnum) {
489 GL_RGBA, GL_UNSIGNED_BYTE,
lm.
buffer);
491 texnum = surf->texnum[1];
502 GL_RGBA, GL_UNSIGNED_BYTE,
lm.
buffer);
Referenced by GL_RebuildLighting().
◆ LM_UploadBlock()
◆ normalize_surface_lmtc()
static void normalize_surface_lmtc |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
Definition at line 690 of file surf.c.
695 s = ((surf->light_s << 4) + 8) - surf->texturemins[0];
696 t = ((surf->light_t << 4) + 8) - surf->texturemins[1];
698 for (i = 0; i < surf->numsurfedges; i++) {
Referenced by upload_world_surfaces().
◆ sample_surface_verts()
static void sample_surface_verts |
( |
mface_t * |
surf, |
|
|
vec_t * |
vbo |
|
) |
| |
|
static |
◆ set_world_size()
Definition at line 815 of file surf.c.
821 for (i = 0, size = 0; i < 3; i++) {
822 temp = node->maxs[i] - node->mins[i];
829 else if (size > 2048)
Referenced by GL_LoadWorld().
◆ update_dynamic_lightmap()
static void update_dynamic_lightmap |
( |
mface_t * |
surf | ) |
|
|
static |
Definition at line 232 of file surf.c.
235 int smax, tmax, size, i;
247 if (surf->dlightframe ==
glr.dlightframe) {
248 add_dynamic_lights(surf);
250 surf->dlightframe = 0;
257 for (i = 0; i < size; i++) {
265 surf->light_s, surf->light_t, smax, tmax,
266 GL_RGBA, GL_UNSIGNED_BYTE, temp);
Referenced by GL_PushLights().
◆ upload_surface_vbo()
static void upload_surface_vbo |
( |
int |
lastvert | ) |
|
|
static |
Definition at line 749 of file surf.c.
751 GLintptrARB offset = lastvert *
VERTEX_SIZE *
sizeof(vec_t);
754 Com_DDPrintf(
"%s: %"PRIz
" bytes at %"PRIz
"\n", __func__, size, offset);
Referenced by upload_world_surfaces().
◆ upload_world_surfaces()
static void upload_world_surfaces |
( |
void |
| ) |
|
|
static |
Definition at line 760 of file surf.c.
765 int i, currvert, lastvert;
776 for (i = 0, surf = bsp->faces; i < bsp->numfaces; i++, surf++) {
777 if (surf->drawflags & SURF_SKY)
793 surf->firstvert = currvert;
802 currvert += surf->numsurfedges;
Referenced by GL_LoadWorld(), and GL_RebuildLighting().
◆ blocklights
◆ lm
Definition at line 25 of file surf.c.
Referenced by adjust_color_f(), adjust_color_ub(), build_primary_lightmap(), GL_BindArrays(), GL_InitImages(), gl_lightmap_changed(), GL_ShutdownImages(), LM_BeginBuilding(), LM_BuildSurface(), LM_EndBuilding(), LM_InitBlock(), LM_RebuildSurfaces(), LM_UploadBlock(), and R_RenderFrame_GL().
cvar_t * Cvar_Set(const char *var_name, const char *value)
PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB
static void sample_surface_verts(mface_t *surf, vec_t *vbo)
PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB
static void LM_RebuildSurfaces(void)
void Hunk_Begin(memhunk_t *hunk, size_t maxsize)
const char * Q_ErrorString(qerror_t error)
static void adjust_color_f(vec_t *out, const vec_t *in, float modulate)
static void normalize_surface_lmtc(mface_t *surf, vec_t *vbo)
void * Hunk_Alloc(memhunk_t *hunk, size_t size)
byte lightstylemap[MAX_LIGHTSTYLES]
static qboolean create_surface_vbo(size_t size)
byte buffer[LM_BLOCK_WIDTH *LM_BLOCK_HEIGHT *4]
PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB
int inuse[LM_BLOCK_WIDTH]
uint32_t inverse_intensity_100
static float blocklights[MAX_BLOCKLIGHTS *3]
void Hunk_Free(memhunk_t *hunk)
PFNGLBUFFERDATAARBPROC qglBufferDataARB
#define TESS_MAX_VERTICES
static void LM_EndBuilding(void)
PFNGLGENBUFFERSARBPROC qglGenBuffersARB
void Com_Error(error_type_t type, const char *fmt,...)
void BSP_Free(bsp_t *bsp)
void QGL_ClearErrors(void)
static void build_surface_poly(mface_t *surf, vec_t *vbo)
struct glStatic_t::@11 world
#define MAX_SURFACE_EXTENTS
static uint32_t color_for_surface(mface_t *surf)
void Hunk_End(memhunk_t *hunk)
void GL_SampleLightPoint(vec3_t color)
static void add_light_styles(mface_t *surf, int size)
static void LM_InitBlock(void)
static void build_surface_light(mface_t *surf, vec_t *vbo)
static void upload_world_surfaces(void)
static void adjust_color_ub(byte *out, const vec_t *in)
PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB
void GL_ForceTexture(GLuint tmu, GLuint texnum)
image_t * IMG_Find(const char *name, imagetype_t type, imageflags_t flags)
static void LM_UploadBlock(void)
#define LM_AllocBlock(w, h, s, t)
int registration_sequence
static void LM_BeginBuilding(void)
static void build_style_map(int dynamic)
static void upload_surface_vbo(int lastvert)
PFNGLBINDBUFFERARBPROC qglBindBufferARB
uint32_t inverse_intensity_33
#define LIGHT_STYLE(surf, i)
GLuint texnums[LM_MAX_LIGHTMAPS]
qerror_t BSP_Load(const char *name, bsp_t **bsp_p)
static void update_dynamic_lightmap(mface_t *surf)
size_t Q_concat(char *dest, size_t size,...)
GLfloat vertices[VERTEX_SIZE *TESS_MAX_VERTICES]
CONST PIXELFORMATDESCRIPTOR int
static void build_primary_lightmap(mface_t *surf)
static void duplicate_surface_lmtc(mface_t *surf, vec_t *vbo)
uint32_t inverse_intensity_66
qboolean GL_ShowErrors(const char *func)
size_t FS_NormalizePath(char *out, const char *in)
static void set_world_size(void)
static void LM_BuildSurface(mface_t *surf, vec_t *vbo)