vis: code style updates
This commit is contained in:
parent
189cc0586c
commit
64daf7ef75
29
vis/flow.cc
29
vis/flow.cc
|
|
@ -131,19 +131,15 @@ static int CheckStack(leaf_t *leaf, threaddata_t *thread)
|
||||||
static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevstack)
|
static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevstack)
|
||||||
{
|
{
|
||||||
pstack_t stack;
|
pstack_t stack;
|
||||||
qplane3d backplane;
|
|
||||||
leaf_t *leaf;
|
|
||||||
int j, err, numblocks;
|
|
||||||
|
|
||||||
++thread->stats.c_chains;
|
++thread->stats.c_chains;
|
||||||
|
|
||||||
leaf = &leafs[leafnum];
|
leaf_t *leaf = &leafs[leafnum];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check we haven't recursed into a leaf already on the stack
|
* Check we haven't recursed into a leaf already on the stack
|
||||||
*/
|
*/
|
||||||
err = CheckStack(leaf, thread);
|
if (CheckStack(leaf, thread)) {
|
||||||
if (err) {
|
|
||||||
logging::funcprint("WARNING: recursion on leaf {}\n", leafnum);
|
logging::funcprint("WARNING: recursion on leaf {}\n", leafnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -168,8 +164,8 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
leafbits_t local(portalleafs);
|
leafbits_t local(portalleafs);
|
||||||
stack.mightsee = &local;
|
stack.mightsee = &local;
|
||||||
|
|
||||||
auto might = stack.mightsee->data();
|
const auto might = stack.mightsee->data();
|
||||||
auto vis = thread->leafvis.data();
|
const auto vis = thread->leafvis.data();
|
||||||
|
|
||||||
// check all portals for flowing into other leafs
|
// check all portals for flowing into other leafs
|
||||||
for (visportal_t *p : leaf->portals) {
|
for (visportal_t *p : leaf->portals) {
|
||||||
|
|
@ -190,8 +186,8 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t more = 0;
|
uint32_t more = 0;
|
||||||
numblocks = (portalleafs + leafbits_t::mask) >> leafbits_t::shift;
|
const int numblocks = (portalleafs + leafbits_t::mask) >> leafbits_t::shift;
|
||||||
for (j = 0; j < numblocks; j++) {
|
for (int j = 0; j < numblocks; j++) {
|
||||||
might[j] = prevstack.mightsee->data()[j] & test[j];
|
might[j] = prevstack.mightsee->data()[j] & test[j];
|
||||||
more |= (might[j] & ~vis[j]);
|
more |= (might[j] & ~vis[j]);
|
||||||
}
|
}
|
||||||
|
|
@ -203,7 +199,7 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
}
|
}
|
||||||
// get plane of portal, point normal into the neighbor leaf
|
// get plane of portal, point normal into the neighbor leaf
|
||||||
stack.portalplane = p->plane;
|
stack.portalplane = p->plane;
|
||||||
backplane = -p->plane;
|
const qplane3d backplane = -p->plane;
|
||||||
|
|
||||||
if (qv::epsilonEqual(prevstack.portalplane.normal, backplane.normal, VIS_EQUAL_EPSILON))
|
if (qv::epsilonEqual(prevstack.portalplane.normal, backplane.normal, VIS_EQUAL_EPSILON))
|
||||||
continue; // can't go out a coplanar face
|
continue; // can't go out a coplanar face
|
||||||
|
|
@ -211,7 +207,7 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
thread->stats.c_portalcheck++;
|
thread->stats.c_portalcheck++;
|
||||||
|
|
||||||
stack.portal = p;
|
stack.portal = p;
|
||||||
stack.next = NULL;
|
stack.next = nullptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Testing visibility of a target portal, from a source portal,
|
* Testing visibility of a target portal, from a source portal,
|
||||||
|
|
@ -254,7 +250,7 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
/* TEST 0 :: source -> pass -> target */
|
/* TEST 0 :: source -> pass -> target */
|
||||||
if (vis_options.level.value() > 0) {
|
if (vis_options.level.value() > 0) {
|
||||||
if (stack.numseparators[0]) {
|
if (stack.numseparators[0]) {
|
||||||
for (j = 0; j < stack.numseparators[0]; j++) {
|
for (int j = 0; j < stack.numseparators[0]; j++) {
|
||||||
stack.pass = ClipStackWinding(thread->stats, stack.pass, stack, stack.separators[0][j]);
|
stack.pass = ClipStackWinding(thread->stats, stack.pass, stack, stack.separators[0][j]);
|
||||||
if (!stack.pass)
|
if (!stack.pass)
|
||||||
break;
|
break;
|
||||||
|
|
@ -273,7 +269,7 @@ static void RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t &prevs
|
||||||
/* TEST 1 :: pass -> source -> target */
|
/* TEST 1 :: pass -> source -> target */
|
||||||
if (vis_options.level.value() > 1) {
|
if (vis_options.level.value() > 1) {
|
||||||
if (stack.numseparators[1]) {
|
if (stack.numseparators[1]) {
|
||||||
for (j = 0; j < stack.numseparators[1]; j++) {
|
for (int j = 0; j < stack.numseparators[1]; j++) {
|
||||||
stack.pass = ClipStackWinding(thread->stats, stack.pass, stack, stack.separators[1][j]);
|
stack.pass = ClipStackWinding(thread->stats, stack.pass, stack, stack.separators[1][j]);
|
||||||
if (!stack.pass)
|
if (!stack.pass)
|
||||||
break;
|
break;
|
||||||
|
|
@ -372,8 +368,6 @@ static void SimpleFlood(visportal_t &srcportal, int leafnum, const leafbits_t &p
|
||||||
*/
|
*/
|
||||||
static void BasePortalThread(size_t portalnum)
|
static void BasePortalThread(size_t portalnum)
|
||||||
{
|
{
|
||||||
size_t j;
|
|
||||||
float d;
|
|
||||||
leafbits_t portalsee(numportals * 2);
|
leafbits_t portalsee(numportals * 2);
|
||||||
|
|
||||||
visportal_t &p = portals[portalnum];
|
visportal_t &p = portals[portalnum];
|
||||||
|
|
@ -390,10 +384,11 @@ static void BasePortalThread(size_t portalnum)
|
||||||
viswinding_t &tw = *tp.winding;
|
viswinding_t &tw = *tp.winding;
|
||||||
|
|
||||||
// Quick test - completely at the back?
|
// Quick test - completely at the back?
|
||||||
d = p.plane.distance_to(tw.origin);
|
float d = p.plane.distance_to(tw.origin);
|
||||||
if (d < -tw.radius)
|
if (d < -tw.radius)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
size_t j;
|
||||||
for (j = 0; j < tw.size(); j++) {
|
for (j = 0; j < tw.size(); j++) {
|
||||||
d = p.plane.distance_to(tw[j]);
|
d = p.plane.distance_to(tw[j]);
|
||||||
if (d > -VIS_ON_EPSILON) // ericw -- changed from > ON_EPSILON for
|
if (d > -VIS_ON_EPSILON) // ericw -- changed from > ON_EPSILON for
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ viswinding_t *ClipStackWinding(visstats_t &stats, viswinding_t *in, pstack_t &st
|
||||||
if (!counts[1])
|
if (!counts[1])
|
||||||
return in;
|
return in;
|
||||||
|
|
||||||
auto neww = AllocStackWinding(stack);
|
auto *neww = AllocStackWinding(stack);
|
||||||
neww->numpoints = 0;
|
neww->numpoints = 0;
|
||||||
neww->origin = in->origin;
|
neww->origin = in->origin;
|
||||||
neww->radius = in->radius;
|
neww->radius = in->radius;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue