private static IntPtr OnCreateTexturePreview(int serial_number, int x, int y, IntPtr pTexture) { RenderPlugIn p = LookUpBySerialNumber(serial_number) as RenderPlugIn; if (p == null || x < 1 || y < 1 || pTexture == IntPtr.Zero) { HostUtils.DebugString("ERROR: Invalid input for OnCreateTexturePreview"); return IntPtr.Zero; } var texture = RenderContent.FromPointer(pTexture) as RenderTexture; IntPtr pBitmap = IntPtr.Zero; CreateTexture2dPreviewEventArgs args = new CreateTexture2dPreviewEventArgs(texture, new Size(x, y)); try { p.CreateTexture2dPreview(args); if (args.PreviewImage != null) pBitmap = args.PreviewImage.GetHbitmap(); } catch (Exception ex) { HostUtils.ExceptionReport("OnCreateTexturePreview", ex); pBitmap = IntPtr.Zero; } return pBitmap; }
/// <summary> /// Creates the preview bitmap that will appear in the content editor's /// thumbnail display when previewing textures in 2d (UV) mode. /// /// If this function is not overridden or the PreviewImage is not set on the /// args, then the internal OpenGL renderer will generate a simulation. /// </summary> /// <param name="args">Event argument with several preview option state properties.</param> protected virtual void CreateTexture2dPreview(CreateTexture2dPreviewEventArgs args) { }