}
#endif
-static Standard_Boolean MyHLRIsOn = Standard_False;
-
NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)> ViewerTest_myViews;
static NCollection_DoubleMap <TCollection_AsciiString, Handle(AIS_InteractiveContext)> ViewerTest_myContexts;
static NCollection_DoubleMap <TCollection_AsciiString, Handle(Graphic3d_GraphicDriver)> ViewerTest_myDrivers;
//==============================================================================
static int Start_Rot = 0;
+Standard_Boolean HasHlrOnBeforeRotation = Standard_False;
int X_Motion = 0; // Current cursor position
int Y_Motion = 0;
int X_ButtonPress = 0; // Last ButtonPress position
//purpose :
//==============================================================================
-const Handle(MMgt_TShared)& ViewerTest::WClass()
+const Handle(Standard_Transient)& ViewerTest::WClass()
{
- static Handle(MMgt_TShared) theWClass;
+ static Handle(Standard_Transient) theWClass;
#if defined(_WIN32)
if (theWClass.IsNull())
{
theWClass = new WNT_WClass ("GW3D_Class", (Standard_Address )AdvViewerWindowProc,
- CS_VREDRAW | CS_HREDRAW, 0, 0,
- ::LoadCursor (NULL, IDC_ARROW));
+ CS_VREDRAW | CS_HREDRAW, 0, 0,
+ ::LoadCursorW (NULL, IDC_ARROW));
}
#endif
return theWClass;
(ViewerTest_myContexts, TCollection_AsciiString (myDriverName + "/Viewer"));
}
else
+ {
myViewerName = ViewerTest_myContexts.Find2 (ViewerTest::GetAISContext());
+ }
- myViewName = CreateName <Handle(V3d_View)>
- (ViewerTest_myViews, TCollection_AsciiString(myViewerName + "/View"));
+ myViewName = CreateName <Handle(V3d_View)> (ViewerTest_myViews, TCollection_AsciiString(myViewerName + "/View"));
}
else
{
Standard_CString theTitle)
{
#if defined(_WIN32)
- SetWindowText ((HWND)Handle(WNT_Window)::DownCast(theWindow)->HWindow(),
- theTitle);
+ const TCollection_ExtendedString theTitleW (theTitle);
+ SetWindowTextW ((HWND )Handle(WNT_Window)::DownCast(theWindow)->HWindow(), theTitleW.ToWideString());
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
SetCocoaWindowTitle (Handle(Cocoa_Window)::DownCast(theWindow), theTitle);
#else
// Set parameters for V3d_View and V3d_Viewer
const Handle (V3d_View) aV3dView = ViewerTest::CurrentView();
aV3dView->SetComputedMode(Standard_False);
- MyHLRIsOn = aV3dView->ComputedMode();
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
if (toCreateViewer)
return 0;
}
+//! Parse HLR algo type.
+static Standard_Boolean parseHlrAlgoType (const char* theName,
+ Prs3d_TypeOfHLR& theType)
+{
+ TCollection_AsciiString aName (theName);
+ aName.LowerCase();
+ if (aName == "polyalgo")
+ {
+ theType = Prs3d_TOH_PolyAlgo;
+ }
+ else if (aName == "algo")
+ {
+ theType = Prs3d_TOH_Algo;
+ }
+ else
+ {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+
//==============================================================================
//function : VHLR
//purpose : hidden lines removal algorithm
-//draw args: vhlr is_enabled={on|off} [show_hidden={1|0}]
//==============================================================================
static int VHLR (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- if (ViewerTest::CurrentView().IsNull())
+ const Handle(V3d_View) aView = ViewerTest::CurrentView();
+ const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+ if (aView.IsNull())
{
- di << argv[0] << ": Call vinit before this command, please.\n";
+ std::cerr << "Error: No opened viewer!\n";
return 1;
}
- if (argc < 2)
+ Standard_Boolean hasHlrOnArg = Standard_False;
+ Standard_Boolean hasShowHiddenArg = Standard_False;
+ Standard_Boolean isHLROn = Standard_False;
+ Standard_Boolean toShowHidden = aCtx->DefaultDrawer()->DrawHiddenLine();
+ Prs3d_TypeOfHLR aTypeOfHLR = Prs3d_TOH_NotSet;
+ ViewerTest_AutoUpdater anUpdateTool (Handle(AIS_InteractiveContext)(), aView);
+ for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
{
- di << argv[0] << ": Wrong number of command arguments.\n"
- << "Type help " << argv[0] << " for more information.\n";
- return 1;
+ TCollection_AsciiString anArg (argv[anArgIter]);
+ anArg.LowerCase();
+ if (anUpdateTool.parseRedrawMode (anArg))
+ {
+ continue;
+ }
+ else if (anArg == "-showhidden"
+ && anArgIter + 1 < argc
+ && ViewerTest::ParseOnOff (argv[anArgIter + 1], toShowHidden))
+ {
+ ++anArgIter;
+ hasShowHiddenArg = Standard_True;
+ continue;
+ }
+ else if ((anArg == "-type"
+ || anArg == "-algo"
+ || anArg == "-algotype")
+ && anArgIter + 1 < argc
+ && parseHlrAlgoType (argv[anArgIter + 1], aTypeOfHLR))
+ {
+ ++anArgIter;
+ continue;
+ }
+ else if (!hasHlrOnArg
+ && ViewerTest::ParseOnOff (argv[anArgIter], isHLROn))
+ {
+ hasHlrOnArg = Standard_True;
+ continue;
+ }
+ // old syntax
+ else if (!hasShowHiddenArg
+ && ViewerTest::ParseOnOff(argv[anArgIter], toShowHidden))
+ {
+ hasShowHiddenArg = Standard_True;
+ continue;
+ }
+ else
+ {
+ std::cout << "Syntax error at '" << argv[anArgIter] << "'\n";
+ return 1;
+ }
}
-
- // Enable or disable HLR mode.
- Standard_Boolean isHLROn =
- (!strcasecmp (argv[1], "on")) ? Standard_True : Standard_False;
-
- if (isHLROn != MyHLRIsOn)
+ if (!hasHlrOnArg)
{
- MyHLRIsOn = isHLROn;
- ViewerTest::CurrentView()->SetComputedMode (MyHLRIsOn);
+ di << "HLR: " << aView->ComputedMode() << "\n";
+ di << "HiddenLine: " << aCtx->DefaultDrawer()->DrawHiddenLine() << "\n";
+ di << "HlrAlgo: ";
+ switch (aCtx->DefaultDrawer()->TypeOfHLR())
+ {
+ case Prs3d_TOH_NotSet: di << "NotSet\n"; break;
+ case Prs3d_TOH_PolyAlgo: di << "PolyAlgo\n"; break;
+ case Prs3d_TOH_Algo: di << "Algo\n"; break;
+ }
+ anUpdateTool.Invalidate();
+ return 0;
}
- // Show or hide hidden lines in HLR mode.
- Standard_Boolean isCurrentShowHidden
- = ViewerTest::GetAISContext()->DefaultDrawer()->DrawHiddenLine();
-
- Standard_Boolean isShowHidden =
- (argc == 3) ? (atoi(argv[2]) == 1 ? Standard_True : Standard_False)
- : isCurrentShowHidden;
-
-
- if (isShowHidden != isCurrentShowHidden)
+ Standard_Boolean toRecompute = Standard_False;
+ if (aTypeOfHLR != Prs3d_TOH_NotSet
+ && aTypeOfHLR != aCtx->DefaultDrawer()->TypeOfHLR())
+ {
+ toRecompute = Standard_True;
+ aCtx->DefaultDrawer()->SetTypeOfHLR (aTypeOfHLR);
+ }
+ if (toShowHidden != aCtx->DefaultDrawer()->DrawHiddenLine())
{
- if (isShowHidden)
+ toRecompute = Standard_True;
+ if (toShowHidden)
{
- ViewerTest::GetAISContext()->DefaultDrawer()->EnableDrawHiddenLine();
+ aCtx->DefaultDrawer()->EnableDrawHiddenLine();
}
else
{
- ViewerTest::GetAISContext()->DefaultDrawer()->DisableDrawHiddenLine();
+ aCtx->DefaultDrawer()->DisableDrawHiddenLine();
}
+ }
- // Redisplay shapes.
- if (MyHLRIsOn)
+ // redisplay shapes
+ if (aView->ComputedMode() && isHLROn && toRecompute)
+ {
+ AIS_ListOfInteractive aListOfShapes;
+ aCtx->DisplayedObjects (aListOfShapes);
+ for (AIS_ListIteratorOfListOfInteractive anIter (aListOfShapes); anIter.More(); anIter.Next())
{
- AIS_ListOfInteractive aListOfShapes;
- ViewerTest::GetAISContext()->DisplayedObjects (aListOfShapes);
-
- for (AIS_ListIteratorOfListOfInteractive anIter(aListOfShapes); anIter.More(); anIter.Next())
+ if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anIter.Value()))
{
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (anIter.Value());
- if (aShape.IsNull())
- {
- continue;
- }
- ViewerTest::GetAISContext()->Redisplay (aShape, Standard_False);
+ aCtx->Redisplay (aShape, Standard_False);
}
}
}
- ViewerTest::CurrentView()->Update();
+ aView->SetComputedMode (isHLROn);
return 0;
}
//purpose : change type of using HLR algorithm
//==============================================================================
-static int VHLRType (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static int VHLRType (Draw_Interpretor& , Standard_Integer argc, const char** argv)
{
- if (ViewerTest::CurrentView().IsNull())
- {
- di << argv[0] << ": Call vinit before this command, please.\n";
- return 1;
- }
-
- if (argc < 2)
+ const Handle(V3d_View) aView = ViewerTest::CurrentView();
+ const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+ if (aView.IsNull())
{
- di << argv[0] << ": Wrong number of command arguments.\n"
- << "Type help " << argv[0] << " for more information.\n";
+ std::cerr << "Error: No opened viewer!\n";
return 1;
}
- Prs3d_TypeOfHLR aTypeOfHLR =
- (!strcasecmp (argv[1], "algo")) ? Prs3d_TOH_Algo : Prs3d_TOH_PolyAlgo;
-
- if (argc == 2)
+ Prs3d_TypeOfHLR aTypeOfHLR = Prs3d_TOH_NotSet;
+ ViewerTest_AutoUpdater anUpdateTool (Handle(AIS_InteractiveContext)(), aView);
+ AIS_ListOfInteractive aListOfShapes;
+ for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
{
- AIS_ListOfInteractive aListOfShapes;
- ViewerTest::GetAISContext()->DisplayedObjects (aListOfShapes);
- ViewerTest::GetAISContext()->DefaultDrawer()->SetTypeOfHLR(aTypeOfHLR);
- for (AIS_ListIteratorOfListOfInteractive anIter(aListOfShapes);
- anIter.More(); anIter.Next())
+ TCollection_AsciiString anArg (argv[anArgIter]);
+ anArg.LowerCase();
+ if (anUpdateTool.parseRedrawMode (anArg))
{
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anIter.Value());
- if (aShape.IsNull())
- continue;
- if (aShape->TypeOfHLR() != aTypeOfHLR)
- aShape->SetTypeOfHLR (aTypeOfHLR);
- if (MyHLRIsOn)
- ViewerTest::GetAISContext()->Redisplay (aShape, Standard_False);
+ continue;
}
- ViewerTest::CurrentView()->Update();
- return 0;
- }
- else
- {
- for (Standard_Integer i = 2; i < argc; ++i)
+ else if ((anArg == "-type"
+ || anArg == "-algo"
+ || anArg == "-algotype")
+ && anArgIter + 1 < argc
+ && parseHlrAlgoType (argv[anArgIter + 1], aTypeOfHLR))
+ {
+ ++anArgIter;
+ continue;
+ }
+ // old syntax
+ else if (aTypeOfHLR == Prs3d_TOH_NotSet
+ && parseHlrAlgoType (argv[anArgIter], aTypeOfHLR))
+ {
+ continue;
+ }
+ else
{
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- TCollection_AsciiString aName (argv[i]);
-
+ TCollection_AsciiString aName (argv[anArgIter]);
if (!aMap.IsBound2 (aName))
{
- di << argv[0] << ": Wrong shape name:" << aName.ToCString() << ".\n";
- continue;
+ std::cout << "Syntax error: Wrong shape name '" << aName << "'.\n";
+ return 1;
}
- Handle(AIS_Shape) anAISObject =
- Handle(AIS_Shape)::DownCast (aMap.Find2(aName));
- if (anAISObject.IsNull())
- continue;
- anAISObject->SetTypeOfHLR (aTypeOfHLR);
- if (MyHLRIsOn)
- ViewerTest::GetAISContext()->Redisplay (anAISObject, Standard_False);
+
+ Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (aMap.Find2 (aName));
+ if (aShape.IsNull())
+ {
+ std::cout << "Syntax error: '" << aName << "' is not a shape presentation.\n";
+ return 1;
+ }
+ aListOfShapes.Append (aShape);
+ continue;
}
- ViewerTest::CurrentView()->Update();
+ }
+ if (aTypeOfHLR == Prs3d_TOH_NotSet)
+ {
+ std::cout << "Syntax error: wrong number of arguments!\n";
+ return 1;
+ }
+
+ const Standard_Boolean isGlobal = aListOfShapes.IsEmpty();
+ if (isGlobal)
+ {
+ aCtx->DisplayedObjects (aListOfShapes);
+ aCtx->DefaultDrawer()->SetTypeOfHLR (aTypeOfHLR);
}
+ for (AIS_ListIteratorOfListOfInteractive anIter(aListOfShapes); anIter.More(); anIter.Next())
+ {
+ Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anIter.Value());
+ if (aShape.IsNull())
+ {
+ continue;
+ }
+
+ const bool toUpdateShape = aShape->TypeOfHLR() != aTypeOfHLR
+ && aView->ComputedMode();
+ if (!isGlobal
+ || aShape->TypeOfHLR() != aTypeOfHLR)
+ {
+ aShape->SetTypeOfHLR (aTypeOfHLR);
+ }
+ if (toUpdateShape)
+ {
+ aCtx->Redisplay (aShape, Standard_False);
+ }
+ }
return 0;
}
}
ViewerTest::CurrentView (aView);
- // Update degenerate mode
- MyHLRIsOn = ViewerTest::CurrentView()->ComputedMode();
ViewerTest::SetAISContext (anAISContext);
- TCollection_AsciiString aTitle = TCollection_AsciiString("3D View - ");
- aTitle = aTitle + theViewName + "(*)";
+ TCollection_AsciiString aTitle = TCollection_AsciiString("3D View - ") + theViewName + "(*)";
SetWindowTitle (ViewerTest::CurrentView()->Window(), aTitle.ToCString());
-#if defined(_WIN32) || defined(__WIN32__)
+#if defined(_WIN32)
VT_GetWindow() = Handle(WNT_Window)::DownCast(ViewerTest::CurrentView()->Window());
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
VT_GetWindow() = Handle(Cocoa_Window)::DownCast(ViewerTest::CurrentView()->Window());
if (ViewerTest_myViews.Extent() > 1)
{
TCollection_AsciiString aNewViewName;
- for (NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)> :: Iterator
- anIter(ViewerTest_myViews); anIter.More(); anIter.Next())
+ for (NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)>::Iterator anIter (ViewerTest_myViews);
+ anIter.More(); anIter.Next())
+ {
if (anIter.Key1() != theViewName)
{
aNewViewName = anIter.Key1();
break;
}
- ActivateView (aNewViewName);
+ }
+ ActivateView (aNewViewName);
}
else
{
// Remove view resources
ViewerTest_myViews.UnBind1(theViewName);
+ aView->Window()->Unmap();
aView->Remove();
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
(( theArgsNb==1 ) || ( strcasecmp( theArgVec[1], "long" ) != 0 ));
if (isTreeView)
+ {
theDi << theArgVec[0] <<":\n";
+ }
- for (NCollection_DoubleMap <TCollection_AsciiString, Handle(Graphic3d_GraphicDriver)>::Iterator
- aDriverIter(ViewerTest_myDrivers); aDriverIter.More(); aDriverIter.Next())
- {
- if (isTreeView)
- theDi << aDriverIter.Key1() << ":\n";
+ for (NCollection_DoubleMap <TCollection_AsciiString, Handle(Graphic3d_GraphicDriver)>::Iterator aDriverIter (ViewerTest_myDrivers);
+ aDriverIter.More(); aDriverIter.Next())
+ {
+ if (isTreeView)
+ theDi << aDriverIter.Key1() << ":\n";
- for (NCollection_DoubleMap <TCollection_AsciiString, Handle(AIS_InteractiveContext)>::Iterator
- aContextIter(ViewerTest_myContexts); aContextIter.More(); aContextIter.Next())
+ for (NCollection_DoubleMap <TCollection_AsciiString, Handle(AIS_InteractiveContext)>::Iterator
+ aContextIter(ViewerTest_myContexts); aContextIter.More(); aContextIter.Next())
+ {
+ if (aContextIter.Key1().Search(aDriverIter.Key1()) != -1)
{
- if (aContextIter.Key1().Search(aDriverIter.Key1()) != -1)
+ if (isTreeView)
{
- if (isTreeView)
- {
- TCollection_AsciiString aContextName(aContextIter.Key1());
- theDi << " " << aContextName.Split(aDriverIter.Key1().Length() + 1) << ":\n";
- }
+ TCollection_AsciiString aContextName(aContextIter.Key1());
+ theDi << " " << aContextName.Split(aDriverIter.Key1().Length() + 1) << ":\n";
+ }
- for (NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)>::Iterator
- aViewIter(ViewerTest_myViews); aViewIter.More(); aViewIter.Next())
+ for (NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)>::Iterator aViewIter (ViewerTest_myViews);
+ aViewIter.More(); aViewIter.Next())
+ {
+ if (aViewIter.Key1().Search(aContextIter.Key1()) != -1)
{
- if (aViewIter.Key1().Search(aContextIter.Key1()) != -1)
+ TCollection_AsciiString aViewName(aViewIter.Key1());
+ if (isTreeView)
{
- TCollection_AsciiString aViewName(aViewIter.Key1());
- if (isTreeView)
- {
- if (aViewIter.Value() == ViewerTest::CurrentView())
- theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "(*)\n";
- else
- theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "\n";
- }
+ if (aViewIter.Value() == ViewerTest::CurrentView())
+ theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "(*)\n";
else
- {
- theDi << aViewName << " ";
- }
+ theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "\n";
+ }
+ else
+ {
+ theDi << aViewName << " ";
}
}
}
}
}
+ }
return 0;
}
else if (!strcasecmp (buf_ret, "H"))
{
// HLR
- cout << "HLR" << endl;
+ std::cout << "HLR" << std::endl;
aView->SetComputedMode (!aView->ComputedMode());
- MyHLRIsOn = aView->ComputedMode();
+ aView->Redraw();
}
else if (!strcasecmp (buf_ret, "P"))
{
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
if(Ctx->NbSelected()==0)
- Ctx->SetDisplayMode(AIS_Shaded);
+ Ctx->SetDisplayMode (AIS_Shaded, Standard_True);
else{
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
Ctx->SetDisplayMode(Ctx->SelectedInteractive(),1,Standard_False);
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
if(Ctx->NbSelected()==0)
- Ctx->SetDisplayMode(AIS_WireFrame);
+ Ctx->SetDisplayMode (AIS_WireFrame, Standard_True);
else{
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
Ctx->UnsetDisplayMode(Ctx->SelectedInteractive(),Standard_False);
std::cout << "setup WireFrame display mode" << std::endl;
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
if(Ctx->NbSelected()==0)
- Ctx->SetDisplayMode(AIS_WireFrame);
+ Ctx->SetDisplayMode (AIS_WireFrame, Standard_True);
else{
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
Ctx->SetDisplayMode(Ctx->SelectedInteractive(),0,Standard_False);
void VT_ProcessButton3Press()
{
Start_Rot = 1;
- if (MyHLRIsOn)
+ HasHlrOnBeforeRotation = ViewerTest::CurrentView()->ComputedMode();
+ if (HasHlrOnBeforeRotation)
{
ViewerTest::CurrentView()->SetComputedMode (Standard_False);
}
if (Start_Rot)
{
Start_Rot = 0;
- if (MyHLRIsOn)
+ if (HasHlrOnBeforeRotation)
{
+ HasHlrOnBeforeRotation = Standard_False;
ViewerTest::CurrentView()->SetComputedMode (Standard_True);
+ ViewerTest::CurrentView()->Redraw();
}
}
}
if (!GetActiveAISManipulator().IsNull())
{
GetActiveAISManipulator()->StopTransform();
- ViewerTest::GetAISContext()->ClearSelected();
+ ViewerTest::GetAISContext()->ClearSelected (Standard_True);
}
if (ViewerTest::GetAISContext()->IsDisplayed (GetRubberBand()))
if (!GetActiveAISManipulator().IsNull())
{
GetActiveAISManipulator()->StopTransform (Standard_False);
- ViewerTest::GetAISContext()->ClearSelected();
+ ViewerTest::GetAISContext()->ClearSelected (Standard_True);
}
IsDragged = Standard_False;
}
const Handle(V3d_View)& aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- return DefWindowProc( hwnd, Msg, wParam, lParam );
+ return DefWindowProcW (hwnd, Msg, wParam, lParam);
}
PAINTSTRUCT ps;
break;
default:
- return( DefWindowProc( hwnd, Msg, wParam, lParam ));
+ return DefWindowProcW (hwnd, Msg, wParam, lParam);
}
return 0L;
}
-
-
-
//==============================================================================
//function : ViewerMainLoop
//purpose : Get a Event on the view and dispatch it
while ( Ppick == 1 ) {
// Wait for a VT_ProcessButton1Press() to toggle pick to 1 or 0
- if (GetMessage(&msg, NULL, 0, 0) ) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
+ if (GetMessageW (&msg, NULL, 0, 0))
+ {
+ TranslateMessage (&msg);
+ DispatchMessageW (&msg);
}
}
if( DragFirst )
if( ShiftPressed )
{
- aContext->ShiftSelect();
+ aContext->ShiftSelect (Standard_True);
}
else
{
- aContext->Select();
+ aContext->Select (Standard_True);
}
else
if( ShiftPressed )
{
- aContext->ShiftSelect( min( X_ButtonPress, X_Motion ), min( Y_ButtonPress, Y_Motion ),
- max( X_ButtonPress, X_Motion ), max( Y_ButtonPress, Y_Motion ),
- ViewerTest::CurrentView());
+ aContext->ShiftSelect(Min(X_ButtonPress, X_Motion), Min(Y_ButtonPress, Y_Motion),
+ Max(X_ButtonPress, X_Motion), Max(Y_ButtonPress, Y_Motion),
+ ViewerTest::CurrentView(), Standard_True);
}
else
{
- aContext->Select( min( X_ButtonPress, X_Motion ), min( Y_ButtonPress, Y_Motion ),
- max( X_ButtonPress, X_Motion ), max( Y_ButtonPress, Y_Motion ),
- ViewerTest::CurrentView() );
+ aContext->Select(Min(X_ButtonPress, X_Motion), Min(Y_ButtonPress, Y_Motion),
+ Max(X_ButtonPress, X_Motion), Max(Y_ButtonPress, Y_Motion),
+ ViewerTest::CurrentView(), Standard_True);
}
else
VT_ProcessButton3Release();
//function : VRepaint
//purpose :
//==============================================================================
-static int VRepaint (Draw_Interpretor& , Standard_Integer , const char** )
+static int VRepaint (Draw_Interpretor& , Standard_Integer theArgNb, const char** theArgVec)
{
- Handle(V3d_View) V = ViewerTest::CurrentView();
- if ( !V.IsNull() ) V->Redraw(); return 0;
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cout << "Error: no active viewer!\n";
+ return 1;
+ }
+
+ Standard_Boolean isImmediateUpdate = Standard_False;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-immediate")
+ {
+ isImmediateUpdate = Standard_True;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isImmediateUpdate))
+ {
+ ++anArgIter;
+ }
+ }
+ else
+ {
+ std::cout << "Syntax error at '" << anArg << "'\n";
+ }
+ }
+
+ if (isImmediateUpdate)
+ {
+ aView->RedrawImmediate();
+ }
+ else
+ {
+ aView->Redraw();
+ }
+ return 0;
}
//==============================================================================
return 1;
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
try
{
- Standard_DISABLE_DEPRECATION_WARNINGS
if (!V3dView->Export (argv[1], anExpFormat))
- Standard_ENABLE_DEPRECATION_WARNINGS
{
di << "Error: export of image to " << aFormatStr << " failed!\n";
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure const& anException)
{
di << "Error: export of image to " << aFormatStr << " failed";
- di << " (exception: " << Standard_Failure::Caught()->GetMessageString() << ")";
+ di << " (exception: " << anException.GetMessageString() << ")";
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
-//==============================================================================
-//function : VColorScale
-//purpose : representation color scale
-//==============================================================================
-
-static Standard_Boolean checkColor (const TCollection_AsciiString& theRed,
- const TCollection_AsciiString& theGreen,
- const TCollection_AsciiString& theBlue,
- Standard_Real& theRedValue,
- Standard_Real& theGreenValue,
- Standard_Real& theBlueValue)
-{
- if (!theRed.IsRealValue()
- || !theGreen.IsRealValue()
- || !theBlue.IsRealValue())
- {
- std::cout << "Error: RGB color values should be real!\n";
- return Standard_True;
- }
- theRedValue = theRed .RealValue();
- theGreenValue = theGreen.RealValue();
- theBlueValue = theBlue .RealValue();
- if (theRedValue < 0.0 || theRedValue > 1.0
- || theGreenValue < 0.0 || theGreenValue > 1.0
- || theBlueValue < 0.0 || theBlueValue > 1.0)
- {
- std::cout << "Error: RGB color values should be within range 0..1!\n";
- return Standard_True;
- }
- return Standard_False;
-}
-
static int VColorScale (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
return 1;
}
- Handle(AIS_ColorScale) aCS;
- // find object
- Handle(AIS_InteractiveObject) anIObj;
+ Handle(AIS_ColorScale) aColorScale;
if (GetMapOfAIS().IsBound2 (theArgVec[1]))
{
- aCS = Handle(AIS_ColorScale)::DownCast (GetMapOfAIS().Find2 (theArgVec[1]));
- if (aCS.IsNull())
+ // find existing object
+ aColorScale = Handle(AIS_ColorScale)::DownCast (GetMapOfAIS().Find2 (theArgVec[1]));
+ if (aColorScale.IsNull())
{
std::cout << "Error: object '" << theArgVec[1] << "'is already defined and is not a color scale!\n";
return 1;
}
}
- else
- {
- aCS = new AIS_ColorScale();
- GetMapOfAIS().Bind (aCS,theArgVec[1]);
- }
-
- if (aCS->ZLayer() != Graphic3d_ZLayerId_TopOSD)
- {
- aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
- }
- if (aCS->TransformPersistence().IsNull()
- || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
- {
- aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
- }
-
- Standard_Real aMinRange = aCS->GetMin();
- Standard_Real aMaxRange = aCS->GetMax();
- Standard_Integer aBreadth = aCS->GetBreadth();
- Standard_Integer aHeight = aCS->GetHeight();
- Standard_Integer aNbIntervals = aCS->GetNumberOfIntervals();
- Standard_Integer aTextHeight = aCS->GetTextHeight();
- Aspect_TypeOfColorScalePosition aLabPosition = aCS->GetLabelPosition();
- Standard_Integer aPosX = aCS->GetXPosition();
- Standard_Integer aPosY = aCS->GetYPosition();
-
- ViewerTest_AutoUpdater anUpdateTool (aContext, aView);
if (theArgNb <= 2)
{
+ if (aColorScale.IsNull())
+ {
+ std::cout << "Syntax error: colorscale with a given name does not exist.\n";
+ return 1;
+ }
+
theDI << "Color scale parameters for '"<< theArgVec[1] << "':\n"
- << "Min range: " << aMinRange << "\n"
- << "Max range: " << aMaxRange << "\n"
- << "Number of intervals: " << aNbIntervals << "\n"
- << "Text height: " << aTextHeight << "\n"
- << "Color scale position: " << aPosX <<" "<< aPosY<< "\n"
- << "Color scale title: " << aCS->GetTitle() << "\n"
+ << "Min range: " << aColorScale->GetMin() << "\n"
+ << "Max range: " << aColorScale->GetMax() << "\n"
+ << "Number of intervals: " << aColorScale->GetNumberOfIntervals() << "\n"
+ << "Text height: " << aColorScale->GetTextHeight() << "\n"
+ << "Color scale position: " << aColorScale->GetXPosition() << " " << aColorScale->GetYPosition() << "\n"
+ << "Color scale title: " << aColorScale->GetTitle() << "\n"
<< "Label position: ";
- switch (aLabPosition)
+ switch (aColorScale->GetLabelPosition())
{
case Aspect_TOCSP_NONE:
theDI << "None\n";
return 0;
}
+ if (aColorScale.IsNull())
+ {
+ aColorScale = new AIS_ColorScale();
+ aColorScale->SetZLayer (Graphic3d_ZLayerId_TopOSD);
+ aContext->SetTransformPersistence (aColorScale, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
+ }
+
+ ViewerTest_AutoUpdater anUpdateTool (aContext, aView);
for (Standard_Integer anArgIter = 2; anArgIter < theArgNb; ++anArgIter)
{
Standard_CString anArg = theArgVec[anArgIter];
return 1;
}
- TCollection_AsciiString anArg1 (theArgVec[++anArgIter]);
- TCollection_AsciiString anArg2 (theArgVec[++anArgIter]);
- TCollection_AsciiString anArg3 (theArgVec[++anArgIter]);
- if (!anArg1.IsRealValue())
- {
- std::cout << "Error: the minRange value should be real!\n";
- return 1;
- }
- else if (!anArg2.IsRealValue())
+ const TCollection_AsciiString aRangeMin (theArgVec[++anArgIter]);
+ const TCollection_AsciiString aRangeMax (theArgVec[++anArgIter]);
+ const TCollection_AsciiString aNbIntervals (theArgVec[++anArgIter]);
+ if (!aRangeMin.IsRealValue()
+ || !aRangeMax.IsRealValue())
{
- std::cout << "Error: the maxRange value should be real!\n";
+ std::cout << "Error: the range values should be real!\n";
return 1;
}
- else if (!anArg3.IsIntegerValue())
+ else if (!aNbIntervals.IsIntegerValue())
{
std::cout << "Error: the number of intervals should be integer!\n";
return 1;
}
- aMinRange = anArg1.RealValue();
- aMaxRange = anArg2.RealValue();
- aNbIntervals = anArg3.IntegerValue();
+ aColorScale->SetRange (aRangeMin.RealValue(), aRangeMax.RealValue());
+ aColorScale->SetNumberOfIntervals (aNbIntervals.IntegerValue());
}
else if (aFlag == "-font")
{
return 1;
}
- aTextHeight = aFontArg.IntegerValue();
+ aColorScale->SetTextHeight (aFontArg.IntegerValue());
anArgIter += 1;
}
else if (aFlag == "-textpos")
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
return 1;
}
+
TCollection_AsciiString aTextPosArg(theArgVec[++anArgIter]);
aTextPosArg.LowerCase();
+ Aspect_TypeOfColorScalePosition aLabPosition = Aspect_TOCSP_NONE;
if (aTextPosArg == "none")
{
aLabPosition = Aspect_TOCSP_NONE;
std::cout << "Error: unknown position '" << aTextPosArg << "'!\n";
return 1;
}
+ aColorScale->SetLabelPosition (aLabPosition);
}
else if (aFlag == "-logarithmic"
|| aFlag == "-log")
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
return 1;
}
+
Standard_Boolean IsLog;
if (!ViewerTest::ParseOnOff(theArgVec[++anArgIter], IsLog))
{
std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
return 1;
}
- aCS->SetLogarithmic (IsLog);
+ aColorScale->SetLogarithmic (IsLog);
+ }
+ else if (aFlag == "-huerange"
+ || aFlag == "-hue")
+ {
+ if (anArgIter + 2 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ const Standard_Real aHueMin = Draw::Atof (theArgVec[++anArgIter]);
+ const Standard_Real aHueMax = Draw::Atof (theArgVec[++anArgIter]);
+ aColorScale->SetHueRange (aHueMin, aHueMax);
+ }
+ else if (aFlag == "-colorrange")
+ {
+ Quantity_Color aColorMin, aColorMax;
+ Standard_Integer aNbParsed1 = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
+ theArgVec + (anArgIter + 1),
+ aColorMin);
+ anArgIter += aNbParsed1;
+ Standard_Integer aNbParsed2 = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
+ theArgVec + (anArgIter + 1),
+ aColorMax);
+ anArgIter += aNbParsed2;
+ if (aNbParsed1 == 0
+ || aNbParsed2 == 0)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+
+ aColorScale->SetColorRange (aColorMin, aColorMax);
+ }
+ else if (aFlag == "-reversed"
+ || aFlag == "-inverted"
+ || aFlag == "-topdown"
+ || aFlag == "-bottomup")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff(theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aColorScale->SetReversed ((aFlag == "-topdown") ? !toEnable : toEnable);
+ }
+ else if (aFlag == "-smooth"
+ || aFlag == "-smoothtransition")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aColorScale->SetSmoothTransition (toEnable);
}
else if (aFlag == "-xy")
{
return 1;
}
- TCollection_AsciiString aX (theArgVec[++anArgIter]);
- TCollection_AsciiString aY (theArgVec[++anArgIter]);
- if (!aX.IsIntegerValue()
- || !aY.IsIntegerValue())
+ const TCollection_AsciiString anX (theArgVec[++anArgIter]);
+ const TCollection_AsciiString anY (theArgVec[++anArgIter]);
+ if (!anX.IsIntegerValue()
+ || !anY.IsIntegerValue())
{
std::cout << "Error: coordinates should be integer values!\n";
return 1;
}
- aPosX = aX.IntegerValue();
- aPosY = aY.IntegerValue();
+ aColorScale->SetPosition (anX.IntegerValue(), anY.IntegerValue());
}
else if (aFlag == "-width"
- || aFlag == "-w")
+ || aFlag == "-w"
+ || aFlag == "-breadth")
{
if (anArgIter + 1 >= theArgNb)
{
return 1;
}
- TCollection_AsciiString aW (theArgVec[++anArgIter]);
- if (!aW.IsIntegerValue())
+ const TCollection_AsciiString aBreadth (theArgVec[++anArgIter]);
+ if (!aBreadth.IsIntegerValue())
{
std::cout << "Error: a width should be an integer value!\n";
return 1;
}
-
- aBreadth = aW.IntegerValue();
+ aColorScale->SetBreadth (aBreadth.IntegerValue());
}
else if (aFlag == "-height"
|| aFlag == "-h")
return 1;
}
- TCollection_AsciiString aH (theArgVec[++anArgIter]);
- if (!aH.IsIntegerValue())
+ const TCollection_AsciiString aHeight (theArgVec[++anArgIter]);
+ if (!aHeight.IsIntegerValue())
{
std::cout << "Error: a width should be an integer value!\n";
return 1;
}
-
- aHeight = aH.IntegerValue();
+ aColorScale->SetHeight (aHeight.IntegerValue());
}
else if (aFlag == "-color")
{
- if (aCS->GetColorType() != Aspect_TOCSD_USER)
+ if (aColorScale->GetColorType() != Aspect_TOCSD_USER)
{
std::cout << "Error: wrong color type! Call -colors before to set user-specified colors!\n";
return 1;
}
+ else if (anArgIter + 2 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
- Quantity_NameOfColor aColorName;
- if (anArgIter + 4 >= theArgNb)
- {
- if (anArgIter + 2 >= theArgNb)
- {
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
- return 1;
- }
- else if (!Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
- {
- std::cout << "Error: wrong color name: '" << theArgVec[anArgIter + 2] << "' !\n";
- return 1;
- }
- }
-
- TCollection_AsciiString anInd (theArgVec[anArgIter + 1]);
- if (!anInd.IsIntegerValue())
+ const TCollection_AsciiString anInd (theArgVec[++anArgIter]);
+ if (!anInd.IsIntegerValue())
{
std::cout << "Error: Index value should be integer!\n";
return 1;
}
-
- Standard_Integer anIndex = anInd.IntegerValue();
- if (anIndex <= 0 || anIndex > aNbIntervals)
+ const Standard_Integer anIndex = anInd.IntegerValue();
+ if (anIndex <= 0 || anIndex > aColorScale->GetNumberOfIntervals())
{
- std::cout << "Error: Index value should be within range 1.." << aNbIntervals <<"!\n";
+ std::cout << "Error: Index value should be within range 1.." << aColorScale->GetNumberOfIntervals() <<"!\n";
return 1;
}
- if (Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
- {
- aCS->SetIntervalColor (Quantity_Color (aColorName), anIndex);
- aCS->SetColorType (Aspect_TOCSD_USER);
- anArgIter += 2;
- continue;
- }
-
- TCollection_AsciiString aRed (theArgVec[anArgIter + 2]);
- TCollection_AsciiString aGreen (theArgVec[anArgIter + 3]);
- TCollection_AsciiString aBlue (theArgVec[anArgIter + 4]);
- Standard_Real aRedValue,aGreenValue, aBlueValue;
- if(checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
+ theArgVec + (anArgIter + 1),
+ aColor);
+ if (aNbParsed == 0)
{
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
- aCS->SetIntervalColor (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB), anIndex);
- aCS->SetColorType (Aspect_TOCSD_USER);
- anArgIter += 4;
+ aColorScale->SetIntervalColor (aColor, anIndex);
+ aColorScale->SetColorType (Aspect_TOCSD_USER);
+ anArgIter += aNbParsed;
}
else if (aFlag == "-label")
{
- if (aCS->GetColorType() != Aspect_TOCSD_USER)
+ if (aColorScale->GetColorType() != Aspect_TOCSD_USER)
{
std::cout << "Error: wrong label type! Call -labels before to set user-specified labels!\n";
return 1;
}
Standard_Integer anIndex = Draw::Atoi (theArgVec[anArgIter + 1]);
- if (anIndex <= 0 || anIndex > aNbIntervals+1)
+ if (anIndex <= 0 || anIndex > aColorScale->GetNumberOfIntervals() + 1)
{
- std::cout << "Error: Index value should be within range 1.." << aNbIntervals+1 <<"!\n";
+ std::cout << "Error: Index value should be within range 1.." << aColorScale->GetNumberOfIntervals() + 1 <<"!\n";
return 1;
}
TCollection_ExtendedString aText (theArgVec[anArgIter + 2]);
- aCS->SetLabel (aText, anIndex);
- aCS->SetLabelType (Aspect_TOCSD_USER);
+ aColorScale->SetLabel (aText, anIndex);
+ aColorScale->SetLabelType (Aspect_TOCSD_USER);
anArgIter += 2;
}
- else if (aFlag == "-colors")
+ else if (aFlag == "-labelat"
+ || aFlag == "-labat"
+ || aFlag == "-labelatborder"
+ || aFlag == "-labatborder"
+ || aFlag == "-labelatcenter"
+ || aFlag == "-labatcenter")
{
- Aspect_SequenceOfColor aSeq;
- if (anArgIter + aNbIntervals + 1 > theArgNb)
- {
- std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
- << aNbIntervals << " intervals\n";
- return 1;
- }
-
- Standard_Integer aColorIter = anArgIter + 1;
- while (aColorIter < theArgNb)
+ Standard_Boolean toEnable = Standard_True;
+ if (aFlag == "-labelat"
+ || aFlag == "-labat")
{
- if (theArgVec[aColorIter][0] == '-')
- {
- break;
- }
-
- else if (theArgVec[aColorIter][0] >= 97
- && theArgVec[aColorIter][0] <= 122)
+ Standard_Integer aLabAtBorder = -1;
+ if (++anArgIter >= theArgNb)
{
- Quantity_NameOfColor aColorName;
- if (!Quantity_Color::ColorFromName (theArgVec[aColorIter], aColorName))
+ TCollection_AsciiString anAtBorder (theArgVec[anArgIter]);
+ anAtBorder.LowerCase();
+ if (anAtBorder == "border")
{
- std::cout << "Error: wrong color name: " << theArgVec[aColorIter] << " !\n";
- return 1;
+ aLabAtBorder = 1;
}
- aSeq.Append (Quantity_Color (aColorName));
- aColorIter++;
- anArgIter++;
- }
- else
- {
- TCollection_AsciiString aRed (theArgVec[aColorIter]);
- TCollection_AsciiString aGreen (theArgVec[aColorIter + 1]);
- TCollection_AsciiString aBlue (theArgVec[aColorIter + 2]);
- Standard_Real aRedValue,aGreenValue, aBlueValue;
- if (checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
+ else if (anAtBorder == "center")
{
- return 1;
+ aLabAtBorder = 0;
}
- aSeq.Append (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB));
- aColorIter += 3;
- anArgIter += 3;
}
+ if (aLabAtBorder == -1)
+ {
+ std::cout << "Syntax error at argument '" << anArg << "'!\n";
+ return 1;
+ }
+ toEnable = (aLabAtBorder == 1);
}
- if (aSeq.Length() < aNbIntervals)
+ else if (anArgIter + 1 < theArgNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aColorScale->SetLabelAtBorder (aFlag == "-labelatcenter"
+ || aFlag == "-labatcenter"
+ ? !toEnable
+ : toEnable);
+ }
+ else if (aFlag == "-colors")
+ {
+ Aspect_SequenceOfColor aSeq;
+ for (;;)
+ {
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
+ theArgVec + (anArgIter + 1),
+ aColor);
+ if (aNbParsed == 0)
+ {
+ break;
+ }
+ anArgIter += aNbParsed;
+ aSeq.Append (aColor);
+ }
+ if (aSeq.Length() != aColorScale->GetNumberOfIntervals())
{
std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
- << aNbIntervals << " intervals\n";
+ << aColorScale->GetNumberOfIntervals() << " intervals\n";
return 1;
}
- aCS->SetColors (aSeq);
- aCS->SetColorType (Aspect_TOCSD_USER);
+ aColorScale->SetColors (aSeq);
+ aColorScale->SetColorType (Aspect_TOCSD_USER);
}
- else if (aFlag == "-labels")
+ else if (aFlag == "-labels"
+ || aFlag == "-freelabels")
{
- if (anArgIter + aNbIntervals + 1 >= theArgNb)
+ if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: not enough arguments! You should provide " << (aNbIntervals + 1)
- << " text labels for " << aNbIntervals << " intervals.\n";
+ std::cout << "Syntax error at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ Standard_Integer aNbLabels = aColorScale->IsLabelAtBorder()
+ ? aColorScale->GetNumberOfIntervals() + 1
+ : aColorScale->GetNumberOfIntervals();
+ if (aFlag == "-freelabels")
+ {
+ ++anArgIter;
+ aNbLabels = Draw::Atoi (theArgVec[anArgIter]);
+ }
+ if (anArgIter + aNbLabels >= theArgNb)
+ {
+ std::cout << "Error: not enough arguments! " << aNbLabels << " text labels are expected.\n";
return 1;
}
TColStd_SequenceOfExtendedString aSeq;
- for (int aLabelIter = anArgIter + 1; aLabelIter <= anArgIter + aNbIntervals + 1; aLabelIter += 1)
+ for (Standard_Integer aLabelIter = 0; aLabelIter < aNbLabels; ++aLabelIter)
{
- aSeq.Append (TCollection_ExtendedString (theArgVec[aLabelIter]));
+ aSeq.Append (TCollection_ExtendedString (theArgVec[++anArgIter]));
}
- aCS->SetLabels (aSeq);
- aCS->SetLabelType (Aspect_TOCSD_USER);
- anArgIter += aSeq.Length();
+ aColorScale->SetLabels (aSeq);
+ aColorScale->SetLabelType (Aspect_TOCSD_USER);
}
else if (aFlag == "-title")
{
{
TCollection_AsciiString aSecondArg (theArgVec[anArgIter + 2]);
aSecondArg.LowerCase();
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (aSecondArg == "none")
{
- aCS->SetTitlePosition (Aspect_TOCSP_NONE);
+ aColorScale->SetTitlePosition (Aspect_TOCSP_NONE);
isTwoArgs = Standard_True;
}
else if (aSecondArg == "left")
{
- aCS->SetTitlePosition (Aspect_TOCSP_LEFT);
+ aColorScale->SetTitlePosition (Aspect_TOCSP_LEFT);
isTwoArgs = Standard_True;
}
else if (aSecondArg == "right")
{
- aCS->SetTitlePosition (Aspect_TOCSP_RIGHT);
+ aColorScale->SetTitlePosition (Aspect_TOCSP_RIGHT);
isTwoArgs = Standard_True;
}
else if (aSecondArg == "center")
{
- aCS->SetTitlePosition (Aspect_TOCSP_CENTER);
+ aColorScale->SetTitlePosition (Aspect_TOCSP_CENTER);
isTwoArgs = Standard_True;
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
}
- aCS->SetTitle (theArgVec[anArgIter + 1]);
+ aColorScale->SetTitle (theArgVec[anArgIter + 1]);
if (isTwoArgs)
{
anArgIter += 1;
else if (aFlag == "-demoversion"
|| aFlag == "-demo")
{
- aPosX = 0;
- aPosY = 0;
- aTextHeight = 16;
- aMinRange = 0.0;
- aMaxRange = 100;
- aNbIntervals = 10;
- aBreadth = 0;
- aHeight = 0;
- aLabPosition = Aspect_TOCSP_RIGHT;
- aCS->SetColorType (Aspect_TOCSD_AUTO);
- aCS->SetLabelType (Aspect_TOCSD_AUTO);
+ aColorScale->SetPosition (0, 0);
+ aColorScale->SetTextHeight (16);
+ aColorScale->SetRange (0.0, 100.0);
+ aColorScale->SetNumberOfIntervals (10);
+ aColorScale->SetBreadth (0);
+ aColorScale->SetHeight (0);
+ aColorScale->SetLabelPosition (Aspect_TOCSP_RIGHT);
+ aColorScale->SetColorType (Aspect_TOCSD_AUTO);
+ aColorScale->SetLabelType (Aspect_TOCSD_AUTO);
}
else if (aFlag == "-findcolor")
{
}
Quantity_Color aColor;
- aCS->FindColor (anArg1.RealValue(), aColor);
+ aColorScale->FindColor (anArg1.RealValue(), aColor);
theDI << Quantity_Color::StringName (aColor.Name());
return 0;
}
return 1;
}
}
- if (!aBreadth || !aHeight)
+
+ Standard_Integer aWinWidth = 0, aWinHeight = 0;
+ aView->Window()->Size (aWinWidth, aWinHeight);
+ if (aColorScale->GetBreadth() == 0)
{
- Standard_Integer aWinWidth, aWinHeight;
- aView->Window()->Size (aWinWidth, aWinHeight);
- if (!aBreadth)
- {
- aBreadth = aWinWidth;
- }
- if (!aHeight)
- {
- aHeight = aWinHeight;
- }
+ aColorScale->SetBreadth (aWinWidth);
}
- aCS->SetSize (aBreadth, aHeight);
- aCS->SetPosition (aPosX, aPosY);
- aCS->SetTextHeight (aTextHeight);
- aCS->SetRange (aMinRange, aMaxRange);
- aCS->SetNumberOfIntervals (aNbIntervals);
- aCS->SetLabelPosition (aLabPosition);
-// aCS->SetColor (aView->BackgroundColor().Invert());
- aCS->SetToUpdate();
- aContext->Display (aCS);
-
+ if (aColorScale->GetHeight() == 0)
+ {
+ aColorScale->SetHeight (aWinHeight);
+ }
+ aColorScale->SetToUpdate();
+ ViewerTest::Display (theArgVec[1], aColorScale, Standard_False, Standard_True);
return 0;
}
Standard_Real X2 = Draw::Atof(argv[3]);
Standard_Real Y2 = Draw::Atof(argv[4]);
- Standard_Real aWidth = 0.5;
- Standard_Integer aType = 0;
- Standard_Real aTransparency = 1.0;
+ Standard_Real aWidth = 0.5;
+ Standard_Real aTransparency = 1.0;
// has width
if (argc > 5)
aWidth = Draw::Atof(argv[5]);
- // has type
- if (argc > 6)
- aType = (Standard_Integer) Draw::Atoi(argv[6]);
+ // select appropriate line type
+ Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
+ if (argc > 6
+ && !ViewerTest::ParseLineType (argv[6], aLineType))
+ {
+ std::cout << "Syntax error: unknown line type '" << argv[6] << "'\n";
+ return 1;
+ }
// has transparency
if (argc > 7)
aTransparency = 1.0;
}
- // select appropriate line type
- Aspect_TypeOfLine aLineType;
- switch (aType)
- {
- case 1:
- aLineType = Aspect_TOL_DASH;
- break;
-
- case 2:
- aLineType = Aspect_TOL_DOT;
- break;
-
- case 3:
- aLineType = Aspect_TOL_DOTDASH;
- break;
-
- default:
- aLineType = Aspect_TOL_SOLID;
- }
-
static Handle (V3d_LineItem) aLine;
if (!aLine.IsNull())
{
- aContext->Erase (aLine);
+ aContext->Erase (aLine, Standard_False);
}
aLine = new V3d_LineItem (X1, Y1, X2, Y2,
aLineType, aWidth,
Aspect_GridType aType = aViewer->GridType();
Aspect_GridDrawMode aMode = aViewer->GridDrawMode();
-
+ ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
Standard_Integer anIter = 1;
for (; anIter < theArgNb; ++anIter)
{
const char* aValue = theArgVec[anIter];
- if (*aValue == 'r')
+ if (anUpdateTool.parseRedrawMode (aValue))
+ {
+ continue;
+ }
+ else if (*aValue == 'r')
{
aType = Aspect_GT_Rectangular;
}
return 1;
}
- Quantity_Length anOriginX, anOriginY;
- Quantity_PlaneAngle aRotAngle;
+ Standard_Real anOriginX, anOriginY, aRotAngle;
if (aType == Aspect_GT_Rectangular)
{
- Quantity_Length aRStepX, aRStepY;
+ Standard_Real aRStepX, aRStepY;
aViewer->RectangularGridValues (anOriginX, anOriginY, aRStepX, aRStepY, aRotAngle);
anOriginX = Draw::Atof (theArgVec[anIter++]);
}
else if (aType == Aspect_GT_Circular)
{
- Quantity_Length aRadiusStep;
+ Standard_Real aRadiusStep;
Standard_Integer aDivisionNumber;
aViewer->CircularGridValues (anOriginX, anOriginY, aRadiusStep, aDivisionNumber, aRotAngle);
{
switch (aMode)
{
- case View : theDI << "View Vv: " << aView->Convert ((Standard_Integer) aCoord (1)); return 0;
- case Window : theDI << "Window Vp: " << aView->Convert ((Quantity_Length) aCoord (1)); return 0;
+ case View : theDI << "View Vv: " << aView->Convert ((Standard_Integer)aCoord (1)); return 0;
+ case Window : theDI << "Window Vp: " << aView->Convert (aCoord (1)); return 0;
default:
std::cerr << "Error: wrong arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 0;
case Window :
- aView->Convert ((V3d_Coordinate) aCoord (1), (V3d_Coordinate) aCoord (2), aXYp[0], aXYp[1]);
+ aView->Convert (aCoord (1), aCoord (2), aXYp[0], aXYp[1]);
theDI << "Window Xp,Yp: " << aXYp[0] << " " << aXYp[1] << "\n";
return 0;
theDI << "VSync: " << aCaps->swapInterval << "\n";
theDI << "Compatible:" << (aCaps->contextCompatible ? "1" : "0") << "\n";
theDI << "Stereo: " << (aCaps->contextStereo ? "1" : "0") << "\n";
+ theDI << "WinBuffer: " << (aCaps->useSystemBuffer ? "1" : "0") << "\n";
return 0;
}
}
aCaps->contextNoAccel = toEnable;
}
+ else if (anArgCase == "-winbuffer"
+ || anArgCase == "-windowbuffer"
+ || anArgCase == "-usewinbuffer"
+ || anArgCase == "-usewindowbuffer"
+ || anArgCase == "-usesystembuffer")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->useSystemBuffer = toEnable;
+ }
else if (anArgCase == "-accel"
|| anArgCase == "-acceleration")
{
return 1;
}
- Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgRGBA;
- Graphic3d_BufferType aBufferType = Graphic3d_BT_RGBA;
+ Image_Format aFormat = Image_Format_RGBA;
+ Graphic3d_BufferType aBufferType = Graphic3d_BT_RGBA;
Standard_Integer aWidth, aHeight;
aView->Window()->Size (aWidth, aHeight);
Standard_Boolean toShowHls = Standard_False;
for (Standard_Integer anIter = 3; anIter < theArgNb; ++anIter)
{
- const char* aParam = theArgVec[anIter];
- if ( strcasecmp( aParam, "rgb" ) == 0 )
+ TCollection_AsciiString aParam (theArgVec[anIter]);
+ aParam.LowerCase();
+ if (aParam == "rgb")
{
- aFormat = Image_PixMap::ImgRGB;
+ aFormat = Image_Format_RGB;
aBufferType = Graphic3d_BT_RGB;
}
- else if ( strcasecmp( aParam, "hls" ) == 0 )
+ else if (aParam == "hls")
{
- aFormat = Image_PixMap::ImgRGB;
+ aFormat = Image_Format_RGB;
aBufferType = Graphic3d_BT_RGB;
toShowHls = Standard_True;
}
- else if ( strcasecmp( aParam, "rgbf" ) == 0 )
+ else if (aParam == "rgbf")
{
- aFormat = Image_PixMap::ImgRGBF;
+ aFormat = Image_Format_RGBF;
aBufferType = Graphic3d_BT_RGB;
}
- else if ( strcasecmp( aParam, "rgba" ) == 0 )
+ else if (aParam == "rgba")
{
- aFormat = Image_PixMap::ImgRGBA;
+ aFormat = Image_Format_RGBA;
aBufferType = Graphic3d_BT_RGBA;
}
- else if ( strcasecmp( aParam, "rgbaf" ) == 0 )
+ else if (aParam == "rgbaf")
{
- aFormat = Image_PixMap::ImgRGBAF;
+ aFormat = Image_Format_RGBAF;
aBufferType = Graphic3d_BT_RGBA;
}
- else if ( strcasecmp( aParam, "depth" ) == 0 )
+ else if (aParam == "depth")
{
- aFormat = Image_PixMap::ImgGrayF;
+ aFormat = Image_Format_GrayF;
aBufferType = Graphic3d_BT_Depth;
}
- else if ( strcasecmp( aParam, "name" ) == 0 )
+ else if (aParam == "name")
{
toShowName = Standard_True;
}
return 1;
}
- Quantity_Parameter anAlpha;
- Quantity_Color aColor = anImage.PixelColor (anX, anY, anAlpha);
+ Quantity_ColorRGBA aColor = anImage.PixelColor (anX, anY);
if (toShowName)
{
if (aBufferType == Graphic3d_BT_RGBA)
{
- theDI << Quantity_Color::StringName (aColor.Name()) << " " << anAlpha;
+ theDI << Quantity_Color::StringName (aColor.GetRGB().Name()) << " " << aColor.Alpha();
}
else
{
- theDI << Quantity_Color::StringName (aColor.Name());
+ theDI << Quantity_Color::StringName (aColor.GetRGB().Name());
}
}
else
{
if (toShowHls)
{
- theDI << aColor.Hue() << " " << aColor.Light() << " " << aColor.Saturation();
+ theDI << aColor.GetRGB().Hue() << " " << aColor.GetRGB().Light() << " " << aColor.GetRGB().Saturation();
}
else
{
- theDI << aColor.Red() << " " << aColor.Green() << " " << aColor.Blue();
+ theDI << aColor.GetRGB().Red() << " " << aColor.GetRGB().Green() << " " << aColor.GetRGB().Blue();
}
break;
}
case Graphic3d_BT_RGBA:
{
- theDI << aColor.Red() << " " << aColor.Green() << " " << aColor.Blue() << " " << anAlpha;
+ theDI << aColor.GetRGB().Red() << " " << aColor.GetRGB().Green() << " " << aColor.GetRGB().Blue() << " " << aColor.Alpha();
break;
}
case Graphic3d_BT_Depth:
{
- theDI << aColor.Red();
+ theDI << aColor.GetRGB().Red();
break;
}
}
Standard_Boolean toSetScale = Standard_False;
Standard_Boolean toSetSize = Standard_False;
Standard_Boolean toSetCenter2d = Standard_False;
- Quantity_Factor aViewScale = aView->Scale();
- Quantity_Length aViewSize = 1.0;
+ Standard_Real aViewScale = aView->Scale();
+ Standard_Real aViewSize = 1.0;
Graphic3d_Vec2i aCenter2d;
gp_XYZ aViewProj, aViewUp, aViewAt, aViewEye;
aView->Proj (aViewProj.ChangeCoord (1), aViewProj.ChangeCoord (2), aViewProj.ChangeCoord (3));
return 1;
}
- aContext->AddOrRemoveSelected(anAISObject);
+ aContext->AddOrRemoveSelected(anAISObject, Standard_True);
}
return 0;
}
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
- aContext->CloseAllContexts(Standard_False);
+
di << aContext->PurgeDisplay() << "\n";
return 0;
}
return 1;
}
- Standard_Real anXYZ[3];
- Quantity_Coefficient anAtten[2];
+ Standard_Real anXYZ[3] = {};
+ Standard_Real anAtten[2] = {};
if (theArgsNb < 2)
{
// print lights info
case Graphic3d_RM_RAYTRACING: theDI << "raytrace "; break;
}
theDI << "\n";
- theDI << "msaa: " << aParams.NbMsaaSamples << "\n";
- theDI << "rayDepth: " << aParams.RaytracingDepth << "\n";
- theDI << "fsaa: " << (aParams.IsAntialiasingEnabled ? "on" : "off") << "\n";
- theDI << "shadows: " << (aParams.IsShadowEnabled ? "on" : "off") << "\n";
- theDI << "reflections: " << (aParams.IsReflectionEnabled ? "on" : "off") << "\n";
- theDI << "gleam: " << (aParams.IsTransparentShadowEnabled ? "on" : "off") << "\n";
- theDI << "GI: " << (aParams.IsGlobalIlluminationEnabled ? "on" : "off") << "\n";
- theDI << "blocked RNG: " << (aParams.CoherentPathTracingMode ? "on" : "off") << "\n";
- theDI << "iss: " << (aParams.AdaptiveScreenSampling ? "on" : "off") << "\n";
- theDI << "iss debug: " << (aParams.ShowSamplingTiles ? "on" : "off") << "\n";
+ theDI << "transparency: ";
+ switch (aParams.TransparencyMethod)
+ {
+ case Graphic3d_RTM_BLEND_UNORDERED: theDI << "Basic blended transparency with non-commuting operator "; break;
+ case Graphic3d_RTM_BLEND_OIT: theDI << "Weighted Blended Order-Independent Transparency, depth weight factor: "
+ << TCollection_AsciiString (aParams.OitDepthFactor); break;
+ }
+ theDI << "\n";
+ theDI << "msaa: " << aParams.NbMsaaSamples << "\n";
+ theDI << "rendScale: " << aParams.RenderResolutionScale << "\n";
+ theDI << "rayDepth: " << aParams.RaytracingDepth << "\n";
+ theDI << "fsaa: " << (aParams.IsAntialiasingEnabled ? "on" : "off") << "\n";
+ theDI << "shadows: " << (aParams.IsShadowEnabled ? "on" : "off") << "\n";
+ theDI << "reflections: " << (aParams.IsReflectionEnabled ? "on" : "off") << "\n";
+ theDI << "gleam: " << (aParams.IsTransparentShadowEnabled ? "on" : "off") << "\n";
+ theDI << "GI: " << (aParams.IsGlobalIlluminationEnabled ? "on" : "off") << "\n";
+ theDI << "blocked RNG: " << (aParams.CoherentPathTracingMode ? "on" : "off") << "\n";
+ theDI << "iss: " << (aParams.AdaptiveScreenSampling ? "on" : "off") << "\n";
+ theDI << "iss debug: " << (aParams.ShowSamplingTiles ? "on" : "off") << "\n";
+ theDI << "two-sided BSDF: " << (aParams.TwoSidedBsdfModels ? "on" : "off") << "\n";
+ theDI << "max radiance: " << aParams.RadianceClampingValue << "\n";
+ theDI << "nb tiles (iss): " << aParams.NbRayTracingTiles << "\n";
theDI << "shadingModel: ";
switch (aView->ShadingModel())
{
aParams.NbMsaaSamples = aNbSamples;
}
}
+ else if (aFlag == "-oit")
+ {
+ if (toPrint)
+ {
+ if (aParams.TransparencyMethod == Graphic3d_RTM_BLEND_OIT)
+ {
+ theDI << "on, depth weight factor: " << TCollection_AsciiString (aParams.OitDepthFactor) << " ";
+ }
+ else
+ {
+ theDI << "off" << " ";
+ }
+ continue;
+ }
+ else if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aParam = theArgVec[anArgIter];
+ aParam.LowerCase();
+ if (aParam.IsRealValue())
+ {
+ const Standard_ShortReal aWeight = (Standard_ShortReal) Draw::Atof (theArgVec[anArgIter]);
+ if (aWeight < 0.f || aWeight > 1.f)
+ {
+ std::cerr << "Error: invalid value of Weighted Order-Independent Transparency depth weight factor " << aWeight << ". Should be within range [0.0; 1.0]\n";
+ return 1;
+ }
+
+ aParams.TransparencyMethod = Graphic3d_RTM_BLEND_OIT;
+ aParams.OitDepthFactor = aWeight;
+ }
+ else if (aParam == "off")
+ {
+ aParams.TransparencyMethod = Graphic3d_RTM_BLEND_UNORDERED;
+ }
+ else
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-rendscale"
+ || aFlag == "-renderscale"
+ || aFlag == "-renderresolutionscale")
+ {
+ if (toPrint)
+ {
+ theDI << aParams.RenderResolutionScale << " ";
+ continue;
+ }
+ else if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ const Standard_Real aScale = Draw::Atof (theArgVec[anArgIter]);
+ if (aScale < 0.01)
+ {
+ std::cerr << "Error: invalid rendering resolution scale " << aScale << ".\n";
+ return 1;
+ }
+ else
+ {
+ aParams.RenderResolutionScale = Standard_ShortReal(aScale);
+ }
+ }
else if (aFlag == "-raydepth"
|| aFlag == "-ray_depth")
{
}
aParams.CoherentPathTracingMode = toEnable;
}
+ else if (aFlag == "-maxrad")
+ {
+ if (toPrint)
+ {
+ theDI << aParams.RadianceClampingValue << " ";
+ continue;
+ }
+ else if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ const TCollection_AsciiString aMaxRadStr = theArgVec[anArgIter];
+ if (!aMaxRadStr.IsRealValue())
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ const Standard_Real aMaxRadiance = aMaxRadStr.RealValue();
+ if (aMaxRadiance <= 0.0)
+ {
+ std::cerr << "Error: invalid radiance clamping value " << aMaxRadiance << ".\n";
+ return 1;
+ }
+ else
+ {
+ aParams.RadianceClampingValue = static_cast<Standard_ShortReal> (aMaxRadiance);
+ }
+ }
else if (aFlag == "-iss")
{
if (toPrint)
}
aParams.ShowSamplingTiles = toEnable;
}
+ else if (aFlag == "-nbtiles")
+ {
+ if (toPrint)
+ {
+ theDI << aParams.NbRayTracingTiles << " ";
+ continue;
+ }
+ else if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ const Standard_Integer aNbTiles = Draw::Atoi (theArgVec[anArgIter]);
+
+ if (aNbTiles < 64)
+ {
+ std::cerr << "Error: invalid number of ISS tiles " << aNbTiles << ".\n";
+ std::cerr << "Specify value in range [64, 1024].\n";
+ return 1;
+ }
+ else
+ {
+ aParams.NbRayTracingTiles = aNbTiles;
+ }
+ }
else if (aFlag == "-env")
{
if (toPrint)
}
aParams.UseEnvironmentMapBackground = toEnable;
}
+ else if (aFlag == "-twoside")
+ {
+ if (toPrint)
+ {
+ theDI << (aParams.TwoSidedBsdfModels ? "on" : "off") << " ";
+ continue;
+ }
+
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aParams.TwoSidedBsdfModels = toEnable;
+ }
else if (aFlag == "-shademodel"
|| aFlag == "-shadingmodel"
|| aFlag == "-shading")
}
aParams.RebuildRayTracingShaders = toEnable;
}
+ else if (aFlag == "-focal")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aParam (theArgVec[anArgIter]);
+ if (aParam.IsRealValue())
+ {
+ float aFocalDist = static_cast<float> (aParam.RealValue());
+ if (aFocalDist < 0)
+ {
+ std::cout << "Error: parameter can't be negative at argument '" << anArg << "'.\n";
+ return 1;
+ }
+ aView->ChangeRenderingParams().CameraFocalPlaneDist = aFocalDist;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-aperture")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aParam(theArgVec[anArgIter]);
+ if (aParam.IsRealValue())
+ {
+ float aApertureSize = static_cast<float> (aParam.RealValue());
+ if (aApertureSize < 0)
+ {
+ std::cout << "Error: parameter can't be negative at argument '" << anArg << "'.\n";
+ return 1;
+ }
+ aView->ChangeRenderingParams().CameraApertureRadius = aApertureSize;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-exposure")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString anExposure (theArgVec[anArgIter]);
+ if (anExposure.IsRealValue())
+ {
+ aView->ChangeRenderingParams().Exposure = static_cast<float> (anExposure.RealValue());
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-whitepoint")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aWhitePoint (theArgVec[anArgIter]);
+ if (aWhitePoint.IsRealValue())
+ {
+ aView->ChangeRenderingParams().WhitePoint = static_cast<float> (aWhitePoint.RealValue());
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-tonemapping")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aMode (theArgVec[anArgIter]);
+ aMode.LowerCase();
+
+ if (aMode == "disabled")
+ {
+ aView->ChangeRenderingParams().ToneMappingMethod = Graphic3d_ToneMappingMethod_Disabled;
+ }
+ else if (aMode == "filmic")
+ {
+ aView->ChangeRenderingParams().ToneMappingMethod = Graphic3d_ToneMappingMethod_Filmic;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ return 1;
+ }
+ }
else
{
std::cout << "Error: wrong syntax, unknown flag '" << anArg << "'\n";
Standard_Boolean toExit = Standard_False;
MSG aMsg;
- while (PeekMessage (&aMsg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageW (&aMsg, NULL, 0, 0, PM_REMOVE))
{
if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b))
{
}
TranslateMessage (&aMsg);
- DispatchMessage (&aMsg);
+ DispatchMessageW (&aMsg);
}
if (toExit)
aManipulator->Detach();
aMapAIS.UnBind2 (aName);
- ViewerTest::GetAISContext()->Remove (aManipulator);
+ ViewerTest::GetAISContext()->Remove (aManipulator, Standard_True);
return 0;
}
aManipulator->Transform (aT);
}
- ViewerTest::GetAISContext()->Redisplay (aManipulator);
+ ViewerTest::GetAISContext()->Redisplay (aManipulator, Standard_True);
return 0;
}
-//===============================================================================================
-//function : parseColor
-//purpose :
-//===============================================================================================
-static Standard_Boolean parseColor (ViewerTest_CmdParser& theParser,
- const std::string& theOptionName,
- Quantity_Color& theColor)
-{
- std::string aColorArg = theParser.Arg (theOptionName, 0);
- if (std::isdigit (aColorArg[0]))
- {
- Graphic3d_Vec3d aColor = theParser.ArgVec3d (theOptionName);
- if (aColor.x() < 0.0 || aColor.x() > 1.0
- || aColor.y() < 0.0 || aColor.y() > 1.0
- || aColor.z() < 0.0 || aColor.z() > 1.0)
- {
- std::cerr << "Error: RGB color values should be within range 0..1!\n";
- return Standard_False;
- }
- theColor.SetValues (aColor.x(), aColor.y(), aColor.z(), Quantity_TOC_RGB);
- }
- else
- {
- Quantity_NameOfColor aName = Quantity_NOC_BLACK;
- if (!Quantity_Color::ColorFromName (aColorArg.c_str(), aName))
- {
- std::cerr << "Name: " << theParser.Arg (theOptionName, 0)
- << " does not correspond to any color in Quantity_NameOfColor!"
- << std::endl;
- return Standard_False;
- }
- theColor.SetValues (aName);
- }
-
- return Standard_True;
-}
-
//===============================================================================================
//function : VSelectionProperties
//purpose :
return 1;
}
- ViewerTest_CmdParser aCmd;
+ Standard_Boolean toPrint = theArgsNb == 1;
+ Standard_Boolean toRedraw = Standard_False;
+ Standard_Integer anArgIter = 1;
+ Prs3d_TypeOfHighlight aType = Prs3d_TypeOfHighlight_None;
+ if (anArgIter < theArgsNb)
+ {
+ TCollection_AsciiString anArgFirst (theArgVec[anArgIter]);
+ anArgFirst.LowerCase();
+ ++anArgIter;
+ if (anArgFirst == "dynhighlight"
+ || anArgFirst == "dynhilight"
+ || anArgFirst == "dynamichighlight"
+ || anArgFirst == "dynamichilight")
+ {
+ aType = Prs3d_TypeOfHighlight_Dynamic;
+ }
+ else if (anArgFirst == "localdynhighlight"
+ || anArgFirst == "localdynhilight"
+ || anArgFirst == "localdynamichighlight"
+ || anArgFirst == "localdynamichilight")
+ {
+ aType = Prs3d_TypeOfHighlight_LocalDynamic;
+ }
+ else if (anArgFirst == "selhighlight"
+ || anArgFirst == "selhilight"
+ || anArgFirst == "selectedhighlight"
+ || anArgFirst == "selectedhilight")
+ {
+ aType = Prs3d_TypeOfHighlight_Selected;
+ }
+ else if (anArgFirst == "localselhighlight"
+ || anArgFirst == "localselhilight"
+ || anArgFirst == "localselectedhighlight"
+ || anArgFirst == "localselectedhilight")
+ {
+ aType = Prs3d_TypeOfHighlight_LocalSelected;
+ }
+ else
+ {
+ --anArgIter;
+ }
+ }
+ for (; anArgIter < theArgsNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-help")
+ {
+ theDi.PrintHelp (theArgVec[0]);
+ return 0;
+ }
+ else if (anArg == "-print")
+ {
+ toPrint = Standard_True;
+ }
+ else if (anArg == "-autoactivate")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (anArgIter + 1 < theArgsNb
+ && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
+ {
+ ++anArgIter;
+ }
+ aCtx->SetAutoActivateSelection (toEnable);
+ }
+ else if (anArg == "-pickstrategy"
+ || anArg == "-pickingstrategy")
+ {
+ if (++anArgIter >= theArgsNb)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.AddOption ("autoActivate");
- aCmd.AddOption ("pixTol");
+ SelectMgr_PickingStrategy aStrategy = SelectMgr_PickingStrategy_FirstAcceptable;
+ TCollection_AsciiString aVal (theArgVec[anArgIter]);
+ aVal.LowerCase();
+ if (aVal == "first"
+ || aVal == "firstaccepted"
+ || aVal == "firstacceptable")
+ {
+ aStrategy = SelectMgr_PickingStrategy_FirstAcceptable;
+ }
+ else if (aVal == "topmost"
+ || aVal == "onlyTopmost")
+ {
+ aStrategy = SelectMgr_PickingStrategy_OnlyTopmost;
+ }
+ else
+ {
+ std::cout << "Syntax error: unknwon picking strategy '" << aVal << "'\n";
+ return 1;
+ }
- aCmd.AddOption ("selColor");
- aCmd.AddOption ("hiColor");
- aCmd.AddOption ("selTransp");
- aCmd.AddOption ("hiTransp");
+ aCtx->SetPickingStrategy (aStrategy);
+ }
+ else if (anArg == "-pixtol"
+ && anArgIter + 1 < theArgsNb)
+ {
+ aCtx->SetPixelTolerance (Draw::Atoi (theArgVec[++anArgIter]));
+ }
+ else if ((anArg == "-mode"
+ || anArg == "-dispmode")
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.AddOption ("print");
+ const Standard_Integer aDispMode = Draw::Atoi (theArgVec[++anArgIter]);
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetDisplayMode (aDispMode);
+ toRedraw = Standard_True;
+ }
+ else if (anArg == "-layer"
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
- aCmd.Parse (theArgsNb, theArgVec);
+ const Standard_Integer aNewLayer = Draw::Atoi (theArgVec[++anArgIter]);
+ if (aNewLayer != Graphic3d_ZLayerId_UNKNOWN)
+ {
+ TColStd_SequenceOfInteger aLayers;
+ aCtx->CurrentViewer()->GetAllZLayers (aLayers);
+ if (std::find (aLayers.begin(), aLayers.end(), aNewLayer) == aLayers.end())
+ {
+ std::cout << "Syntax error: Layer " << aNewLayer << " is undefined\n";
+ return 1;
+ }
+ }
- if (aCmd.HasOption ("help"))
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetZLayer (aNewLayer);
+ toRedraw = Standard_True;
+ }
+ else if (anArg == "-hicolor"
+ || anArg == "-selcolor"
+ || anArg == "-color")
+ {
+ if (anArg.StartsWith ("-hi"))
+ {
+ aType = Prs3d_TypeOfHighlight_Dynamic;
+ }
+ else if (anArg.StartsWith ("-sel"))
+ {
+ aType = Prs3d_TypeOfHighlight_Selected;
+ }
+ else if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
+
+ Quantity_Color aColor;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aColor);
+ if (aNbParsed == 0)
+ {
+ std::cout << "Syntax error: need more arguments.\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
+
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetColor (aColor);
+ toRedraw = Standard_True;
+ }
+ else if ((anArg == "-transp"
+ || anArg == "-transparency"
+ || anArg == "-hitransp"
+ || anArg == "-seltransp"
+ || anArg == "-hitransplocal"
+ || anArg == "-seltransplocal")
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (anArg.StartsWith ("-hi"))
+ {
+ aType = Prs3d_TypeOfHighlight_Dynamic;
+ }
+ else if (anArg.StartsWith ("-sel"))
+ {
+ aType = Prs3d_TypeOfHighlight_Selected;
+ }
+ else if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
+
+ const Standard_Real aTransp = Draw::Atof (theArgVec[++anArgIter]);
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ aStyle->SetTransparency ((Standard_ShortReal )aTransp);
+ toRedraw = Standard_True;
+ }
+ else if ((anArg == "-mat"
+ || anArg == "-material")
+ && anArgIter + 1 < theArgsNb)
+ {
+ if (aType == Prs3d_TypeOfHighlight_None)
+ {
+ std::cout << "Syntax error: type of highlighting is undefined\n";
+ return 1;
+ }
+
+ const Handle(Prs3d_Drawer)& aStyle = aCtx->HighlightStyle (aType);
+ Graphic3d_NameOfMaterial aMatName = Graphic3d_MaterialAspect::MaterialFromName (theArgVec[anArgIter + 1]);
+ if (aMatName != Graphic3d_NOM_DEFAULT)
+ {
+ ++anArgIter;
+ Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
+ *anAspect = *aCtx->DefaultDrawer()->ShadingAspect()->Aspect();
+ Graphic3d_MaterialAspect aMat (aMatName);
+ aMat.SetColor (aStyle->Color());
+ aMat.SetTransparency (aStyle->Transparency());
+ anAspect->SetFrontMaterial (aMat);
+ anAspect->SetInteriorColor (aStyle->Color());
+ aStyle->SetBasicFillAreaAspect (anAspect);
+ }
+ else
+ {
+ aStyle->SetBasicFillAreaAspect (Handle(Graphic3d_AspectFillArea3d)());
+ }
+ toRedraw = Standard_True;
+ }
+ else
+ {
+ std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ }
+ }
+
+ if (toPrint)
{
- theDi.PrintHelp (theArgVec[0]);
- return 0;
+ const Handle(Prs3d_Drawer)& aHiStyle = aCtx->HighlightStyle();
+ const Handle(Prs3d_Drawer)& aSelStyle = aCtx->SelectionStyle();
+ theDi << "Auto-activation : " << (aCtx->GetAutoActivateSelection() ? "On" : "Off") << "\n";
+ theDi << "Selection pixel tolerance : " << aCtx->MainSelector()->PixelTolerance() << "\n";
+ theDi << "Selection color : " << Quantity_Color::StringName (aSelStyle->Color().Name()) << "\n";
+ theDi << "Dynamic highlight color : " << Quantity_Color::StringName (aHiStyle->Color().Name()) << "\n";
+ theDi << "Selection transparency : " << aSelStyle->Transparency() << "\n";
+ theDi << "Dynamic highlight transparency : " << aHiStyle->Transparency() << "\n";
+ theDi << "Selection mode : " << aSelStyle->DisplayMode() << "\n";
+ theDi << "Dynamic highlight mode : " << aHiStyle->DisplayMode() << "\n";
+ theDi << "Selection layer : " << aSelStyle->ZLayer() << "\n";
+ theDi << "Dynamic layer : " << aHiStyle->ZLayer() << "\n";
}
- if (aCmd.HasOption ("autoActivate", 1, Standard_False))
+ if (aCtx->NbSelected() != 0 && toRedraw)
{
- aCtx->SetAutoActivateSelection (aCmd.ArgBool ("autoActivate"));
+ aCtx->HilightSelected (Standard_True);
}
- if (aCmd.HasOption ("pixTol", 1, Standard_False))
+
+ return 0;
+}
+
+//===============================================================================================
+//function : VDumpSelectionImage
+//purpose :
+//===============================================================================================
+static int VDumpSelectionImage (Draw_Interpretor& /*theDi*/,
+ Standard_Integer theArgsNb,
+ const char** theArgVec)
+{
+ if (theArgsNb < 2)
{
- aCtx->SetPixelTolerance (aCmd.ArgInt ("pixTol"));
+ std::cout << "Syntax error: wrong number arguments for '" << theArgVec[0] << "'\n";
+ return 1;
}
- const Handle(Graphic3d_HighlightStyle)& aHiStyle = aCtx->HighlightStyle();
- const Handle(Graphic3d_HighlightStyle)& aSelStyle = aCtx->SelectionStyle();
- Standard_Boolean toRedraw = Standard_False;
- if (aCmd.HasOption ("selColor"))
+ const Handle(AIS_InteractiveContext)& aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
{
- Quantity_Color aNewColor;
- if (!parseColor (aCmd, "selColor", aNewColor))
- return 1;
- aSelStyle->SetColor (aNewColor);
- toRedraw = Standard_True;
+ std::cout << "Error: no active view.\n";
+ return 1;
}
- if (aCmd.HasOption ("hiColor"))
+
+ TCollection_AsciiString aFile;
+ StdSelect_TypeOfSelectionImage aType = StdSelect_TypeOfSelectionImage_NormalizedDepth;
+ Image_Format anImgFormat = Image_Format_BGR;
+ Standard_Integer aPickedIndex = 1;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{
- Quantity_Color aNewColor;
- if (!parseColor (aCmd, "hiColor", aNewColor))
+ TCollection_AsciiString aParam (theArgVec[anArgIter]);
+ aParam.LowerCase();
+ if (aParam == "-type")
+ {
+ if (++anArgIter >= theArgsNb)
+ {
+ std::cout << "Syntax error: wrong number parameters of flag '-depth'.\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aValue (theArgVec[anArgIter]);
+ aValue.LowerCase();
+ if (aValue == "depth"
+ || aValue == "normdepth"
+ || aValue == "normalizeddepth")
+ {
+ aType = StdSelect_TypeOfSelectionImage_NormalizedDepth;
+ anImgFormat = Image_Format_GrayF;
+ }
+ if (aValue == "depthinverted"
+ || aValue == "normdepthinverted"
+ || aValue == "normalizeddepthinverted"
+ || aValue == "inverted")
+ {
+ aType = StdSelect_TypeOfSelectionImage_NormalizedDepthInverted;
+ anImgFormat = Image_Format_GrayF;
+ }
+ else if (aValue == "unnormdepth"
+ || aValue == "unnormalizeddepth")
+ {
+ aType = StdSelect_TypeOfSelectionImage_UnnormalizedDepth;
+ anImgFormat = Image_Format_GrayF;
+ }
+ else if (aValue == "objectcolor"
+ || aValue == "object"
+ || aValue == "color")
+ {
+ aType = StdSelect_TypeOfSelectionImage_ColoredDetectedObject;
+ }
+ else if (aValue == "entitycolor"
+ || aValue == "entity")
+ {
+ aType = StdSelect_TypeOfSelectionImage_ColoredEntity;
+ }
+ else if (aValue == "ownercolor"
+ || aValue == "owner")
+ {
+ aType = StdSelect_TypeOfSelectionImage_ColoredOwner;
+ }
+ else if (aValue == "selectionmodecolor"
+ || aValue == "selectionmode"
+ || aValue == "selmodecolor"
+ || aValue == "selmode")
+ {
+ aType = StdSelect_TypeOfSelectionImage_ColoredSelectionMode;
+ }
+ }
+ else if (aParam == "-picked"
+ || aParam == "-pickeddepth"
+ || aParam == "-pickedindex")
+ {
+ if (++anArgIter >= theArgsNb)
+ {
+ std::cout << "Syntax error: wrong number parameters at '" << aParam << "'.\n";
+ return 1;
+ }
+
+ aPickedIndex = Draw::Atoi (theArgVec[anArgIter]);
+ }
+ else if (aFile.IsEmpty())
+ {
+ aFile = theArgVec[anArgIter];
+ }
+ else
+ {
+ std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'.\n";
return 1;
- aHiStyle->SetColor (aNewColor);
+ }
}
- if (aCmd.HasOption ("selTransp"))
+ if (aFile.IsEmpty())
{
- aSelStyle->SetTransparency (aCmd.ArgFloat ("selTransp"));
- toRedraw = Standard_True;
+ std::cout << "Syntax error: image file name is missing.\n";
+ return 1;
}
- if (aCmd.HasOption ("hiTransp"))
+
+ const Handle(V3d_View)& aView = ViewerTest::CurrentView();
+ Standard_Integer aWidth = 0, aHeight = 0;
+ aView->Window()->Size (aWidth, aHeight);
+
+ Image_AlienPixMap aPixMap;
+ if (!aPixMap.InitZero (anImgFormat, aWidth, aHeight))
{
- aHiStyle->SetTransparency (aCmd.ArgFloat ("hiTransp"));
+ std::cout << "Error: can't allocate image.\n";
+ return 1;
}
-
- if (aCmd.HasOption ("print") || theArgsNb == 1)
+ if (!aContext->MainSelector()->ToPixMap (aPixMap, aView, aType, aPickedIndex))
{
- theDi << "Auto-activation : " << (aCtx->GetAutoActivateSelection() ? "On" : "Off") << "\n";
- theDi << "Selection pixel tolerance : " << aCtx->MainSelector()->PixelTolerance() << "\n";
- theDi << "Selection color : " << Quantity_Color::StringName (aCtx->SelectionStyle()->Color().Name()) << "\n";
- theDi << "Dynamic highlight color : " << Quantity_Color::StringName (aCtx->HighlightStyle()->Color().Name()) << "\n";
- theDi << "Selection transparency : " << aCtx->SelectionStyle()->Transparency() << "\n";
- theDi << "Dynamic highlight transparency : " << aCtx->HighlightStyle()->Transparency() << "\n";
+ std::cout << "Error: can't generate selection image.\n";
+ return 1;
}
-
- if (aCtx->NbSelected() != 0 && toRedraw)
+ if (!aPixMap.Save (aFile))
{
- aCtx->HilightSelected (Standard_True);
+ std::cout << "Error: can't save selection image.\n";
+ return 0;
}
-
return 0;
}
" \"scale\" - specifies factor to scale computed z range.\n",
__FILE__, VZFit, group);
theCommands.Add("vrepaint",
- "vrepaint : vrepaint, force redraw",
+ "vrepaint [-immediate]"
+ "\n\t\t: force redraw",
__FILE__,VRepaint,group);
theCommands.Add("vclear",
"vclear : vclear"
" : notice that EMF format requires patched gl2ps",
__FILE__,VExport,group);
theCommands.Add("vcolorscale",
- "vcolorscale : vcolorscale name [-range RangeMin = 0 RangeMax = 100 Intervals = 10 -font HeightFont = 16 -textpos "
- "Position = left -xy X = 0 Y = 0] [-noupdate|-update]: draw color scale\n"
- "-demo/-demoversion draw a demoversion of color scale.\n"
- "-show/display display color scale.\n"
- "-hide/erase erase color scale.\n"
- "Please note that -show/-hide option must be the first argument!\n"
- "-color Index R G B: set color for indexed interval\n"
- "-color Index ColorName: set color for indexed interval\n"
- "-colors R G B R G B ...: set colors for all intervals\n"
- "-colors ColorName1 ColorName2 ...: set colors for all intervals\n"
- "-colors supports both color names and rgb values in one call\n"
- "-label Index Text: set label for indexed interval\n"
- "-labels Text Text Text ...: set labels for all intervals\n"
- "-title Title [Position]: set the title for color scale with certain position. Default position = center;\n"
- "Available text positions: left, right, center, none;\n",
- __FILE__,VColorScale,group);
+ "vcolorscale name [-noupdate|-update] [-demo]"
+ "\n\t\t: [-range RangeMin=0 RangeMax=1 NbIntervals=10]"
+ "\n\t\t: [-font HeightFont=20]"
+ "\n\t\t: [-logarithmic {on|off}=off] [-reversed {on|off}=off]"
+ "\n\t\t: [-smoothTransition {on|off}=off]"
+ "\n\t\t: [-hueRange MinAngle=230 MaxAngle=0]"
+ "\n\t\t: [-colorRange MinColor=BLUE1 MaxColor=RED]"
+ "\n\t\t: [-textpos {left|right|center|none}=right]"
+ "\n\t\t: [-labelAtBorder {on|off}=on]"
+ "\n\t\t: [-colors Color1 Color2 ...] [-color Index Color]"
+ "\n\t\t: [-labels Label1 Label2 ...] [-label Index Label]"
+ "\n\t\t: [-freeLabels NbOfLabels Label1 Label2 ...]"
+ "\n\t\t: [-xy Left=0 Bottom=0]"
+ "\n\t\t: -demo - displays a color scale with demonstratio values"
+ "\n\t\t: -colors - set colors for all intervals"
+ "\n\t\t: -color - set color for specific interval"
+ "\n\t\t: -textpos - horizontal label position relative to color scale bar"
+ "\n\t\t: -labelAtBorder - vertical label position relative to color interval;"
+ "\n\t\t: at border means the value inbetween neighbor intervals,"
+ "\n\t\t: at center means the center value within current interval"
+ "\n\t\t: -labels - set labels for all intervals"
+ "\n\t\t: -freeLabels - same as -labels but does not require"
+ "\n\t\t: matching the number of intervals"
+ "\n\t\t: -label - set label for specific interval"
+ "\n\t\t: -title - set title"
+ "\n\t\t: -reversed - setup smooth color transition between intervals"
+ "\n\t\t: -smoothTransition - swap colorscale direction"
+ "\n\t\t: -hueRange - set hue angles corresponding to minimum and maximum values"
+ __FILE__, VColorScale, group);
theCommands.Add("vgraduatedtrihedron",
"vgraduatedtrihedron : -on/-off [-xname Name] [-yname Name] [-zname Name] [-arrowlength Value]\n"
"\t[-namefont Name] [-valuesfont Name]\n"
theCommands.Add ("vcaps",
"vcaps [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}]"
"\n\t\t: [-compatibleProfile {0|1}]"
- "\n\t\t: [-vsync {0|1}]"
+ "\n\t\t: [-vsync {0|1}] [-useWinBuffer {0|1}]"
"\n\t\t: [-quadBuffer {0|1}] [-stereo {0|1}]"
"\n\t\t: [-softMode {0|1}] [-noupdate|-update]"
"\n\t\t: Modify particular graphic driver options:"
"\n\t\t: arrays to GPU memory)"
"\n\t\t: sprite - use textured sprites instead of bitmaps"
"\n\t\t: vsync - switch VSync on or off"
+ "\n\t\t: winBuffer - allow using window buffer for rendering"
"\n\t\t: Context creation options:"
"\n\t\t: softMode - software OpenGL implementation"
"\n\t\t: compatibleProfile - backward-compatible profile"
" ts, tt - translation for s and t texture coordinates\n"
" rot - texture rotation angle in degrees",
__FILE__, VTextureEnv, group);
- theCommands.Add("vhlr" ,
- "is_enabled={on|off} [show_hidden={1|0}]"
- " - Hidden line removal algorithm:"
- " - is_enabled: if is on HLR algorithm is applied\n"
- " - show_hidden: if equals to 1, hidden lines are drawn as dotted ones.\n",
+ theCommands.Add("vhlr",
+ "vhlr {on|off} [-showHidden={1|0}] [-algoType={algo|polyAlgo}] [-noupdate]"
+ "\n\t\t: Hidden Line Removal algorithm."
+ "\n\t\t: -showHidden if set ON, hidden lines are drawn as dotted ones"
+ "\n\t\t: -algoType type of HLR algorithm.\n",
__FILE__,VHLR,group);
- theCommands.Add("vhlrtype" ,
- "algo_type={algo|polyalgo} [shape_1 ... shape_n]"
- " - Changes the type of HLR algorithm using for shapes."
- " - algo_type: if equals to algo, exact HLR algorithm is applied;\n"
- " if equals to polyalgo, polygonal HLR algorithm is applied."
- "If shapes are not given HLR algoithm of given type is applied"
- " to all shapes in the view\n",
+ theCommands.Add("vhlrtype",
+ "vhlrtype {algo|polyAlgo} [shape_1 ... shape_n] [-noupdate]"
+ "\n\t\t: Changes the type of HLR algorithm using for shapes:"
+ "\n\t\t: 'algo' - exact HLR algorithm is applied"
+ "\n\t\t: 'polyAlgo' - polygonal HLR algorithm is applied"
+ "\n\t\t: If shapes are not given - option is applied to all shapes in the view",
__FILE__,VHLRType,group);
theCommands.Add("vclipplane",
"vclipplane planeName [{0|1}]"
__FILE__, VRenderParams, group);
theCommands.Add("vrenderparams",
"\n Manages rendering parameters: "
- "\n '-raster' Disables GPU ray-tracing"
- "\n '-msaa 0..4' Specifies number of samples for MSAA"
- "\n '-rayTrace' Enables GPU ray-tracing"
- "\n '-rayDepth 0..10' Defines maximum ray-tracing depth"
- "\n '-shadows on|off' Enables/disables shadows rendering"
- "\n '-reflections on|off' Enables/disables specular reflections"
- "\n '-fsaa on|off' Enables/disables adaptive anti-aliasing"
- "\n '-gleam on|off' Enables/disables transparency shadow effects"
- "\n '-gi on|off' Enables/disables global illumination effects"
- "\n '-brng on|off' Enables/disables blocked RNG (fast coherent PT)"
- "\n '-env on|off' Enables/disables environment map background"
- "\n '-iss on|off' Enables/disables adaptive screen sampling (PT mode)"
- "\n '-issd on|off' Shows screen sampling distribution in ISS mode"
- "\n '-rebuildGlsl on|off' Rebuild Ray-Tracing GLSL programs (for debugging)"
- "\n '-shadingModel model' Controls shading model from enumeration"
- "\n color, flat, gouraud, phong"
- "\n '-resolution value' Sets a new pixels density (PPI), defines scaling factor for parameters like text size"
+ "\n '-raster' Disables GPU ray-tracing"
+ "\n '-msaa 0..4' Specifies number of samples for MSAA"
+ "\n '-oit off|0.0-1.0' Enables/disables OIT and sets depth weight factor"
+ "\n '-rendScale value Rendering resolution scale factor"
+ "\n '-rayTrace' Enables GPU ray-tracing"
+ "\n '-rayDepth 0..10' Defines maximum ray-tracing depth"
+ "\n '-shadows on|off' Enables/disables shadows rendering"
+ "\n '-reflections on|off' Enables/disables specular reflections"
+ "\n '-fsaa on|off' Enables/disables adaptive anti-aliasing"
+ "\n '-gleam on|off' Enables/disables transparency shadow effects"
+ "\n '-gi on|off' Enables/disables global illumination effects"
+ "\n '-brng on|off' Enables/disables blocked RNG (fast coherent PT)"
+ "\n '-env on|off' Enables/disables environment map background"
+ "\n '-twoside on|off' Enables/disables two-sided BSDF models (PT mode)"
+ "\n '-iss on|off' Enables/disables adaptive screen sampling (PT mode)"
+ "\n '-issd on|off' Shows screen sampling distribution in ISS mode"
+ "\n '-maxrad > 0.0' Value used for clamping radiance estimation (PT mode)"
+ "\n '-nbtiles 64..1024' Specifies number of screen tiles in ISS mode"
+ "\n '-rebuildGlsl on|off' Rebuild Ray-Tracing GLSL programs (for debugging)"
+ "\n '-shadingModel model' Controls shading model from enumeration"
+ "\n color, flat, gouraud, phong"
+ "\n '-resolution value' Sets a new pixels density (PPI), defines scaling factor for parameters like text size"
+ "\n '-aperture >= 0.0' Aperture size of perspective camera for depth-of-field effect (0 disables DOF)"
+ "\n '-focal >= 0.0' Focal distance of perspective camera for depth-of-field effect"
+ "\n '-exposure value' Exposure value for tone mapping (0.0 value disables the effect)"
+ "\n '-whitepoint value' White point value for filmic tone mapping"
+ "\n '-tonemapping mode' Tone mapping mode (disabled, filmic)"
"\n Unlike vcaps, these parameters dramatically change visual properties."
"\n Command is intended to control presentation quality depending on"
"\n hardware capabilities and performance.",
__FILE__, VManipulator, group);
theCommands.Add("vselprops",
- "\n vselprops [options]"
+ "\n vselprops [dynHighlight|localDynHighlight|selHighlight|localSelHighlight] [options]"
"\n Customizes selection and dynamic highlight parameters for the whole interactive context:"
"\n -autoActivate {0|1} : disables|enables default computation and activation of global selection mode"
+ "\n -pickStrategy {first|topmost} : defines picking strategy"
+ "\n 'first' to pick first acceptable (default)"
+ "\n 'topmost' to pick only topmost (and nothing, if topmost is rejected by filters)"
"\n -pixTol value : sets up pixel tolerance"
- "\n -selColor {name|r g b} : sets selection color"
- "\n -hiColor {name|r g b} : sets dynamic highlight color"
- "\n -selTransp value : sets transparency coefficient for selection"
- "\n -hiTransp value : sets transparency coefficient for dynamic highlight"
+ "\n -dispMode dispMode : sets display mode for highlighting"
+ "\n -layer ZLayer : sets ZLayer for highlighting"
+ "\n -color {name|r g b} : sets highlight color"
+ "\n -transp value : sets transparency coefficient for highlight"
+ "\n -material material : sets highlight material"
"\n -print : prints current state of all mentioned parameters",
__FILE__, VSelectionProperties, group);
+ theCommands.Add ("vseldump",
+ "vseldump file -type {depth|unnormDepth|object|owner|selMode|entity}=depth -pickedIndex Index=1"
+ "\n\t\t: Generate an image based on detection results:"
+ "\n\t\t: depth normalized depth values"
+ "\n\t\t: unnormDepth unnormalized depth values"
+ "\n\t\t: object color of detected object"
+ "\n\t\t: owner color of detected owner"
+ "\n\t\t: selMode color of selection mode"
+ "\n\t\t: entity color of etected entity",
+ __FILE__, VDumpSelectionImage, group);
+
#if defined(_WIN32)
theCommands.Add("vprogressive",
"vprogressive",