1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0025974: Visualization - fix misprints in method naming of Graphic3d_GraduatedTrihedron

V3d_View::GetGraduatedTrihedron() - return configuration structure directly.

OpenGl_View::TriedronDisplay() - do not re-create trihedron on each Display call.
OpenGl_Trihedron::Setup() - eliminate global variables.
OpenGl_PrimitiveArray::buildVBO() - release old VBOs before initialization.

ViewerTest.hxx - move out package header from .cdl file.
ViewerTest::ParseColor() - add new method to parse color arguments in common way.

vzbufftrihedron - improve command syntax.
vgraduatedtrihedron - add options -drawgrid and -drawaxes.
This commit is contained in:
kgv 2015-04-03 21:41:52 +03:00 committed by bugmaster
parent 24e40cc2dc
commit 536d98e224
27 changed files with 918 additions and 599 deletions

View File

@ -35,7 +35,7 @@ class Graphic3d_AxisAspect
Graphic3d_AxisAspect (const TCollection_ExtendedString theName = "", const Quantity_Color theNameColor = Quantity_NOC_BLACK, Graphic3d_AxisAspect (const TCollection_ExtendedString theName = "", const Quantity_Color theNameColor = Quantity_NOC_BLACK,
const Quantity_Color theColor = Quantity_NOC_BLACK, const Quantity_Color theColor = Quantity_NOC_BLACK,
const Standard_Integer theValuesOffset = 10, const Standard_Integer theNameOffset = 30, const Standard_Integer theValuesOffset = 10, const Standard_Integer theNameOffset = 30,
const Standard_Integer theTickmarkNumber = 5, const Standard_Integer theTickmarkLength = 10, const Standard_Integer theTickmarksNumber = 5, const Standard_Integer theTickmarksLength = 10,
const Standard_Boolean theToDrawName = Standard_True, const Standard_Boolean theToDrawName = Standard_True,
const Standard_Boolean theToDrawValues = Standard_True, const Standard_Boolean theToDrawValues = Standard_True,
const Standard_Boolean theToDrawTickmarks = Standard_True) const Standard_Boolean theToDrawTickmarks = Standard_True)
@ -44,8 +44,8 @@ class Graphic3d_AxisAspect
myToDrawTickmarks (theToDrawTickmarks), myToDrawTickmarks (theToDrawTickmarks),
myToDrawValues (theToDrawValues), myToDrawValues (theToDrawValues),
myNameColor (theNameColor), myNameColor (theNameColor),
myTickmarkNumber (theTickmarkNumber), myTickmarksNumber (theTickmarksNumber),
myTickmarkLength (theTickmarkLength), myTickmarksLength (theTickmarksLength),
myColor (theColor), myColor (theColor),
myValuesOffset (theValuesOffset), myValuesOffset (theValuesOffset),
myNameOffset (theNameOffset) myNameOffset (theNameOffset)
@ -57,13 +57,13 @@ public:
const TCollection_ExtendedString& Name() const { return myName; } const TCollection_ExtendedString& Name() const { return myName; }
const Standard_Boolean ToDrawName() const { return myToDrawName; } const Standard_Boolean ToDrawName() const { return myToDrawName; }
void SetToDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; } void SetDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; }
const Standard_Boolean ToDrawTickmarks() const { return myToDrawTickmarks; } const Standard_Boolean ToDrawTickmarks() const { return myToDrawTickmarks; }
void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; } void SetDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; }
const Standard_Boolean ToDrawValues() const { return myToDrawValues; } const Standard_Boolean ToDrawValues() const { return myToDrawValues; }
void SetToDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; } void SetDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; }
const Quantity_Color& NameColor() const { return myNameColor; } const Quantity_Color& NameColor() const { return myNameColor; }
void SetNameColor (const Quantity_Color& theColor) { myNameColor = theColor; } void SetNameColor (const Quantity_Color& theColor) { myNameColor = theColor; }
@ -74,11 +74,11 @@ public:
//! Sets color of axis and values //! Sets color of axis and values
void SetColor (const Quantity_Color& theColor) { myColor = theColor; } void SetColor (const Quantity_Color& theColor) { myColor = theColor; }
const Standard_Integer TickmarkNumber() const { return myTickmarkNumber; } const Standard_Integer TickmarksNumber() const { return myTickmarksNumber; }
void SetTickmarkNumber (const Standard_Integer theValue) { myTickmarkNumber = theValue; } void SetTickmarksNumber (const Standard_Integer theValue) { myTickmarksNumber = theValue; }
const Standard_Integer TickmarkLength() const { return myTickmarkLength; } const Standard_Integer TickmarksLength() const { return myTickmarksLength; }
void SetTickmarkLength (const Standard_Integer theValue) { myTickmarkLength = theValue; } void SetTickmarksLength (const Standard_Integer theValue) { myTickmarksLength = theValue; }
const Standard_Integer ValuesOffset() const { return myValuesOffset; } const Standard_Integer ValuesOffset() const { return myValuesOffset; }
void SetValuesOffset (const Standard_Integer theValue) { myValuesOffset = theValue; } void SetValuesOffset (const Standard_Integer theValue) { myValuesOffset = theValue; }
@ -96,8 +96,8 @@ protected:
Quantity_Color myNameColor; Quantity_Color myNameColor;
Standard_Integer myTickmarkNumber; //!< Number of splits along axes Standard_Integer myTickmarksNumber; //!< Number of splits along axes
Standard_Integer myTickmarkLength; //!< Length of tickmarks Standard_Integer myTickmarksLength; //!< Length of tickmarks
Quantity_Color myColor; //!< Color of axis and values Quantity_Color myColor; //!< Color of axis and values
Standard_Integer myValuesOffset; //!< Offset for drawing values Standard_Integer myValuesOffset; //!< Offset for drawing values
@ -118,18 +118,18 @@ public:
//! Default constructor //! Default constructor
//! Constructs the default graduated trihedron with grid, X, Y, Z axes, and tickmarks //! Constructs the default graduated trihedron with grid, X, Y, Z axes, and tickmarks
Graphic3d_GraduatedTrihedron (const TCollection_AsciiString& theNamesFont = "Arial", Graphic3d_GraduatedTrihedron (const TCollection_AsciiString& theNamesFont = "Arial",
const Font_FontAspect& theNameStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12, const Font_FontAspect& theNamesStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12,
const TCollection_AsciiString& theValuesFont = "Arial", const TCollection_AsciiString& theValuesFont = "Arial",
const Font_FontAspect& theValuesStyle = Font_FA_Regular, const Standard_Integer theValuesSize = 12, const Font_FontAspect& theValuesStyle = Font_FA_Regular, const Standard_Integer theValuesSize = 12,
const Standard_ShortReal theArrowLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE, const Standard_ShortReal theArrowsLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE,
const Standard_Boolean theToDrawGrid = Standard_True, const Standard_Boolean theToDrawAxes = Standard_True) const Standard_Boolean theToDrawGrid = Standard_True, const Standard_Boolean theToDrawAxes = Standard_True)
: myNamesFont (theNamesFont), : myNamesFont (theNamesFont),
myNamesStyle (theNameStyle), myNamesStyle (theNamesStyle),
myNamesSize (theNamesSize), myNamesSize (theNamesSize),
myValuesFont (theValuesFont), myValuesFont (theValuesFont),
myValuesStyle (theValuesStyle), myValuesStyle (theValuesStyle),
myValuesSize (theValuesSize), myValuesSize (theValuesSize),
myArrowLength (theArrowLength), myArrowsLength (theArrowsLength),
myGridColor (theGridColor), myGridColor (theGridColor),
myToDrawGrid (theToDrawGrid), myToDrawGrid (theToDrawGrid),
myToDrawAxes (theToDrawAxes), myToDrawAxes (theToDrawAxes),
@ -157,17 +157,17 @@ public:
return myAxes (theIndex); return myAxes (theIndex);
} }
const Standard_ShortReal ArrowLength() const { return myArrowLength; } const Standard_ShortReal ArrowsLength() const { return myArrowsLength; }
void SetArrowLength (const Standard_ShortReal theValue) { myArrowLength = theValue; } void SetArrowsLength (const Standard_ShortReal theValue) { myArrowsLength = theValue; }
const Quantity_Color& GridColor() const { return myGridColor; } const Quantity_Color& GridColor() const { return myGridColor; }
void SetGridColor (const Quantity_Color& theColor) {myGridColor = theColor; } void SetGridColor (const Quantity_Color& theColor) {myGridColor = theColor; }
const Standard_Boolean ToDrawGrid() const { return myToDrawGrid; } const Standard_Boolean ToDrawGrid() const { return myToDrawGrid; }
void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; } void SetDrawGrid (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; }
const Standard_Boolean ToDrawAxes() const { return myToDrawAxes; } const Standard_Boolean ToDrawAxes() const { return myToDrawAxes; }
void SetToDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; } void SetDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; }
const TCollection_AsciiString& NamesFont() const { return myNamesFont; } const TCollection_AsciiString& NamesFont() const { return myNamesFont; }
void SetNamesFont (const TCollection_AsciiString& theFont) { myNamesFont = theFont; } void SetNamesFont (const TCollection_AsciiString& theFont) { myNamesFont = theFont; }
@ -206,7 +206,7 @@ protected:
protected: protected:
Standard_ShortReal myArrowLength; Standard_ShortReal myArrowsLength;
Quantity_Color myGridColor; Quantity_Color myGridColor;
Standard_Boolean myToDrawGrid; Standard_Boolean myToDrawGrid;

View File

