Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r548 - branches/itanium2/Model/Groups
- Date: Tue, 13 Sep 2005 17:22:58 -0600 (MDT)
Author: abe
Date: Tue Sep 13 17:22:58 2005
New Revision: 548
Modified:
branches/itanium2/Model/Groups/FrustumKDTree.cc
Log:
Removed all but one of the branches from frustum_node_intersect.
M Model/Groups/FrustumKDTree.cc
Modified: branches/itanium2/Model/Groups/FrustumKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/FrustumKDTree.cc (original)
+++ branches/itanium2/Model/Groups/FrustumKDTree.cc Tue Sep 13 17:22:58
2005
@@ -220,21 +220,37 @@
// First check for overlap.
bool above[2];
- above[0] = (f[0] < max_edge[0]);
- above[1] = (f[1] < max_edge[1]);
+ above[0] = (f[0] >= max_edge[0]);
+ above[1] = (f[1] >= max_edge[1]);
+ // Doesn't handle "on-edge" or "on-corner" overlap.
+
+ // In the case that n[0] == min_edge[0] or f[0] == max_edge[0]
+ // The frustum still intersects only A or B, depending on direction.
+ // Not classifing these as INTERSECT_BOTH allows a deeper node to be
choosen
+ // as a candidate starting point.
+
if ( ((n[0] > min_edge[0]) && !above[0]) ||
((n[1] > min_edge[1]) && !above[1]) )
return INTERSECT_BOTH;
// Determine A and B child -- A is closer to the frustum origin.
- unsigned int A_child = INTERSECT_MAX;
- unsigned int B_child = INTERSECT_MIN;
+#if 0
+ unsigned int child_table[4];
unsigned int result = INTERSECT_NONE;
- if (frustum.origin()[axis] < node->split()) {
- A_child = INTERSECT_MIN;
- B_child = INTERSECT_MAX;
+
+ if (frustum.origin()[axis] > node->split()) {
+ child_table[0] = INTERSECT_MAX;
+ child_table[1] = INTERSECT_MIN;
+ child_table[2] = INTERSECT_MIN;
+ child_table[3] = INTERSECT_MAX;
+ }
+ else {
+ child_table[0] = INTERSECT_MIN;
+ child_table[1] = INTERSECT_MAX;
+ child_table[2] = INTERSECT_MAX;
+ child_table[3] = INTERSECT_MIN;
}
// Do we need to check both plane axis?
@@ -242,35 +258,41 @@
/////////////////////////////////////////////////////////////////////////////
// Check for each plane axis direction.
for (int i=0;i<2;++i) {
-
- // Frustum intersection above node.
- if (above[i]) {
-
- // Case "A+"
- if (frustum.direction(plane_axis[i])==1) {
- result &= A_child;
- }
- // Case "B-"
- else {
- result &= B_child;
- }
-
- }
-
- // Frustum intersection below node.
- else {
-
- // Case "B+"
- if (frustum.direction(plane_axis[i])==1) {
- result &= B_child;
- }
- // Case "A-"
- else {
- result &= A_child;
- }
- }
+ result |= child_table[(above[i] << 2) +
frustum.direction(plane_axis[i])];
}
-
+// #else
+ unsigned int child_table[2];
+ unsigned int result = INTERSECT_NONE;
+
+ if (frustum.origin()[axis] > node->split()) {
+ child_table[0] = INTERSECT_MAX;
+ child_table[1] = INTERSECT_MIN;
+ }
+ else {
+ child_table[0] = INTERSECT_MIN;
+ child_table[1] = INTERSECT_MAX;
+ }
+
+ for (int i=0;i<2;++i) {
+ result |= child_table[above[i] ^ frustum.direction(plane_axis[i])];
+ }
+#endif
+
+ // Which side of the split plane is the ray packet on.
+ unsigned int origin = (frustum.origin()[axis] > node->split());
+ unsigned int result = INTERSECT_NONE;
+
+ for (int i=0;i<2;++i) {
+
+ // Determine the A or B child.
+ // This assumes frustum origin is positive,
+ // A=INTERSECT_MAX=0x2 B=INTERSECT_MIN=0x1
+ unsigned int exp1 = ( 0x1 << (above[i] ^
frustum.direction(plane_axis[i])) );
+
+ // Based on origin flip A and B children
+ result |= ((exp1 & 0x2) >> origin) | ((exp1 & 0x1) << origin);
+ }
+
// Return the result.
return (IntersectCase)result;
}
- [MANTA] r548 - branches/itanium2/Model/Groups, abe, 09/13/2005
Archive powered by MHonArc 2.6.16.