27 #include "../../shared/images.h"
55 for (j = 0; j <
i; j++) {
73 texels = surf->w * surf->h;
74 color[0] = color[1] = color[2] = 0;
76 for(j = 0; j < texels; j++){
77 const byte* pos = (
byte*)surf->pixels + j * 4;
85 SDL_FreeSurface(surf);
87 for(j = 0; j < 3; j++){
88 const float r = color[j] / texels / 255.0;
152 face_patches[fn] = patch;
172 if (patch->
area < 1.0)
210 for (
int j = 0; j < mod->
numfaces; j++) {
236 #define PATCH_SUBDIVIDE 64
246 if (patch->
area < 1.0)
251 if (newp->
area < 1.0)
280 for (i = 0; i < 3; i++) {
dBspEdge_t edges[MAX_MAP_EDGES]
#define VectorCopy(src, dest)
#define VectorSet(v, x, y, z)
void WindingBounds(const winding_t *w, vec3_t mins, vec3_t maxs)
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb)
static void EmissiveLight(patch_t *patch)
Check for light emitted by texture.
void FreePatches(void)
After light sources have been created, patches may be freed.
static entity_t * EntityForModel(int modnum)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
dBspModel_t models[MAX_MAP_MODELS]
#define VectorNegate(src, dest)
entity_t entities[MAX_MAP_ENTITIES]
#define VectorScale(in, scale, out)
void RemoveColinearPoints(winding_t *w)
static winding_t * WindingFromFace(const dBspSurface_t *f)
dBspTexinfo_t texinfo[MAX_MAP_TEXINFO]
void CalcTextureReflectivity(void)
Calculates the texture color that is used for light emitting surfaces.
static void FinishSubdividePatch(patch_t *patch, patch_t *newp)
void GetVectorForKey(const entity_t *ent, const char *key, vec3_t vec)
Converts the value of a entity parameter into a vec3_t.
dBspSurface_t faces[MAX_MAP_FACES]
winding_t * AllocWinding(int points)
Allocate a new winding (polygon)
void ClipWindingEpsilon(const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
void BuildPatches(void)
Create surface fragments for light-emitting surfaces so that light sources may be computed along them...
void WindingCenter(const winding_t *w, vec3_t center)
dBspPlane_t planes[MAX_MAP_PLANES]
SDL_Surface * Img_LoadImage(char const *name)
Loads the specified image from the game filesystem and populates the provided SDL_Surface.
for storing the vertices of the side of a brush or other polygon
static void BuildPatch(int fn, winding_t *w)
Build a patch for a surface that emits light.
static bool HasLight(const dBspSurface_t *f)
#define VectorAdd(a, b, dest)
vec_t WindingArea(const winding_t *w)
vec3_t face_offset[MAX_MAP_FACES]
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
int surfedges[MAX_MAP_SURFEDGES]
patch_t * face_patches[MAX_MAP_FACES]
static vec3_t texture_reflectivity[MAX_MAP_TEXINFO]
#define Mem_AllocType(type)
dBspVertex_t vertexes[MAX_MAP_VERTS]
const char * ValueForKey(const entity_t *ent, const char *key)
static void SubdividePatch(patch_t *patch)
Chops the patch by a global grid.
QGL_EXTERN int GLboolean GLfloat * v
void SubdividePatches(void)
Iterate all of the head face patches, subdividing them as necessary.