@ -293,6 +293,7 @@ is
---------------------------------------- ----------------------------------------
ZBufferTriedronSetup ( me : mutable; ZBufferTriedronSetup ( me : mutable;
theCView : CView from Graphic3d;
XColor : NameOfColor from Quantity = Quantity_NOC_RED; XColor : NameOfColor from Quantity = Quantity_NOC_RED;
YColor : NameOfColor from Quantity = Quantity_NOC_GREEN; YColor : NameOfColor from Quantity = Quantity_NOC_GREEN;
ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1; ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1;

View File

@ -36,7 +36,8 @@ public:
Standard_EXPORT void SetAspect (const CALL_DEF_CONTEXTLINE& theAspect); Standard_EXPORT void SetAspect (const CALL_DEF_CONTEXTLINE& theAspect);
const TEL_COLOUR & Color() const { return myColor; } const TEL_COLOUR& Color() const { return myColor; }
TEL_COLOUR& ChangeColor() { return myColor; }
Aspect_TypeOfLine Type() const { return myType; } Aspect_TypeOfLine Type() const { return myType; }
float Width() const { return myWidth; } float Width() const { return myWidth; }

View File

@ -35,34 +35,50 @@
#include <OpenGl_Cylinder.hxx> #include <OpenGl_Cylinder.hxx>
#include <Precision.hxx> #include <Precision.hxx>
namespace
{
static const OpenGl_TextParam THE_LABEL_PARAMS =
{
16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
};
}
// ======================================================================= // =======================================================================
// function : Constructor // function : Constructor
// purpose : // purpose :
// ======================================================================= // =======================================================================
OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_GraduatedTrihedron& theData) OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron()
: myMin (0.0f, 0.0f, 0.0f), : myMin (0.0f, 0.0f, 0.0f),
myMax (100.0f, 100.0f, 100.0f), myMax (100.0f, 100.0f, 100.0f)
myData (theData)
{ {
//
}
// =======================================================================
// function : SetValues
// purpose :
// =======================================================================
void OpenGl_GraduatedTrihedron::SetValues (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theData)
{
Release (theCtx.operator->());
myData = theData;
// Initialize text label parameters for x, y, and z axes // Initialize text label parameters for x, y, and z axes
myAxes[0] = Axis (myData.XAxisAspect(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f)); myAxes[0] = Axis (myData.XAxisAspect(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
myAxes[1] = Axis (myData.YAxisAspect(), OpenGl_Vec3 (0.0f, 1.0f, 0.0f)); myAxes[1] = Axis (myData.YAxisAspect(), OpenGl_Vec3 (0.0f, 1.0f, 0.0f));
myAxes[2] = Axis (myData.ZAxisAspect(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f)); myAxes[2] = Axis (myData.ZAxisAspect(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
// Initialize constant primitives: text, arrows. // Initialize constant primitives: text, arrows.
myAxes[0].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
myAxes[0].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f)); myAxes[1].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
myAxes[2].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
myAxes[1].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
myAxes[2].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
for (Standard_Integer anIt = 0; anIt < 3; ++anIt) for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{ {
myAxes[anIt].Label.SetFontSize (NULL, theData.NamesSize()); myAxes[anIt].Label.SetFontSize (theCtx, theData.NamesSize());
} }
myLabelValues.SetFontSize (NULL, theData.ValuesSize()); myLabelValues.SetFontSize (theCtx, theData.ValuesSize());
myAspectLabels.SetFontAspect (theData.NamesFontAspect()); myAspectLabels.SetFontAspect (theData.NamesFontAspect());
myAspectLabels.ChangeFontName() = theData.NamesFont(); myAspectLabels.ChangeFontName() = theData.NamesFont();
@ -71,15 +87,9 @@ OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_GraduatedT
myAspectValues.ChangeFontName() = theData.ValuesFont(); myAspectValues.ChangeFontName() = theData.ValuesFont();
// Grid aspect // Grid aspect
Graphic3d_CAspectLine anAspect; myGridLineAspect.ChangeColor().rgb[0] = (Standard_ShortReal) theData.GridColor().Red();
anAspect.IsDef = 1; myGridLineAspect.ChangeColor().rgb[1] = (Standard_ShortReal) theData.GridColor().Green();
anAspect.IsSet = 1; myGridLineAspect.ChangeColor().rgb[2] = (Standard_ShortReal) theData.GridColor().Blue();
anAspect.Width = 1.0f;
anAspect.LineType = Aspect_TOL_SOLID;
anAspect.Color.r = (Standard_ShortReal) theData.GridColor().Red();
anAspect.Color.g = (Standard_ShortReal) theData.GridColor().Green();
anAspect.Color.b = (Standard_ShortReal) theData.GridColor().Blue();
myGridLineAspect.SetAspect (anAspect);
} }
// ======================================================================= // =======================================================================
@ -310,7 +320,7 @@ Standard_ExtCharacter OpenGl_GraduatedTrihedron::getGridAxes (const Standard_Sho
// function : renderLine // function : renderLine
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray* theLine, void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray& theLine,
const Handle(OpenGl_Workspace)& theWorkspace, const Handle(OpenGl_Workspace)& theWorkspace,
const OpenGl_Mat4& theMat, const OpenGl_Mat4& theMat,
const Standard_ShortReal theXt, const Standard_ShortReal theXt,
@ -322,7 +332,7 @@ void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray* theLine
OpenGl_Utils::Translate (aMat, theXt, theYt, theZt); OpenGl_Utils::Translate (aMat, theXt, theYt, theZt);
aContext->WorldViewState.SetCurrent (aMat); aContext->WorldViewState.SetCurrent (aMat);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
theLine->Render (theWorkspace); theLine.Render (theWorkspace);
} }
// ======================================================================= // =======================================================================
@ -335,7 +345,7 @@ void OpenGl_GraduatedTrihedron::renderGridPlane (const Handle(OpenGl_Workspace)&
OpenGl_Mat4& theMat) const OpenGl_Mat4& theMat) const
{ {
const Graphic3d_AxisAspect& aCurAspect = myData.AxisAspect (theIndex); const Graphic3d_AxisAspect& aCurAspect = myData.AxisAspect (theIndex);
if (aCurAspect.TickmarkNumber() <= 0) if (aCurAspect.TickmarksNumber() <= 0)
{ {
return; return;
} }
@ -343,10 +353,10 @@ void OpenGl_GraduatedTrihedron::renderGridPlane (const Handle(OpenGl_Workspace)&
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext(); const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex] Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex]
* (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarkNumber(); * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarksNumber();
// NOTE: // NOTE:
// Get two other axes directions and draw lines Axis.TickmarkNumber times. // Get two other axes directions and draw lines Axis.TickmarksNumber times.
// Combining together from three axes, these lines will make a grid. // Combining together from three axes, these lines will make a grid.
for (Standard_Integer anIter = 1; anIter <= 2; ++anIter) for (Standard_Integer anIter = 1; anIter <= 2; ++anIter)
{ {
@ -364,12 +374,12 @@ void OpenGl_GraduatedTrihedron::renderGridPlane (const Handle(OpenGl_Workspace)&
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
const OpenGl_Vec3 aStepVec (myAxes[theIndex].Direction * aStep); const OpenGl_Vec3 aStepVec (myAxes[theIndex].Direction * aStep);
for (Standard_Integer anIt = myData.ToDrawAxes() ? 1 : 0; anIt < aCurAspect.TickmarkNumber(); ++anIt) for (Standard_Integer anIt = myData.ToDrawAxes() ? 1 : 0; anIt < aCurAspect.TickmarksNumber(); ++anIt)
{ {
OpenGl_Utils::Translate (aMat, aStepVec.x(), aStepVec.y(), aStepVec.z()); OpenGl_Utils::Translate (aMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
aContext->WorldViewState.SetCurrent (aMat); aContext->WorldViewState.SetCurrent (aMat);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
anAxis.Line->Render (theWorkspace); anAxis.Line.Render (theWorkspace);
} }
} }
} }
@ -416,12 +426,12 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
aProjMat .Convert (aContext->ProjectionState.Current()); aProjMat .Convert (aContext->ProjectionState.Current());
// Get the window's (fixed) coordinates for before matrixes modifications // Get the window's (fixed) coordinates for before matrixes modifications
OpenGl_Vec3 aEndPoint = -anAxis.Direction * myData.ArrowLength(); OpenGl_Vec3 aEndPoint = -anAxis.Direction * myData.ArrowsLength();
OpenGl_Vec3 aWinPoint; OpenGl_Vec3 aWinPoint;
OpenGl_Utils::Project<Standard_ShortReal> (aEndPoint.x(), aEndPoint.y(), aEndPoint.z(), OpenGl_Utils::Project<Standard_ShortReal> (aEndPoint.x(), aEndPoint.y(), aEndPoint.z(),
aModelMat, aProjMat, aViewport, aModelMat, aProjMat, aViewport,
aWinPoint.x(), aWinPoint.y(), aWinPoint.z()); aWinPoint.x(), aWinPoint.y(), aWinPoint.z());
anAxis.Arrow->Render (theWorkspace); anAxis.Arrow.Render (theWorkspace);
theWorkspace->ActiveView()->EndTransformPersistence (aContext); theWorkspace->ActiveView()->EndTransformPersistence (aContext);
// Get current Model-View and Projection states after the end of Transform Persistence // Get current Model-View and Projection states after the end of Transform Persistence
@ -445,7 +455,7 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
aContext->WorldViewState.SetCurrent (aModelMat); aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
anAxis.Line->Render (theWorkspace); anAxis.Line.Render (theWorkspace);
} }
// ======================================================================= // =======================================================================
@ -468,27 +478,27 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
const Axis& anAxis = myAxes[theIndex]; const Axis& anAxis = myAxes[theIndex];
const OpenGl_Vec3 aSizeVec (myMax - myMin); const OpenGl_Vec3 aSizeVec (myMax - myMin);
Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex] Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex]
* (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarkNumber(); * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarksNumber();
OpenGl_Vec3 aDir = (theGridAxes.Ticks[theIndex] - theGridAxes.Origin).Normalized(); OpenGl_Vec3 aDir = (theGridAxes.Ticks[theIndex] - theGridAxes.Origin).Normalized();
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext(); const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarkNumber() > 0) if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarksNumber() > 0)
{ {
theWorkspace->SetAspectLine (&myGridLineAspect); theWorkspace->SetAspectLine (&myGridLineAspect);
OpenGl_Mat4 aModelMat (theMat); OpenGl_Mat4 aModelMat (theMat);
anAxis.InitTickmark (aContext, aDir * (Standard_ShortReal) aCurAspect.TickmarkLength() * theDpix); anAxis.InitTickmark (aContext, aDir * (Standard_ShortReal) aCurAspect.TickmarksLength() * theDpix);
OpenGl_Utils::Translate (aModelMat, theGridAxes.Ticks[theIndex].x(), OpenGl_Utils::Translate (aModelMat, theGridAxes.Ticks[theIndex].x(),
theGridAxes.Ticks[theIndex].y(), theGridAxes.Ticks[theIndex].y(),
theGridAxes.Ticks[theIndex].z()); theGridAxes.Ticks[theIndex].z());
aContext->WorldViewState.SetCurrent (aModelMat); aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
OpenGl_Vec3 aStepVec = anAxis.Direction * aStep; OpenGl_Vec3 aStepVec = anAxis.Direction * aStep;
for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarkNumber(); ++anIter) for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarksNumber(); ++anIter)
{ {
anAxis.Tickmark->Render (theWorkspace); anAxis.Tickmark.Render (theWorkspace);
OpenGl_Utils::Translate (aModelMat, aStepVec.x(), aStepVec.y(), aStepVec.z()); OpenGl_Utils::Translate (aModelMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
aContext->WorldViewState.SetCurrent (aModelMat); aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
@ -501,7 +511,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
if (aCurAspect.ToDrawName()) if (aCurAspect.ToDrawName())
{ {
Standard_Real anOffset = aCurAspect.NameOffset() + aCurAspect.TickmarkLength(); Standard_Real anOffset = aCurAspect.NameOffset() + aCurAspect.TickmarksLength();
OpenGl_Vec3 aMiddle (theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f + aDir * (Standard_ShortReal)(theDpix * anOffset)); OpenGl_Vec3 aMiddle (theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f + aDir * (Standard_ShortReal)(theDpix * anOffset));
@ -511,13 +521,13 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
anAxis.Label.Render (theWorkspace); anAxis.Label.Render (theWorkspace);
} }
if (aCurAspect.ToDrawValues() && aCurAspect.TickmarkNumber() > 0) if (aCurAspect.ToDrawValues() && aCurAspect.TickmarksNumber() > 0)
{ {
myAspectValues.ChangeColor() = anAxis.LineAspect.Color(); myAspectValues.ChangeColor() = anAxis.LineAspect.Color();
theWorkspace->SetAspectText (&myAspectValues); theWorkspace->SetAspectText (&myAspectValues);
Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarkLength(); Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarksLength();
for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarkNumber(); ++anIt) for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarksNumber(); ++anIt)
{ {
sprintf (aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep); sprintf (aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep);
OpenGl_Vec3 aPos (theGridAxes.Ticks[theIndex] + anAxis.Direction* (Standard_ShortReal) (anIt * aStep) + aDir * (Standard_ShortReal) (theDpix * anOffset)); OpenGl_Vec3 aPos (theGridAxes.Ticks[theIndex] + anAxis.Direction* (Standard_ShortReal) (anIt * aStep) + aDir * (Standard_ShortReal) (theDpix * anOffset));
@ -542,7 +552,9 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks
if (myData.CubicAxesCallback) if (myData.CubicAxesCallback)
{ {
myData.CubicAxesCallback (myData.PtrVisual3dView); myData.CubicAxesCallback (myData.PtrVisual3dView);
if (myAxes[0].Line == NULL || myAxes[1].Line == NULL || myAxes[2].Line == NULL if (!myAxes[0].Line.IsInitialized()
|| !myAxes[1].Line.IsInitialized()
|| !myAxes[2].Line.IsInitialized()
|| OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion() || OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion()
|| OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion()) || OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion())
{ {
@ -695,46 +707,44 @@ void OpenGl_GraduatedTrihedron::SetMinMax (const OpenGl_Vec3& theMin, const Open
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect, OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
const OpenGl_Vec3& theDirection) const OpenGl_Vec3& theDirection)
: Direction (theDirection), : Direction (theDirection),
Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), theDirection, THE_LABEL_PARAMS),
Direction, THE_LABEL_PARAMS) Tickmark (NULL),
Line (NULL),
Arrow (NULL)
{ {
NameColor.rgb[0] = (Standard_ShortReal) theAspect.NameColor().Red(); NameColor.rgb[0] = (Standard_ShortReal) theAspect.NameColor().Red();
NameColor.rgb[1] = (Standard_ShortReal) theAspect.NameColor().Green(); NameColor.rgb[1] = (Standard_ShortReal) theAspect.NameColor().Green();
NameColor.rgb[2] = (Standard_ShortReal) theAspect.NameColor().Blue(); NameColor.rgb[2] = (Standard_ShortReal) theAspect.NameColor().Blue();
NameColor.rgb[3] = 1.0f; NameColor.rgb[3] = 1.0f;
// Fill aspect LineAspect.ChangeColor().rgb[0] = (Standard_ShortReal) theAspect.Color().Red();
Graphic3d_CAspectLine anAspect; LineAspect.ChangeColor().rgb[1] = (Standard_ShortReal) theAspect.Color().Green();
anAspect.IsDef = 1; LineAspect.ChangeColor().rgb[2] = (Standard_ShortReal) theAspect.Color().Blue();
anAspect.IsSet = 1;
anAspect.Width = 1.0f;
anAspect.LineType = Aspect_TOL_SOLID;
anAspect.Color.r = (Standard_ShortReal) theAspect.Color().Red();
anAspect.Color.g = (Standard_ShortReal) theAspect.Color().Green();
anAspect.Color.b = (Standard_ShortReal) theAspect.Color().Blue();
LineAspect.SetAspect (anAspect);
// Create primitives
Line = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_SEGMENTS, NULL, NULL, NULL);
Tickmark = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_SEGMENTS, NULL, NULL, NULL);
Arrow = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_POLYLINES, NULL, NULL, NULL);
} }
// ======================================================================= // =======================================================================
// method : OpenGl_GraduatedTrihedron::Axis operator = // method : OpenGl_GraduatedTrihedron::Axis::~Axis
// purpose : // purpose :
// ======================================================================= // =======================================================================
OpenGl_GraduatedTrihedron::Axis& OpenGl_GraduatedTrihedron::Axis::~Axis()
OpenGl_GraduatedTrihedron::Axis::operator= (const Axis& theOther) {
//
}
// =======================================================================
// method : OpenGl_GraduatedTrihedron::Axis operator=
// purpose :
// =======================================================================
OpenGl_GraduatedTrihedron::Axis& OpenGl_GraduatedTrihedron::Axis::operator= (const Axis& theOther)
{ {
Direction = theOther.Direction; Direction = theOther.Direction;
NameColor = theOther.NameColor; NameColor = theOther.NameColor;
LineAspect = theOther.LineAspect; LineAspect = theOther.LineAspect;
Label = theOther.Label; Label = theOther.Label;
Line->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line->Indices(), theOther.Line->Attributes(), theOther.Line->Bounds()); Line .InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line.Indices(), theOther.Line.Attributes(), theOther.Line.Bounds());
Tickmark->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark->Indices(), theOther.Tickmark->Attributes(), theOther.Tickmark->Bounds()); Tickmark.InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark.Indices(), theOther.Tickmark.Attributes(), theOther.Tickmark.Bounds());
Arrow->InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow->Indices(), theOther.Arrow->Attributes(), theOther.Arrow->Bounds()); Arrow .InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow.Indices(), theOther.Arrow.Attributes(), theOther.Arrow.Bounds());
return *this; return *this;
} }
@ -769,7 +779,7 @@ void OpenGl_GraduatedTrihedron::Axis::InitArrow (const Handle(OpenGl_Context)& t
anArray->AddVertex (aPoint3); anArray->AddVertex (aPoint3);
anArray->AddVertex (aPoint1); anArray->AddVertex (aPoint1);
Arrow->InitBuffers (theContext, Graphic3d_TOPA_POLYLINES, Arrow.InitBuffers (theContext, Graphic3d_TOPA_POLYLINES,
anArray->Indices(), anArray->Attributes(), anArray->Bounds()); anArray->Indices(), anArray->Attributes(), anArray->Bounds());
} }
@ -784,7 +794,7 @@ void OpenGl_GraduatedTrihedron::Axis::InitTickmark (const Handle(OpenGl_Context)
Handle(Graphic3d_ArrayOfSegments) anArray = new Graphic3d_ArrayOfSegments (2); Handle(Graphic3d_ArrayOfSegments) anArray = new Graphic3d_ArrayOfSegments (2);
anArray->AddVertex (0.0f, 0.0f, 0.0f); anArray->AddVertex (0.0f, 0.0f, 0.0f);
anArray->AddVertex (theDir); anArray->AddVertex (theDir);
Tickmark->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS, Tickmark.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
anArray->Indices(), anArray->Attributes(), anArray->Bounds()); anArray->Indices(), anArray->Attributes(), anArray->Bounds());
} }
@ -801,7 +811,7 @@ void OpenGl_GraduatedTrihedron::Axis::InitLine (const Handle(OpenGl_Context)& th
anArray->AddVertex (0.0f, 0.0f, 0.0f); anArray->AddVertex (0.0f, 0.0f, 0.0f);
anArray->AddVertex (theDir); anArray->AddVertex (theDir);
Line->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS, Line.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
anArray->Indices(), anArray->Attributes(), anArray->Bounds()); anArray->Indices(), anArray->Attributes(), anArray->Bounds());
} }
@ -811,8 +821,8 @@ void OpenGl_GraduatedTrihedron::Axis::InitLine (const Handle(OpenGl_Context)& th
// ======================================================================= // =======================================================================
void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx) void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx)
{ {
Label.Release (theCtx); Label .Release (theCtx);
Tickmark->Release (theCtx); Tickmark.Release (theCtx);
Line->Release (theCtx); Line .Release (theCtx);
Arrow->Release (theCtx); Arrow .Release (theCtx);
} }

