游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1363|回复: 0

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

[复制链接]

9

主题

15

帖子

15

积分

新手上路

Rank: 1

积分
15
发表于 2011-8-23 16:21:00 | 显示全部楼层 |阅读模式
在这本《focus on 3d terrain》书中的四叉树的renderNode函数有一段:
其中全局变量:


  1. char g_cQTFanCode[] = { 10, 8, 8, 12, 8, 0, 12, 14, 8, 12, 0, 14, 12, 14, 14, 0 };
  2. 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)                        
  3. iStart= g_cQTFanStart[iFanCode];                         
  4. iFanLength= 0;                         
  5. //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++;
  6. //..........................
复制代码

虽然代码意思我明白,但是我不明白他用这种方法来判断是否渲染子节点的依据是什么?或说
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 };
这两个数组的值是怎么得来?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-8 18:14

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表