mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0025775: "Default Gradient Background" in V3d_Viewer has no effect in new created V3d_View.
This commit is contained in:
parent
c6a60baab7
commit
d3fab23ba9
@ -306,6 +306,7 @@ void V3d_View::SetWindow(const Handle(Aspect_Window)& TheWindow)
|
|||||||
// SetWindow carries out SetRatio and modifies
|
// SetWindow carries out SetRatio and modifies
|
||||||
MyView->SetContext(MyViewContext) ;
|
MyView->SetContext(MyViewContext) ;
|
||||||
MyView->SetBackground(MyBackground) ;
|
MyView->SetBackground(MyBackground) ;
|
||||||
|
MyView->SetGradientBackground (MyGradientBackground, Standard_False);
|
||||||
MyViewer->SetViewOn(this) ;
|
MyViewer->SetViewOn(this) ;
|
||||||
MyView->Redraw() ;
|
MyView->Redraw() ;
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,14 @@ static OpenGl_Caps ViewerTest_myDefaultCaps;
|
|||||||
|
|
||||||
static void OSWindowSetup();
|
static void OSWindowSetup();
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
Quantity_Color FlatColor;
|
||||||
|
Quantity_Color GradientColor1;
|
||||||
|
Quantity_Color GradientColor2;
|
||||||
|
Aspect_GradientFillMethod FillMethod;
|
||||||
|
} ViewerTest_DefaultBackground = { Quantity_NOC_BLACK, Quantity_NOC_BLACK, Quantity_NOC_BLACK, Aspect_GFM_NONE };
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// EVENT GLOBAL VARIABLES
|
// EVENT GLOBAL VARIABLES
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@ -641,10 +649,10 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
|
|||||||
toCreateViewer = Standard_True;
|
toCreateViewer = Standard_True;
|
||||||
TCollection_ExtendedString NameOfWindow("Viewer3D");
|
TCollection_ExtendedString NameOfWindow("Viewer3D");
|
||||||
a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString());
|
a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString());
|
||||||
|
a3DViewer->SetDefaultBackgroundColor (ViewerTest_DefaultBackground.FlatColor);
|
||||||
NameOfWindow = TCollection_ExtendedString("Collector");
|
a3DViewer->SetDefaultBgGradientColors (ViewerTest_DefaultBackground.GradientColor1,
|
||||||
|
ViewerTest_DefaultBackground.GradientColor2,
|
||||||
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
ViewerTest_DefaultBackground.FillMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AIS context setup
|
// AIS context setup
|
||||||
@ -2916,6 +2924,57 @@ static int VSetColorBg(Draw_Interpretor& di, Standard_Integer argc, const char**
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//function : VSetDefaultBg
|
||||||
|
//purpose : Set default viewer background fill color
|
||||||
|
//==============================================================================
|
||||||
|
static int VSetDefaultBg (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
|
||||||
|
{
|
||||||
|
if (theArgNb != 4
|
||||||
|
&& theArgNb != 8)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong syntax! See usage:\n";
|
||||||
|
theDI.PrintHelp (theArgVec[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewerTest_DefaultBackground.FillMethod =
|
||||||
|
theArgNb == 4 ? Aspect_GFM_NONE
|
||||||
|
: (Aspect_GradientFillMethod) Draw::Atoi (theArgVec[7]);
|
||||||
|
|
||||||
|
if (theArgNb == 4)
|
||||||
|
{
|
||||||
|
Standard_Real R = Draw::Atof (theArgVec[1]) / 255.;
|
||||||
|
Standard_Real G = Draw::Atof (theArgVec[2]) / 255.;
|
||||||
|
Standard_Real B = Draw::Atof (theArgVec[3]) / 255.;
|
||||||
|
ViewerTest_DefaultBackground.FlatColor.SetValues (R, G, B, Quantity_TOC_RGB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Standard_Real R1 = Draw::Atof (theArgVec[1]) / 255.;
|
||||||
|
Standard_Real G1 = Draw::Atof (theArgVec[2]) / 255.;
|
||||||
|
Standard_Real B1 = Draw::Atof (theArgVec[3]) / 255.;
|
||||||
|
ViewerTest_DefaultBackground.GradientColor1.SetValues (R1, G1, B1, Quantity_TOC_RGB);
|
||||||
|
|
||||||
|
Standard_Real R2 = Draw::Atof (theArgVec[4]) / 255.;
|
||||||
|
Standard_Real G2 = Draw::Atof (theArgVec[5]) / 255.;
|
||||||
|
Standard_Real B2 = Draw::Atof (theArgVec[6]) / 255.;
|
||||||
|
ViewerTest_DefaultBackground.GradientColor2.SetValues (R2, G2, B2, Quantity_TOC_RGB);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (NCollection_DoubleMap<TCollection_AsciiString, Handle(AIS_InteractiveContext)>::Iterator
|
||||||
|
anIter (ViewerTest_myContexts); anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(V3d_Viewer)& aViewer = anIter.Value()->CurrentViewer();
|
||||||
|
aViewer->SetDefaultBackgroundColor (ViewerTest_DefaultBackground.FlatColor);
|
||||||
|
aViewer->SetDefaultBgGradientColors (ViewerTest_DefaultBackground.GradientColor1,
|
||||||
|
ViewerTest_DefaultBackground.GradientColor2,
|
||||||
|
ViewerTest_DefaultBackground.FillMethod);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : VScale
|
//function : VScale
|
||||||
//purpose : View Scaling
|
//purpose : View Scaling
|
||||||
@ -8775,6 +8834,11 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
theCommands.Add("vsetcolorbg",
|
theCommands.Add("vsetcolorbg",
|
||||||
"vsetcolorbg : vsetcolorbg r g b : Set background color",
|
"vsetcolorbg : vsetcolorbg r g b : Set background color",
|
||||||
__FILE__,VSetColorBg,group);
|
__FILE__,VSetColorBg,group);
|
||||||
|
theCommands.Add("vsetdefaultbg",
|
||||||
|
"vsetdefaultbg r g b\n"
|
||||||
|
"\n\t\t: vsetdefaultbg r1 g1 b1 r2 g2 b2 fillmode"
|
||||||
|
"\n\t\t: Set default viewer background fill color (flat/gradient).",
|
||||||
|
__FILE__,VSetDefaultBg,group);
|
||||||
theCommands.Add("vscale",
|
theCommands.Add("vscale",
|
||||||
"vscale : vscale X Y Z",
|
"vscale : vscale X Y Z",
|
||||||
__FILE__,VScale,group);
|
__FILE__,VScale,group);
|
||||||
|
25
tests/bugs/vis/bug25775
Normal file
25
tests/bugs/vis/bug25775
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25775"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
################################################################
|
||||||
|
# "Default Gradient Backgound" in V3d_Viewer has no effect in new created V3d_View.
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
pload ALL
|
||||||
|
vsetdefaultbg 0 0 0 64 64 64 1
|
||||||
|
vinit View1 w=400 h=400
|
||||||
|
if { [checkcolor 399 100 0.25 0.25 0.25] != 1 } {
|
||||||
|
puts "Error: bug with default gradient color is reproduced."
|
||||||
|
}
|
||||||
|
|
||||||
|
vinit View2 w=400 h=400
|
||||||
|
if { [checkcolor 399 100 0.25 0.25 0.25] != 1 } {
|
||||||
|
puts "Error: bug with default gradient color is reproduced."
|
||||||
|
}
|
||||||
|
|
||||||
|
vsetdefaultbg 128 128 128
|
||||||
|
vinit View3
|
||||||
|
if { [checkcolor 100 100 0.5 0.5 0.5] != 1 } {
|
||||||
|
puts "Error: bug with default background color is reproduced."
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user