thePreviousView->Convert (theX1, theY1, aU1, aV1);
thePreviousView->Convert (theX2, theY2, aU2, aV2);
myView->SetWindow (theWindow);
- FitAll (theWindow, aU1, aV1, aU2, aV2);
+ FitAll (aU1, aV1, aU2, aV2);
MyViewer->SetViewOn (this);
MyWindow = theWindow;
SetRatio();
return;
}
- myView->Update (Aspect_TOU_ASAP);
+ myView->Update();
+ myView->Compute();
+ myView->Redraw();
}
//=============================================================================
}
}
-//=============================================================================
-//function : SetBackgroundColor
-//purpose :
-//=============================================================================
-void V3d_View::SetBackgroundColor (const Quantity_NameOfColor theName)
-{
- SetBackgroundColor (Quantity_Color (theName));
-}
-
//=============================================================================
//function : SetBgGradientColors
//purpose :
}
}
-//=============================================================================
-//function : SetBgGradientColors
-//purpose :
-//=============================================================================
-void V3d_View::SetBgGradientColors (const Quantity_NameOfColor theColor1,
- const Quantity_NameOfColor theColor2,
- const Aspect_GradientFillMethod theFillStyle,
- const Standard_Boolean theToUpdate)
-{
- Quantity_Color aColor1 (theColor1);
- Quantity_Color aColor2 (theColor2);
-
- SetBgGradientColors (aColor1, aColor2, theFillStyle, theToUpdate);
-}
-
//=============================================================================
//function : SetBgGradientStyle
//purpose :
//function : SetZoom
//purpose :
//=============================================================================
-void V3d_View::SetZoom(const Standard_Real Coef,const Standard_Boolean Start)
+void V3d_View::SetZoom (const Standard_Real theCoef,const Standard_Boolean theToStart)
{
- V3d_BadValue_Raise_if( Coef <= 0.,"V3d_View::SetZoom, bad coefficient");
+ V3d_BadValue_Raise_if (theCoef <= 0., "V3d_View::SetZoom, bad coefficient");
Handle(Graphic3d_Camera) aCamera = Camera();
- if (Start)
+ if (theToStart)
{
myCamStartOpEye = aCamera->Eye();
myCamStartOpCenter = aCamera->Center();
Standard_Real aViewHeight = aCamera->ViewDimensions().Y();
// ensure that zoom will not be too small or too big
- Standard_Real coef = Coef;
- if (aViewWidth < coef * Precision::Confusion())
+ Standard_Real aCoef = theCoef;
+ if (aViewWidth < aCoef * Precision::Confusion())
{
- coef = aViewWidth / Precision::Confusion();
+ aCoef = aViewWidth / Precision::Confusion();
}
- else if (aViewWidth > coef * 1e12)
+ else if (aViewWidth > aCoef * 1e12)
{
- coef = aViewWidth / 1e12;
+ aCoef = aViewWidth / 1e12;
}
- if (aViewHeight < coef * Precision::Confusion())
+ if (aViewHeight < aCoef * Precision::Confusion())
{
- coef = aViewHeight / Precision::Confusion();
+ aCoef = aViewHeight / Precision::Confusion();
}
- else if (aViewHeight > coef * 1e12)
+ else if (aViewHeight > aCoef * 1e12)
{
- coef = aViewHeight / 1e12;
+ aCoef = aViewHeight / 1e12;
}
aCamera->SetEye (myCamStartOpEye);
aCamera->SetCenter (myCamStartOpCenter);
- aCamera->SetScale (aCamera->Scale() / Coef);
+ aCamera->SetScale (aCamera->Scale() / aCoef);
AutoZFit();
ImmediateUpdate();
}
-//=============================================================================
-//function : FitAll
-//purpose :
-//=============================================================================
-void V3d_View::FitAll(const Standard_Real theMinXv,
- const Standard_Real theMinYv,
- const Standard_Real theMaxXv,
- const Standard_Real theMaxYv)
-{
- FitAll (MyWindow, theMinXv, theMinYv, theMaxXv, theMaxYv);
-}
-
//=============================================================================
//function : WindowFitAll
//purpose :
continue;
}
- const Graphic3d_BndBox4f& aBox = aStruct->CStructure()->BoundingBox();
+ const Graphic3d_BndBox3d& aBox = aStruct->CStructure()->BoundingBox();
if (!aBox.IsValid())
{
continue;
}
// use camera projection to find gravity point
- Xmin = (Standard_Real )aBox.CornerMin().x();
- Ymin = (Standard_Real )aBox.CornerMin().y();
- Zmin = (Standard_Real )aBox.CornerMin().z();
- Xmax = (Standard_Real )aBox.CornerMax().x();
- Ymax = (Standard_Real )aBox.CornerMax().y();
- Zmax = (Standard_Real )aBox.CornerMax().z();
+ Xmin = aBox.CornerMin().x();
+ Ymin = aBox.CornerMin().y();
+ Zmin = aBox.CornerMin().z();
+ Xmax = aBox.CornerMax().x();
+ Ymax = aBox.CornerMax().y();
+ Zmax = aBox.CornerMax().z();
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
{
gp_Pnt (Xmin, Ymin, Zmin), gp_Pnt (Xmin, Ymin, Zmax),
//function : FitAll
//purpose :
//=============================================================================
-void V3d_View::FitAll(const Handle(Aspect_Window)& aWindow,
- const Standard_Real Xmin,
- const Standard_Real Ymin,
- const Standard_Real Xmax,
- const Standard_Real Ymax)
+void V3d_View::FitAll(const Standard_Real theXmin,
+ const Standard_Real theYmin,
+ const Standard_Real theXmax,
+ const Standard_Real theYmax)
{
- Standard_Integer aWinWidth, aWinHeight;
- aWindow->Size (aWinWidth, aWinHeight);
+ Handle(Graphic3d_Camera) aCamera = Camera();
+ Standard_Real anAspect = aCamera->Aspect();
- Standard_Real aWinAspect = (Standard_Real)aWinWidth / aWinHeight;
- Standard_Real aFitSizeU = Abs (Xmax - Xmin);
- Standard_Real aFitSizeV = Abs (Ymax - Ymin);
+ Standard_Real aFitSizeU = Abs (theXmax - theXmin);
+ Standard_Real aFitSizeV = Abs (theYmax - theYmin);
Standard_Real aFitAspect = aFitSizeU / aFitSizeV;
- if (aFitAspect >= aWinAspect)
+ if (aFitAspect >= anAspect)
{
- aFitSizeV = aFitSizeU / aWinAspect;
+ aFitSizeV = aFitSizeU / anAspect;
}
else
{
- aFitSizeU = aFitSizeV * aWinAspect;
+ aFitSizeU = aFitSizeV * anAspect;
}
- Handle(Graphic3d_Camera) aCamera = Camera();
-
- aCamera->SetAspect (aWinAspect);
- Translate (aCamera, (Xmin + Xmax) * 0.5, (Ymin + Ymax) * 0.5);
+ Translate (aCamera, (theXmin + theXmax) * 0.5, (theYmin + theYmax) * 0.5);
Scale (aCamera, aFitSizeU, aFitSizeV);
AutoZFit();
|| theImage.SizeX() != Standard_Size(aTargetSize.x())
|| theImage.SizeY() != Standard_Size(aTargetSize.y()))
{
- const bool isBigEndian = Image_PixMap::IsBigEndianHost();
- Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgUNKNOWN;
+ Image_Format aFormat = Image_Format_UNKNOWN;
switch (theParams.BufferType)
{
- case Graphic3d_BT_RGB: aFormat = isBigEndian ? Image_PixMap::ImgRGB : Image_PixMap::ImgBGR; break;
- case Graphic3d_BT_RGBA: aFormat = isBigEndian ? Image_PixMap::ImgRGBA : Image_PixMap::ImgBGRA; break;
- case Graphic3d_BT_Depth: aFormat = Image_PixMap::ImgGrayF; break;
+ case Graphic3d_BT_RGB: aFormat = Image_Format_RGB; break;
+ case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break;
+ case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
+ case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break;
}
if (!theImage.InitZero (aFormat, Standard_Size(aTargetSize.x()), Standard_Size(aTargetSize.y())))
{
myView->DiagnosticInformation (theDict, theFlags);
}
+
+//=============================================================================
+//function : RenderingParams
+//purpose :
+//=============================================================================
+const Graphic3d_RenderingParams& V3d_View::RenderingParams() const
+{
+ return myView->RenderingParams();
+}
+
+//=============================================================================
+//function : ChangeRenderingParams
+//purpose :
+//=============================================================================
+Graphic3d_RenderingParams& V3d_View::ChangeRenderingParams()
+{
+ return myView->ChangeRenderingParams();
+}