Beispiel #1
0
        public void TestConstructor()
        {
            PointParticleRenderer <SimpleParticle> renderer;

            renderer = new PointParticleRenderer <SimpleParticle>(this.effect);
            Assert.IsNotNull(renderer); // Nonsense; avoids compiler warning
        }
Beispiel #2
0
        public void TestThrowOnNullEffectInConstructor()
        {
            DrawContext nullContext = null;
            PointParticleRenderer <SimpleParticle> renderer;

            Assert.Throws <ArgumentException>(
                delegate() {
                renderer = new PointParticleRenderer <SimpleParticle>(nullContext);
            }
                );
        }
Beispiel #3
0
        public void TestRenderParticles()
        {
            SimpleParticle[] particles = new SimpleParticle[] {
                new SimpleParticle(Vector3.Zero, Vector3.Zero),
                new SimpleParticle(Vector3.Zero, Vector3.Zero),
                new SimpleParticle(Vector3.Zero, Vector3.Zero),
                new SimpleParticle(Vector3.Zero, Vector3.Zero)
            };

            PrimitiveBatch <SimpleParticle> primitiveBatch;

            using (
                primitiveBatch = new PrimitiveBatch <SimpleParticle>(
                    this.mockedGraphicsDeviceService.GraphicsDevice,
                    this.vertexDeclaration, SimpleParticle.SizeInBytes
                    )
                ) {
                PointParticleRenderer <SimpleParticle> renderer = createRenderer();
                renderer.Render(
                    new ArraySegment <SimpleParticle>(particles, 1, 2), primitiveBatch
                    );
            }
        }