예제 #1
0
                public void Run(Forever parent)
                {
                    var longRunning = parent._scheduler.AsLongRunning();

                    if (longRunning != null)
                    {
                        SetUpstream(longRunning.ScheduleLongRunning(this, (@this, c) => @this.LoopInf(c)));
                    }
                    else
                    {
                        SetUpstream(parent._scheduler.Schedule(this, (@this, a) => @this.LoopRecInf(a)));
                    }
                }
예제 #2
0
파일: Repeat.cs 프로젝트: akarnokd/Rx.NET
                public IDisposable Run(Forever parent)
                {
                    var longRunning = parent._scheduler.AsLongRunning();

                    if (longRunning != null)
                    {
                        return(longRunning.ScheduleLongRunning(LoopInf));
                    }
                    else
                    {
                        return(parent._scheduler.Schedule(LoopRecInf));
                    }
                }
예제 #3
0
                public void Run(Forever parent)
                {
                    var longRunning = parent._scheduler.AsLongRunning();

                    if (longRunning != null)
                    {
                        SetUpstream(longRunning.ScheduleLongRunning(LoopInf));
                    }
                    else
                    {
                        SetUpstream(parent._scheduler.Schedule(LoopRecInf));
                    }
                }
예제 #4
0
        public void When_Subscribed_To_Then_Returns_Value_And_Does_Not_Complete()
        {
            // Arrange
            var scheduler = new TestScheduler();
            var sut = new Forever<int>(100);
            var observer = scheduler.CreateObserver<int>();
            var expected = new[]
            {
                OnNext(0, 100),
            };
            sut.Subscribe(observer);

            // Act
            scheduler.Start();

            // Assert
            KKAssert.AreEqualByValue(expected, observer.Messages);
        }
        public static void Render(Forever.Physics.Collide.Plane plane, RenderContext context, Color color)
        {
            if (effect == null)
              {
            InitializeGraphics(context.GraphicsDevice);
              }
              Matrix view = context.Camera.View;
              Matrix projection = context.Camera.Projection;
              GraphicsDevice graphicsDevice = context.GraphicsDevice;

              Vector3 w_point = context.Camera.Position;
              Vector3 point = plane.ClosestPoint(w_point);

              Vector3 away =  point - plane.PrinciplePoint;

              Vector3 a = Vector3.Cross(away,  plane.Normal);
              Vector3 b = Vector3.Cross(a, plane.Normal);
              if (a.Length() != 0)
              {
            a.Normalize();
              }

              if (b.Length() != 0)
              {
            b.Normalize();
              }

              float check = Vector3.Dot(plane.Normal, b);

              Vector3 planeOrigin = plane.PrinciplePoint;
              planeVerts[3].Position = planeOrigin + (a * -10000f) + (b * 10000f);
              planeVerts[2].Position = planeOrigin + (a * 10000f)  + (b * 10000f);
              planeVerts[1].Position = planeOrigin + (a * 10000f)  + (b * -10000f);
              planeVerts[0].Position = planeOrigin + (a * -10000f) + (b * -10000f);

              for (int i = 0; i < 4; i++)
              {
            planeVerts[i].Color = color;
              }

              //graphicsDevice.VertexDeclaration = vertDecl;

              effect.World = Matrix.Identity;
              effect.View = view;
              effect.Projection = projection;

              //effect.Begin();
              foreach (EffectPass pass in effect.CurrentTechnique.Passes)
              {
            pass.Apply();

            graphicsDevice.DrawUserIndexedPrimitives(
              Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList,
              planeVerts,
              0,
              4,
              planeIndices,
              0,
              4
             );

            //pass.End();
              }
              //effect.End();
        }