|
|
@@ -1547,8 +1547,9 @@ struct Imgui
|
|
|
return selected;
|
|
|
}
|
|
|
|
|
|
- void image(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
+ bool image(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
{
|
|
|
+ const uint32_t id = getId();
|
|
|
Area& area = getCurrentArea();
|
|
|
|
|
|
int32_t xx;
|
|
|
@@ -1576,6 +1577,10 @@ struct Imgui
|
|
|
const int32_t yy = area.m_widgetY;
|
|
|
area.m_widgetY += _height + DEFAULT_SPACING;
|
|
|
|
|
|
+ const bool enabled = isEnabled(m_areaId);
|
|
|
+ const bool over = enabled && inRect(xx, yy, _width, _height);
|
|
|
+ const bool res = buttonLogic(id, over);
|
|
|
+
|
|
|
screenQuad(xx, yy, _width, _height, _originBottomLeft);
|
|
|
bgfx::setUniform(u_imageLod, &_lod);
|
|
|
bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
|
|
|
@@ -1583,20 +1588,23 @@ struct Imgui
|
|
|
bgfx::setProgram(m_imageProgram);
|
|
|
setCurrentScissor();
|
|
|
bgfx::submit(m_view);
|
|
|
+
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
- void image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
+ bool image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
{
|
|
|
const float width = _width*float(getCurrentArea().m_widgetW);
|
|
|
const float height = width/_aspect;
|
|
|
|
|
|
- image(_image, _lod, int32_t(width), int32_t(height), _align, _originBottomLeft);
|
|
|
+ return image(_image, _lod, int32_t(width), int32_t(height), _align, _originBottomLeft);
|
|
|
}
|
|
|
|
|
|
- void imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
|
|
|
+ bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
|
|
|
{
|
|
|
BX_CHECK(_channel < 4, "Channel param must be from 0 to 3!");
|
|
|
|
|
|
+ const uint32_t id = getId();
|
|
|
Area& area = getCurrentArea();
|
|
|
|
|
|
int32_t xx;
|
|
|
@@ -1624,6 +1632,10 @@ struct Imgui
|
|
|
const int32_t yy = area.m_widgetY;
|
|
|
area.m_widgetY += _height + DEFAULT_SPACING;
|
|
|
|
|
|
+ const bool enabled = isEnabled(m_areaId);
|
|
|
+ const bool over = enabled && inRect(xx, yy, _width, _height);
|
|
|
+ const bool res = buttonLogic(id, over);
|
|
|
+
|
|
|
screenQuad(xx, yy, _width, _height);
|
|
|
bgfx::setUniform(u_imageLod, &_lod);
|
|
|
|
|
|
@@ -1636,14 +1648,16 @@ struct Imgui
|
|
|
bgfx::setProgram(m_imageSwizzProgram);
|
|
|
setCurrentScissor();
|
|
|
bgfx::submit(m_view);
|
|
|
+
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
- void imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
|
|
|
+ bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
|
|
|
{
|
|
|
const float width = _width*float(getCurrentArea().m_widgetW);
|
|
|
const float height = width/_aspect;
|
|
|
|
|
|
- imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align);
|
|
|
+ return imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align);
|
|
|
}
|
|
|
|
|
|
bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align)
|
|
|
@@ -3288,24 +3302,24 @@ void imguiColorWheel(const char* _text, float _rgb[3], bool& _activated, bool _e
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
+bool imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
{
|
|
|
- s_imgui.image(_image, _lod, _width, _height, _align, _originBottomLeft);
|
|
|
+ return s_imgui.image(_image, _lod, _width, _height, _align, _originBottomLeft);
|
|
|
}
|
|
|
|
|
|
-void imguiImage(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
+bool imguiImage(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
|
|
|
{
|
|
|
- s_imgui.image(_image, _lod, _width, _aspect, _align, _originBottomLeft);
|
|
|
+ return s_imgui.image(_image, _lod, _width, _aspect, _align, _originBottomLeft);
|
|
|
}
|
|
|
|
|
|
-void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
|
|
|
+bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
|
|
|
{
|
|
|
- s_imgui.imageChannel(_image, _channel, _lod, _width, _height, _align);
|
|
|
+ return s_imgui.imageChannel(_image, _channel, _lod, _width, _height, _align);
|
|
|
}
|
|
|
|
|
|
-void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
|
|
|
+bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
|
|
|
{
|
|
|
- s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align);
|
|
|
+ return s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align);
|
|
|
}
|
|
|
|
|
|
bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align)
|