1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
drochalo
8910dd9f80 0025811: Visualization - Incorrect texture mapping on faces with reversed orientation
Added section in StdPrs_ShadedShape to correct UV orientation on face triangulation whose orientation is reversed.
Expanded test cases.
2024-04-08 17:02:30 +01:00
132 changed files with 615 additions and 1452 deletions

View File

@@ -50,27 +50,22 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
Standard_Real umin, umax, vmin, vmax; Standard_Real umin, umax, vmin, vmax;
S->Bounds(umin, umax, vmin, vmax); S->Bounds(umin, umax, vmin, vmax);
S->D1((umin + umax) / 2, (vmin + vmax) / 2, P, DU, DV); S->D1((umin + umax) / 2, (vmin + vmax) / 2, P, DU, DV);
// On prend DX le plus proche possible de DU
if (DU.SquareMagnitude() > gp::Resolution() && gp_Dir du(DU);
DV.SquareMagnitude() > gp::Resolution()) Standard_Real Angle1 = du.Angle(DX);
{ Standard_Real Angle2 = du.Angle(DY);
// On prend DX le plus proche possible de DU if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1;
gp_Dir du(DU); if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2;
Standard_Real Angle1 = du.Angle(DX); if (Angle2 < Angle1) {
Standard_Real Angle2 = du.Angle(DY); du = DY; DY = DX; DX = du;
if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1;
if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2;
if (Angle2 < Angle1) {
du = DY; DY = DX; DX = du;
}
if (DX.Angle(DU) > M_PI / 2) DX.Reverse();
if (DY.Angle(DV) > M_PI / 2) DY.Reverse();
gp_Ax3 axe(Bary, DX^DY, DX);
Plan.SetPosition(axe);
Plan.SetLocation(Bary);
IsPlan = Standard_True;
} }
if (DX.Angle(DU) > M_PI / 2) DX.Reverse();
if (DY.Angle(DV) > M_PI / 2) DY.Reverse();
gp_Ax3 axe(Bary, DX^DY, DX);
Plan.SetPosition(axe);
Plan.SetLocation(Bary);
IsPlan = Standard_True;
} }
return IsPlan; return IsPlan;
} }

View File

@@ -20,10 +20,10 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <StepData_Factors.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Axis1Placement; class StepGeom_Axis1Placement;
class gp_Ax1; class gp_Ax1;
class gp_Ax2d; class gp_Ax2d;
@@ -43,16 +43,16 @@ public:
Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax1& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax1& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax2d& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax2d& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom_Axis1Placement)& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom_Axis1Placement)& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom2d_AxisPlacement)& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom2d_AxisPlacement)& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis1Placement)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis1Placement)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Axis2Placement2d; class StepGeom_Axis2Placement2d;
class gp_Ax2; class gp_Ax2;
class gp_Ax22d; class gp_Ax22d;
@@ -40,10 +41,10 @@ public:
Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax2& A, Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax2& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax22d& A, Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax22d& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis2Placement2d)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis2Placement2d)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
class StepData_Factors;
class StepGeom_Axis2Placement3d; class StepGeom_Axis2Placement3d;
class gp_Ax2; class gp_Ax2;
class gp_Ax3; class gp_Ax3;
@@ -41,19 +42,19 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const StepData_Factors& theLocalFactors = StepData_Factors()); Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax2& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax2& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax3& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax3& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Trsf& T, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Trsf& T,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const Handle(Geom_Axis2Placement)& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const Handle(Geom_Axis2Placement)& A,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis2Placement3d)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis2Placement3d)& Value() const;

View File

@@ -24,6 +24,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class Geom_BSplineCurve; class Geom_BSplineCurve;
class Geom2d_BSplineCurve; class Geom2d_BSplineCurve;
class StepData_Factors;
class StepGeom_BSplineCurveWithKnots; class StepGeom_BSplineCurveWithKnots;
@@ -40,10 +41,10 @@ public:
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom_BSplineCurve)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom2d_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom2d_BSplineCurve)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnots)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnots)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve; class StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve;
class Geom_BSplineCurve; class Geom_BSplineCurve;
class Geom2d_BSplineCurve; class Geom2d_BSplineCurve;
@@ -41,10 +42,10 @@ public:
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom_BSplineCurve)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom2d_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom2d_BSplineCurve)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)& Value() const;

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineSurfaceWithKnots; class StepGeom_BSplineSurfaceWithKnots;
class Geom_BSplineSurface; class Geom_BSplineSurface;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnots(const Handle(Geom_BSplineSurface)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnots(const Handle(Geom_BSplineSurface)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnots)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnots)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface; class StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface;
class Geom_BSplineSurface; class Geom_BSplineSurface;
@@ -40,7 +41,7 @@ public:
Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface(const Handle(Geom_BSplineSurface)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface(const Handle(Geom_BSplineSurface)& Bsplin,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BoundedCurve; class StepGeom_BoundedCurve;
class Geom_BoundedCurve; class Geom_BoundedCurve;
class Geom2d_BoundedCurve; class Geom2d_BoundedCurve;
@@ -41,10 +42,10 @@ public:
Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom_BoundedCurve)& C, Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom_BoundedCurve)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom2d_BoundedCurve)& C, Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom2d_BoundedCurve)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BoundedCurve)& Value() const; Standard_EXPORT const Handle(StepGeom_BoundedCurve)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BoundedSurface; class StepGeom_BoundedSurface;
class Geom_BoundedSurface; class Geom_BoundedSurface;
@@ -40,7 +41,7 @@ public:
Standard_EXPORT GeomToStep_MakeBoundedSurface(const Handle(Geom_BoundedSurface)& C, Standard_EXPORT GeomToStep_MakeBoundedSurface(const Handle(Geom_BoundedSurface)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BoundedSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_BoundedSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Circle; class StepGeom_Circle;
class gp_Circ; class gp_Circ;
class Geom_Circle; class Geom_Circle;
@@ -41,13 +42,13 @@ public:
Standard_EXPORT GeomToStep_MakeCircle(const gp_Circ& C, Standard_EXPORT GeomToStep_MakeCircle(const gp_Circ& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom_Circle)& C, Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom_Circle)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom2d_Circle)& C, Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom2d_Circle)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Circle)& Value() const; Standard_EXPORT const Handle(StepGeom_Circle)& Value() const;

View File

@@ -25,6 +25,7 @@
class StepGeom_Conic; class StepGeom_Conic;
class Geom_Conic; class Geom_Conic;
class Geom2d_Conic; class Geom2d_Conic;
class StepData_Factors;
//! This class implements the mapping between classes //! This class implements the mapping between classes
@@ -39,10 +40,10 @@ public:
Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom_Conic)& C, Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom_Conic)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom2d_Conic)& C, Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom2d_Conic)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Conic)& Value() const; Standard_EXPORT const Handle(StepGeom_Conic)& Value() const;

View File

@@ -24,6 +24,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepGeom_ConicalSurface; class StepGeom_ConicalSurface;
class Geom_ConicalSurface; class Geom_ConicalSurface;
class StepData_Factors;
//! This class implements the mapping between class //! This class implements the mapping between class
@@ -38,7 +39,7 @@ public:
Standard_EXPORT GeomToStep_MakeConicalSurface(const Handle(Geom_ConicalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeConicalSurface(const Handle(Geom_ConicalSurface)& CSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ConicalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ConicalSurface)& Value() const;

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Curve; class StepGeom_Curve;
class Geom_Curve; class Geom_Curve;
class Geom2d_Curve; class Geom2d_Curve;
@@ -39,10 +40,10 @@ public:
Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom_Curve)& C, Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom_Curve)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom2d_Curve)& C, Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom2d_Curve)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Curve)& Value() const; Standard_EXPORT const Handle(StepGeom_Curve)& Value() const;

View File

@@ -24,6 +24,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepGeom_CylindricalSurface; class StepGeom_CylindricalSurface;
class Geom_CylindricalSurface; class Geom_CylindricalSurface;
class StepData_Factors;
//! This class implements the mapping between class //! This class implements the mapping between class
@@ -38,7 +39,7 @@ public:
Standard_EXPORT GeomToStep_MakeCylindricalSurface(const Handle(Geom_CylindricalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeCylindricalSurface(const Handle(Geom_CylindricalSurface)& CSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_CylindricalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_CylindricalSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_ElementarySurface; class StepGeom_ElementarySurface;
class Geom_ElementarySurface; class Geom_ElementarySurface;
@@ -40,7 +41,7 @@ public:
Standard_EXPORT GeomToStep_MakeElementarySurface(const Handle(Geom_ElementarySurface)& S, Standard_EXPORT GeomToStep_MakeElementarySurface(const Handle(Geom_ElementarySurface)& S,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ElementarySurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ElementarySurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Ellipse; class StepGeom_Ellipse;
class gp_Elips; class gp_Elips;
class Geom_Ellipse; class Geom_Ellipse;
@@ -41,13 +42,13 @@ public:
Standard_EXPORT GeomToStep_MakeEllipse(const gp_Elips& C, Standard_EXPORT GeomToStep_MakeEllipse(const gp_Elips& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom_Ellipse)& C, Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom_Ellipse)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom2d_Ellipse)& C, Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom2d_Ellipse)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Ellipse)& Value() const; Standard_EXPORT const Handle(StepGeom_Ellipse)& Value() const;

View File

@@ -38,10 +38,10 @@ public:
Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C, Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C, Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Hyperbola)& Value() const; Standard_EXPORT const Handle(StepGeom_Hyperbola)& Value() const;

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Line; class StepGeom_Line;
class gp_Lin; class gp_Lin;
class gp_Lin2d; class gp_Lin2d;
@@ -41,16 +42,16 @@ public:
Standard_EXPORT GeomToStep_MakeLine(const gp_Lin& L, Standard_EXPORT GeomToStep_MakeLine(const gp_Lin& L,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const gp_Lin2d& L, Standard_EXPORT GeomToStep_MakeLine(const gp_Lin2d& L,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom_Line)& C, Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom_Line)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom2d_Line)& C, Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom2d_Line)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Line)& Value() const; Standard_EXPORT const Handle(StepGeom_Line)& Value() const;

View File