View File

@ -29,11 +29,6 @@
class Visual3d_View; class Visual3d_View;
class OpenGl_View; class OpenGl_View;
static const OpenGl_TextParam THE_LABEL_PARAMS =
{
16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
};
//! This class allows to render Graduated Trihedron, i.e. trihedron with grid. //! This class allows to render Graduated Trihedron, i.e. trihedron with grid.
//! it is based on Graphic3d_GraduatedTrihedron parameters and support its customization //! it is based on Graphic3d_GraduatedTrihedron parameters and support its customization
//! on construction level only. //! on construction level only.
@ -46,20 +41,27 @@ public:
public: public:
OpenGl_GraduatedTrihedron (const Graphic3d_GraduatedTrihedron& theData); //! Default constructor.
OpenGl_GraduatedTrihedron();
//! Destructor.
virtual ~OpenGl_GraduatedTrihedron();
//! Draw the element.
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Release OpenGL resources.
virtual void Release (OpenGl_Context* theCtx); virtual void Release (OpenGl_Context* theCtx);
//! Setup configuration.
void SetValues (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theData);
//! Sets up-to-date values of scene bounding box. //! Sets up-to-date values of scene bounding box.
//! Can be used in callback mechanism to get up-to-date values. //! Can be used in callback mechanism to get up-to-date values.
//! @sa Graphic3d_GraduatedTrihedron::CubicAxesCallback //! @sa Graphic3d_GraduatedTrihedron::CubicAxesCallback
void SetMinMax (const OpenGl_Vec3& theMin, const OpenGl_Vec3& theMax); void SetMinMax (const OpenGl_Vec3& theMin,
const OpenGl_Vec3& theMax);
protected:
virtual ~OpenGl_GraduatedTrihedron();
private: private:
@ -72,23 +74,18 @@ private:
TEL_COLOUR NameColor; TEL_COLOUR NameColor;
OpenGl_AspectLine LineAspect; OpenGl_AspectLine LineAspect;
mutable OpenGl_Text Label; mutable OpenGl_Text Label;
mutable OpenGl_PrimitiveArray* Tickmark; mutable OpenGl_PrimitiveArray Tickmark;
mutable OpenGl_PrimitiveArray* Line; mutable OpenGl_PrimitiveArray Line;
mutable OpenGl_PrimitiveArray* Arrow; mutable OpenGl_PrimitiveArray Arrow;
public: public:
Axis (const Graphic3d_AxisAspect& theAspect = Graphic3d_AxisAspect(), Axis (const Graphic3d_AxisAspect& theAspect = Graphic3d_AxisAspect(),
const OpenGl_Vec3& theDirection = OpenGl_Vec3 (1.0f, 0.0f, 0.0f)); const OpenGl_Vec3& theDirection = OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
Axis& operator= (const Axis& theOther); ~Axis();
~Axis() Axis& operator= (const Axis& theOther);
{
OpenGl_Element::Destroy (NULL, Line);
OpenGl_Element::Destroy (NULL, Tickmark);
OpenGl_Element::Destroy (NULL, Arrow);
}
void InitArrow (const Handle(OpenGl_Context)& theContext, void InitArrow (const Handle(OpenGl_Context)& theContext,
const Standard_ShortReal theLength, const Standard_ShortReal theLength,
@ -101,6 +98,7 @@ private:
const OpenGl_Vec3& theDir) const; const OpenGl_Vec3& theDir) const;
void Release (OpenGl_Context* theCtx); void Release (OpenGl_Context* theCtx);
}; };
private: private:
@ -165,7 +163,7 @@ private:
//! @param thaTx the X for vector of translation //! @param thaTx the X for vector of translation
//! @param thaTy the Y for vector of translation //! @param thaTy the Y for vector of translation
//! @param thaTz the Z for vector of translation //! @param thaTz the Z for vector of translation
void renderLine (const OpenGl_PrimitiveArray* theLine, void renderLine (const OpenGl_PrimitiveArray& theLine,
const Handle(OpenGl_Workspace)& theWorkspace, const Handle(OpenGl_Workspace)& theWorkspace,
const OpenGl_Mat4& theMat, const OpenGl_Mat4& theMat,
const Standard_ShortReal theXt, const Standard_ShortReal theXt,
@ -206,7 +204,6 @@ private:
const GridAxes& theGridAxes, const GridAxes& theGridAxes,
const Standard_ShortReal theDpix) const; const Standard_ShortReal theDpix) const;
protected: //! @name Scene bounding box values protected: //! @name Scene bounding box values
OpenGl_Vec3 myMin; OpenGl_Vec3 myMin;

View File

@ -492,14 +492,25 @@ Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
// function : ZBufferTriedronSetup // function : ZBufferTriedronSetup
// purpose : // purpose :
// ======================================================================= // =======================================================================
void OpenGl_GraphicDriver::ZBufferTriedronSetup (const Quantity_NameOfColor theXColor, void OpenGl_GraphicDriver::ZBufferTriedronSetup (const Graphic3d_CView& theCView,
const Quantity_NameOfColor theXColor,
const Quantity_NameOfColor theYColor, const Quantity_NameOfColor theYColor,
const Quantity_NameOfColor theZColor, const Quantity_NameOfColor theZColor,
const Standard_Real theSizeRatio, const Standard_Real theSizeRatio,
const Standard_Real theAxisDiametr, const Standard_Real theAxisDiametr,
const Standard_Integer theNbFacettes) const Standard_Integer theNbFacets)
{ {
OpenGl_Trihedron::Setup (theXColor, theYColor, theZColor, theSizeRatio, theAxisDiametr, theNbFacettes); const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
if (aCView == NULL)
{
return;
}
OpenGl_Trihedron& aTrih = aCView->View->ChangeTrihedron();
aTrih.SetArrowsColors (theXColor, theYColor, theZColor);
aTrih.SetSizeRatio (theSizeRatio);
aTrih.SetNbFacets (theNbFacets);
aTrih.SetArrowDiameter (theAxisDiametr);
} }
// ======================================================================= // =======================================================================
@ -515,7 +526,7 @@ void OpenGl_GraphicDriver::TriedronDisplay (const Graphic3d_CView&
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView; const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
if (aCView != NULL) if (aCView != NULL)
{ {
aCView->View->TriedronDisplay (aCView->WS->GetGlContext(), thePosition, theColor, theScale, theAsWireframe); aCView->View->TriedronDisplay (thePosition, theColor, theScale, theAsWireframe);
} }
} }
@ -639,6 +650,6 @@ void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues (const Graphic3d_CView
const OpenGl_CView* aCView = (const OpenGl_CView* )theView.ptrView; const OpenGl_CView* aCView = (const OpenGl_CView* )theView.ptrView;
if (aCView != NULL) if (aCView != NULL)
{ {
aCView->View->GraduatedTrihedron()->SetMinMax (theMin, theMax); aCView->View->ChangeGraduatedTrihedron().SetMinMax (theMin, theMax);
} }
} }

