コード例 #1
0
ファイル: OctreeCacheNode.cs プロジェクト: RHY3756547/FreeSO
        /// <summary>
        /// Adds the color.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="paletteIndex">Index of the palette.</param>
        /// <param name="level">The level.</param>
        public void AddColor(Color color, Int32 paletteIndex, Int32 level)
        {
            // if this node is a leaf, then increase a color amount, and pixel presence
            entries.Add(paletteIndex, color);

            if (level < 8) // otherwise goes one level deeper
            {
                // calculates an index for the next sub-branch
                Int32 index = GetColorIndexAtLevel(color, level);

                // if that branch doesn't exist, grows it
                if (nodes[index] == null)
                {
                    nodes[index] = new OctreeCacheNode();
                }

                // adds a color to that branch
                nodes[index].AddColor(color, paletteIndex, level + 1);
            }
        }
コード例 #2
0
 /// <summary>
 /// See <see cref="BaseColorCache.Prepare"/> for more details.
 /// </summary>
 public override void Prepare()
 {
     base.Prepare();
     root = new OctreeCacheNode();
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OctreeColorCache"/> class.
 /// </summary>
 public OctreeColorCache()
 {
     ColorModel = ColorModel.RedGreenBlue;
     root       = new OctreeCacheNode();
 }
コード例 #4
0
ファイル: OctreeColorCache.cs プロジェクト: RHY3756547/FreeSO
 /// <summary>
 /// See <see cref="BaseColorCache.Prepare"/> for more details.
 /// </summary>
 public override void Prepare()
 {
     base.Prepare();
     root = new OctreeCacheNode();
 }
コード例 #5
0
ファイル: OctreeColorCache.cs プロジェクト: RHY3756547/FreeSO
 /// <summary>
 /// Initializes a new instance of the <see cref="OctreeColorCache"/> class.
 /// </summary>
 public OctreeColorCache()
 {
     ColorModel = ColorModel.RedGreenBlue;
     root = new OctreeCacheNode();
 }