Пример #1
0
 //============================================================
 // <T>构造八叉树节点。</T>
 //============================================================
 public FOctreeNode16(FOctreeQuantizer16 quantizer, int level)
 {
     if (level < 7)
     {
         quantizer.AddLevelNode(level, this);
     }
 }
Пример #2
0
 //============================================================
 // <T>增加颜色。</T>
 //============================================================
 public void AddColor(Color color, int level, FOctreeQuantizer16 quantizer)
 {
     if (level == 8)
     {
         _alpha += color.A;
         _red   += color.R;
         _green += color.G;
         _blue  += color.B;
         _pixelCount++;
     }
     else if (level < 8)
     {
         int           index = GetColorIndexAtLevel(color, level);
         FOctreeNode16 node  = _nodes[index];
         if (null == node)
         {
             node          = new FOctreeNode16(quantizer, level);
             _nodes[index] = node;
         }
         node.AddColor(color, level + 1, quantizer);
     }
 }