View File

@ -167,7 +167,13 @@ public:
Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView); Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView); Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
Standard_EXPORT void Environment (const Graphic3d_CView& ACView); Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12); Standard_EXPORT void ZBufferTriedronSetup (const Graphic3d_CView& theCView,
const Quantity_NameOfColor XColor = Quantity_NOC_RED,
const Quantity_NameOfColor YColor = Quantity_NOC_GREEN,
const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1,
const Standard_Real SizeRatio = 0.8,
const Standard_Real AxisDiametr = 0.05,
const Standard_Integer NbFacettes = 12);
Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True); Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True);
Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView); Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE); Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);

View File

@ -287,6 +287,7 @@ Standard_Boolean OpenGl_PrimitiveArray::buildVBO (const Handle(OpenGl_Context)&
const Standard_Boolean theToKeepData) const const Standard_Boolean theToKeepData) const
{ {
bool isNormalMode = theCtx->ToUseVbo(); bool isNormalMode = theCtx->ToUseVbo();
clearMemoryGL (theCtx);
if (myAttribs.IsNull() if (myAttribs.IsNull()
|| myAttribs->IsEmpty() || myAttribs->IsEmpty()
|| myAttribs->NbElements < 1 || myAttribs->NbElements < 1

View File

@ -66,6 +66,9 @@ public:
//! Notice that this flag does not indicate VBOs validity. //! Notice that this flag does not indicate VBOs validity.
Standard_Boolean IsInitialized() const { return myIsVboInit; } Standard_Boolean IsInitialized() const { return myIsVboInit; }
//! Invalidate VBO content without destruction.
void Invalidate() const { myIsVboInit = Standard_False; }
//! @return primitive type (GL_LINES, GL_TRIANGLES and others) //! @return primitive type (GL_LINES, GL_TRIANGLES and others)
GLint DrawMode() const { return myDrawMode; } GLint DrawMode() const { return myDrawMode; }

View File

@ -21,43 +21,15 @@
#include <Graphic3d_ArrayOfPolylines.hxx> #include <Graphic3d_ArrayOfPolylines.hxx>
#include <OpenGl_View.hxx> #include <OpenGl_View.hxx>
#include <OpenGl_Workspace.hxx> #include <OpenGl_Workspace.hxx>
#include <Precision.hxx>
static const OpenGl_TextParam THE_LABEL_PARAMS = namespace
{ {
static const OpenGl_TextParam THE_LABEL_PARAMS =
{
16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
}; };
}
static const CALL_DEF_CONTEXTLINE myDefaultContextLine =
{
1, //IsDef
1, //IsSet
{ 1.F, 1.F, 1.F }, //Color
Aspect_TOL_SOLID, //LineType
1.F //Width
};
static const CALL_DEF_CONTEXTTEXT myDefaultContextText =
{
1, //IsDef
1, //IsSet
"Courier", //Font
0.3F, //Space
1.0F, //Expan
{ 1.F, 1.F, 1.F }, //Color
Aspect_TOST_NORMAL, //Style
Aspect_TODT_NORMAL, //DisplayType
{ 1.F, 1.F, 1.F }, //ColorSubTitle
0, //TextZoomable
0.F, //TextAngle
Font_FA_Regular //TextFontAspect
};
static TEL_COLOUR theXColor = {{ 1.F, 0.F, 0.F, 0.6F }};
static TEL_COLOUR theYColor = {{ 0.F, 1.F, 0.F, 0.6F }};
static TEL_COLOUR theZColor = {{ 0.F, 0.F, 1.F, 0.6F }};
static float theRatio = 0.8f;
static float theDiameter = 0.05f;
static int theNbFacettes = 12;
// ======================================================================= // =======================================================================
// function : resetTransformations // function : resetTransformations
@ -198,12 +170,12 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
anCircleArray->Attributes(), anCircleArray->Bounds()); anCircleArray->Attributes(), anCircleArray->Bounds());
} }
if (!myDisk.IsDefined()) if (!myDisk.IsInitialized())
{ {
myDisk.Init (0.0, static_cast<GLfloat> (aConeDiametr), myNbFacettes, 1); myDisk.Init (0.0, static_cast<GLfloat> (aConeDiametr), myNbFacettes, 1);
} }
if (!myCone.IsDefined()) if (!myCone.IsInitialized())
{ {
myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1); myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1);
} }
@ -212,9 +184,9 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
OpenGl_AspectFace anAspectY; OpenGl_AspectFace anAspectY;
OpenGl_AspectFace anAspectZ; OpenGl_AspectFace anAspectZ;
OpenGl_AspectLine anAspectLine; OpenGl_AspectLine anAspectLine;
memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.GetData(), sizeof (TEL_COLOUR));
memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.GetData(), sizeof (TEL_COLOUR));
memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.GetData(), sizeof (TEL_COLOUR));
OpenGl_Mat4d aModelMatrix; OpenGl_Mat4d aModelMatrix;
aModelMatrix.Convert (aContext->WorldViewState.Current()); aModelMatrix.Convert (aContext->WorldViewState.Current());
OpenGl_Mat4d aModelViewX (aModelMatrix); OpenGl_Mat4d aModelViewX (aModelMatrix);
@ -224,9 +196,9 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
// Set line aspect // Set line aspect
const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->AspectLine (Standard_True); const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->AspectLine (Standard_True);
CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F }, aCurrentAspectLine->Type(), aCurrentAspectLine->Width()}; CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F }, aCurrentAspectLine->Type(), aCurrentAspectLine->Width()};
aLineAspect.Color.r = myZColor.rgb[0]; aLineAspect.Color.r = myZColor.r();
aLineAspect.Color.g = myZColor.rgb[1]; aLineAspect.Color.g = myZColor.g();
aLineAspect.Color.b = myZColor.rgb[2]; aLineAspect.Color.b = myZColor.b();
anAspectLine.SetAspect (aLineAspect); anAspectLine.SetAspect (aLineAspect);
// Disable depth test and face culling // Disable depth test and face culling
@ -271,9 +243,9 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewX); aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewX);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
aLineAspect.Color.r = myXColor.rgb[0]; aLineAspect.Color.r = myXColor.r();
aLineAspect.Color.g = myXColor.rgb[1]; aLineAspect.Color.g = myXColor.g();
aLineAspect.Color.b = myXColor.rgb[2]; aLineAspect.Color.b = myXColor.b();
anAspectLine.SetAspect (aLineAspect); anAspectLine.SetAspect (aLineAspect);
theWorkspace->SetAspectLine (&anAspectLine); theWorkspace->SetAspectLine (&anAspectLine);
myLine.Render (theWorkspace); myLine.Render (theWorkspace);
@ -289,9 +261,9 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewY); aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewY);
aContext->ApplyWorldViewMatrix(); aContext->ApplyWorldViewMatrix();
aLineAspect.Color.r = myYColor.rgb[0]; aLineAspect.Color.r = myYColor.r();
aLineAspect.Color.g = myYColor.rgb[1]; aLineAspect.Color.g = myYColor.g();
aLineAspect.Color.b = myYColor.rgb[2]; aLineAspect.Color.b = myYColor.b();
anAspectLine.SetAspect (aLineAspect); anAspectLine.SetAspect (aLineAspect);
theWorkspace->SetAspectLine (&anAspectLine); theWorkspace->SetAspectLine (&anAspectLine);
myLine.Render (theWorkspace); myLine.Render (theWorkspace);
@ -349,8 +321,7 @@ void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspa
resetTransformations (theWorkspace); resetTransformations (theWorkspace);
GLdouble aScale = myScale; const GLdouble aScale = myScale * myRatio;
aScale *= myRatio;
const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
const TEL_COLOUR& aLineColor = anAspectLine->Color(); const TEL_COLOUR& aLineColor = anAspectLine->Color();
@ -365,24 +336,24 @@ void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspa
// Position des Axes // Position des Axes
GLdouble aTriedronAxeX[3] = { aScale, 0.0, 0.0 }; GLdouble aTriedronAxeX[3] = { aScale, 0.0, 0.0 };
GLdouble aTriedronAxeY[3] = { 0.0, aScale, 0.0 }; GLdouble aTriedronAxeY[3] = { 0.0, aScale, 0.0 };
if (!myDisk.IsDefined()) if (!myDisk.IsInitialized())
{ {
myDisk.Init (static_cast<GLfloat> (aCylinderDiametr), myDisk.Init (static_cast<GLfloat> (aCylinderDiametr),
static_cast<GLfloat> (aConeDiametr), static_cast<GLfloat> (aConeDiametr),
myNbFacettes, 1); myNbFacettes, 1);
} }
if (!mySphere.IsDefined()) if (!mySphere.IsInitialized())
{ {
mySphere.Init (static_cast<GLfloat> (aCylinderDiametr * 2.0), myNbFacettes, myNbFacettes); mySphere.Init (static_cast<GLfloat> (aCylinderDiametr * 2.0), myNbFacettes, myNbFacettes);
} }
if (!myCone.IsDefined()) if (!myCone.IsInitialized())
{ {
myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1); myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1);
} }
if (!myCylinder.IsDefined()) if (!myCylinder.IsInitialized())
{ {
myCylinder.Init (static_cast<GLfloat> (aCylinderDiametr), myCylinder.Init (static_cast<GLfloat> (aCylinderDiametr),
static_cast<GLfloat> (aCylinderDiametr), static_cast<GLfloat> (aCylinderDiametr),
@ -416,9 +387,9 @@ void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspa
OpenGl_AspectFace anAspectX; OpenGl_AspectFace anAspectX;
OpenGl_AspectFace anAspectY; OpenGl_AspectFace anAspectY;
OpenGl_AspectFace anAspectZ; OpenGl_AspectFace anAspectZ;
memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.GetData(), sizeof (TEL_COLOUR));
memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.GetData(), sizeof (TEL_COLOUR));
memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.GetData(), sizeof (TEL_COLOUR));
memcpy (anAspectC.ChangeIntFront().matcol.rgb, aLineColor.rgb, sizeof (TEL_COLOUR)); memcpy (anAspectC.ChangeIntFront().matcol.rgb, aLineColor.rgb, sizeof (TEL_COLOUR));
OpenGl_Mat4d aModelMatrix; OpenGl_Mat4d aModelMatrix;
@ -512,42 +483,26 @@ void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspa
// function : OpenGl_Trihedron // function : OpenGl_Trihedron
// purpose : // purpose :
// ======================================================================= // =======================================================================
OpenGl_Trihedron::OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition thePosition, OpenGl_Trihedron::OpenGl_Trihedron()
const Quantity_NameOfColor theColor, : myPos (Aspect_TOTP_LEFT_LOWER),
const Standard_Real theScale, myScale (1.0),
const Standard_Boolean theAsWireframe) myIsWireframe (Standard_False),
: myPos (thePosition), myXColor (1.0f, 0.0f, 0.0f, 0.6f),
myScale (theScale), myYColor (0.0f, 1.0f, 0.0f, 0.6f),
myIsWireframe (theAsWireframe), myZColor (0.0f, 0.0f, 1.0f, 0.6f),
myRatio (0.8f),
myDiameter (0.05f),
myNbFacettes (12),
myLabelX ("X", OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS), myLabelX ("X", OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
myLabelY ("Y", OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS), myLabelY ("Y", OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
myLabelZ ("Z", OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS), myLabelZ ("Z", OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS),
myLine (NULL), // do not register arrays UID - trihedron is not intended to be drawn by Ray Tracing engine myLine (NULL), // do not register arrays UID - trihedron is not intended to be drawn by Ray Tracing engine
myCircle (NULL) myCircle (NULL)
{ {
Standard_Real R,G,B; const TEL_COLOUR aWhiteColor = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
Quantity_Color aColor (theColor); myAspectLine.ChangeColor() = aWhiteColor;
aColor.Values (R, G, B, Quantity_TOC_RGB); myAspectText.ChangeColor() = aWhiteColor;
myAspectText.ChangeFontName() = "Courier";
CALL_DEF_CONTEXTLINE aLineAspect = myDefaultContextLine;
aLineAspect.Color.r = (float)R;
aLineAspect.Color.g = (float)G;
aLineAspect.Color.b = (float)B;
myAspectLine.SetAspect (aLineAspect);
CALL_DEF_CONTEXTTEXT aTextAspect = myDefaultContextText;
aTextAspect.Color.r = (float)R;
aTextAspect.Color.g = (float)G;
aTextAspect.Color.b = (float)B;
myAspectText.SetAspect (aTextAspect);
myXColor = theXColor;
myYColor = theYColor;
myZColor = theZColor;
myRatio = theRatio;
myDiameter = theDiameter;
myNbFacettes = theNbFacettes;
} }
// ======================================================================= // =======================================================================
@ -578,6 +533,96 @@ void OpenGl_Trihedron::Release (OpenGl_Context* theCtx)
myCircle.Release (theCtx); myCircle.Release (theCtx);
} }
// =======================================================================
// function : invalidate
// purpose :
// =======================================================================
void OpenGl_Trihedron::invalidate()
{
myCone .Invalidate();
myDisk .Invalidate();
mySphere .Invalidate();
myCylinder.Invalidate();
myLine .Invalidate();
myCircle .Invalidate();
}
// =======================================================================
// function : SetScale
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetScale (const Standard_Real theScale)
{
if (Abs (myScale - theScale) > Precision::Confusion())
{
invalidate();
}
myScale = theScale;
}
// =======================================================================
// function : SetSizeRatio
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetSizeRatio (const Standard_Real theRatio)
{
if (Abs (Standard_Real(myRatio) - theRatio) > Precision::Confusion())
{
invalidate();
}
myRatio = float(theRatio);
}
// =======================================================================
// function : SetArrowDiameter
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetArrowDiameter (const Standard_Real theDiam)
{
if (Abs (Standard_Real(myDiameter) - theDiam) > Precision::Confusion())
{
invalidate();
}
myDiameter = float(theDiam);
}
// =======================================================================
// function : SetNbFacets
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetNbFacets (const Standard_Integer theNbFacets)
{
if (Abs (myNbFacettes - theNbFacets) > 0)
{
invalidate();
}
myNbFacettes = theNbFacets;
}
// =======================================================================
// function : SetLabelsColor
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetLabelsColor (const Quantity_Color& theColor)
{
myAspectText.ChangeColor().rgb[0] = float(theColor.Red());
myAspectText.ChangeColor().rgb[1] = float(theColor.Green());
myAspectText.ChangeColor().rgb[2] = float(theColor.Blue());
}
// =======================================================================
// function : SetArrowsColors
// purpose :
// =======================================================================
void OpenGl_Trihedron::SetArrowsColors (const Quantity_Color& theColorX,
const Quantity_Color& theColorY,
const Quantity_Color& theColorZ)
{
myXColor = OpenGl_Vec4 (float(theColorX.Red()), float(theColorX.Green()), float(theColorX.Blue()), 0.6f);
myYColor = OpenGl_Vec4 (float(theColorY.Red()), float(theColorY.Green()), float(theColorY.Blue()), 0.6f);
myZColor = OpenGl_Vec4 (float(theColorZ.Red()), float(theColorZ.Green()), float(theColorZ.Blue()), 0.6f);
}
// ======================================================================= // =======================================================================
// function : Render // function : Render
// purpose : // purpose :
@ -620,30 +665,3 @@ void OpenGl_Trihedron::Render (const Handle(OpenGl_Workspace)& theWorkspace) con
theWorkspace->SetAspectText (aPrevAspectText); theWorkspace->SetAspectText (aPrevAspectText);
theWorkspace->SetAspectLine (aPrevAspectLine); theWorkspace->SetAspectLine (aPrevAspectLine);
} }
/*----------------------------------------------------------------------*/
//call_ztriedron_setup
void OpenGl_Trihedron::Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor,
const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes)
{
Standard_Real R,G,B;
Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB);
theXColor.rgb[0] = float (R);
theXColor.rgb[1] = float (G);
theXColor.rgb[2] = float (B);
Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB);
theYColor.rgb[0] = float (R);
theYColor.rgb[1] = float (G);
theYColor.rgb[2] = float (B);
Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB);
theZColor.rgb[0] = float (R);
theZColor.rgb[1] = float (G);
theZColor.rgb[2] = float (B);
theRatio = float (SizeRatio);
theDiameter = float (AxisDiametr);
theNbFacettes = NbFacettes;
}

