| 18 | namespace sibr { |
| 19 | |
| 20 | ImageView::ImageView(bool interactiveMode) |
| 21 | { |
| 22 | _display.init("Display", sibr::loadFile( |
| 23 | sibr::getShadersDirectory("core") + "/image_viewer.vert"), |
| 24 | sibr::loadFile(sibr::getShadersDirectory("core") + "/image_viewer.frag")); |
| 25 | |
| 26 | _minVal.init(_display, "minVal"); |
| 27 | _maxVal.init(_display, "maxVal"); |
| 28 | _channels.init(_display, "channels"); |
| 29 | _size.init(_display, "size"); |
| 30 | _pos.init(_display, "pos"); |
| 31 | _scale.init(_display, "scale"); |
| 32 | _correctRatio.init(_display, "correctRatio"); |
| 33 | |
| 34 | _minVal = { 0.0f, 0.0f, 0.0f, 0.0f }; |
| 35 | _maxVal = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 36 | _showChannels[0] = _showChannels[1] = _showChannels[2] = _showChannels[3] = true; |
| 37 | _bgColor = {0.25f, 0.25f, 0.25f}; |
| 38 | _pos = {0.0f, 0.0f}; |
| 39 | _scale = 1.0f; |
| 40 | // When in "fixed" mode, don't respect the aspect ratio, to make sure that the full image is visible to the viewer. |
| 41 | _correctRatio = interactiveMode; |
| 42 | _showGUI = interactiveMode; |
| 43 | _allowInteraction = interactiveMode; |
| 44 | } |
| 45 | |
| 46 | void ImageView::onUpdate(Input& input, const Viewport & vp) { |
| 47 | if(!_allowInteraction) { |