Beispiel #1
0
        /// <summary>
        /// Adds a shadow caster to the canvas.
        /// </summary>
        public void AddShadowCaster(Vector2[] vertices, float x, float y, ShadowType shadowType = ShadowType.Illuminated)
        {
            if (!_lighting)
            {
                return;
            }

            LightRenderer.AddShadowCaster(Matrix, vertices, x, y, shadowType);
        }
Beispiel #2
0
        private void DrawImageInternal(Image img, float x, float y)
        {
            unsafe
            {
                var ptr  = AddDrawOp((int)PrimType.Quad, 1, img, _currentEffect, _blendMode);
                var quad = img.Quad;

                ptr[0].Transform(quad.vertex0.X + x, quad.vertex0.Y + y, quad.u0, quad.v0, _transform._tanX, _transform._tanY, _transform, _color);
                ptr[1].Transform(quad.vertex1.X + x, quad.vertex1.Y + y, quad.u1, quad.v0, _transform._tanX, _transform._tanY, _transform, _color);
                ptr[2].Transform(quad.vertex2.X + x, quad.vertex2.Y + y, quad.u1, quad.v1, _transform._tanX, _transform._tanY, _transform, _color);
                ptr[3].Transform(quad.vertex3.X + x, quad.vertex3.Y + y, quad.u0, quad.v1, _transform._tanX, _transform._tanY, _transform, _color);

                if (_lighting && img.ShadowCaster != null)
                {
                    LightRenderer.AddShadowCaster(Matrix, img.ShadowCaster, x + img.Width / 2, y + img.Height / 2);
                }
            }
        }