View File

@ -32,31 +32,55 @@ class OpenGl_Trihedron : public OpenGl_Element
{ {
public: public:
static void Setup(const Quantity_NameOfColor theXColor, //! Default constructor.
const Quantity_NameOfColor theYColor, OpenGl_Trihedron();
const Quantity_NameOfColor theZColor,
const Standard_Real theSizeRatio, //! Destructor.
const Standard_Real theAxisDiametr, virtual ~OpenGl_Trihedron();
const Standard_Integer theNbFacettes);
//! Render the element.
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Release OpenGL resources.
virtual void Release (OpenGl_Context* theCtx);
public: public:
OpenGl_Trihedron(const Aspect_TypeOfTriedronPosition thePosition, //! Switch wireframe / shaded trihedron.
const Quantity_NameOfColor theColor, void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; }
const Standard_Real theScale,
const Standard_Boolean theAsWireframe);
virtual void Render(const Handle(OpenGl_Workspace)& theWorkspace) const; //! Setup the corner to draw the trihedron.
virtual void Release(OpenGl_Context* theCtx); void SetPosition (const Aspect_TypeOfTriedronPosition thePosition) { myPos = thePosition; }
//! Setup the scale factor.
void SetScale (const Standard_Real theScale);
//! Setup the size ratio factor.
void SetSizeRatio (const Standard_Real theRatio);
//! Setup the arrow diameter.
void SetArrowDiameter (const Standard_Real theDiam);
//! Setup the number of facets for tessellation.
void SetNbFacets (const Standard_Integer theNbFacets);
//! Setup color of text labels.
void SetLabelsColor (const Quantity_Color& theColor);
//! Setup per-arrow color.
void SetArrowsColors (const Quantity_Color& theColorX,
const Quantity_Color& theColorY,
const Quantity_Color& theColorZ);
protected: protected:
virtual ~OpenGl_Trihedron(); //! Invalidate Primitve Arrays.
void invalidate();
void redraw(const Handle(OpenGl_Workspace)& theWorkspace) const; void redraw(const Handle(OpenGl_Workspace)& theWorkspace) const;
void redrawZBuffer(const Handle(OpenGl_Workspace)& theWorkspace) const; void redrawZBuffer(const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Resets current model-view and projection transfprmations and sets //! Resets current model-view and projection transformations and sets
//! translation for trihedron position //! translation for trihedron position
//! @sa Aspect_TypeOfTriedronPosition //! @sa Aspect_TypeOfTriedronPosition
void resetTransformations (const Handle(OpenGl_Workspace)& theWorkspace) const; void resetTransformations (const Handle(OpenGl_Workspace)& theWorkspace) const;
@ -66,10 +90,9 @@ protected:
Aspect_TypeOfTriedronPosition myPos; Aspect_TypeOfTriedronPosition myPos;
Standard_Real myScale; Standard_Real myScale;
Standard_Boolean myIsWireframe; Standard_Boolean myIsWireframe;
// Parameters for z-buffered mode OpenGl_Vec4 myXColor;
TEL_COLOUR myXColor; OpenGl_Vec4 myYColor;
TEL_COLOUR myYColor; OpenGl_Vec4 myZColor;
TEL_COLOUR myZColor;
float myRatio; float myRatio;
float myDiameter; float myDiameter;
int myNbFacettes; int myNbFacettes;

View File

@ -62,8 +62,8 @@ OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext,
myZClip(myDefaultZClip), myZClip(myDefaultZClip),
myCamera(AContext.Camera), myCamera(AContext.Camera),
myFog(myDefaultFog), myFog(myDefaultFog),
myTrihedron(NULL), myToShowTrihedron (false),
myGraduatedTrihedron(NULL), myToShowGradTrihedron (false),
myVisualization(AContext.Visualization), myVisualization(AContext.Visualization),
myShadingModel ((Visual3d_TypeOfModel )AContext.Model), myShadingModel ((Visual3d_TypeOfModel )AContext.Model),
myAntiAliasing(Standard_False), myAntiAliasing(Standard_False),
@ -86,8 +86,6 @@ OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext,
OpenGl_View::~OpenGl_View() OpenGl_View::~OpenGl_View()
{ {
ReleaseGlResources (NULL); // ensure ReleaseGlResources() was called within valid context ReleaseGlResources (NULL); // ensure ReleaseGlResources() was called within valid context
OpenGl_Element::Destroy (NULL, myTrihedron);
OpenGl_Element::Destroy (NULL, myGraduatedTrihedron);
OpenGl_Element::Destroy (NULL, myBgGradientArray); OpenGl_Element::Destroy (NULL, myBgGradientArray);
OpenGl_Element::Destroy (NULL, myBgTextureArray); OpenGl_Element::Destroy (NULL, myBgTextureArray);
OpenGl_Element::Destroy (NULL, myTextureParams); OpenGl_Element::Destroy (NULL, myTextureParams);
@ -95,14 +93,8 @@ OpenGl_View::~OpenGl_View()
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx) void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
{ {
if (myTrihedron != NULL) myTrihedron .Release (theCtx.operator->());
{ myGraduatedTrihedron.Release (theCtx.operator->());
myTrihedron->Release (theCtx.operator->());
}
if (myGraduatedTrihedron != NULL)
{
myGraduatedTrihedron->Release (theCtx.operator->());
}
if (!myTextureEnv.IsNull()) if (!myTextureEnv.IsNull())
{ {
@ -222,21 +214,24 @@ void OpenGl_View::SetFog (const Graphic3d_CView& theCView,
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void OpenGl_View::TriedronDisplay (const Handle(OpenGl_Context)& theCtx, void OpenGl_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition,
const Aspect_TypeOfTriedronPosition thePosition,
const Quantity_NameOfColor theColor, const Quantity_NameOfColor theColor,
const Standard_Real theScale, const Standard_Real theScale,
const Standard_Boolean theAsWireframe) const Standard_Boolean theAsWireframe)
{ {
OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron); myToShowTrihedron = true;
myTrihedron = new OpenGl_Trihedron (thePosition, theColor, theScale, theAsWireframe); myTrihedron.SetWireframe (theAsWireframe);
myTrihedron.SetPosition (thePosition);
myTrihedron.SetScale (theScale);
myTrihedron.SetLabelsColor (theColor);
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx) void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx)
{ {
OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron); myToShowTrihedron = false;
myTrihedron.Release (theCtx.operator->());
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
@ -244,15 +239,16 @@ void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx)
void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx, void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theData) const Graphic3d_GraduatedTrihedron& theData)
{ {
OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron); myToShowGradTrihedron = true;
myGraduatedTrihedron = new OpenGl_GraduatedTrihedron (theData); myGraduatedTrihedron.SetValues (theCtx, theData);
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void OpenGl_View::GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx) void OpenGl_View::GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx)
{ {
OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron); myToShowGradTrihedron = false;
myGraduatedTrihedron.Release (theCtx.operator->());
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/

View File

@ -44,6 +44,8 @@
#include <OpenGl_LayerList.hxx> #include <OpenGl_LayerList.hxx>
#include <OpenGl_Light.hxx> #include <OpenGl_Light.hxx>
#include <OpenGl_LineAttributes.hxx> #include <OpenGl_LineAttributes.hxx>
#include <OpenGl_Trihedron.hxx>
#include <OpenGl_GraduatedTrihedron.hxx>
#include <Handle_OpenGl_Context.hxx> #include <Handle_OpenGl_Context.hxx>
#include <Handle_OpenGl_GraphicDriver.hxx> #include <Handle_OpenGl_GraphicDriver.hxx>
@ -72,9 +74,7 @@ struct OPENGL_FOG
}; };
struct OpenGl_Matrix; struct OpenGl_Matrix;
class OpenGl_GraduatedTrihedron;
class OpenGl_Structure; class OpenGl_Structure;
class OpenGl_Trihedron;
class Handle(OpenGl_PrinterContext); class Handle(OpenGl_PrinterContext);
class OpenGl_StateCounter; class OpenGl_StateCounter;
@ -102,14 +102,14 @@ class OpenGl_View : public MMgt_TShared
void SetFog (const Graphic3d_CView& theCView, const Standard_Boolean theFlag); void SetFog (const Graphic3d_CView& theCView, const Standard_Boolean theFlag);
void TriedronDisplay (const Handle(OpenGl_Context)& theCtx, OpenGl_Trihedron& ChangeTrihedron() { return myTrihedron; }
const Aspect_TypeOfTriedronPosition thePosition, void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition,
const Quantity_NameOfColor theColor, const Quantity_NameOfColor theColor,
const Standard_Real theScale, const Standard_Real theScale,
const Standard_Boolean theAsWireframe); const Standard_Boolean theAsWireframe);
void TriedronErase (const Handle(OpenGl_Context)& theCtx); void TriedronErase (const Handle(OpenGl_Context)& theCtx);
OpenGl_GraduatedTrihedron* GraduatedTrihedron() const { return myGraduatedTrihedron; } OpenGl_GraduatedTrihedron& ChangeGraduatedTrihedron() { return myGraduatedTrihedron; }
void GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx, void GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theCubic); const Graphic3d_GraduatedTrihedron& theCubic);
void GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx); void GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx);
@ -246,8 +246,10 @@ protected:
Handle(Graphic3d_Camera) myCamera; Handle(Graphic3d_Camera) myCamera;
OPENGL_FOG myFog; OPENGL_FOG myFog;
OpenGl_Trihedron* myTrihedron; OpenGl_Trihedron myTrihedron;
OpenGl_GraduatedTrihedron* myGraduatedTrihedron; OpenGl_GraduatedTrihedron myGraduatedTrihedron;
bool myToShowTrihedron;
bool myToShowGradTrihedron;
//View_LABViewContext //View_LABViewContext
int myVisualization; int myVisualization;