@@ -25,6 +25,7 @@
class StepGeom_Parabola; class StepGeom_Parabola;
class Geom2d_Parabola; class Geom2d_Parabola;
class Geom_Parabola; class Geom_Parabola;
class StepData_Factors;
//! This class implements the mapping between the class //! This class implements the mapping between the class
@@ -38,10 +39,10 @@ public:
Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C, Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C, Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Parabola)& Value() const; Standard_EXPORT const Handle(StepGeom_Parabola)& Value() const;

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Plane; class StepGeom_Plane;
class gp_Pln; class gp_Pln;
class Geom_Plane; class Geom_Plane;
@@ -39,10 +40,10 @@ public:
Standard_EXPORT GeomToStep_MakePlane(const gp_Pln& P, Standard_EXPORT GeomToStep_MakePlane(const gp_Pln& P,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakePlane(const Handle(Geom_Plane)& P, Standard_EXPORT GeomToStep_MakePlane(const Handle(Geom_Plane)& P,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Plane)& Value() const; Standard_EXPORT const Handle(StepGeom_Plane)& Value() const;

View File

@@ -25,6 +25,7 @@
#include <TColgp_Array1OfPnt.hxx> #include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx> #include <TColgp_Array1OfPnt2d.hxx>
class StepData_Factors;
class StepGeom_Polyline; class StepGeom_Polyline;
@@ -38,10 +39,10 @@ public:
Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt& P, Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt& P,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt2d& P, Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt2d& P,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Polyline)& Value() const; Standard_EXPORT const Handle(StepGeom_Polyline)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_RectangularTrimmedSurface; class StepGeom_RectangularTrimmedSurface;
class Geom_RectangularTrimmedSurface; class Geom_RectangularTrimmedSurface;
@@ -40,7 +41,7 @@ public:
Standard_EXPORT GeomToStep_MakeRectangularTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& RTSurf, Standard_EXPORT GeomToStep_MakeRectangularTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& RTSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_RectangularTrimmedSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_RectangularTrimmedSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SphericalSurface; class StepGeom_SphericalSurface;
class Geom_SphericalSurface; class Geom_SphericalSurface;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeSphericalSurface(const Handle(Geom_SphericalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeSphericalSurface(const Handle(Geom_SphericalSurface)& CSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SphericalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_SphericalSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Surface; class StepGeom_Surface;
class Geom_Surface; class Geom_Surface;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeSurface(const Handle(Geom_Surface)& C, Standard_EXPORT GeomToStep_MakeSurface(const Handle(Geom_Surface)& C,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Surface)& Value() const; Standard_EXPORT const Handle(StepGeom_Surface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SurfaceOfLinearExtrusion; class StepGeom_SurfaceOfLinearExtrusion;
class Geom_SurfaceOfLinearExtrusion; class Geom_SurfaceOfLinearExtrusion;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeSurfaceOfLinearExtrusion(const Handle(Geom_SurfaceOfLinearExtrusion)& CSurf, Standard_EXPORT GeomToStep_MakeSurfaceOfLinearExtrusion(const Handle(Geom_SurfaceOfLinearExtrusion)& CSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SurfaceOfLinearExtrusion)& Value() const; Standard_EXPORT const Handle(StepGeom_SurfaceOfLinearExtrusion)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SurfaceOfRevolution; class StepGeom_SurfaceOfRevolution;
class Geom_SurfaceOfRevolution; class Geom_SurfaceOfRevolution;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeSurfaceOfRevolution(const Handle(Geom_SurfaceOfRevolution)& RevSurf, Standard_EXPORT GeomToStep_MakeSurfaceOfRevolution(const Handle(Geom_SurfaceOfRevolution)& RevSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SurfaceOfRevolution)& Value() const; Standard_EXPORT const Handle(StepGeom_SurfaceOfRevolution)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SweptSurface; class StepGeom_SweptSurface;
class Geom_SweptSurface; class Geom_SweptSurface;
@@ -40,7 +41,7 @@ public:
Standard_EXPORT GeomToStep_MakeSweptSurface(const Handle(Geom_SweptSurface)& S, Standard_EXPORT GeomToStep_MakeSweptSurface(const Handle(Geom_SweptSurface)& S,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SweptSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_SweptSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_ToroidalSurface; class StepGeom_ToroidalSurface;
class Geom_ToroidalSurface; class Geom_ToroidalSurface;
@@ -39,7 +40,7 @@ public:
Standard_EXPORT GeomToStep_MakeToroidalSurface(const Handle(Geom_ToroidalSurface)& TorSurf, Standard_EXPORT GeomToStep_MakeToroidalSurface(const Handle(Geom_ToroidalSurface)& TorSurf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ToroidalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ToroidalSurface)& Value() const;

View File

@@ -23,6 +23,7 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Vector; class StepGeom_Vector;
class gp_Vec; class gp_Vec;
class gp_Vec2d; class gp_Vec2d;
@@ -42,16 +43,16 @@ public:
Standard_EXPORT GeomToStep_MakeVector(const gp_Vec& V, Standard_EXPORT GeomToStep_MakeVector(const gp_Vec& V,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const gp_Vec2d& V, Standard_EXPORT GeomToStep_MakeVector(const gp_Vec2d& V,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom_Vector)& V, Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom_Vector)& V,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom2d_Vector)& V, Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom2d_Vector)& V,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Vector)& Value() const; Standard_EXPORT const Handle(StepGeom_Vector)& Value() const;

View File

@@ -20,7 +20,6 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <StepData_Factors.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>

View File

@@ -150,8 +150,7 @@ void Graphic3d_CLight::SetEnabled (Standard_Boolean theIsOn)
void Graphic3d_CLight::SetCastShadows (Standard_Boolean theToCast) void Graphic3d_CLight::SetCastShadows (Standard_Boolean theToCast)
{ {
if (myType != Graphic3d_TypeOfLightSource_Directional if (myType != Graphic3d_TypeOfLightSource_Directional
&& myType != Graphic3d_TypeOfLightSource_Spot && myType != Graphic3d_TypeOfLightSource_Spot)
&& myType != Graphic3d_TypeOfLightSource_Positional)
{ {
throw Standard_NotImplemented ("Graphic3d_CLight::SetCastShadows() is not implemented for this light type"); throw Standard_NotImplemented ("Graphic3d_CLight::SetCastShadows() is not implemented for this light type");
} }

View File

@@ -200,24 +200,6 @@ void Graphic3d_Camera::Copy (const Handle(Graphic3d_Camera)& theOther)
CopyOrientationData (theOther); CopyOrientationData (theOther);
} }
// =======================================================================
// function : GetDefaultZNear
// purpose :
// =======================================================================
Standard_Real Graphic3d_Camera::GetDefaultZNear()
{
return DEFAULT_ZNEAR;
}
// =======================================================================
// function : GetDefaultZFar
// purpose :
// =======================================================================
Standard_Real Graphic3d_Camera::GetDefaultZFar()
{
return DEFAULT_ZFAR;
}
// ======================================================================= // =======================================================================
// function : SetIdentityOrientation // function : SetIdentityOrientation
// purpose : // purpose :

View File

@@ -202,12 +202,6 @@ public:
//! @name Public camera properties //! @name Public camera properties
public: public:
//! return default valut for znear.
Standard_EXPORT static Standard_Real GetDefaultZNear();
//! return default valut for zfar.
Standard_EXPORT static Standard_Real GetDefaultZFar();
//! Get camera look direction. //! Get camera look direction.
//! @return camera look direction. //! @return camera look direction.
const gp_Dir& Direction() const { return myDirection; } const gp_Dir& Direction() const { return myDirection; }

View File

@@ -52,29 +52,3 @@ Graphic3d_CubeMap::~Graphic3d_CubeMap()
{ {
// //
} }
// =======================================================================
// function : GetCubeDirection
// purpose :
// =======================================================================
gp_Dir Graphic3d_CubeMap::GetCubeDirection (Graphic3d_CubeMapSide theFace)
{
const Standard_Integer aDiv2 = theFace / 2;
const Standard_Integer aMod2 = theFace % 2;
return gp_Dir (aDiv2 == 0 ? aMod2 == 0 ? 1.0 : -1.0 : 0.0,
aDiv2 == 1 ? aMod2 == 0 ? 1.0 : -1.0 : 0.0,
aDiv2 == 2 ? aMod2 == 0 ? 1.0 : -1.0 : 0.0);
}
// =======================================================================
// function : GetCubeUp
// purpose :
// =======================================================================
gp_Dir Graphic3d_CubeMap::GetCubeUp (Graphic3d_CubeMapSide theFace)
{
const Standard_Integer aDiv2 = theFace / 2;
const Standard_Integer aMod2 = theFace % 2;
return gp_Dir (0.0,
aDiv2 == 0 ? 1.0 : aDiv2 == 2 ? -1.0 : 0.0,
aDiv2 == 1 ? aMod2 == 0 ? 1.0 : -1.0 : 0.0);
}

View File

@@ -15,7 +15,6 @@
#ifndef _Graphic3d_CubeMap_HeaderFile #ifndef _Graphic3d_CubeMap_HeaderFile
#define _Graphic3d_CubeMap_HeaderFile #define _Graphic3d_CubeMap_HeaderFile
#include <gp_Dir.hxx>
#include <Graphic3d_CubeMapOrder.hxx> #include <Graphic3d_CubeMapOrder.hxx>
#include <Graphic3d_TextureMap.hxx> #include <Graphic3d_TextureMap.hxx>
@@ -91,12 +90,6 @@ public:
//! Empty destructor. //! Empty destructor.
Standard_EXPORT virtual ~Graphic3d_CubeMap(); Standard_EXPORT virtual ~Graphic3d_CubeMap();
//! Returns direction vector for cubemap's @theFace
Standard_EXPORT gp_Dir static GetCubeDirection (Graphic3d_CubeMapSide theFace);
//! Returns up vector for cubemap's @theFace
Standard_EXPORT gp_Dir static GetCubeUp (Graphic3d_CubeMapSide theFace);
protected: protected:
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state

View File

@@ -86,31 +86,6 @@ Standard_Boolean Graphic3d_LightSet::Remove (const Handle(Graphic3d_CLight)& the
return Standard_True; return Standard_True;
} }
// =======================================================================
// function : CalculateNbShadows
// purpose :
// =======================================================================
void Graphic3d_LightSet::CalculateNbShadows (Standard_Integer& theNb2DShadows, Standard_Integer& theNbPointShadows)
{
theNb2DShadows = 0;
theNbPointShadows = 0;
for (NCollection_IndexedDataMap<Handle(Graphic3d_CLight), Standard_Size>::Iterator aLightIter(myLights); aLightIter.More(); aLightIter.Next())
{
const Handle(Graphic3d_CLight)& aLight = aLightIter.Key();
if (aLight->ToCastShadows())
{
if (aLight->Type() == Graphic3d_TypeOfLightSource_Positional)
{
++theNbPointShadows;
}
else
{
++theNb2DShadows;
}
}
}
}
// ======================================================================= // =======================================================================
// function : UpdateRevision // function : UpdateRevision
// purpose : // purpose :

View File

@@ -143,9 +143,6 @@ public:
//! Returns total amount of lights of specified type. //! Returns total amount of lights of specified type.
Standard_Integer NbLightsOfType (Graphic3d_TypeOfLightSource theType) const { return myLightTypes[theType]; } Standard_Integer NbLightsOfType (Graphic3d_TypeOfLightSource theType) const { return myLightTypes[theType]; }
//! Calculates total amount of enabled lights castings shadows (point lights and others).
Standard_EXPORT void CalculateNbShadows (Standard_Integer& theNb2DShadows, Standard_Integer& theNbPointShadows);
//! @name cached state of lights set updated by UpdateRevision() //! @name cached state of lights set updated by UpdateRevision()
public: public:

View File

@@ -19,7 +19,6 @@
#include <Message.hxx> #include <Message.hxx>
#include "../Shaders/Shaders_LightShadow_glsl.pxx" #include "../Shaders/Shaders_LightShadow_glsl.pxx"
#include "../Shaders/Shaders_LightPointShadow_glsl.pxx"
#include "../Shaders/Shaders_PBRDistribution_glsl.pxx" #include "../Shaders/Shaders_PBRDistribution_glsl.pxx"
#include "../Shaders/Shaders_PBRDirectionalLight_glsl.pxx" #include "../Shaders/Shaders_PBRDirectionalLight_glsl.pxx"
#include "../Shaders/Shaders_PBRGeometry_glsl.pxx" #include "../Shaders/Shaders_PBRGeometry_glsl.pxx"
@@ -517,7 +516,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramFont() con
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -647,7 +645,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramFboBlit (S
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -703,7 +700,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramOitComposi
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -1141,7 +1137,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramUnlit (Sta
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes); aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes);
aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0); aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0);
const Standard_Integer aNbGeomInputVerts = !aSrcGeom.IsEmpty() ? 3 : 0; const Standard_Integer aNbGeomInputVerts = !aSrcGeom.IsEmpty() ? 3 : 0;
@@ -1157,11 +1152,10 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramUnlit (Sta
// ======================================================================= // =======================================================================
TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_Integer& theNbLights, TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_Integer& theNbLights,
const Handle(Graphic3d_LightSet)& theLights, const Handle(Graphic3d_LightSet)& theLights,
Standard_Boolean theHasVertColor, Standard_Boolean theHasVertColor,
Standard_Boolean theIsPBR, Standard_Boolean theIsPBR,
Standard_Boolean theHasTexColor, Standard_Boolean theHasTexColor,
Standard_Integer theNbShadowMaps, Standard_Integer theNbShadowMaps) const
Standard_Integer theNbShadowCubeMaps) const
{ {
TCollection_AsciiString aLightsFunc, aLightsLoop; TCollection_AsciiString aLightsFunc, aLightsLoop;
theNbLights = 0; theNbLights = 0;
@@ -1171,8 +1165,6 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
if (theNbLights <= THE_NB_UNROLLED_LIGHTS_MAX) if (theNbLights <= THE_NB_UNROLLED_LIGHTS_MAX)
{ {
Standard_Integer anIndex = 0; Standard_Integer anIndex = 0;
Standard_Integer a2DSamplerIndex = 0;
Standard_Integer aCubeSamplerIndex = 0;
for (Graphic3d_LightSet::Iterator aLightIter (theLights, Graphic3d_LightSet::IterationFilter_ExcludeDisabledAndAmbient); for (Graphic3d_LightSet::Iterator aLightIter (theLights, Graphic3d_LightSet::IterationFilter_ExcludeDisabledAndAmbient);
aLightIter.More(); aLightIter.Next()) aLightIter.More(); aLightIter.Next())
{ {
@@ -1189,7 +1181,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
{ {
aLightsLoop = aLightsLoop + aLightsLoop = aLightsLoop +
EOL" occDirectionalLight (" + anIndex + ", theNormal, theView, theIsFront," EOL" occDirectionalLight (" + anIndex + ", theNormal, theView, theIsFront,"
EOL" occLightShadow (occShadowMapSamplers[" + a2DSamplerIndex++ + "], " + anIndex + ", theNormal));"; EOL" occLightShadow (occShadowMapSamplers[" + anIndex + "], " + anIndex + ", theNormal));";
} }
else else
{ {
@@ -1200,18 +1192,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
} }
case Graphic3d_TypeOfLightSource_Positional: case Graphic3d_TypeOfLightSource_Positional:
{ {
if (theNbShadowCubeMaps > 0 aLightsLoop = aLightsLoop + EOL" occPointLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront);";
&& aLightIter.Value()->ToCastShadows())
{
aLightsLoop = aLightsLoop +
EOL" occPointLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront,"
EOL" occLightPointShadow (occShadowCubeMapSamplers[" + aCubeSamplerIndex++ + "],"
EOL" " + anIndex + ", aPoint, theNormal)); ";
}
else
{
aLightsLoop = aLightsLoop + EOL" occPointLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront, 1.0);";
}
++anIndex; ++anIndex;
break; break;
} }
@@ -1222,7 +1203,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
{ {
aLightsLoop = aLightsLoop + aLightsLoop = aLightsLoop +
EOL" occSpotLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront," EOL" occSpotLight (" + anIndex + ", theNormal, theView, aPoint, theIsFront,"
EOL" occLightShadow (occShadowMapSamplers[" + a2DSamplerIndex++ + "], " + anIndex + ", theNormal));"; EOL" occLightShadow (occShadowMapSamplers[" + anIndex + "], " + anIndex + ", theNormal));";
} }
else else
{ {
@@ -1261,7 +1242,7 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
aLightsLoop += aLightsLoop +=
EOL" if (aType == OccLightType_Point)" EOL" if (aType == OccLightType_Point)"
EOL" {" EOL" {"
EOL" occPointLight (anIndex, theNormal, theView, aPoint, theIsFront, 1.0);" EOL" occPointLight (anIndex, theNormal, theView, aPoint, theIsFront);"
EOL" }"; EOL" }";
} }
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0) if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0)
@@ -1290,7 +1271,6 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
} }
bool isShadowShaderAdded = false; bool isShadowShaderAdded = false;
bool isShadowCubeShaderAdded = false;
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Directional) == 1 if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Directional) == 1
&& theNbLights == 1 && theNbLights == 1
&& !theIsPBR && !theIsPBR
@@ -1311,11 +1291,6 @@ TCollection_AsciiString Graphic3d_ShaderManager::stdComputeLighting (Standard_In
} }
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Positional) > 0) if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Positional) > 0)
{ {
if (theNbShadowCubeMaps > 0 && !isShadowCubeShaderAdded)
{
aLightsFunc += Shaders_LightPointShadow_glsl;
isShadowCubeShaderAdded = true;
}
aLightsFunc += theIsPBR ? Shaders_PBRPointLight_glsl : Shaders_PhongPointLight_glsl; aLightsFunc += theIsPBR ? Shaders_PBRPointLight_glsl : Shaders_PhongPointLight_glsl;
} }
if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0) if (theLights->NbEnabledLightsOfType (Graphic3d_TypeOfLightSource_Spot) > 0)
@@ -1500,7 +1475,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramGouraud (c
aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 BackColor", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT)); aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 BackColor", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT));
Standard_Integer aNbLights = 0; Standard_Integer aNbLights = 0;
const TCollection_AsciiString aLights = stdComputeLighting (aNbLights, theLights, !aSrcVertColor.IsEmpty(), false, toUseTexColor, 0, 0); const TCollection_AsciiString aLights = stdComputeLighting (aNbLights, theLights, !aSrcVertColor.IsEmpty(), false, toUseTexColor, 0);
aSrcVert = TCollection_AsciiString() aSrcVert = TCollection_AsciiString()
+ THE_FUNC_transformNormal_world + THE_FUNC_transformNormal_world
+ EOL + EOL
@@ -1545,7 +1520,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramGouraud (c
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (aNbLights); aProgramSrc->SetNbLightsMax (aNbLights);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes); aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes);
aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0); aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0);
const Standard_Integer aNbGeomInputVerts = !aSrcGeom.IsEmpty() ? 3 : 0; const Standard_Integer aNbGeomInputVerts = !aSrcGeom.IsEmpty() ? 3 : 0;
@@ -1563,8 +1537,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
const Standard_Integer theBits, const Standard_Integer theBits,
const Standard_Boolean theIsFlatNormal, const Standard_Boolean theIsFlatNormal,
const Standard_Boolean theIsPBR, const Standard_Boolean theIsPBR,
const Standard_Integer theNbShadowMaps, const Standard_Integer theNbShadowMaps) const
const Standard_Integer theNbShadowCubeMaps) const
{ {
TCollection_AsciiString aPhongCompLight = TCollection_AsciiString() + TCollection_AsciiString aPhongCompLight = TCollection_AsciiString() +
"computeLighting (normalize (Normal), normalize (View), PositionWorld, gl_FrontFacing)"; "computeLighting (normalize (Normal), normalize (View), PositionWorld, gl_FrontFacing)";
@@ -1717,19 +1690,12 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 PositionWorld", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT)); aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 PositionWorld", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT));
aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec3 View", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT)); aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec3 View", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT));
if (theNbShadowMaps + theNbShadowCubeMaps > 0) if (theNbShadowMaps > 0)
{ {
aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("mat4 occShadowMapMatrices[THE_NB_SHADOWMAPS]", Graphic3d_TOS_VERTEX)); aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("mat4 occShadowMapMatrices[THE_NB_SHADOWMAPS]", Graphic3d_TOS_VERTEX));
aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("vec2 occShadowMapRangeParams[THE_NB_SHADOWMAPS]", Graphic3d_TOS_FRAGMENT)); aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("sampler2D occShadowMapSamplers[THE_NB_SHADOWMAPS]", Graphic3d_TOS_FRAGMENT));
aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("vec2 occShadowMapSizeBias", Graphic3d_TOS_FRAGMENT)); aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("vec2 occShadowMapSizeBias", Graphic3d_TOS_FRAGMENT));
if (theNbShadowMaps > 0)
{
aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("sampler2D occShadowMapSamplers[THE_NB_SHADOWMAPS2D]", Graphic3d_TOS_FRAGMENT));
}
if (theNbShadowCubeMaps > 0)
{
aUniforms.Append (Graphic3d_ShaderObject::ShaderVariable ("samplerCube occShadowCubeMapSamplers[THE_NB_SHADOWMAPSCUBE]", Graphic3d_TOS_FRAGMENT));
}
aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 PosLightSpace[THE_NB_SHADOWMAPS]", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT)); aStageInOuts.Append (Graphic3d_ShaderObject::ShaderVariable ("vec4 PosLightSpace[THE_NB_SHADOWMAPS]", Graphic3d_TOS_VERTEX | Graphic3d_TOS_FRAGMENT));
aSrcVertExtraMain += aSrcVertExtraMain +=
EOL" for (int aShadowIter = 0; aShadowIter < THE_NB_SHADOWMAPS; ++aShadowIter)" EOL" for (int aShadowIter = 0; aShadowIter < THE_NB_SHADOWMAPS; ++aShadowIter)"
@@ -1763,7 +1729,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
Standard_Integer aNbLights = 0; Standard_Integer aNbLights = 0;
const TCollection_AsciiString aLights = stdComputeLighting (aNbLights, theLights, !aSrcFragGetVertColor.IsEmpty(), const TCollection_AsciiString aLights = stdComputeLighting (aNbLights, theLights, !aSrcFragGetVertColor.IsEmpty(),
theIsPBR, toUseTexColor, theNbShadowMaps, theNbShadowCubeMaps); theIsPBR, toUseTexColor, theNbShadowMaps);
aSrcFrag += TCollection_AsciiString() aSrcFrag += TCollection_AsciiString()
+ EOL + EOL
+ aSrcFragGetVertColor + aSrcFragGetVertColor
@@ -1779,12 +1745,11 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
+ EOL"}"; + EOL"}";
const TCollection_AsciiString aProgId = TCollection_AsciiString (theIsFlatNormal ? "flat-" : "phong-") + (theIsPBR ? "pbr-" : "") const TCollection_AsciiString aProgId = TCollection_AsciiString (theIsFlatNormal ? "flat-" : "phong-") + (theIsPBR ? "pbr-" : "")
+ genLightKey (theLights, (theNbShadowMaps + theNbShadowCubeMaps) > 0) + "-"; + genLightKey (theLights, theNbShadowMaps > 0) + "-";
defaultGlslVersion (aProgramSrc, aProgId, theBits, isFlatNormal); defaultGlslVersion (aProgramSrc, aProgId, theBits, isFlatNormal);
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (aNbLights); aProgramSrc->SetNbLightsMax (aNbLights);
aProgramSrc->SetNbShadowMaps (theNbShadowMaps); aProgramSrc->SetNbShadowMaps (theNbShadowMaps);
aProgramSrc->SetNbShadowCubeMaps (theNbShadowCubeMaps);
aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes); aProgramSrc->SetNbClipPlanesMax (aNbClipPlanes);
aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0); aProgramSrc->SetAlphaTest ((theBits & Graphic3d_ShaderFlags_AlphaTest) != 0);
@@ -1979,7 +1944,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramStereo (Gr
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -2016,7 +1980,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramBoundBox()
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -2078,7 +2041,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
aProgramSrc->SetDefaultSampler (false); aProgramSrc->SetDefaultSampler (false);
aProgramSrc->SetNbLightsMax (0); aProgramSrc->SetNbLightsMax (0);
aProgramSrc->SetNbShadowMaps (0); aProgramSrc->SetNbShadowMaps (0);
aProgramSrc->SetNbShadowCubeMaps (0);
aProgramSrc->SetNbClipPlanesMax (0); aProgramSrc->SetNbClipPlanesMax (0);
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
@@ -2145,7 +2107,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getBgCubeMapProgram() c
aProgSrc->SetDefaultSampler (false); aProgSrc->SetDefaultSampler (false);
aProgSrc->SetNbLightsMax (0); aProgSrc->SetNbLightsMax (0);
aProgSrc->SetNbShadowMaps (0); aProgSrc->SetNbShadowMaps (0);
aProgSrc->SetNbShadowCubeMaps (0);
aProgSrc->SetNbClipPlanesMax (0); aProgSrc->SetNbClipPlanesMax (0);
aProgSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts)); aProgSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
aProgSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts)); aProgSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));

View File

@@ -134,8 +134,7 @@ protected:
const Standard_Integer theBits, const Standard_Integer theBits,
const Standard_Boolean theIsFlatNormal, const Standard_Boolean theIsFlatNormal,
const Standard_Boolean theIsPBR, const Standard_Boolean theIsPBR,
const Standard_Integer theNbShadowMaps, const Standard_Integer theNbShadowMaps) const;
const Standard_Integer theNbShadowCubeMaps) const;
//! Prepare standard GLSL program for bounding box. //! Prepare standard GLSL program for bounding box.
Standard_EXPORT Handle(Graphic3d_ShaderProgram) getStdProgramBoundBox() const; Standard_EXPORT Handle(Graphic3d_ShaderProgram) getStdProgramBoundBox() const;
@@ -208,11 +207,10 @@ protected:
//! @param theNbShadowMaps [in] flag to include shadow map //! @param theNbShadowMaps [in] flag to include shadow map
Standard_EXPORT TCollection_AsciiString stdComputeLighting (Standard_Integer& theNbLights, Standard_EXPORT TCollection_AsciiString stdComputeLighting (Standard_Integer& theNbLights,
const Handle(Graphic3d_LightSet)& theLights, const Handle(Graphic3d_LightSet)& theLights,
Standard_Boolean theHasVertColor, Standard_Boolean theHasVertColor,
Standard_Boolean theIsPBR, Standard_Boolean theIsPBR,
Standard_Boolean theHasTexColor, Standard_Boolean theHasTexColor,
Standard_Integer theNbShadowMaps, Standard_Integer theNbShadowMaps) const;
Standard_Integer theNbShadowCubeMaps) const;
protected: protected:

View File

@@ -80,7 +80,6 @@ const TCollection_AsciiString& Graphic3d_ShaderProgram::ShadersFolder()
Graphic3d_ShaderProgram::Graphic3d_ShaderProgram() Graphic3d_ShaderProgram::Graphic3d_ShaderProgram()
: myNbLightsMax (THE_MAX_LIGHTS_DEFAULT), : myNbLightsMax (THE_MAX_LIGHTS_DEFAULT),
myNbShadowMaps (0), myNbShadowMaps (0),
myNbShadowCubeMaps (0),
myNbClipPlanesMax (THE_MAX_CLIP_PLANES_DEFAULT), myNbClipPlanesMax (THE_MAX_CLIP_PLANES_DEFAULT),
myNbFragOutputs (THE_NB_FRAG_OUTPUTS), myNbFragOutputs (THE_NB_FRAG_OUTPUTS),
myTextureSetBits (Graphic3d_TextureSetBits_NONE), myTextureSetBits (Graphic3d_TextureSetBits_NONE),

View File

@@ -96,18 +96,12 @@ public:
//! Specify the length of array of light sources (THE_MAX_LIGHTS). //! Specify the length of array of light sources (THE_MAX_LIGHTS).
void SetNbLightsMax (Standard_Integer theNbLights) { myNbLightsMax = theNbLights; } void SetNbLightsMax (Standard_Integer theNbLights) { myNbLightsMax = theNbLights; }
//! Return the length of array of 2D shadow maps (THE_NB_SHADOWMAP2D); 0 by default. //! Return the length of array of shadow maps (THE_NB_SHADOWMAPS); 0 by default.
Standard_Integer NbShadowMaps() const { return myNbShadowMaps; } Standard_Integer NbShadowMaps() const { return myNbShadowMaps; }
//! Specify the length of array of 2D shadow maps (THE_NB_SHADOWMAP2D). //! Specify the length of array of shadow maps (THE_NB_SHADOWMAPS).
void SetNbShadowMaps (Standard_Integer theNbMaps) { myNbShadowMaps = theNbMaps; } void SetNbShadowMaps (Standard_Integer theNbMaps) { myNbShadowMaps = theNbMaps; }
//! Return the length of array of shadow cube maps (THE_NB_SHADOWMAPCUBE); 0 by default.
Standard_Integer NbShadowCubeMaps() const { return myNbShadowCubeMaps; }
//! Specify the length of array of shadow cube maps (THE_NB_SHADOWMAPCUBE).
void SetNbShadowCubeMaps (Standard_Integer theNbMaps) { myNbShadowCubeMaps = theNbMaps; }
//! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES), //! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES),
//! to be used for initialization occClipPlaneEquations. //! to be used for initialization occClipPlaneEquations.
//! Default value is THE_MAX_CLIP_PLANES_DEFAULT. //! Default value is THE_MAX_CLIP_PLANES_DEFAULT.
@@ -220,21 +214,20 @@ public:
private: private:
TCollection_AsciiString myID; //!< the unique identifier of program object TCollection_AsciiString myID; //!< the unique identifier of program object
Graphic3d_ShaderObjectList myShaderObjects; //!< the list of attached shader objects Graphic3d_ShaderObjectList myShaderObjects; //!< the list of attached shader objects
Graphic3d_ShaderVariableList myVariables; //!< the list of custom uniform variables Graphic3d_ShaderVariableList myVariables; //!< the list of custom uniform variables
Graphic3d_ShaderAttributeList myAttributes; //!< the list of custom vertex attributes Graphic3d_ShaderAttributeList myAttributes; //!< the list of custom vertex attributes
TCollection_AsciiString myHeader; //!< GLSL header with version code and used extensions TCollection_AsciiString myHeader; //!< GLSL header with version code and used extensions
Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS) Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS)
Standard_Integer myNbShadowMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAP2D) Standard_Integer myNbShadowMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAPS)
Standard_Integer myNbShadowCubeMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAPCUBE) Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES)
Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES) Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS)
Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS) Standard_Integer myTextureSetBits;//!< texture units declared within the program, @sa Graphic3d_TextureSetBits
Standard_Integer myTextureSetBits; //!< texture units declared within the program, @sa Graphic3d_TextureSetBits Graphic3d_RenderTransparentMethod myOitOutput; //!< flag indicating that Fragment Shader includes OIT outputs
Graphic3d_RenderTransparentMethod myOitOutput; //!< flag indicating that Fragment Shader includes OIT outputs Standard_Boolean myHasDefSampler; //!< flag indicating that program defines default texture sampler occSampler0
Standard_Boolean myHasDefSampler; //!< flag indicating that program defines default texture sampler occSampler0 Standard_Boolean myHasAlphaTest; //!< flag indicating that Fragment Shader performs alpha test
Standard_Boolean myHasAlphaTest; //!< flag indicating that Fragment Shader performs alpha test Standard_Boolean myIsPBR; //!< flag indicating that program defines functions and variables used in PBR pipeline
Standard_Boolean myIsPBR; //!< flag indicating that program defines functions and variables used in PBR pipeline
}; };

View File

@@ -67,10 +67,6 @@ enum Graphic3d_TextureUnit
//! Note that it can be overridden to Graphic3d_TextureUnit_0 for FFP fallback on hardware without multi-texturing. //! Note that it can be overridden to Graphic3d_TextureUnit_0 for FFP fallback on hardware without multi-texturing.
Graphic3d_TextureUnit_PointSprite = Graphic3d_TextureUnit_1, Graphic3d_TextureUnit_PointSprite = Graphic3d_TextureUnit_1,
//! samplerCube occShadowCubeMapSampler.
//! Point light source shadowmap texture.
Graphic3d_TextureUnit_ShadowCubeMap = -7,
//! sampler2D occDepthPeelingDepth. //! sampler2D occDepthPeelingDepth.
//! 1st texture unit for Depth Peeling lookups. //! 1st texture unit for Depth Peeling lookups.
Graphic3d_TextureUnit_DepthPeelingDepth = -6, Graphic3d_TextureUnit_DepthPeelingDepth = -6,

View File

@@ -25,15 +25,8 @@ enum Graphic3d_TransModeFlags
Graphic3d_TMF_TriedronPers = 0x0020, //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating) 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_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_CameraPers = 0x0080, //!< object is in front of the camera
Graphic3d_TMF_OrthoPers = 0x0100, //!< object is forced to be rendered with orthographic projection.
Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers
| Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate | Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate
}; };
//! Bitwise OR operator for transform persistence mode flags. Be aware that some flags combinations are not valid.
inline Graphic3d_TransModeFlags operator| (Graphic3d_TransModeFlags a, Graphic3d_TransModeFlags b)
{
return static_cast<Graphic3d_TransModeFlags> (static_cast<uint32_t> (a) | static_cast<uint32_t> (b));
}
#endif #endif

View File

