mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
Give the fields of pstack_t clearer names.
And some comments.
This commit is contained in:
parent
1ea79e8626
commit
ccc432a7ea
2 changed files with 36 additions and 31 deletions
|
@ -98,10 +98,11 @@ typedef struct cluster_s {
|
||||||
|
|
||||||
typedef struct pstack_s {
|
typedef struct pstack_s {
|
||||||
struct pstack_s *next; ///< linked list of active stack objects
|
struct pstack_s *next; ///< linked list of active stack objects
|
||||||
cluster_t *cluster;
|
cluster_t *cluster; ///< the cluster being sub-vised
|
||||||
portal_t *portal; // portal exiting
|
winding_t *source_winding; ///< clipped source portal winding
|
||||||
winding_t *source, *pass;
|
portal_t *pass_portal; ///< the portal exiting from the cluster
|
||||||
plane_t portalplane;
|
winding_t *pass_winding; ///< clipped pass portal winding
|
||||||
|
plane_t pass_plane; ///< plane of the pass portal
|
||||||
sep_t *separators[2];
|
sep_t *separators[2];
|
||||||
set_t mightsee;
|
set_t mightsee;
|
||||||
} pstack_t;
|
} pstack_t;
|
||||||
|
|
|
@ -298,7 +298,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
}
|
}
|
||||||
|
|
||||||
stack->cluster = cluster;
|
stack->cluster = cluster;
|
||||||
stack->portal = NULL;
|
stack->pass_portal = NULL;
|
||||||
stack->separators[0] = 0;
|
stack->separators[0] = 0;
|
||||||
stack->separators[1] = 0;
|
stack->separators[1] = 0;
|
||||||
might = &stack->mightsee;
|
might = &stack->mightsee;
|
||||||
|
@ -319,37 +319,38 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get plane of portal, point normal into the neighbor cluster
|
// get plane of portal, point normal into the neighbor cluster
|
||||||
stack->portalplane = portal->plane;
|
|
||||||
VectorNegate (portal->plane.normal, backplane.normal);
|
VectorNegate (portal->plane.normal, backplane.normal);
|
||||||
backplane.dist = -portal->plane.dist;
|
backplane.dist = -portal->plane.dist;
|
||||||
|
|
||||||
if (_VectorCompare (prevstack->portalplane.normal, backplane.normal))
|
if (_VectorCompare (prevstack->pass_plane.normal, backplane.normal))
|
||||||
continue; // can't go out a coplanar face
|
continue; // can't go out a coplanar face
|
||||||
|
|
||||||
thread->stats.portalcheck++;
|
thread->stats.portalcheck++;
|
||||||
|
|
||||||
stack->portal = portal;
|
|
||||||
|
|
||||||
target = ClipWinding (portal->winding,
|
target = ClipWinding (portal->winding,
|
||||||
&thread->pstack_head->portalplane, false);
|
&thread->pstack_head->pass_plane, false);
|
||||||
if (!target)
|
if (!target)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!prevstack->pass) {
|
if (!prevstack->pass_winding) {
|
||||||
// the second cluster can be blocked only if coplanar
|
// the second cluster can be blocked only if coplanar
|
||||||
|
|
||||||
stack->source = prevstack->source;
|
stack->source_winding = prevstack->source_winding;
|
||||||
stack->pass = target;
|
stack->pass_winding = target;
|
||||||
|
|
||||||
|
stack->pass_plane = portal->plane;
|
||||||
|
stack->pass_portal = portal;
|
||||||
|
|
||||||
RecursiveClusterFlow (portal->cluster, thread, stack);
|
RecursiveClusterFlow (portal->cluster, thread, stack);
|
||||||
FreeWinding (target);
|
FreeWinding (target);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = ClipWinding (target, &prevstack->portalplane, false);
|
target = ClipWinding (target, &prevstack->pass_plane, false);
|
||||||
if (!target)
|
if (!target)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
source = CopyWinding (prevstack->source);
|
source = CopyWinding (prevstack->source_winding);
|
||||||
|
|
||||||
source = ClipWinding (source, &backplane, false);
|
source = ClipWinding (source, &backplane, false);
|
||||||
if (!source) {
|
if (!source) {
|
||||||
|
@ -363,12 +364,12 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
if (options.level > 0) {
|
if (options.level > 0) {
|
||||||
// clip target to the image that would be formed by a laser
|
// clip target to the image that would be formed by a laser
|
||||||
// pointing from the edges of source passing though the corners of
|
// pointing from the edges of source passing though the corners of
|
||||||
// pass
|
// pass_winding
|
||||||
winding_t *old = target;
|
winding_t *old = target;
|
||||||
if (!stack->separators[0])
|
if (!stack->separators[0])
|
||||||
stack->separators[0] = FindSeparators (thread, source,
|
stack->separators[0] = FindSeparators (thread, source,
|
||||||
thread->pstack_head->portalplane,
|
thread->pstack_head->pass_plane,
|
||||||
prevstack->pass, 0);
|
prevstack->pass_winding, 0);
|
||||||
target = ClipToSeparators (stack->separators[0], target);
|
target = ClipToSeparators (stack->separators[0], target);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
thread->stats.targetclipped++;
|
thread->stats.targetclipped++;
|
||||||
|
@ -380,16 +381,16 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.level > 1) {
|
if (options.level > 1) {
|
||||||
// now pass the laser along the edges of pass from the corners of
|
// now pass the laser along the edges of pass_winding from the corners of
|
||||||
// source. the resulting image will have a smaller aree. The
|
// source. the resulting image will have a smaller aree. The
|
||||||
// resulting shape will be the light image produced by a backlit
|
// resulting shape will be the light image produced by a backlit
|
||||||
// source shining past pass. eg, if source and pass are equilateral
|
// source shining past pass_winding. eg, if source and pass_winding are equilateral
|
||||||
// triangles rotated 60 (or 180) degrees relative to each other,
|
// triangles rotated 60 (or 180) degrees relative to each other,
|
||||||
// parallel and in line, target will wind up being a hexagon.
|
// parallel and in line, target will wind up being a hexagon.
|
||||||
winding_t *old = target;
|
winding_t *old = target;
|
||||||
if (!stack->separators[1])
|
if (!stack->separators[1])
|
||||||
stack->separators[1] = FindSeparators (thread, prevstack->pass,
|
stack->separators[1] = FindSeparators (thread, prevstack->pass_winding,
|
||||||
prevstack->portalplane,
|
prevstack->pass_plane,
|
||||||
source, 1);
|
source, 1);
|
||||||
target = ClipToSeparators (stack->separators[1], target);
|
target = ClipToSeparators (stack->separators[1], target);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
|
@ -408,7 +409,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
winding_t *old = source;
|
winding_t *old = source;
|
||||||
sep_t *sep;
|
sep_t *sep;
|
||||||
sep = FindSeparators (thread, target, portal->plane,
|
sep = FindSeparators (thread, target, portal->plane,
|
||||||
prevstack->pass, 0);
|
prevstack->pass_winding, 0);
|
||||||
source = ClipToSeparators (sep, source);
|
source = ClipToSeparators (sep, source);
|
||||||
free_separators (thread, sep);
|
free_separators (thread, sep);
|
||||||
if (!source) {
|
if (!source) {
|
||||||
|
@ -423,8 +424,8 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
if (options.level > 3) {
|
if (options.level > 3) {
|
||||||
winding_t *old = source;
|
winding_t *old = source;
|
||||||
sep_t *sep;
|
sep_t *sep;
|
||||||
sep = FindSeparators (thread, prevstack->pass,
|
sep = FindSeparators (thread, prevstack->pass_winding,
|
||||||
prevstack->portalplane, target, 1);
|
prevstack->pass_plane, target, 1);
|
||||||
source = ClipToSeparators (sep, source);
|
source = ClipToSeparators (sep, source);
|
||||||
free_separators (thread, sep);
|
free_separators (thread, sep);
|
||||||
if (!source) {
|
if (!source) {
|
||||||
|
@ -436,8 +437,11 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
thread->stats.sourcetrimmed++;
|
thread->stats.sourcetrimmed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack->source = source;
|
stack->source_winding = source;
|
||||||
stack->pass = target;
|
stack->pass_winding = target;
|
||||||
|
|
||||||
|
stack->pass_plane = portal->plane;
|
||||||
|
stack->pass_portal = portal;
|
||||||
|
|
||||||
thread->stats.portalpass++;
|
thread->stats.portalpass++;
|
||||||
|
|
||||||
|
@ -467,10 +471,10 @@ PortalFlow (threaddata_t *data, portal_t *portal)
|
||||||
if (!data->pstack_head)
|
if (!data->pstack_head)
|
||||||
data->pstack_head = new_stack ();
|
data->pstack_head = new_stack ();
|
||||||
data->pstack_head->cluster = 0;
|
data->pstack_head->cluster = 0;
|
||||||
data->pstack_head->portal = portal;
|
data->pstack_head->pass_portal = portal;
|
||||||
data->pstack_head->source = portal->winding;
|
data->pstack_head->source_winding = portal->winding;
|
||||||
data->pstack_head->pass = 0;
|
data->pstack_head->pass_winding = 0;
|
||||||
data->pstack_head->portalplane = portal->plane;
|
data->pstack_head->pass_plane = portal->plane;
|
||||||
set_assign (&data->pstack_head->mightsee, portal->mightsee);
|
set_assign (&data->pstack_head->mightsee, portal->mightsee);
|
||||||
data->pstack_head->separators[0] = 0;
|
data->pstack_head->separators[0] = 0;
|
||||||
data->pstack_head->separators[1] = 0;
|
data->pstack_head->separators[1] = 0;
|
||||||
|
|
Loading…
Reference in a new issue