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(); } }
/******************************************************************************************************** * * 以下都是生成图形类的静态方法 * * * * ***********************************************************************************************************/ /// <summary> /// 根据数据生成一个可视化的图形 /// </summary> /// <param name="array">数据集合</param> /// <param name="width">需要绘制图形的宽度</param> /// <param name="height">需要绘制图形的高度</param> /// <param name="graphic">指定绘制成什么样子的图形</param> /// <returns>返回一个bitmap对象</returns> public static Bitmap GetGraphicFromArray(Paintdata[] array, int width, int height, GraphicRender graphic) { if (width < 10 && height < 10) { throw new ArgumentException("长宽不能小于等于10"); } array.Max(m => m.Count); Action <Paintdata[], GraphicRender, Graphics> paintAction = delegate(Paintdata[] array1, GraphicRender graphic1, Graphics g) { }; return(null); }