@@ -58,12 +58,6 @@ public:
return (theMode & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) != 0; return (theMode & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) != 0;
} }
//! Return true if specified mode is orthographic projection transformation persistence.
static Standard_Boolean IsOrthoPers (Graphic3d_TransModeFlags theMode)
{
return (theMode & Graphic3d_TMF_OrthoPers) != 0;
}
public: public:
//! Set transformation persistence. //! Set transformation persistence.
@@ -116,9 +110,6 @@ public:
//! Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes. //! Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.
Standard_Boolean IsTrihedronOr2d() const { return IsTrihedronOr2d (myMode); } Standard_Boolean IsTrihedronOr2d() const { return IsTrihedronOr2d (myMode); }
//! Return true for Graphic3d_TMF_OrthoPers mode.
Standard_Boolean IsOrthoPers () const { return IsOrthoPers (myMode); }
//! Transformation persistence mode flags. //! Transformation persistence mode flags.
Graphic3d_TransModeFlags Mode() const { return myMode; } Graphic3d_TransModeFlags Mode() const { return myMode; }
@@ -306,32 +297,28 @@ public:
//! @param theWorldView [in] the world view transformation matrix. //! @param theWorldView [in] the world view transformation matrix.
//! @param theViewportWidth [in] the width of viewport (for 2d persistence). //! @param theViewportWidth [in] the width of viewport (for 2d persistence).
//! @param theViewportHeight [in] the height of viewport (for 2d persistence). //! @param theViewportHeight [in] the height of viewport (for 2d persistence).
//! @param theToApplyProjPers [in] if should apply projection persistence to matrix (for orthographic persistence).
//! @return transformation matrix to be applied to model world transformation of an object. //! @return transformation matrix to be applied to model world transformation of an object.
template<class T> template<class T>
NCollection_Mat4<T> Compute (const Handle(Graphic3d_Camera)& theCamera, NCollection_Mat4<T> Compute (const Handle(Graphic3d_Camera)& theCamera,
const NCollection_Mat4<T>& theProjection, const NCollection_Mat4<T>& theProjection,
const NCollection_Mat4<T>& theWorldView, const NCollection_Mat4<T>& theWorldView,
const Standard_Integer theViewportWidth, const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight, const Standard_Integer theViewportHeight) const;
const Standard_Boolean theToApplyProjPers = false) const;
//! Apply transformation persistence on specified matrices. //! Apply transformation persistence on specified matrices.
//! @param theCamera [in] camera definition //! @param theCamera camera definition
//! @param theProjection [in] projection matrix to modify //! @param theProjection projection matrix to modify
//! @param theWorldView [in/out] world-view matrix to modify //! @param theWorldView world-view matrix to modify
//! @param theViewportWidth [in] viewport width //! @param theViewportWidth viewport width
//! @param theViewportHeight [in] viewport height //! @param theViewportHeight viewport height
//! @param theAnchor [in] if not NULL, overrides anchor point //! @param theAnchor if not NULL, overrides anchor point
//! @param theToApplyProjPers [in] if should apply projection persistence to matrix (for orthographic persistence).
template<class T> template<class T>
void Apply (const Handle(Graphic3d_Camera)& theCamera, void Apply (const Handle(Graphic3d_Camera)& theCamera,
const NCollection_Mat4<T>& theProjection, const NCollection_Mat4<T>& theProjection,
NCollection_Mat4<T>& theWorldView, NCollection_Mat4<T>& theWorldView,
const Standard_Integer theViewportWidth, const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight, const Standard_Integer theViewportHeight,
const gp_Pnt* theAnchor = NULL, const gp_Pnt* theAnchor = NULL) const;
const Standard_Boolean theToApplyProjPers = true) const;
//! Dumps the content of me into the stream //! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
@@ -381,50 +368,41 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
NCollection_Mat4<T>& theWorldView, NCollection_Mat4<T>& theWorldView,
const Standard_Integer theViewportWidth, const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight, const Standard_Integer theViewportHeight,
const gp_Pnt* theAnchor, const gp_Pnt* theAnchor) const
const Standard_Boolean theToApplyProjPers) const
{ {
(void )theViewportWidth; (void )theViewportWidth;
(void )theProjection;
if (myMode == Graphic3d_TMF_None if (myMode == Graphic3d_TMF_None
|| theViewportHeight == 0) || theViewportHeight == 0)
{ {
return; 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 // use total size when tiling is active
const Standard_Integer aVPSizeY = aCamera->Tile().IsValid() ? aCamera->Tile().TotalSize.y() : theViewportHeight; const Standard_Integer aVPSizeY = theCamera->Tile().IsValid() ? theCamera->Tile().TotalSize.y() : theViewportHeight;
// a small enough jitter compensation offset // a small enough jitter compensation offset
// to avoid image dragging within single pixel in corner cases // to avoid image dragging within single pixel in corner cases
const Standard_Real aJitterComp = 0.001; const Standard_Real aJitterComp = 0.001;
if ((myMode & Graphic3d_TMF_TriedronPers) != 0) if (myMode == Graphic3d_TMF_TriedronPers)
{ {
// reset Z focus for trihedron persistence // reset Z focus for trihedron persistence
const Standard_Real aFocus = aCamera->IsOrthographic() const Standard_Real aFocus = theCamera->IsOrthographic()
? aCamera->Distance() ? theCamera->Distance()
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative : (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aCamera->ZFocus() * aCamera->Distance()) ? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
: Standard_Real(aCamera->ZFocus())); : Standard_Real(theCamera->ZFocus()));
// scale factor to pixels // scale factor to pixels
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus); const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY); const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
const gp_Dir aForward = aCamera->Direction(); const gp_Dir aForward = theCamera->Direction();
gp_XYZ aCenter = aCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aCamera->Distance()); gp_XYZ aCenter = theCamera->Center().XYZ() + aForward.XYZ() * (aFocus - theCamera->Distance());
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0) if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{ {
const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale; const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
const gp_Dir aSide = aForward.Crossed (aCamera->Up()); const gp_Dir aSide = aForward.Crossed (theCamera->Up());
const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * aCamera->NDC2dOffsetX() - anOffsetX); const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * theCamera->NDC2dOffsetX() - anOffsetX);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0) if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{ {
aCenter += aDeltaX; aCenter += aDeltaX;
@@ -437,7 +415,7 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0) if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{ {
const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale; const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
const gp_XYZ aDeltaY = aCamera->Up().XYZ() * (Abs(aViewDim.Y()) * aCamera->NDC2dOffsetY() - anOffsetY); const gp_XYZ aDeltaY = theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * theCamera->NDC2dOffsetY() - anOffsetY);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0) if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{ {
aCenter += aDeltaY; aCenter += aDeltaY;
@@ -448,24 +426,27 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
} }
} }
NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z()); Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale); Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
theWorldView.ConvertFrom (aWorldView);
return;
} }
else if ((myMode & Graphic3d_TMF_2d) != 0) else if (myMode == Graphic3d_TMF_2d)
{ {
const Standard_Real aFocus = aCamera->IsOrthographic() const Standard_Real aFocus = theCamera->IsOrthographic()
? aCamera->Distance() ? theCamera->Distance()
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative : (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
? Standard_Real(aCamera->ZFocus() * aCamera->Distance()) ? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
: Standard_Real(aCamera->ZFocus())); : Standard_Real(theCamera->ZFocus()));
// scale factor to pixels // scale factor to pixels
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus); const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY); const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
gp_XYZ aCenter (0.0, 0.0, -aFocus); gp_XYZ aCenter (0.0, 0.0, -aFocus);
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0) if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
{ {
aCenter.SetX (-aViewDim.X() * aCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale); aCenter.SetX (-aViewDim.X() * theCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0) if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
{ {
aCenter.SetX (-aCenter.X()); aCenter.SetX (-aCenter.X());
@@ -473,24 +454,26 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
} }
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0) if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
{ {
aCenter.SetY (-aViewDim.Y() * aCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale); aCenter.SetY (-aViewDim.Y() * theCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0) if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
{ {
aCenter.SetY (-aCenter.Y()); aCenter.SetY (-aCenter.Y());
} }
} }
aWorldView.InitIdentity(); theWorldView.InitIdentity();
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z()); Graphic3d_TransformUtils::Translate (theWorldView, T(aCenter.X()), T(aCenter.Y()), T(aCenter.Z()));
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale); Graphic3d_TransformUtils::Scale (theWorldView, T(aScale), T(aScale), T(aScale));
return;
} }
else if ((myMode & Graphic3d_TMF_CameraPers) != 0) else if ((myMode & Graphic3d_TMF_CameraPers) != 0)
{ {
aWorldView.InitIdentity(); theWorldView.InitIdentity();
} }
else else
{ {
// Compute reference point for transformation in untransformed projection space. // Compute reference point for transformation in untransformed projection space.
NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
if (theAnchor != NULL) if (theAnchor != NULL)
{ {
Graphic3d_TransformUtils::Translate (aWorldView, theAnchor->X(), theAnchor->Y(), theAnchor->Z()); Graphic3d_TransformUtils::Translate (aWorldView, theAnchor->X(), theAnchor->Y(), theAnchor->Z());
@@ -520,19 +503,12 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
if ((myMode & Graphic3d_TMF_ZoomPers) != 0) if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
{ {
// lock zooming // lock zooming
Standard_Real aScale = persistentScale (aCamera, theViewportWidth, theViewportHeight); Standard_Real aScale = persistentScale (theCamera, theViewportWidth, theViewportHeight);
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale); Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
} }
theWorldView.ConvertFrom (aWorldView);
return;
} }
if (!theCamera->IsOrthographic() && IsOrthoPers() && theToApplyProjPers)
{
Graphic3d_Mat4d aProjInv;
aProjInv.ConvertFrom (theProjection.Inverted());
aWorldView = (aProjInv * aCamera->ProjectionMatrix()) * aWorldView;
}
theWorldView.ConvertFrom (aWorldView);
} }
// ======================================================================= // =======================================================================
@@ -579,7 +555,7 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
const Standard_Integer theViewportHeight, const Standard_Integer theViewportHeight,
BVH_Box<T, 3>& theBoundingBox) const BVH_Box<T, 3>& theBoundingBox) const
{ {
NCollection_Mat4<T> aTPers = Compute (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight, false); NCollection_Mat4<T> aTPers = Compute (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight);
if (aTPers.IsIdentity() if (aTPers.IsIdentity()
|| !theBoundingBox.IsValid()) || !theBoundingBox.IsValid())
{ {
@@ -618,8 +594,7 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
const NCollection_Mat4<T>& theProjection, const NCollection_Mat4<T>& theProjection,
const NCollection_Mat4<T>& theWorldView, const NCollection_Mat4<T>& theWorldView,
const Standard_Integer theViewportWidth, const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight, const Standard_Integer theViewportHeight) const
const Standard_Boolean theToApplyProjPers) const
{ {
if (myMode == Graphic3d_TMF_None) if (myMode == Graphic3d_TMF_None)
{ {
@@ -635,7 +610,7 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
// compute only world-view matrix difference to avoid floating point instability // compute only world-view matrix difference to avoid floating point instability
// caused by projection matrix modifications outside of this algorithm (e.g. by Z-fit) // caused by projection matrix modifications outside of this algorithm (e.g. by Z-fit)
Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight, NULL, theToApplyProjPers); Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight);
return anUnviewMat * aWorldView; return anUnviewMat * aWorldView;
} }

View File

@@ -227,7 +227,6 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
myPBRDiffIBLMapSHTexUnit (Graphic3d_TextureUnit_PbrIblDiffuseSH), myPBRDiffIBLMapSHTexUnit (Graphic3d_TextureUnit_PbrIblDiffuseSH),
myPBRSpecIBLMapTexUnit (Graphic3d_TextureUnit_PbrIblSpecular), myPBRSpecIBLMapTexUnit (Graphic3d_TextureUnit_PbrIblSpecular),
myShadowMapTexUnit (Graphic3d_TextureUnit_ShadowMap), myShadowMapTexUnit (Graphic3d_TextureUnit_ShadowMap),
myShadowCubeMapTexUnit (Graphic3d_TextureUnit_ShadowCubeMap),
myDepthPeelingDepthTexUnit (Graphic3d_TextureUnit_DepthPeelingDepth), myDepthPeelingDepthTexUnit (Graphic3d_TextureUnit_DepthPeelingDepth),
myDepthPeelingFrontColorTexUnit (Graphic3d_TextureUnit_DepthPeelingFrontColor), myDepthPeelingFrontColorTexUnit (Graphic3d_TextureUnit_DepthPeelingFrontColor),
myFrameStats (new OpenGl_FrameStats()), myFrameStats (new OpenGl_FrameStats()),
@@ -1654,7 +1653,6 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
} }
} }
myShadowCubeMapTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_ShadowCubeMap); // -7
myDepthPeelingDepthTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_DepthPeelingDepth); // -6 myDepthPeelingDepthTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_DepthPeelingDepth); // -6
myDepthPeelingFrontColorTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_DepthPeelingFrontColor); // -5 myDepthPeelingFrontColorTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_DepthPeelingFrontColor); // -5
myShadowMapTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_ShadowMap); // -4 myShadowMapTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_ShadowMap); // -4
@@ -1663,7 +1661,6 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
myPBRSpecIBLMapTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_PbrIblSpecular); // -1 myPBRSpecIBLMapTexUnit = static_cast<Graphic3d_TextureUnit>(myMaxTexCombined + Graphic3d_TextureUnit_PbrIblSpecular); // -1
if (!myHasPBR) if (!myHasPBR)
{ {
myShadowCubeMapTexUnit = static_cast<Graphic3d_TextureUnit>(myShadowCubeMapTexUnit + 3);
myDepthPeelingDepthTexUnit = static_cast<Graphic3d_TextureUnit>(myDepthPeelingDepthTexUnit + 3); myDepthPeelingDepthTexUnit = static_cast<Graphic3d_TextureUnit>(myDepthPeelingDepthTexUnit + 3);
myDepthPeelingFrontColorTexUnit = static_cast<Graphic3d_TextureUnit>(myDepthPeelingFrontColorTexUnit + 3); myDepthPeelingFrontColorTexUnit = static_cast<Graphic3d_TextureUnit>(myDepthPeelingFrontColorTexUnit + 3);
myShadowMapTexUnit = static_cast<Graphic3d_TextureUnit>(myShadowMapTexUnit + 3); myShadowMapTexUnit = static_cast<Graphic3d_TextureUnit>(myShadowMapTexUnit + 3);

View File

@@ -605,9 +605,6 @@ public:
//! Returns texture unit where shadow map is expected to be bound, or 0 if unavailable. //! Returns texture unit where shadow map is expected to be bound, or 0 if unavailable.
Graphic3d_TextureUnit ShadowMapTexUnit() const { return myShadowMapTexUnit; } Graphic3d_TextureUnit ShadowMapTexUnit() const { return myShadowMapTexUnit; }
//! Returns texture unit where shadow map is expected to be bound, or 0 if unavailable.
Graphic3d_TextureUnit ShadowCubeMapTexUnit() const { return myShadowCubeMapTexUnit; }
//! Returns texture unit for occDepthPeelingDepth within enabled Depth Peeling. //! Returns texture unit for occDepthPeelingDepth within enabled Depth Peeling.
Graphic3d_TextureUnit DepthPeelingDepthTexUnit() const { return myDepthPeelingDepthTexUnit; } Graphic3d_TextureUnit DepthPeelingDepthTexUnit() const { return myDepthPeelingDepthTexUnit; }
@@ -1140,7 +1137,6 @@ private: // context info
//! (0 if PBR is not supported) //! (0 if PBR is not supported)
Graphic3d_TextureUnit myPBRSpecIBLMapTexUnit; //!< samplerCube occSpecIBLMap, texture unit where specular IBL map is expected to be binded (0 if PBR is not supported) Graphic3d_TextureUnit myPBRSpecIBLMapTexUnit; //!< samplerCube occSpecIBLMap, texture unit where specular IBL map is expected to be binded (0 if PBR is not supported)
Graphic3d_TextureUnit myShadowMapTexUnit; //!< sampler2D occShadowMapSampler Graphic3d_TextureUnit myShadowMapTexUnit; //!< sampler2D occShadowMapSampler
Graphic3d_TextureUnit myShadowCubeMapTexUnit; //!< samplerCube occShadowCubeMapSampler
Graphic3d_TextureUnit myDepthPeelingDepthTexUnit; //!< sampler2D occDepthPeelingDepth, texture unit for Depth Peeling lookups Graphic3d_TextureUnit myDepthPeelingDepthTexUnit; //!< sampler2D occDepthPeelingDepth, texture unit for Depth Peeling lookups
Graphic3d_TextureUnit myDepthPeelingFrontColorTexUnit; //!< sampler2D occDepthPeelingFrontColor, texture unit for Depth Peeling lookups Graphic3d_TextureUnit myDepthPeelingFrontColorTexUnit; //!< sampler2D occDepthPeelingFrontColor, texture unit for Depth Peeling lookups

View File

@@ -330,8 +330,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
const Graphic3d_Vec2i& theSize, const Graphic3d_Vec2i& theSize,
const OpenGl_ColorFormats& theColorFormats, const OpenGl_ColorFormats& theColorFormats,
const Standard_Integer theDepthFormat, const Standard_Integer theDepthFormat,
const Standard_Integer theNbSamples, const Standard_Integer theNbSamples)
const Standard_Boolean theIsCubeMap)
{ {
myColorFormats = theColorFormats; myColorFormats = theColorFormats;
@@ -424,10 +423,9 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
// extensions (GL_OES_packed_depth_stencil, GL_OES_depth_texture) + GL version might be used to determine supported formats // extensions (GL_OES_packed_depth_stencil, GL_OES_depth_texture) + GL version might be used to determine supported formats
// instead of just trying to create such texture // instead of just trying to create such texture
Graphic3d_TypeOfTexture aTypeOfTexture = theIsCubeMap ? Graphic3d_TypeOfTexture_CUBEMAP : Graphic3d_TypeOfTexture_2D;
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, myDepthFormat); const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, myDepthFormat);
if (aDepthFormat.IsValid() if (aDepthFormat.IsValid()
&& !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), aTypeOfTexture)) && !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
{ {
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH, theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
"Warning! Depth textures are not supported by hardware!"); "Warning! Depth textures are not supported by hardware!");
@@ -472,36 +470,15 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
{ {
if (hasDepthStencilAttach (theGlContext)) if (hasDepthStencilAttach (theGlContext))
{ {
if (theIsCubeMap) theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
{ myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X),
myDepthStencilTexture->TextureId(), 0);
}
else
{
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
}
} }
else else
{ {
if (theIsCubeMap) theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
{ myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X), myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
myDepthStencilTexture->TextureId(), 0);
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X),
myDepthStencilTexture->TextureId(), 0);
}
else
{
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
}
} }
} }
else if (myGlDepthRBufferId != NO_RENDERBUFFER) else if (myGlDepthRBufferId != NO_RENDERBUFFER)
@@ -522,17 +499,8 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
} }
} }
} }
const GLenum aRendImgErr = theGlContext->core11fwd->glGetError();
if (aRendImgErr != GL_NO_ERROR)
{
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
TCollection_AsciiString("Error: in setup of glFramebufferTexture2D: ") + OpenGl_Context::FormatGlError(aRendImgErr) + ".");
Release (theGlContext.get());
return Standard_False;
}
if (theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) if (theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{ {
std::cout << "\n\nIncomplete framebuffer: " << theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) << "\n\n";
Release (theGlContext.operator->()); Release (theGlContext.operator->());
return Standard_False; return Standard_False;
} }
@@ -939,30 +907,6 @@ void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId); theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
} }
// =======================================================================
// function : BindBufferCube
// purpose :
// =======================================================================
void OpenGl_FrameBuffer::BindBufferCube (const Handle(OpenGl_Context)& theGlCtx, const Standard_Integer theFace)
{
theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
if (hasDepthStencilAttach (theGlCtx))
{
theGlCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X + theFace),
myDepthStencilTexture->TextureId(), 0);
}
else
{
theGlCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X + theFace),
myDepthStencilTexture->TextureId(), 0);
theGlCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X + theFace),
myDepthStencilTexture->TextureId(), 0);
}
}
// ======================================================================= // =======================================================================
// function : UnbindBuffer // function : UnbindBuffer
// purpose : // purpose :
@@ -1013,8 +957,7 @@ inline void convertRowFromRgba (T* theRgbRow,
Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& theGlCtx, Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& theGlCtx,
const Handle(OpenGl_FrameBuffer)& theFbo, const Handle(OpenGl_FrameBuffer)& theFbo,
Image_PixMap& theImage, Image_PixMap& theImage,
Graphic3d_BufferType theBufferType, Graphic3d_BufferType theBufferType)
const Standard_Integer theCubeFace)
{ {
if (theGlCtx.IsNull() if (theGlCtx.IsNull()
|| theImage.IsEmpty()) || theImage.IsEmpty())
@@ -1176,38 +1119,6 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
return Standard_False; return Standard_False;
} }
if (theCubeFace >= 0)
{
theGlCtx->core11fwd->glBindTexture (GL_TEXTURE_CUBE_MAP, theFbo->DepthStencilTexture()->TextureId());
theFbo->BindBufferCube (theGlCtx, theCubeFace);
const GLint anAligment = Min(GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
theGlCtx->core11fwd->glPixelStorei (GL_PACK_ALIGNMENT, anAligment);
if (theGlCtx->hasPackRowLength)
{
theGlCtx->core11fwd->glPixelStorei (GL_PACK_ROW_LENGTH, 0);
}
theGlCtx->core11fwd->glGetTexImage (GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X + theCubeFace),
0, aFormat, aType, theImage.ChangeData());
const bool hasErrors = theGlCtx->ResetErrors (true);
if (hasErrors)
{
std::cout << "\nError saving cubemap face texture to image.\n";
return Standard_False;
}
theGlCtx->core11fwd->glPixelStorei (GL_PACK_ALIGNMENT, 1);
if (!theFbo.IsNull() && theFbo->IsValid())
{
theFbo->UnbindBuffer(theGlCtx);
}
else if (theGlCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
{
theGlCtx->core11fwd->glReadBuffer(aReadBufferPrev);
}
return Standard_True;
}
// bind FBO if used // bind FBO if used
if (!theFbo.IsNull() && theFbo->IsValid()) if (!theFbo.IsNull() && theFbo->IsValid())
{ {

View File

@@ -48,13 +48,11 @@ public:
//! @param theFbo FBO to dump (or window buffer, if NULL) //! @param theFbo FBO to dump (or window buffer, if NULL)
//! @param theImage target image //! @param theImage target image
//! @param theBufferType buffer type (attachment) to dump //! @param theBufferType buffer type (attachment) to dump
//! @param theCubeFace id of the cubemap face (only used for fbo's rendering to cubemaps)
//! @return TRUE on success //! @return TRUE on success
Standard_EXPORT static Standard_Boolean BufferDump (const Handle(OpenGl_Context)& theGlCtx, Standard_EXPORT static Standard_Boolean BufferDump (const Handle(OpenGl_Context)& theGlCtx,
const Handle(OpenGl_FrameBuffer)& theFbo, const Handle(OpenGl_FrameBuffer)& theFbo,
Image_PixMap& theImage, Image_PixMap& theImage,
Graphic3d_BufferType theBufferType, Graphic3d_BufferType theBufferType);
const Standard_Integer theCubeFace = -1);
public: public:
@@ -144,14 +142,12 @@ public:
//! @param theColorFormats list of color texture sized format (0 means no color attachment), e.g. GL_RGBA8 //! @param theColorFormats list of color texture sized format (0 means no color attachment), e.g. GL_RGBA8
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8 //! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
//! @param theNbSamples MSAA number of samples (0 means normal texture) //! @param theNbSamples MSAA number of samples (0 means normal texture)
//! @param theIsCubeMap flag to setup texture target to cubemap (FALSE by default)
//! @return true on success //! @return true on success
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theGlCtx, Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theGlCtx,
const Graphic3d_Vec2i& theSize, const Graphic3d_Vec2i& theSize,
const OpenGl_ColorFormats& theColorFormats, const OpenGl_ColorFormats& theColorFormats,
const Standard_Integer theDepthFormat, const Standard_Integer theDepthFormat,
const Standard_Integer theNbSamples = 0, const Standard_Integer theNbSamples = 0);
const Standard_Boolean theIsCubeMap = Standard_False);
//! (Re-)initialize FBO with specified dimensions. //! (Re-)initialize FBO with specified dimensions.
Standard_EXPORT Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx, Standard_EXPORT Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx,
@@ -229,9 +225,6 @@ public:
//! Bind frame buffer for reading GL_READ_FRAMEBUFFER //! Bind frame buffer for reading GL_READ_FRAMEBUFFER
Standard_EXPORT virtual void BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx); Standard_EXPORT virtual void BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx);
//! Bind frame buffer for reading cubemap with the target @theFace.
Standard_EXPORT virtual void BindBufferCube (const Handle(OpenGl_Context)& theGlCtx, const Standard_Integer theFace);
//! Unbind frame buffer. //! Unbind frame buffer.
Standard_EXPORT virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx); Standard_EXPORT virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx);

