PBRBackgroundGUI

PBRBackgroundGUI provides a PBR background loaded from PNG or JPEG images. It's very practical while in development because it let's you reload the six images used with the press of ENTER. The path of each of these images (given as a template parameter) must be in your "stringImportPaths" settings.

Constructors

this
this(int width, int height)
Undocumented in source.
this
this(SizeConstraints sizeConstraints)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

onDrawPBR
void onDrawPBR(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] dirtyRects)
Undocumented in source. Be warned that the author may not have intended to support it.
onKeyDown
bool onKeyDown(Key key)
Undocumented in source. Be warned that the author may not have intended to support it.
reflow
void reflow()
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From GUIGraphics

PBR_TILE_MAX_WIDTH
enum PBR_TILE_MAX_WIDTH;
Undocumented in source.
PBR_TILE_MAX_HEIGHT
enum PBR_TILE_MAX_HEIGHT;
Undocumented in source.
buildCompositor
ICompositor buildCompositor(CompositorCreationContext* context)
Undocumented in source. Be warned that the author may not have intended to support it.
onScreenshot
void onScreenshot(ImageRef!RGBA finalRender, WindowPixelFormat pixelFormat, ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap)

Want a screenshot? Want to generate a mesh or a voxel out of your render? Override this function and call IUIContext.requestUIScreenshot()

