Пример #1
0
 public override void Draw()
 {
     if (Show)
     {
         Screen2DImmediate.Draw_Box3D(boundingBoxMin, boundingBoxMax, Color);
     }
 }
Пример #2
0
        public override void PostDraw()
        {
            if (!pageLoaded)
            {
                return;
            }

            if ((View != null) && View.IsDirty)
            {
                isLoading = true;
                int    depth   = 4;
                int    rowSpan = width * depth;
                int    length  = rowSpan * height;
                byte[] buffer  = new byte[length];
                View.Render(buffer, rowSpan, depth);
                int[] data = new int[buffer.Length];

                // 1 way
                //IntPtr pointer = Marshal.AllocHGlobal(buffer.Length);
                //Marshal.Copy(buffer, 0, pointer, buffer.Length);
                //Marshal.Copy(pointer, data, 0, width * height);
                //Marshal.FreeHGlobal(pointer);

                // 2 way
                GCHandle pinnedArray = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                IntPtr   pointer     = pinnedArray.AddrOfPinnedObject();
                Marshal.Copy(pointer, data, 0, width * height);
                pinnedArray.Free();

                TextureFactory.LockTexture(webTextureID, false);
                TextureFactory.SetPixelArray(webTextureID, 0, 0, width, height, data);
                TextureFactory.UnlockTexture(webTextureID, true);
            }

            Screen2DImmediate.Action_Begin2D();
            hud.Draw_Sprite(webTextureID, hudPosX, hudPosY);
            Screen2DImmediate.Action_End2D();
        }