View File

@@ -15,7 +15,6 @@
#include <OpenGl_ShaderManager.hxx> #include <OpenGl_ShaderManager.hxx>
#include <Graphic3d_Camera.hxx>
#include <Graphic3d_CubeMapPacked.hxx> #include <Graphic3d_CubeMapPacked.hxx>
#include <Graphic3d_TextureParams.hxx> #include <Graphic3d_TextureParams.hxx>
#include <OpenGl_Aspects.hxx> #include <OpenGl_Aspects.hxx>
@@ -555,10 +554,9 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
// update shadow map variables // update shadow map variables
if (const OpenGl_ShaderUniformLocation aShadowMatLoc = theProgram->GetStateLocation (OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES)) if (const OpenGl_ShaderUniformLocation aShadowMatLoc = theProgram->GetStateLocation (OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES))
{ {
Standard_Integer aNbShadowMaps = theProgram->NbShadowMaps() + theProgram->NbShadowCubeMaps(); if (myShadowMatArray.Size() < theProgram->NbShadowMaps())
if (myShadowMatArray.Size() < aNbShadowMaps)
{ {
myShadowMatArray.Resize (0, aNbShadowMaps - 1, false); myShadowMatArray.Resize (0, theProgram->NbShadowMaps() - 1, false);
} }
Graphic3d_Vec2 aSizeBias; Graphic3d_Vec2 aSizeBias;
@@ -566,7 +564,7 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
{ {
aSizeBias.SetValues (1.0f / (float )myLightSourceState.ShadowMaps()->First()->Texture()->SizeX(), aSizeBias.SetValues (1.0f / (float )myLightSourceState.ShadowMaps()->First()->Texture()->SizeX(),
myLightSourceState.ShadowMaps()->First()->ShadowMapBias()); myLightSourceState.ShadowMaps()->First()->ShadowMapBias());
const Standard_Integer aNbShadows = Min (aNbShadowMaps, myLightSourceState.ShadowMaps()->Size()); const Standard_Integer aNbShadows = Min (theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size());
for (Standard_Integer aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter) for (Standard_Integer aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter)
{ {
const Handle(OpenGl_ShadowMap)& aShadow = myLightSourceState.ShadowMaps()->Value (aShadowIter); const Handle(OpenGl_ShadowMap)& aShadow = myLightSourceState.ShadowMaps()->Value (aShadowIter);
@@ -574,28 +572,9 @@ void OpenGl_ShaderManager::pushLightSourceState (const Handle(OpenGl_ShaderProgr
} }
} }
theProgram->SetUniform (myContext, aShadowMatLoc, aNbShadowMaps, &myShadowMatArray.First()); theProgram->SetUniform (myContext, aShadowMatLoc, theProgram->NbShadowMaps(), &myShadowMatArray.First());
theProgram->SetUniform (myContext, theProgram->GetStateLocation (OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS), aSizeBias); theProgram->SetUniform (myContext, theProgram->GetStateLocation (OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS), aSizeBias);
} }
if (const OpenGl_ShaderUniformLocation aShadowRangeLoc = theProgram->GetStateLocation (OpenGl_OCC_LIGHT_SHADOWMAP_RANGEPARAMS))
{
Standard_Integer aNbShadowMaps = theProgram->NbShadowMaps() + theProgram->NbShadowCubeMaps();
if (myShadowRangeArray.Size() < aNbShadowMaps)
{
myShadowRangeArray.Resize (0, aNbShadowMaps - 1, false);
}
if (myLightSourceState.HasShadowMaps())
{
const Standard_Integer aNbShadows = Min (aNbShadowMaps, myLightSourceState.ShadowMaps()->Size());
for (Standard_Integer aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter)
{
const Handle(OpenGl_ShadowMap)& aShadow = myLightSourceState.ShadowMaps()->Value (aShadowIter);
myShadowRangeArray[aShadowIter] = Graphic3d_Vec2 (aShadow->Camera()->ZNear(), aShadow->Camera()->ZFar());
}
}
theProgram->SetUniform (myContext, aShadowRangeLoc, aNbShadowMaps, &myShadowRangeArray.First());
}
} }
// ======================================================================= // =======================================================================
@@ -1250,16 +1229,10 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
const Standard_Boolean theIsFlatNormal, const Standard_Boolean theIsFlatNormal,
const Standard_Boolean theIsPBR) const Standard_Boolean theIsPBR)
{ {
Standard_Integer aNbShadowMaps, aNbShadowCubeMaps; Standard_Integer aNbShadowMaps = myLightSourceState.HasShadowMaps()
myLightSourceState.LightSources()->CalculateNbShadows (aNbShadowMaps, aNbShadowCubeMaps); ? myLightSourceState.LightSources()->NbCastShadows()
// point light shadows are not currently supported on opengles 2.0. : 0;
if (myContext->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES Handle(Graphic3d_ShaderProgram) aProgramSrc = getStdProgramPhong (myLightSourceState.LightSources(), theBits, theIsFlatNormal, theIsPBR, aNbShadowMaps);
&& myContext->VersionMajor() <= 2)
{
aNbShadowCubeMaps = 0;
}
Handle(Graphic3d_ShaderProgram) aProgramSrc = getStdProgramPhong (myLightSourceState.LightSources(), theBits, theIsFlatNormal,
theIsPBR, aNbShadowMaps, aNbShadowCubeMaps);
TCollection_AsciiString aKey; TCollection_AsciiString aKey;
if (!Create (aProgramSrc, aKey, theProgram)) if (!Create (aProgramSrc, aKey, theProgram))
{ {

View File

@@ -801,7 +801,6 @@ protected:
mutable NCollection_Array1<Standard_Integer> myLightTypeArray; mutable NCollection_Array1<Standard_Integer> myLightTypeArray;
mutable NCollection_Array1<OpenGl_ShaderLightParameters> myLightParamsArray; mutable NCollection_Array1<OpenGl_ShaderLightParameters> myLightParamsArray;
mutable NCollection_Array1<Graphic3d_Mat4> myShadowMatArray; mutable NCollection_Array1<Graphic3d_Mat4> myShadowMatArray;
mutable NCollection_Array1<Graphic3d_Vec2> myShadowRangeArray;
mutable NCollection_Array1<OpenGl_Vec4> myClipPlaneArray; mutable NCollection_Array1<OpenGl_Vec4> myClipPlaneArray;
mutable NCollection_Array1<OpenGl_Vec4d> myClipPlaneArrayFfp; mutable NCollection_Array1<OpenGl_Vec4d> myClipPlaneArrayFfp;
mutable NCollection_Array1<Standard_Integer> myClipChainArray; mutable NCollection_Array1<Standard_Integer> myClipChainArray;

View File

@@ -50,45 +50,43 @@ Standard_CString OpenGl_ShaderProgram::PredefinedKeywords[] =
"occWorldViewMatrixInverseTranspose", // OpenGl_OCC_WORLD_VIEW_MATRIX_INVERSE_TRANSPOSE "occWorldViewMatrixInverseTranspose", // OpenGl_OCC_WORLD_VIEW_MATRIX_INVERSE_TRANSPOSE
"occProjectionMatrixInverseTranspose", // OpenGl_OCC_PROJECTION_MATRIX_INVERSE_TRANSPOSE "occProjectionMatrixInverseTranspose", // OpenGl_OCC_PROJECTION_MATRIX_INVERSE_TRANSPOSE
"occClipPlaneEquations", // OpenGl_OCC_CLIP_PLANE_EQUATIONS "occClipPlaneEquations", // OpenGl_OCC_CLIP_PLANE_EQUATIONS
"occClipPlaneChains", // OpenGl_OCC_CLIP_PLANE_CHAINS "occClipPlaneChains", // OpenGl_OCC_CLIP_PLANE_CHAINS
"occClipPlaneCount", // OpenGl_OCC_CLIP_PLANE_COUNT "occClipPlaneCount", // OpenGl_OCC_CLIP_PLANE_COUNT
"occLightSourcesCount", // OpenGl_OCC_LIGHT_SOURCE_COUNT "occLightSourcesCount", // OpenGl_OCC_LIGHT_SOURCE_COUNT
"occLightSourcesTypes", // OpenGl_OCC_LIGHT_SOURCE_TYPES "occLightSourcesTypes", // OpenGl_OCC_LIGHT_SOURCE_TYPES
"occLightSources", // OpenGl_OCC_LIGHT_SOURCE_PARAMS "occLightSources", // OpenGl_OCC_LIGHT_SOURCE_PARAMS
"occLightAmbient", // OpenGl_OCC_LIGHT_AMBIENT "occLightAmbient", // OpenGl_OCC_LIGHT_AMBIENT
"occShadowMapSizeBias", // OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS "occShadowMapSizeBias", // OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS
"occShadowMapSamplers", // OpenGl_OCC_LIGHT_SHADOWMAP_SAMPLERS, "occShadowMapSamplers", // OpenGl_OCC_LIGHT_SHADOWMAP_SAMPLERS,
"occShadowCubeMapSamplers", // OpenGl_OCC_LIGHT_SHADOWCUBEMAP_SAMPLERS, "occShadowMapMatrices", // OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES,
"occShadowMapMatrices", // OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES,
"occShadowMapRangeParams", // OpenGl_OCC_LIGHT_SHADOWMAP_RANGEPARAMS,
"occTextureEnable", // OpenGl_OCCT_TEXTURE_ENABLE "occTextureEnable", // OpenGl_OCCT_TEXTURE_ENABLE
"occDistinguishingMode", // OpenGl_OCCT_DISTINGUISH_MODE "occDistinguishingMode", // OpenGl_OCCT_DISTINGUISH_MODE
"occPbrMaterial", // OpenGl_OCCT_PBR_MATERIAL "occPbrMaterial", // OpenGl_OCCT_PBR_MATERIAL
"occCommonMaterial", // OpenGl_OCCT_COMMON_MATERIAL "occCommonMaterial", // OpenGl_OCCT_COMMON_MATERIAL
"occAlphaCutoff", // OpenGl_OCCT_ALPHA_CUTOFF "occAlphaCutoff", // OpenGl_OCCT_ALPHA_CUTOFF
"occColor", // OpenGl_OCCT_COLOR "occColor", // OpenGl_OCCT_COLOR
"occOitOutput", // OpenGl_OCCT_OIT_OUTPUT "occOitOutput", // OpenGl_OCCT_OIT_OUTPUT
"occOitDepthFactor", // OpenGl_OCCT_OIT_DEPTH_FACTOR "occOitDepthFactor", // OpenGl_OCCT_OIT_DEPTH_FACTOR
"occTexTrsf2d", // OpenGl_OCCT_TEXTURE_TRSF2D "occTexTrsf2d", // OpenGl_OCCT_TEXTURE_TRSF2D
"occPointSize", // OpenGl_OCCT_POINT_SIZE "occPointSize", // OpenGl_OCCT_POINT_SIZE
"occViewport", // OpenGl_OCCT_VIEWPORT "occViewport", // OpenGl_OCCT_VIEWPORT
"occLineWidth", // OpenGl_OCCT_LINE_WIDTH "occLineWidth", // OpenGl_OCCT_LINE_WIDTH
"occLineFeather", // OpenGl_OCCT_LINE_FEATHER "occLineFeather", // OpenGl_OCCT_LINE_FEATHER
"occStipplePattern", // OpenGl_OCCT_LINE_STIPPLE_PATTERN "occStipplePattern", // OpenGl_OCCT_LINE_STIPPLE_PATTERN
"occStippleFactor", // OpenGl_OCCT_LINE_STIPPLE_FACTOR "occStippleFactor", // OpenGl_OCCT_LINE_STIPPLE_FACTOR
"occWireframeColor", // OpenGl_OCCT_WIREFRAME_COLOR "occWireframeColor", // OpenGl_OCCT_WIREFRAME_COLOR
"occIsQuadMode", // OpenGl_OCCT_QUAD_MODE_STATE "occIsQuadMode", // OpenGl_OCCT_QUAD_MODE_STATE
"occOrthoScale", // OpenGl_OCCT_ORTHO_SCALE "occOrthoScale", // OpenGl_OCCT_ORTHO_SCALE
"occSilhouetteThickness", // OpenGl_OCCT_SILHOUETTE_THICKNESS "occSilhouetteThickness", // OpenGl_OCCT_SILHOUETTE_THICKNESS
"occNbSpecIBLLevels" // OpenGl_OCCT_NB_SPEC_IBL_LEVELS "occNbSpecIBLLevels" // OpenGl_OCCT_NB_SPEC_IBL_LEVELS
}; };
namespace namespace
@@ -167,7 +165,6 @@ OpenGl_ShaderProgram::OpenGl_ShaderProgram (const Handle(Graphic3d_ShaderProgram
myShareCount(1), myShareCount(1),
myNbLightsMax (0), myNbLightsMax (0),
myNbShadowMaps (0), myNbShadowMaps (0),
myNbShadowCubeMaps (0),
myNbClipPlanesMax (0), myNbClipPlanesMax (0),
myNbFragOutputs (1), myNbFragOutputs (1),
myTextureSetBits (Graphic3d_TextureSetBits_NONE), myTextureSetBits (Graphic3d_TextureSetBits_NONE),
@@ -422,24 +419,15 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
} }
TCollection_AsciiString aHeaderConstants; TCollection_AsciiString aHeaderConstants;
myNbLightsMax = !myProxy.IsNull() ? myProxy->NbLightsMax() : 0; myNbLightsMax = !myProxy.IsNull() ? myProxy->NbLightsMax() : 0;
myNbShadowMaps = !myProxy.IsNull() ? myProxy->NbShadowMaps() : 0; myNbShadowMaps = !myProxy.IsNull() ? myProxy->NbShadowMaps() : 0;
myNbShadowCubeMaps = !myProxy.IsNull() ? myProxy->NbShadowCubeMaps() : 0; myNbClipPlanesMax = !myProxy.IsNull() ? myProxy->NbClipPlanesMax() : 0;
myNbClipPlanesMax = !myProxy.IsNull() ? myProxy->NbClipPlanesMax() : 0;
aHeaderConstants += TCollection_AsciiString("#define THE_MAX_LIGHTS ") + myNbLightsMax + "\n"; aHeaderConstants += TCollection_AsciiString("#define THE_MAX_LIGHTS ") + myNbLightsMax + "\n";
aHeaderConstants += TCollection_AsciiString("#define THE_MAX_CLIP_PLANES ") + myNbClipPlanesMax + "\n"; aHeaderConstants += TCollection_AsciiString("#define THE_MAX_CLIP_PLANES ") + myNbClipPlanesMax + "\n";
aHeaderConstants += TCollection_AsciiString("#define THE_NB_FRAG_OUTPUTS ") + myNbFragOutputs + "\n"; aHeaderConstants += TCollection_AsciiString("#define THE_NB_FRAG_OUTPUTS ") + myNbFragOutputs + "\n";
if (myNbShadowMaps + myNbShadowCubeMaps > 0)
{
aHeaderConstants += TCollection_AsciiString("#define THE_NB_SHADOWMAPS ") + (myNbShadowMaps + myNbShadowCubeMaps) + "\n";
}
if (myNbShadowMaps > 0) if (myNbShadowMaps > 0)
{ {
aHeaderConstants += TCollection_AsciiString("#define THE_NB_SHADOWMAPS2D ") + myNbShadowMaps + "\n"; aHeaderConstants += TCollection_AsciiString("#define THE_NB_SHADOWMAPS ") + myNbShadowMaps + "\n";
}
if (myNbShadowCubeMaps > 0)
{
aHeaderConstants += TCollection_AsciiString("#define THE_NB_SHADOWMAPSCUBE ") + myNbShadowCubeMaps + "\n";
} }
if (theCtx->caps->useZeroToOneDepth if (theCtx->caps->useZeroToOneDepth
&& theCtx->arbClipControl) && theCtx->arbClipControl)
@@ -602,16 +590,7 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
} }
SetUniform (theCtx, aLocSampler, myNbShadowMaps, &aShadowSamplers.front()); SetUniform (theCtx, aLocSampler, myNbShadowMaps, &aShadowSamplers.front());
} }
if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation (theCtx, "occShadowCubeMapSamplers"))
{
std::vector<GLint> aShadowSamplers (myNbShadowCubeMaps);
const GLint aSamplFrom = GLint(theCtx->ShadowCubeMapTexUnit()) - myNbShadowCubeMaps + 1;
for (Standard_Integer aSamplerIter = 0; aSamplerIter < myNbShadowCubeMaps; ++aSamplerIter)
{
aShadowSamplers[aSamplerIter] = aSamplFrom + aSamplerIter;
}
SetUniform (theCtx, aLocSampler, myNbShadowCubeMaps, &aShadowSamplers.front());
}
if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation (theCtx, "occDepthPeelingDepth")) if (const OpenGl_ShaderUniformLocation aLocSampler = GetUniformLocation (theCtx, "occDepthPeelingDepth"))
{ {
SetUniform (theCtx, aLocSampler, GLint(theCtx->DepthPeelingDepthTexUnit())); SetUniform (theCtx, aLocSampler, GLint(theCtx->DepthPeelingDepthTexUnit()));

View File

@@ -57,11 +57,9 @@ enum OpenGl_StateVariable
OpenGl_OCC_LIGHT_SOURCE_TYPES, OpenGl_OCC_LIGHT_SOURCE_TYPES,
OpenGl_OCC_LIGHT_SOURCE_PARAMS, OpenGl_OCC_LIGHT_SOURCE_PARAMS,
OpenGl_OCC_LIGHT_AMBIENT, OpenGl_OCC_LIGHT_AMBIENT,
OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS, // occShadowMapSizeBias OpenGl_OCC_LIGHT_SHADOWMAP_SIZE_BIAS,// occShadowMapSizeBias
OpenGl_OCC_LIGHT_SHADOWMAP_SAMPLERS, // occShadowMapSamplers OpenGl_OCC_LIGHT_SHADOWMAP_SAMPLERS, // occShadowMapSamplers
OpenGl_OCC_LIGHT_SHADOWCUBEMAP_SAMPLERS, // occShadowCubeMapSamplers OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES, // occShadowMapMatrices
OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES, // occShadowMapMatrices
OpenGl_OCC_LIGHT_SHADOWMAP_RANGEPARAMS, // occShadowMapRangeParams
// Material state // Material state
OpenGl_OCCT_TEXTURE_ENABLE, OpenGl_OCCT_TEXTURE_ENABLE,
@@ -285,12 +283,9 @@ public:
//! to be used for initialization occLightSources (OpenGl_OCC_LIGHT_SOURCE_PARAMS). //! to be used for initialization occLightSources (OpenGl_OCC_LIGHT_SOURCE_PARAMS).
Standard_Integer NbLightsMax() const { return myNbLightsMax; } Standard_Integer NbLightsMax() const { return myNbLightsMax; }
//! Return the length of array of 2D shadow maps (THE_NB_SHADOWMAP2D); 0 by default. //! Return the length of array of shadow maps (THE_NB_SHADOWMAPS); 0 by default.
Standard_Integer NbShadowMaps() const { return myNbShadowMaps; } Standard_Integer NbShadowMaps() const { return myNbShadowMaps; }
//! Return the length of array of shadow cube maps (THE_NB_SHADOWMAPCUBE); 0 by default.
Standard_Integer NbShadowCubeMaps() const { return myNbShadowCubeMaps; }
//! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES), //! Return the length of array of clipping planes (THE_MAX_CLIP_PLANES),
//! to be used for initialization occClipPlaneEquations (OpenGl_OCC_CLIP_PLANE_EQUATIONS) and occClipPlaneChains (OpenGl_OCC_CLIP_PLANE_CHAINS). //! to be used for initialization occClipPlaneEquations (OpenGl_OCC_CLIP_PLANE_EQUATIONS) and occClipPlaneChains (OpenGl_OCC_CLIP_PLANE_CHAINS).
Standard_Integer NbClipPlanesMax() const { return myNbClipPlanesMax; } Standard_Integer NbClipPlanesMax() const { return myNbClipPlanesMax; }
@@ -648,19 +643,18 @@ protected:
protected: protected:
GLuint myProgramID; //!< Handle of OpenGL shader program GLuint myProgramID; //!< Handle of OpenGL shader program
OpenGl_ShaderList myShaderObjects; //!< List of attached shader objects OpenGl_ShaderList myShaderObjects; //!< List of attached shader objects
Handle(Graphic3d_ShaderProgram) myProxy; //!< Proxy shader program (from application layer) Handle(Graphic3d_ShaderProgram) myProxy; //!< Proxy shader program (from application layer)
Standard_Integer myShareCount; //!< program users count, initialized with 1 (already shared by one user) Standard_Integer myShareCount; //!< program users count, initialized with 1 (already shared by one user)
Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS) Standard_Integer myNbLightsMax; //!< length of array of light sources (THE_MAX_LIGHTS)
Standard_Integer myNbShadowMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAP2D) Standard_Integer myNbShadowMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAPS)
Standard_Integer myNbShadowCubeMaps; //!< length of array of shadow maps (THE_NB_SHADOWMAPCUBE) Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES)
Standard_Integer myNbClipPlanesMax; //!< length of array of clipping planes (THE_MAX_CLIP_PLANES) Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS)
Standard_Integer myNbFragOutputs; //!< length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS) Standard_Integer myTextureSetBits;//!< texture units declared within the program, @sa Graphic3d_TextureSetBits
Standard_Integer myTextureSetBits; //!< texture units declared within the program, @sa Graphic3d_TextureSetBits Graphic3d_RenderTransparentMethod myOitOutput; //!< flag indicating that Fragment Shader includes OIT outputs
Graphic3d_RenderTransparentMethod myOitOutput; //!< flag indicating that Fragment Shader includes OIT outputs Standard_Boolean myHasAlphaTest; //!< flag indicating that Fragment Shader should perform alpha-test
Standard_Boolean myHasAlphaTest; //!< flag indicating that Fragment Shader should perform alpha-test Standard_Boolean myHasTessShader; //!< flag indicating that program defines tessellation stage
Standard_Boolean myHasTessShader; //!< flag indicating that program defines tessellation stage
protected: protected:

