#include <NCollection_DoubleMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Vector.hxx>
-#include <NIS_View.hxx>
-#include <NIS_Triangulated.hxx>
-#include <NIS_InteractiveContext.hxx>
#include <AIS_InteractiveContext.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw.hxx>
Standard_IMPORT Standard_Boolean Draw_Interprete (const char* theCommand);
Standard_EXPORT int ViewerMainLoop(Standard_Integer , const char** argv);
-extern const Handle(NIS_InteractiveContext)& TheNISContext();
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
extern int VErase (Draw_Interpretor& theDI,
#endif
VT_GetWindow()->SetVirtual (Draw_VirtualWindows);
- // NIS setup
- Handle(NIS_View) aView = new NIS_View (a3DViewer, VT_GetWindow());
+ // View setup
+ Handle(V3d_View) aView = a3DViewer->CreateView();
+ aView->SetWindow (VT_GetWindow());
ViewerTest::CurrentView(aView);
ViewerTest_myViews.Bind (aViewNames.GetViewName(), aView);
- TheNISContext()->AttachView (aView);
// Setup for X11 or NT
OSWindowSetup();
Handle(AIS_InteractiveContext) aCurrentContext = FindContextByView(aView);
// Remove view resources
- TheNISContext()->DetachView(Handle(NIS_View)::DownCast(aView));
ViewerTest_myViews.UnBind1(theViewName);
aView->Remove();
{
//cout << "KeyPress" << endl;
const Handle(V3d_View) aView = ViewerTest::CurrentView();
- const Handle(NIS_View) aNisView = Handle(NIS_View)::DownCast (aView);
// Letter in alphabetic order
if (!strcasecmp (buf_ret, "A"))
}
else if (!strcasecmp (buf_ret, "F"))
{
- // FitAll
- if (aNisView.IsNull())
- aView->FitAll();
+ if (ViewerTest::GetAISContext()->NbSelected() > 0)
+ {
+ ViewerTest::GetAISContext()->FitSelected (aView);
+ }
else
- aNisView->FitAll3d();
+ {
+ // FitAll
+ aView->FitAll();
+ }
}
else if (!strcasecmp (buf_ret, "H"))
{
{
ViewerTest::GetAISContext()->HilightPreviousDetected(ViewerTest::CurrentView());
}
+ else if (!strcasecmp (buf_ret, "/"))
+ {
+ Handle(Graphic3d_Camera) aCamera = aView->Camera();
+ if (aCamera->IsStereo())
+ {
+ aCamera->SetIOD (aCamera->GetIODType(), aCamera->IOD() - 0.01);
+ aView->Redraw();
+ }
+ }
+ else if (!strcasecmp (buf_ret, "*"))
+ {
+ Handle(Graphic3d_Camera) aCamera = aView->Camera();
+ if (aCamera->IsStereo())
+ {
+ aCamera->SetIOD (aCamera->GetIODType(), aCamera->IOD() + 0.01);
+ aView->Redraw();
+ }
+ }
else if (*buf_ret == THE_KEY_DELETE)
{
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
Handle(ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
if (theIsShift)
{
- EM->ShiftSelect (Min (X_ButtonPress, X_Motion), Max (Y_ButtonPress, Y_Motion),
- Max (X_ButtonPress, X_Motion), Min (Y_ButtonPress, Y_Motion));
+ EM->ShiftSelect (X_ButtonPress, Y_ButtonPress,
+ X_Motion, Y_Motion);
}
else
{
- EM->Select (Min (X_ButtonPress, X_Motion), Max (Y_ButtonPress, Y_Motion),
- Max (X_ButtonPress, X_Motion), Min (Y_ButtonPress, Y_Motion));
+ EM->Select (X_ButtonPress, Y_ButtonPress,
+ X_Motion, Y_Motion);
}
}
}
{
Handle(V3d_View) a3DView = ViewerTest::CurrentView();
if ( Abs(X_Motion - X_ButtonPress) > 2 ) {
- static Standard_Real CurZPos = 0.;
//Quantity_Length VDX, VDY;
//a3DView->Size(VDX,VDY);
//Standard_Real VDZ = a3DView->ZSize();
//printf("View size (%lf,%lf,%lf)\n", VDX, VDY, VDZ);
- Quantity_Length dx = a3DView->Convert(X_Motion - X_ButtonPress);
+ Quantity_Length aDx = a3DView->Convert(X_Motion - X_ButtonPress);
// Front = Depth + width/2.
- Standard_Real D = 0.5;
- Standard_Real W = 0.1;
-
- CurZPos += (dx);
+ Standard_Real aDepth = 0.5;
+ Standard_Real aWidth = 0.1;
+ a3DView->ZClipping(aDepth,aWidth);
- D += CurZPos;
+ aDepth += aDx;
//printf("dx %lf Depth %lf Width %lf\n", dx, D, W);
- a3DView->SetZClippingType(V3d_OFF);
- a3DView->SetZClippingDepth(D);
- a3DView->SetZClippingWidth(W);
- a3DView->SetZClippingType(V3d_FRONT);
+ a3DView->SetZClippingDepth(aDepth);
a3DView->Redraw();
LPARAM lParam )
{
static int Up = 1;
+ const Handle(V3d_View)& aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ return DefWindowProc( hwnd, Msg, wParam, lParam );
+ }
- if ( !ViewerTest::CurrentView().IsNull() ) {
PAINTSTRUCT ps;
switch( Msg ) {
case WM_SIZE:
VT_ProcessConfigure();
break;
+ case WM_MOVE:
+ case WM_MOVING:
+ case WM_SIZING:
+ switch (aView->RenderingParams().StereoMode)
+ {
+ case Graphic3d_StereoMode_RowInterlaced:
+ case Graphic3d_StereoMode_ColumnInterlaced:
+ case Graphic3d_StereoMode_ChessBoard:
+ VT_ProcessConfigure(); // track window moves to reverse stereo pair
+ break;
+ default:
+ break;
+ }
+ break;
case WM_KEYDOWN:
if ((wParam != VK_SHIFT) && (wParam != VK_CONTROL))
{
c[0] = '.';
}
+ else if (wParam == VK_DIVIDE)
+ {
+ c[0] = '/';
+ }
+ // dot
+ else if (wParam == VK_MULTIPLY)
+ {
+ c[0] = '*';
+ }
VT_ProcessKeyPress (c);
}
break;
}
break;
+ case WM_MOUSEWHEEL:
+ {
+ int aDelta = GET_WHEEL_DELTA_WPARAM (wParam);
+ if (wParam & MK_CONTROL)
+ {
+ if (aView->Camera()->IsStereo())
+ {
+ Standard_Real aFocus = aView->Camera()->ZFocus() + (aDelta > 0 ? 0.05 : -0.05);
+ if (aFocus > 0.2
+ && aFocus < 2.0)
+ {
+ aView->Camera()->SetZFocus (aView->Camera()->ZFocusType(), aFocus);
+ aView->Redraw();
+ }
+ }
+ }
+ else
+ {
+ aView->Zoom (0, 0, aDelta / 40, aDelta / 40);
+ }
+ break;
+ }
+
case WM_MOUSEMOVE:
{
//cout << "\t WM_MOUSEMOVE" << endl;
return( DefWindowProc( hwnd, Msg, wParam, lParam ));
}
return 0L;
- }
-
- return DefWindowProc( hwnd, Msg, wParam, lParam );
}
}
-
//==============================================================================
//function : VFit
//Draw arg : No args
//==============================================================================
-static int VFit(Draw_Interpretor& , Standard_Integer , const char** )
+static int VFit (Draw_Interpretor& /*theDi*/, Standard_Integer theArgc, const char** theArgv)
{
+ if (theArgc > 2)
+ {
+ std::cout << "Wrong number of arguments! Use: vfit [-selected]" << std::endl;
+ }
+
const Handle(V3d_View) aView = ViewerTest::CurrentView();
- Handle(NIS_View) V = Handle(NIS_View)::DownCast(aView);
- if (V.IsNull() == Standard_False) {
- V->FitAll3d();
- } else if (aView.IsNull() == Standard_False) {
+
+ if (theArgc == 2)
+ {
+ TCollection_AsciiString anArg (theArgv[1]);
+ anArg.LowerCase();
+ if (anArg == "-selected")
+ {
+ ViewerTest::GetAISContext()->FitSelected (aView);
+ return 0;
+ }
+ }
+ if (aView.IsNull() == Standard_False) {
+
aView->FitAll();
}
return 0;
return 0;
}
-DEFINE_STANDARD_HANDLE(V3d_TextItem, Visual3d_LayerItem)
-
// this class provides a presentation of text item in v3d view under-/overlayer
class V3d_TextItem : public Visual3d_LayerItem
{
public:
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(V3d_TextItem)
+ DEFINE_STANDARD_RTTI(V3d_TextItem, Visual3d_LayerItem)
// constructor
Standard_EXPORT V3d_TextItem(const TCollection_AsciiString& theText,
TCollection_AsciiString myFontName;
};
-IMPLEMENT_STANDARD_HANDLE(V3d_TextItem, Visual3d_LayerItem)
-IMPLEMENT_STANDARD_RTTIEXT(V3d_TextItem, Visual3d_LayerItem)
// create and add to display the text item
V3d_TextItem::V3d_TextItem (const TCollection_AsciiString& theText,
myLayer->DrawText (myText.ToCString (), myX1, myY1, myHeight);
}
-DEFINE_STANDARD_HANDLE(V3d_LineItem, Visual3d_LayerItem)
-
// The Visual3d_LayerItem line item for "vlayerline" command
// it provides a presentation of line with user-defined
// linewidth, linetype and transparency.
{
public:
// CASCADE RTTI
- DEFINE_STANDARD_RTTI(V3d_LineItem)
+ DEFINE_STANDARD_RTTI(V3d_LineItem, Visual3d_LayerItem)
// constructor
Standard_EXPORT V3d_LineItem(Standard_Real X1, Standard_Real Y1,
Standard_Real myTransparency;
};
-IMPLEMENT_STANDARD_HANDLE(V3d_LineItem, Visual3d_LayerItem)
-IMPLEMENT_STANDARD_RTTIEXT(V3d_LineItem, Visual3d_LayerItem)
// default constructor for line item
V3d_LineItem::V3d_LineItem(Standard_Real X1, Standard_Real Y1,
return 0;
}
+//==============================================================================
+//function : VPriviledgedPlane
+//purpose :
+//==============================================================================
+
+static int VPriviledgedPlane (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ if (theArgNb != 1 && theArgNb != 7 && theArgNb != 10)
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ // get the active viewer
+ Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
+ if (aViewer.IsNull())
+ {
+ std::cerr << "Error: no active viewer. Please call vinit.\n";
+ return 1;
+ }
+
+ if (theArgNb == 1)
+ {
+ gp_Ax3 aPriviledgedPlane = aViewer->PrivilegedPlane();
+ const gp_Pnt& anOrig = aPriviledgedPlane.Location();
+ const gp_Dir& aNorm = aPriviledgedPlane.Direction();
+ const gp_Dir& aXDir = aPriviledgedPlane.XDirection();
+ theDI << "Origin: " << anOrig.X() << " " << anOrig.Y() << " " << anOrig.Z() << " "
+ << "Normal: " << aNorm.X() << " " << aNorm.Y() << " " << aNorm.Z() << " "
+ << "X-dir: " << aXDir.X() << " " << aXDir.Y() << " " << aXDir.Z() << "\n";
+ return 0;
+ }
+
+ Standard_Integer anArgIdx = 1;
+ Standard_Real anOrigX = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real anOrigY = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real anOrigZ = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real aNormX = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real aNormY = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real aNormZ = Draw::Atof (theArgVec[anArgIdx++]);
+
+ gp_Ax3 aPriviledgedPlane;
+ gp_Pnt anOrig (anOrigX, anOrigY, anOrigZ);
+ gp_Dir aNorm (aNormX, aNormY, aNormZ);
+ if (theArgNb > 7)
+ {
+ Standard_Real aXDirX = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real aXDirY = Draw::Atof (theArgVec[anArgIdx++]);
+ Standard_Real aXDirZ = Draw::Atof (theArgVec[anArgIdx++]);
+ gp_Dir aXDir (aXDirX, aXDirY, aXDirZ);
+ aPriviledgedPlane = gp_Ax3 (anOrig, aNorm, aXDir);
+ }
+ else
+ {
+ aPriviledgedPlane = gp_Ax3 (anOrig, aNorm);
+ }
+
+ aViewer->SetPrivilegedPlane (aPriviledgedPlane);
+
+ return 0;
+}
+
+//==============================================================================
+//function : VConvert
+//purpose :
+//==============================================================================
+
+static int VConvert (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ // get the active view
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cerr << "Error: no active view. Please call vinit.\n";
+ return 1;
+ }
+
+ enum { Model, Ray, View, Window, Grid } aMode = Model;
+
+ // access coordinate arguments
+ TColStd_SequenceOfReal aCoord;
+ Standard_Integer anArgIdx = 1;
+ for (; anArgIdx < 4 && anArgIdx < theArgNb; ++anArgIdx)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIdx]);
+ if (!anArg.IsRealValue())
+ {
+ break;
+ }
+ aCoord.Append (anArg.RealValue());
+ }
+
+ // non-numeric argument too early
+ if (aCoord.IsEmpty())
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ // collect all other arguments and options
+ for (; anArgIdx < theArgNb; ++anArgIdx)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIdx]);
+ anArg.LowerCase();
+ if (anArg == "window") aMode = Window;
+ else if (anArg == "view") aMode = View;
+ else if (anArg == "grid") aMode = Grid;
+ else if (anArg == "ray") aMode = Ray;
+ else
+ {
+ std::cerr << "Error: wrong argument " << anArg << "! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+ }
+
+ // complete input checks
+ if ((aCoord.Length() == 1 && theArgNb > 3) ||
+ (aCoord.Length() == 2 && theArgNb > 4) ||
+ (aCoord.Length() == 3 && theArgNb > 5))
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ Standard_Real aXYZ[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+ Standard_Integer aXYp[2] = {0, 0};
+
+ // convert one-dimensional coordinate
+ if (aCoord.Length() == 1)
+ {
+ 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;
+ default:
+ std::cerr << "Error: wrong arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+ }
+
+ // convert 2D coordinates from projection or view reference space
+ if (aCoord.Length() == 2)
+ {
+ switch (aMode)
+ {
+ case Model :
+ aView->Convert ((Standard_Integer) aCoord (1), (Standard_Integer) aCoord (2), aXYZ[0], aXYZ[1], aXYZ[2]);
+ theDI << "Model X,Y,Z: " << aXYZ[0] << " " << aXYZ[1] << " " << aXYZ[2] << "\n";
+ return 0;
+
+ case View :
+ aView->Convert ((Standard_Integer) aCoord (1), (Standard_Integer) aCoord (2), aXYZ[0], aXYZ[1]);
+ theDI << "View Xv,Yv: " << aXYZ[0] << " " << aXYZ[1] << "\n";
+ return 0;
+
+ case Window :
+ aView->Convert ((V3d_Coordinate) aCoord (1), (V3d_Coordinate) aCoord (2), aXYp[0], aXYp[1]);
+ theDI << "Window Xp,Yp: " << aXYp[0] << " " << aXYp[1] << "\n";
+ return 0;
+
+ case Grid :
+ aView->Convert ((Standard_Integer) aCoord (1), (Standard_Integer) aCoord (2), aXYZ[0], aXYZ[1], aXYZ[2]);
+ aView->ConvertToGrid (aXYZ[0], aXYZ[1], aXYZ[2], aXYZ[3], aXYZ[4], aXYZ[5]);
+ theDI << "Model X,Y,Z: " << aXYZ[3] << " " << aXYZ[4] << " " << aXYZ[5] << "\n";
+ return 0;
+
+ case Ray :
+ aView->ConvertWithProj ((Standard_Integer) aCoord (1),
+ (Standard_Integer) aCoord (2),
+ aXYZ[0], aXYZ[1], aXYZ[2],
+ aXYZ[3], aXYZ[4], aXYZ[5]);
+ theDI << "Model DX,DY,DZ: " << aXYZ[3] << " " << aXYZ[4] << " " << aXYZ[5] << "\n";
+ return 0;
+
+ default:
+ std::cerr << "Error: wrong arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+ }
+
+ // convert 3D coordinates from view reference space
+ else if (aCoord.Length() == 3)
+ {
+ switch (aMode)
+ {
+ case Window :
+ aView->Convert (aCoord (1), aCoord (2), aCoord (3), aXYp[0], aXYp[1]);
+ theDI << "Window Xp,Yp: " << aXYp[0] << " " << aXYp[1] << "\n";
+ return 0;
+
+ case Grid :
+ aView->ConvertToGrid (aCoord (1), aCoord (2), aCoord (3), aXYZ[0], aXYZ[1], aXYZ[2]);
+ theDI << "Model X,Y,Z: " << aXYZ[0] << " " << aXYZ[1] << " " << aXYZ[2] << "\n";
+ return 0;
+
+ default:
+ std::cerr << "Error: wrong arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
//==============================================================================
//function : VFps
//purpose :
{
aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aView->Viewer()->Driver());
}
+ OpenGl_Caps* aDefCaps = &ViewerTest_myDefaultCaps;
+ OpenGl_Caps* aCaps = !aDriver.IsNull() ? &aDriver->ChangeOptions() : NULL;
+
if (theArgNb < 2)
{
- if (aDriver.IsNull())
+ TCollection_AsciiString aDebActive, aSyncActive;
+ if (aCaps == NULL)
{
- std::cerr << "No active view. Please call vinit.\n";
- return 0;
+ aCaps = aDefCaps;
+ }
+ else
+ {
+ Standard_Boolean isActive = OpenGl_Context::CheckExtension ((const char* )::glGetString (GL_EXTENSIONS),
+ "GL_ARB_debug_output");
+ aDebActive = isActive ? " (active)" : " (inactive)";
+ if (isActive)
+ {
+ // GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
+ aSyncActive = ::glIsEnabled (0x8242) == GL_TRUE ? " (active)" : " (inactive)";
+ }
}
- Standard_Boolean isActive = OpenGl_Context::CheckExtension ((const char* )glGetString (GL_EXTENSIONS),
- "GL_ARB_debug_output");
- std::cout << "Active graphic driver: debug " << (isActive ? "ON" : "OFF") << "\n";
- theDI << (isActive ? "1" : "0");
+ theDI << "debug: " << (aCaps->contextDebug ? "1" : "0") << aDebActive << "\n"
+ << "sync: " << (aCaps->contextSyncDebug ? "1" : "0") << aSyncActive << "\n"
+ << "glslWarn:" << (aCaps->glslWarnings ? "1" : "0") << "\n"
+ << "extraMsg:" << (aCaps->suppressExtraMsg ? "0" : "1") << "\n";
return 0;
}
- const Standard_Boolean toEnableDebug = Draw::Atoi (theArgVec[1]) != 0;
- ViewerTest_myDefaultCaps.contextDebug = toEnableDebug;
- ViewerTest_myDefaultCaps.glslWarnings = toEnableDebug;
- if (aDriver.IsNull())
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
- return 0;
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString anArgCase (anArg);
+ anArgCase.LowerCase();
+ Standard_Boolean toEnableDebug = Standard_True;
+ if (anArgCase == "-glsl"
+ || anArgCase == "-glslwarn"
+ || anArgCase == "-glslwarns"
+ || anArgCase == "-glslwarnings")
+ {
+ Standard_Boolean toShowWarns = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toShowWarns))
+ {
+ --anArgIter;
+ }
+ aDefCaps->glslWarnings = toShowWarns;
+ if (aCaps != NULL)
+ {
+ aCaps->glslWarnings = toShowWarns;
+ }
+ }
+ else if (anArgCase == "-extra"
+ || anArgCase == "-extramsg"
+ || anArgCase == "-extramessages")
+ {
+ Standard_Boolean toShow = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toShow))
+ {
+ --anArgIter;
+ }
+ aDefCaps->suppressExtraMsg = !toShow;
+ if (aCaps != NULL)
+ {
+ aCaps->suppressExtraMsg = !toShow;
+ }
+ }
+ else if (anArgCase == "-noextra"
+ || anArgCase == "-noextramsg"
+ || anArgCase == "-noextramessages")
+ {
+ Standard_Boolean toSuppress = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toSuppress))
+ {
+ --anArgIter;
+ }
+ aDefCaps->suppressExtraMsg = toSuppress;
+ if (aCaps != NULL)
+ {
+ aCaps->suppressExtraMsg = toSuppress;
+ }
+ }
+ else if (anArgCase == "-sync")
+ {
+ Standard_Boolean toSync = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toSync))
+ {
+ --anArgIter;
+ }
+ aDefCaps->contextSyncDebug = toSync;
+ if (toSync)
+ {
+ aDefCaps->contextDebug = Standard_True;
+ }
+ }
+ else if (anArgCase == "-debug")
+ {
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnableDebug))
+ {
+ --anArgIter;
+ }
+ aDefCaps->contextDebug = toEnableDebug;
+ }
+ else if (parseOnOff (anArg, toEnableDebug)
+ && (anArgIter + 1 == theArgNb))
+ {
+ // simple alias to turn on almost everything
+ aDefCaps->contextDebug = toEnableDebug;
+ aDefCaps->contextSyncDebug = toEnableDebug;
+ aDefCaps->glslWarnings = toEnableDebug;
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
}
- aDriver->ChangeOptions().glslWarnings = toEnableDebug;
return 0;
}
theDI << "Sprites: " << (aCaps->pntSpritesDisable ? "0" : "1") << "\n";
theDI << "SoftMode:" << (aCaps->contextNoAccel ? "1" : "0") << "\n";
theDI << "FFP: " << (aCaps->ffpEnable ? "1" : "0") << "\n";
+ theDI << "VSync: " << aCaps->swapInterval << "\n";
theDI << "Compatible:" << (aCaps->contextCompatible ? "1" : "0") << "\n";
+ theDI << "Stereo: " << (aCaps->contextStereo ? "1" : "0") << "\n";
return 0;
}
{
continue;
}
+ else if (anArgCase == "-vsync"
+ || anArgCase == "-swapinterval")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->swapInterval = toEnable;
+ }
else if (anArgCase == "-ffp")
{
Standard_Boolean toEnable = Standard_True;
aCaps->ffpEnable = Standard_False;
}
}
+ else if (anArgCase == "-stereo"
+ || anArgCase == "-quadbuffer")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextStereo = toEnable;
+ }
else
{
std::cout << "Error: unknown argument '" << anArg << "'\n";
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
- const Standard_Boolean isShiftSelection = (argc>3 && !(argc%2) && (atoi(argv[argc-1])==1));
+
+ const Standard_Boolean isShiftSelection = (argc > 3 && !(argc % 2) && (atoi (argv[argc - 1]) == 1));
+ Standard_Integer aCoordsNb = isShiftSelection ? argc - 2 : argc - 1;
+ TCollection_AsciiString anArg;
+ anArg = isShiftSelection ? argv[argc - 3] : argv[argc - 2];
+ anArg.LowerCase();
+ if (anArg == "-allowoverlap")
+ {
+ Standard_Boolean isValidated = isShiftSelection ? argc == 8
+ : argc == 7;
+ if (!isValidated)
+ {
+ di << "Wrong number of arguments! -allowoverlap key is applied only for rectangle selection";
+ return 1;
+ }
+
+ Standard_Integer isToAllow = isShiftSelection ? Draw::Atoi(argv[argc - 2]) : Draw::Atoi(argv[argc - 1]);
+ myAIScontext->MainSelector()->AllowOverlapDetection((Standard_Boolean)isToAllow);
+ aCoordsNb -= 2;
+ }
+
Handle(ViewerTest_EventManager) aCurrentEventManager = ViewerTest::CurrentEventManager();
aCurrentEventManager->MoveTo(atoi(argv[1]),atoi(argv[2]));
- if(argc <= 4)
+ if(aCoordsNb == 2)
{
if(isShiftSelection)
aCurrentEventManager->ShiftSelect();
else
aCurrentEventManager->Select();
}
- else if(argc <= 6)
+ else if(aCoordsNb == 4)
{
if(isShiftSelection)
- aCurrentEventManager->ShiftSelect(atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),atoi(argv[4]));
+ aCurrentEventManager->ShiftSelect (atoi (argv[1]), atoi (argv[2]), atoi (argv[3]), atoi (argv[4]), Standard_False);
else
- aCurrentEventManager->Select(atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),atoi(argv[4]));
+ aCurrentEventManager->Select (atoi (argv[1]), atoi (argv[2]), atoi (argv[3]), atoi (argv[4]), Standard_False);
}
else
{
- Standard_Integer anUpper = 0;
+ TColgp_Array1OfPnt2d aPolyline (1,aCoordsNb / 2);
- if(isShiftSelection)
- anUpper = (argc-1)/2;
- else
- anUpper = argc/2;
- TColgp_Array1OfPnt2d aPolyline(1,anUpper);
-
- for(Standard_Integer i=1;i<=anUpper;++i)
+ for(Standard_Integer i=1;i<=aCoordsNb / 2;++i)
aPolyline.SetValue(i,gp_Pnt2d(atoi(argv[2*i-1]),atoi(argv[2*i])));
if(isShiftSelection)
const Standard_ShortReal theXShift,
const Standard_ShortReal theYShift,
const Standard_ShortReal theAngle);
- DEFINE_STANDARD_RTTI(OCC_TextureEnv);
+ DEFINE_STANDARD_RTTI(OCC_TextureEnv, Graphic3d_TextureEnv);
};
DEFINE_STANDARD_HANDLE(OCC_TextureEnv, Graphic3d_TextureEnv);
-IMPLEMENT_STANDARD_HANDLE(OCC_TextureEnv, Graphic3d_TextureEnv);
-IMPLEMENT_STANDARD_RTTIEXT(OCC_TextureEnv, Graphic3d_TextureEnv);
+
+
+
OCC_TextureEnv::OCC_TextureEnv(const Standard_CString theFileName)
: Graphic3d_TextureEnv(theFileName)
return 0;
}
+//! Parse stereo output mode
+inline Standard_Boolean parseStereoMode (Standard_CString theArg,
+ Graphic3d_StereoMode& theMode)
+{
+ TCollection_AsciiString aFlag (theArg);
+ aFlag.LowerCase();
+ if (aFlag == "quadbuffer")
+ {
+ theMode = Graphic3d_StereoMode_QuadBuffer;
+ }
+ else if (aFlag == "anaglyph")
+ {
+ theMode = Graphic3d_StereoMode_Anaglyph;
+ }
+ else if (aFlag == "row"
+ || aFlag == "rowinterlaced")
+ {
+ theMode = Graphic3d_StereoMode_RowInterlaced;
+ }
+ else if (aFlag == "col"
+ || aFlag == "colinterlaced"
+ || aFlag == "columninterlaced")
+ {
+ theMode = Graphic3d_StereoMode_ColumnInterlaced;
+ }
+ else if (aFlag == "chess"
+ || aFlag == "chessboard")
+ {
+ theMode = Graphic3d_StereoMode_ChessBoard;
+ }
+ else if (aFlag == "sbs"
+ || aFlag == "sidebyside")
+ {
+ theMode = Graphic3d_StereoMode_SideBySide;
+ }
+ else if (aFlag == "ou"
+ || aFlag == "overunder")
+ {
+ theMode = Graphic3d_StereoMode_OverUnder;
+ }
+ else if (aFlag == "pageflip"
+ || aFlag == "softpageflip")
+ {
+ theMode = Graphic3d_StereoMode_SoftPageFlip;
+ }
+ else
+ {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+
+//! Parse anaglyph filter
+inline Standard_Boolean parseAnaglyphFilter (Standard_CString theArg,
+ Graphic3d_RenderingParams::Anaglyph& theFilter)
+{
+ TCollection_AsciiString aFlag (theArg);
+ aFlag.LowerCase();
+ if (aFlag == "redcyansimple")
+ {
+ theFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Simple;
+ }
+ else if (aFlag == "redcyan"
+ || aFlag == "redcyanoptimized")
+ {
+ theFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized;
+ }
+ else if (aFlag == "yellowbluesimple")
+ {
+ theFilter = Graphic3d_RenderingParams::Anaglyph_YellowBlue_Simple;
+ }
+ else if (aFlag == "yellowblue"
+ || aFlag == "yellowblueoptimized")
+ {
+ theFilter = Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized;
+ }
+ else if (aFlag == "greenmagenta"
+ || aFlag == "greenmagentasimple")
+ {
+ theFilter = Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple;
+ }
+ else
+ {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+
//==============================================================================
//function : VStereo
//purpose :
Standard_Integer theArgNb,
const char** theArgVec)
{
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
if (theArgNb < 2)
{
- Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "No active view. Please call vinit.\n";
+ std::cout << "Error: no active viewer!\n";
return 0;
}
return 0;
}
- ViewerTest_myDefaultCaps.contextStereo = Draw::Atoi (theArgVec[1]) != 0;
+ Handle(Graphic3d_Camera) aCamera;
+ Graphic3d_RenderingParams* aParams = NULL;
+ Graphic3d_StereoMode aMode = Graphic3d_StereoMode_QuadBuffer;
+ if (!aView.IsNull())
+ {
+ aParams = &aView->ChangeRenderingParams();
+ aMode = aParams->StereoMode;
+ aCamera = aView->Camera();
+ }
+
+ ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString aFlag (anArg);
+ aFlag.LowerCase();
+ if (anUpdateTool.parseRedrawMode (aFlag))
+ {
+ continue;
+ }
+ else if (aFlag == "0"
+ || aFlag == "off")
+ {
+ if (++anArgIter < theArgNb)
+ {
+ std::cout << "Error: wrong number of arguments!\n";
+ return 1;
+ }
+
+ if (!aCamera.IsNull()
+ && aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
+ {
+ aCamera->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
+ }
+ ViewerTest_myDefaultCaps.contextStereo = Standard_False;
+ return 0;
+ }
+ else if (aFlag == "1"
+ || aFlag == "on")
+ {
+ if (++anArgIter < theArgNb)
+ {
+ std::cout << "Error: wrong number of arguments!\n";
+ return 1;
+ }
+
+ if (!aCamera.IsNull())
+ {
+ aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
+ }
+ ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ return 0;
+ }
+ else if (aFlag == "-reverse"
+ || aFlag == "-reversed"
+ || aFlag == "-swap")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aParams->ToReverseStereo = toEnable;
+ }
+ else if (aFlag == "-noreverse"
+ || aFlag == "-noswap")
+ {
+ Standard_Boolean toDisable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toDisable))
+ {
+ --anArgIter;
+ }
+ aParams->ToReverseStereo = !toDisable;
+ }
+ else if (aFlag == "-mode"
+ || aFlag == "-stereomode")
+ {
+ if (++anArgIter >= theArgNb
+ || !parseStereoMode (theArgVec[anArgIter], aMode))
+ {
+ std::cout << "Error: syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+
+ if (aMode == Graphic3d_StereoMode_QuadBuffer)
+ {
+ ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ }
+ }
+ else if (aFlag == "-anaglyph"
+ || aFlag == "-anaglyphfilter")
+ {
+ Graphic3d_RenderingParams::Anaglyph aFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Simple;
+ if (++anArgIter >= theArgNb
+ || !parseAnaglyphFilter (theArgVec[anArgIter], aFilter))
+ {
+ std::cout << "Error: syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+
+ aMode = Graphic3d_StereoMode_Anaglyph;
+ aParams->AnaglyphFilter = aFilter;
+ }
+ else if (parseStereoMode (anArg, aMode)) // short syntax
+ {
+ if (aMode == Graphic3d_StereoMode_QuadBuffer)
+ {
+ ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ }
+ }
+ else
+ {
+ std::cout << "Error: syntax error at '" << anArg << "'\n";
+ return 1;
+ }
+ }
+
+ if (!aView.IsNull())
+ {
+ aParams->StereoMode = aMode;
+ aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
+ }
return 0;
}
// currently HLRDeviationAngle is used instead of DeviationAngle in most places
aDefParams->SetHLRAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
}
- if (anArg == "-AUTOTR"
- || anArg == "-AUTOTRIANG"
- || anArg == "-AUTOTRIANGULATION")
+ else if (anArg == "-AUTOTR"
+ || anArg == "-AUTOTRIANG"
+ || anArg == "-AUTOTRIANGULATION")
{
if (++anArgIter >= theArgsNb)
{
{
case V3d_AMBIENT:
{
- theDi << " Type: Ambient\n";
+ theDi << " Type: Ambient\n";
+ theDi << " Intensity: " << aLight->Intensity() << "\n";
break;
}
case V3d_DIRECTIONAL:
{
Handle(V3d_DirectionalLight) aLightDir = Handle(V3d_DirectionalLight)::DownCast (aLight);
- theDi << " Type: Directional\n";
- theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
+ theDi << " Type: Directional\n";
+ theDi << " Intensity: " << aLight->Intensity() << "\n";
+ theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
+ theDi << " Smoothness: " << aLight->Smoothness() << "\n";
if (!aLightDir.IsNull())
{
aLightDir->Position (anXYZ[0], anXYZ[1], anXYZ[2]);
- theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
+ theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
aLightDir->Direction (anXYZ[0], anXYZ[1], anXYZ[2]);
- theDi << " Direction: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
+ theDi << " Direction: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
}
break;
}
case V3d_POSITIONAL:
{
Handle(V3d_PositionalLight) aLightPos = Handle(V3d_PositionalLight)::DownCast (aLight);
- theDi << " Type: Positional\n";
- theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
+ theDi << " Type: Positional\n";
+ theDi << " Intensity: " << aLight->Intensity() << "\n";
+ theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
+ theDi << " Smoothness: " << aLight->Smoothness() << "\n";
if (!aLightPos.IsNull())
{
aLightPos->Position (anXYZ[0], anXYZ[1], anXYZ[2]);
- theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
+ theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
aLightPos->Attenuation (anAtten[0], anAtten[1]);
- theDi << " Atten.: " << anAtten[0] << " " << anAtten[1] << "\n";
+ theDi << " Atten.: " << anAtten[0] << " " << anAtten[1] << "\n";
}
break;
}
case V3d_SPOT:
{
Handle(V3d_SpotLight) aLightSpot = Handle(V3d_SpotLight)::DownCast (aLight);
- theDi << " Type: Spot\n";
- theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
+ theDi << " Type: Spot\n";
+ theDi << " Intensity: " << aLight->Intensity() << "\n";
+ theDi << " Headlight: " << (aLight->Headlight() ? "TRUE" : "FALSE") << "\n";
if (!aLightSpot.IsNull())
{
aLightSpot->Position (anXYZ[0], anXYZ[1], anXYZ[2]);
- theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
+ theDi << " Position: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
aLightSpot->Direction (anXYZ[0], anXYZ[1], anXYZ[2]);
- theDi << " Direction: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
+ theDi << " Direction: " << anXYZ[0] << ", " << anXYZ[1] << ", " << anXYZ[2] << "\n";
aLightSpot->Attenuation (anAtten[0], anAtten[1]);
- theDi << " Atten.: " << anAtten[0] << " " << anAtten[1] << "\n";
- theDi << " Angle: " << (aLightSpot->Angle() * 180.0 / M_PI) << "\n";
- theDi << " Exponent: " << aLightSpot->Concentration() << "\n";
+ theDi << " Atten.: " << anAtten[0] << " " << anAtten[1] << "\n";
+ theDi << " Angle: " << (aLightSpot->Angle() * 180.0 / M_PI) << "\n";
+ theDi << " Exponent: " << aLightSpot->Concentration() << "\n";
}
break;
}
default:
{
- theDi << " Type: UNKNOWN\n";
+ theDi << " Type: UNKNOWN\n";
break;
}
}
return 1;
}
}
+ else if (anArgCase.IsEqual ("SM")
+ || anArgCase.IsEqual ("SMOOTHNESS"))
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ Standard_Real aSmoothness = Atof (theArgVec[anArgIt]);
+
+ if (fabs (aSmoothness) < Precision::Confusion())
+ {
+ aLightCurr->SetIntensity (1.f);
+ }
+ else if (fabs (aLightCurr->Smoothness()) < Precision::Confusion())
+ {
+ aLightCurr->SetIntensity ((aSmoothness * aSmoothness) / 3.f);
+ }
+ else
+ {
+ Standard_ShortReal aSmoothnessRatio = static_cast<Standard_ShortReal> (aSmoothness / aLightCurr->Smoothness());
+ aLightCurr->SetIntensity (aLightCurr->Intensity() / (aSmoothnessRatio * aSmoothnessRatio));
+ }
+
+ if (!aLightPos.IsNull())
+ {
+ aLightPos->SetSmoothRadius (aSmoothness);
+ }
+ else if (!aLightDir.IsNull())
+ {
+ aLightDir->SetSmoothAngle (aSmoothness);
+ }
+ }
+ else if (anArgCase.IsEqual ("INT")
+ || anArgCase.IsEqual ("INTENSITY"))
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ Standard_Real aIntensity = Atof (theArgVec[anArgIt]);
+
+ if (!aLightCurr.IsNull())
+ {
+ aLightCurr->SetIntensity (aIntensity);
+ }
+ }
else if (anArgCase.IsEqual ("ANG")
|| anArgCase.IsEqual ("ANGLE"))
{
case Graphic3d_RM_RAYTRACING: theDI << "raytrace "; break;
}
theDI << "\n";
- theDI << "fsaa: " << (aParams.IsAntialiasingEnabled ? "on" : "off") << "\n";
- theDI << "shadows: " << (aParams.IsShadowEnabled ? "on" : "off") << "\n";
- theDI << "reflections: " << (aParams.IsReflectionEnabled ? "on" : "off") << "\n";
- theDI << "rayDepth: " << aParams.RaytracingDepth << "\n";
- theDI << "gleam: " << (aParams.IsTransparentShadowEnabled ? "on" : "off") << "\n";
+ theDI << "fsaa: " << (aParams.IsAntialiasingEnabled ? "on" : "off") << "\n";
+ theDI << "shadows: " << (aParams.IsShadowEnabled ? "on" : "off") << "\n";
+ theDI << "reflections: " << (aParams.IsReflectionEnabled ? "on" : "off") << "\n";
+ theDI << "rayDepth: " << aParams.RaytracingDepth << "\n";
+ theDI << "gleam: " << (aParams.IsTransparentShadowEnabled ? "on" : "off") << "\n";
+ theDI << "GI: " << (aParams.IsGlobalIlluminationEnabled ? "on" : "off") << "\n";
theDI << "shadingModel: ";
switch (aView->ShadingModel())
{
}
const Standard_Integer aDepth = Draw::Atoi (theArgVec[anArgIter]);
- if (aDepth < 1 || aDepth > 10)
+
+ // We allow RaytracingDepth be more than 10 in case of GI enabled
+ if (aDepth < 1 || (aDepth > 10 && !aParams.IsGlobalIlluminationEnabled))
{
std::cerr << "Error: invalid ray-tracing depth " << aDepth << ". Should be within range [1; 10]\n";
return 1;
}
aParams.IsTransparentShadowEnabled = toEnable;
}
+ else if (aFlag == "-gi")
+ {
+ if (toPrint)
+ {
+ theDI << (aParams.IsGlobalIlluminationEnabled ? "on" : "off") << " ";
+ continue;
+ }
+
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aParams.IsGlobalIlluminationEnabled = toEnable;
+ if (!toEnable)
+ {
+ aParams.RaytracingDepth = Min (aParams.RaytracingDepth, 10);
+ }
+ }
+ else if (aFlag == "-env")
+ {
+ if (toPrint)
+ {
+ theDI << (aParams.UseEnvironmentMapBackground ? "on" : "off") << " ";
+ continue;
+ }
+
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !parseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aParams.UseEnvironmentMapBackground = toEnable;
+ }
else if (aFlag == "-shademodel"
|| aFlag == "-shadingmodel"
|| aFlag == "-shading")
return 1;
}
}
+
+ return 0;
+}
+
+//=======================================================================
+//function : VProgressiveMode
+//purpose :
+//=======================================================================
+#if defined(_WIN32)
+static Standard_Integer VProgressiveMode (Draw_Interpretor& /*theDI*/,
+ Standard_Integer /*theNbArgs*/,
+ const char** /*theArgs*/)
+{
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cerr << "Error: no active viewer!\n";
+ return 1;
+ }
+
+ std::cout << "Press Enter or Escape key to exit progressive rendering mode" << std::endl;
+
+ for (;;)
+ {
+ aView->Redraw();
+
+ Standard_Boolean toExit = Standard_False;
+
+ MSG aMsg;
+ while (PeekMessage (&aMsg, NULL, NULL, NULL, PM_REMOVE))
+ {
+ if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b))
+ {
+ toExit = Standard_True;
+ }
+
+ TranslateMessage (&aMsg);
+ DispatchMessage (&aMsg);
+ }
+
+ if (toExit)
+ {
+ break;
+ }
+ }
+
return 0;
}
+#endif
//=======================================================================
//function : VFrustumCulling
"vpick : vpick X Y Z [shape subshape] ( all variables as string )",
VPick,group);
theCommands.Add("vfit" ,
- "vfit or <F> : vfit",
+ "vfit or <F> [-selected]"
+ "\n\t\t: [-selected] fits the scene according to bounding box of currently selected objects",
__FILE__,VFit,group);
theCommands.Add ("vfitarea",
"vfitarea x1 y1 x2 y2"
" : Mode - rectangular or circular"
" : Type - lines or points",
__FILE__, VGrid, group);
+ theCommands.Add ("vpriviledgedplane",
+ "vpriviledgedplane [Ox Oy Oz Nx Ny Nz [Xx Xy Xz]]"
+ "\n\t\t: Ox, Oy, Oz - plane origin"
+ "\n\t\t: Nx, Ny, Nz - plane normal direction"
+ "\n\t\t: Xx, Xy, Xz - plane x-reference axis direction"
+ "\n\t\t: Sets or prints viewer's priviledged plane geometry.",
+ __FILE__, VPriviledgedPlane, group);
+ theCommands.Add ("vconvert",
+ "vconvert v [Mode={window|view}]"
+ "\n\t\t: vconvert x y [Mode={window|view|grid|ray}]"
+ "\n\t\t: vconvert x y z [Mode={window|grid}]"
+ "\n\t\t: window - convert to window coordinates, pixels"
+ "\n\t\t: view - convert to view projection plane"
+ "\n\t\t: grid - convert to model coordinates, given on grid"
+ "\n\t\t: ray - convert projection ray to model coordiantes"
+ "\n\t\t: - vconvert v window : convert view to window;"
+ "\n\t\t: - vconvert v view : convert window to view;"
+ "\n\t\t: - vconvert x y window : convert view to window;"
+ "\n\t\t: - vconvert x y view : convert window to view;"
+ "\n\t\t: - vconvert x y : convert window to model;"
+ "\n\t\t: - vconvert x y grid : convert window to model using grid;"
+ "\n\t\t: - vconvert x y ray : convert window projection line to model;"
+ "\n\t\t: - vconvert x y z window : convert model to window;"
+ "\n\t\t: - vconvert x y z grid : convert view to model using grid;"
+ "\n\t\t: Converts the given coordinates to window/view/model space.",
+ __FILE__, VConvert, group);
theCommands.Add ("vfps",
"vfps [framesNb=100] : estimate average frame rate for active view",
__FILE__, VFps, group);
theCommands.Add ("vgldebug",
- "vgldebug [{0|1}] : request debug GL context, should be called before vinit\n"
- " : this function is implemented only for Windows\n"
- " : GL_ARB_debug_output extension should be exported by OpenGL driver!",
+ "vgldebug [-sync {0|1}] [-debug {0|1}] [-glslWarn {0|1}]"
+ "\n\t\t: [-extraMsg {0|1}] [{0|1}]"
+ "\n\t\t: Request debug GL context. Should be called BEFORE vinit."
+ "\n\t\t: Debug context can be requested only on Windows"
+ "\n\t\t: with GL_ARB_debug_output extension implemented by GL driver!"
+ "\n\t\t: -sync - request synchronized debug GL context"
+ "\n\t\t: -glslWarn - log GLSL compiler/linker warnings,"
+ "\n\t\t: which are suppressed by default,"
+ "\n\t\t: -extraMsg - log extra diagnostic messages from GL context,"
+ "\n\t\t: which are suppressed by default",
__FILE__, VGlDebug, group);
theCommands.Add ("vvbo",
"vvbo [{0|1}] : turn VBO usage On/Off; affects only newly displayed objects",
__FILE__, VVbo, group);
theCommands.Add ("vstereo",
- "\nvstereo [{0|1}] : turn stereo usage On/Off; affects only newly displayed objects",
+ "vstereo [0|1] [-mode Mode] [-reverse {0|1}]"
+ "\n\t\t: [-anaglyph Filter]"
+ "\n\t\t: Control stereo output mode. Available modes for -mode:"
+ "\n\t\t: quadBuffer - OpenGL QuadBuffer stereo,"
+ "\n\t\t: requires driver support."
+ "\n\t\t: Should be called BEFORE vinit!"
+ "\n\t\t: anaglyph - Anaglyph glasses"
+ "\n\t\t: rowInterlaced - row-interlaced display"
+ "\n\t\t: columnInterlaced - column-interlaced display"
+ "\n\t\t: chessBoard - chess-board output"
+ "\n\t\t: sideBySide - horizontal pair"
+ "\n\t\t: overUnder - vertical pair"
+ "\n\t\t: Available Anaglyph filters for -anaglyph:"
+ "\n\t\t: redCyan, redCyanSimple, yellowBlue, yellowBlueSimple,"
+ "\n\t\t: greenMagentaSimple",
__FILE__, VStereo, group);
theCommands.Add ("vcaps",
"vcaps [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}]"
"\n\t\t: [-compatibleContext {0|1}]"
+ "\n\t\t: [-vsync {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: FFP - use fixed-function pipeline instead of"
"\n\t\t: VBO - use Vertex Buffer Object (copy vertex"
"\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: Context creation options:"
"\n\t\t: softMode - software OpenGL implementation"
"\n\t\t: compatibleProfile - backward-compatible profile"
+ "\n\t\t: quadbuffer - QuadBuffer"
"\n\t\t: Unlike vrenderparams, these parameters control alternative"
"\n\t\t: rendering paths producing the same visual result when"
"\n\t\t: possible."
"diffimage : diffimage imageFile1 imageFile2 toleranceOfColor(0..1) blackWhite(1|0) borderFilter(1|0) [diffImageFile]",
__FILE__, VDiffImage, group);
theCommands.Add ("vselect",
- "vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [shift_selection = 0|1]\n"
+ "vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [shift_selection = 0|1]\n"
"- emulates different types of selection:\n"
"- 1) single click selection\n"
"- 2) selection with rectangle having corners at pixel positions (x1,y1) and (x2,y2)\n"
"- 3) selection with polygon having corners in pixel positions (x1,y1), (x2,y2),...,(xn,yn)\n"
- "- 4) any of these selections with shift button pressed",
+ "- 4) -allowoverlap determines will partially included objects be selected in rectangular selection"
+ " (partial inclusion - overlap - is not allowed by default)\n"
+ "- 5) any of these selections with shift button pressed",
__FILE__, VSelect, group);
theCommands.Add ("vmoveto",
"vmoveto x y"
"\n {dir}ection X Y Z (for directional light or for spotlight)"
"\n color colorName"
"\n {head}light 0|1"
+ "\n {sm}oothness value"
+ "\n {int}ensity value"
"\n {constAtten}uation value"
"\n {linearAtten}uation value"
"\n angle angleDeg"
__FILE__, VLight, group);
theCommands.Add("vraytrace",
"vraytrace [0|1]"
- "\n\t\t: Turn on/off raytracing renderer."
+ "\n\t\t: Turns on/off ray-tracing renderer."
"\n\t\t: 'vraytrace 0' alias for 'vrenderparams -raster'."
"\n\t\t: 'vraytrace 1' alias for 'vrenderparams -rayTrace'.",
__FILE__, VRenderParams, group);
"\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 '-env on|off' Enables/disables environment map background"
"\n '-shadingModel model' Controls shading model from enumeration"
"\n color, flat, gouraud, phong"
"\n Unlike vcaps, these parameters dramatically change visual properties."
"vxrotate",
__FILE__,VXRotate,group);
+#if defined(_WIN32)
+ theCommands.Add("vprogressive",
+ "vprogressive",
+ __FILE__, VProgressiveMode, group);
+#endif
}