mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9339c7e335 |
@@ -331,6 +331,15 @@ void AIS_Manipulator::EnableMode(const AIS_ManipulatorMode theMode)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void AIS_Manipulator::attachToPoint(const gp_Pnt& thePoint)
|
||||
{
|
||||
gp_Ax2 aPosition = gp::XOY();
|
||||
aPosition.SetLocation(thePoint);
|
||||
SetPosition(aPosition);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void AIS_Manipulator::attachToBox(const Bnd_Box& theBox)
|
||||
{
|
||||
if (theBox.IsVoid())
|
||||
@@ -392,7 +401,15 @@ void AIS_Manipulator::Attach(const Handle(AIS_ManipulatorObjectSequence)& theObj
|
||||
|
||||
if (theOptions.AdjustPosition)
|
||||
{
|
||||
attachToBox(aBox);
|
||||
const Handle(Graphic3d_TransformPers)& aTransPers = aCurObject->TransformPersistence();
|
||||
if (!aTransPers.IsNull() && (aTransPers->IsZoomOrRotate() || aTransPers->IsAxial()))
|
||||
{
|
||||
attachToPoint(aTransPers->AnchorPoint());
|
||||
}
|
||||
else
|
||||
{
|
||||
attachToBox(aBox);
|
||||
}
|
||||
}
|
||||
|
||||
if (theOptions.AdjustSize)
|
||||
@@ -746,9 +763,18 @@ void AIS_Manipulator::Transform(const gp_Trsf& theTrsf)
|
||||
NCollection_Sequence<gp_Trsf>::Iterator aTrsfIter(myStartTrsfs);
|
||||
for (; anObjIter.More(); anObjIter.Next(), aTrsfIter.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObj = anObjIter.ChangeValue();
|
||||
const gp_Trsf& anOldTrsf = aTrsfIter.Value();
|
||||
const Handle(TopLoc_Datum3D)& aParentTrsf = anObj->CombinedParentTransformation();
|
||||
const Handle(AIS_InteractiveObject)& anObj = anObjIter.ChangeValue();
|
||||
const Handle(Graphic3d_TransformPers)& aTransPers = anObj->TransformPersistence();
|
||||
if (!aTransPers.IsNull() && (aTransPers->IsZoomOrRotate() || aTransPers->IsAxial()))
|
||||
{
|
||||
gp_XYZ aNewAnchorPoint = aTransPers->AnchorPoint().XYZ() - myPosition.Location().XYZ();
|
||||
aNewAnchorPoint += myStartPosition.Location().Transformed(theTrsf).XYZ();
|
||||
aTransPers->SetAnchorPoint(aNewAnchorPoint);
|
||||
continue;
|
||||
}
|
||||
|
||||
const gp_Trsf& anOldTrsf = aTrsfIter.Value();
|
||||
const Handle(TopLoc_Datum3D)& aParentTrsf = anObj->CombinedParentTransformation();
|
||||
if (!aParentTrsf.IsNull() && aParentTrsf->Form() != gp_Identity)
|
||||
{
|
||||
// recompute local transformation relative to parent transformation
|
||||
|
@@ -416,6 +416,8 @@ protected:
|
||||
Standard_EXPORT Handle(Graphic3d_Group) getGroup(const Standard_Integer theIndex,
|
||||
const AIS_ManipulatorMode theMode) const;
|
||||
|
||||
Standard_EXPORT void attachToPoint(const gp_Pnt& thePoint);
|
||||
|
||||
Standard_EXPORT void attachToBox(const Bnd_Box& theBox);
|
||||
|
||||
Standard_EXPORT void adjustSize(const Bnd_Box& theBox);
|
||||
|
@@ -89,12 +89,6 @@ public:
|
||||
//! Sets camera used by the view.
|
||||
virtual void SetCamera(const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
|
||||
|
||||
//! Returns necessity to flip OY in projection matrix
|
||||
virtual Standard_Boolean ToFlipOutput() const { return Standard_False; }
|
||||
|
||||
//! Sets state of flip OY necessity in projection matrix
|
||||
virtual void SetToFlipOutput(const Standard_Boolean) {}
|
||||
|
||||
public:
|
||||
//! Returns default Shading Model of the view; Graphic3d_TypeOfShadingModel_Phong by default.
|
||||
Graphic3d_TypeOfShadingModel ShadingModel() const { return myRenderParams.ShadingModel; }
|
||||
|
@@ -340,15 +340,6 @@ public: //! @name obsolete Graduated Trihedron functionality
|
||||
const Graphic3d_Vec3 theMax)
|
||||
Standard_OVERRIDE;
|
||||
|
||||
//! Returns necessity to flip OY in projection matrix
|
||||
virtual Standard_Boolean ToFlipOutput() const Standard_OVERRIDE { return myToFlipOutput; }
|
||||
|
||||
//! Sets state of flip OY necessity in projection matrix
|
||||
virtual void SetToFlipOutput(const Standard_Boolean theFlip) Standard_OVERRIDE
|
||||
{
|
||||
myToFlipOutput = theFlip;
|
||||
}
|
||||
|
||||
protected: //! @name Internal methods for managing GL resources
|
||||
//! Initializes OpenGl resource for environment texture.
|
||||
void initTextureEnv(const Handle(OpenGl_Context)& theContext);
|
||||
|
@@ -11027,20 +11027,6 @@ static Standard_Integer VRenderParams(Draw_Interpretor& theDI,
|
||||
++anArgIter;
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-flip")
|
||||
{
|
||||
if (toPrint)
|
||||
{
|
||||
theDI << (aView->View()->ToFlipOutput() ? "on " : "off ");
|
||||
continue;
|
||||
}
|
||||
Standard_Boolean isToFlipOutput = Standard_False;
|
||||
if (anArgIter + 1 < theArgNb && Draw::ParseOnOff(theArgVec[anArgIter + 1], isToFlipOutput))
|
||||
{
|
||||
aView->View()->SetToFlipOutput(isToFlipOutput);
|
||||
++anArgIter;
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-rendscale" || aFlag == "-renderscale" || aFlag == "-renderresolutionscale")
|
||||
{
|
||||
if (toPrint)
|
||||
@@ -12097,7 +12083,8 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
||||
NCollection_Sequence<ManipAxisModeOnOff> aParts;
|
||||
gp_XYZ aLocation(RealLast(), RealLast(), RealLast()), aVDir, anXDir;
|
||||
//
|
||||
bool toDetach = false;
|
||||
bool toDetach = false;
|
||||
bool toAddObject = false;
|
||||
AIS_Manipulator::OptionsForAttach anAttachOptions;
|
||||
Handle(AIS_InteractiveObject) anAttachObject;
|
||||
Handle(V3d_View) aViewAffinity;
|
||||
@@ -12287,6 +12274,10 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
||||
aTrsf.SetRotation(gp_Ax1(gp_Pnt(aRotPnt), gp_Dir(aRotAxis)), aTmpReal);
|
||||
}
|
||||
//
|
||||
else if (anArg == "-addobject")
|
||||
{
|
||||
toAddObject = true;
|
||||
}
|
||||
else if (anArg == "-detach")
|
||||
{
|
||||
toDetach = true;
|
||||
@@ -12444,7 +12435,16 @@ static int VManipulator(Draw_Interpretor& theDi, Standard_Integer theArgsNb, con
|
||||
|
||||
if (!anAttachObject.IsNull())
|
||||
{
|
||||
aManipulator->Attach(anAttachObject, anAttachOptions);
|
||||
if (toAddObject && aManipulator->IsAttached())
|
||||
{
|
||||
Handle(AIS_ManipulatorObjectSequence) anAttachObjects = aManipulator->Objects();
|
||||
anAttachObjects->Append(anAttachObject);
|
||||
aManipulator->Attach(anAttachObjects, anAttachOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
aManipulator->Attach(anAttachObject, anAttachOptions);
|
||||
}
|
||||
}
|
||||
if (!aViewAffinity.IsNull())
|
||||
{
|
||||
@@ -14396,7 +14396,7 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
|
||||
[-shadows {on|off}=on] [-shadowMapResolution value=1024] [-shadowMapBias value=0.005]
|
||||
[-depthPrePass {on|off}=off] [-alphaToCoverage {on|off}=on]
|
||||
[-frustumCulling {on|off|noupdate}=on] [-lineFeather width=1.0]
|
||||
[-sync {default|views}] [-reset] [-flip {on|off}=off]
|
||||
[-sync {default|views}] [-reset]
|
||||
-raster Disables GPU ray-tracing.
|
||||
-shadingModel Controls shading model.
|
||||
-msaa Specifies number of samples for MSAA.
|
||||
@@ -14418,7 +14418,6 @@ vrenderparams [-raster] [-shadingModel {unlit|facet|gouraud|phong|pbr|pbr_facet}
|
||||
sets state to check structures culled previously.
|
||||
-sync Sets active View parameters as Viewer defaults / to other Views.
|
||||
-reset Resets active View parameters to Viewer defaults.
|
||||
-flip Flips View Vertically.
|
||||
|
||||
Diagnostic output (on-screen overlay):
|
||||
vrenderparams [-perfCounters none|fps|cpu|layers|structures|groups|arrays|triangles|points
|
||||
@@ -14505,6 +14504,7 @@ Options:
|
||||
'-enableModes {0|1}' enable modes when attaching
|
||||
'-view {active | [name of view]}' display manipulator only in defined view,
|
||||
by default it is displayed in all views of the current viewer
|
||||
'-addObject allows attach manipulator to multiple objects (replace by default)
|
||||
'-detach' detach manipulator
|
||||
'-startTransform mouse_x mouse_y' - invoke start of transformation
|
||||
'-transform mouse_x mouse_y' - invoke transformation
|
||||
|
41
tests/v3d/bugs/bug32116
Normal file
41
tests/v3d/bugs/bug32116
Normal file
@@ -0,0 +1,41 @@
|
||||
puts "============"
|
||||
puts "0032116: Visualization - AIS_Manipulator is unusable when attaching to objects with Graphic3d_TMF_ZoomPers"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
box b1 10 10 10 10 20 30
|
||||
box b2 50 50 50 10 20 30
|
||||
|
||||
vinit View1
|
||||
vdisplay b1 -dispmode 1 -trsfPers zoom -trsfPersPos 0 0 0
|
||||
vdisplay b2 -dispmode 1 -trsfPers zoom -trsfPersPos 10 10 10
|
||||
vfit
|
||||
|
||||
vmanipulator m -attach b1 -addObject
|
||||
vmanipulator m -attach b2 -addObject
|
||||
|
||||
set mouse_pick {90 225}
|
||||
set mouse_drag {90 150}
|
||||
|
||||
vmoveto {*}$mouse_pick
|
||||
vselect {*}$mouse_pick
|
||||
vmanipulator m -startTransform {*}$mouse_pick
|
||||
vmanipulator m -transform {*}$mouse_drag
|
||||
vmanipulator m -stopTransform
|
||||
vmoveto {*}$mouse_drag
|
||||
|
||||
if { [vreadpixel {*}$mouse_drag -rgb -name] != "CYAN" } { puts "Error: wrong manipulator position" }
|
||||
if { [vreadpixel 115 170 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b1 tranformation" }
|
||||
if { [vreadpixel 400 10 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b2 tranformation" }
|
||||
|
||||
vdump ${imagedir}/${casename}_1.png
|
||||
|
||||
vmoveto 0 0
|
||||
vzoom 0.2
|
||||
|
||||
if { [vreadpixel 210 170 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b1 tranformation" }
|
||||
if { [vreadpixel 310 120 -rgb -name] != "DARKGOLDENROD" } { puts "Error: wrong b2 tranformation" }
|
||||
|
||||
vdump ${imagedir}/${casename}_2.png
|
Reference in New Issue
Block a user