View File

@@ -83,8 +83,7 @@ const Handle(OpenGl_Texture)& OpenGl_ShadowMap::Texture() const
// purpose : // purpose :
// ======================================================================= // =======================================================================
bool OpenGl_ShadowMap::UpdateCamera (const Graphic3d_CView& theView, bool OpenGl_ShadowMap::UpdateCamera (const Graphic3d_CView& theView,
const gp_XYZ* theOrigin, const gp_XYZ* theOrigin)
const Standard_Integer theFace)
{ {
const Bnd_Box aMinMaxBox = theOrigin == NULL ? theView.MinMaxValues (false) : Bnd_Box(); // applicative min max boundaries const Bnd_Box aMinMaxBox = theOrigin == NULL ? theView.MinMaxValues (false) : Bnd_Box(); // applicative min max boundaries
const Bnd_Box aGraphicBox = aMinMaxBox; const Bnd_Box aGraphicBox = aMinMaxBox;
@@ -135,18 +134,7 @@ bool OpenGl_ShadowMap::UpdateCamera (const Graphic3d_CView& theView,
case Graphic3d_TypeOfLightSource_Positional: case Graphic3d_TypeOfLightSource_Positional:
{ {
// render into cubemap shadowmap texture // render into cubemap shadowmap texture
myShadowCamera->SetZeroToOneDepth (theView.Camera()->IsZeroToOneDepth()); return false; // not implemented
myShadowCamera->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
myShadowCamera->SetFOVy (90.0);
myShadowCamera->MoveEyeTo (myShadowLight->Position());
// calculate direction and up vector for the given cubemap face
myShadowCamera->SetDirectionFromEye (Graphic3d_CubeMap::GetCubeDirection ((Graphic3d_CubeMapSide)theFace));
myShadowCamera->SetUp (Graphic3d_CubeMap::GetCubeUp ((Graphic3d_CubeMapSide)theFace));
// setup znear and zfar (default value)
myShadowCamera->SetZRange (1.0, myShadowLight->Range() <= 1.0 ? Graphic3d_Camera::GetDefaultZFar() : myShadowLight->Range());
myLightMatrix = myShadowCamera->ProjectionMatrixF() * myShadowCamera->OrientationMatrixF();
return true;
} }
case Graphic3d_TypeOfLightSource_Spot: case Graphic3d_TypeOfLightSource_Spot:
{ {

View File

@@ -76,10 +76,8 @@ public:
//! Compute camera. //! Compute camera.
//! @param theView [in] active view //! @param theView [in] active view
//! @param theOrigin [in] when not-NULL - displace shadow map camera to specified Z-Layer origin //! @param theOrigin [in] when not-NULL - displace shadow map camera to specified Z-Layer origin
//! @param theFace [in] if light is point light calculate for given cubemap face index
Standard_EXPORT bool UpdateCamera (const Graphic3d_CView& theView, Standard_EXPORT bool UpdateCamera (const Graphic3d_CView& theView,
const gp_XYZ* theOrigin = NULL, const gp_XYZ* theOrigin = NULL);
const Standard_Integer theFace = -1);
private: private:

View File

@@ -443,6 +443,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
return false; return false;
} }
} }
theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat, theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
theSizeXYZ.x(), theSizeXYZ.y(), 0, theSizeXYZ.x(), theSizeXYZ.y(), 0,
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr); theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
@@ -519,48 +520,9 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
} }
case Graphic3d_TypeOfTexture_CUBEMAP: case Graphic3d_TypeOfTexture_CUBEMAP:
{ {
Bind (theCtx); Unbind (theCtx);
applyDefaultSamplerParams (theCtx); Release (theCtx.get());
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL) return false;
{
// use proxy to check texture could be created or not
theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_CUBE_MAP, 0, anIntFormat,
theSizeXYZ.x(), theSizeXYZ.y(), 0,
theFormat.PixelFormat(), theFormat.DataType(), NULL);
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_WIDTH, &aTestWidth);
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
if (aTestWidth == 0 || aTestHeight == 0)
{
// no memory or broken input parameters
Unbind(theCtx);
Release(theCtx.get());
return false;
}
}
for (Standard_Integer aCubeIndex = 0; aCubeIndex < 6; ++aCubeIndex)
{
theCtx->core11fwd->glTexImage2D (GLenum(GL_TEXTURE_CUBE_MAP_POSITIVE_X + aCubeIndex), 0, anIntFormat,
theSizeXYZ.x(), theSizeXYZ.y(), 0,
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
GLenum anErr = theCtx->core11fwd->glGetError();
if (anErr != GL_NO_ERROR)
{
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
TCollection_AsciiString ("Error: Cubemap texture ") + theSizeXYZ.x() + "x" + theSizeXYZ.y()
+ " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
+ " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
+ " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
+ " can not be created with error " + OpenGl_Context::FormatGlError (anErr)
+ " [" + myResourceId + "]");
Unbind (theCtx);
Release (theCtx.get());
return false;
}
}
mySize.SetValues (theSizeXYZ.xy(), 1);
break;
} }
} }

View File

@@ -1583,73 +1583,31 @@ bool OpenGl_View::prepareFrameBuffers (Graphic3d_Camera::Projection& theProj)
&& myRenderParams.Method != Graphic3d_RM_RAYTRACING; && myRenderParams.Method != Graphic3d_RM_RAYTRACING;
if (toUseShadowMap) if (toUseShadowMap)
{ {
Standard_Integer aNbShadows = 0;
Standard_Integer aNbPointShadows = 0;
Standard_Boolean aToReviewLights = Standard_False;
for (Graphic3d_LightSet::Iterator aLightIter(myLights); aLightIter.More(); aLightIter.Next())
{
Handle(Graphic3d_CLight) aLight = aLightIter.Value();
if (aLight->Type() == Graphic3d_TypeOfLightSource_Positional)
{
// point lights shadows are not currently supported on opengles 2.0
if (aCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
&& aCtx->VersionMajor() <= 2)
{
aLight->SetCastShadows (Standard_False);
aToReviewLights = Standard_True;
}
else if (aLight->ToCastShadows())
{
++aNbPointShadows;
}
}
else
{
if (aLight->ToCastShadows())
{
++aNbShadows;
}
}
}
if (aToReviewLights)
{
myLights->UpdateRevision();
}
if (myShadowMaps->Size() != myLights->NbCastShadows()) if (myShadowMaps->Size() != myLights->NbCastShadows())
{ {
myShadowMaps->Release (aCtx.get()); myShadowMaps->Release (aCtx.get());
myShadowMaps->Resize (0, myLights->NbCastShadows() - 1, true); myShadowMaps->Resize (0, myLights->NbCastShadows() - 1, true);
} }
const GLint aSampleFrom = GLint(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + aNbPointShadows + 1;
const GLint aSampleCubeFrom = GLint(aCtx->ShadowCubeMapTexUnit()) - aNbPointShadows + 1; const GLint aSamplFrom = GLint(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1;
Standard_Integer aLightIndex = 0; for (Standard_Integer aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter)
Standard_Integer a2DShadowIndex = 0;
Standard_Integer aCubeShadowIndex = 0;
for (Graphic3d_LightSet::Iterator aLightIter(myLights); aLightIter.More(); aLightIter.Next())
{ {
Handle(Graphic3d_CLight) aLight = aLightIter.Value(); Handle(OpenGl_ShadowMap)& aShadow = myShadowMaps->ChangeValue (aShadowIter);
if (aLight->ToCastShadows()) if (aShadow.IsNull())
{ {
Handle(OpenGl_ShadowMap)& aShadow = myShadowMaps->ChangeValue (aLightIndex++); aShadow = new OpenGl_ShadowMap();
if (aShadow.IsNull()) }
aShadow->SetShadowMapBias (myRenderParams.ShadowMapBias);
aShadow->Texture()->Sampler()->Parameters()->SetTextureUnit ((Graphic3d_TextureUnit )(aSamplFrom + aShadowIter));
const Handle(OpenGl_FrameBuffer)& aShadowFbo = aShadow->FrameBuffer();
if (aShadowFbo->GetVPSizeX() != myRenderParams.ShadowMapResolution
&& toUseShadowMap)
{
OpenGl_ColorFormats aDummy;
if (!aShadowFbo->Init (aCtx, Graphic3d_Vec2i (myRenderParams.ShadowMapResolution), aDummy, myFboDepthFormat, 0))
{ {
aShadow = new OpenGl_ShadowMap(); toUseShadowMap = false;
}
aShadow->SetShadowMapBias (myRenderParams.ShadowMapBias);
Standard_Integer aTexUnit = aLight->Type() == Graphic3d_TypeOfLightSource_Positional
? aSampleCubeFrom + aCubeShadowIndex++
: aSampleFrom + a2DShadowIndex++;
aShadow->Texture()->Sampler()->Parameters()->SetTextureUnit ((Graphic3d_TextureUnit)(aTexUnit));
const Handle(OpenGl_FrameBuffer)& aShadowFbo = aShadow->FrameBuffer();
if (aShadowFbo->GetVPSizeX() != myRenderParams.ShadowMapResolution
&& toUseShadowMap)
{
OpenGl_ColorFormats aDummy;
if (!aShadowFbo->Init (aCtx, Graphic3d_Vec2i(myRenderParams.ShadowMapResolution), aDummy, myFboDepthFormat, 0,
aLight->Type() == Graphic3d_TypeOfLightSource_Positional))
{
toUseShadowMap = false;
}
} }
} }
} }
@@ -1730,22 +1688,7 @@ void OpenGl_View::Redraw()
{ {
const Handle(OpenGl_ShadowMap)& aShadowMap = myShadowMaps->ChangeValue (aShadowIndex); const Handle(OpenGl_ShadowMap)& aShadowMap = myShadowMaps->ChangeValue (aShadowIndex);
aShadowMap->SetLightSource (aLight); aShadowMap->SetLightSource (aLight);
if (aLight->Type() == Graphic3d_TypeOfLightSource_Positional) renderShadowMap (aShadowMap);
{
// cube shadow maps are not currently working on opengles 2.0.
if (aCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES
|| aCtx->VersionMajor() >= 3)
{
for (Standard_Integer aCubeFace = 0; aCubeFace < 6; ++aCubeFace)
{
renderShadowMap (aShadowMap, aCubeFace);
}
}
}
else
{
renderShadowMap (aShadowMap, -1);
}
++aShadowIndex; ++aShadowIndex;
} }
} }
@@ -2354,11 +2297,10 @@ bool OpenGl_View::blitSubviews (const Graphic3d_Camera::Projection ,
//function : renderShadowMap //function : renderShadowMap
//purpose : //purpose :
//======================================================================= //=======================================================================
void OpenGl_View::renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap, void OpenGl_View::renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap)
const Standard_Integer theFace)
{ {
const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext(); const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext();
if (!theShadowMap->UpdateCamera (*this, NULL, theFace)) if (!theShadowMap->UpdateCamera (*this))
{ {
return; return;
} }
@@ -2377,14 +2319,7 @@ void OpenGl_View::renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap,
aCtx->ShaderManager()->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit); aCtx->ShaderManager()->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
const Handle(OpenGl_FrameBuffer)& aShadowBuffer = theShadowMap->FrameBuffer(); const Handle(OpenGl_FrameBuffer)& aShadowBuffer = theShadowMap->FrameBuffer();
if (theFace < 0) aShadowBuffer->BindBuffer (aCtx);
{
aShadowBuffer->BindBuffer (aCtx);
}
else
{
aShadowBuffer->BindBufferCube (aCtx, theFace);
}
aShadowBuffer->SetupViewport (aCtx); aShadowBuffer->SetupViewport (aCtx);
aCtx->SetColorMask (false); aCtx->SetColorMask (false);
@@ -2394,9 +2329,9 @@ void OpenGl_View::renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap,
myWorkspace->UseZBuffer() = true; myWorkspace->UseZBuffer() = true;
myWorkspace->UseDepthWrite() = true; myWorkspace->UseDepthWrite() = true;
aCtx->core11fwd->glDepthFunc (GL_LEQUAL); aCtx->core11fwd->glDepthFunc (GL_LEQUAL);
aCtx->core11fwd->glDepthMask (GL_TRUE);
aCtx->core11fwd->glEnable (GL_DEPTH_TEST); aCtx->core11fwd->glEnable (GL_DEPTH_TEST);
aCtx->core11fwd->glClearDepth (1.0); aCtx->core11fwd->glClearDepth (1.0);
aCtx->core11fwd->glDepthMask (GL_TRUE);
aCtx->core11fwd->glClear (GL_DEPTH_BUFFER_BIT); aCtx->core11fwd->glClear (GL_DEPTH_BUFFER_BIT);
Graphic3d_Camera::Projection aProjection = theShadowMap->LightSource()->Type() == Graphic3d_TypeOfLightSource_Directional Graphic3d_Camera::Projection aProjection = theShadowMap->LightSource()->Type() == Graphic3d_TypeOfLightSource_Directional
@@ -2410,9 +2345,10 @@ void OpenGl_View::renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap,
myWorkspace->ResetAppliedAspect(); myWorkspace->ResetAppliedAspect();
aCtx->BindProgram (Handle(OpenGl_ShaderProgram)()); aCtx->BindProgram (Handle(OpenGl_ShaderProgram)());
//Image_AlienPixMap anImage; anImage.InitZero (Image_Format_GrayF, aShadowBuffer->GetVPSizeX(), aShadowBuffer->GetVPSizeY()); //Image_AlienPixMap anImage; anImage.InitZero (Image_Format_Gray, aShadowBuffer->GetVPSizeX(), aShadowBuffer->GetVPSizeY());
//OpenGl_FrameBuffer::BufferDump (aCtx, aShadowBuffer, anImage, Graphic3d_BT_Depth); //OpenGl_FrameBuffer::BufferDump (aCtx, aShadowBuffer, anImage, Graphic3d_BT_Depth);
//anImage.Save (TCollection_AsciiString("shadow") + theShadowMap->Texture()->Sampler()->Parameters()->TextureUnit() + ".png"); //anImage.Save (TCollection_AsciiString ("shadow") + theShadowMap->Texture()->Sampler()->Parameters()->TextureUnit() + ".png");
bindDefaultFbo(); bindDefaultFbo();
} }

View File

@@ -354,9 +354,7 @@ protected: //! @name Rendering of GL graphics (with prepared drawing buffer).
//! Renders the graphical contents of the view into the preprepared shadowmap framebuffer. //! Renders the graphical contents of the view into the preprepared shadowmap framebuffer.
//! @param theShadowMap [in] the framebuffer for rendering shadowmap. //! @param theShadowMap [in] the framebuffer for rendering shadowmap.
//! @param theFace [in] value for cubemap face. Standard_EXPORT virtual void renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap);
Standard_EXPORT virtual void renderShadowMap (const Handle(OpenGl_ShadowMap)& theShadowMap,
const Standard_Integer theFace);
//! Renders the graphical contents of the view into the preprepared window or framebuffer. //! Renders the graphical contents of the view into the preprepared window or framebuffer.
//! @param theProjection [in] the projection that should be used for rendering. //! @param theProjection [in] the projection that should be used for rendering.

View File

@@ -91,14 +91,7 @@ void RWStepBasic_RWProduct::WriteStep
// --- own field : description --- // --- own field : description ---
if (!ent->Description().IsNull()) SW.Send(ent->Description());
{
SW.Send(ent->Description());
}
else
{
SW.SendUndef();
}
// --- own field : frameOfReference --- // --- own field : frameOfReference ---

View File

@@ -78,14 +78,7 @@ void RWStepBasic_RWProductDefinition::WriteStep
// --- own field : description --- // --- own field : description ---
if (!ent->Description().IsNull()) SW.Send(ent->Description());
{
SW.Send(ent->Description());
}
else
{
SW.SendUndef();
}
// --- own field : formation --- // --- own field : formation ---

View File

@@ -71,14 +71,7 @@ void RWStepBasic_RWProductDefinitionFormation::WriteStep
// --- own field : description --- // --- own field : description ---
if (!ent->Description().IsNull()) SW.Send(ent->Description());
{
SW.Send(ent->Description());
}
else
{
SW.SendUndef();
}
// --- own field : ofProduct --- // --- own field : ofProduct ---

View File

