Gui: by default radial gradient is off
This commit is contained in:
@@ -96,27 +96,28 @@ void SoFCBackgroundGradient::GLRender (SoGLRenderAction * /*action*/)
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
if(!radial){ // linear gradient
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
if (mCol[0] < 0) {
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f(-1, 1);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f(-1,-1);
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f( 1, 1);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f( 1,-1);
|
||||
}
|
||||
else {
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f(-1, 1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f(-1, 0);
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f( 1, 1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f( 1, 0);
|
||||
glEnd();
|
||||
if (!radial) { // linear gradient
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f(-1, 0);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f(-1,-1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f( 1, 0);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f( 1,-1);
|
||||
if (mCol[0] < 0) {
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f(-1, 1);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f(-1,-1);
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f( 1, 1);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f( 1,-1);
|
||||
}
|
||||
else {
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f(-1, 1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f(-1, 0);
|
||||
glColor3f(fCol[0],fCol[1],fCol[2]); glVertex2f( 1, 1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f( 1, 0);
|
||||
glEnd();
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f(-1, 0);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f(-1,-1);
|
||||
glColor3f(mCol[0],mCol[1],mCol[2]); glVertex2f( 1, 0);
|
||||
glColor3f(tCol[0],tCol[1],tCol[2]); glVertex2f( 1,-1);
|
||||
}
|
||||
}
|
||||
} else { // radial gradient
|
||||
else { // radial gradient
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor3f(fCol[0], fCol[1], fCol[2]); glVertex2f(0.0f, 0.0f);
|
||||
|
||||
@@ -133,9 +134,10 @@ void SoFCBackgroundGradient::GLRender (SoGLRenderAction * /*action*/)
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
for (std::size_t i = 0; i < small_oval.size(); i++){
|
||||
for (std::size_t i = 0; i < small_oval.size(); i++) {
|
||||
glColor3f(mCol[0], mCol[1], mCol[2]); glVertex2fv( small_oval[i] );
|
||||
glColor3f(tCol[0], tCol[1], tCol[2]); glVertex2fv( big_circle[i] ); }
|
||||
glColor3f(tCol[0], tCol[1], tCol[2]); glVertex2fv( big_circle[i] );
|
||||
}
|
||||
|
||||
glColor3f(mCol[0], mCol[1], mCol[2]); glVertex2fv( small_oval.front() );
|
||||
glColor3f(tCol[0], tCol[1], tCol[2]); glVertex2fv( big_circle.front() );
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Inventor/SbColor.h>
|
||||
#include <Inventor/nodes/SoNode.h>
|
||||
#include <Inventor/nodes/SoSubNode.h>
|
||||
#include <FCGlobal.h>
|
||||
|
||||
|
||||
class SbColor;
|
||||
@@ -44,8 +45,13 @@ public:
|
||||
SoFCBackgroundGradient();
|
||||
|
||||
void GLRender (SoGLRenderAction *action);
|
||||
void setColorGradient(const SbColor& fromColor, const SbColor& toColor, bool isRadial);
|
||||
void setColorGradient(const SbColor& fromColor, const SbColor& toColor, const SbColor& midColor, bool isRadial);
|
||||
void setColorGradient(const SbColor& fromColor,
|
||||
const SbColor& toColor,
|
||||
bool isRadial);
|
||||
void setColorGradient(const SbColor& fromColor,
|
||||
const SbColor& toColor,
|
||||
const SbColor& midColor,
|
||||
bool isRadial);
|
||||
|
||||
private:
|
||||
bool radial;
|
||||
|
||||
@@ -266,7 +266,7 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp
|
||||
}
|
||||
else if ( strcmp(Reason,"Gradient") == 0 || strcmp(Reason, "RadialGradient") == 0 ) {
|
||||
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it)
|
||||
(*it)->setGradientBackground(rGrp.GetBool("Gradient", true) || rGrp.GetBool("RadialGradient", true));
|
||||
(*it)->setGradientBackground(rGrp.GetBool("Gradient", true) || rGrp.GetBool("RadialGradient", false));
|
||||
}
|
||||
else if (strcmp(Reason,"ShowFPS") == 0) {
|
||||
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it)
|
||||
|
||||
@@ -235,7 +235,7 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
||||
_viewer->setAnimationEnabled(rGrp.GetBool("UseAutoRotation", false));
|
||||
}
|
||||
else if (strcmp(Reason,"Gradient") == 0 || strcmp(Reason,"RadialGradient") == 0) {
|
||||
_viewer->setGradientBackground(rGrp.GetBool("Gradient", true) || rGrp.GetBool("RadialGradient", true));
|
||||
_viewer->setGradientBackground(rGrp.GetBool("Gradient", true) || rGrp.GetBool("RadialGradient", false));
|
||||
}
|
||||
else if (strcmp(Reason,"ShowFPS") == 0) {
|
||||
_viewer->setEnabledFPSCounter(rGrp.GetBool("ShowFPS", false));
|
||||
|
||||
Reference in New Issue
Block a user