Overrides - Various color grading bugs fixed

This commit is contained in:
Emmanuel BENOîT 2017-11-19 22:59:41 +01:00
parent 761b9fca1c
commit 7a4595e8e8
4 changed files with 14 additions and 11 deletions

4
TODO
View file

@ -30,7 +30,9 @@ Sync / inputs:
* Display selected input values
* Display selected overrides
* Edit curves in UI
* Specific controls for color grading
Misc:
* General overhaul (e.g. use tabs)
* Color grading controls:
* White balance control in components tab
* Don't reset when hitting value or saturation 0

View file

@ -35,9 +35,11 @@ bool ColorSelectorBar(
{
const float BarWidth = 24.f;
const float BarHeight = 180.f;
const float fullWidth = CalcItemWidth( );
const ImVec2 labelSize = CalcTextSize( label );
const ImVec2 maxValueSize = CalcTextSize( "-9.99" );
const float fullWidth{
std::max( BarWidth , std::max( labelSize.x , maxValueSize.x ) )
+ 2 };
// Compute bounding boxes
auto* const win( GetCurrentWindow( ) );
@ -103,8 +105,8 @@ bool ColorSelectorBar(
dl->AddRect( bbBar.Min , bbBar.Max , fCol );
// Draw colored area on bar
const float val( std::max( base , std::min( unit * 2 , nValue ) ) );
const float vy2( ( BarHeight - 2 ) * ( 1 - val / ( unit * 2 ) ) );
const float val( std::max( base , std::min( base + unit * 2 , nValue ) ) );
const float vy2( ( BarHeight - 2 ) * ( 1 - ( val - base ) / ( unit * 2 ) ) );
dl->AddRectFilled( bbBar.Min + ImVec2( 1 , BarHeight * .5 ) ,
bbBar.Min + ImVec2( BarWidth - 1 , 1 + vy2 ) ,
dispColor );
@ -160,7 +162,8 @@ bool HueSaturationPad(
const auto mPos{ ctx->IO.MousePos };
const auto rmPos{ mPos - wCenter };
const auto mcSqDist{ rmPos.x * rmPos.x + rmPos.y * rmPos.y };
const bool hovered{ mcSqDist <= wSize * wSize * .25f };
const bool hovered{ ItemHoverable( bb , id ) && (
mcSqDist <= wSize * wSize * .25f ) };
const bool tabFocus{ FocusableItemRegister( win , id ) };
if ( tabFocus || ( hovered && ctx->IO.MouseClicked[ 0 ] ) ) {
SetActiveID( id , win );
@ -290,9 +293,9 @@ bool ColorGradingControls(
ColorConvertRGBtoHSV( scRed , scGreen , scBlue , hue , saturation , value );
PushMultiItemsWidths( 2 );
changed = HueSaturationPad( "##wheel" , &hue , &saturation , 180.f );
changed = HueSaturationPad( "" , &hue , &saturation , 180.f );
PopItemWidth( );
SameLine( 0 , GetStyle( ).ItemInnerSpacing.x );
SameLine( 0 , 0 * GetStyle( ).ItemInnerSpacing.x );
ImVec4 updated{ 0 , 0 , 0 , 1 };
ColorConvertHSVtoRGB( hue , saturation * .5f , 1 ,
updated.x , updated.y , updated.z );

View file

@ -447,13 +447,13 @@
(section "Color grading"
(color-grading "Lift"
cg-lift-r cg-lift-g cg-lift-b
(base -1) (unit 1))
(base -.1) (unit .1))
(color-grading "Gain"
cg-gain-r cg-gain-g cg-gain-b
(base 0) (unit 1))
(color-grading "Gamma"
cg-gamma-r cg-gamma-g cg-gamma-b
(base -.9) (unit 1.8))
(base -.9) (unit .9))
)
)
# FIXME: overrides for vignette

View file

@ -10,8 +10,6 @@
#include "rendertarget.hh"
#include "sync.hh"
#include "colorgrading.hh"
using ebcl::T_Optional;