@@ -2553,36 +2553,11 @@ static Standard_Boolean ReadDatums(const Handle(XCAFDoc_ShapeTool) &STool,
const Handle(StepDimTol_GeometricToleranceWithDatumReference)& GTWDR) const Handle(StepDimTol_GeometricToleranceWithDatumReference)& GTWDR)
{ {
if (GTWDR.IsNull()) return Standard_False; if (GTWDR.IsNull()) return Standard_False;
Handle(StepDimTol_HArray1OfDatumSystemOrReference) aHADSOR = GTWDR->DatumSystemAP242(); Handle(StepDimTol_HArray1OfDatumReference) HADR = GTWDR->DatumSystem();
if (aHADSOR.IsNull()) if (HADR.IsNull()) return Standard_False;
{ for (Standard_Integer idr = 1; idr <= HADR->Length(); idr++) {
return Standard_False; Handle(StepDimTol_DatumReference) DR = HADR->Value(idr);
} Handle(StepDimTol_Datum) aDatum = DR->ReferencedDatum();
NCollection_List<Handle(StepDimTol_Datum)> aDatumList;
for (Standard_Integer idr = 1; idr <= aHADSOR->Length(); idr++)
{
const StepDimTol_DatumSystemOrReference aDSOR = aHADSOR->Value(idr);
if (aDSOR.IsNull()) continue;
Handle(StepDimTol_DatumSystem) aDS = aDSOR.DatumSystem();
Handle(StepDimTol_DatumReference) aDR = aDSOR.DatumReference();
Handle(StepDimTol_Datum) aDatum;
if (!aDS.IsNull())
{
auto aDatumConList = aDS->Constituents();
for (Standard_Integer anInd = 1; anInd <= aDatumConList->Length(); anInd++)
{
Handle(StepDimTol_DatumReferenceCompartment) aDatRefC = aDatumConList->Value(anInd);
aDatumList.Append(aDatRefC->Base().Datum());
}
}
else if (!aDR.IsNull())
{
aDatumList.Append(aDR->ReferencedDatum());
}
}
for(NCollection_List<Handle(StepDimTol_Datum)>::Iterator anIt(aDatumList); anIt.More(); anIt.Next())
{
Handle(StepDimTol_Datum) aDatum = anIt.Value();
if (aDatum.IsNull()) continue; if (aDatum.IsNull()) continue;
Interface_EntityIterator subs4 = graph.Sharings(aDatum); Interface_EntityIterator subs4 = graph.Sharings(aDatum);
for (subs4.Start(); subs4.More(); subs4.Next()) { for (subs4.Start(); subs4.More(); subs4.Next()) {

View File

@@ -17,7 +17,6 @@
#define _STEPCAFControl_Reader_HeaderFile #define _STEPCAFControl_Reader_HeaderFile
#include <STEPControl_Reader.hxx> #include <STEPControl_Reader.hxx>
#include <StepData_Factors.hxx>
#include <IFSelect_ReturnStatus.hxx> #include <IFSelect_ReturnStatus.hxx>
#include <TDF_LabelSequence.hxx> #include <TDF_LabelSequence.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
@@ -39,6 +38,8 @@ class StepShape_ConnectedFaceSet;
class StepRepr_NextAssemblyUsageOccurrence; class StepRepr_NextAssemblyUsageOccurrence;
class STEPConstruct_Tool; class STEPConstruct_Tool;
class StepDimTol_Datum; class StepDimTol_Datum;
class StepData_Factors;
//! Provides a tool to read STEP file and put it into //! Provides a tool to read STEP file and put it into
//! DECAF document. Besides transfer of shapes (including //! DECAF document. Besides transfer of shapes (including
@@ -233,7 +234,7 @@ protected:
Standard_EXPORT Standard_Boolean ReadColors Standard_EXPORT Standard_Boolean ReadColors
(const Handle(XSControl_WorkSession)& WS, (const Handle(XSControl_WorkSession)& WS,
const Handle(TDocStd_Document)& doc, const Handle(TDocStd_Document)& doc,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Reads names of parts defined in the STEP model and //! Reads names of parts defined in the STEP model and
//! assigns them to corresponding labels in the DECAF document //! assigns them to corresponding labels in the DECAF document
@@ -245,7 +246,7 @@ protected:
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS,
const Handle(TDocStd_Document)& doc, const Handle(TDocStd_Document)& doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Reads layers of parts defined in the STEP model and //! Reads layers of parts defined in the STEP model and
//! set reference between shape and layers in the DECAF document //! set reference between shape and layers in the DECAF document
@@ -259,19 +260,19 @@ protected:
//! set reference between shape instances from different assemblyes //! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS,
const Handle(TDocStd_Document)& doc, const Handle(TDocStd_Document)& doc,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Reads materials for instances defined in the STEP model and //! Reads materials for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes //! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS,
const Handle(TDocStd_Document)& doc, const Handle(TDocStd_Document)& doc,
const Handle(TColStd_HSequenceOfTransient)& SeqPDS, const Handle(TColStd_HSequenceOfTransient)& SeqPDS,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Reads Views for instances defined in the STEP model //! Reads Views for instances defined in the STEP model
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Populates the sub-Label of the passed TDF Label with shape //! Populates the sub-Label of the passed TDF Label with shape
//! data associated with the given STEP Representation Item, //! data associated with the given STEP Representation Item,
@@ -313,20 +314,20 @@ private:
const Standard_Real theModifValue, const Standard_Real theModifValue,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Internal method. Read Datums, connected to GeomTolerance theGDTL. //! Internal method. Read Datums, connected to GeomTolerance theGDTL.
Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt, Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
const TDF_Label theGDTL, const TDF_Label theGDTL,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Internal method. Read Dimension or GeomTolerance. //! Internal method. Read Dimension or GeomTolerance.
TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Prepares units for transfer //! Prepares units for transfer
void prepareUnits(const Handle(StepData_StepModel)& theModel, void prepareUnits(const Handle(StepData_StepModel)& theModel,

View File

@@ -25,7 +25,6 @@
#include <STEPControl_Writer.hxx> #include <STEPControl_Writer.hxx>
#include <StepAP242_GeometricItemSpecificUsage.hxx> #include <StepAP242_GeometricItemSpecificUsage.hxx>
#include <StepData_ConfParameters.hxx> #include <StepData_ConfParameters.hxx>
#include <StepData_Factors.hxx>
#include <StepDimTol_Datum.hxx> #include <StepDimTol_Datum.hxx>
#include <StepDimTol_GeometricTolerance.hxx> #include <StepDimTol_GeometricTolerance.hxx>
#include <StepDimTol_HArray1OfDatumSystemOrReference.hxx> #include <StepDimTol_HArray1OfDatumSystemOrReference.hxx>
@@ -40,6 +39,7 @@ class XSControl_WorkSession;
class TDocStd_Document; class TDocStd_Document;
class STEPCAFControl_ExternFile; class STEPCAFControl_ExternFile;
class TopoDS_Shape; class TopoDS_Shape;
class StepData_Factors;
//! Provides a tool to write DECAF document to the //! Provides a tool to write DECAF document to the
//! STEP file. Besides transfer of shapes (including //! STEP file. Besides transfer of shapes (including
@@ -233,7 +233,7 @@ protected:
TopoDS_Shape transferExternFiles(const TDF_Label& theLabel, TopoDS_Shape transferExternFiles(const TDF_Label& theLabel,
const STEPControl_StepModelType theMode, const STEPControl_StepModelType theMode,
TDF_LabelSequence& theLabelSeq, TDF_LabelSequence& theLabelSeq,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Standard_CString thePrefix = "", const Standard_CString thePrefix = "",
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -256,7 +256,7 @@ protected:
//! Write D&GTs assigned to specified labels, to STEP model, according AP242 //! Write D&GTs assigned to specified labels, to STEP model, according AP242
Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theLabels, const TDF_LabelSequence& theLabels,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Write materials assigned to specified labels, to STEP model //! Write materials assigned to specified labels, to STEP model
Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS,
@@ -297,14 +297,14 @@ protected:
const gp_Ax2& theAnnotationPlane, const gp_Ax2& theAnnotationPlane,
const gp_Pnt& theTextPosition, const gp_Pnt& theTextPosition,
const Handle(Standard_Transient)& theDimension, const Handle(Standard_Transient)& theDimension,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS, Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theShapeL, const TDF_LabelSequence& theShapeL,
const TDF_Label& theDatumL, const TDF_Label& theDatumL,
const Standard_Boolean isFirstDTarget, const Standard_Boolean isFirstDTarget,
const Handle(StepDimTol_Datum)& theWrittenDatum, const Handle(StepDimTol_Datum)& theWrittenDatum,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS, void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject, const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
@@ -316,7 +316,7 @@ protected:
const TDF_Label& theGeomTolL, const TDF_Label& theGeomTolL,
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem, const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
const Handle(StepRepr_RepresentationContext)& theRC, const Handle(StepRepr_RepresentationContext)& theRC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
private: private:

View File

@@ -23,8 +23,8 @@
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <StepData_Factors.hxx>
#include <StepBasic_SiPrefix.hxx> #include <StepBasic_SiPrefix.hxx>
class StepData_Factors;
class StepData_StepModel; class StepData_StepModel;
class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx; class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx;
class StepRepr_GlobalUnitAssignedContext; class StepRepr_GlobalUnitAssignedContext;
@@ -49,7 +49,7 @@ public:
//! uncertainty equal to Tol3d) //! uncertainty equal to Tol3d)
Standard_EXPORT void Init (const Standard_Real Tol3d, Standard_EXPORT void Init (const Standard_Real Tol3d,
const Handle(StepData_StepModel)& theModel, const Handle(StepData_StepModel)& theModel,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Returns True if Init was called successfully //! Returns True if Init was called successfully
Standard_EXPORT Standard_Boolean IsDone() const; Standard_EXPORT Standard_Boolean IsDone() const;
@@ -60,10 +60,10 @@ public:
//! Computes the length, plane angle and solid angle conversion //! Computes the length, plane angle and solid angle conversion
//! factor . Returns a status, 0 if OK //! factor . Returns a status, 0 if OK
Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepRepr_GlobalUnitAssignedContext)& aContext, Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepRepr_GlobalUnitAssignedContext)& aContext,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepBasic_NamedUnit)& aUnit, Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepBasic_NamedUnit)& aUnit,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Computes the uncertainty value (for length) //! Computes the uncertainty value (for length)
Standard_EXPORT Standard_Integer ComputeTolerance (const Handle(StepRepr_GlobalUncertaintyAssignedContext)& aContext); Standard_EXPORT Standard_Integer ComputeTolerance (const Handle(StepRepr_GlobalUncertaintyAssignedContext)& aContext);

View File

@@ -26,6 +26,7 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <TColStd_SequenceOfTransient.hxx> #include <TColStd_SequenceOfTransient.hxx>
class StepBasic_ProductDefinition; class StepBasic_ProductDefinition;
class StepData_Factors;
class XSControl_WorkSession; class XSControl_WorkSession;
class TopoDS_Shape; class TopoDS_Shape;
class StepRepr_RepresentationItem; class StepRepr_RepresentationItem;
@@ -114,13 +115,13 @@ public:
Standard_EXPORT Standard_Boolean GetPropReal (const Handle(StepRepr_RepresentationItem)& item, Standard_EXPORT Standard_Boolean GetPropReal (const Handle(StepRepr_RepresentationItem)& item,
Standard_Real& Val, Standard_Real& Val,
Standard_Boolean& isArea, Standard_Boolean& isArea,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Returns value of Centriod property (or False if it is not) //! Returns value of Centriod property (or False if it is not)
Standard_EXPORT Standard_Boolean GetPropPnt (const Handle(StepRepr_RepresentationItem)& item, Standard_EXPORT Standard_Boolean GetPropPnt (const Handle(StepRepr_RepresentationItem)& item,
const Handle(StepRepr_RepresentationContext)& Context, const Handle(StepRepr_RepresentationContext)& Context,
gp_Pnt& Pnt, gp_Pnt& Pnt,
const StepData_Factors& theLocalFactors = StepData_Factors()) const; const StepData_Factors& theLocalFactors) const;
//! Sets current assembly shape SDR (for FindCDSR calls) //! Sets current assembly shape SDR (for FindCDSR calls)
Standard_EXPORT void SetAssemblyShape (const TopoDS_Shape& shape); Standard_EXPORT void SetAssemblyShape (const TopoDS_Shape& shape);

View File

@@ -1500,7 +1500,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
} }
else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedSurfaceSet))) else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedSurfaceSet)))
{ {
myShapeBuilder.Init(GetCasted(StepVisual_TessellatedSurfaceSet, start), TP, aHasGeom, aLocalFactors); myShapeBuilder.Init(GetCasted(StepVisual_TessellatedSurfaceSet, start), TP, aLocalFactors, aHasGeom);
found = Standard_True; found = Standard_True;
} }
} }

View File

@@ -20,7 +20,6 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <StepData_Factors.hxx>
#include <StepToTopoDS_NMTool.hxx> #include <StepToTopoDS_NMTool.hxx>
#include <Transfer_ActorOfTransientProcess.hxx> #include <Transfer_ActorOfTransientProcess.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
@@ -48,6 +47,7 @@ class StepShape_FaceSurface;
class TopoDS_Shell; class TopoDS_Shell;
class TopoDS_Compound; class TopoDS_Compound;
class StepRepr_ConstructiveGeometryRepresentationRelationship; class StepRepr_ConstructiveGeometryRepresentationRelationship;
class StepData_Factors;
class StepData_StepModel; class StepData_StepModel;
@@ -77,7 +77,7 @@ public:
Standard_EXPORT Handle(Transfer_Binder) TransferShape ( Standard_EXPORT Handle(Transfer_Binder) TransferShape (
const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -105,14 +105,14 @@ public:
const Handle(StepRepr_Representation)& TargContext, const Handle(StepRepr_Representation)& TargContext,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
gp_Trsf& Trsf, gp_Trsf& Trsf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Computes transformation defined by given //! Computes transformation defined by given
//! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION //! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
gp_Trsf& Trsf, gp_Trsf& Trsf,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
@@ -127,7 +127,7 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity ( Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
const Handle(StepBasic_ProductDefinition)& PD, const Handle(StepBasic_ProductDefinition)& PD,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -135,7 +135,7 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO, (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers shape representation entity //! Transfers shape representation entity
@@ -152,7 +152,7 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR, (const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers shape representation relationship entity //! Transfers shape representation relationship entity
@@ -189,7 +189,7 @@ protected:
Handle(TransferBRep_ShapeBinder) TransferEntity( const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR, Handle(TransferBRep_ShapeBinder) TransferEntity( const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
//! Translates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off. //! Translates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off.
Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay

View File

@@ -28,6 +28,7 @@
class Transfer_Finder; class Transfer_Finder;
class Transfer_Binder; class Transfer_Binder;
class Transfer_FinderProcess; class Transfer_FinderProcess;
class StepData_Factors;
class StepShape_ShapeDefinitionRepresentation; class StepShape_ShapeDefinitionRepresentation;
class StepGeom_Axis2Placement3d; class StepGeom_Axis2Placement3d;
class TopoDS_Shape; class TopoDS_Shape;
@@ -59,7 +60,7 @@ public:
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
Handle(StepGeom_Axis2Placement3d)& AX1, Handle(StepGeom_Axis2Placement3d)& AX1,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -68,7 +69,7 @@ public:
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -77,7 +78,7 @@ public:
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void SetMode (const STEPControl_StepModelType M); Standard_EXPORT void SetMode (const STEPControl_StepModelType M);

View File

@@ -93,24 +93,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_AxisIntersector::ScaleAndTransform (
return aRes; return aRes;
} }
//=======================================================================
// function : CopyWithBuilder
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
// Returned frustum should be re-constructed before being used.
//=======================================================================
Handle(SelectMgr_BaseIntersector) SelectMgr_AxisIntersector::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
{
(void )theBuilder;
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
"Error! SelectMgr_AxisIntersector::CopyWithBuilder() should be called after selection axis initialization");
Handle(SelectMgr_AxisIntersector) aRes = new SelectMgr_AxisIntersector();
aRes->myAxis = myAxis;
aRes->mySelectionType = mySelectionType;
return aRes;
}
// ======================================================================= // =======================================================================
// function : hasIntersection // function : hasIntersection
// purpose : // purpose :

View File

@@ -52,11 +52,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
//! Returns a copy of the intersector transformed using the builder configuration given.
//! Builder is an argument that represents corresponding settings for re-constructing transformed frustum from scratch.
//! In this class, builder is not used and theBuilder parameter is ignored.
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
public: public:
//! Intersection test between defined axis and given axis-aligned box //! Intersection test between defined axis and given axis-aligned box

View File

@@ -71,11 +71,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
//! should NOT be NULL.
//! @return a copy of the frustum with the input builder assigned
virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
public: public:
//! Return camera definition. //! Return camera definition.

View File

@@ -449,28 +449,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_RectangularFrustum::ScaleAndTransfor
return aRes; return aRes;
} }
// =======================================================================
// function : CopyWithBuilder
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
// Returned frustum should be re-constructed before being used.
// =======================================================================
Handle(SelectMgr_BaseIntersector) SelectMgr_RectangularFrustum::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
{
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
"Error! SelectMgr_RectangularFrustum::CopyWithBuilder() should be called after selection frustum initialization");
Standard_ASSERT_RAISE (!theBuilder.IsNull(),
"Error! SelectMgr_RectangularFrustum::CopyWithBuilder() should be called with valid builder");
Handle(SelectMgr_RectangularFrustum) aRes = new SelectMgr_RectangularFrustum();
aRes->mySelectionType = mySelectionType;
aRes->mySelRectangle = mySelRectangle;
aRes->myPixelTolerance = myPixelTolerance;
aRes->SetBuilder (theBuilder);
return aRes;
}
// ======================================================================= // =======================================================================
// function : IsScalable // function : IsScalable
// purpose : // purpose :

View File

@@ -99,13 +99,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
//! Returns a copy of the frustum using the given frustum builder configuration.
//! Returned frustum should be re-constructed before being used.
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
//! should NOT be NULL.
//! @return a copy of the frustum with the input builder assigned
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
// SAT Tests for different objects // SAT Tests for different objects
//! SAT intersection test between defined volume and given axis-aligned box //! SAT intersection test between defined volume and given axis-aligned box

View File

@@ -241,23 +241,17 @@ namespace
//============================================================================= //=============================================================================
SelectMgr_SelectableObjectSet::SelectMgr_SelectableObjectSet() SelectMgr_SelectableObjectSet::SelectMgr_SelectableObjectSet()
{ {
myBVH[BVHSubset_ortho2dPersistent] = new BVH_Tree<Standard_Real, 3>(); myBVH[BVHSubset_2dPersistent] = new BVH_Tree<Standard_Real, 3>();
myBVH[BVHSubset_ortho3dPersistent] = new BVH_Tree<Standard_Real, 3>(); myBVH[BVHSubset_3dPersistent] = new BVH_Tree<Standard_Real, 3>();
myBVH[BVHSubset_2dPersistent] = new BVH_Tree<Standard_Real, 3>(); myBVH[BVHSubset_3d] = new BVH_Tree<Standard_Real, 3>();
myBVH[BVHSubset_3dPersistent] = new BVH_Tree<Standard_Real, 3>();
myBVH[BVHSubset_3d] = new BVH_Tree<Standard_Real, 3>();
myBuilder[BVHSubset_ortho2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth); myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
myBuilder[BVHSubset_ortho3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth); myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth); myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_False; myIsDirty[BVHSubset_2dPersistent] = Standard_False;
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_False; myIsDirty[BVHSubset_3dPersistent] = Standard_False;
myIsDirty[BVHSubset_2dPersistent] = Standard_False; myIsDirty[BVHSubset_3d] = Standard_False;
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
myIsDirty[BVHSubset_3d] = Standard_False;
} }
//============================================================================= //=============================================================================
@@ -268,9 +262,10 @@ Standard_Boolean SelectMgr_SelectableObjectSet::Append (const Handle(SelectMgr_S
{ {
// get an appropriate BVH subset to insert the object into it // get an appropriate BVH subset to insert the object into it
const Standard_Integer aSubsetIdx = appropriateSubset (theObject); const Standard_Integer aSubsetIdx = appropriateSubset (theObject);
// check that the object is excluded from other subsets // check that the object is excluded from other subsets
if (currentSubset (theObject) != -1) if (myObjects[(aSubsetIdx + 1) % BVHSubsetNb].Contains (theObject)
|| myObjects[(aSubsetIdx + 2) % BVHSubsetNb].Contains (theObject))
{ {
return Standard_False; return Standard_False;
} }
@@ -406,51 +401,9 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
myBuilder[BVHSubset_2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_2dPersistent].get(), anAdaptor.Box()); myBuilder[BVHSubset_2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_2dPersistent].get(), anAdaptor.Box());
} }
// -------------------------------------------------------------------
// check and update 3D orthographic persistence BVH tree if necessary
// -------------------------------------------------------------------
if (!IsEmpty (BVHSubset_ortho3dPersistent)
&& (myIsDirty[BVHSubset_ortho3dPersistent]
|| myLastViewState.IsChanged (aViewState)
|| isWinSizeChanged))
{
Handle(Graphic3d_Camera) aNewOrthoCam = new Graphic3d_Camera (*theCam); // If OrthoPers, copy camera and set to orthographic projection
aNewOrthoCam->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
// construct adaptor over private fields to provide direct access for the BVH builder
BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_ortho3dPersistent],
aNewOrthoCam, aNewOrthoCam->ProjectionMatrix(),
aNewOrthoCam->OrientationMatrix(), theWinSize);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_ortho3dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_ortho3dPersistent].get(), anAdaptor.Box());
}
// -------------------------------------------------------------------
// check and update 2D orthographic persistence BVH tree if necessary
// -------------------------------------------------------------------
if (!IsEmpty (BVHSubset_ortho2dPersistent)
&& (myIsDirty[BVHSubset_ortho2dPersistent]
|| myLastViewState.IsProjectionChanged (aViewState)
|| isWinSizeChanged))
{
Handle(Graphic3d_Camera) aNewOrthoCam = new Graphic3d_Camera (*theCam); // If OrthoPers, copy camera and set to orthographic projection
aNewOrthoCam->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
// construct adaptor over private fields to provide direct access for the BVH builder
BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_ortho2dPersistent],
aNewOrthoCam, aNewOrthoCam->ProjectionMatrix(),
SelectMgr_SelectableObjectSet_THE_IDENTITY_MAT, theWinSize);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_ortho2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_ortho2dPersistent].get(), anAdaptor.Box());
}
// release dirty state for every subset // release dirty state for every subset
myIsDirty[BVHSubset_3dPersistent] = Standard_False; myIsDirty[BVHSubset_3dPersistent] = Standard_False;
myIsDirty[BVHSubset_2dPersistent] = Standard_False; myIsDirty[BVHSubset_2dPersistent] = Standard_False;
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_False;
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_False;
// keep last view state // keep last view state
myLastViewState = aViewState; myLastViewState = aViewState;
@@ -466,11 +419,9 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
//============================================================================= //=============================================================================
void SelectMgr_SelectableObjectSet::MarkDirty() void SelectMgr_SelectableObjectSet::MarkDirty()
{ {
myIsDirty[BVHSubset_3d] = Standard_True; myIsDirty[BVHSubset_3d] = Standard_True;
myIsDirty[BVHSubset_3dPersistent] = Standard_True; myIsDirty[BVHSubset_3dPersistent] = Standard_True;
myIsDirty[BVHSubset_2dPersistent] = Standard_True; myIsDirty[BVHSubset_2dPersistent] = Standard_True;
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_True;
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_True;
} }
//======================================================================= //=======================================================================
//function : DumpJson //function : DumpJson

View File

@@ -42,22 +42,11 @@ public:
//! needs to be updated only when camera's projection changes. Bounding volumes for this object subclass //! needs to be updated only when camera's projection changes. Bounding volumes for this object subclass
//! is represented directly in eye space coordinates. //! is represented directly in eye space coordinates.
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf. //! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
//! - BVHSubset_ortho3dPersistent refers to the subset of 3D persistent selectable objects (rotate, pan, zoom persistence)
//! that contains `Graphic3d_TMF_OrthoPers` persistence mode.
//! Associated BVH tree needs to be updated when either the camera's projection and position change.
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
//! - BVHSubset_ortho2dPersistent refers to the subset of 2D persistent selectable objects
//! that contains `Graphic3d_TMF_OrthoPers` persistence mode. Associated BVH tree
//! needs to be updated only when camera's projection changes. Bounding volumes for this object subclass
//! is represented directly in eye space coordinates.
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
enum BVHSubset enum BVHSubset
{ {
BVHSubset_3d, BVHSubset_3d,
BVHSubset_3dPersistent, BVHSubset_3dPersistent,
BVHSubset_2dPersistent, BVHSubset_2dPersistent,
BVHSubset_ortho3dPersistent,
BVHSubset_ortho2dPersistent,
BVHSubsetNb BVHSubsetNb
}; };
@@ -151,9 +140,7 @@ public:
{ {
return myObjects[BVHSubset_3d].Contains (theObject) return myObjects[BVHSubset_3d].Contains (theObject)
|| myObjects[BVHSubset_3dPersistent].Contains (theObject) || myObjects[BVHSubset_3dPersistent].Contains (theObject)
|| myObjects[BVHSubset_2dPersistent].Contains (theObject) || myObjects[BVHSubset_2dPersistent].Contains (theObject);
|| myObjects[BVHSubset_ortho3dPersistent].Contains (theObject)
|| myObjects[BVHSubset_ortho2dPersistent].Contains (theObject);
} }
//! Returns true if the object set does not contain any selectable objects. //! Returns true if the object set does not contain any selectable objects.
@@ -161,9 +148,7 @@ public:
{ {
return myObjects[BVHSubset_3d].IsEmpty() return myObjects[BVHSubset_3d].IsEmpty()
&& myObjects[BVHSubset_3dPersistent].IsEmpty() && myObjects[BVHSubset_3dPersistent].IsEmpty()
&& myObjects[BVHSubset_2dPersistent].IsEmpty() && myObjects[BVHSubset_2dPersistent].IsEmpty();
&& myObjects[BVHSubset_ortho3dPersistent].IsEmpty()
&& myObjects[BVHSubset_ortho2dPersistent].IsEmpty();
} }
//! Returns true if the specified object subset is empty. //! Returns true if the specified object subset is empty.
@@ -207,18 +192,10 @@ private:
} }
return SelectMgr_SelectableObjectSet::BVHSubset_3d; return SelectMgr_SelectableObjectSet::BVHSubset_3d;
} }
else if ((theObject->TransformPersistence()->Mode() & Graphic3d_TMF_2d) != 0) else if (theObject->TransformPersistence()->Mode() == Graphic3d_TMF_2d)
{ {
if (theObject->TransformPersistence()->IsOrthoPers())
{
return SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent;
}
return SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent; return SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent;
} }
else if (theObject->TransformPersistence()->IsOrthoPers())
{
return SelectMgr_SelectableObjectSet::BVHSubset_ortho3dPersistent;
}
else else
{ {
return SelectMgr_SelectableObjectSet::BVHSubset_3dPersistent; return SelectMgr_SelectableObjectSet::BVHSubset_3dPersistent;

View File

@@ -67,28 +67,6 @@ SelectMgr_SelectingVolumeManager SelectMgr_SelectingVolumeManager::ScaleAndTrans
return aMgr; return aMgr;
} }
//=======================================================================
// function : CopyWithBuilder
// purpose : Returns a copy of the selecting volume manager and its active frustum re-constructed using the passed builder.
// Builder is an argument that represents corresponding settings for re-constructing transformed
// frustum from scratch.
//=======================================================================
SelectMgr_SelectingVolumeManager SelectMgr_SelectingVolumeManager::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
{
SelectMgr_SelectingVolumeManager aMgr;
aMgr.myToAllowOverlap = myToAllowOverlap;
aMgr.myViewClipPlanes = myViewClipPlanes;
aMgr.myObjectClipPlanes = myObjectClipPlanes;
aMgr.myViewClipRange = myViewClipRange;
if (!myActiveSelectingVolume.IsNull())
{
aMgr.myActiveSelectingVolume = myActiveSelectingVolume->CopyWithBuilder (theBuilder);
aMgr.BuildSelectingVolume();
}
return aMgr;
}
//======================================================================= //=======================================================================
// function : GetActiveSelectionType // function : GetActiveSelectionType
// purpose : // purpose :

