1 /**
2 * PBR widget: panel (rather useless beware).
3 * Copyright: Copyright Auburn Sounds 2015 and later.
4 * License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
5 * Authors:   Guillaume Piolat
6 */
7 module dplug.pbrwidgets.panel;
8 
9 import std.math;
10 import dplug.gui.element;
11 import dplug.client.params;
12 
13 /// An UIPanel is simply a plain rectangle with a depth, material and diffuse.
14 deprecated("Use a custom widget, or look at the background widgets") class UIPanel : UIElement
15 {
16 public:
17 nothrow:
18 @nogc:
19 
20     this(UIContext context, RGBA diffuse, RGBA material, L16 depth)
21     {
22         super(context);
23         _depth = depth;
24         _material = material;
25         _diffuse = diffuse;
26     }
27 
28     override void onDraw(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] dirtyRects) nothrow @nogc
29     {
30         foreach(dirtyRect; dirtyRects)
31         {
32             // fill diffuse map
33             diffuseMap.cropImageRef(dirtyRect).fillAll(_diffuse);
34 
35             // fill material map
36             materialMap.cropImageRef(dirtyRect).fillAll(_material);
37 
38             // fill depth map
39             depthMap.cropImageRef(dirtyRect).fillAll(_depth);
40         }
41     }
42 
43 protected:
44     L16 _depth;
45     RGBA _diffuse;
46     RGBA _material;
47 }