private static void RenderMethod(DecalGlyp component, GraphicRender <DecalGlyp, TranslationGlypHitTestEffect> render)
        {
            var effect = render.Effect;
            var device = effect.Device;

            device.PrimitiveTopology = IAPrimitive.TriangleList;

            var decal  = component.ScreenRectangle;
            var scene  = Engine.Scene;
            var camera = scene.ActiveCamera;

            effect.Input.View  = camera.View;
            effect.Input.Proj  = Matrix.PerspectiveFovLh((float)decal.Width / decal.Height, Numerics.ToRadians(60), 1, 100);
            effect.Input.World = Matrix.Identity;

            foreach (var item in component.Components)
            {
                //HitTestId id = new HitTestId(((int)item.Axix << 8) | 0x000000FF);
                HitTestId id = new HitTestId(item.Id);
                render.Bind(id);

                device.SetVertexBuffer(0, item.VertexBuffer);
                device.SetIndexBuffer(item.IndexBufffer);

                int indexCount = (int)(item.IndexBufffer.SizeInBytes / item.IndexBufffer.Stride);

                effect.OnRender(render);
                foreach (var pass in effect.Passes(0))
                {
                    effect.Apply(pass);
                    device.DrawIndexed(indexCount, 0, 0);
                }
                effect.EndPasses();
            }
        }
 public DecalGlypIdRender(DecalGlyp glyp)
 {
     this.glyp   = glyp;
     this.render = new RelayRender <DecalGlyp, TranslationGlypHitTestEffect>(RenderMethod);
 }
 public DecalGlypHitTest(int width, int height, Format depthFormat, DecalGlyp coordinate)
     : base(width, height, depthFormat, new DecalGlypIdRender(coordinate))
 {
 }