View File

@@ -81,11 +81,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
//! Returns a copy of the selecting volume manager and its active frustum re-constructed using the passed builder.
//! Builder is an argument that represents corresponding settings for re-constructing transformed
//! frustum from scratch.
Standard_EXPORT virtual SelectMgr_SelectingVolumeManager CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
public: public:
//! Returns current camera definition. //! Returns current camera definition.

View File

@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder) SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder)
: BVH_PrimitiveSet3d (theBuilder) : BVH_PrimitiveSet3d (theBuilder)
{ {
myNbEntityWithPersistence = 0; //
} }
//======================================================================= //=======================================================================
@@ -42,6 +42,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntit
theEntity->ResetSelectionActiveStatus(); theEntity->ResetSelectionActiveStatus();
return; return;
} }
const Standard_Integer anExtent = mySensitives.Extent(); const Standard_Integer anExtent = mySensitives.Extent();
if (mySensitives.Add (theEntity) > anExtent) if (mySensitives.Add (theEntity) > anExtent)
{ {
@@ -49,7 +50,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntit
} }
if (!theEntity->BaseSensitive()->TransformPersistence().IsNull()) if (!theEntity->BaseSensitive()->TransformPersistence().IsNull())
{ {
++myNbEntityWithPersistence; myHasEntityWithPersistence = Standard_True;
} }
MarkDirty(); MarkDirty();
} }
@@ -77,7 +78,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& th
} }
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull()) if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
{ {
++myNbEntityWithPersistence; myHasEntityWithPersistence = Standard_True;
} }
} }
MarkDirty(); MarkDirty();
@@ -92,8 +93,7 @@ void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& th
{ {
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectMgr_SensitiveEntity)& aSensEnt = aSelEntIter.Value(); const Standard_Integer anEntIdx = mySensitives.FindIndex (aSelEntIter.Value());
const Standard_Integer anEntIdx = mySensitives.FindIndex (aSensEnt);
if (anEntIdx == 0) if (anEntIdx == 0)
{ {
continue; continue;
@@ -103,13 +103,9 @@ void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& th
{ {
Swap (anEntIdx - 1, mySensitives.Size() - 1); Swap (anEntIdx - 1, mySensitives.Size() - 1);
} }
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
{
--myNbEntityWithPersistence;
}
mySensitives.RemoveLast(); mySensitives.RemoveLast();
removeOwner (aSensEnt->BaseSensitive()->OwnerId()); removeOwner (aSelEntIter.Value()->BaseSensitive()->OwnerId());
} }
MarkDirty(); MarkDirty();

View File

@@ -77,7 +77,7 @@ public:
const SelectMgr_MapOfOwners& Owners() const { return myOwnersMap; } const SelectMgr_MapOfOwners& Owners() const { return myOwnersMap; }
//! Returns map of entities. //! Returns map of entities.
Standard_Boolean HasEntityWithPersistence() const { return myNbEntityWithPersistence > 0; } Standard_Boolean HasEntityWithPersistence() const { return myHasEntityWithPersistence; }
protected: protected:
@@ -89,9 +89,9 @@ protected:
private: private:
SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives
Standard_Integer myNbEntityWithPersistence; //!< number of sensitive entities that have own transform persistence Standard_Boolean myHasEntityWithPersistence; //!< flag if some of sensitive entity has own transform persistence
}; };
#endif // _SelectMgr_SensitiveEntitySet_HeaderFile #endif // _SelectMgr_SensitiveEntitySet_HeaderFile

View File

@@ -189,20 +189,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustum::ScaleAndTransform
return aRes; return aRes;
} }
//=======================================================================
// function : CopyWithBuilder
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
// Returned frustum should be re-constructed before being used.
//=======================================================================
Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustum::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
{
Handle(SelectMgr_TriangularFrustum) aRes = new SelectMgr_TriangularFrustum();
aRes->mySelTriangle = mySelTriangle;
aRes->SetBuilder (theBuilder);
return aRes;
}
//======================================================================= //=======================================================================
// function : OverlapsBox // function : OverlapsBox
// purpose : SAT intersection test between defined volume and // purpose : SAT intersection test between defined volume and

View File

@@ -55,13 +55,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
//! Returns a copy of the frustum using the given frustum builder configuration.
//! Returned frustum should be re-constructed before being used.
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
//! should NOT be NULL.
//! @return a copy of the frustum with the input builder assigned
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
public: //! @name SAT Tests for different objects public: //! @name SAT Tests for different objects
//! SAT intersection test between defined volume and given axis-aligned box //! SAT intersection test between defined volume and given axis-aligned box

View File

@@ -186,32 +186,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::ScaleAndTransf
return aRes; return aRes;
} }
//=======================================================================
// function : CopyWithBuilder
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
// Returned frustum should be re-constructed before being used.
//=======================================================================
Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
{
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Polyline,
"Error! SelectMgr_TriangularFrustumSet::CopyWithBuilder() should be called after selection frustum initialization");
Standard_ASSERT_RAISE (!theBuilder.IsNull(),
"Error! SelectMgr_TriangularFrustumSet::CopyWithBuilder() should be called with valid builder");
Handle(SelectMgr_TriangularFrustumSet) aRes = new SelectMgr_TriangularFrustumSet();
aRes->SetCamera (myCamera);
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
{
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->CopyWithBuilder (theBuilder)));
}
aRes->mySelectionType = mySelectionType;
aRes->mySelPolyline = mySelPolyline;
aRes->myToAllowOverlap = myToAllowOverlap;
aRes->SetBuilder (theBuilder);
return aRes;
}
// ======================================================================= // =======================================================================
// function : OverlapsBox // function : OverlapsBox
// purpose : // purpose :

View File

@@ -62,13 +62,6 @@ public:
const gp_GTrsf& theTrsf, const gp_GTrsf& theTrsf,
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE; const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
//! Returns a copy of the frustum using the given frustum builder configuration.
//! Returned frustum should be re-constructed before being used.
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
//! should NOT be NULL.
//! @return a copy of the frustum with the input builder assigned
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
public: public:
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt, Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,

View File

@@ -138,12 +138,12 @@ void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriter
case SelectMgr_TypeOfDepthTolerance_UniformPixels: case SelectMgr_TypeOfDepthTolerance_UniformPixels:
case SelectMgr_TypeOfDepthTolerance_SensitivityFactor: case SelectMgr_TypeOfDepthTolerance_SensitivityFactor:
{ {
if (theMgr.Camera().IsNull()) if (mySelectingVolumeMgr.Camera().IsNull())
{ {
// fallback for an arbitrary projection matrix // fallback for an arbitrary projection matrix
theCriterion.Tolerance = aSensFactor / 33.0; theCriterion.Tolerance = aSensFactor / 33.0;
} }
else if (theMgr.Camera()->IsOrthographic()) else if (mySelectingVolumeMgr.Camera()->IsOrthographic())
{ {
theCriterion.Tolerance = myCameraScale * aSensFactor; theCriterion.Tolerance = myCameraScale * aSensFactor;
} }
@@ -634,9 +634,6 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
Graphic3d_Vec2i aWinSize; Graphic3d_Vec2i aWinSize;
mySelectingVolumeMgr.WindowSize (aWinSize.x(), aWinSize.y()); mySelectingVolumeMgr.WindowSize (aWinSize.x(), aWinSize.y());
const double aPixelSize = aWinSize.x() > 0 && aWinSize.y() > 0
? Max (1.0 / aWinSize.x(), 1.0 / aWinSize.y())
: 1.0;
const Handle(Graphic3d_Camera)& aCamera = mySelectingVolumeMgr.Camera(); const Handle(Graphic3d_Camera)& aCamera = mySelectingVolumeMgr.Camera();
Graphic3d_Mat4d aProjectionMat, aWorldViewMat; Graphic3d_Mat4d aProjectionMat, aWorldViewMat;
@@ -649,6 +646,11 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
myCameraEye = aCamera->Eye().XYZ(); myCameraEye = aCamera->Eye().XYZ();
myCameraDir = aCamera->Direction().XYZ(); myCameraDir = aCamera->Direction().XYZ();
myCameraScale = aCamera->IsOrthographic()
? aCamera->Scale()
: 2.0 * Tan (aCamera->FOVy() * M_PI / 360.0);
const double aPixelSize = Max (1.0 / aWinSize.x(), 1.0 / aWinSize.y());
myCameraScale *= aPixelSize;
} }
mySelectableObjects.UpdateBVH (aCamera, aWinSize); mySelectableObjects.UpdateBVH (aCamera, aWinSize);
@@ -670,8 +672,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
// for 2D space selection transform selecting volumes to perform overlap testing // for 2D space selection transform selecting volumes to perform overlap testing
// directly in camera's eye space omitting the camera position, which is not // directly in camera's eye space omitting the camera position, which is not
// needed there at all // needed there at all
if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent)
|| aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent)
{ {
gp_GTrsf aTFrustum; gp_GTrsf aTFrustum;
aTFrustum.SetValue (1, 1, aWorldViewMat.GetValue (0, 0)); aTFrustum.SetValue (1, 1, aWorldViewMat.GetValue (0, 0));
@@ -687,46 +688,22 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
aWorldViewMat.GetValue (1, 3), aWorldViewMat.GetValue (1, 3),
aWorldViewMat.GetValue (2, 3))); aWorldViewMat.GetValue (2, 3)));
// define corresponding frustum builder parameters for 2d persistence. // define corresponding frustum builder parameters
Handle(SelectMgr_FrustumBuilder) aBuilder = new SelectMgr_FrustumBuilder(); Handle(SelectMgr_FrustumBuilder) aBuilder = new SelectMgr_FrustumBuilder();
Handle(Graphic3d_Camera) aNewCamera = new Graphic3d_Camera(); Handle(Graphic3d_Camera) aNewCamera = new Graphic3d_Camera();
aNewCamera->CopyMappingData (aCamera); aNewCamera->CopyMappingData (aCamera);
aNewCamera->SetIdentityOrientation(); aNewCamera->SetIdentityOrientation();
if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent)
{
aNewCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
}
aWorldViewMat = aNewCamera->OrientationMatrix(); // should be identity matrix aWorldViewMat = aNewCamera->OrientationMatrix(); // should be identity matrix
aProjectionMat = aNewCamera->ProjectionMatrix(); // should be the same to aProjectionMat aProjectionMat = aNewCamera->ProjectionMatrix(); // should be the same to aProjectionMat
aBuilder->SetCamera (aNewCamera); aBuilder->SetCamera (aNewCamera);
aBuilder->SetWindowSize (aWinSize.x(), aWinSize.y()); aBuilder->SetWindowSize (aWinSize.x(), aWinSize.y());
aMgr = mySelectingVolumeMgr.ScaleAndTransform (1, aTFrustum, aBuilder); aMgr = mySelectingVolumeMgr.ScaleAndTransform (1, aTFrustum, aBuilder);
} }
else if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho3dPersistent)
{
// define corresponding frustum builder parameters for 3d orthographic persistence.
Handle(SelectMgr_FrustumBuilder) aBuilder = new SelectMgr_FrustumBuilder();
Handle(Graphic3d_Camera) aNewCamera = new Graphic3d_Camera (*aCamera);
aNewCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
aWorldViewMat = aNewCamera->OrientationMatrix(); // should be the same to aWorldViewMat
aProjectionMat = aNewCamera->ProjectionMatrix(); // should be orthographic projection
aBuilder->SetCamera (aNewCamera);
aBuilder->SetWindowSize (aWinSize.x(), aWinSize.y());
aMgr = mySelectingVolumeMgr.CopyWithBuilder (aBuilder);
}
else else
{ {
aMgr = mySelectingVolumeMgr; aMgr = mySelectingVolumeMgr;
} }
if (!aMgr.Camera().IsNull())
{
myCameraScale = aMgr.Camera()->IsOrthographic()
? aMgr.Camera()->Scale()
: 2.0 * Tan (aMgr.Camera()->FOVy() * M_PI / 360.0);
myCameraScale *= aPixelSize;
}
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset); const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset);
Standard_Integer aNode = 0; Standard_Integer aNode = 0;

View File

@@ -328,7 +328,7 @@ protected:
//! @param theObject [in] the selectable object for traversal. //! @param theObject [in] the selectable object for traversal.
//! @param theMgr [in] the (un)transformed copy of the selecting volume manager representing active selection frustum. //! @param theMgr [in] the (un)transformed copy of the selecting volume manager representing active selection frustum.
//! @param theCamera, theProjectionMat, theWorldViewMat [in] the source camera and matrices for theMgr given. //! @param theCamera, theProjectionMat, theWorldViewMat [in] the source camera and matrices for theMgr given.
//! @param theWinSize [in] viewport (window) dimensions for evaluating //! @param theViewportWidth, theViewportHeight [in] viewport (window) dimensions for evaluating
//! object's transformation persistence. //! object's transformation persistence.
Standard_EXPORT void traverseObject (const Handle(SelectMgr_SelectableObject)& theObject, Standard_EXPORT void traverseObject (const Handle(SelectMgr_SelectableObject)& theObject,
const SelectMgr_SelectingVolumeManager& theMgr, const SelectMgr_SelectingVolumeManager& theMgr,

View File

@@ -113,10 +113,6 @@
#define INV_PI 0.318309886 #define INV_PI 0.318309886
#define INV_PI_2 0.159154943 #define INV_PI_2 0.159154943
// Point light depth range values
#define POINTLIGHT_ZNEAR 1.0
#define POINTLIGHT_ZFAR 3000.0
// Matrix state // Matrix state
uniform mat4 occWorldViewMatrix; //!< World-view matrix uniform mat4 occWorldViewMatrix; //!< World-view matrix
uniform mat4 occProjectionMatrix; //!< Projection matrix uniform mat4 occProjectionMatrix; //!< Projection matrix

View File

@@ -1,7 +1,6 @@
srcinc:::Declarations.glsl srcinc:::Declarations.glsl
srcinc:::DeclarationsImpl.glsl srcinc:::DeclarationsImpl.glsl
srcinc:::LightShadow.glsl srcinc:::LightShadow.glsl
srcinc:::LightPointShadow.glsl
srcinc:::PBRCookTorrance.glsl srcinc:::PBRCookTorrance.glsl
srcinc:::PBRDirectionalLight.glsl srcinc:::PBRDirectionalLight.glsl
srcinc:::PBRDistribution.glsl srcinc:::PBRDistribution.glsl
@@ -29,7 +28,6 @@ srcinc:::SkydomBackground.fs
Shaders_Declarations_glsl.pxx Shaders_Declarations_glsl.pxx
Shaders_DeclarationsImpl_glsl.pxx Shaders_DeclarationsImpl_glsl.pxx
Shaders_LightShadow_glsl.pxx Shaders_LightShadow_glsl.pxx
Shaders_LightPointShadow_glsl.pxx
Shaders_Display_fs.pxx Shaders_Display_fs.pxx
Shaders_PBRCookTorrance_glsl.pxx Shaders_PBRCookTorrance_glsl.pxx
Shaders_PBRDirectionalLight_glsl.pxx Shaders_PBRDirectionalLight_glsl.pxx

View File

@@ -1,24 +0,0 @@
//! Function computes point light shadow attenuation (1.0 means no shadow).
float occLightPointShadow (in samplerCube theShadow,
in int theId,
in vec3 thePoint,
in vec3 theNormal)
{
vec4 aPosLightSpace = PosLightSpace[occLight_Index(theId)];
vec3 aLightDir = thePoint - occLight_Position (theId);
// convert light-to-fragment vector to a depth value.
vec3 anAbsVec = abs (aLightDir);
float aLocalZcomp = max (anAbsVec.x, max (anAbsVec.y, anAbsVec.z));
// set znear and zfar
float aRange = occShadowMapRangeParams[theId].y;
float aNear = occShadowMapRangeParams[theId].x;
float aFar = aRange <= aNear ? POINTLIGHT_ZFAR : aRange;
float aNormZComp = (aFar + aNear) / (aFar - aNear) - (2.0 * aFar * aNear) / (aFar - aNear) / aLocalZcomp;
float aDist = (aNormZComp + 1.0) * 0.5;
// calculate bias and test depth.
aLightDir = normalize (aLightDir);
float aBias = min (occShadowMapSizeBias.y * (1.0 - dot (theNormal, aLightDir)), occShadowMapSizeBias.y * 0.1);
float aClosestDepth = occTextureCube (theShadow, aLightDir).r;
float aShadow = (aDist - aBias) > aClosestDepth ? 1.0 : 0.0;
return 1.0 - aShadow;
}

View File

@@ -9,8 +9,7 @@ void occPointLight (in int theId,
in vec3 theNormal, in vec3 theNormal,
in vec3 theView, in vec3 theView,
in vec3 thePoint, in vec3 thePoint,
in bool theIsFront, in bool theIsFront)
in float theShadow)
{ {
vec3 aLight = occLight_Position (theId) - thePoint; vec3 aLight = occLight_Position (theId) - thePoint;
@@ -24,5 +23,5 @@ void occPointLight (in int theId,
DirectLighting += occPBRIllumination (theView, aLight, theNormal, DirectLighting += occPBRIllumination (theView, aLight, theNormal,
BaseColor, Metallic, Roughness, IOR, BaseColor, Metallic, Roughness, IOR,
occLight_Specular (theId), occLight_Specular (theId),
occLight_Intensity(theId) * anAtten) * theShadow; occLight_Intensity(theId) * anAtten);
} }

View File

@@ -9,8 +9,7 @@ void occPointLight (in int theId,
in vec3 theNormal, in vec3 theNormal,
in vec3 theView, in vec3 theView,
in vec3 thePoint, in vec3 thePoint,
in bool theIsFront, in bool theIsFront)
in float theShadow)
{ {
vec3 aLight = occLight_Position (theId) - thePoint; vec3 aLight = occLight_Position (theId) - thePoint;
@@ -32,6 +31,6 @@ void occPointLight (in int theId,
aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront)); aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));
} }
Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten * theShadow; Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;
Specular += occLight_Specular(theId) * aSpecl * anAtten * theShadow; Specular += occLight_Specular(theId) * aSpecl * anAtten;
} }

View File

@@ -116,10 +116,6 @@ static const char Shaders_Declarations_glsl[] =
"#define INV_PI 0.318309886\n" "#define INV_PI 0.318309886\n"
"#define INV_PI_2 0.159154943\n" "#define INV_PI_2 0.159154943\n"
"\n" "\n"
"// Point light depth range values\n"
"#define POINTLIGHT_ZNEAR 1.0\n"
"#define POINTLIGHT_ZFAR 3000.0\n"
"\n"
"// Matrix state\n" "// Matrix state\n"
"uniform mat4 occWorldViewMatrix; //!< World-view matrix\n" "uniform mat4 occWorldViewMatrix; //!< World-view matrix\n"
"uniform mat4 occProjectionMatrix; //!< Projection matrix\n" "uniform mat4 occProjectionMatrix; //!< Projection matrix\n"

View File

@@ -1,28 +0,0 @@
// This file has been automatically generated from resource file src/Shaders/LightShadow.glsl
static const char Shaders_LightPointShadow_glsl[] =
"//! Function computes point light shadow attenuation (1.0 means no shadow).\n"
"float occLightPointShadow (in samplerCube theShadow,\n"
" //in vec2 theDepthRange,\n"
" in int theId,\n"
" in vec3 thePoint,\n"
" in vec3 theNormal)\n"
"{\n"
" vec4 aPosLightSpace = PosLightSpace[occLight_Index(theId)];\n"
" vec3 aLightDir = thePoint - occLight_Position (theId);\n"
" // convert light-to-fragment vector to a depth value.\n"
" vec3 anAbsVec = abs (aLightDir);\n"
" float aLocalZcomp = max (anAbsVec.x, max (anAbsVec.y, anAbsVec.z));\n"
" // set znear and zfar\n"
" float aRange = occShadowMapRangeParams[theId].y;\n"
" float aNear = occShadowMapRangeParams[theId].x;\n"
" float aFar = aRange <= aNear ? POINTLIGHT_ZFAR : aRange;\n"
" float aNormZComp = (aFar + aNear) / (aFar-aNear) - (2.0 * aFar * aNear) / (aFar - aNear) / aLocalZcomp;\n"
" float aDist = (aNormZComp + 1.0) * 0.5;\n"
" // calculate bias and test depth.\n"
" aLightDir = normalize (aLightDir);\n"
" float aBias = min (occShadowMapSizeBias.y * (1.0 - dot (theNormal, aLightDir)), occShadowMapSizeBias.y * 0.1);\n"
" float aClosestDepth = occTextureCube (theShadow, aLightDir).r;\n"
" float aShadow = (aDist - aBias) > aClosestDepth ? 1.0 : 0.0;\n"
" return 1.0 - aShadow;\n"
"}\n";

