+ -
当前位置:首页 → 问答吧 → 《focus on 3d terrain》书中的四叉树的renderNode函数的一些疑问

《focus on 3d terrain》书中的四叉树的renderNode函数的一些疑问

时间:2011-08-23

来源:互联网


在这本《focus on 3d terrain》书中的四叉树的renderNode函数有一段:
其中全局变量:

C/C++ code
char g_cQTFanCode[] = { 10, 8, 8, 12, 8, 0, 12, 14, 8, 12, 0, 14, 12, 14, 14, 0 }; 
char g_cQTFanStart[]= { 3,  3, 0,  3, 1, 0,  0,  3, 2,  2, 0,  2,  1,  1,  0, 0 }; 
//(thanks to Chris Cookson for this idea)             
iStart= g_cQTFanStart[iFanCode];              
iFanLength= 0;              
//calculate the fan length by computing the index of the first non-zero bit in g_cQTFanCode             
while( !( ( ( long )g_cQTFanCode[iFanCode] )&( 1<<iFanLength ) ) && iFanLength<8 )                 iFanLength++;
 //..........................




虽然代码意思我明白,但是我不明白他用这种方法来判断是否渲染子节点的依据是什么?或说
char g_cQTFanCode[] = { 10, 8, 8, 12, 8, 0, 12, 14, 8, 12, 0, 14, 12, 14, 14, 0 };
char g_cQTFanStart[]= { 3, 3, 0, 3, 1, 0, 0, 3, 2, 2, 0, 2, 1, 1, 0, 0 };
这两个数组的值是怎么得来?

作者: xfate   发布时间: 2011-08-23

帮你项一下

作者: dahuaixiaohuai   发布时间: 2011-08-25