View File

@ -780,13 +780,13 @@ void OpenGl_View::RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintCo
void OpenGl_View::RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace) void OpenGl_View::RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace)
{ {
// display global trihedron // display global trihedron
if (myTrihedron != NULL) if (myToShowTrihedron)
{ {
myTrihedron->Render (theWorkspace); myTrihedron.Render (theWorkspace);
} }
if (myGraduatedTrihedron != NULL) if (myToShowGradTrihedron)
{ {
myGraduatedTrihedron->Render (theWorkspace); myGraduatedTrihedron.Render (theWorkspace);
} }
} }

View File

@ -458,9 +458,10 @@ is
---Category: Graduated trihedron ---Category: Graduated trihedron
--------------------------------- ---------------------------------
GetGraduatedTrihedron(me; GetGraduatedTrihedron (me)
theTrigedronData: out GraduatedTrihedron from Graphic3d) returns GraduatedTrihedron from Graphic3d
---Purpose: Returns data of a graduated trihedron. ---Purpose: Returns data of a graduated trihedron.
---C++: return const&
is static; is static;
GraduatedTrihedronDisplay(me : mutable; GraduatedTrihedronDisplay(me : mutable;

View File

@ -271,9 +271,9 @@ void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType )
MyView->TriedronEcho (AType); MyView->TriedronEcho (AType);
} }
void V3d_View::GetGraduatedTrihedron (Graphic3d_GraduatedTrihedron& theTrihedronData) const const Graphic3d_GraduatedTrihedron& V3d_View::GetGraduatedTrihedron() const
{ {
MyView->GetGraduatedTrihedron (theTrihedronData); return MyView->GetGraduatedTrihedron();
} }
void V3d_View::GraduatedTrihedronDisplay(const Graphic3d_GraduatedTrihedron& theTrihedronData) void V3d_View::GraduatedTrihedronDisplay(const Graphic3d_GraduatedTrihedron& theTrihedronData)

View File

@ -10,3 +10,5 @@ ViewerTest_FilletCommands.cxx
ViewerTest_VoxelCommands.cxx ViewerTest_VoxelCommands.cxx
ViewerTest_OpenGlCommands.cxx ViewerTest_OpenGlCommands.cxx
ViewerTest_ViewerCommands_1.mm ViewerTest_ViewerCommands_1.mm
ViewerTest.hxx
ViewerTest.cxx

View File

@ -42,156 +42,4 @@ is
MapTransientHasher from TColStd, MapTransientHasher from TColStd,
AsciiString from TCollection); AsciiString from TCollection);
-- ----------------------------------------------------------------------
-- Package methods
-- ----------------------------------------------------------------------
Factory (theDI : out Interpretor from Draw);
---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin.
---Category: Create the viewer....
ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0;
thePxWidth, thePxHeight : Integer from Standard = 0;
theViewName : CString from Standard = "";
theDisplayName : CString from Standard = "")
returns AsciiString from TCollection;
---Purpose: Creates view with default or custom name
-- and add this name in map to manage muliple views
-- implemented in ViewerTest_ViewerCommands.cxx
---Category: Manage the name of views
RemoveViewName (theName: AsciiString from TCollection);
InitViewName (theName: AsciiString from TCollection;
theView: View from V3d);
GetCurrentViewName returns AsciiString from TCollection;
---Category: Delete the viewer....
RemoveView (theViewName : AsciiString from TCollection;
theToRemoveContext : Boolean from Standard = Standard_True);
---Purpose: Removes view and clear all maps
-- with information about its resources if neccessary
---Category: Delete the viewer....
RemoveView (theView : View from V3d;
theToRemoveContext : Boolean from Standard = Standard_True);
---Purpose: Removes view and clear all maps
-- with information about its resources if neccessary
---Category: Selection in the viewer....
WClass returns TShared from MMgt is private;
---C++: return const &
---Purpose: Returns a window class that implements standard behavior of
-- all windows of the ViewerTest. This includes usual Open CASCADE
-- view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
-- Ctrl+MB2 for pan, etc) and keyboard shortcuts.
-- This method is relevant for MS Windows only and respectively
-- returns WNT_WClass handle.
PickShape (aType : ShapeEnum from TopAbs;
MaxPick : Integer from Standard = 5) returns Shape from TopoDS;
---Purpose: waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
-- if <aType> == TopAbs_Shape, any shape can be picked...
-- MaxPick is the Max number before exiting, if no pick is successfull
PickShapes (aType : ShapeEnum from TopAbs;
thepicked : in out HArray1OfShape from TopTools;
MaxPick : Integer from Standard = 5)
returns Boolean from Standard;
---Purpose: wait until the array is filled with picked shapes.
-- returns True if the array is filled.
-- exit if number of unsuccesfull picks = <MaxPick>
PickObject(Type : KindOfInteractive from AIS = AIS_KOI_None;
Signature : Integer from Standard = -1;
MaxPick : Integer from Standard = 5)
returns InteractiveObject from AIS;
---Purpose: waits until an interactive object of a given Type
-- and signature is picked (defaut values authorize
-- selection of any Interactive Object)
-- exit if number of unsuccesfull picks = <MaxPick>
PickObjects(thepicked : in out HArray1OfTransient from TColStd;
Type : KindOfInteractive from AIS = AIS_KOI_None;
Signature : Integer from Standard = -1;
MaxPick : Integer from Standard = 5)
returns Boolean from Standard;
---Purpose: selection of several interactive objects. Number is given
-- by the size of <thepicked>
-- exit if number of unsuccesfull picks = <MaxPick>
Commands (theCommands : in out Interpretor from Draw);
AviCommands(theCommands :in out Interpretor from Draw);
ViewerCommands(theCommands :in out Interpretor from Draw);
MyCommands (theCommands : in out Interpretor from Draw); -- My Own Com-s
RelationCommands(theCommands :in out Interpretor from Draw);
ObjectCommands(theCommands :in out Interpretor from Draw);
FilletCommands(theCommands :in out Interpretor from Draw);
VoxelCommands(theCommands :in out Interpretor from Draw);
OpenGlCommands(theCommands :in out Interpretor from Draw);
GetMousePosition(xpix,ypix: out Integer from Standard);
GetViewerFromContext returns Viewer from V3d;
GetCollectorFromContext returns Viewer from V3d;
GetAISContext returns InteractiveContext from AIS;
---C++: return const &
GetNISContext returns InteractiveContext from NIS;
---C++: return &
SetAISContext (aContext: InteractiveContext from AIS);
SetNISContext (aContext: InteractiveContext from NIS);
CurrentView returns View from V3d;
---C++: return const &
CurrentView (aViou:View from V3d);
Clear ;
---Category: Change behaviour on move,select,... events.
SetEventManager (aMgr:EventManager from ViewerTest);
---Purpose: puts <aMgr> as current eventmanager (the
-- move,select,...will be applied to <aMgr>
UnsetEventManager;
---Purpose: removes the last EventManager from the list.
ResetEventManager;
---Purpose: clear the list of EventManagers and
-- sets the default EventManager as current
CurrentEventManager returns EventManager from ViewerTest;
---Category: privateMethods...
RemoveSelected;
StandardModeActivation(Mode : Integer from Standard);
GetColorFromName(name: CString from Standard)
returns NameOfColor from Quantity;
RedrawAllViews;
---Purpose: redraws all defined views.
SplitParameter (theString : AsciiString from TCollection;
theName : out AsciiString from TCollection;
theValue : out AsciiString from TCollection)
returns Boolean from Standard;
---Purpose: Splits "parameter=value" string into separate
-- parameter and value strings.
-- @return TRUE if the string matches pattern "<string>=<empty or string>"
end; end;

View File

@ -106,6 +106,56 @@ Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theNam
return aColor; return aColor;
} }
//=======================================================================
//function : ParseColor
//purpose :
//=======================================================================
Standard_Integer ViewerTest::ParseColor (Standard_Integer theArgNb,
const char** theArgVec,
Quantity_Color& theColor)
{
Quantity_NameOfColor aColor = Quantity_NOC_BLACK;
if (theArgNb >= 1
&& Quantity_Color::ColorFromName (theArgVec[0], aColor))
{
theColor = aColor;
return 1;
}
else if (theArgNb >= 3)
{
const TCollection_AsciiString anRgbStr[3] =
{
theArgVec[0],
theArgVec[1],
theArgVec[2]
};
if (!anRgbStr[0].IsRealValue()
|| !anRgbStr[1].IsRealValue()
|| !anRgbStr[2].IsRealValue())
{
return 0;
}
Graphic3d_Vec4d anRgb;
anRgb.x() = anRgbStr[0].RealValue();
anRgb.y() = anRgbStr[1].RealValue();
anRgb.z() = anRgbStr[2].RealValue();
if (anRgb.x() < 0.0 || anRgb.x() > 1.0
|| anRgb.y() < 0.0 || anRgb.y() > 1.0
|| anRgb.z() < 0.0 || anRgb.z() > 1.0)
{
std::cout << "Error: RGB color values should be within range 0..1!\n";
return 0;
}
theColor.SetValues (anRgb.x(), anRgb.y(), anRgb.z(), Quantity_TOC_RGB);
return 3;
}
return 0;
}
//======================================================================= //=======================================================================
//function : GetTypeNames //function : GetTypeNames
//purpose : //purpose :

View File

