在这本《focus on 3d terrain》书中的四叉树的renderNode函数有一段:
其中全局变量:
- 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 };
这两个数组的值是怎么得来?
|