[DEV] better display of the rounded theme

This commit is contained in:
Edouard DUPIN 2013-05-25 10:56:57 +02:00
parent 31b6134640
commit b35988ef89
4 changed files with 26 additions and 22 deletions

View File

@ -51,7 +51,7 @@ void main(void) {
vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding); vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding); vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
// Calculate the distance of the radius // Calculate the distance of the radius
float tmpDist = sqrt(dot(circleMode,circleMode)); float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
// Generate the internal rampe for the the imput drawing // Generate the internal rampe for the the imput drawing
float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5, float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
S_roundedRatio + S_sizeBorder*1.5, S_roundedRatio + S_sizeBorder*1.5,

View File

@ -51,7 +51,7 @@ void main(void) {
vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding); vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding); vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
// Calculate the distance of the radius // Calculate the distance of the radius
float tmpDist = sqrt(dot(circleMode,circleMode)); float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
// Generate the internal rampe for the the imput drawing // Generate the internal rampe for the the imput drawing
float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5, float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
S_roundedRatio + S_sizeBorder*1.5, S_roundedRatio + S_sizeBorder*1.5,

View File

@ -38,25 +38,29 @@ void main(void) {
// prevent origin moving ... // prevent origin moving ...
vec2 position = v_position - EW_widgetProperty.origin; vec2 position = v_position - EW_widgetProperty.origin;
/* generate a central simetry
____ _____
\ /
\ /
\ /
-
*/
vec2 positionCenter = abs(position-ratio); vec2 positionCenter = abs(position-ratio);
vec2 ratioHight = ratio - S_sizePadding; // This is a clip to remove center of the display of the widget
vec2 ratioLow = ratioHight - (S_sizeBorder+S_roundedRatio); vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
vec2 circleMode = smoothstep(ratioLow, ratioHight, positionCenter); vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
float tmpDist = sqrt(dot(circleMode,circleMode)); // Calculate the distance of the radius
float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
//float distanceInternal = (S_roundedRatio-S_sizeBorder/2.0)/(S_roundedRatio-S_sizeBorder); // Generate the internal rampe for the the imput drawing
//float distanceExternal = (S_roundedRatio+S_sizeBorder/2.0)/(S_roundedRatio-S_sizeBorder);; float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
if(tmpDist <= 0.7 ) { S_roundedRatio + S_sizeBorder*1.5,
gl_FragColor = S_colorFg; tmpDist);
} else if(tmpDist <= 0.9) { // set Background
float tmpVal = smoothstep(0.7, 0.9, tmpDist);
if (tmpVal<=0.5) {
gl_FragColor = S_colorBorder*(tmpVal*2.0) + S_colorFg*(1.0-tmpVal*2.0);
} else {
gl_FragColor = S_colorBorder*(1.0-(tmpVal-0.5)*2.0) + S_colorBg*((tmpVal-0.5)*2.0);
}
} else {
gl_FragColor = S_colorBg; gl_FragColor = S_colorBg;
} // set foreground
gl_FragColor = gl_FragColor*tmpVal + S_colorFg*(1.0-tmpVal);
// set border
float tmpVal2 = abs(tmpVal-0.5)*2.0;
gl_FragColor = gl_FragColor*tmpVal2 + S_colorBorder*(1.0-tmpVal2);
} }

View File

@ -51,7 +51,7 @@ void main(void) {
vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding); vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding); vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
// Calculate the distance of the radius // Calculate the distance of the radius
float tmpDist = sqrt(dot(circleMode,circleMode)); float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
// Generate the internal rampe for the the imput drawing // Generate the internal rampe for the the imput drawing
float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5, float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
S_roundedRatio + S_sizeBorder*1.5, S_roundedRatio + S_sizeBorder*1.5,