Created
August 27, 2014 07:08
-
-
Save hb3p8/c4125a960a8e4d496491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======================================================================= | |
// function : PrintPretty | |
// purpose : | |
// ======================================================================= | |
void RayTraceGPU_Node::PrintPretty (std::string thePrefix, bool isLeft, int theLevel) const | |
{ | |
if (IsLeaf()) | |
{ | |
thePrefix.erase(thePrefix.size() - 2, 2); | |
thePrefix += isLeft ? "|-" : "\xC0-"; | |
std::cout << thePrefix; | |
const RayTraceGPU_PrimitiveNode* aNode = | |
static_cast<const RayTraceGPU_PrimitiveNode*> (this); | |
char buf[32]; | |
_itoa((int)aNode, buf, 16); | |
std::cout << (aNode->IsComplement() ? "!" : " ") << aNode->TypeID() << std::endl; | |
} | |
else | |
{ | |
const RayTraceGPU_OperationNode* aNode = | |
static_cast<const RayTraceGPU_OperationNode*> (this); | |
thePrefix.erase(thePrefix.size() - 2, 2); | |
thePrefix += isLeft ? "|-" : "\xC0-"; | |
std::cout | |
<< thePrefix | |
<< (aNode->Operation() == RT_OP_INTER ? (aNode->IsComplement() ? " ~." : " . ") : (aNode->Operation() == RT_OP_UNION ? (aNode->IsComplement() ? " ~+" : " + ") : (aNode->IsComplement() ? " ~-" : " - "))) | |
<< "(" << aNode->Height() << ")" | |
<< std::endl; | |
thePrefix.erase(thePrefix.size() - 2, 2); | |
if (!isLeft) | |
{ | |
thePrefix += " "; | |
} | |
else | |
{ | |
thePrefix += "| "; | |
} | |
thePrefix += " | "; | |
{ | |
aNode->Child<0>()->PrintPretty (thePrefix, true, theLevel + 1); | |
aNode->Child<1>()->PrintPretty (thePrefix, false, theLevel + 1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment