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

Compare commits

..

13 Commits

Author SHA1 Message Date
astromko
e5f2b4bd62 0031041: Modeling Algorithms - Crash in BRepOffsetAPI_MakePipeShell
Since some part of the code was commented, the TheV contains just an initial value and we don't have to execute the code under contions "if(!TheV.IsNull())" because this code expects not initial value in the TheV.
2024-07-08 12:45:30 +01:00
drochalo
4c8faa5e2d 0032752: Visualization, TKOpenGl - extend V3d_View::ToPixMap() options with Z-layer
Added option to dump only a selection of zlayer's content.
Changed zlayers redraw and render method for selection of layers to render.
Added filters for layer parsing.
Modified vdump command.
Added test with multiple dumps for comparison.
Added option to dump shadow maps.
2024-05-19 16:03:09 +01:00
astromko
65d8eece35 0032964: Modeling Algorithms - 2d Offset sometimes 'split' straight edges
Implemented avoiding force cut of an edge in case of simple edge (that contains just 1 curve).
2024-05-19 16:03:09 +01:00
astromko
8991082051 0033156: Modeling Algorithms - Planar face creation problem
Implemented suggested patch to avoid unnecessary replacement of a wire.
Added the second test case.
2024-05-19 16:03:09 +01:00
astromko
1db93f640e 0033146: Modeling Algorithms - 2D Offset with arc-lin approximation fails on open B-spline edge
Added additional conditions to avoid crash.
Added a test case.
2024-05-19 16:03:09 +01:00
drochalo
fc51ce503e 0030484: Visualization, SelectMgr_ViewerSelector - Graphic3d_TMF_2d persistence sorting issues
Added property to SelectableObject for selection focused on display priority.
Modified SelectMgr_ViewerSelector CompareResults based on the focus priority property.
Added display priority to the sorting criterion
Added tests for multiple types of sensitive entities.
Modified vpriority command to change an object's selection priority.
2024-05-19 16:03:08 +01:00
drochalo
ad9840d4d4 0033533: Visualization - possibility to redefine Graphic3d_TransformPers
Split template method apply and moved calculations to virtual method.
2024-05-19 16:02:30 +01:00
drochalo
7f1d0563bb 0033514: Visualization - Scaled view twists zoom persistence objects
Added flag to transform persistence to handle axial scaling.
Modified manipulator's zoom transform persistence to fit in axial scaling events.
Added tests for cases 27832 and 33514.
Logic change on Graphic3d_TransformPers::Apply for Graphic3d_TMF_AxialScalePers.
Logic fixes in AIS_Manipulator to integrate axial scale in both zoomable and unzoomable states.
2024-05-17 08:31:06 +00:00
dpasukhi
69f380ae32 0033699: Data Exchange, DE Wrapper - Integration activation plug-in mechanism plug-in
New virtual function is implemented
2024-05-06 10:53:55 +01:00
ika
36dc3d2037 0033371: USD - Implementation of import and export USD files using the USD SDK. 1 Stage
Do auxiliary improvement in OCCT.
2024-04-17 23:19:49 +01:00
anv
ead71c66a3 0033430: IFC Import - Adding basic support of materials
Updated XStat to show VisMaterials info
2024-04-17 23:19:48 +01:00
drochalo
d4dbeab49b 0032750: Visualization, AIS_Manipulator - selection of moved object is broken
Completed the stop transform action when dragging manipulator with mouse.
Added context redisplay for update of interactive object sensitive areas.
Added test.
2024-04-17 23:19:48 +01:00
dpasukhi
4fb9b2f250 Update version to 7.8.2 dev 2024-04-17 23:14:47 +01:00
47 changed files with 1281 additions and 336 deletions

View File

@@ -643,7 +643,7 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
//function : ProcessDragging
//purpose :
//=======================================================================
Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveContext)&,
Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveContext)& aCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)&,
const Graphic3d_Vec2i& theDragFrom,
@@ -676,7 +676,16 @@ Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveC
return Standard_True;
}
case AIS_DragAction_Stop:
break;
{
//at the end of transformation redisplay for updating sensitive areas
StopTransform (true);
if (aCtx->IsDisplayed (this))
{
aCtx->Redisplay (this, true);
}
return Standard_True;
}
break;
}
return Standard_False;
}
@@ -834,10 +843,18 @@ void AIS_Manipulator::updateTransformation()
if (myIsZoomPersistentMode)
{
if (TransformPersistence().IsNull()
|| TransformPersistence()->Mode() != Graphic3d_TMF_ZoomPers
|| TransformPersistence()->Mode() != Graphic3d_TMF_AxialZoomPers
|| !TransformPersistence()->AnchorPoint().IsEqual (myPosition.Location(), 0.0))
{
setTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_ZoomPers, myPosition.Location()));
setTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_AxialZoomPers, myPosition.Location()));
}
}
else
{
if (TransformPersistence().IsNull()
|| TransformPersistence()->Mode() != Graphic3d_TMF_AxialScalePers)
{
setTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_AxialScalePers, myPosition.Location()));
}
}
}
@@ -922,7 +939,7 @@ void AIS_Manipulator::SetZoomPersistence (const Standard_Boolean theToEnable)
if (!theToEnable)
{
setTransformPersistence (Handle(Graphic3d_TransformPers)());
setTransformPersistence (new (Graphic3d_TransformPers)(Graphic3d_TMF_AxialScalePers));
}
updateTransformation();

View File

@@ -19,7 +19,6 @@
#include <BRep_CurveOnClosedSurface.hxx>
#include <BRep_CurveOnSurface.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_Polygon3D.hxx>
#include <BRep_PolygonOnSurface.hxx>
#include <BRep_PolygonOnTriangulation.hxx>
@@ -27,7 +26,6 @@
#include <BRep_TFace.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TVertex.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <ElSLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
@@ -63,6 +61,7 @@
#include <TopoDS_Vertex.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <BRep_GCurve.hxx>
//modified by NIZNHY-PKV Fri Oct 17 14:13:29 2008f
static
@@ -1673,13 +1672,3 @@ Standard_Real BRep_Tool::MaxTolerance (const TopoDS_Shape& theShape,
return aTol;
}
//=======================================================================
//function : Tolerance2d
//purpose :
//=======================================================================
Standard_Real BRep_Tool::Tolerance2d(const TopoDS_Face& theFace, const Standard_Real theTolerance)
{
BRepAdaptor_Surface aAdaptorSurface(theFace);
return Max(aAdaptorSurface.UResolution(theTolerance), aAdaptorSurface.VResolution(theTolerance));
}

View File

@@ -297,11 +297,6 @@ public:
//@param theSubShape - Search subshape, only Face, Edge or Vertex are supported.
Standard_EXPORT static Standard_Real MaxTolerance (const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theSubShape);
//! Returns the 2d tolerance.
//@param theFace - the input face to find 2d tolerance
//@param theTolerance - the input tolerance to calculate 2d tolerance.
Standard_EXPORT static Standard_Real Tolerance2d(const TopoDS_Face& theFace, const Standard_Real theTolerance);
};
#endif // _BRep_Tool_HeaderFile

View File

@@ -441,6 +441,7 @@ static void PERFORM_C0(const TopoDS_Edge& S1, const TopoDS_Edge& S2,
gp_Pnt P1, Pt;
Standard_Integer i, ii;
BRepClass_FaceClassifier classifier;
for (i = 1; i <= arrInter.Length(); i++)
{
const Standard_Real aParameter = arrInter(i);
@@ -771,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& theS1,
Standard_Real U, V;
gp_Pnt Pt, P1 = BRep_Tool::Pnt(theS1);
BRepClass_FaceClassifier classifier;
const Standard_Real tol2d = BRep_Tool::Tolerance2d(theS2, BRep_Tool::Tolerance(theS2));
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
for (i = 1; i <= NbExtrema; i++)
{
@@ -783,7 +784,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& theS1,
// Check if the parameter does not correspond to a vertex
Ext.Parameter(i, U, V);
const gp_Pnt2d PUV(U, V);
classifier.Perform(theS2, PUV, tol2d);
classifier.Perform(theS2, PUV, tol);
if (classifier.State() == TopAbs_IN)
{
if (myDstRef > Dstmin)
@@ -921,7 +922,7 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1, const TopoDS_Fac
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin - myDstRef) < myEps))
{
Standard_Real U, V;
const Standard_Real tol2d = BRep_Tool::Tolerance2d(theS2, BRep_Tool::Tolerance(theS2));
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
gp_Pnt Pt1, Pt2;
const Standard_Real epsP = Precision::PConfusion();
@@ -940,7 +941,7 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1, const TopoDS_Fac
{
Ext.ParameterOnFace(i, U, V);
const gp_Pnt2d PUV(U, V);
classifier.Perform(theS2, PUV, tol2d);
classifier.Perform(theS2, PUV, tol);
if (classifier.State() == TopAbs_IN)
{
if (myDstRef > Dstmin)
@@ -973,7 +974,7 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1, const TopoDS_Fac
gp_Pnt Pt;
Standard_Real U, V;
const Standard_Real tol2d = BRep_Tool::Tolerance2d(theS2, BRep_Tool::Tolerance(theS2));
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
Standard_Integer i;
for (i = 1; i <= arrInter.Length(); i++)
@@ -1006,7 +1007,7 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1, const TopoDS_Fac
// Check if the parameter does not correspond to a vertex
ExtPF.Parameter(ii, U, V);
const gp_Pnt2d PUV(U, V);
classifier.Perform(theS2, PUV, tol2d);
classifier.Perform(theS2, PUV, tol);
if (classifier.State() == TopAbs_IN)
{
if (myDstRef > Dstmin)
@@ -1061,8 +1062,8 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Face& theS1,
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin - myDstRef) < myEps))
{
const Standard_Real tol2d1 = BRep_Tool::Tolerance2d(theS1, BRep_Tool::Tolerance(theS1));
const Standard_Real tol2d2 = BRep_Tool::Tolerance2d(theS2, BRep_Tool::Tolerance(theS2));
const Standard_Real tol1 = BRep_Tool::Tolerance(theS1);
const Standard_Real tol2 = BRep_Tool::Tolerance(theS2);
gp_Pnt Pt1, Pt2;
gp_Pnt2d PUV;
@@ -1080,12 +1081,12 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Face& theS1,
// Check if the parameter does not correspond to a vertex
Ext.ParameterOnFace1(i, U1, V1);
PUV.SetCoord(U1, V1);
classifier.Perform(theS1, PUV, tol2d1);
classifier.Perform(theS1, PUV, tol1);
if (classifier.State() == TopAbs_IN)
{
Ext.ParameterOnFace2(i, U2, V2);
PUV.SetCoord(U2, V2);
classifier.Perform(theS2, PUV, tol2d2);
classifier.Perform(theS2, PUV, tol2);
if (classifier.State() == TopAbs_IN)
{
if (myDstRef > Dstmin)

View File

@@ -89,7 +89,7 @@ void BRepExtrema_ExtFF::Perform(const TopoDS_Face& F1, const TopoDS_Face& F2)
{
// Exploration of points and classification
BRepClass_FaceClassifier classifier;
const Standard_Real Tol2d2 = BRep_Tool::Tolerance2d(F2, BRep_Tool::Tolerance(F2));
const Standard_Real Tol2 = BRep_Tool::Tolerance(F2);
Extrema_POnSurf P1, P2;
Standard_Integer i;
@@ -98,14 +98,13 @@ void BRepExtrema_ExtFF::Perform(const TopoDS_Face& F1, const TopoDS_Face& F2)
myExtSS.Points(i, P1, P2);
P1.Parameter(U1, U2);
const gp_Pnt2d Puv1(U1, U2);
const Standard_Real Tol2d1 = BRep_Tool::Tolerance2d(F1, Tol1);
classifier.Perform(F1, Puv1, Tol2d1);
classifier.Perform(F1, Puv1, Tol1);
const TopAbs_State state1 = classifier.State();
if (state1 == TopAbs_ON || state1 == TopAbs_IN)
{
P2.Parameter(U1, U2);
const gp_Pnt2d Puv2(U1, U2);
classifier.Perform(F2, Puv2, Tol2d2);
classifier.Perform(F2, Puv2, Tol2);
const TopAbs_State state2 = classifier.State();
if (state2 == TopAbs_ON || state2 == TopAbs_IN)
{

View File

@@ -85,12 +85,12 @@ void BRepExtrema_ExtPF::Perform(const TopoDS_Vertex& TheVertex, const TopoDS_Fac
{
BRepClass_FaceClassifier classifier;
Standard_Real U1, U2;
const Standard_Real Tol2d = BRep_Tool::Tolerance2d(TheFace, BRep_Tool::Tolerance(TheFace));
const Standard_Real Tol = BRep_Tool::Tolerance(TheFace);
for (Standard_Integer i = 1; i <= myExtPS.NbExt(); i++)
{
myExtPS.Point(i).Parameter(U1, U2);
const gp_Pnt2d Puv(U1, U2);
classifier.Perform(TheFace, Puv, Tol2d);
classifier.Perform(TheFace, Puv, Tol);
const TopAbs_State state = classifier.State();
if(state == TopAbs_ON || state == TopAbs_IN)
{

View File

@@ -926,7 +926,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
if (StartOnEdge) {
Standard_Boolean Start = 1;
Trim.AddOrConfuse(Start, E[0], E[1], Params);
if (Params.Length() == Vertices.Length())
if (Params.Length() == Vertices.Length() && Params.Length() != 0)
Vertices.SetValue(1,VS);
else
@@ -936,7 +936,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
if (EndOnEdge) {
Standard_Boolean Start = 0;
Trim.AddOrConfuse(Start, E[0], E[1], Params);
if (Params.Length() == Vertices.Length())
if (Params.Length() == Vertices.Length() && Params.Length() != 0)
Vertices.SetValue(Params.Length(),VE);
else
@@ -962,7 +962,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
// Storage of vertices on parallel edges.
// fill MapBis and MapVerPar.
//----------------------------------------------
if (!Vertices.IsEmpty()) {
if (!Vertices.IsEmpty() && Params.Length() == Vertices.Length()) {
for (k = 0; k <= 1; k++) {
if (!MapBis.IsBound(E[k])) {
MapBis .Bind(E[k],EmptySeq);
@@ -1198,7 +1198,9 @@ void BRepFill_OffsetWire::PrepareSpine()
// Cut
TopoDS_Shape aLocalShape = E.Oriented(TopAbs_FORWARD);
// Modified by Sergey KHROMOV - Thu Nov 16 17:29:29 2000 Begin
if (nbEdges == 2 && nbResEdges == 0)
Handle(BRep_TEdge) TEdge = Handle(BRep_TEdge)::DownCast(E.TShape());
const Standard_Integer aNumCurvesInEdge = TEdge->Curves().Size();
if (nbEdges == 2 && nbResEdges == 0 && aNumCurvesInEdge > 1)
ForcedCut = 1;
// Modified by Sergey KHROMOV - Thu Nov 16 17:29:33 2000 End
nbResEdges = CutEdge (TopoDS::Edge(aLocalShape), mySpine, ForcedCut, Cuts);
@@ -1298,7 +1300,7 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh
ii++;
}
while (ii <= Vertices.Length()) {
while (ii <= Vertices.Length() && ii <= Params.Length()) {
U2 = Params.Value(ii).X();
V2 = TopoDS::Vertex(Vertices.Value(ii));

View File

@@ -313,27 +313,11 @@ BRepFill_SectionPlacement(const Handle(BRepFill_LocationLaw)& Law,
}
if (Bof) throw Standard_ConstructionError("Interval non trouve !!");
//Search of the <Ind1> by vertex <TheV>
if (!TheV.IsNull())
for (Ind1 = 1; Ind1 <= myLaw->NbLaw(); Ind1++)
{
TopoDS_Edge anEdge = myLaw->Edge(Ind1);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anEdge, V1, V2);
if (V1.IsSame(TheV) || V2.IsSame(TheV))
break;
}
////////////////////
// Positioning on the localized edge (or 2 Edges)
Standard_Real Angle;
Place.SetLocation(myLaw->Law(Ind1));
if(TheV.IsNull())
Place.Perform(Precision::Confusion());
else {
Place.Perform(SearchParam(myLaw, Ind1, TheV),
Precision::Confusion());
}
Place.Perform(Precision::Confusion());
myTrsf = Place.Transformation(WithContact, WithCorrection);
myIndex = Ind1;
@@ -342,13 +326,7 @@ BRepFill_SectionPlacement(const Handle(BRepFill_LocationLaw)& Law,
if (Ind2) {
Place.SetLocation(myLaw->Law(Ind2));
if (TheV.IsNull())
Place.Perform(Precision::Confusion());
else {
if (Ind1 == Ind2) TheV.Reverse();
Place.Perform(SearchParam(myLaw, Ind2,TheV),
Precision::Confusion());
}
if (Place.Angle() > Angle) {
myTrsf = Place.Transformation(WithContact, WithCorrection);
myIndex = Ind2;

View File

@@ -273,18 +273,32 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
aB.MakeWire (aW);
TopoDS_Wire aWForw = W;
Standard_Boolean hasDegenerated = Standard_False;
aWForw.Orientation (TopAbs_FORWARD);
TopoDS_Iterator anIter (aWForw);
for (; anIter.More(); anIter.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge (anIter.Value());
if (!BRep_Tool::Degenerated (aE))
aB.Add (aW, aE);
if (BRep_Tool::Degenerated(aE))
{
hasDegenerated = Standard_True;
}
else
{
aB.Add(aW, aE);
}
}
aW.Orientation (W.Orientation()); // return to original orient
aW.Closed (W.Closed());
if (hasDegenerated)
{
aW.Orientation (W.Orientation()); // return to original orient
aW.Closed (W.Closed());
}
else
{
aW = W;
}
}
else
{

View File

@@ -140,6 +140,15 @@ public:
myIsEnabled = theIsLoaded;
}
//! Custom function to activate commercial DE component.
//! The input is special sequence of values that described in
//! specific component documentation. Order is important.
//! Each component can have own way of activation.
//!
//! The main goal - real-time loading plug-in activation.
//! OpenSource components don't need to have activation process.
Standard_EXPORT void virtual CustomActivation(const TColStd_ListOfAsciiString&) {};
public:
//!< Internal parameters for transfer process

View File

@@ -17,11 +17,12 @@
//! Define buffers available for dump
enum Graphic3d_BufferType
{
Graphic3d_BT_RGB, //!< color buffer without alpha component
Graphic3d_BT_RGBA, //!< color buffer
Graphic3d_BT_Depth, //!< depth buffer
Graphic3d_BT_RGB, //!< color buffer without alpha component
Graphic3d_BT_RGBA, //!< color buffer
Graphic3d_BT_Depth, //!< depth buffer
Graphic3d_BT_RGB_RayTraceHdrLeft, //!< left view HDR color buffer for Ray-Tracing
Graphic3d_BT_Red, //!< color buffer, red channel
Graphic3d_BT_Red, //!< color buffer, red channel
Graphic3d_BT_ShadowMap, //!< buffer with shadow map
};
#endif // _Graphic3d_BufferType_H__

View File

@@ -42,6 +42,9 @@ Graphic3d_CView::Graphic3d_CView (const Handle(Graphic3d_StructureManager)& theM
myBackfacing (Graphic3d_TypeOfBackfacingModel_Auto),
myVisualization (Graphic3d_TOV_WIREFRAME),
//
myZLayerTarget (Graphic3d_ZLayerId_BotOSD),
myZLayerRedrawMode (Standard_False),
//
myBgColor (Quantity_NOC_BLACK),
myBackgroundType (Graphic3d_TOB_NONE),
myToUpdateSkydome (Standard_False),

View File

@@ -112,6 +112,18 @@ public:
//! Sets visualization type of the view.
void SetVisualizationType (const Graphic3d_TypeOfVisualization theType) { myVisualization = theType; }
//! Returns ZLayerId target
Graphic3d_ZLayerId ZLayerTarget() const { return myZLayerTarget; }
//! Sets ZLayerId target.
void SetZLayerTarget (const Graphic3d_ZLayerId theTarget) { myZLayerTarget = theTarget; }
//! Returns ZLayerId redraw mode
Standard_Boolean ZLayerRedrawMode() const { return myZLayerRedrawMode; }
//! Sets ZLayerId redraw mode.
void SetZLayerRedrawMode (const Standard_Boolean theMode) { myZLayerRedrawMode = theMode; }
//! Switches computed HLR mode in the view
Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
@@ -258,6 +270,11 @@ public:
//! Dump active rendering buffer into specified memory buffer.
virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
//! Dumps the graphical contents of a shadowmap framebuffer into an image.
//! @param theImage the image to store the shadow map.
//! @param theLightName [in] name of the light used to generate the shadow map.
virtual Standard_Boolean ShadowMapDump (Image_PixMap& theImage, const TCollection_AsciiString& theLightName) = 0;
//! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
virtual void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId) = 0;
@@ -638,15 +655,18 @@ protected:
Graphic3d_Vec2d mySubviewOffset; //!< subview corner offset within parent view
Handle(Graphic3d_StructureManager) myStructureManager;
Handle(Graphic3d_Camera) myCamera;
Graphic3d_SequenceOfStructure myStructsToCompute;
Graphic3d_SequenceOfStructure myStructsComputed;
Graphic3d_MapOfStructure myStructsDisplayed;
Standard_Boolean myIsInComputedMode;
Standard_Boolean myIsActive;
Standard_Boolean myIsRemoved;
Graphic3d_TypeOfBackfacingModel myBackfacing;
Graphic3d_TypeOfVisualization myVisualization;
Handle(Graphic3d_Camera) myCamera;
Graphic3d_SequenceOfStructure myStructsToCompute;
Graphic3d_SequenceOfStructure myStructsComputed;
Graphic3d_MapOfStructure myStructsDisplayed;
Standard_Boolean myIsInComputedMode;
Standard_Boolean myIsActive;
Standard_Boolean myIsRemoved;
Graphic3d_TypeOfBackfacingModel myBackfacing;
Graphic3d_TypeOfVisualization myVisualization;
Graphic3d_ZLayerId myZLayerTarget; //!< ZLayerId for redrawing the content of specific zlayers.
Standard_Boolean myZLayerRedrawMode; //!< If true redraws single layer, otherwise redraws group of layers.
Quantity_ColorRGBA myBgColor;
Handle(Graphic3d_TextureMap) myBackgroundImage;

View File

@@ -309,6 +309,10 @@ void Graphic3d_Camera::SetUp (const gp_Dir& theUp)
// =======================================================================
void Graphic3d_Camera::SetAxialScale (const gp_XYZ& theAxialScale)
{
Standard_OutOfRange_Raise_if (theAxialScale.X() <= 0.0
|| theAxialScale.Y() <= 0.0
|| theAxialScale.Z() <= 0.0,
"Graphic3d_Camera::SetAxialScale, bad coefficient");
if (AxialScale().IsEqual (theAxialScale, 0.0))
{
return;

View File

@@ -19,15 +19,18 @@
//! Transform Persistence Mode defining whether to lock in object position, rotation and / or zooming relative to camera position.
enum Graphic3d_TransModeFlags
{
Graphic3d_TMF_None = 0x0000, //!< no persistence attributes (normal 3D object)
Graphic3d_TMF_ZoomPers = 0x0002, //!< object does not resize
Graphic3d_TMF_RotatePers = 0x0008, //!< object does not rotate;
Graphic3d_TMF_TriedronPers = 0x0020, //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating)
Graphic3d_TMF_2d = 0x0040, //!< object is defined in 2D screen coordinates (pixels) and does not resize, pan and rotate
Graphic3d_TMF_CameraPers = 0x0080, //!< object is in front of the camera
Graphic3d_TMF_OrthoPers = 0x0100, //!< object is forced to be rendered with orthographic projection.
Graphic3d_TMF_None = 0x0000, //!< no persistence attributes (normal 3D object)
Graphic3d_TMF_ZoomPers = 0x0002, //!< object does not resize
Graphic3d_TMF_RotatePers = 0x0008, //!< object does not rotate;
Graphic3d_TMF_TriedronPers = 0x0020, //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating)
Graphic3d_TMF_2d = 0x0040, //!< object is defined in 2D screen coordinates (pixels) and does not resize, pan and rotate
Graphic3d_TMF_CameraPers = 0x0080, //!< object is in front of the camera
Graphic3d_TMF_OrthoPers = 0x0100, //!< object is forced to be rendered with orthographic projection.
Graphic3d_TMF_AxialScalePers = 0x0200, //!< object does not resize with axial scale
Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers
| Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate
| Graphic3d_TMF_RotatePers, //!< object doesn't resize and rotate
Graphic3d_TMF_AxialZoomPers = Graphic3d_TMF_ZoomPers
| Graphic3d_TMF_AxialScalePers //!< object does not visually resize with either object or axial scale
};
//! Bitwise OR operator for transform persistence mode flags. Be aware that some flags combinations are not valid.

View File

@@ -40,6 +40,9 @@ DEFINE_STANDARD_HANDLE(Graphic3d_TransformPers, Standard_Transient)
//! Beware that Graphic3d_RenderingParams::ResolutionRatio() will be ignored!
//! For other Persistence flags, normal (world) length units will apply.
//!
//! Graphic3d_TMF_AxialPers and Graphic3d_TMF_AxialZoomPers defines persistence in the axial scale,
//! i.e., keeps the object visual coherence when the camera's axial scale is changed.
//! Meant to be used by objects such as Manipulators and trihedrons.
//! WARNING: Graphic3d_TMF_None is not permitted for defining instance of this class - NULL handle should be used for this purpose!
class Graphic3d_TransformPers : public Standard_Transient
{
@@ -64,13 +67,19 @@ public:
return (theMode & Graphic3d_TMF_OrthoPers) != 0;
}
//! Return true if specified mode is axial transformation persistence.
static Standard_Boolean IsAxial (Graphic3d_TransModeFlags theMode)
{
return (theMode & Graphic3d_TMF_AxialScalePers) != 0;
}
public:
//! Set transformation persistence.
Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode)
: myMode (theMode)
{
if (IsZoomOrRotate (theMode))
if (IsZoomOrRotate (theMode) || IsAxial (theMode))
{
SetPersistence (theMode, gp_Pnt(0.0, 0.0, 0.0));
}
@@ -119,6 +128,9 @@ public:
//! Return true for Graphic3d_TMF_OrthoPers mode.
Standard_Boolean IsOrthoPers () const { return IsOrthoPers (myMode); }
//! Return true for Graphic3d_TMF_AxialScalePers modes.
Standard_Boolean IsAxial() const { return IsAxial (myMode); }
//! Transformation persistence mode flags.
Graphic3d_TransModeFlags Mode() const { return myMode; }
@@ -130,7 +142,7 @@ public:
void SetPersistence (const Graphic3d_TransModeFlags theMode,
const gp_Pnt& thePnt)
{
if (!IsZoomOrRotate (theMode))
if (!IsZoomOrRotate (theMode) && !IsAxial (theMode))
{
throw Standard_ProgramError("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
}
@@ -163,7 +175,7 @@ public:
//! Return the anchor point for zoom/rotate transformation persistence.
gp_Pnt AnchorPoint() const
{
if (!IsZoomOrRotate())
if (!IsZoomOrRotate() && !IsAxial())
{
throw Standard_ProgramError("Graphic3d_TransformPers::AnchorPoint(), wrong persistence mode.");
}
@@ -174,7 +186,7 @@ public:
//! Set the anchor point for zoom/rotate transformation persistence.
void SetAnchorPoint (const gp_Pnt& thePnt)
{
if (!IsZoomOrRotate())
if (!IsZoomOrRotate() && !IsAxial())
{
throw Standard_ProgramError("Graphic3d_TransformPers::SetAnchorPoint(), wrong persistence mode.");
}
@@ -333,6 +345,163 @@ public:
const gp_Pnt* theAnchor = NULL,
const Standard_Boolean theToApplyProjPers = true) const;
//! Perform computations for applying transformation persistence on specified matrices.
//! @param theCamera [in] camera definition
//! @param theViewportWidth [in] viewport width
//! @param theViewportHeight [in] viewport height
//! @param theAnchor [in] if not NULL, overrides anchor point
virtual NCollection_Mat4<Standard_Real> ComputeApply (Handle(Graphic3d_Camera)& theCamera,
const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight,
const gp_Pnt* theAnchor = NULL) const
{
(void)theViewportWidth;
Handle(Graphic3d_Camera) aProxyCamera = theCamera;
if (IsOrthoPers() && !aProxyCamera->IsOrthographic())
{
aProxyCamera = new Graphic3d_Camera(*theCamera); // If OrthoPers, copy camera and set to orthographic projection
aProxyCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
}
NCollection_Mat4<Standard_Real> aWorldView = aProxyCamera->OrientationMatrix();
// use total size when tiling is active
const Standard_Integer aVPSizeY = aProxyCamera->Tile().IsValid() ? aProxyCamera->Tile().TotalSize.y() : theViewportHeight;
// a small enough jitter compensation offset
// to avoid image dragging within single pixel in corner cases
const Standard_Real aJitterComp = 0.001;
if ((myMode & Graphic3d_TMF_TriedronPers) != 0)
{
// reset Z focus for trihedron persistence
const Standard_Real aFocus = aProxyCamera->IsOrthographic()
? aProxyCamera->Distance()
: (aProxyCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aProxyCamera->ZFocus() * aProxyCamera->Distance())
: Standard_Real(aProxyCamera->ZFocus()));
// scale factor to pixels
const gp_XYZ aViewDim = aProxyCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
const gp_Dir aForward = aProxyCamera->Direction();
gp_XYZ aCenter = aProxyCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aProxyCamera->Distance());
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{
const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
const gp_Dir aSide = aForward.Crossed (aProxyCamera->Up());
const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * aProxyCamera->NDC2dOffsetX() - anOffsetX);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{
aCenter += aDeltaX;
}
else
{
aCenter -= aDeltaX;
}
}
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{
const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
const gp_XYZ aDeltaY = aProxyCamera->Up().XYZ() * (Abs(aViewDim.Y()) * aProxyCamera->NDC2dOffsetY() - anOffsetY);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{
aCenter += aDeltaY;
}
else
{
aCenter -= aDeltaY;
}
}
Graphic3d_TransformUtils::Scale (aWorldView,
1.0 / theCamera->AxialScale().X(),
1.0 / theCamera->AxialScale().Y(),
1.0 / theCamera->AxialScale().Z());
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
else if ((myMode & Graphic3d_TMF_2d) != 0)
{
const Standard_Real aFocus = aProxyCamera->IsOrthographic()
? aProxyCamera->Distance()
: (aProxyCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aProxyCamera->ZFocus() * aProxyCamera->Distance())
: Standard_Real(aProxyCamera->ZFocus()));
// scale factor to pixels
const gp_XYZ aViewDim = aProxyCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
gp_XYZ aCenter (0.0, 0.0, -aFocus);
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{
aCenter.SetX (-aViewDim.X() * aProxyCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{
aCenter.SetX (-aCenter.X());
}
}
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{
aCenter.SetY (-aViewDim.Y() * aProxyCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{
aCenter.SetY (-aCenter.Y());
}
}
aWorldView.InitIdentity();
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
else if ((myMode & Graphic3d_TMF_CameraPers) != 0)
{
aWorldView.InitIdentity();
}
else
{
// Compute reference point for transformation in untransformed projection space.
if (theAnchor != NULL)
{
Graphic3d_TransformUtils::Translate (aWorldView, theAnchor->X(), theAnchor->Y(), theAnchor->Z());
}
else
{
Graphic3d_TransformUtils::Translate (aWorldView, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ);
}
if ((myMode & Graphic3d_TMF_RotatePers) != 0)
{
NCollection_Mat3<Standard_Real> aRotMat = persistentRotationMatrix (theCamera, theViewportWidth, theViewportHeight);
aWorldView.SetValue (0, 0, aRotMat.GetColumn (0).x());
aWorldView.SetValue (1, 0, aRotMat.GetColumn (0).y());
aWorldView.SetValue (2, 0, aRotMat.GetColumn (0).z());
aWorldView.SetValue (0, 1, aRotMat.GetColumn (1).x());
aWorldView.SetValue (1, 1, aRotMat.GetColumn (1).y());
aWorldView.SetValue (2, 1, aRotMat.GetColumn (1).z());
aWorldView.SetValue (0, 2, aRotMat.GetColumn (2).x());
aWorldView.SetValue (1, 2, aRotMat.GetColumn (2).y());
aWorldView.SetValue (2, 2, aRotMat.GetColumn (2).z());
}
if (IsAxial())
{
Graphic3d_TransformUtils::Scale (aWorldView,
1.0 / theCamera->AxialScale().X(),
1.0 / theCamera->AxialScale().Y(),
1.0 / theCamera->AxialScale().Z());
}
if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
{
// lock zooming
Standard_Real aScale = persistentScale (aProxyCamera, theViewportWidth, theViewportHeight);
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
}
theCamera = aProxyCamera;
return aWorldView;
}
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
@@ -384,146 +553,14 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
const gp_Pnt* theAnchor,
const Standard_Boolean theToApplyProjPers) const
{
(void )theViewportWidth;
if (myMode == Graphic3d_TMF_None
|| theViewportHeight == 0)
(void)theViewportWidth;
if (myMode == Graphic3d_TMF_None || theViewportHeight == 0)
{
return;
}
Handle(Graphic3d_Camera) aCamera = theCamera;
if (IsOrthoPers() && !aCamera->IsOrthographic())
{
aCamera = new Graphic3d_Camera(*theCamera); // If OrthoPers, copy camera and set to orthographic projection
aCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
}
NCollection_Mat4<Standard_Real> aWorldView = aCamera->OrientationMatrix();
// use total size when tiling is active
const Standard_Integer aVPSizeY = aCamera->Tile().IsValid() ? aCamera->Tile().TotalSize.y() : theViewportHeight;
// a small enough jitter compensation offset
// to avoid image dragging within single pixel in corner cases
const Standard_Real aJitterComp = 0.001;
if ((myMode & Graphic3d_TMF_TriedronPers) != 0)
{
// reset Z focus for trihedron persistence
const Standard_Real aFocus = aCamera->IsOrthographic()
? aCamera->Distance()
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aCamera->ZFocus() * aCamera->Distance())
: Standard_Real(aCamera->ZFocus()));
// scale factor to pixels
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
const gp_Dir aForward = aCamera->Direction();
gp_XYZ aCenter = aCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aCamera->Distance());
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{
const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
const gp_Dir aSide = aForward.Crossed (aCamera->Up());
const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * aCamera->NDC2dOffsetX() - anOffsetX);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{
aCenter += aDeltaX;
}
else
{
aCenter -= aDeltaX;
}
}
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{
const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
const gp_XYZ aDeltaY = aCamera->Up().XYZ() * (Abs(aViewDim.Y()) * aCamera->NDC2dOffsetY() - anOffsetY);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{
aCenter += aDeltaY;
}
else
{
aCenter -= aDeltaY;
}
}
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
else if ((myMode & Graphic3d_TMF_2d) != 0)
{
const Standard_Real aFocus = aCamera->IsOrthographic()
? aCamera->Distance()
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aCamera->ZFocus() * aCamera->Distance())
: Standard_Real(aCamera->ZFocus()));
// scale factor to pixels
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
gp_XYZ aCenter (0.0, 0.0, -aFocus);
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{
aCenter.SetX (-aViewDim.X() * aCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{
aCenter.SetX (-aCenter.X());
}
}
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{
aCenter.SetY (-aViewDim.Y() * aCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{
aCenter.SetY (-aCenter.Y());
}
}
aWorldView.InitIdentity();
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
else if ((myMode & Graphic3d_TMF_CameraPers) != 0)
{
aWorldView.InitIdentity();
}
else
{
// Compute reference point for transformation in untransformed projection space.
if (theAnchor != NULL)
{
Graphic3d_TransformUtils::Translate (aWorldView, theAnchor->X(), theAnchor->Y(), theAnchor->Z());
}
else
{
Graphic3d_TransformUtils::Translate (aWorldView, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ);
}
if ((myMode & Graphic3d_TMF_RotatePers) != 0)
{
NCollection_Mat3<Standard_Real> aRotMat = persistentRotationMatrix (theCamera, theViewportWidth, theViewportHeight);
aWorldView.SetValue (0, 0, aRotMat.GetColumn (0).x());
aWorldView.SetValue (1, 0, aRotMat.GetColumn (0).y());
aWorldView.SetValue (2, 0, aRotMat.GetColumn (0).z());
aWorldView.SetValue (0, 1, aRotMat.GetColumn (1).x());
aWorldView.SetValue (1, 1, aRotMat.GetColumn (1).y());
aWorldView.SetValue (2, 1, aRotMat.GetColumn (1).z());
aWorldView.SetValue (0, 2, aRotMat.GetColumn (2).x());
aWorldView.SetValue (1, 2, aRotMat.GetColumn (2).y());
aWorldView.SetValue (2, 2, aRotMat.GetColumn (2).z());
}
if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
{
// lock zooming
Standard_Real aScale = persistentScale (aCamera, theViewportWidth, theViewportHeight);
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
}
}
Handle(Graphic3d_Camera) aCamera = new Graphic3d_Camera(*theCamera);
NCollection_Mat4<Standard_Real> aWorldView = ComputeApply (aCamera, theViewportWidth, theViewportHeight, theAnchor);
if (!theCamera->IsOrthographic() && IsOrthoPers() && theToApplyProjPers)
{

View File

@@ -978,7 +978,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
return false;
}
aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED;
aFormat = theBufferType == Graphic3d_BT_Depth || theBufferType == Graphic3d_BT_ShadowMap ? GL_DEPTH_COMPONENT : GL_RED;
aType = GL_UNSIGNED_BYTE;
break;
}
@@ -989,7 +989,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
return false;
}
aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED;
aFormat = theBufferType == Graphic3d_BT_Depth || theBufferType == Graphic3d_BT_ShadowMap ? GL_DEPTH_COMPONENT : GL_RED;
aType = GL_UNSIGNED_SHORT;
break;
}
@@ -1000,7 +1000,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
return false;
}
aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED;
aFormat = theBufferType == Graphic3d_BT_Depth || theBufferType == Graphic3d_BT_ShadowMap ? GL_DEPTH_COMPONENT : GL_RED;
aType = GL_FLOAT;
break;
}
@@ -1113,7 +1113,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
GLint aReadBufferPrev = GL_BACK;
if (theGlCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES
&& theBufferType == Graphic3d_BT_Depth
&& (theBufferType == Graphic3d_BT_Depth || theBufferType == Graphic3d_BT_ShadowMap)
&& aFormat != GL_DEPTH_COMPONENT)
{
return Standard_False;

View File

@@ -23,6 +23,7 @@ enum OpenGl_LayerFilter
OpenGl_LF_All, //!< process all layers
OpenGl_LF_Upper, //!< process only top non-raytracable layers
OpenGl_LF_Bottom, //!< process only Graphic3d_ZLayerId_BotOSD
OpenGl_LF_Single, //!< process single layer
OpenGl_LF_RayTracable //!< process only normal raytracable layers (save the bottom layer)
};

View File

@@ -58,10 +58,12 @@ namespace
//! Main constructor.
OpenGl_FilteredIndexedLayerIterator (const NCollection_List<Handle(Graphic3d_Layer)>& theSeq,
Standard_Boolean theToDrawImmediate,
OpenGl_LayerFilter theLayersToProcess)
OpenGl_LayerFilter theFilterMode,
Graphic3d_ZLayerId theLayersToProcess)
: myIter (theSeq),
myLayersToProcess (theLayersToProcess),
myToDrawImmediate (theToDrawImmediate)
myFilterMode (theFilterMode),
myToDrawImmediate (theToDrawImmediate),
myLayersToProcess (theLayersToProcess)
{
next();
}
@@ -94,11 +96,15 @@ namespace
continue;
}
switch (myLayersToProcess)
switch (myFilterMode)
{
case OpenGl_LF_All:
{
return;
if (aLayer->LayerId() >= myLayersToProcess)
{
return;
}
break;
}
case OpenGl_LF_Upper:
{
@@ -119,6 +125,14 @@ namespace
}
break;
}
case OpenGl_LF_Single:
{
if (aLayer->LayerId() == myLayersToProcess)
{
return;
}
break;
}
case OpenGl_LF_RayTracable:
{
if (aLayer->LayerSettings().IsRaytracable()
@@ -133,8 +147,9 @@ namespace
}
private:
OpenGl_IndexedLayerIterator myIter;
OpenGl_LayerFilter myLayersToProcess;
OpenGl_LayerFilter myFilterMode;
Standard_Boolean myToDrawImmediate;
Graphic3d_ZLayerId myLayersToProcess;
};
static const Standard_Integer THE_DRAW_BUFFERS0[] = { GL_COLOR_ATTACHMENT0 };
@@ -714,7 +729,8 @@ void OpenGl_LayerList::renderLayer (const Handle(OpenGl_Workspace)& theWorkspace
//=======================================================================
void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate,
const OpenGl_LayerFilter theLayersToProcess,
const OpenGl_LayerFilter theFilterMode,
const Graphic3d_ZLayerId theLayersToProcess,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const
{
@@ -750,7 +766,7 @@ void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
&& !isShadowMapPass;
const Handle(Graphic3d_LightSet) aLightsBack = aCtx->ShaderManager()->LightSourceState().LightSources();
const Handle(OpenGl_ShadowMapArray) aShadowMaps = aCtx->ShaderManager()->LightSourceState().ShadowMaps();
for (OpenGl_FilteredIndexedLayerIterator aLayerIterStart (myLayers, theToDrawImmediate, theLayersToProcess); aLayerIterStart.More();)
for (OpenGl_FilteredIndexedLayerIterator aLayerIterStart (myLayers, theToDrawImmediate, theFilterMode, theLayersToProcess); aLayerIterStart.More();)
{
bool hasSkippedDepthLayers = false;
for (int aPassIter = toPerformDepthPrepass ? 0 : 2; aPassIter < 3; ++aPassIter)

View File

@@ -102,7 +102,8 @@ public:
//! Render this element
Standard_EXPORT void Render (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate,
const OpenGl_LayerFilter theLayersToProcess,
const OpenGl_LayerFilter theFilterMode,
const Graphic3d_ZLayerId theLayersToProcess,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const;

View File

@@ -520,12 +520,12 @@ Standard_Boolean OpenGl_View::BufferDump (Image_PixMap& theImage, const Graphic3
const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext();
if (theBufferType != Graphic3d_BT_RGB_RayTraceHdrLeft)
{
return myWorkspace->BufferDump(myFBO, theImage, theBufferType);
return myWorkspace->BufferDump (myFBO, theImage, theBufferType);
}
if (!myRaytraceParameters.AdaptiveScreenSampling)
{
return myWorkspace->BufferDump(myAccumFrames % 2 ? myRaytraceFBO2[0] : myRaytraceFBO1[0], theImage, theBufferType);
return myWorkspace->BufferDump (myAccumFrames % 2 ? myRaytraceFBO2[0] : myRaytraceFBO1[0], theImage, theBufferType);
}
if (aCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
@@ -572,6 +572,71 @@ Standard_Boolean OpenGl_View::BufferDump (Image_PixMap& theImage, const Graphic3
return true;
}
//=======================================================================
//function : ShadowMapDump
//purpose :
//=======================================================================
Standard_Boolean OpenGl_View::ShadowMapDump (Image_PixMap& theImage, const TCollection_AsciiString& theLightName)
{
if (!myShadowMaps->IsValid())
{
return Standard_False;
}
const Handle(OpenGl_Context)& aGlCtx = myWorkspace->GetGlContext();
for (Standard_Integer aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter)
{
Handle(OpenGl_ShadowMap)& aShadow = myShadowMaps->ChangeValue(aShadowIter);
if (!aShadow.IsNull() && aShadow->LightSource()->Name() == theLightName)
{
const Handle(OpenGl_FrameBuffer)& aShadowFbo = aShadow->FrameBuffer();
if (aShadowFbo->GetVPSizeX() == myRenderParams.ShadowMapResolution)
{
if ((Standard_Integer)theImage.Width() != aShadowFbo->GetVPSizeX() || (Standard_Integer)theImage.Height() != aShadowFbo->GetVPSizeY())
{
theImage.InitZero(Image_Format_GrayF, aShadowFbo->GetVPSizeX(), aShadowFbo->GetVPSizeY());
}
GLint aReadBufferPrev = GL_BACK;
// Bind FBO if used.
if (!aShadowFbo.IsNull() && aShadowFbo->IsValid())
{
aShadowFbo->BindBuffer (aGlCtx);
}
else if (aGlCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
{
aGlCtx->core11fwd->glGetIntegerv (GL_READ_BUFFER, &aReadBufferPrev);
GLint aDrawBufferPrev = GL_BACK;
aGlCtx->core11fwd->glGetIntegerv (GL_DRAW_BUFFER, &aDrawBufferPrev);
aGlCtx->core11fwd->glReadBuffer (aDrawBufferPrev);
}
// Setup alignment.
const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL.
aGlCtx->core11fwd->glPixelStorei (GL_PACK_ALIGNMENT, anAligment);
// Read data.
aGlCtx->core11fwd->glReadPixels (0, 0, GLsizei(theImage.SizeX()), GLsizei(theImage.SizeY()), GL_DEPTH_COMPONENT, GL_FLOAT, theImage.ChangeData());
aGlCtx->core11fwd->glPixelStorei (GL_PACK_ALIGNMENT, 1);
if (aGlCtx->hasPackRowLength)
{
aGlCtx->core11fwd->glPixelStorei (GL_PACK_ROW_LENGTH, 0);
}
// Unbind FBO.
if (!aShadowFbo.IsNull() && aShadowFbo->IsValid())
{
aShadowFbo->UnbindBuffer (aGlCtx);
}
else if (aGlCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
{
aGlCtx->core11fwd->glReadBuffer (aReadBufferPrev);
}
// Check for errors.
const bool hasErrors = aGlCtx->ResetErrors (true);
return !hasErrors;
}
}
}
return Standard_False;
}
// =======================================================================
// function : GradientBackground
// purpose :
@@ -2583,7 +2648,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
if (aCtx->arbFBOBlit != NULL)
{
// Render bottom OSD layer
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Bottom, theReadDrawFbo, theOitAccumFbo);
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Bottom, myZLayerTarget, theReadDrawFbo, theOitAccumFbo);
const Standard_Integer aPrevFilter = myWorkspace->RenderFilter() & ~(Standard_Integer )(OpenGl_RenderFilter_NonRaytraceableOnly);
myWorkspace->SetRenderFilter (aPrevFilter | OpenGl_RenderFilter_NonRaytraceableOnly);
@@ -2599,7 +2664,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
}
// Render non-polygonal elements in default layer
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_RayTracable, theReadDrawFbo, theOitAccumFbo);
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_RayTracable, myZLayerTarget, theReadDrawFbo, theOitAccumFbo);
}
myWorkspace->SetRenderFilter (aPrevFilter);
}
@@ -2622,7 +2687,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
raytrace (aSizeXY.x(), aSizeXY.y(), theProjection, theReadDrawFbo, aCtx);
// Render upper (top and topmost) OpenGL layers
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Upper, theReadDrawFbo, theOitAccumFbo);
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Upper, myZLayerTarget, theReadDrawFbo, theOitAccumFbo);
}
}
@@ -2630,7 +2695,9 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
// mode or in case of ray-tracing failure
if (toRenderGL)
{
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_All, theReadDrawFbo, theOitAccumFbo);
// check if only a single layer is to be dumped
OpenGl_LayerFilter aFilter = myZLayerRedrawMode ? OpenGl_LF_Single : OpenGl_LF_All;
myZLayers.Render (myWorkspace, theToDrawImmediate, aFilter, myZLayerTarget, theReadDrawFbo, theOitAccumFbo);
// Set flag that scene was redrawn by standard pipeline
myWasRedrawnGL = Standard_True;

View File

@@ -111,6 +111,12 @@ public:
Standard_EXPORT virtual Standard_Boolean BufferDump (Image_PixMap& theImage,
const Graphic3d_BufferType& theBufferType) Standard_OVERRIDE;
//! Dumps the graphical contents of a shadowmap framebuffer into an image.
//! @param theImage the image to store the shadow map.
//! @param theLightName [in] name of the light used to generate the shadow map.
Standard_EXPORT virtual Standard_Boolean ShadowMapDump (Image_PixMap& theImage,
const TCollection_AsciiString& theLightName) Standard_OVERRIDE;
//! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
Standard_EXPORT virtual void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId) Standard_OVERRIDE;

View File

@@ -383,6 +383,16 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools,
return Standard_False;
}
if (toMakeAssembly)
{
TDF_Label aRefLabel;
theTools.ShapeTool->GetReferredShape(aNewLabel, aRefLabel);
if (!aRefLabel.IsNull())
{
theTools.OriginalShapeMap.Bind(theShape, aRefLabel);
}
}
// if new label is a reference get referred shape
TDF_Label aNewRefLabel = aNewLabel;
theTools.ShapeTool->GetReferredShape (aNewLabel, aNewRefLabel);

View File

@@ -57,6 +57,7 @@ public:
Handle(XCAFDoc_ColorTool) ColorTool;
Handle(XCAFDoc_VisMaterialTool) VisMaterialTool;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> ComponentMap;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> OriginalShapeMap;
};
public:

View File

@@ -28,14 +28,16 @@ class SelectMgr_SortCriterion
public:
Handle(Select3D_SensitiveEntity) Entity; //!< detected entity
gp_Pnt Point; //!< 3D point
Graphic3d_Vec3 Normal; //!< surface normal or 0 vector if undefined
Standard_Real Depth; //!< distance from the view plane to the entity
Standard_Real MinDist; //!< distance from the clicked point to the entity on the view plane
Standard_Real Tolerance; //!< tolerance used for selecting candidates
Standard_Integer Priority; //!< selection priority
Standard_Integer ZLayerPosition; //!< ZLayer rendering order index, stronger than a depth
Standard_Integer NbOwnerMatches; //!< overall number of entities collected for the same owner
gp_Pnt Point; //!< 3D point
Graphic3d_Vec3 Normal; //!< surface normal or 0 vector if undefined
Standard_Real Depth; //!< distance from the view plane to the entity
Standard_Real MinDist; //!< distance from the clicked point to the entity on the view plane
Standard_Real Tolerance; //!< tolerance used for selecting candidates
Standard_Integer SelectionPriority; //!< selection priority
Standard_Integer DisplayPriority; //!< display priority
Standard_Integer ZLayerPosition; //!< ZLayer rendering order index, stronger than a depth
Standard_Integer NbOwnerMatches; //!< overall number of entities collected for the same owner
Standard_Boolean IsPreferPriority; //!< flag to signal comparison to be done over priority
public:
DEFINE_STANDARD_ALLOC
@@ -45,9 +47,11 @@ public:
: Depth (0.0),
MinDist (0.0),
Tolerance(0.0),
Priority (0),
SelectionPriority (0),
DisplayPriority(0),
ZLayerPosition (0),
NbOwnerMatches (0) {}
NbOwnerMatches (0),
IsPreferPriority (Standard_False) {}
//! Compare with another item by depth, priority and minDist.
bool IsCloserDepth (const SelectMgr_SortCriterion& theOther) const
@@ -86,13 +90,18 @@ public:
}
// if two objects have similar depth, select the one with higher priority
if (Priority > theOther.Priority)
if (SelectionPriority > theOther.SelectionPriority)
{
return true;
}
if (DisplayPriority > theOther.DisplayPriority)
{
return true;
}
// if priorities are equal, one closest to the mouse
return Priority == theOther.Priority
return SelectionPriority == theOther.SelectionPriority
&& MinDist < theOther.MinDist;
}
@@ -105,13 +114,14 @@ public:
return ZLayerPosition > theOther.ZLayerPosition;
}
if (Priority > theOther.Priority)
if (SelectionPriority != theOther.SelectionPriority)
{
return true;
return SelectionPriority > theOther.SelectionPriority;
}
else if (Priority != theOther.Priority)
if (DisplayPriority != theOther.DisplayPriority)
{
return false;
return DisplayPriority > theOther.DisplayPriority;
}
//if (Abs (Depth - theOther.Depth) <= (Tolerance + theOther.Tolerance))

View File

@@ -16,6 +16,7 @@
#include <SelectMgr_ViewerSelector.hxx>
#include <AIS_InteractiveObject.hxx>
#include <BVH_Tree.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Pnt.hxx>
@@ -54,13 +55,13 @@ namespace
{
const SelectMgr_SortCriterion& anElemLeft = myMapOfCriterion->FindFromIndex (theLeft);
const SelectMgr_SortCriterion& anElemRight = myMapOfCriterion->FindFromIndex (theRight);
if (myToPreferClosest)
if ((anElemLeft.IsPreferPriority && anElemRight.IsPreferPriority) || !myToPreferClosest)
{
return anElemLeft.IsCloserDepth (anElemRight);
return anElemLeft.IsHigherPriority (anElemRight);
}
else
{
return anElemLeft.IsHigherPriority (anElemRight);
return anElemLeft.IsCloserDepth (anElemRight);
}
}
@@ -270,13 +271,32 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
{
return;
}
SelectMgr_SortCriterion aCriterion;
myZLayerOrderMap.Find (!aSelectable.IsNull() ? aSelectable->ZLayer() : Graphic3d_ZLayerId_Default, aCriterion.ZLayerPosition);
aCriterion.Entity = theEntity;
aCriterion.Priority = anOwner->Priority();
aCriterion.Depth = aPickResult.Depth();
aCriterion.MinDist = aPickResult.DistToGeomCenter();
aCriterion.Entity = theEntity;
aCriterion.SelectionPriority = anOwner->Priority();
aCriterion.Depth = aPickResult.Depth();
aCriterion.MinDist = aPickResult.DistToGeomCenter();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelectable);
if (!aSelectable.IsNull())
{
if (aSelectable->Presentations().Size() > 0 && !aSelectable->TransformPersistence().IsNull())
{
if (aSelectable->TransformPersistence()->Mode() == Graphic3d_TMF_2d)
{
aCriterion.IsPreferPriority = Standard_True;
aCriterion.DisplayPriority = Graphic3d_DisplayPriority_INVALID;
if (!anObj.IsNull())
{
Handle(Prs3d_Presentation) aPrs = anObj->Presentation();
if (!aPrs.IsNull())
{
aCriterion.DisplayPriority = aPrs->DisplayPriority();
}
}
}
}
}
if (SelectMgr_SortCriterion* aPrevCriterion = mystored.ChangeSeek (anOwner))
{

View File

@@ -35,7 +35,7 @@
// Primary definitions
#define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 8
#define OCC_VERSION_MAINTENANCE 1
#define OCC_VERSION_MAINTENANCE 2
//! This macro must be commented in official release, and set to non-empty
//! string in other situations, to identify specifics of the version, e.g.:
@@ -47,7 +47,7 @@
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.8
#define OCC_VERSION_STRING "7.8"
#define OCC_VERSION_COMPLETE "7.8.1"
#define OCC_VERSION_COMPLETE "7.8.2"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -16,29 +16,36 @@
#include <Graphic3d_BufferType.hxx>
#include <V3d_StereoDumpOptions.hxx>
#include <Graphic3d_ZLayerId.hxx>
//! The structure defines options for image dump functionality.
struct V3d_ImageDumpOptions
{
Standard_Integer Width; //!< width of image dump to allocate an image, 0 by default (meaning that image should be already allocated)
Standard_Integer Height; //!< height of image dump to allocate an image, 0 by default (meaning that image should be already allocated)
Graphic3d_BufferType BufferType; //!< which buffer to dump (color / depth), Graphic3d_BT_RGB by default
V3d_StereoDumpOptions StereoOptions; //!< dumping stereoscopic camera, V3d_SDO_MONO by default (middle-point monographic projection)
Standard_Integer TileSize; //!< the view dimension limited for tiled dump, 0 by default (automatic tiling depending on hardware capabilities)
Standard_Boolean ToAdjustAspect; //!< flag to override active view aspect ratio by (Width / Height) defined for image dump (TRUE by default)
Standard_Integer Width; //!< Width of image dump to allocate an image, 0 by default (meaning that image should be already allocated).
Standard_Integer Height; //!< Height of image dump to allocate an image, 0 by default (meaning that image should be already allocated).
Graphic3d_BufferType BufferType; //!< Which buffer to dump (color / depth), Graphic3d_BT_RGB by default.
V3d_StereoDumpOptions StereoOptions; //!< Dumping stereoscopic camera, V3d_SDO_MONO by default (middle-point monographic projection).
Standard_Integer TileSize; //!< The view dimension limited for tiled dump, 0 by default (automatic tiling depending on hardware capabilities).
Standard_Boolean ToAdjustAspect; //!< Flag to override active view aspect ratio by (Width / Height) defined for image dump (TRUE by default).
Graphic3d_ZLayerId TargetZLayerId; //!< Target z layer id which defines the last layer to be drawn before image dump.
Standard_Boolean IsSingleLayer; //<! Flags if dumping is to be done to a single or to multiple layers.
Standard_CString LightName; //<! Name of the target light whose shadowmap is to be dumped.
public:
//! Default constructor.
V3d_ImageDumpOptions()
: Width (0),
Height (0),
BufferType (Graphic3d_BT_RGB),
StereoOptions (V3d_SDO_MONO),
TileSize (0),
ToAdjustAspect(Standard_True) {}
: Width (0),
Height (0),
BufferType (Graphic3d_BT_RGB),
StereoOptions (V3d_SDO_MONO),
TileSize (0),
ToAdjustAspect (Standard_True),
TargetZLayerId (Graphic3d_ZLayerId_BotOSD),
IsSingleLayer (Standard_False),
LightName ("") {}
};
#endif // _V3d_ImageDumpOptions_HeaderFile

View File

@@ -2814,6 +2814,7 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break;
case Graphic3d_BT_Red: aFormat = Image_Format_Gray; break;
case Graphic3d_BT_ShadowMap: aFormat = Image_Format_GrayF; break;
}
if (!theImage.InitZero (aFormat, Standard_Size(aTargetSize.x()), Standard_Size(aTargetSize.y())))
@@ -2940,7 +2941,9 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
{
aCamera->SetAspect (Standard_Real(aTargetSize.x()) / Standard_Real(aTargetSize.y()));
}
//apply zlayer rendering parameters to view
myView->SetZLayerTarget (theParams.TargetZLayerId);
myView->SetZLayerRedrawMode (theParams.IsSingleLayer);
// render immediate structures into back buffer rather than front
const Standard_Boolean aPrevImmediateMode = myView->SetImmediateModeDrawToFront (Standard_False);
@@ -2952,7 +2955,19 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
myView->FBOChangeViewport (aFBOPtr, aTargetSize.x(), aTargetSize.y());
}
Redraw();
isSuccess = isSuccess && myView->BufferDump (theImage, theParams.BufferType);
if (theParams.BufferType == Graphic3d_BT_ShadowMap)
{
// draw shadow maps
if (!myView->ShadowMapDump (theImage, theParams.LightName))
{
Message::SendFail ("OpenGl_View::BufferDump() failed to dump shadowmap");
isSuccess = Standard_False;
}
}
else
{
isSuccess = isSuccess && myView->BufferDump (theImage, theParams.BufferType);
}
}
else
{
@@ -3024,6 +3039,9 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
myView->FBOChangeViewport (aPrevFBOPtr, aPrevFBOVPSize.x(), aPrevFBOVPSize.y());
}
myView->SetFBO (aPrevFBOPtr);
//apply default zlayer rendering parameters to view
myView->SetZLayerTarget (Graphic3d_ZLayerId_BotOSD);
myView->SetZLayerRedrawMode (Standard_False);
return isSuccess;
}

View File

@@ -851,19 +851,25 @@ public:
//! @param theBufferType type of the view buffer to dump (color / depth)
//! @param theToAdjustAspect when true, active view aspect ratio will be overridden by (theWidth / theHeight)
//! @param theStereoOptions how to dump stereographic camera
Standard_Boolean ToPixMap (Image_PixMap& theImage,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
Standard_Boolean ToPixMap (Image_PixMap& theImage,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB,
const Standard_Boolean theToAdjustAspect = Standard_True,
const V3d_StereoDumpOptions theStereoOptions = V3d_SDO_MONO)
const Graphic3d_ZLayerId theTargetZLayerId = Graphic3d_ZLayerId_BotOSD,
const Standard_Integer theIsSingleLayer = Standard_False,
const V3d_StereoDumpOptions theStereoOptions = V3d_SDO_MONO,
const Standard_CString theLightName = "")
{
V3d_ImageDumpOptions aParams;
aParams.Width = theWidth;
aParams.Height = theHeight;
aParams.BufferType = theBufferType;
aParams.Width = theWidth;
aParams.Height = theHeight;
aParams.BufferType = theBufferType;
aParams.StereoOptions = theStereoOptions;
aParams.ToAdjustAspect = theToAdjustAspect;
aParams.TargetZLayerId = theTargetZLayerId;
aParams.IsSingleLayer = theIsSingleLayer;
aParams.LightName = theLightName;
return ToPixMap (theImage, aParams);
}

View File

@@ -966,8 +966,11 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
ViewerTest_StereoPair aStereoPair = ViewerTest_SP_Single;
V3d_ImageDumpOptions aParams;
Handle(Graphic3d_Camera) aCustomCam;
aParams.BufferType = Graphic3d_BT_RGB;
aParams.StereoOptions = V3d_SDO_MONO;
aParams.BufferType = Graphic3d_BT_RGB;
aParams.StereoOptions = V3d_SDO_MONO;
aParams.TargetZLayerId = Graphic3d_ZLayerId_BotOSD;
aParams.IsSingleLayer = Standard_False;
aParams.LightName = "";
for (; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArg (theArgVec[anArgIter]);
@@ -998,6 +1001,31 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
{
aParams.BufferType = Graphic3d_BT_Depth;
}
else if (aBufArg == "shadowmap")
{
if (++anArgIter >= theArgNb)
{
Message::SendFail() << "Error: missing light name for shadowmap dump";
return 1;
}
aParams.BufferType = Graphic3d_BT_ShadowMap;
aParams.LightName = theArgVec[anArgIter];
Standard_Boolean isLightFound = Standard_False;
for (V3d_ListOfLightIterator aLightIter(aView->ActiveLightIterator()); aLightIter.More(); aLightIter.Next())
{
Handle(V3d_Light) aLight = aLightIter.Value();
if (aLight->Name() == aParams.LightName)
{
isLightFound = Standard_True;
break;
}
}
if (!isLightFound)
{
Message::SendFail() << "Error: couldn't find light '" << aParams.LightName << "'";
return 1;
}
}
else
{
Message::SendFail() << "Error: unknown buffer '" << aBufArg << "'";
@@ -1105,6 +1133,11 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
{
aParams.BufferType = Graphic3d_BT_Depth;
}
else if (anArg == "-shadowmap"
|| anArg == "shadowmap")
{
aParams.BufferType = Graphic3d_BT_ShadowMap;
}
else if (anArg == "-width"
|| anArg == "width"
|| anArg == "sizex")
@@ -1147,6 +1180,39 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
}
aParams.TileSize = Draw::Atoi (theArgVec[anArgIter]);
}
else if (anArg == "-grouplayer")
{
if (++anArgIter >= theArgNb)
{
Message::SendFail() << "Error: integer value is expected right after 'grouplayer'";
return 1;
}
Graphic3d_ZLayerId aZLayer = (Graphic3d_ZLayerId)Draw::Atoi (theArgVec[anArgIter]);
if (!ViewerTest::ParseZLayer (theArgVec[anArgIter], aZLayer) ||
aZLayer == Graphic3d_ZLayerId_UNKNOWN)
{
Message::SendFail() << "Error: invalid layer " << aZLayer << ".";
return 1;
}
aParams.TargetZLayerId = aZLayer;
}
else if (anArg == "-singlelayer")
{
if (++anArgIter >= theArgNb)
{
Message::SendFail() << "Error: integer value is expected right after 'singlelayer'";
return 1;
}
Graphic3d_ZLayerId aZLayer = (Graphic3d_ZLayerId)Draw::Atoi (theArgVec[anArgIter]);
if (!ViewerTest::ParseZLayer (theArgVec[anArgIter], aZLayer) ||
aZLayer == Graphic3d_ZLayerId_UNKNOWN)
{
Message::SendFail() << "Error: invalid layer " << aZLayer << ".";
return 1;
}
aParams.TargetZLayerId = aZLayer;
aParams.IsSingleLayer = Standard_True;
}
else
{
Message::SendFail() << "Error: unknown argument '" << theArgVec[anArgIter] << "'";
@@ -1174,6 +1240,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break;
case Graphic3d_BT_Red: aFormat = Image_Format_Gray; break;
case Graphic3d_BT_ShadowMap: aFormat = Image_Format_GrayF; break;
}
const bool wasImmUpdate = aView->SetImmediateUpdate (false);
@@ -1194,8 +1261,11 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
else if (aPixMap.SizeX() != Standard_Size(aParams.Width)
|| aPixMap.SizeY() != Standard_Size(aParams.Height))
{
theDI << "Fail: dumped dimensions " << (Standard_Integer )aPixMap.SizeX() << "x" << (Standard_Integer )aPixMap.SizeY()
<< " are lesser than requested " << aParams.Width << "x" << aParams.Height << "\n";
if (aParams.BufferType != Graphic3d_BT_ShadowMap)
{
theDI << "Fail: dumped dimensions " << (Standard_Integer)aPixMap.SizeX() << "x" << (Standard_Integer)aPixMap.SizeY()
<< " are lesser than requested " << aParams.Width << "x" << aParams.Height << "\n";
}
}
break;
}
@@ -4798,6 +4868,14 @@ inline Standard_Boolean parseTrsfPersFlag (const TCollection_AsciiString& theFla
{
theFlags = Graphic3d_TMF_TriedronPers;
}
else if (theFlagString == "axial")
{
theFlags = Graphic3d_TMF_AxialScalePers;
}
else if (theFlagString == "zoomaxial")
{
theFlags = Graphic3d_TMF_AxialZoomPers;
}
else if (theFlagString == "none")
{
theFlags = Graphic3d_TMF_None;
@@ -6648,7 +6726,7 @@ If last 3 optional parameters are not set prints numbers of U-, V- isolines and
addCmd ("vdisplay", VDisplay2, /* [vdisplay] */ R"(
vdisplay [-noupdate|-update] [-mutable] [-neutral]
[-trsfPers {zoom|rotate|zoomRotate|trihedron|none}=none]
[-trsfPers {zoom|rotate|zoomRotate|trihedron|axial|zoomaxial|none}=none]
[-trsfPersPos X Y [Z]] [-3d]
[-2d|-trihedron [{top|bottom|left|right|topLeft
|topRight|bottomLeft|bottomRight}
@@ -6776,6 +6854,9 @@ vdump <filename>.png [-width Width -height Height]
[-stereo mono|left|right|blend|sideBySide|overUnder=mono]
[-xrPose base|head|handLeft|handRight=base]
[-tileSize Size=0]
[-grouplayer zlayerId]
[-singlelayer zlayerId]
[-buffer shadowmap lightname]
Dumps content of the active view into image file.
)" /* [vdump] */);

View File

@@ -6390,6 +6390,79 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
return 0;
}
//=======================================================================
//function : VSelectPriority
//purpose : Prints or sets the selection priority for an object
//=======================================================================
static Standard_Integer VSelectPriority (Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
Message::SendFail("Error: no active viewer");
return 1;
}
TCollection_AsciiString aLastArg(theArgVec[theNbArgs - 1]);
Standard_Integer aPriority = -1;
Standard_Integer aNbArgs = theNbArgs;
if (aNbArgs < 2 || aNbArgs > 3)
{
Message::SendFail("Syntax error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
if (aLastArg.IsIntegerValue())
{
TCollection_AsciiString aFocusArg(theArgVec[1]);
aPriority = aLastArg.IntegerValue();
--aNbArgs;
if (aPriority < 0)
{
Message::SendFail() << "Syntax error: the specified selection priority value '" << aLastArg << "' is invalid ]";
return 1;
}
}
else
{
anUpdateTool.Invalidate();
}
for (Standard_Integer anArgIter = 1; anArgIter < aNbArgs; ++anArgIter)
{
TCollection_AsciiString aName(theArgVec[anArgIter]);
Handle(AIS_InteractiveObject) anIObj;
GetMapOfAIS().Find2 (aName, anIObj);
if (anIObj.IsNull())
{
Message::SendFail() << "Error: the object '" << theArgVec[1] << "' is not displayed";
return 1;
}
Handle(SelectMgr_EntityOwner) anOwner = anIObj->GlobalSelOwner();
if (!anOwner.IsNull())
{
if (aPriority == Graphic3d_DisplayPriority_INVALID)
{
theDI << anOwner->Priority() << " ";
}
else
{
anOwner->SetPriority (aPriority);
}
}
else
{
Message::SendFail() << "Error: the object '" << theArgVec[1] << "' is does not have a selection priority attached.";
return 1;
}
}
return 0;
}
//=======================================================================
//function : VMoveTo
//purpose : Emulates cursor movement to defined pixel position
@@ -14431,6 +14504,11 @@ Emulate different types of selection:
5) Selection scheme replace, replaceextra, xor, add or remove (replace by default).
)" /* [vselect] */);
addCmd("vselectpriority", VSelectPriority, /* [vselectpriority] */ R"(
vselectpriority name [value]
Prints or sets the selection priority for an object.
)" /* [vselectpriority] */);
addCmd ("vmoveto", VMoveTo, /* [vmoveto] */ R"(
vmoveto [x y] [-reset]
Emulate cursor movement to pixel position (x,y).

View File

@@ -98,6 +98,7 @@
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_Material.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#include <XCAFDoc_Volume.hxx>
#include <XCAFPrs.hxx>
#include <XCAFPrs_AISObject.hxx>
@@ -323,7 +324,7 @@ static Standard_Integer dump (Draw_Interpretor& di, Standard_Integer argc, const
//=======================================================================
static void StatAssembly(const TDF_Label L,
const Standard_Integer level,
const Standard_Integer level,
Handle(TColStd_HArray1OfInteger) &HAI,
Standard_Integer &NbCentroidProp,
Standard_Integer &NbVolumeProp,
@@ -331,9 +332,10 @@ static void StatAssembly(const TDF_Label L,
Standard_Integer &NbShapesWithName,
Standard_Integer &NbShapesWithColor,
Standard_Integer &NbShapesWithLayer,
Standard_Integer &NbShapesWithVisMaterial,
Handle(TDocStd_Document) &aDoc,
Standard_Boolean &PrintStructMode,
Draw_Interpretor& di)
Draw_Interpretor& di)
{
if(PrintStructMode) {
for(Standard_Integer j=0; j<=level; j++)
@@ -370,6 +372,7 @@ static void StatAssembly(const TDF_Label L,
}
Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(aDoc->Main());
Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(aDoc->Main());
Handle(XCAFDoc_VisMaterialTool) VMTool = XCAFDoc_DocumentTool::VisMaterialTool(aDoc->Main());
Quantity_ColorRGBA col;
Standard_Boolean IsColor = Standard_False;
Standard_Boolean IsByLayer = Standard_False;
@@ -386,7 +389,7 @@ static void StatAssembly(const TDF_Label L,
{
Handle(TColStd_HSequenceOfExtendedString) aLayerS;
LTool->GetLayers(L, aLayerS);
// Currently for DXF pnly, thus
// Currently for DXF only, thus
// only 1 Layer should be.
if(aLayerS->Length() == 1)
{
@@ -428,14 +431,29 @@ static void StatAssembly(const TDF_Label L,
}
NbShapesWithLayer++;
}
if(PrintStructMode) di<<"\n";
TDF_Label aVMat;
if (VMTool->GetShapeMaterial(L, aVMat))
{
if (PrintStructMode) {
di << "VisMaterial(";
Handle(TDataStd_Name) aNodeName;
if (aVMat.FindAttribute(TDataStd_Name::GetID(), aNodeName))
{
di << "\"" << aNodeName->Get() << "\"";
}
di << ") ";
}
NbShapesWithVisMaterial++;
}
if (PrintStructMode) di << "\n";
HAI->SetValue(level, HAI->Value(level)+1 );
if(L.HasChild()) {
for(Standard_Integer i=1; i<=L.NbChildren(); i++) {
StatAssembly(L.FindChild(i), level+1, HAI, NbCentroidProp, NbVolumeProp,
NbAreaProp, NbShapesWithName, NbShapesWithColor,
NbShapesWithLayer, aDoc, PrintStructMode, di);
NbShapesWithLayer, NbShapesWithVisMaterial, aDoc, PrintStructMode, di);
}
}
@@ -465,14 +483,14 @@ static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, co
if(PrintStructMode) di<<"\nStructure of shapes in the document:\n";
Standard_Integer level=0;
Standard_Integer NbCentroidProp=0, NbVolumeProp=0, NbAreaProp=0;
Standard_Integer NbShapesWithName=0, NbShapesWithColor=0, NbShapesWithLayer=0;
Standard_Integer NbShapesWithName=0, NbShapesWithColor=0, NbShapesWithLayer=0, NbShapesWithVisMaterial = 0;
Handle(TColStd_HArray1OfInteger) HAI = new TColStd_HArray1OfInteger(0,20);
Standard_Integer i=0;
for(i=0; i<=20; i++) HAI->SetValue(i,0);
for(i=1; i<=SeqLabels.Length(); i++) {
StatAssembly(SeqLabels.Value(i), level, HAI, NbCentroidProp, NbVolumeProp,
NbAreaProp, NbShapesWithName, NbShapesWithColor,
NbShapesWithLayer, Doc, PrintStructMode, di);
NbShapesWithLayer, NbShapesWithVisMaterial, Doc, PrintStructMode, di);
}
Standard_Integer NbLabelsShape = 0;
di<<"\nStatistis of shapes in the document:\n";
@@ -486,6 +504,7 @@ static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, co
di<<"Number of labels with name = "<<NbShapesWithName<<"\n";
di<<"Number of labels with color link = "<<NbShapesWithColor<<"\n";
di<<"Number of labels with layer link = "<<NbShapesWithLayer<<"\n";
di << "Number of labels with vis material link = " << NbShapesWithVisMaterial << "\n";
di<<"\nStatistis of Props in the document:\n";
di<<"Number of Centroid Props = "<<NbCentroidProp<<"\n";
@@ -520,6 +539,23 @@ static Standard_Integer statdoc (Draw_Interpretor& di, Standard_Integer argc, co
di<<"\n";
}
Handle(XCAFDoc_VisMaterialTool) VMTool = XCAFDoc_DocumentTool::VisMaterialTool(Doc->Main());
TDF_LabelSequence aVMats;
VMTool->GetMaterials(aVMats);
di << "\nNumber of vis materials = " << aVMats.Length() << "\n";
if (!aVMats.IsEmpty())
{
for (TDF_LabelSequence::Iterator aVMIter(aVMats); aVMIter.More(); aVMIter.Next())
{
Handle(TDataStd_Name) aNodeName;
if (aVMIter.Value().FindAttribute(TDataStd_Name::GetID(), aNodeName))
{
di << "\"" << aNodeName->Get() << "\" ";
}
}
di << "\n";
}
di<<"\n";
return 0;
}

View File

@@ -17,7 +17,7 @@ if [catch { openoffset resoffset a 5 5 i } ] {
checkshape result
checksection result
checknbshapes result -vertex 4 -edge 3 -wire 1 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 0 -shape 8
checknbshapes result -vertex 3 -edge 2 -wire 1 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 0 -shape 6
}
smallview

View File

@@ -0,0 +1,14 @@
puts "============="
puts "0032964: Modeling Algorithms - 2d Offset sometimes 'split' straight edges"
puts "============="
pload MODELING
vertex p1 -90 40 0
vertex p2 40 40 0
vertex p3 40 -90 0
edge e1 p1 p2
edge e2 p2 p3
wire w1 e1 e2
openoffset oo w1 1 40
checknbshapes oo_1 -vertex 3 -edge 2 -wire 1 -shape 6
checkview -display oo_1 -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,10 @@
puts "==============================================================="
puts "0033146: Modeling Algorithms - 2D Offset with arc-lin approximation fails on open B-spline edge"
puts "==============================================================="
puts ""
pload MODELING
restore [locate_data_file bug33146.brep] a
wire a a
openoffset result a 1 1. -approx
checkview -display result_1 -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,21 @@
puts "============="
puts "0033156: Modeling Algorithms - Planar face creation problem"
puts "============="
pload MODELING
vertex v1 0 0 0
vertex v2 10 0 0
vertex v3 0 10 0
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v1
wire w1 e1 e2 e3
mkplane f1 w1 1
set state [issubshape w1 f1]
if { [regexp "w1 is NOT sub-shape of f1" $state] == 1 } {
puts "Error : w1 is NOT sub-shape of f1"
}

View File

@@ -1,14 +0,0 @@
puts "========================"
puts "0033394: Modeling Algorithms - Wrong usage of BRepClass_FaceClassifier with 3d tolerance"
puts "========================"
puts ""
pload MODELING
restore [locate_data_file bug33394.brep] fb
vertex vert 1016.3915670000133 17180 -5689.3758362036951
distmini aa fb vert
set tolerance [checkmaxtol aa]
if { [dval aa_val] > ${tolerance} } {
puts "Error: The distance should be 0"
}

View File

@@ -1,10 +0,0 @@
puts "============="
puts "0033156: Modeling Algorithms - Planar face creation problem"
puts "============="
brestore [locate_data_file bug33156_face.brep] Face
explode Face W
#Face_1
mkplane result Face_1 1

88
tests/v3d/bugs/bug32752 Normal file
View File

@@ -0,0 +1,88 @@
puts "========"
puts "0032752: Visualization, TKOpenGl - extend V3d_View::ToPixMap() options with Z-layer"
puts "========"
puts ""
pload MODELING VISUALIZATION
vclear
vinit
box b1 20 0 0 10 10 10
box b2 -20 0 0 10 10 10
box b3 0 -10 0 5 5 5
box b4 0 5 0 5 5 5
box b5 0 0 5 3 3 3
box b6 0 0 -5 7 7 7
box b7 0 -5 -10 3 3 3
set aLayerId1 [vzlayer -add -enable depthTest -enable depthWrite -disable depthClear]
set aLayerId2 [vzlayer -add -enable depthTest -enable depthWrite -disable depthClear]
vdisplay -dispmode 1 -layer ${aLayerId1} b1
vdisplay -dispmode 1 -layer ${aLayerId2} b2
vdisplay -dispmode 1 -layer 0 b3
vdisplay -dispmode 1 -layer -2 b4
vdisplay -dispmode 1 -layer -3 b5
vdisplay -dispmode 1 -layer -4 b6
vdisplay -dispmode 1 -layer -5 b7
vfit
vviewparams -scale 15.0 -proj 0.57735 -0.57735 0.57735 -up -0.1 0.1 0.1 -at 0.0 0.0 0.0
vsetcolor b1 RED3
vsetcolor b2 GREEN3
vsetcolor b3 BLUE3
vsetcolor b4 ORANGE3
vsetcolor b5 YELLOW3
vsetcolor b6 SALMON3
vsetcolor b7 PURPLE3
#dump entire scene
#color
vdump $imagedir/${casename}_all.png
#depth
vdump $imagedir/${casename}_depth.png -buffer depth
#dump single layer
vdump $imagedir/${casename}_only_b1.png -singlelayer ${aLayerId1}
vdump $imagedir/${casename}_only_b2.png -singlelayer ${aLayerId2}
vdump $imagedir/${casename}_only_b3.png -singlelayer 0
vdump $imagedir/${casename}_only_b4.png -singlelayer -2
vdump $imagedir/${casename}_only_b5.png -singlelayer -3
vdump $imagedir/${casename}_only_b6.png -singlelayer -4
vdump $imagedir/${casename}_only_b7.png -singlelayer -5
#dump a group of layers
vdump $imagedir/${casename}_upto_b1.png -grouplayer ${aLayerId1}
vdump $imagedir/${casename}_upto_b2.png -grouplayer ${aLayerId2}
vdump $imagedir/${casename}_upto_b3.png -grouplayer 0
vdump $imagedir/${casename}_upto_b4.png -grouplayer -2
vdump $imagedir/${casename}_upto_b5.png -grouplayer -3
vdump $imagedir/${casename}_upto_b6.png -grouplayer -4
vdump $imagedir/${casename}_upto_b7.png -grouplayer -5
#dump single layer depth values
vdump $imagedir/${casename}_only_b1_depth.png -buffer depth -singlelayer ${aLayerId1}
vdump $imagedir/${casename}_only_b2_depth.png -buffer depth -singlelayer ${aLayerId2}
vdump $imagedir/${casename}_only_b3_depth.png -buffer depth -singlelayer 0
vdump $imagedir/${casename}_only_b4_depth.png -buffer depth -singlelayer -2
vdump $imagedir/${casename}_only_b5_depth.png -buffer depth -singlelayer -3
vdump $imagedir/${casename}_only_b6_depth.png -buffer depth -singlelayer -4
vdump $imagedir/${casename}_only_b7_depth.png -buffer depth -singlelayer -5
#dump a group of layers depth values
vdump $imagedir/${casename}_upto_b1_depth.png -buffer depth -grouplayer ${aLayerId1}
vdump $imagedir/${casename}_upto_b2_depth.png -buffer depth -grouplayer ${aLayerId2}
vdump $imagedir/${casename}_upto_b3_depth.png -buffer depth -grouplayer 0
vdump $imagedir/${casename}_upto_b4_depth.png -buffer depth -grouplayer -2
vdump $imagedir/${casename}_upto_b5_depth.png -buffer depth -grouplayer -3
vdump $imagedir/${casename}_upto_b6_depth.png -buffer depth -grouplayer -4
vdump $imagedir/${casename}_upto_b7_depth.png -buffer depth -grouplayer -5
#dump shadow maps
vlight -clear
vlight v1 -type directional -intensity 1 -dir -1 0 -0.5 -castShadows 1
vlight v2 -type directional -intensity 1 -dir -1 0.1 0 -castShadows 1
#dump scene
vdump $imagedir/${casename}_newlights.png
#dump shadowmaps
vdump $imagedir/${casename}_shadowmap_v1.png -buffer shadowmap v1
vdump $imagedir/${casename}_shadowmap_v2.png -buffer shadowmap v2

View File

@@ -0,0 +1,53 @@
puts "========"
puts "0033514: Visualization - Scaled view twists zoom persistence objects"
puts "========"
puts ""
pload MODELING VISUALIZATION
vinit
box b 10 10 10
vdisplay b
vfit
vsetdispmode 1
vmanipulator vm -attach b
vscale 1 3 10
vviewparams -scale 6.28866 -proj 0.57735 -0.57735 0.57735 -up -0.408248 0.408248 0.816497 -at 0 10 30
set color_1 [vreadpixel 235 170 -rgb -name]
set color_2 [vreadpixel 223 155 -rgb -name]
set color_3 [vreadpixel 235 155 -rgb -name]
if {$color_1 != "RED3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: RED3"
puts " current color is: $color_1"
}
if {$color_2 != "BLUE3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: BLUE3"
puts " current color is: $color_2"
}
if {$color_3 != "GREEN3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: GREEN3"
puts " current color is: $color_3"
}
vdump $imagedir/${casename}.png
vclear
box b 10 10 10
vdisplay b
vfit
vsetdispmode 1
vmanipulator vm -attach b -zoomable 1
vscale 1 3 10
vviewparams -scale 4.28866 -proj 0.57735 -0.57735 0.57735 -up -0.408248 0.408248 0.816497 -at 0 10 30
vdump $imagedir/${casename}_zoomable.png

View File

@@ -0,0 +1,46 @@
puts "========"
puts "0027832: Visualization - Scaled zbuffer trihedron"
puts "========"
puts ""
pload MODELING VISUALIZATION
vinit
box b 10 10 10
vdisplay b
vfit
vsetdispmode 1
vzbufftrihedron -on
#draw initial picture of box without visual scale
vdump $imagedir/${casename}_unscaled.png
#draw picture of box after visual scale
#and zoomed out
vscale 1 3 10
vzoom 1.0
set color_1 [vreadpixel 55 360 -rgb -name]
set color_2 [vreadpixel 50 350 -rgb -name]
set color_3 [vreadpixel 55 355 -rgb -name]
if {$color_1 != "RED3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: RED3"
puts " current color is: $color_1"
}
if {$color_2 != "BLUE3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: BLUE3"
puts " current color is: $color_2"
}
if {$color_3 != "GREEN3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: GREEN3"
puts " current color is: $color_3"
}
vdump $imagedir/${casename}_scaled.png

View File

@@ -0,0 +1,51 @@
puts "============="
puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation"
puts "============="
pload MODELING VISUALIZATION
vclear
vinit
vselprops dynHighlight -dispMode 1 -color WHITE
# compare boxes displayed with 2d transform persistence
# with the same properties (zlayer, depth and priority)
box box_1 75 -250 0 200 200 200
box box_2 175 -300 0 200 200 200
vdisplay box_1 -2d topLeft -top -dispmode 1
vsetmaterial box_1 PLASTIC
vsetcolor box_1 DEEPPINK2
vdisplay box_2 -2d topLeft -top -dispmode 1
vsetmaterial box_2 PLASTIC
vsetcolor box_2 PALEGREEN2
# verify colors
if { [vreadpixel 205 170 rgb name] != "DARKSEAGREEN4" } { puts "Error: selected pixel should be green." }
if { [vreadpixel 150 170 rgb name] != "MAROON" } { puts "Error: selected pixel should be maroon." }
vmoveto 205 170
if { [vreadpixel 205 170 rgb name] != "WHITE" } { puts "Error: box_1 should be highlighted" }
# dump image
vdump $imagedir/${casename}_boxes_undefined.png
# modify display priority and test selection based on display priority
# Set box_1 with higher priority
vmoveto 0 0
vpriority -update box_1 5
vpriority -update box_2 4
# test if box_1 is selected by moving mouse close to
# edge close to box_2
vmoveto 270 170
if { [vreadpixel 100 170 rgb name] != "WHITE" } { puts "Error: box_1 should be highlighted" }
vdump $imagedir/${casename}_highlight_box1.png
vmoveto 280 170
if { [vreadpixel 350 170 rgb name] != "WHITE" } { puts "Error: box_2 should be highlighted" }
vdump $imagedir/${casename}_highlight_box2.png
# modify selection priority and test selection based on selection priority
# Set box_2 with higher priority
vmoveto 0 0
vselectpriority box_1 4
vselectpriority box_2 5
vmoveto 180 170
if { [vreadpixel 350 170 rgb name] != "WHITE" } { puts "Error: box_2 should be highlighted" }
vdump $imagedir/${casename}_highlight_box1.png
vmoveto 170 170
if { [vreadpixel 100 170 rgb name] != "WHITE" } { puts "Error: box_1 should be highlighted" }
vdump $imagedir/${casename}_highlight_box2.png

View File

@@ -0,0 +1,121 @@
puts "============="
puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation"
puts "============="
pload MODELING VISUALIZATION
vclear
vinit
vselprops dynHighlight -dispMode 1 -color WHITE
# Compare behaviour in a scene with a quad (2 triangles)
# 4 segments on the edges and a circle on the center
vpoint pt1 75 -250 0
vpoint pt2 275 -250 0
vpoint pt3 275 -50 0
vpoint pt4 75 -50 0
vtriangle tri1 pt1 pt2 pt3
vtriangle tri2 pt3 pt4 pt1
vdisplay tri1 -2d topLeft -top -dispmode 1
vdisplay tri2 -2d topLeft -top -dispmode 1
vsetmaterial tri1 PLASTIC
vsetcolor tri1 ORANGE
vsetmaterial tri2 PLASTIC
vsetcolor tri2 ORANGE
vremove pt1 pt2 pt3 pt4
vaspects -update tri1 -faceBoundaryDraw 1
vaspects -update tri2 -faceBoundaryDraw 1
vdrawparray seg1 segments v 76 -249 0 c 1 0 0 v 274 -249 0 c 1 0 0
vdrawparray seg2 segments v 274 -249 0 c 1 0 0 v 274 -51 0 c 1 0 0
vdrawparray seg3 segments v 274 -51 0 c 1 0 0 v 76 -51 0 c 1 0 0
vdrawparray seg4 segments v 76 -51 0 c 1 0 0 v 76 -249 0 c 1 0 0
vdisplay seg1 -2d topLeft -top -dispmode 1
vdisplay seg2 -2d topLeft -top -dispmode 1
vdisplay seg3 -2d topLeft -top -dispmode 1
vdisplay seg4 -2d topLeft -top -dispmode 1
vsetmaterial seg1 PLASTIC
vsetmaterial seg2 PLASTIC
vsetmaterial seg3 PLASTIC
vsetmaterial seg4 PLASTIC
vsetcolor seg1 RED
vsetcolor seg2 RED
vsetcolor seg3 RED
vsetcolor seg4 RED
vpoint pr1 170 -145 0
vpoint pr2 180 -145 0
vpoint pr3 180 -155 0
vcircle circle1 pr1 pr2 pr3 1
vdisplay circle1 -2d topLeft -top
vsetmaterial circle1 PLASTIC
vsetcolor circle1 BROWN3
vremove pr1 pr2 pr3
vaspects -update circle1 -faceBoundaryDraw 1
# dump image
vdump $imagedir/${casename}_quad_segments_circle.png
# test selection with undefined behaviour
vmoveto 75 150
if { [vreadpixel 75 100 rgb name] != "WHITE" } { puts "Error: segment should be highlighted" }
vdump $imagedir/${casename}_undefined_segmenthighlight.png
vmoveto 100 150
if { [vreadpixel 100 100 rgb name] != "WHITE" } { puts "Error: tri2 should be highlighted" }
vdump $imagedir/${casename}_undefined_tri2highlight.png
vmoveto 200 150
if { [vreadpixel 200 200 rgb name] != "WHITE" } { puts "Error: tri1 should be highlighted" }
vdump $imagedir/${casename}_undefined_tri1highlight.png
vmoveto 175 150
vdump $imagedir/${casename}_undefined_circle.png
# change selection priority for each element and
# test selection priority focused selection
vselectpriority tri1 6
vselectpriority tri2 6
vselectpriority seg1 4
vselectpriority seg2 4
vselectpriority seg3 4
vselectpriority seg4 4
vselectpriority circle1 4
vmoveto 175 150
if { [vreadpixel 200 200 rgb name] != "WHITE" } { puts "Error: tri1 should be highlighted" }
# show image with display priority focused
vdump $imagedir/${casename}_quad_focused1.png
vmoveto 170 140
if { [vreadpixel 100 100 rgb name] != "WHITE" } { puts "Error: tri2 should be highlighted" }
# show image with display priority focused
vdump $imagedir/${casename}_quad_focused2.png
# test priority selection for circle
vmoveto 0 0
vselectpriority tri1 4
vselectpriority tri2 4
vselectpriority seg1 4
vselectpriority seg2 4
vselectpriority seg3 4
vselectpriority seg4 4
vselectpriority circle1 6
# show image with priority focused
vdump $imagedir/${casename}_circle_focused.png
vmoveto 175 150
vselect
# show image with priority focused
vdump $imagedir/${casename}_circle_selected.png
# test priority selection for segments
vmoveto 0 0
vselect
vselectpriority tri1 4
vselectpriority tri2 4
vselectpriority seg1 6
vselectpriority seg2 6
vselectpriority seg3 6
vselectpriority seg4 6
vselectpriority circle1 4
vmoveto 175 250
vdump $imagedir/${casename}_segment1_focused.png
vmoveto 276 150
vdump $imagedir/${casename}_segment2_focused.png
vmoveto 175 49
vdump $imagedir/${casename}_segment3_focused.png
vmoveto 75 150
vdump $imagedir/${casename}_segment4_focused.png

View File

@@ -0,0 +1,54 @@
puts "============="
puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation"
puts "============="
pload MODELING VISUALIZATION
vclear
vinit
vselprops dynHighlight -dispMode 1 -color WHITE
# Compare behaviour in a scene with a quad (2 triangles)
# and a point in the center
vpoint pt1 75 -250 0
vpoint pt2 275 -250 0
vpoint pt3 275 -50 0
vpoint pt4 75 -50 0
vtriangle tri1 pt1 pt2 pt3
vtriangle tri2 pt3 pt4 pt1
vdisplay tri1 -2d topLeft -top -dispmode 1
vdisplay tri2 -2d topLeft -top -dispmode 1
vsetmaterial tri1 PLASTIC
vsetcolor tri1 ORANGE
vsetmaterial tri2 PLASTIC
vsetcolor tri2 ORANGE
vremove pt1 pt2 pt3 pt4
vaspects -update tri1 -faceBoundaryDraw 1
vaspects -update tri2 -faceBoundaryDraw 1
vpoint p1 175 150 -2d
vdisplay p1 -2d topLeft -top -dispmode 1
# dump image
vdump $imagedir/${casename}_quad_point_undefined.png
vmoveto 175 150
if { [vreadpixel 175 150 rgb name] != "CYAN" } { puts "Error: point should be highlighted" }
vdump $imagedir/${casename}_quad_point_onpoint.png
vmoveto 150 100
vdump $imagedir/${casename}_quad_point_ontri2.png
vmoveto 200 200
vdump $imagedir/${casename}_quad_point_ontri1.png
# test selection priority
vmoveto 0 0
vpriority -update tri1 4
vpriority -update tri2 4
vpriority -update p1 4
vselectpriority tri1 6
vselectpriority tri2 6
vselectpriority p1 5
vmoveto 175 150
if { [vreadpixel 175 150 rgb name] == "CYAN" } { puts "Error: point should not be highlighted" }
vdump $imagedir/${casename}_quad_point_changedpriorityfocus.png
vmoveto 0 0
vselectpriority p1 4
vmoveto 175 150
vdump $imagedir/${casename}_quad_point_reducedpointpriority.png

View File

@@ -0,0 +1,37 @@
puts "============="
puts "0030484: Visualization - 2d persistent: order of detection doesn't coincide with order of objects creation"
puts "============="
pload MODELING VISUALIZATION
vclear
vinit
vselprops dynHighlight -dispMode 1 -color WHITE
# Compare behaviour in a scene with two quads
# 1 from a box and another from primitive array
# quad primitive array only highlights in the corners
box box_1 75 -250 0 200 200 200
vdisplay box_1 -2d topLeft -top -dispmode 1
vsetmaterial box_1 PLASTIC
vsetcolor box_1 DEEPPINK2
vdrawparray quad1 quads v 175 -300 0 c 0 0 1 v 375 -300 0 c 0 0 1 v 375 -100 0 c 0 0 1 v 175 -100 0 c 0 0 1
vdisplay quad1 -2d topLeft -top -dispmode 1
vsetmaterial quad1 PLASTIC
vsetcolor quad1 PALEGREEN2
# dump image
vdump $imagedir/${casename}_box_quad_undefined.png
vmoveto 100 100
vdump $imagedir/${casename}_box_quad_boxhighlight.png
vmoveto 376 100
vdump $imagedir/${casename}_box_quad_quadhighlight.png
#test selection priority
vmoveto 0 0
vpriority -update box_1 6
vpriority -update quad1 5
vselectpriority box_1 5
vselectpriority quad1 6
vmoveto 175 99
if { [vreadpixel 300 200 rgb name] != "WHITE" } { puts "Error: quad primitive should be highlighted" }
vdump $imagedir/${casename}_box_quad_selectionpriority_focused.png

View File

@@ -0,0 +1,44 @@
puts "========"
puts "0032750: Visualization, AIS_Manipulator - selection of moved object is broken"
puts "========"
puts ""
#load modules
pload MODELING VISUALIZATION
vinit
#create box and attach manipulator
box b 100 100 100
vdisplay b
vsetdispmode 1
vaspects -shadingModel unlit
vfront
vfit
vzoom 0.5
vmanipulator m -attach b
#set mouse coordinates for actions
set mouse_pick {205 155}
set mouse_drag1 {205 55}
set mouse_pick2 {250 10}
set mouse_pick3 {250 200}
#NOTE: issue not reproducible by draw command
#but similar action with mouse would show issue
#set mouse action
vmoveto {*}$mouse_pick
vselect {*}$mouse_pick
vmanipulator m -startTransform {*}$mouse_pick
vmanipulator m -transform {*}$mouse_drag1
vmanipulator m -stopTransform
vselect 0 0
#check if object is selected
vremove m
vmoveto 0 0
vdump $imagedir/${casename}_unselected.png
vmoveto {*}$mouse_pick2
vdump $imagedir/${casename}_selectTop.png
vmoveto {*}$mouse_pick3
vdump $imagedir/${casename}_selectBot.png