]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
new option -capturedemo to capture a demo to an AVI file;
[xonotic/darkplaces.git] / model_brush.c
index 3461fabff56b9385a84a65b2e67995ae7fd69708..660c4df77dfa7504aea387485d825ca0a106cba0 100644 (file)
@@ -4570,7 +4570,10 @@ Q3 shader blendfuncs actually used in the game (* = supported by DP)
                                out->skinframerate = shader->primarylayer->framerate;
                                for (j = 0;j < shader->primarylayer->numframes;j++)
                                        if (!(out->skinframes[j] = R_SkinFrame_LoadExternal(shader->primarylayer->texturename[j], ((shader->surfaceparms & Q3SURFACEPARM_NOMIPMAPS) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | ((!r_picmipworld.integer || (shader->textureflags & Q3TEXTUREFLAG_NOPICMIP)) ? 0 : TEXF_PICMIP) | (shader->primarylayer->clampmap ? TEXF_CLAMP : 0), false)))
+                                       {
                                                Con_DPrintf("%s: could not load texture \"%s\" (frame %i) for shader \"%s\"\n", loadmodel->name, shader->primarylayer->texturename[j], j, out->name);
+                                               out->skinframes[j] = R_SkinFrame_LoadMissing();
+                                       }
                        }
                        if (shader->backgroundlayer)
                        {
@@ -4905,7 +4908,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
        if (loadmodel->texturepool == NULL && cls.state != ca_dedicated)
                loadmodel->texturepool = R_AllocTexturePool();
 
-       if (loadmodel->brushq3.num_lightmapmergepower > 0 || true)
+       if (loadmodel->brushq3.num_lightmapmergepower > 0)
        {
                power = loadmodel->brushq3.num_lightmapmergepower;
                power2 = power * 2;
@@ -5579,7 +5582,7 @@ static void Mod_Q3BSP_LoadPVS(lump_t *l)
 static void Mod_Q3BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal)
 {
        int i, j, k, index[3];
-       float transformed[3], blend1, blend2, blend, yaw, pitch, sinpitch, stylescale;
+       float transformed[3], blend1, blend2, blend, stylescale;
        q3dlightgrid_t *a, *s;
 
        // scale lighting by lightstyle[0] so that darkmode in dpmod works properly
@@ -5625,12 +5628,12 @@ static void Mod_Q3BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientc
                                s = a + (k * model->brushq3.num_lightgrid_isize[1] + j) * model->brushq3.num_lightgrid_isize[0] + i;
                                VectorMA(ambientcolor, blend * (1.0f / 128.0f), s->ambientrgb, ambientcolor);
                                VectorMA(diffusecolor, blend * (1.0f / 128.0f), s->diffusergb, diffusecolor);
-                               pitch = s->diffusepitch * M_PI / 128;
-                               yaw = s->diffuseyaw * M_PI / 128;
-                               sinpitch = sin(pitch);
-                               diffusenormal[0] += blend * (cos(yaw) * sinpitch);
-                               diffusenormal[1] += blend * (sin(yaw) * sinpitch);
-                               diffusenormal[2] += blend * (cos(pitch));
+                               // this uses the mod_md3_sin table because the values are
+                               // already in the 0-255 range, the 64+ bias fetches a cosine
+                               // instead of a sine value
+                               diffusenormal[0] += blend * (mod_md3_sin[64 + s->diffuseyaw] * mod_md3_sin[s->diffusepitch]);
+                               diffusenormal[1] += blend * (mod_md3_sin[     s->diffuseyaw] * mod_md3_sin[s->diffusepitch]);
+                               diffusenormal[2] += blend * (mod_md3_sin[64 + s->diffusepitch]);
                                //Con_Printf("blend %f: ambient %i %i %i, diffuse %i %i %i, diffusepitch %i diffuseyaw %i (%f %f, normal %f %f %f)\n", blend, s->ambientrgb[0], s->ambientrgb[1], s->ambientrgb[2], s->diffusergb[0], s->diffusergb[1], s->diffusergb[2], s->diffusepitch, s->diffuseyaw, pitch, yaw, (cos(yaw) * cospitch), (sin(yaw) * cospitch), (-sin(pitch)));
                        }
                }