refdef_t r_refdef;
cvar_t r_showtris = {0, "r_showtris", "0"};
+cvar_t r_shownormals = {0, "r_shownormals", "0"};
cvar_t r_drawentities = {0, "r_drawentities","1"};
cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"};
cvar_t r_speeds = {0, "r_speeds","0"};
// FIXME: move this to client?
FOG_registercvars();
Cvar_RegisterVariable(&r_showtris);
+ Cvar_RegisterVariable(&r_shownormals);
Cvar_RegisterVariable(&r_drawentities);
Cvar_RegisterVariable(&r_drawviewmodel);
Cvar_RegisterVariable(&r_speeds);
GL_Color(r, g, b, a);
}
-
static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *texture, int texturenumsurfaces, const msurface_t **texturesurfacelist, const vec3_t modelorg)
{
int texturesurfaceindex;
}
}
}
+ if (r_shownormals.integer && !r_showtrispass)
+ {
+ int j, k;
+ float v[3];
+ GL_DepthTest(true);
+ GL_DepthMask(texture->currentlayers->depthmask);
+ GL_BlendFunc(texture->currentlayers->blendfunc1, texture->currentlayers->blendfunc2);
+ memset(&m, 0, sizeof(m));
+ R_Mesh_State(&m);
+ for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
+ {
+ surface = texturesurfacelist[texturesurfaceindex];
+ RSurf_SetVertexPointer(ent, texture, surface, modelorg);
+ if (!rsurface_svector3f)
+ {
+ rsurface_svector3f = varray_svector3f;
+ rsurface_tvector3f = varray_tvector3f;
+ rsurface_normal3f = varray_normal3f;
+ Mod_BuildTextureVectorsAndNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface_vertex3f, surface->groupmesh->data_texcoordtexture2f, surface->groupmesh->data_element3i + surface->num_firsttriangle * 3, rsurface_svector3f, rsurface_tvector3f, rsurface_normal3f, r_smoothnormals_areaweighting.integer);
+ }
+ GL_Color(1, 0, 0, 1);
+ qglBegin(GL_LINES);
+ for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
+ {
+ VectorCopy(rsurface_vertex3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_svector3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ GL_Color(0, 0, 1, 1);
+ for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
+ {
+ VectorCopy(rsurface_vertex3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_tvector3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ GL_Color(0, 1, 0, 1);
+ for (j = 0, k = surface->num_firstvertex;j < surface->num_vertices;j++, k++)
+ {
+ VectorCopy(rsurface_vertex3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ VectorMA(v, 8, rsurface_normal3f + k * 3, v);
+ qglVertex3f(v[0], v[1], v[2]);
+ }
+ qglEnd();
+ }
+ }
}
if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
qglEnable(GL_CULL_FACE);
// 6 multiply, 9 subtract
VectorSubtract(v1, v0, v10);
VectorSubtract(v2, v0, v20);
- normal3f[0] = v10[1] * v20[2] - v10[2] * v20[1];
- normal3f[1] = v10[2] * v20[0] - v10[0] * v20[2];
- normal3f[2] = v10[0] * v20[1] - v10[1] * v20[0];
+ normal3f[0] = v20[1] * v10[2] - v20[2] * v10[1];
+ normal3f[1] = v20[2] * v10[0] - v20[0] * v10[2];
+ normal3f[2] = v20[0] * v10[1] - v20[1] * v10[0];
// 12 multiply, 10 subtract
tc10[1] = tc1[1] - tc0[1];
tc20[1] = tc2[1] - tc0[1];