if (gl_textureshader && r_watershader.integer)
{
GL_ActiveTexture (0);
- qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
+ qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
GL_ActiveTexture (1);
qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
qglTexEnvi (GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_OFFSET_TEXTURE_2D_NV);
((i & 0x0038) >> 3) * (1.0f / 7.0f) * r_colorscale,
((i & 0x01C0) >> 6) * (1.0f / 7.0f) * r_colorscale,
0.125f);
- if (PlaneDiff(r_origin, (&portal->plane)) > 0)
+ if (PlaneDiff(r_origin, (&portal->plane)) < 0)
{
for (i = portal->numpoints - 1, v = varray_vertex3f;i >= 0;i--, v += 3)
VectorCopy(portal->points[i].position, v);
// create the new portal by generating a polygon for the node plane,
// and clipping it by all of the other portals(which came from nodes above this one)
nodeportal = AllocPortal();
- nodeportal->plane = *node->plane;
+ nodeportal->plane = *plane;
- nodeportalwinding = Winding_NewFromPlane(node->plane->normal[0], node->plane->normal[1], node->plane->normal[2], node->plane->dist);
+ nodeportalwinding = Winding_NewFromPlane(nodeportal->plane.normal[0], nodeportal->plane.normal[1], nodeportal->plane.normal[2], nodeportal->plane.dist);
side = 0; // shut up compiler warning
for (portal = (portal_t *)node->portals;portal;portal = portal->next[side])
{
{
int exact;
int numfrustumplanes;
- float nradius;
+ vec3_t boxmins;
+ vec3_t boxmaxs;
qbyte *surfacemark;
qbyte *leafmark;
model_t *model;
void Portal_RecursiveFlow_ExactMarkSurfaces(portalrecursioninfo_t *info, int *mark, int nummarksurfaces, int firstclipplane, int numclipplanes)
{
int i, j, *elements;
+ vec3_t trimins, trimaxs;
msurface_t *surf;
surfmesh_t *surfmesh;
for (i = 0;i < nummarksurfaces;i++, mark++)
VectorCopy((surfmesh->vertex3f + elements[0] * 3), trianglepoints[0]);
VectorCopy((surfmesh->vertex3f + elements[1] * 3), trianglepoints[1]);
VectorCopy((surfmesh->vertex3f + elements[2] * 3), trianglepoints[2]);
- if (PointInfrontOfTriangle(info->eye, trianglepoints[0], trianglepoints[1], trianglepoints[2])
- && Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, trianglepoints[0], 3, &portaltemppoints2[0][0], 256) >= 3)
- break;
+ if (PointInfrontOfTriangle(info->eye, trianglepoints[0], trianglepoints[1], trianglepoints[2]))
+ {
+ trimins[0] = min(trianglepoints[0][0], min(trianglepoints[1][0], trianglepoints[2][0]));
+ trimaxs[0] = max(trianglepoints[0][0], max(trianglepoints[1][0], trianglepoints[2][0]));
+ trimins[1] = min(trianglepoints[0][1], min(trianglepoints[1][1], trianglepoints[2][1]));
+ trimaxs[1] = max(trianglepoints[0][1], max(trianglepoints[1][1], trianglepoints[2][1]));
+ trimins[2] = min(trianglepoints[0][2], min(trianglepoints[1][2], trianglepoints[2][2]));
+ trimaxs[2] = max(trianglepoints[0][2], max(trianglepoints[1][2], trianglepoints[2][2]));
+ if (BoxesOverlap(trimins, trimaxs, info->boxmins, info->boxmaxs))
+ if (Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, trianglepoints[0], 3, &portaltemppoints2[0][0], 256) >= 3)
+ break;
+ }
}
if (j < surfmesh->numtriangles)
break;
// follow portals into other leafs
for (p = leaf->portals;p;p = p->next)
{
- // only flow through portals facing away from the viewer
+ // only flow through portals facing the viewer
dist = PlaneDiff(info->eye, (&p->plane));
- if (dist < 0 && dist >= info->nradius)
+ if (dist < 0 && BoxesOverlap(p->past->mins, p->past->maxs, info->boxmins, info->boxmaxs))
{
newpoints = Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, (float *) p->points, p->numpoints, &portaltemppoints2[0][0], 256);
if (newpoints < 3)
newplanes = &portalplanes[firstclipplane + numclipplanes];
for (prev = newpoints - 1, i = 0;i < newpoints;prev = i, i++)
{
- VectorSubtract(info->eye, portaltemppoints2[i], v1);
- VectorSubtract(portaltemppoints2[prev], portaltemppoints2[i], v2);
+ VectorSubtract(portaltemppoints2[prev], portaltemppoints2[i], v1);
+ VectorSubtract(info->eye, portaltemppoints2[i], v2);
CrossProduct(v1, v2, newplanes[i].normal);
VectorNormalizeFast(newplanes[i].normal);
newplanes[i].dist = DotProduct(info->eye, newplanes[i].normal);
}
}
-void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte *surfacemark, const mplane_t *frustumplanes, int numfrustumplanes, int exact, float radius, float *updateleafsmins, float *updateleafsmaxs)
+void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte *surfacemark, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs)
{
int i;
portalrecursioninfo_t info;
ranoutofportalplanes = false;
ranoutofportals = false;
- info.nradius = -radius;
+ VectorCopy(boxmins, info.boxmins);
+ VectorCopy(boxmaxs, info.boxmaxs);
info.exact = exact;
info.surfacemark = surfacemark;
info.leafmark = leafmark;
int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpoints);
int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b);
-void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte *surfacemark, const mplane_t *frustumplanes, int numfrustumplanes, int exact, float radius, float *updateleafsmins, float *updateleafsmaxs);
+void Portal_Visibility(model_t *model, const vec3_t eye, qbyte *leafmark, qbyte *surfacemark, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs);
#endif
//byteleafpvs = Mem_Alloc(tempmempool, cl.worldmodel->brushq1.numleafs);
bytesurfacepvs = Mem_Alloc(tempmempool, cl.worldmodel->brushq1.numsurfaces);
- Portal_Visibility(cl.worldmodel, e->origin, NULL/*byteleafpvs*/, bytesurfacepvs, NULL, 0, true, RadiusFromBoundsAndOrigin(e->mins, e->maxs, e->origin), e->mins, e->maxs);
+ Portal_Visibility(cl.worldmodel, e->origin, NULL/*byteleafpvs*/, bytesurfacepvs, NULL, 0, true, mins, maxs, e->mins, e->maxs);
/*
for (i = 0, leaf = cl.worldmodel->brushq1.leafs;i < cl.worldmodel->brushq1.numleafs;i++, leaf++)
-n darkplaces: server is starting before the "port" cvar is set by commandline and scripts? (yummyluv)
-n darkplaces: typing ip in join game menu should show 'trying' and 'no response' after a while, or 'no network' if networking is not initialized (yummyluv)
-n dpmod: make grapple off-hand (joe hill)
+0 darkplaces: make a getattachmentvectors qc builtin (Supajoe)
+0 darkplaces: add _reflect textures which filter use of skybox as a cubemap reflection (FrikaC)
0 darkplaces: ability to disable fopen builtin access to read /, read data/, write data/, or disable fopen builtin entirely
0 darkplaces: add DP_GFX_QUAKE3MODELTAGS, DP_GFX_SKINFILES, and any other new extensions to the wiki
0 darkplaces: add DP_LITSUPPORT extension and document it
VectorSubtract(org, vright, w->points[3]);
VectorSubtract(w->points[3], vup, w->points[3]);
+#if 0
+ {
+ double n[3];
+ TriangleNormal(w->points[0], w->points[1], w->points[2], n);
+ VectorNormalize(n);
+ if (fabs(DotProduct(n, normal) - 1) > 0.01f)
+ Con_Printf("%.0f %.0f %.0f (%.0f %.0f %.0f, %.0f %.0f %.0f) != %.0f %.0f %.0f (%.0f %.0f %.0f, %.0f %.0f %.0f, %.0f %.0f %.0f, %.0f %.0f %.0f)\n", normal[0], normal[1], normal[2], vright[0], vright[1], vright[2], vup[0], vup[1], vup[2], n[0], n[1], n[2], w->points[0][0], w->points[0][1], w->points[0][2], w->points[1][0], w->points[1][1], w->points[1][2], w->points[2][0], w->points[2][1], w->points[2][2], w->points[3][0], w->points[3][1], w->points[3][2]);
+ }
+#endif
+
w->numpoints = 4;
return w;