View File

@@ -12,8 +12,7 @@ static const char Shaders_PBRPointLight_glsl[] =
" in vec3 theNormal,\n" " in vec3 theNormal,\n"
" in vec3 theView,\n" " in vec3 theView,\n"
" in vec3 thePoint,\n" " in vec3 thePoint,\n"
" in bool theIsFront,\n" " in bool theIsFront)\n"
" in float theShadow)\n"
"{\n" "{\n"
" vec3 aLight = occLight_Position (theId) - thePoint;\n" " vec3 aLight = occLight_Position (theId) - thePoint;\n"
"\n" "\n"
@@ -27,5 +26,5 @@ static const char Shaders_PBRPointLight_glsl[] =
" DirectLighting += occPBRIllumination (theView, aLight, theNormal,\n" " DirectLighting += occPBRIllumination (theView, aLight, theNormal,\n"
" BaseColor, Metallic, Roughness, IOR,\n" " BaseColor, Metallic, Roughness, IOR,\n"
" occLight_Specular (theId),\n" " occLight_Specular (theId),\n"
" occLight_Intensity(theId) * anAtten) * theShadow;\n" " occLight_Intensity(theId) * anAtten);\n"
"}\n"; "}\n";

View File

@@ -12,8 +12,7 @@ static const char Shaders_PhongPointLight_glsl[] =
" in vec3 theNormal,\n" " in vec3 theNormal,\n"
" in vec3 theView,\n" " in vec3 theView,\n"
" in vec3 thePoint,\n" " in vec3 thePoint,\n"
" in bool theIsFront,\n" " in bool theIsFront)\n"
" in float theShadow)\n"
"{\n" "{\n"
" vec3 aLight = occLight_Position (theId) - thePoint;\n" " vec3 aLight = occLight_Position (theId) - thePoint;\n"
"\n" "\n"
@@ -35,6 +34,6 @@ static const char Shaders_PhongPointLight_glsl[] =
" aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));\n" " aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));\n"
" }\n" " }\n"
"\n" "\n"
" Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten * theShadow;\n" " Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;\n"
" Specular += occLight_Specular(theId) * aSpecl * anAtten * theShadow;\n" " Specular += occLight_Specular(theId) * aSpecl * anAtten;\n"
"}\n"; "}\n";

View File

@@ -35,19 +35,19 @@
// Primary definitions // Primary definitions
#define OCC_VERSION_MAJOR 7 #define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 8 #define OCC_VERSION_MINOR 8
#define OCC_VERSION_MAINTENANCE 1 #define OCC_VERSION_MAINTENANCE 0
//! This macro must be commented in official release, and set to non-empty //! 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.: //! string in other situations, to identify specifics of the version, e.g.:
//! - "dev" for development version between releases //! - "dev" for development version between releases
//! - "beta..." or "rc..." for beta releases or release candidates //! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes //! - "project..." for version containing project-specific fixes
#define OCC_VERSION_DEVELOPMENT "dev" //#define OCC_VERSION_DEVELOPMENT "dev"
// Derived (manually): version as real and string (major.minor) // Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.8 #define OCC_VERSION 7.8
#define OCC_VERSION_STRING "7.8" #define OCC_VERSION_STRING "7.8"
#define OCC_VERSION_COMPLETE "7.8.1" #define OCC_VERSION_COMPLETE "7.8.0"
//! Derived: extended version as string ("major.minor.maintenance.dev") //! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT #ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -192,6 +192,7 @@ namespace
} }
const Standard_Integer aDecal = anArray->VertexNumber(); const Standard_Integer aDecal = anArray->VertexNumber();
Standard_Real aMaxX = -FLT_MAX, aMinX = FLT_MAX;
for (Standard_Integer aNodeIter = 1; aNodeIter <= aT->NbNodes(); ++aNodeIter) for (Standard_Integer aNodeIter = 1; aNodeIter <= aT->NbNodes(); ++aNodeIter)
{ {
aPoint = aT->Node (aNodeIter); aPoint = aT->Node (aNodeIter);
@@ -199,13 +200,19 @@ namespace
if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored) if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
{ {
aNorm.Reverse(); aNorm.Reverse();
if (aT->HasUVNodes())
{
gp_Pnt2d aTmpPnt = aT->UVNode(aNodeIter);
if (aMaxX < aTmpPnt.X()) { aMaxX = aTmpPnt.X(); }
if (aMinX > aTmpPnt.X()) { aMinX = aTmpPnt.X(); }
}
} }
if (!aLoc.IsIdentity()) if (!aLoc.IsIdentity())
{ {
aPoint.Transform (aTrsf); aPoint.Transform (aTrsf);
aNorm .Transform (aTrsf); aNorm .Transform (aTrsf);
} }
if (theHasTexels && aT->HasUVNodes()) if (theHasTexels && aT->HasUVNodes())
{ {
const gp_Pnt2d aNode2d = aT->UVNode (aNodeIter); const gp_Pnt2d aNode2d = aT->UVNode (aNodeIter);
@@ -221,6 +228,18 @@ namespace
} }
} }
// changes uvs for reversed faces depending on number of vertex
// by flipping the uv coordinates according to face normal
if (((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored) && aT->HasUVNodes())
{
for (Standard_Integer anIndex = 1; anIndex <= aT->NbNodes(); anIndex++)
{
gp_Pnt2d aTmpPnt = aT->UVNode (anIndex);
aTmpPnt.SetX (aMaxX + aMinX - aTmpPnt.X());
aT->SetUVNode (anIndex, aTmpPnt);
}
}
// Fill array with vertex and edge visibility info // Fill array with vertex and edge visibility info
Standard_Integer anIndex[3]; Standard_Integer anIndex[3];
for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter) for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter)

View File

@@ -20,7 +20,6 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <StepData_Factors.hxx>
class Geom_Axis1Placement; class Geom_Axis1Placement;
class Geom_Axis2Placement; class Geom_Axis2Placement;
@@ -68,6 +67,7 @@ class Geom2d_VectorWithMagnitude;
class gp_Trsf; class gp_Trsf;
class gp_Trsf2d; class gp_Trsf2d;
class StepData_Factors;
class StepGeom_Axis1Placement; class StepGeom_Axis1Placement;
class StepGeom_Axis2Placement2d; class StepGeom_Axis2Placement2d;
class StepGeom_Axis2Placement3d; class StepGeom_Axis2Placement3d;
@@ -115,94 +115,94 @@ class StepToGeom
public: public:
Standard_EXPORT static Handle(Geom_Axis1Placement) MakeAxis1Placement (const Handle(StepGeom_Axis1Placement)& SA, Standard_EXPORT static Handle(Geom_Axis1Placement) MakeAxis1Placement (const Handle(StepGeom_Axis1Placement)& SA,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Axis2Placement) MakeAxis2Placement (const Handle(StepGeom_Axis2Placement3d)& SA, Standard_EXPORT static Handle(Geom_Axis2Placement) MakeAxis2Placement (const Handle(StepGeom_Axis2Placement3d)& SA,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Axis2Placement) MakeAxis2Placement (const Handle(StepGeom_SuParameters)& SP); Standard_EXPORT static Handle(Geom_Axis2Placement) MakeAxis2Placement (const Handle(StepGeom_SuParameters)& SP);
Standard_EXPORT static Handle(Geom2d_AxisPlacement) MakeAxisPlacement (const Handle(StepGeom_Axis2Placement2d)& SA, Standard_EXPORT static Handle(Geom2d_AxisPlacement) MakeAxisPlacement (const Handle(StepGeom_Axis2Placement2d)& SA,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_BoundedCurve) MakeBoundedCurve (const Handle(StepGeom_BoundedCurve)& SC, Standard_EXPORT static Handle(Geom_BoundedCurve) MakeBoundedCurve (const Handle(StepGeom_BoundedCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_BoundedCurve) MakeBoundedCurve2d (const Handle(StepGeom_BoundedCurve)& SC, Standard_EXPORT static Handle(Geom2d_BoundedCurve) MakeBoundedCurve2d (const Handle(StepGeom_BoundedCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_BoundedSurface) MakeBoundedSurface (const Handle(StepGeom_BoundedSurface)& SS, Standard_EXPORT static Handle(Geom_BoundedSurface) MakeBoundedSurface (const Handle(StepGeom_BoundedSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_BSplineCurve) MakeBSplineCurve (const Handle(StepGeom_BSplineCurve)& SC, Standard_EXPORT static Handle(Geom_BSplineCurve) MakeBSplineCurve (const Handle(StepGeom_BSplineCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeBSplineCurve2d (const Handle(StepGeom_BSplineCurve)& SC, Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeBSplineCurve2d (const Handle(StepGeom_BSplineCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_BSplineSurface) MakeBSplineSurface (const Handle(StepGeom_BSplineSurface)& SS, Standard_EXPORT static Handle(Geom_BSplineSurface) MakeBSplineSurface (const Handle(StepGeom_BSplineSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_CartesianPoint) MakeCartesianPoint (const Handle(StepGeom_CartesianPoint)& SP, Standard_EXPORT static Handle(Geom_CartesianPoint) MakeCartesianPoint (const Handle(StepGeom_CartesianPoint)& SP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_CartesianPoint) MakeCartesianPoint2d (const Handle(StepGeom_CartesianPoint)& SP, Standard_EXPORT static Handle(Geom2d_CartesianPoint) MakeCartesianPoint2d (const Handle(StepGeom_CartesianPoint)& SP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Circle) MakeCircle (const Handle(StepGeom_Circle)& SC, Standard_EXPORT static Handle(Geom_Circle) MakeCircle (const Handle(StepGeom_Circle)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Circle) MakeCircle2d (const Handle(StepGeom_Circle)& SC, Standard_EXPORT static Handle(Geom2d_Circle) MakeCircle2d (const Handle(StepGeom_Circle)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Conic) MakeConic (const Handle(StepGeom_Conic)& SC, Standard_EXPORT static Handle(Geom_Conic) MakeConic (const Handle(StepGeom_Conic)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Conic) MakeConic2d (const Handle(StepGeom_Conic)& SC, Standard_EXPORT static Handle(Geom2d_Conic) MakeConic2d (const Handle(StepGeom_Conic)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_ConicalSurface) MakeConicalSurface (const Handle(StepGeom_ConicalSurface)& SS, Standard_EXPORT static Handle(Geom_ConicalSurface) MakeConicalSurface (const Handle(StepGeom_ConicalSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Curve) MakeCurve (const Handle(StepGeom_Curve)& SC, Standard_EXPORT static Handle(Geom_Curve) MakeCurve (const Handle(StepGeom_Curve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Curve) MakeCurve2d (const Handle(StepGeom_Curve)& SC, Standard_EXPORT static Handle(Geom2d_Curve) MakeCurve2d (const Handle(StepGeom_Curve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_CylindricalSurface) MakeCylindricalSurface (const Handle(StepGeom_CylindricalSurface)& SS, Standard_EXPORT static Handle(Geom_CylindricalSurface) MakeCylindricalSurface (const Handle(StepGeom_CylindricalSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Direction) MakeDirection (const Handle(StepGeom_Direction)& SD); Standard_EXPORT static Handle(Geom_Direction) MakeDirection (const Handle(StepGeom_Direction)& SD);
Standard_EXPORT static Handle(Geom2d_Direction) MakeDirection2d (const Handle(StepGeom_Direction)& SD); Standard_EXPORT static Handle(Geom2d_Direction) MakeDirection2d (const Handle(StepGeom_Direction)& SD);
Standard_EXPORT static Handle(Geom_ElementarySurface) MakeElementarySurface (const Handle(StepGeom_ElementarySurface)& SS, Standard_EXPORT static Handle(Geom_ElementarySurface) MakeElementarySurface (const Handle(StepGeom_ElementarySurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Ellipse) MakeEllipse (const Handle(StepGeom_Ellipse)& SC, Standard_EXPORT static Handle(Geom_Ellipse) MakeEllipse (const Handle(StepGeom_Ellipse)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Ellipse) MakeEllipse2d (const Handle(StepGeom_Ellipse)& SC, Standard_EXPORT static Handle(Geom2d_Ellipse) MakeEllipse2d (const Handle(StepGeom_Ellipse)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Hyperbola) MakeHyperbola (const Handle(StepGeom_Hyperbola)& SC, Standard_EXPORT static Handle(Geom_Hyperbola) MakeHyperbola (const Handle(StepGeom_Hyperbola)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Hyperbola) MakeHyperbola2d (const Handle(StepGeom_Hyperbola)& SC, Standard_EXPORT static Handle(Geom2d_Hyperbola) MakeHyperbola2d (const Handle(StepGeom_Hyperbola)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Line) MakeLine (const Handle(StepGeom_Line)& SC, Standard_EXPORT static Handle(Geom_Line) MakeLine (const Handle(StepGeom_Line)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Line) MakeLine2d (const Handle(StepGeom_Line)& SC, Standard_EXPORT static Handle(Geom2d_Line) MakeLine2d (const Handle(StepGeom_Line)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Parabola) MakeParabola (const Handle(StepGeom_Parabola)& SC, Standard_EXPORT static Handle(Geom_Parabola) MakeParabola (const Handle(StepGeom_Parabola)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_Parabola) MakeParabola2d (const Handle(StepGeom_Parabola)& SC, Standard_EXPORT static Handle(Geom2d_Parabola) MakeParabola2d (const Handle(StepGeom_Parabola)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Plane) MakePlane (const Handle(StepGeom_Plane)& SP, Standard_EXPORT static Handle(Geom_Plane) MakePlane (const Handle(StepGeom_Plane)& SP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_BSplineCurve) MakePolyline (const Handle(StepGeom_Polyline)& SPL, Standard_EXPORT static Handle(Geom_BSplineCurve) MakePolyline (const Handle(StepGeom_Polyline)& SPL,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakePolyline2d (const Handle(StepGeom_Polyline)& SPL, Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakePolyline2d (const Handle(StepGeom_Polyline)& SPL,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_RectangularTrimmedSurface) MakeRectangularTrimmedSurface (const Handle(StepGeom_RectangularTrimmedSurface)& SS, Standard_EXPORT static Handle(Geom_RectangularTrimmedSurface) MakeRectangularTrimmedSurface (const Handle(StepGeom_RectangularTrimmedSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_SphericalSurface) MakeSphericalSurface (const Handle(StepGeom_SphericalSurface)& SS, Standard_EXPORT static Handle(Geom_SphericalSurface) MakeSphericalSurface (const Handle(StepGeom_SphericalSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_Surface) MakeSurface (const Handle(StepGeom_Surface)& SS, Standard_EXPORT static Handle(Geom_Surface) MakeSurface (const Handle(StepGeom_Surface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_SurfaceOfLinearExtrusion) MakeSurfaceOfLinearExtrusion (const Handle(StepGeom_SurfaceOfLinearExtrusion)& SS, Standard_EXPORT static Handle(Geom_SurfaceOfLinearExtrusion) MakeSurfaceOfLinearExtrusion (const Handle(StepGeom_SurfaceOfLinearExtrusion)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_SurfaceOfRevolution) MakeSurfaceOfRevolution (const Handle(StepGeom_SurfaceOfRevolution)& SS, Standard_EXPORT static Handle(Geom_SurfaceOfRevolution) MakeSurfaceOfRevolution (const Handle(StepGeom_SurfaceOfRevolution)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_SweptSurface) MakeSweptSurface (const Handle(StepGeom_SweptSurface)& SS, Standard_EXPORT static Handle(Geom_SweptSurface) MakeSweptSurface (const Handle(StepGeom_SweptSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_ToroidalSurface) MakeToroidalSurface (const Handle(StepGeom_ToroidalSurface)& SS, Standard_EXPORT static Handle(Geom_ToroidalSurface) MakeToroidalSurface (const Handle(StepGeom_ToroidalSurface)& SS,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Standard_Boolean MakeTransformation2d (const Handle(StepGeom_CartesianTransformationOperator2d)& SCTO, gp_Trsf2d& CT, Standard_EXPORT static Standard_Boolean MakeTransformation2d (const Handle(StepGeom_CartesianTransformationOperator2d)& SCTO, gp_Trsf2d& CT,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Standard_Boolean MakeTransformation3d (const Handle(StepGeom_CartesianTransformationOperator3d)& SCTO, gp_Trsf& CT, Standard_EXPORT static Standard_Boolean MakeTransformation3d (const Handle(StepGeom_CartesianTransformationOperator3d)& SCTO, gp_Trsf& CT,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_TrimmedCurve) MakeTrimmedCurve (const Handle(StepGeom_TrimmedCurve)& SC, Standard_EXPORT static Handle(Geom_TrimmedCurve) MakeTrimmedCurve (const Handle(StepGeom_TrimmedCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeTrimmedCurve2d (const Handle(StepGeom_TrimmedCurve)& SC, Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeTrimmedCurve2d (const Handle(StepGeom_TrimmedCurve)& SC,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom_VectorWithMagnitude) MakeVectorWithMagnitude (const Handle(StepGeom_Vector)& SV, Standard_EXPORT static Handle(Geom_VectorWithMagnitude) MakeVectorWithMagnitude (const Handle(StepGeom_Vector)& SV,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT static Handle(Geom2d_VectorWithMagnitude) MakeVectorWithMagnitude2d (const Handle(StepGeom_Vector)& SV); Standard_EXPORT static Handle(Geom2d_VectorWithMagnitude) MakeVectorWithMagnitude2d (const Handle(StepGeom_Vector)& SV);
Standard_EXPORT static Handle(TColStd_HArray1OfReal) MakeYprRotation(const StepKinematics_SpatialRotation& SR, const Handle(StepRepr_GlobalUnitAssignedContext)& theCntxt); Standard_EXPORT static Handle(TColStd_HArray1OfReal) MakeYprRotation(const StepKinematics_SpatialRotation& SR, const Handle(StepRepr_GlobalUnitAssignedContext)& theCntxt);
}; };

View File

@@ -897,8 +897,8 @@ void StepToTopoDS_Builder::Init(const Handle(StepVisual_TessellatedFace)& theTF,
// ============================================================================ // ============================================================================
void StepToTopoDS_Builder::Init(const Handle(StepVisual_TessellatedSurfaceSet)& theTSS, void StepToTopoDS_Builder::Init(const Handle(StepVisual_TessellatedSurfaceSet)& theTSS,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
Standard_Boolean& theHasGeom, const StepData_Factors& theLocalFactors,
const StepData_Factors& theLocalFactors) Standard_Boolean& theHasGeom)
{ {
StepToTopoDS_TranslateFace aTranFace; StepToTopoDS_TranslateFace aTranFace;
aTranFace.SetPrecision(Precision()); aTranFace.SetPrecision(Precision());

View File

@@ -55,41 +55,41 @@ public:
Standard_EXPORT void Init (const Handle(StepShape_ManifoldSolidBrep)& theManifoldSolid, Standard_EXPORT void Init (const Handle(StepShape_ManifoldSolidBrep)& theManifoldSolid,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepShape_BrepWithVoids)& theBRepWithVoids, Standard_EXPORT void Init (const Handle(StepShape_BrepWithVoids)& theBRepWithVoids,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepShape_FacetedBrep)& theFB, Standard_EXPORT void Init (const Handle(StepShape_FacetedBrep)& theFB,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepShape_FacetedBrepAndBrepWithVoids)& theFBABWV, Standard_EXPORT void Init (const Handle(StepShape_FacetedBrepAndBrepWithVoids)& theFBABWV,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepShape_ShellBasedSurfaceModel)& S, Standard_EXPORT void Init (const Handle(StepShape_ShellBasedSurfaceModel)& S,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
StepToTopoDS_NMTool& NMTool, StepToTopoDS_NMTool& NMTool,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepShape_EdgeBasedWireframeModel)& S, Standard_EXPORT void Init (const Handle(StepShape_EdgeBasedWireframeModel)& S,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT void Init (const Handle(StepShape_FaceBasedSurfaceModel)& S, Standard_EXPORT void Init (const Handle(StepShape_FaceBasedSurfaceModel)& S,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT void Init (const Handle(StepShape_GeometricSet)& S, Standard_EXPORT void Init (const Handle(StepShape_GeometricSet)& S,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Handle(Transfer_ActorOfTransientProcess)& RA = NULL, const Handle(Transfer_ActorOfTransientProcess)& RA = NULL,
const Standard_Boolean isManifold = Standard_False, const Standard_Boolean isManifold = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -98,26 +98,26 @@ public:
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const Standard_Boolean theReadTessellatedWhenNoBRepOnly, const Standard_Boolean theReadTessellatedWhenNoBRepOnly,
Standard_Boolean& theHasGeom, Standard_Boolean& theHasGeom,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepVisual_TessellatedShell)& theTSh, Standard_EXPORT void Init (const Handle(StepVisual_TessellatedShell)& theTSh,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const Standard_Boolean theReadTessellatedWhenNoBRepOnly, const Standard_Boolean theReadTessellatedWhenNoBRepOnly,
Standard_Boolean& theHasGeom, Standard_Boolean& theHasGeom,
const StepData_Factors& theLocalFactors = StepData_Factors(), const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init (const Handle(StepVisual_TessellatedFace)& theTF, Standard_EXPORT void Init (const Handle(StepVisual_TessellatedFace)& theTF,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
const Standard_Boolean theReadTessellatedWhenNoBRepOnly, const Standard_Boolean theReadTessellatedWhenNoBRepOnly,
Standard_Boolean& theHasGeom, Standard_Boolean& theHasGeom,
const StepData_Factors& theLocalFactors = StepData_Factors()); const StepData_Factors& theLocalFactors);
Standard_EXPORT void Init (const Handle(StepVisual_TessellatedSurfaceSet)& theTSS, Standard_EXPORT void Init (const Handle(StepVisual_TessellatedSurfaceSet)& theTSS,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP,
Standard_Boolean& theHasGeom, const StepData_Factors& theLocalFactors,
const StepData_Factors& theLocalFactors = StepData_Factors()); Standard_Boolean& theHasGeom);
Standard_EXPORT const TopoDS_Shape& Value() const; Standard_EXPORT const TopoDS_Shape& Value() const;

Some files were not shown because too many files have changed in this diff Show More