1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030668: Visualization - revise adding ZLayer API

V3d_Viewer::AddZLayer() has been replaced by
V3d_Viewer::InsertLayerBefore() and V3d_Viewer::InsertLayerAfter() methods
allowing to specify Layer settings and index of existing layer to insert new one before/after.
The behavior of V3d_Viewer::AddZLayer() has been adjusted to append
new Layer before Graphic3d_ZLayerId_Top
(between Graphic3d_ZLayerId_Default and Graphic3d_ZLayerId_Top).

Graphic3d_Layer now provides LayerId() property.
Graphic3d_ZLayerSettings has been extended with IsRaytracable() property;
Ray-Tracing now processes multiple layers instead of Graphic3d_ZLayerId_Default.

Moved some methods from OpenGl_View to the base class Graphic3d_CView.
This commit is contained in:
kgv
2019-07-15 21:06:05 +03:00
committed by bugmaster
parent 6b9b7e3c92
commit 1c728f2d6d
24 changed files with 684 additions and 560 deletions

View File

@@ -5322,6 +5322,7 @@ static int VZLayer (Draw_Interpretor& theDI,
}
}
Graphic3d_ZLayerId anOtherLayerId = Graphic3d_ZLayerId_UNKNOWN;
for (; anArgIter < theArgNb; ++anArgIter)
{
// perform operation
@@ -5343,6 +5344,34 @@ static int VZLayer (Draw_Interpretor& theDI,
theDI << aLayerId;
}
else if (anArg == "-insertbefore"
&& anArgIter + 1 < theArgNb
&& ViewerTest::ParseZLayer (theArgVec[anArgIter + 1], anOtherLayerId))
{
++anArgIter;
aLayerId = Graphic3d_ZLayerId_UNKNOWN;
if (!aViewer->InsertLayerBefore (aLayerId, Graphic3d_ZLayerSettings(), anOtherLayerId))
{
std::cout << "Error: can not add a new z layer!\n";
return 0;
}
theDI << aLayerId;
}
else if (anArg == "-insertafter"
&& anArgIter + 1 < theArgNb
&& ViewerTest::ParseZLayer (theArgVec[anArgIter + 1], anOtherLayerId))
{
++anArgIter;
aLayerId = Graphic3d_ZLayerId_UNKNOWN;
if (!aViewer->InsertLayerAfter (aLayerId, Graphic3d_ZLayerSettings(), anOtherLayerId))
{
std::cout << "Error: can not add a new z layer!\n";
return 0;
}
theDI << aLayerId;
}
else if (anArg == "-del"
|| anArg == "-delete"
|| anArg == "del")
@@ -5584,6 +5613,10 @@ static int VZLayer (Draw_Interpretor& theDI,
{
aSettings.SetEnvironmentTexture (toEnable);
}
else if (aSubOp == "raytracing")
{
aSettings.SetRaytracable (toEnable);
}
aViewer->SetZLayerSettings (aLayerId, aSettings);
}
@@ -13336,12 +13369,14 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
__FILE__, VTile, group);
theCommands.Add("vzlayer",
"vzlayer [layerId]"
"\n\t\t: [-add|-delete|-get|-settings]"
"\n\t\t: [-add|-delete|-get|-settings] [-insertBefore AnotherLayer] [-insertAfter AnotherLayer]"
"\n\t\t: [-origin X Y Z] [-cullDist Distance] [-cullSize Size]"
"\n\t\t: [-enable|-disable {depthTest|depthWrite|depthClear|depthoffset}]"
"\n\t\t: [-enable|-disable {positiveOffset|negativeOffset|textureenv}]"
"\n\t\t: [-enable|-disable {positiveOffset|negativeOffset|textureenv|rayTracing}]"
"\n\t\t: ZLayer list management:"
"\n\t\t: -add add new z layer to viewer and print its id"
"\n\t\t: -insertBefore add new z layer and insert it before existing one"
"\n\t\t: -insertAfter add new z layer and insert it after existing one"
"\n\t\t: -delete delete z layer"
"\n\t\t: -get print sequence of z layers"
"\n\t\t: -settings print status of z layer settings"