36 #ifdef GL_VERSION_ES_CM_1_0 37 const int texFormat = GL_RGB;
43 Com_Printf(
"R_UploadLightmapPage: MAX_GL_LIGHTMAPS reached.\n");
65 Com_Printf(
"R_UploadLightmapPage: MAX_GL_DELUXEMAPS reached.\n");
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;
343 if (
tr.fraction < frac) {
static void R_UploadLightmapPage(void)
#define CM_TransformedBoxTrace(tile, line, box, headnode, brushmask, brushreject, origin, angles)
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
#define DELUXEMAP_SAMPLE_SIZE
TR_TILE_TYPE mapTiles[MAX_MAPTILES]
void R_EndBuildingLightmaps(void)
local graphics definitions
void Com_Printf(const char *const fmt,...)
void R_CreateSurfaceLightmap(mBspSurface_t *surf)
void Com_Error(int code, const char *fmt,...)
#define MAX_GL_DELUXEMAPS
GLuint deluxemap_texnums[MAX_GL_DELUXEMAPS]
#define Vector4Set(v, r, g, b, a)
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *texels)
memPool_t * vid_lightPool
QGL_EXTERN GLint GLenum GLboolean GLsizei stride
void R_Trace(const Line &trLine, float size, int contentmask)
Moves the given mins/maxs volume through the world from start to end.
void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
#define Mem_PoolAllocTypeN(type, n, pool)
static void R_DisposeLightmaps(void)
static void R_BuildDefaultLightmap(mBspSurface_t *surf, byte *sout, byte *dout, int stride)
Fullbridght lightmap.
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 expand(const float byVal)
expand the box in all directions, but clip them to the maximum boundaries
void glGenTextures(GLsizei n, GLuint *textures)
struct entity_s * traceEntity
void R_BeginBuildingLightmaps(void)
GLuint lightmap_texnums[MAX_GL_LIGHTMAPS]
#define R_BindTexture(tn)
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 LIGHTMAP_SAMPLE_SIZE
int gl_compressed_solid_format
static bool R_AllocLightmapBlock(int w, int h, int *x, int *y)
returns a texture number and the position inside it