@ -0,0 +1,212 @@
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ViewerTest_HeaderFile
#define _ViewerTest_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Draw_Interpretor.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <Handle_V3d_View.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_MMgt_TShared.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Handle_TopTools_HArray1OfShape.hxx>
#include <Handle_AIS_InteractiveObject.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <Handle_TColStd_HArray1OfTransient.hxx>
#include <Handle_V3d_Viewer.hxx>
#include <Handle_AIS_InteractiveContext.hxx>
#include <NIS_InteractiveContext.hxx>
#include <Handle_ViewerTest_EventManager.hxx>
#include <Quantity_NameOfColor.hxx>
class TCollection_AsciiString;
class V3d_View;
class MMgt_TShared;
class TopoDS_Shape;
class TopTools_HArray1OfShape;
class AIS_InteractiveObject;
class TColStd_HArray1OfTransient;
class V3d_Viewer;
class AIS_InteractiveContext;
class ViewerTest_EventManager;
class ViewerTest_EventManager;
class ViewerTest_DoubleMapOfInteractiveAndName;
class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
class Quantity_Color;
class ViewerTest
{
public:
DEFINE_STANDARD_ALLOC
//! Loads all Draw commands of V2d & V3d. Used for plugin.
Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
//! Creates view with default or custom name
//! and add this name in map to manage muliple views
//! implemented in ViewerTest_ViewerCommands.cxx
Standard_EXPORT static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft = 0,
const Standard_Integer thePxTop = 0,
const Standard_Integer thePxWidth = 0,
const Standard_Integer thePxHeight = 0,
const Standard_CString theViewName = "",
const Standard_CString theDisplayName = "");
Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
Standard_EXPORT static void InitViewName (const TCollection_AsciiString& theName,
const Handle(V3d_View)& theView);
Standard_EXPORT static TCollection_AsciiString GetCurrentViewName();
//! Removes view and clear all maps
//! with information about its resources if necessary
Standard_EXPORT static void RemoveView (const TCollection_AsciiString& theViewName,
const Standard_Boolean theToRemoveContext = Standard_True);
//! Removes view and clear all maps
//! with information about its resources if necessary
Standard_EXPORT static void RemoveView (const Handle(V3d_View)& theView,
const Standard_Boolean theToRemoveContext = Standard_True);
//! waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
//! if <aType> == TopAbs_Shape, any shape can be picked...
//! MaxPick is the Max number before exiting, if no pick is successful
Standard_EXPORT static TopoDS_Shape PickShape (const TopAbs_ShapeEnum aType,
const Standard_Integer MaxPick = 5);
//! wait until the array is filled with picked shapes.
//! returns True if the array is filled.
//! exit if number of unsuccessful picks = <MaxPick>
Standard_EXPORT static Standard_Boolean PickShapes (const TopAbs_ShapeEnum aType,
Handle(TopTools_HArray1OfShape)& thepicked,
const Standard_Integer MaxPick = 5);
//! waits until an interactive object of a given Type
//! and signature is picked (default values authorize
//! selection of any Interactive Object)
//! exit if number of unsuccessful picks = <MaxPick>
Standard_EXPORT static Handle(AIS_InteractiveObject) PickObject (const AIS_KindOfInteractive Type = AIS_KOI_None,
const Standard_Integer Signature = -1,
const Standard_Integer MaxPick = 5);
//! selection of several interactive objects.
//! Number is given by the size of <thepicked>
//! exit if number of unsuccesfull picks = <MaxPick>
Standard_EXPORT static Standard_Boolean PickObjects (Handle(TColStd_HArray1OfTransient)& thepicked,
const AIS_KindOfInteractive Type = AIS_KOI_None,
const Standard_Integer Signature = -1,
const Standard_Integer MaxPick = 5);
Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
Standard_EXPORT static void AviCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void ViewerCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void MyCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void RelationCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void ObjectCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void FilletCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void VoxelCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void OpenGlCommands (Draw_Interpretor& theCommands);
Standard_EXPORT static void GetMousePosition (Standard_Integer& xpix, Standard_Integer& ypix);
Standard_EXPORT static Handle(V3d_Viewer) GetViewerFromContext();
Standard_EXPORT static Handle(V3d_Viewer) GetCollectorFromContext();
Standard_EXPORT static const Handle(AIS_InteractiveContext)& GetAISContext();
Standard_EXPORT static NIS_InteractiveContext& GetNISContext();
Standard_EXPORT static void SetAISContext (const Handle(AIS_InteractiveContext)& aContext);
Standard_EXPORT static void SetNISContext (const NIS_InteractiveContext& aContext);
Standard_EXPORT static const Handle(V3d_View)& CurrentView();
Standard_EXPORT static void CurrentView (const Handle(V3d_View)& aViou);
Standard_EXPORT static void Clear();
//! puts theMgr as current eventmanager (the move,select,...will be applied to theMgr)
Standard_EXPORT static void SetEventManager (const Handle(ViewerTest_EventManager)& theMgr);
//! removes the last EventManager from the list.
Standard_EXPORT static void UnsetEventManager();
//! clear the list of EventManagers and
//! sets the default EventManager as current
Standard_EXPORT static void ResetEventManager();
Standard_EXPORT static Handle(ViewerTest_EventManager) CurrentEventManager();
Standard_EXPORT static void RemoveSelected();
Standard_EXPORT static void StandardModeActivation (const Standard_Integer Mode);
Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
//! Parses color argument(s) specified within theArgVec[0], theArgVec[1] and theArgVec[2].
//! Handles either color specified by name (single argument)
//! or by RGB components (3 arguments) in range 0..1.
//! The result is stored in theColor on success.
//! Returns number of handled arguments (1 or 3) or 0 on syntax error.
Standard_EXPORT static Standard_Integer ParseColor (Standard_Integer theArgNb,
const char** theArgVec,
Quantity_Color& theColor);
//! redraws all defined views.
Standard_EXPORT static void RedrawAllViews();
//! Splits "parameter=value" string into separate
//! parameter and value strings.
//! @return TRUE if the string matches pattern "<string>=<empty or string>"
Standard_EXPORT static Standard_Boolean SplitParameter (const TCollection_AsciiString& theString,
TCollection_AsciiString& theName,
TCollection_AsciiString& theValue);
private:
//! Returns a window class that implements standard behavior of
//! all windows of the ViewerTest. This includes usual Open CASCADE
//! view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
//! Ctrl+MB2 for pan, etc) and keyboard shortcuts.
//! This method is relevant for MS Windows only and respectively
//! returns WNT_WClass handle.
Standard_EXPORT static const Handle(MMgt_TShared)& WClass();
friend class ViewerTest_EventManager;
friend class ViewerTest_DoubleMapOfInteractiveAndName;
friend class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
friend class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
};
#endif // _ViewerTest_HeaderFile

View File

