예제 #1
0
        public override void Prepare(PrepareContext context)
        {
            BatchCombiner.CombineBatches(ref _DrawCalls, context.BatchesToRelease);

            _DrawCalls.Sort(Frame.BatchComparer);
            context.PrepareMany(_DrawCalls);

            OnPrepareDone();
        }
예제 #2
0
        void Prepare_OnNodeBegin(StrategyTree tree, PrepareContext[] stack, int depth)
        {
            PrepareContext context = stack[depth];
            Int64          n       = context.NodeIdx;

            if (depth == 0)
            {
                context.ActionTreeIdx = 0;
            }
            else
            {
                context.ActionTreeIdx = stack[depth - 1].ActionTreeIdx;
                context.Probab        = stack[depth - 1].Probab;
                context.Round         = stack[depth - 1].Round;
                context.ChanceIdx     = stack[depth - 1].ChanceIdx;

                if (tree.Nodes[n].IsDealerAction)
                {
                    context.Round++;
                    context.ChanceIdx += CalculateChanceOffset(context.Round, _curPlayer) * tree.Nodes[n].Card;
                }
                else
                {
                    if (tree.Nodes[n].Position == _curPlayer)
                    {
                        context.Probab = n > _playersCount ? tree.Nodes[n].Probab : 1;
                    }
                    // Find the corresponding node in the action tree

                    context.ActionTreeIdx = FindActionTreeNodeIdx(tree, n, context.ActionTreeIdx, stack[depth - 1].ChildrenCount - 1);

                    if (_actionTreeIndex.GetChildrenCount(context.ActionTreeIdx) == 0)
                    {
                        // A leaf.
                        _spArrays[_curPlayer][context.ActionTreeIdx][context.ChanceIdx] = context.Probab;
                    }
                }
            }
        }
예제 #3
0
 // This is where you should do any computation necessary to prepare a batch for rendering.
 // Examples: State sorting, computing vertices.
 public virtual void Prepare(PrepareContext context)
 {
     context.InvokeBasePrepare(this);
     OnPrepareDone();
 }
예제 #4
0
 public override void Prepare(PrepareContext context)
 {
     OnPrepareDone();
 }
예제 #5
0
 void IBatchContainer.PrepareChildren(ref PrepareContext context)
 {
     BatchCombiner.CombineBatches(ref _DrawCalls, ref context.BatchesToRelease);
     _DrawCalls.Sort(Frame.BatchComparer);
     context.PrepareMany(ref _DrawCalls);
 }