36#ifdef GL_VERSION_ES_CM_1_0
37 const int texFormat = GL_RGB;
39 const int texFormat =
r_config.gl_compressed_solid_format ?
r_config.gl_compressed_solid_format :
r_config.gl_solid_format;
43 Com_Printf(
"R_UploadLightmapPage: MAX_GL_LIGHTMAPS reached.\n");
60 0, GL_RGB, GL_UNSIGNED_BYTE,
r_lightmaps.sample_buffer);
65 Com_Printf(
"R_UploadLightmapPage: MAX_GL_DELUXEMAPS reached.\n");
82 0, GL_RGB, GL_UNSIGNED_BYTE,
r_lightmaps.direction_buffer);
112 for (j = 0; j < w; j++) {
128 for (
i = 0;
i < w;
i++)
146 for (
int t = 0; t < tmax; t++) {
147 byte* lmPtr = sout, *dmPtr = dout;
148 for (
int s = 0; s < smax; s++) {
150 l[0] = lmPtr[0] = 255;
151 l[1] = lmPtr[1] = 255;
152 l[2] = lmPtr[2] = 255;
178 const int area = smax * tmax;
180 int color[3] = {0, 0, 0};
186 for (
int t = 0; t < tmax; t++) {
187 byte* lmPtr = sout, *dmPtr = dout;
188 for (
int s = 0; s < smax; s++) {
190 color[0] += l[0] = lmPtr[0] = src[0];
191 color[1] += l[1] = lmPtr[1] = src[1];
192 color[2] += l[2] = lmPtr[2] = src[2];
208 surf->
lightColor[0] = color[0] / (255.0 * area);
209 surf->
lightColor[1] = color[1] / (255.0 * area);
210 surf->
lightColor[2] = color[2] / (255.0 * area);
226 byte* samples, *directions;
238 Com_Error(
ERR_DROP,
"R_CreateSurfaceLightmap: Consecutive calls to R_AllocLightmapBlock(%d,%d) failed (lightmap_scale: %i, stextents: %f %f)\n",
275 static bool gotAllocatedLightmaps =
false;
277 if (gotAllocatedLightmaps)
280 gotAllocatedLightmaps =
true;
328 refdef.traceEntity =
nullptr;
330 float frac =
refdef.trace.fraction;
333 for (
int i = 0;
i <
refdef.numEntities;
i++) {
343 if (
tr.fraction < frac) {
351 assert(
refdef.trace.mapTile >= 0);
memPool_t * vid_lightPool
void expand(const float byVal)
expand the box in all directions, but clip them to the maximum boundaries
trace_t CM_CompleteBoxTrace(mapTiles_t *mapTiles, const Line &trLine, const AABB &box, int levelmask, int brushmask, int brushreject)
Traces all submodels in all tiles. Used by ufo and ufo_ded.
#define CM_TransformedBoxTrace(tile, line, box, headnode, brushmask, brushreject, origin, angles)
void Com_Error(int code, const char *fmt,...)
void Com_Printf(const char *const fmt,...)
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *texels)
void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
void glGenTextures(GLsizei n, GLuint *textures)
#define Mem_PoolAllocTypeN(type, n, pool)
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
QGL_EXTERN GLint GLenum GLboolean GLsizei stride
#define MAX_GL_DELUXEMAPS
static void R_BuildLightmap(mBspSurface_t *surf, byte *sout, byte *dout, int stride)
Consume raw lightmap and deluxemap RGB/XYZ data from the surface samples, and write them into the str...
void R_BeginBuildingLightmaps(void)
static void R_DisposeLightmaps(void)
void R_CreateSurfaceLightmap(mBspSurface_t *surf)
static bool R_AllocLightmapBlock(int w, int h, int *x, int *y)
returns a texture number and the position inside it
void R_Trace(const Line &trLine, float size, int contentmask)
Moves the given mins/maxs volume through the world from start to end.
void R_EndBuildingLightmaps(void)
static void R_UploadLightmapPage(void)
static void R_BuildDefaultLightmap(mBspSurface_t *surf, byte *sout, byte *dout, int stride)
Fullbridght lightmap.
#define LIGHTMAP_SAMPLE_SIZE
#define DELUXEMAP_SAMPLE_SIZE
local graphics definitions
#define R_BindTexture(tn)
#define Vector4Set(v, r, g, b, a)