@ -2857,94 +2857,228 @@ static int VScale(Draw_Interpretor& di, Standard_Integer argc, const char** argv
return 0; return 0;
} }
//============================================================================== //==============================================================================
//function : VTestZBuffTrihedron //function : VZBuffTrihedron
//purpose : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron //purpose :
//============================================================================== //==============================================================================
static int VTestZBuffTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv) static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
Standard_Integer theArgNb,
const char** theArgVec)
{ {
Handle(V3d_View) V3dView = ViewerTest::CurrentView(); Handle(V3d_View) aView = ViewerTest::CurrentView();
if ( V3dView.IsNull() ) return 1; if (aView.IsNull())
V3dView->ZBufferTriedronSetup();
if ( argc == 1 ) {
// Set up default trihedron parameters
V3dView->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER );
} else
if ( argc == 7 )
{ {
Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER; std::cout << "Error: no active viewer!\n";
const char* aPosType = argv[1]; return 1;
}
if ( strcmp(aPosType, "center") == 0 ) ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER;
V3d_TypeOfVisualization aVisType = V3d_ZBUFFER;
Quantity_Color aLabelsColor = Quantity_NOC_WHITE;
Quantity_Color anArrowColorX = Quantity_NOC_RED;
Quantity_Color anArrowColorY = Quantity_NOC_GREEN;
Quantity_Color anArrowColorZ = Quantity_NOC_BLUE1;
Standard_Real aScale = 0.1;
Standard_Real aSizeRatio = 0.8;
Standard_Real anArrowDiam = 0.05;
Standard_Integer aNbFacets = 12;
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 == "-on")
{
continue;
}
else if (aFlag == "-off")
{
aView->TriedronErase();
return 0;
}
else if (aFlag == "-pos"
|| aFlag == "-position"
|| aFlag == "-corner")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
TCollection_AsciiString aPosName (theArgVec[anArgIter]);
aPosName.LowerCase();
if (aPosName == "center")
{ {
aPosition = Aspect_TOTP_CENTER; aPosition = Aspect_TOTP_CENTER;
} else }
if (strcmp(aPosType, "left_lower") == 0) else if (aPosName == "left_lower"
|| aPosName == "lower_left"
|| aPosName == "leftlower"
|| aPosName == "lowerleft")
{ {
aPosition = Aspect_TOTP_LEFT_LOWER; aPosition = Aspect_TOTP_LEFT_LOWER;
} else }
if (strcmp(aPosType, "left_upper") == 0) else if (aPosName == "left_upper"
|| aPosName == "upper_left"
|| aPosName == "leftupper"
|| aPosName == "upperleft")
{ {
aPosition = Aspect_TOTP_LEFT_UPPER; aPosition = Aspect_TOTP_LEFT_UPPER;
} else }
if (strcmp(aPosType, "right_lower") == 0) else if (aPosName == "right_lower"
|| aPosName == "lower_right"
|| aPosName == "rightlower"
|| aPosName == "lowerright")
{ {
aPosition = Aspect_TOTP_RIGHT_LOWER; aPosition = Aspect_TOTP_RIGHT_LOWER;
} else }
if (strcmp(aPosType, "right_upper") == 0) else if (aPosName == "right_upper"
|| aPosName == "upper_right"
|| aPosName == "rightupper"
|| aPosName == "upperright")
{ {
aPosition = Aspect_TOTP_RIGHT_UPPER; aPosition = Aspect_TOTP_RIGHT_UPPER;
} else }
else
{ {
di << argv[1] << " Invalid type of alignment" << "\n"; std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown position '" << aPosName << "'\n";
di << "Must be one of [ center, left_lower," << "\n"; return 1;
di << "left_upper, right_lower, right_upper ]" << "\n"; }
}
else if (aFlag == "-type")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1; return 1;
} }
Standard_Real R = Draw::Atof(argv[2])/255.; TCollection_AsciiString aTypeName (theArgVec[anArgIter]);
Standard_Real G = Draw::Atof(argv[3])/255.; aTypeName.LowerCase();
Standard_Real B = Draw::Atof(argv[4])/255.; if (aTypeName == "wireframe"
Quantity_Color aColor(R, G, B, Quantity_TOC_RGB); || aTypeName == "wire")
Standard_Real aScale = Draw::Atof(argv[5]);
if( aScale <= 0.0 )
{ {
di << argv[5] << " Invalid value. Must be > 0" << "\n"; aVisType = V3d_WIREFRAME;
}
else if (aTypeName == "zbuffer"
|| aTypeName == "shaded")
{
aVisType = V3d_ZBUFFER;
}
else
{
std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown type '" << aTypeName << "'\n";
}
}
else if (aFlag == "-scale")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1; return 1;
} }
V3d_TypeOfVisualization aPresentation = V3d_ZBUFFER; aScale = Draw::Atof (theArgVec[anArgIter]);
const char* aPresType = argv[6]; }
else if (aFlag == "-size"
if ( strcmp(aPresType, "wireframe") == 0 ) || aFlag == "-sizeratio")
{ {
aPresentation = V3d_WIREFRAME; if (++anArgIter >= theArgNb)
} else
if (strcmp(aPresType, "zbuffer") == 0)
{ {
aPresentation = V3d_ZBUFFER; std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
} else
{
di << argv[6] << " Invalid type of visualization" << "\n";
di << "Must be one of [ wireframe, zbuffer ]" << "\n";
return 1; return 1;
} }
V3dView->TriedronDisplay( aPosition, aColor.Name(), aScale, aPresentation ); aSizeRatio = Draw::Atof (theArgVec[anArgIter]);
}
} else else if (aFlag == "-arrowdiam"
|| aFlag == "-arrowdiameter")
{ {
di << argv[0] << " Invalid number of arguments" << "\n"; if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1; return 1;
} }
V3dView->View()->ZFitAll(); anArrowDiam = Draw::Atof (theArgVec[anArgIter]);
V3dView->Redraw(); }
else if (aFlag == "-nbfacets")
{
if (++anArgIter >= theArgNb)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
aNbFacets = Draw::Atoi (theArgVec[anArgIter]);
}
else if (aFlag == "-colorlabel"
|| aFlag == "-colorlabels")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aLabelsColor);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowx")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorX);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowy")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorY);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else if (aFlag == "-colorarrowz")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorZ);
if (aNbParsed == 0)
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
anArgIter += aNbParsed;
}
else
{
std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
}
aView->ZBufferTriedronSetup (anArrowColorX.Name(), anArrowColorY.Name(), anArrowColorZ.Name(),
aSizeRatio, anArrowDiam, aNbFacets);
aView->TriedronDisplay (aPosition, aLabelsColor.Name(), aScale, aVisType);
aView->View()->ZFitAll();
return 0; return 0;
} }
@ -3720,7 +3854,8 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// On/off arguments // On/off arguments
if ((aKey.IsEqual ("xdrawname") || aKey.IsEqual ("ydrawname") || aKey.IsEqual ("zdrawname") if ((aKey.IsEqual ("xdrawname") || aKey.IsEqual ("ydrawname") || aKey.IsEqual ("zdrawname")
|| aKey.IsEqual ("xdrawticks") || aKey.IsEqual ("ydrawticks") || aKey.IsEqual ("zdrawticks") || aKey.IsEqual ("xdrawticks") || aKey.IsEqual ("ydrawticks") || aKey.IsEqual ("zdrawticks")
|| aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues")) || aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues")
|| aKey.IsEqual ("drawgrid") || aKey.IsEqual ("drawaxes"))
&& anArgs->Length() == 1 && (anArgs->Value(1).IsEqual ("on") || anArgs->Value(1).IsEqual ("off"))) && anArgs->Length() == 1 && (anArgs->Value(1).IsEqual ("on") || anArgs->Value(1).IsEqual ("off")))
{ {
continue; continue;
@ -3799,15 +3934,15 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
} }
if (aMapOfArgs.Find ("xdrawname", aValues)) if (aMapOfArgs.Find ("xdrawname", aValues))
{ {
aTrihedronData.ChangeXAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeXAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("ydrawname", aValues)) if (aMapOfArgs.Find ("ydrawname", aValues))
{ {
aTrihedronData.ChangeYAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeYAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("zdrawname", aValues)) if (aMapOfArgs.Find ("zdrawname", aValues))
{ {
aTrihedronData.ChangeZAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeZAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("xnameoffset", aValues)) if (aMapOfArgs.Find ("xnameoffset", aValues))
{ {
@ -3881,53 +4016,53 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// TICKMARKS // TICKMARKS
if (aMapOfArgs.Find ("xticks", aValues)) if (aMapOfArgs.Find ("xticks", aValues))
{ {
aTrihedronData.ChangeXAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeXAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("yticks", aValues)) if (aMapOfArgs.Find ("yticks", aValues))
{ {
aTrihedronData.ChangeYAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeYAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("zticks", aValues)) if (aMapOfArgs.Find ("zticks", aValues))
{ {
aTrihedronData.ChangeZAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeZAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("xticklength", aValues)) if (aMapOfArgs.Find ("xticklength", aValues))
{ {
aTrihedronData.ChangeXAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeXAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("yticklength", aValues)) if (aMapOfArgs.Find ("yticklength", aValues))
{ {
aTrihedronData.ChangeYAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeYAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("zticklength", aValues)) if (aMapOfArgs.Find ("zticklength", aValues))
{ {
aTrihedronData.ChangeZAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue()); aTrihedronData.ChangeZAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
} }
if (aMapOfArgs.Find ("xdrawticks", aValues)) if (aMapOfArgs.Find ("xdrawticks", aValues))
{ {
aTrihedronData.ChangeXAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeXAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("ydrawticks", aValues)) if (aMapOfArgs.Find ("ydrawticks", aValues))
{ {
aTrihedronData.ChangeYAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeYAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("zdrawticks", aValues)) if (aMapOfArgs.Find ("zdrawticks", aValues))
{ {
aTrihedronData.ChangeZAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeZAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
} }
// VALUES // VALUES
if (aMapOfArgs.Find ("xdrawvalues", aValues)) if (aMapOfArgs.Find ("xdrawvalues", aValues))
{ {
aTrihedronData.ChangeXAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeXAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("ydrawvalues", aValues)) if (aMapOfArgs.Find ("ydrawvalues", aValues))
{ {
aTrihedronData.ChangeYAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeYAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("zdrawvalues", aValues)) if (aMapOfArgs.Find ("zdrawvalues", aValues))
{ {
aTrihedronData.ChangeZAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on")); aTrihedronData.ChangeZAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
} }
if (aMapOfArgs.Find ("xvaluesoffset", aValues)) if (aMapOfArgs.Find ("xvaluesoffset", aValues))
{ {
@ -3945,7 +4080,7 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
// ARROWS // ARROWS
if (aMapOfArgs.Find ("arrowlength", aValues)) if (aMapOfArgs.Find ("arrowlength", aValues))
{ {
aTrihedronData.SetArrowLength ((Standard_ShortReal) aValues->Value(1).RealValue()); aTrihedronData.SetArrowsLength ((Standard_ShortReal) aValues->Value(1).RealValue());
} }
// FONTS // FONTS
@ -3958,6 +4093,15 @@ static int VGraduatedTrihedron (Draw_Interpretor& /*theDi*/, Standard_Integer th
aTrihedronData.SetValuesFont (aValues->Value(1)); aTrihedronData.SetValuesFont (aValues->Value(1));
} }
if (aMapOfArgs.Find ("drawgrid", aValues))
{
aTrihedronData.SetDrawGrid (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("drawaxes", aValues))
{
aTrihedronData.SetDrawAxes (aValues->Value(1).IsEqual ("on"));
}
// The final step: display of erase trihedron // The final step: display of erase trihedron
if (toDisplay) if (toDisplay)
{ {
@ -7995,10 +8139,13 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vscale : vscale X Y Z", "vscale : vscale X Y Z",
__FILE__,VScale,group); __FILE__,VScale,group);
theCommands.Add("vzbufftrihedron", theCommands.Add("vzbufftrihedron",
"vzbufftrihedron [center|left_lower|left_upper|right_lower|right_upper" "vzbufftrihedron [{-on|-off}=-on] [-type {wireframe|zbuffer}=zbuffer]"
" textR=255 textG=255 textB=255 scale=0.1 wireframe|zbuffer]" "\n\t\t: [-position center|left_lower|left_upper|right_lower|right_upper]"
" : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron", "\n\t\t: [-scale value=0.1] [-size value=0.8] [-arrowDiam value=0.05]"
__FILE__,VTestZBuffTrihedron,group); "\n\t\t: [-colorArrowX color=RED] [-colorArrowY color=GREEN] [-colorArrowZ color=BLUE]"
"\n\t\t: [-nbfacets value=12] [-colorLabels color=WHITE]"
"\n\t\t: Displays a trihedron",
__FILE__,VZBuffTrihedron,group);
theCommands.Add("vrotate", theCommands.Add("vrotate",
"vrotate [[-mouseStart X Y] [-mouseMove X Y]]|[AX AY AZ [X Y Z]]" "vrotate [[-mouseStart X Y] [-mouseMove X Y]]|[AX AY AZ [X Y Z]]"
"\n : Option -mouseStart starts rotation according to the mouse position" "\n : Option -mouseStart starts rotation according to the mouse position"
@ -8046,6 +8193,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\t[-xdrawticks on/off] [-ydrawticks on/off] [-zdrawticks on/off]\n" "\t[-xdrawticks on/off] [-ydrawticks on/off] [-zdrawticks on/off]\n"
"\t[-xticks Number] [-yticks Number] [-zticks Number]\n" "\t[-xticks Number] [-yticks Number] [-zticks Number]\n"
"\t[-xticklength IntVal] [-yticklength IntVal] [-zticklength IntVal]\n" "\t[-xticklength IntVal] [-yticklength IntVal] [-zticklength IntVal]\n"
"\t[-drawgrid on/off] [-drawaxes on/off]\n"
" - Displays or erases graduated trihedron" " - Displays or erases graduated trihedron"
" - xname, yname, zname - names of axes, default: X, Y, Z\n" " - xname, yname, zname - names of axes, default: X, Y, Z\n"
" - namefont - font of axes names. Default: Arial\n" " - namefont - font of axes names. Default: Arial\n"

View File

@ -514,11 +514,11 @@ is
---Category: Graduated trihedron ---Category: Graduated trihedron
------------------------------------------ ------------------------------------------
GetGraduatedTrihedron(me; GetGraduatedTrihedron (me)
theTrigedronData: out GraduatedTrihedron from Graphic3d) returns GraduatedTrihedron from Graphic3d
returns Boolean from Standard
is static; is static;
---Purpose: Returns data of a graduated trihedron if displayed (return value is True) ---Purpose: Returns data of a graduated trihedron
---C++: return const&
GraduatedTrihedronDisplay(me : mutable; GraduatedTrihedronDisplay(me : mutable;
theTrigedronData: in GraduatedTrihedron from Graphic3d) theTrigedronData: in GraduatedTrihedron from Graphic3d)

View File

@ -2060,7 +2060,7 @@ void Visual3d_View::ZBufferTriedronSetup (const Quantity_NameOfColor theXColor,
const Standard_Real theAxisDiametr, const Standard_Real theAxisDiametr,
const Standard_Integer theNbFacettes) const Standard_Integer theNbFacettes)
{ {
myGraphicDriver->ZBufferTriedronSetup (theXColor, theYColor, theZColor, myGraphicDriver->ZBufferTriedronSetup (MyCView, theXColor, theYColor, theZColor,
theSizeRatio, theAxisDiametr, theNbFacettes); theSizeRatio, theAxisDiametr, theNbFacettes);
} }
@ -2115,15 +2115,9 @@ static void SetMinMaxValuesCallback (Visual3d_View* theView)
// function : GetGraduatedTrihedron // function : GetGraduatedTrihedron
// purpose : // purpose :
// ======================================================================= // =======================================================================
Standard_Boolean Visual3d_View::GetGraduatedTrihedron (Graphic3d_GraduatedTrihedron& theTrihedronData) const const Graphic3d_GraduatedTrihedron& Visual3d_View::GetGraduatedTrihedron() const
{ {
if (!myGTrihedron.PtrVisual3dView) return myGTrihedron;
{
return Standard_False;
}
theTrihedronData = myGTrihedron;
return Standard_True;
} }
// ======================================================================= // =======================================================================

View File

@ -8,8 +8,7 @@ puts ""
set BugNumber OCC22483 set BugNumber OCC22483
vinit vinit View1
vzbufftrihedron left_lower 255 255 255 0.1 zbuffer vzbufftrihedron -position left_lower -scale 0.1 -type zbuffer -colorLabels WHITE
set only_screen 1 set only_screen 1

View File

@ -8,9 +8,7 @@ puts ""
set BugNumber OCC22483 set BugNumber OCC22483
vinit vinit View1
vzbufftrihedron right_upper 200 50 255 0.2 zbuffer vzbufftrihedron -position right_upper -scale 0.2 -type zbuffer -colorLabels 0.78 0.20 1.0
set only_screen 1 set only_screen 1

View File

@ -8,9 +8,7 @@ puts ""
set BugNumber OCC22483 set BugNumber OCC22483
vinit vinit View1
vzbufftrihedron center 0 150 255 0.1 wireframe vzbufftrihedron -position center -scale 0.1 -type wireframe -colorLabels 0.0 0.59 1.0
set only_screen 1 set only_screen 1

View File

@ -14,10 +14,10 @@ vinit View1
vfit vfit
vaxo vaxo
vzbufftrihedron left_lower 255 255 255 0.1 wireframe vzbufftrihedron -scale 0.1 -type wireframe -position left_lower
vdump $anImage1 vdump $anImage1
vzbufftrihedron center 255 255 255 0.1 wireframe vzbufftrihedron -scale 0.1 -type wireframe -position center
vdump $anImage2 vdump $anImage2
vclear vclear