Exemplo n.º 1
0
        public void Begin()
        {
            //uhhmmm I want to throw an exception if its already active, but its annoying.

            if (CurrPipeline == null)
            {
                throw new InvalidOperationException("Pipeline hasn't been set!");
            }

            IsActive = true;
            Owner.BindPipeline(CurrPipeline);

            //clear state cache
            sTexture = null;
            CurrPipeline["uSamplerEnable"].Set(false);
            Modelview.Clear();
            Projection.Clear();
            SetModulateColorWhite();

#if DEBUG
            BlendStateSet = false;
#endif
        }
Exemplo n.º 2
0
        public void Run(TestConfig config)
        {
            int i;
            IDatabase db = config.GetDatabase();
            config.Result = new TestResult();
            Root root = new Root();
            var arr = db.CreateArray<FromRec>(45);
            root.arr = arr;
            db.Root = root;
            db.Commit();
            int projectedEls = 45;
            for (i = 0; i < projectedEls; i++)
            {
                arr.Add(new FromRec(db, i));
            }
            arr[0].toEl = null;

            db.Commit();
            var p1 = new Projection<FromRec, ToRec>("list");
            Tests.Assert(p1.Count == 0);
            Tests.Assert(p1.Length == 0);
            Tests.Assert(!p1.IsReadOnly);
            Tests.Assert(!p1.IsSynchronized);
            Tests.Assert(null == p1.SyncRoot);
            p1.Project(arr);
            Tests.Assert(p1.Count == projectedEls * 5);
            var arrTmp = p1.ToArray();
            Tests.Assert(arrTmp.Length == p1.Length);
            p1.Reset();

            p1.Project(arr[0]);
            Tests.Assert(p1.Length == 5);
            p1.Reset();

            var arr3 = arr.ToArray();
            p1.Project(arr3);
            Tests.Assert(p1.Length == projectedEls * 5);
            p1.Clear();

            IEnumerator<FromRec> e1 = arr.GetEnumerator();
            p1.Project(e1);
            Tests.Assert(p1.Length == projectedEls * 5);

            var p2 = new Projection<FromRec, ToRec>("list2");
            p2.Project(arr);
            Tests.Assert(p2.Length == projectedEls * 5);

            var p3 = new Projection<FromRec, ToRec>("toEl");
            p3.Project(arr);
            Tests.Assert(p2.Length == projectedEls * 5);

            p1.Join<FromRec>(p2);

            Tests.Assert(p1.GetEnumerator() != null);
            IEnumerator eTmp = ((IEnumerable)p1).GetEnumerator();
            Tests.Assert(eTmp != null);

            ToRec[] res = new ToRec[p3.Count];
            p3.CopyTo(res, 0);
            foreach (var tmp in res)
            {
                Tests.Assert(p3.Contains(tmp));
                p3.Remove(tmp);
                Tests.Assert(!p3.Contains(tmp));
            }
            Tests.Assert(0 == p3.Length);
            db.Commit();
            db.Close();
        }