compositor
ICompositor compositor()
Undocumented in source. Be warned that the author may not have intended to support it.
~this
~this()
Undocumented in source.
openUI
void* openUI(void* parentInfo, void* controlInfo, IClient client, GraphicsBackend backend)
Undocumented in source. Be warned that the author may not have intended to support it.
closeUI
void closeUI()
Undocumented in source. Be warned that the author may not have intended to support it.
getGUISize
void getGUISize(int* widthLogicalPixels, int* heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
getDesiredGUISize
void getDesiredGUISize(int* widthLogicalPixels, int* heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
isResizeable
bool isResizeable()
Undocumented in source. Be warned that the author may not have intended to support it.
isAspectRatioPreserved
bool isAspectRatioPreserved()
Undocumented in source. Be warned that the author may not have intended to support it.
getPreservedAspectRatio
int[2] getPreservedAspectRatio()
Undocumented in source. Be warned that the author may not have intended to support it.
isResizeableHorizontally
bool isResizeableHorizontally()
Undocumented in source. Be warned that the author may not have intended to support it.
isResizeableVertically
bool isResizeableVertically()
Undocumented in source. Be warned that the author may not have intended to support it.
getMaxSmallerValidSize
void getMaxSmallerValidSize(int* inoutWidth, int* inoutHeight)
Undocumented in source. Be warned that the author may not have intended to support it.
getNearestValidSize
void getNearestValidSize(int* inoutWidth, int* inoutHeight)
Undocumented in source. Be warned that the author may not have intended to support it.
nativeWindowResize
bool nativeWindowResize(int newWidthLogicalPixels, int newHeightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
WindowListener
class WindowListener
Undocumented in source.
setUpdateMargin
void setUpdateMargin(int margin)

Tune this to tune the trade-off between light quality and speed. The default value was tuned by hand on very shiny light sources. Too high and processing becomes more expensive. Too little and the ligth decay doesn't feel natural. IMPORTANT: This should be called only inside your main reflow() or at UI creation time.

getUIScale
float getUIScale()
Undocumented in source. Be warned that the author may not have intended to support it.
getUserScale
float getUserScale()
Undocumented in source. Be warned that the author may not have intended to support it.
getDefaultUISizeInPixels
vec2i getDefaultUISizeInPixels()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsUser
vec2i getUISizeInPixelsUser()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsLogical
vec2i getUISizeInPixelsLogical()
Undocumented in source. Be warned that the author may not have intended to support it.
getUISizeInPixelsPhysical
vec2i getUISizeInPixelsPhysical()
Undocumented in source. Be warned that the author may not have intended to support it.
requestUIScreenshot
void requestUIScreenshot()
Undocumented in source. Be warned that the author may not have intended to support it.
requestUIResize
bool requestUIResize(int widthLogicalPixels, int heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
getUINearestValidSize
void getUINearestValidSize(int* widthLogicalPixels, int* heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
isUIResizable
bool isUIResizable()
Undocumented in source. Be warned that the author may not have intended to support it.
_client
IClient _client;
Undocumented in source.
_compositor
ICompositor _compositor;
Undocumented in source.
_uiContext
UIContext _uiContext;
Undocumented in source.
_windowListener
WindowListener _windowListener;
Undocumented in source.
_window
IWindow _window;
Undocumented in source.
_threadPool
ThreadPool _threadPool;
Undocumented in source.
_sizeConstraints
SizeConstraints _sizeConstraints;
Undocumented in source.
_currentLogicalWidth
int _currentLogicalWidth;
Undocumented in source.
_currentLogicalHeight
int _currentLogicalHeight;
Undocumented in source.
_desiredLogicalWidth
int _desiredLogicalWidth;
Undocumented in source.
_desiredLogicalHeight
int _desiredLogicalHeight;
Undocumented in source.
_currentUserWidth
int _currentUserWidth;
Undocumented in source.
_currentUserHeight
int _currentUserHeight;
Undocumented in source.
_userArea
box2i _userArea;

the area in logical area where the user area is drawn.

_firstResize
bool _firstResize;
Undocumented in source.
_redrawBlackBordersAndResizedArea
bool _redrawBlackBordersAndResizedArea;
Undocumented in source.
_reportBlackBordersAndResizedAreaAsDirty
bool _reportBlackBordersAndResizedAreaAsDirty;
Undocumented in source.
_diffuseMap
Mipmap!RGBA _diffuseMap;
Undocumented in source.
_depthMap
Mipmap!L16 _depthMap;
Undocumented in source.
_materialMap
Mipmap!RGBA _materialMap;
Undocumented in source.
_rectsToUpdateDisjointedRaw
Vec!box2i _rectsToUpdateDisjointedRaw;
_rectsToUpdateDisjointedPBR
Vec!box2i _rectsToUpdateDisjointedPBR;

The list of areas to be redrawn at the Raw and PBR levels (composited). These are accumulated over possibly several calls of recomputeDirtyRects and cleared by a call to onDraw. Other lists of areas are purely derived from _rectsToUpdateDisjointedRaw and _rectsToUpdateDisjointedPBR.

_rectsTemp
Vec!box2i _rectsTemp;
Undocumented in source.
_updateRectScratch
Vec!box2i[2] _updateRectScratch;
Undocumented in source.
_rectsToComposite
Vec!box2i _rectsToComposite;
Undocumented in source.
_rectsToCompositeDisjointed
Vec!box2i _rectsToCompositeDisjointed;
Undocumented in source.
_rectsToCompositeDisjointedTiled
Vec!box2i _rectsToCompositeDisjointedTiled;
Undocumented in source.
_rectsToDisplay
Vec!box2i _rectsToDisplay;
Undocumented in source.
_rectsToDisplayDisjointed
Vec!box2i _rectsToDisplayDisjointed;
Undocumented in source.
_rectsToResize
Vec!box2i _rectsToResize;
Undocumented in source.
_rectsToResizeDisjointed
Vec!box2i _rectsToResizeDisjointed;
Undocumented in source.
_elemsToDrawRaw
Vec!UIElement _elemsToDrawRaw;

The list of UIElement to potentially call onDrawPBR on.

_elemsToDrawPBR
Vec!UIElement _elemsToDrawPBR;

The list of UIElement to potentially call onDrawPBR on.

_sortScratchBuf
Vec!UIElement _sortScratchBuf;

The scratch buffer used to sort the two above list.

_updateMargin
int _updateMargin;

Amount of pixels dirty rectangles are extended with.

_compositedBuffer
OwnedImage!RGBA _compositedBuffer;

The composited buffer, before the Raw layer is applied.

_renderedBuffer
OwnedImage!RGBA _renderedBuffer;

The rendered framebuffer. This is copied from _compositedBuffer, then Raw layer is drawn on top. Components are reordered there. It must be possible to use a Canvas on it.

_resizedBuffer
ubyte* _resizedBuffer;

The final framebuffer. It is the only buffer to have a size in logical pixels. Internally the UI has an "user" size. FUTURE: resize from user size to logical size using a resizer, to allow better looking DPI without the OS blurry resizing. Or to allow higher internal pixel count.

_screenShotRequested
shared(bool) _screenShotRequested;

If a screenshot was requested by user widget.

recomputeDrawLists
void recomputeDrawLists()
Undocumented in source. Be warned that the author may not have intended to support it.
toImageRef
ImageRef!RGBA toImageRef(ubyte* alignedBuffer, int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
profiler
IProfiler profiler()
Undocumented in source. Be warned that the author may not have intended to support it.
doDraw
void doDraw(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.
recomputeDirtyAreas
void recomputeDirtyAreas()
Undocumented in source. Be warned that the author may not have intended to support it.
recomputePurelyDerivedRectangles
void recomputePurelyDerivedRectangles()
Undocumented in source. Be warned that the author may not have intended to support it.
convertPBRLayerRectToRawLayerRect
box2i convertPBRLayerRectToRawLayerRect(box2i rect, int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
doResize
ImageRef!RGBA doResize(int widthLogicalPixels, int heightLogicalPixels)
Undocumented in source. Be warned that the author may not have intended to support it.
redrawElementsRaw
void redrawElementsRaw()

Draw the Raw layer of UIElement widgets

redrawElementsPBR
void redrawElementsPBR()

Draw the PBR layer of UIElement widgets

compositeGUI
void compositeGUI(ImageRef!RGBA wfb)

Do the PBR compositing step. This is the most expensive step in the UI.

regenerateMipmaps
void regenerateMipmaps()

Compose lighting effects from depth and diffuse into a result. takes output image and non-overlapping areas as input Useful multithreading code.

reorderComponents
void reorderComponents(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.
convertUserRectToLogicalRect
box2i convertUserRectToLogicalRect(box2i b)
Undocumented in source. Be warned that the author may not have intended to support it.
convertLogicalRectToUserRect
box2i convertLogicalRectToUserRect(box2i b)
Undocumented in source. Be warned that the author may not have intended to support it.
resizeContent
void resizeContent(WindowPixelFormat pf)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta