mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
16 Commits
CR30892
...
IR-2020-06
Author | SHA1 | Date | |
---|---|---|---|
|
32b723d5c6 | ||
|
36cc58f85d | ||
|
09543c2d99 | ||
|
a7400019ce | ||
|
1fc1a207b0 | ||
|
59ec2ccec9 | ||
|
d4cefcc0da | ||
|
872f98d9ef | ||
|
2ba1172b73 | ||
|
e4e3254a35 | ||
|
04c5a696e4 | ||
|
ae58f70718 | ||
|
faff37677c | ||
|
691711cd3e | ||
|
8189cc72d0 | ||
|
c6f14a5213 |
@@ -111,7 +111,18 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||
# does not support option "-std=c++0x"
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
elseif(MINGW)
|
||||
# Set default release optimization option to O2 instead of O3, since in
|
||||
# some OCCT related examples, this gives significantly smaller binaries
|
||||
# at comparable performace with MinGW-w64.
|
||||
@@ -122,25 +133,19 @@ if(MINGW)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
endif()
|
||||
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||
# does not support option "-std=c++0x"
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# Optimize size of binaries
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
endif()
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "Sample2D_Image.h"
|
||||
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Image,AIS_Shape)
|
||||
|
||||
@@ -19,10 +20,13 @@ Sample2D_Image::Sample2D_Image(TCollection_AsciiString& aFileName,
|
||||
}
|
||||
void Sample2D_Image::MakeShape()
|
||||
{
|
||||
Handle(Graphic3d_Texture1D) anImageTexture =
|
||||
new Graphic3d_Texture1Dsegment(myFilename);
|
||||
Standard_Real coeff = (Standard_Real)(anImageTexture->GetImage()->Height())/
|
||||
(anImageTexture->GetImage()->Width())*myScale;
|
||||
Standard_Real coeff = 1.0;
|
||||
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap();
|
||||
if (anImage->Load (myFilename))
|
||||
{
|
||||
coeff = Standard_Real(anImage->Height()) / Standard_Real(anImage->Width()) * myScale;
|
||||
}
|
||||
|
||||
TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(gp_Pnt(myX,myY,0.), gp_Pnt(100*myScale+myX,myY,0.));
|
||||
TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(gp_Pnt(100*myScale+myX,myY,0.), gp_Pnt(100*myScale+myX,100*coeff+myY,0.));
|
||||
TopoDS_Edge E3 = BRepBuilderAPI_MakeEdge(gp_Pnt(100*myScale+myX,100*coeff+myY,0.), gp_Pnt(myX,100*coeff+myY,0.));
|
||||
|
@@ -2935,11 +2935,11 @@ void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)&
|
||||
{
|
||||
theView->View()->SetupXRPosedCamera();
|
||||
}
|
||||
handleMoveTo (theCtx, theView);
|
||||
handleCameraActions (theCtx, theView, aWalk);
|
||||
theView->View()->SynchronizeXRPosedToBaseCamera(); // handleCameraActions() may modify posed camera position - copy this modifications also to the base camera
|
||||
handleXRPresentations (theCtx, theView);
|
||||
|
||||
handleMoveTo (theCtx, theView);
|
||||
handleViewRedraw (theCtx, theView);
|
||||
theView->View()->UnsetXRPosedCamera();
|
||||
|
||||
|
@@ -43,7 +43,10 @@ public:
|
||||
}
|
||||
|
||||
//! Image reader.
|
||||
virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE { return myImageSource->ReadImage(); }
|
||||
virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE
|
||||
{
|
||||
return myImageSource->ReadImage (theSupported);
|
||||
}
|
||||
|
||||
protected:
|
||||
Handle(Image_Texture) myImageSource;
|
||||
|
@@ -261,7 +261,7 @@ public:
|
||||
|
||||
protected:
|
||||
//! Read image.
|
||||
virtual Handle(Image_PixMap) ReadImage() const Standard_OVERRIDE
|
||||
virtual Handle(Image_PixMap) ReadImage (const Handle(Image_SupportedFormats)& ) const Standard_OVERRIDE
|
||||
{
|
||||
Handle(VRImagePixmap) aPixmap = new VRImagePixmap();
|
||||
if (!aPixmap->Load (myVrTextureId, myVrModelName))
|
||||
|
@@ -1174,13 +1174,9 @@ void BRep_Builder::Transfert(const TopoDS_Edge& Ein,
|
||||
const TopoDS_Edge& Eout) const
|
||||
{
|
||||
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &Ein.TShape());
|
||||
if(TE->Locked())
|
||||
{
|
||||
throw TopoDS_LockedShape("BRep_Builder::Transfert");
|
||||
}
|
||||
const Standard_Real tol = TE->Tolerance();
|
||||
|
||||
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
|
||||
const BRep_ListOfCurveRepresentation& lcr = TE->Curves();
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
|
||||
|
||||
while (itcr.More()) {
|
||||
|
@@ -149,7 +149,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
|
||||
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
|
||||
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
|
||||
|
||||
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
|
||||
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
|
||||
if (aDistTool.IsDone())
|
||||
{
|
||||
if (aDistTool.DistValue() < myDistRef - myEps)
|
||||
@@ -194,7 +194,8 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
|
||||
myEps (Precision::Confusion()),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (Extrema_ExtFlag_MINMAX)
|
||||
myFlag (Extrema_ExtFlag_MINMAX),
|
||||
myAlgo (Extrema_ExtAlgo_Grad)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -205,14 +206,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
|
||||
//=======================================================================
|
||||
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
|
||||
const TopoDS_Shape& Shape2,
|
||||
const Extrema_ExtFlag F)
|
||||
const Extrema_ExtFlag F,
|
||||
const Extrema_ExtAlgo A)
|
||||
: myDistRef (0.0),
|
||||
myIsDone (Standard_False),
|
||||
myInnerSol (Standard_False),
|
||||
myEps (Precision::Confusion()),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (F)
|
||||
myFlag (F),
|
||||
myAlgo (A)
|
||||
{
|
||||
LoadS1(Shape1);
|
||||
LoadS2(Shape2);
|
||||
@@ -227,14 +230,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
|
||||
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
|
||||
const TopoDS_Shape& Shape2,
|
||||
const Standard_Real theDeflection,
|
||||
const Extrema_ExtFlag F)
|
||||
const Extrema_ExtFlag F,
|
||||
const Extrema_ExtAlgo A)
|
||||
: myDistRef (0.0),
|
||||
myIsDone (Standard_False),
|
||||
myInnerSol (Standard_False),
|
||||
myEps (theDeflection),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (F)
|
||||
myFlag (F),
|
||||
myAlgo (A)
|
||||
{
|
||||
LoadS1(Shape1);
|
||||
LoadS2(Shape2);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <BRepExtrema_SeqOfSolution.hxx>
|
||||
#include <BRepExtrema_SolutionElem.hxx>
|
||||
#include <BRepExtrema_SupportType.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -38,9 +39,9 @@ class BRepExtrema_DistShapeShape
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape();
|
||||
//! computation of the minimum distance (value and pair of points) using default deflection <br>
|
||||
//! Default value is Precision::Confusion(). <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
//! create tool and load both shapes into it <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
void SetDeflection(const Standard_Real theDeflection)
|
||||
{
|
||||
@@ -128,6 +129,11 @@ class BRepExtrema_DistShapeShape
|
||||
myFlag = F;
|
||||
}
|
||||
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
|
||||
@@ -150,6 +156,7 @@ private:
|
||||
Standard_Boolean myIsInitS1;
|
||||
Standard_Boolean myIsInitS2;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
Bnd_SeqOfBox myBV1;
|
||||
Bnd_SeqOfBox myBV2;
|
||||
Bnd_SeqOfBox myBE1;
|
||||
|
@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
|
||||
const Standard_Real Dst=B1.Distance(B2);
|
||||
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
|
||||
{
|
||||
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
|
||||
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
|
||||
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
|
||||
if ( NbExtrema > 0 )
|
||||
{
|
||||
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
|
||||
const Standard_Real Dst=B1.Distance(B2);
|
||||
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
|
||||
{
|
||||
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
|
||||
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
|
||||
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
|
||||
if ( NbExtrema > 0 )
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <BRepExtrema_SeqOfSolution.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
@@ -38,8 +39,9 @@ class BRepExtrema_DistanceSS
|
||||
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
|
||||
const Bnd_Box& B1, const Bnd_Box& B2,
|
||||
const Standard_Real DstRef,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
|
||||
{
|
||||
Perform(S1, S2, B1, B2);
|
||||
}
|
||||
@@ -50,8 +52,9 @@ class BRepExtrema_DistanceSS
|
||||
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
|
||||
const Bnd_Box& B1, const Bnd_Box& B2,
|
||||
const Standard_Real DstRef, const Standard_Real aDeflection,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
|
||||
{
|
||||
Perform(S1, S2, B1, B2);
|
||||
}
|
||||
@@ -80,6 +83,11 @@ class BRepExtrema_DistanceSS
|
||||
{
|
||||
myFlag = F;
|
||||
}
|
||||
//! sets the flag controlling ...
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -122,6 +130,7 @@ class BRepExtrema_DistanceSS
|
||||
Standard_Boolean myModif;
|
||||
Standard_Real myEps;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -32,9 +32,9 @@
|
||||
//=======================================================================
|
||||
|
||||
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag)
|
||||
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
|
||||
{
|
||||
Initialize(TheFace,TheFlag);
|
||||
Initialize(TheFace,TheFlag,TheAlgo);
|
||||
Perform(TheVertex,TheFace);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
|
||||
//=======================================================================
|
||||
|
||||
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag)
|
||||
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
|
||||
{
|
||||
// cette surface doit etre en champ. Extrema ne fait
|
||||
// pas de copie et prend seulement un pointeur dessus.
|
||||
@@ -60,6 +60,7 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
|
||||
myExtPS.SetFlag(TheFlag);
|
||||
myExtPS.SetAlgo(TheAlgo);
|
||||
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Extrema_SequenceOfPOnSurf.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
|
||||
class TopoDS_Vertex;
|
||||
class TopoDS_Face;
|
||||
@@ -37,10 +38,12 @@ class BRepExtrema_ExtPF
|
||||
{}
|
||||
//! It calculates all the distances. <br>
|
||||
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! An exception is raised if the fields have not been initialized. <br>
|
||||
//! Be careful: this method uses the Face only for classify not for the fields. <br>
|
||||
@@ -76,6 +79,11 @@ class BRepExtrema_ExtPF
|
||||
myExtPS.SetFlag(F);
|
||||
}
|
||||
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myExtPS.SetAlgo(A);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Extrema_ExtPS myExtPS;
|
||||
|
@@ -721,6 +721,7 @@ void BRepFill_Filling::Build()
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt(V1);
|
||||
NewV1 = BRepLib_MakeVertex(aPnt);
|
||||
BB.UpdateVertex(NewV1, dmax);
|
||||
myOldNewMap.Bind(V1.Oriented(TopAbs_FORWARD), NewV1);
|
||||
}
|
||||
|
||||
if (myOldNewMap.IsBound(V2))
|
||||
@@ -730,6 +731,7 @@ void BRepFill_Filling::Build()
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt(V2);
|
||||
NewV2 = BRepLib_MakeVertex(aPnt);
|
||||
BB.UpdateVertex(NewV2, dmax);
|
||||
myOldNewMap.Bind(V2.Oriented(TopAbs_FORWARD), NewV2);
|
||||
}
|
||||
|
||||
NewV1.Orientation(TopAbs_FORWARD);
|
||||
@@ -742,9 +744,6 @@ void BRepFill_Filling::Build()
|
||||
BRepLib::SameParameter(NewEdge, dmax, Standard_True);
|
||||
FinalEdges.Append(NewEdge);
|
||||
myOldNewMap.Bind(InitEdge.Oriented(TopAbs_FORWARD), NewEdge.Oriented(TopAbs_FORWARD));
|
||||
myOldNewMap.Bind(V1.Oriented(TopAbs_FORWARD), NewV1.Oriented(TopAbs_FORWARD));
|
||||
if (!V1.IsSame(V2))
|
||||
myOldNewMap.Bind(V2.Oriented(TopAbs_FORWARD), NewV2.Oriented(TopAbs_FORWARD));
|
||||
}
|
||||
|
||||
TopoDS_Wire FinalWire = WireFromList(FinalEdges);
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <BRepLib_MakeFace.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <GCPnts.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
@@ -179,6 +178,39 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
|
||||
|
||||
namespace
|
||||
{
|
||||
static void fillParams (const TColStd_Array1OfReal& theKnots,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Real theParMin,
|
||||
Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams)
|
||||
{
|
||||
Standard_Real aPrevPar = theParMin;
|
||||
theParams.Append (aPrevPar);
|
||||
|
||||
Standard_Integer aNbP = Max (theDegree, 1);
|
||||
|
||||
for (Standard_Integer i = 1;
|
||||
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
|
||||
{
|
||||
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
|
||||
continue;
|
||||
|
||||
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
|
||||
for (Standard_Integer k = 1; k <= aNbP ; ++k)
|
||||
{
|
||||
Standard_Real aPar = theKnots (i) + k * aStep;
|
||||
if (aPar > theParMax - Precision::PConfusion())
|
||||
break;
|
||||
|
||||
if (aPar > aPrevPar + Precision::PConfusion())
|
||||
{
|
||||
theParams.Append (aPar);
|
||||
aPrevPar = aPar;
|
||||
}
|
||||
}
|
||||
}
|
||||
theParams.Append (theParMax);
|
||||
}
|
||||
|
||||
static void fillPoints (const BRepAdaptor_Curve& theCurve,
|
||||
const NCollection_Vector<Standard_Real> theParams,
|
||||
@@ -326,13 +358,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
aKnots.SetValue (1, GC->FirstParameter());
|
||||
aKnots.SetValue (2, GC->LastParameter());
|
||||
|
||||
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
|
||||
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(Geom_BSplineCurve) GC = c.BSpline();
|
||||
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
|
||||
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Line:
|
||||
@@ -359,7 +391,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
aBounds.SetValue (1, dfUf);
|
||||
aBounds.SetValue (2, dfUl);
|
||||
|
||||
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
|
||||
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
|
||||
if (n == 5)
|
||||
aDeflection = Draw::Atof(a[4]);
|
||||
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection, Extrema_ExtFlag_MIN);
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
|
||||
|
||||
if (dst.IsDone())
|
||||
{
|
||||
|
@@ -617,9 +617,9 @@ static Standard_Integer getedgeregul
|
||||
//=======================================================================
|
||||
static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3 || n > 4) {
|
||||
if (n < 3 || n > 5) {
|
||||
di << "Project point on the face.\n";
|
||||
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax]\n";
|
||||
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
|
||||
return 1;
|
||||
}
|
||||
// get face
|
||||
@@ -642,6 +642,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
//
|
||||
// get projection options
|
||||
// default values;
|
||||
Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
|
||||
Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
|
||||
//
|
||||
for (Standard_Integer i = 3; i < n; ++i) {
|
||||
@@ -654,6 +655,12 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
else if (!strcasecmp(a[i], "-minmax")) {
|
||||
anExtFlag = Extrema_ExtFlag_MINMAX;
|
||||
}
|
||||
else if (!strcasecmp(a[i], "-t")) {
|
||||
anExtAlgo = Extrema_ExtAlgo_Tree;
|
||||
}
|
||||
else if (!strcasecmp(a[i], "-g")) {
|
||||
anExtAlgo = Extrema_ExtAlgo_Grad;
|
||||
}
|
||||
}
|
||||
//
|
||||
// get surface
|
||||
@@ -670,6 +677,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
GeomAPI_ProjectPointOnSurf aProjPS;
|
||||
aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
|
||||
// set the options
|
||||
aProjPS.SetExtremaAlgo(anExtAlgo);
|
||||
aProjPS.SetExtremaFlag(anExtFlag);
|
||||
// perform projection
|
||||
aProjPS.Perform(aP);
|
||||
@@ -758,7 +766,7 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
|
||||
|
||||
theCommands.Add ("projponf",
|
||||
"projponf face pnt [extrema flag: -min/-max/-minmax]\n"
|
||||
"projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
|
||||
"\t\tProject point on the face.",
|
||||
__FILE__, projponf, g);
|
||||
}
|
||||
|
@@ -1156,3 +1156,112 @@ TopAbs_Orientation BRepTools::OriEdgeInFace (const TopoDS_Edge& E,
|
||||
}
|
||||
throw Standard_ConstructionError("BRepTools::OriEdgeInFace");
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
//function : findInternalsToKeep
|
||||
//purpose : Looks for internal sub-shapes which has to be kept to preserve
|
||||
// topological connectivity.
|
||||
//=======================================================================
|
||||
static void findInternalsToKeep (const TopoDS_Shape& theS,
|
||||
TopTools_MapOfShape& theAllNonInternals,
|
||||
TopTools_MapOfShape& theAllInternals,
|
||||
TopTools_MapOfShape& theShapesToKeep)
|
||||
{
|
||||
for (TopoDS_Iterator it (theS, Standard_True); it.More(); it.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSS = it.Value();
|
||||
findInternalsToKeep (aSS, theAllNonInternals, theAllInternals, theShapesToKeep);
|
||||
|
||||
if (aSS.Orientation() == TopAbs_INTERNAL)
|
||||
theAllInternals.Add (aSS);
|
||||
else
|
||||
theAllNonInternals.Add (aSS);
|
||||
|
||||
if (theAllNonInternals.Contains(aSS) && theAllInternals.Contains (aSS))
|
||||
theShapesToKeep.Add (aSS);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : removeShapes
|
||||
//purpose : Removes sub-shapes from the shape
|
||||
//=======================================================================
|
||||
static void removeShapes (TopoDS_Shape& theS,
|
||||
const TopTools_ListOfShape& theLS)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
Standard_Boolean isFree = theS.Free();
|
||||
theS.Free (Standard_True);
|
||||
|
||||
for (TopTools_ListOfShape::Iterator it (theLS); it.More(); it.Next())
|
||||
{
|
||||
aBB.Remove (theS, it.Value());
|
||||
}
|
||||
theS.Free (isFree);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : removeInternals
|
||||
//purpose : Removes recursively all internal sub-shapes from the given shape.
|
||||
// Returns true if all sub-shapes have been removed from the shape.
|
||||
//=======================================================================
|
||||
static Standard_Boolean removeInternals (TopoDS_Shape& theS,
|
||||
const TopTools_MapOfShape* theShapesToKeep)
|
||||
{
|
||||
TopTools_ListOfShape aLRemove;
|
||||
for (TopoDS_Iterator it (theS, Standard_True); it.More(); it.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSS = it.Value();
|
||||
if (aSS.Orientation() == TopAbs_INTERNAL)
|
||||
{
|
||||
if (!theShapesToKeep || !theShapesToKeep->Contains (aSS))
|
||||
aLRemove.Append (aSS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (removeInternals (*(TopoDS_Shape*)&aSS, theShapesToKeep))
|
||||
aLRemove.Append (aSS);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aNbSToRemove = aLRemove.Extent();
|
||||
if (aNbSToRemove)
|
||||
{
|
||||
removeShapes (theS, aLRemove);
|
||||
return (theS.NbChildren() == 0);
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveInternals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepTools::RemoveInternals (TopoDS_Shape& theS,
|
||||
const Standard_Boolean theForce)
|
||||
{
|
||||
TopTools_MapOfShape *pMKeep = NULL, aMKeep;
|
||||
if (!theForce)
|
||||
{
|
||||
// Find all internal sub-shapes which has to be kept to preserve topological connectivity.
|
||||
// Note that if the multi-connected shape is not directly contained in some shape,
|
||||
// but as a part of bigger sub-shape which will be removed, the multi-connected
|
||||
// shape is going to be removed also, breaking topological connectivity.
|
||||
// For instance, <theS> is a compound of the face and edge, which does not
|
||||
// belong to the face. The face contains internal wire and the edge shares
|
||||
// the vertex with one of the vertices of that wire. The vertex is not directly
|
||||
// contained in the face, thus will be removed as part of internal wire, and topological
|
||||
// connectivity between edge and face will be lost.
|
||||
TopTools_MapOfShape anAllNonInternals, anAllInternals;
|
||||
findInternalsToKeep (theS, anAllNonInternals, anAllInternals, aMKeep);
|
||||
if (aMKeep.Extent())
|
||||
pMKeep = &aMKeep;
|
||||
}
|
||||
|
||||
removeInternals (theS, pMKeep);
|
||||
}
|
||||
|
@@ -238,6 +238,16 @@ public:
|
||||
Standard_EXPORT static TopAbs_Orientation OriEdgeInFace(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace);
|
||||
|
||||
//! Removes internal sub-shapes from the shape.
|
||||
//! The check on internal status is based on orientation of sub-shapes,
|
||||
//! classification is not performed.
|
||||
//! Before removal of internal sub-shapes the algorithm checks if such
|
||||
//! removal is not going to break topological connectivity between sub-shapes.
|
||||
//! The flag <theForce> if set to true disables the connectivity check and clears
|
||||
//! the given shape from all sub-shapes with internal orientation.
|
||||
Standard_EXPORT static void RemoveInternals (TopoDS_Shape& theS,
|
||||
const Standard_Boolean theForce = Standard_False);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -66,18 +66,6 @@ public: //! @name Adding elements in BVH
|
||||
BVH_Object<NumType, Dimension>::myIsDirty = Standard_True;
|
||||
}
|
||||
|
||||
//! Allows to update the box of the element while the tree is not yet built
|
||||
virtual void UpdateBox (const Standard_Integer theId, const BVH_Box<NumType, Dimension>& theNewBox)
|
||||
{
|
||||
if (BVH_Object<NumType, Dimension>::myIsDirty)
|
||||
{
|
||||
if (theId >= 0 && theId < Size())
|
||||
{
|
||||
myBoxes[theId] = theNewBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public: //! @name BVH construction
|
||||
|
||||
//! BVH construction
|
||||
|
@@ -84,7 +84,7 @@ public: //! @name Necessary overrides for BVH construction
|
||||
//! Returns the bounding box with the given index.
|
||||
virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
|
||||
{
|
||||
return this->myBoxes[myIndices[theIndex]];
|
||||
return myBoxes[myIndices[theIndex]];
|
||||
}
|
||||
|
||||
//! Swaps indices of two specified boxes.
|
||||
@@ -97,7 +97,7 @@ public: //! @name Necessary overrides for BVH construction
|
||||
//! Returns the Element with the index theIndex.
|
||||
virtual DataType Element (const Standard_Integer theIndex) const
|
||||
{
|
||||
return this->myElements[myIndices[theIndex]];
|
||||
return myElements[myIndices[theIndex]];
|
||||
}
|
||||
|
||||
protected: //! @name Fields
|
||||
|
@@ -88,24 +88,6 @@ public: //! @name Point-Box Square distance
|
||||
return aDist;
|
||||
}
|
||||
|
||||
//! Computes Max square distance between point and bounding box
|
||||
static T PointBoxMaxSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theCMin,
|
||||
const BVH_VecNt& theCMax)
|
||||
{
|
||||
T aDist = 0;
|
||||
for (int i = 0; i < N; ++i)
|
||||
{
|
||||
T dmin = 0, dmax = 0;
|
||||
if (thePoint[i] > theCMin[i]) { dmin = thePoint[i] - theCMin[i]; }
|
||||
if (thePoint[i] < theCMax[i]) { dmax = theCMax[i] - thePoint[i]; }
|
||||
T d = dmin > dmax ? dmin : dmax;
|
||||
d *= d;
|
||||
aDist += d;
|
||||
}
|
||||
return aDist;
|
||||
}
|
||||
|
||||
public: //! @name Point-Box projection
|
||||
|
||||
//! Computes projection of point on bounding box
|
||||
@@ -128,6 +110,7 @@ public: //! @name Point-Box projection
|
||||
{
|
||||
return thePoint.cwiseMax (theCMin).cwiseMin (theCMax);
|
||||
}
|
||||
|
||||
public: //! @name Point-Triangle Square distance
|
||||
|
||||
//! Computes square distance between point and triangle
|
||||
|
@@ -1416,6 +1416,39 @@ static Standard_Integer binrestore(Draw_Interpretor& di, Standard_Integer n, con
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// removeinternals
|
||||
//=======================================================================
|
||||
static Standard_Integer removeInternals (Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n < 2)
|
||||
{
|
||||
di.PrintHelp (a[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get (a[1]);
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
di << a[1] << "is a null shape\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean isForce = Standard_False;
|
||||
if (n > 2)
|
||||
{
|
||||
isForce = (Draw::Atoi (a[2]) != 0);
|
||||
}
|
||||
|
||||
BRepTools::RemoveInternals (aShape, isForce);
|
||||
|
||||
DBRep::Set (a[1], aShape);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BasicCommands
|
||||
//purpose :
|
||||
@@ -1487,6 +1520,12 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("binrestore", "binrestore filename shape\n"
|
||||
"\t\trestore the shape from the binary format file",
|
||||
__FILE__, binrestore, g);
|
||||
|
||||
theCommands.Add ("removeinternals", "removeinternals shape [force flag {0/1}]"
|
||||
"\n\t\t Removes sub-shapes with internal orientation from the shape.\n"
|
||||
"\n\t\t Force flag disables the check on topological connectivity and"
|
||||
"removes all internal sub-shapes\n",
|
||||
__FILE__, removeInternals, g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -18,10 +18,6 @@
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Draw_Box.hxx>
|
||||
|
||||
// This file defines global functions not declared in any public header,
|
||||
// intended for use from debugger prompt (Command Window in Visual Studio)
|
||||
|
||||
@@ -44,47 +40,3 @@ Standard_EXPORT const char* Draw_Eval (const char *theCommandStr)
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DBRep_SetOBB
|
||||
//purpose : Draw OBB
|
||||
//=======================================================================
|
||||
Standard_EXPORT const char* Draw_SetOBB(const char* theNameStr, void* theBox)
|
||||
{
|
||||
if (theNameStr == 0 || theBox == 0)
|
||||
{
|
||||
return "Error: name or box is null";
|
||||
}
|
||||
try {
|
||||
Bnd_OBB B = *(Bnd_OBB*)theBox;
|
||||
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
|
||||
Draw::Set (theNameStr, DB);
|
||||
return theNameStr;
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DBRep_SetBox
|
||||
//purpose : Draw Box
|
||||
//=======================================================================
|
||||
Standard_EXPORT const char* Draw_SetBox(const char* theNameStr, void* theBox)
|
||||
{
|
||||
if (theNameStr == 0 || theBox == 0)
|
||||
{
|
||||
return "Error: name or box is null";
|
||||
}
|
||||
try {
|
||||
Bnd_Box B = *(Bnd_Box*)theBox;
|
||||
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
|
||||
Draw::Set (theNameStr, DB);
|
||||
return theNameStr;
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
@@ -102,8 +102,8 @@ Standard_Boolean Draw_ProgressIndicator::Show(const Standard_Boolean force)
|
||||
if ( scale.GetName().IsNull() ) continue; // skip unnamed scopes
|
||||
aText << " " << scale.GetName()->ToCString() << ": ";
|
||||
|
||||
// if scope has subscopes, print end of subscope as its current position
|
||||
Standard_Real locPos = ( i >1 ? GetScope ( i-1 ).GetLast() : GetPosition() );
|
||||
// if scope has subscopes, print end of subscope as it s current position
|
||||
Standard_Real locPos = ( (i >1 && GetPosition()!=0) ? GetScope ( i-1 ).GetLast() : GetPosition() );
|
||||
// print progress info differently for finite and infinite scopes
|
||||
if ( scale.GetInfinite() )
|
||||
{
|
||||
|
27
src/Extrema/Extrema_ExtAlgo.hxx
Normal file
27
src/Extrema/Extrema_ExtAlgo.hxx
Normal file
@@ -0,0 +1,27 @@
|
||||
// Created on: 1991-02-26
|
||||
// Created by: Isabelle GRIGNON
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Extrema_ExtAlgo_HeaderFile
|
||||
#define _Extrema_ExtAlgo_HeaderFile
|
||||
|
||||
|
||||
enum Extrema_ExtAlgo
|
||||
{
|
||||
Extrema_ExtAlgo_Grad,
|
||||
Extrema_ExtAlgo_Tree
|
||||
};
|
||||
|
||||
#endif // _Extrema_ExtAlgo_HeaderFile
|
@@ -17,16 +17,12 @@
|
||||
#ifndef _Extrema_ExtFlag_HeaderFile
|
||||
#define _Extrema_ExtFlag_HeaderFile
|
||||
|
||||
//! Enumeration describes the objective for extrema algorithms.
|
||||
//! Generally:
|
||||
//! - *Extrema_ExtFlag_MIN* - means that only minimal solutions are required
|
||||
//! - *Extrema_ExtFlag_MAX* - means that only maximal solutions are required
|
||||
//! - *Extrema_ExtFlag_MINMAX* - means that all solutions are required
|
||||
|
||||
enum Extrema_ExtFlag
|
||||
{
|
||||
Extrema_ExtFlag_MIN,
|
||||
Extrema_ExtFlag_MAX,
|
||||
Extrema_ExtFlag_MINMAX
|
||||
Extrema_ExtFlag_MIN,
|
||||
Extrema_ExtFlag_MAX,
|
||||
Extrema_ExtFlag_MINMAX
|
||||
};
|
||||
|
||||
#endif // _Extrema_ExtFlag_HeaderFile
|
||||
|
@@ -144,7 +144,7 @@ void Extrema_ExtPExtS::MakePreciser (Standard_Real& U,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS (const Handle (Extrema_GenExtPS)& theExtPS)
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS()
|
||||
: myuinf(0.0),
|
||||
myusup(0.0),
|
||||
mytolu(0.0),
|
||||
@@ -153,8 +153,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const Handle (Extrema_GenExtPS)& theExtPS)
|
||||
mytolv(0.0),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
myNbExt(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -167,8 +166,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
const Standard_Real theTolV)
|
||||
: myuinf(theUmin),
|
||||
myusup(theUsup),
|
||||
mytolu(theTolU),
|
||||
@@ -178,8 +176,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
myS (theS),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
myNbExt(0)
|
||||
{
|
||||
Initialize (theS,
|
||||
theUmin,
|
||||
@@ -196,8 +193,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt& theP,
|
||||
const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
const Standard_Real theTolV)
|
||||
: myuinf(theS->FirstUParameter()),
|
||||
myusup(theS->LastUParameter()),
|
||||
mytolu(theTolU),
|
||||
@@ -207,8 +203,7 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
myS (theS),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
myNbExt(0)
|
||||
{
|
||||
Initialize (theS,
|
||||
theS->FirstUParameter(),
|
||||
@@ -258,18 +253,15 @@ void Extrema_ExtPExtS::Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtr
|
||||
|
||||
if (!myIsAnalyticallyComputable)
|
||||
{
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize (theS->ChangeSurface(),
|
||||
32,
|
||||
32,
|
||||
theUinf,
|
||||
theUsup,
|
||||
theVinf,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
myExtPS.Initialize (theS->ChangeSurface(),
|
||||
32,
|
||||
32,
|
||||
theUinf,
|
||||
theUsup,
|
||||
theVinf,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,9 +280,11 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
|
||||
myNbExt = 0;
|
||||
|
||||
if (!myIsAnalyticallyComputable) {
|
||||
myExtPS->Perform(P);
|
||||
myDone = myExtPS->IsDone();
|
||||
myNbExt = myExtPS->NbExt();
|
||||
myExtPS.Perform(P);
|
||||
myDone = myExtPS.IsDone();
|
||||
// modified by NIZHNY-EAP Wed Nov 17 12:59:08 1999 ___BEGIN___
|
||||
myNbExt = myExtPS.NbExt();
|
||||
// modified by NIZHNY-EAP Wed Nov 17 12:59:09 1999 ___END___
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,8 +443,10 @@ Standard_Boolean Extrema_ExtPExtS::IsDone () const { return myDone; }
|
||||
Standard_Integer Extrema_ExtPExtS::NbExt () const
|
||||
{
|
||||
if (!IsDone()) { throw StdFail_NotDone(); }
|
||||
|
||||
return myNbExt;
|
||||
if (myIsAnalyticallyComputable)
|
||||
return myNbExt;
|
||||
else
|
||||
return myExtPS.NbExt();
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
@@ -466,7 +462,7 @@ Standard_Real Extrema_ExtPExtS::SquareDistance (const Standard_Integer N) const
|
||||
return mySqDist[N-1];
|
||||
// modified by NIZHNY-MKK Thu Sep 18 14:48:42 2003.END
|
||||
else
|
||||
return myExtPS->SquareDistance(N);
|
||||
return myExtPS.SquareDistance(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
@@ -483,7 +479,7 @@ const Extrema_POnSurf& Extrema_ExtPExtS::Point (const Standard_Integer N) const
|
||||
}
|
||||
// modified by NIZHNY-MKK Thu Sep 18 14:47:43 2003.END
|
||||
else
|
||||
return myExtPS->Point(N);
|
||||
return myExtPS.Point(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
|
@@ -50,21 +50,15 @@ class Extrema_ExtPExtS : public Standard_Transient
|
||||
public:
|
||||
|
||||
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const Handle(Extrema_GenExtPS)& theExtPS);
|
||||
Standard_EXPORT Extrema_ExtPExtS();
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a Surface.
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a Surface.
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
@@ -109,12 +103,13 @@ private:
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
|
||||
gp_Vec myDirection;
|
||||
gp_Ax2 myPosition;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Standard_Boolean myIsAnalyticallyComputable;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbExt;
|
||||
Standard_Real mySqDist[4];
|
||||
Extrema_POnSurf myPoint[4];
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -208,9 +208,7 @@ static Standard_Boolean IsExtremum (const Standard_Real U, const Standard_Real V
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS()
|
||||
{
|
||||
myvinf = myvsup = 0.0;
|
||||
mytolv = Precision::Confusion();
|
||||
@@ -235,10 +233,7 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
const Standard_Real theTolV)
|
||||
{
|
||||
Initialize (theS,
|
||||
theUmin,
|
||||
@@ -258,10 +253,7 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt& theP,
|
||||
const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
const Standard_Real theTolV)
|
||||
{
|
||||
Initialize (theS,
|
||||
theS->FirstUParameter(),
|
||||
@@ -313,18 +305,15 @@ void Extrema_ExtPRevS::Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution
|
||||
aNbv = 100;
|
||||
}
|
||||
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize (theS->ChangeSurface(),
|
||||
aNbu,
|
||||
aNbv,
|
||||
theUmin,
|
||||
theUsup,
|
||||
theVmin,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
myExtPS.Initialize (theS->ChangeSurface(),
|
||||
aNbu,
|
||||
aNbv,
|
||||
theUmin,
|
||||
theUsup,
|
||||
theVmin,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -337,11 +326,11 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
|
||||
myDone = Standard_False;
|
||||
myNbExt = 0;
|
||||
|
||||
if (!myIsAnalyticallyComputable)
|
||||
{
|
||||
myExtPS->Perform(P);
|
||||
myDone = myExtPS->IsDone();
|
||||
myNbExt = myExtPS->NbExt();
|
||||
if (!myIsAnalyticallyComputable) {
|
||||
|
||||
myExtPS.Perform(P);
|
||||
myDone = myExtPS.IsDone();
|
||||
myNbExt = myExtPS.NbExt();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -566,7 +555,7 @@ Standard_Real Extrema_ExtPRevS::SquareDistance(const Standard_Integer N) const
|
||||
if (myIsAnalyticallyComputable)
|
||||
return mySqDist[N-1];
|
||||
else
|
||||
return myExtPS->SquareDistance(N);
|
||||
return myExtPS.SquareDistance(N);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
@@ -582,7 +571,7 @@ const Extrema_POnSurf& Extrema_ExtPRevS::Point(const Standard_Integer N) const
|
||||
if (myIsAnalyticallyComputable)
|
||||
return myPoint[N-1];
|
||||
else
|
||||
return myExtPS->Point(N);
|
||||
return myExtPS.Point(N);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -45,21 +45,16 @@ class Extrema_ExtPRevS : public Standard_Transient
|
||||
|
||||
public:
|
||||
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
Standard_EXPORT Extrema_ExtPRevS();
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a SurfacePtr from Adaptor3d.
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a SurfacePtr from Adaptor3d.
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
@@ -95,12 +90,13 @@ private:
|
||||
Standard_Real myvsup;
|
||||
Standard_Real mytolv;
|
||||
gp_Ax2 myPosition;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Standard_Boolean myIsAnalyticallyComputable;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbExt;
|
||||
Standard_Real mySqDist[8];
|
||||
Extrema_POnSurf myPoint[8];
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -157,8 +157,12 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget)
|
||||
const Extrema_ExtFlag theF,
|
||||
const Extrema_ExtAlgo theA)
|
||||
{
|
||||
myExtPS.SetFlag (theF);
|
||||
myExtPS.SetAlgo (theA);
|
||||
|
||||
Initialize (theS,
|
||||
theS.FirstUParameter(),
|
||||
theS.LastUParameter(),
|
||||
@@ -167,8 +171,6 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
theTolU,
|
||||
theTolV);
|
||||
|
||||
myExtPS->SetTarget (theTarget);
|
||||
|
||||
Perform (theP);
|
||||
}
|
||||
|
||||
@@ -185,8 +187,12 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget)
|
||||
const Extrema_ExtFlag theF,
|
||||
const Extrema_ExtAlgo theA)
|
||||
{
|
||||
myExtPS.SetFlag (theF);
|
||||
myExtPS.SetAlgo (theA);
|
||||
|
||||
Initialize (theS,
|
||||
theUinf,
|
||||
theUsup,
|
||||
@@ -195,8 +201,6 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
theTolU,
|
||||
theTolV);
|
||||
|
||||
myExtPS->SetTarget (theTarget);
|
||||
|
||||
Perform (theP);
|
||||
}
|
||||
|
||||
@@ -247,10 +251,7 @@ void Extrema_ExtPS::Initialize (const Adaptor3d_Surface& theS,
|
||||
if(bUIsoIsDeg) nbU = 300;
|
||||
if(bVIsoIsDeg) nbV = 300;
|
||||
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize(*myS, nbU, nbV, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
myExtPS.Initialize(*myS, nbU, nbV, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
|
||||
myExtPExtS.Nullify();
|
||||
myExtPRevS.Nullify();
|
||||
@@ -291,7 +292,7 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) aS (new GeomAdaptor_HSurfaceOfLinearExtrusion (
|
||||
GeomAdaptor_SurfaceOfLinearExtrusion (myS->BasisCurve(), myS->Direction())));
|
||||
|
||||
myExtPExtS = new Extrema_ExtPExtS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv, myExtPS);
|
||||
myExtPExtS = new Extrema_ExtPExtS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -317,7 +318,7 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
Handle(GeomAdaptor_HSurfaceOfRevolution) aS (new GeomAdaptor_HSurfaceOfRevolution (
|
||||
GeomAdaptor_SurfaceOfRevolution (myS->BasisCurve(), myS->AxeOfRevolution())));
|
||||
|
||||
myExtPRevS = new Extrema_ExtPRevS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv, myExtPS);
|
||||
myExtPRevS = new Extrema_ExtPRevS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -338,13 +339,13 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
|
||||
default:
|
||||
{
|
||||
myExtPS->Perform (thePoint);
|
||||
myDone = myExtPS->IsDone();
|
||||
myExtPS.Perform (thePoint);
|
||||
myDone = myExtPS.IsDone();
|
||||
if (myDone)
|
||||
{
|
||||
for (Standard_Integer anIdx = 1; anIdx <= myExtPS->NbExt(); ++anIdx)
|
||||
for (Standard_Integer anIdx = 1; anIdx <= myExtPS.NbExt(); ++anIdx)
|
||||
{
|
||||
TreatSolution (myExtPS->Point (anIdx), myExtPS->SquareDistance (anIdx));
|
||||
TreatSolution (myExtPS.Point (anIdx), myExtPS.SquareDistance (anIdx));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -410,8 +411,10 @@ void Extrema_ExtPS::TrimmedSquareDistances(Standard_Real& dUfVf,
|
||||
|
||||
void Extrema_ExtPS::SetFlag(const Extrema_ExtFlag F)
|
||||
{
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->SetTarget(F);
|
||||
myExtPS.SetFlag(F);
|
||||
}
|
||||
|
||||
void Extrema_ExtPS::SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myExtPS.SetAlgo(A);
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Extrema_ExtPExtS;
|
||||
class Extrema_ExtPRevS;
|
||||
@@ -62,11 +63,7 @@ public:
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX);
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
@@ -76,24 +73,10 @@ public:
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Real Uinf,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vinf,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX);
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S,
|
||||
const Standard_Real Uinf,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vinf,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV);
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! Computes the distances.
|
||||
//! An exception is raised if the fieds have not been
|
||||
@@ -124,6 +107,9 @@ public:
|
||||
Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dUfVf, Standard_Real& dUfVl, Standard_Real& dUlVf, Standard_Real& dUlVl, gp_Pnt& PUfVf, gp_Pnt& PUfVl, gp_Pnt& PUlVf, gp_Pnt& PUlVl) const;
|
||||
|
||||
Standard_EXPORT void SetFlag (const Extrema_ExtFlag F);
|
||||
|
||||
Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -144,7 +130,7 @@ private:
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Standard_Boolean myDone;
|
||||
Extrema_ExtPElS myExtPElS;
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Extrema_SequenceOfPOnSurf myPoints;
|
||||
Standard_Real myuinf;
|
||||
Standard_Real myusup;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,19 +21,18 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <BVH_BoxSet.hxx>
|
||||
#include <BVH_IndexedBoxSet.hxx>
|
||||
#include <BVH_Traverse.hxx>
|
||||
#include <Extrema_HArray2OfPOnSurfParams.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Extrema_POnSurfParams.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Extrema_HArray2OfPOnSurfParams.hxx>
|
||||
#include <Extrema_HUBTreeOfSphere.hxx>
|
||||
#include <Bnd_HArray1OfSphere.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <Extrema_POnSurfParams.hxx>
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_TypeMismatch;
|
||||
@@ -43,339 +42,130 @@ class Extrema_POnSurf;
|
||||
class Extrema_POnSurfParams;
|
||||
|
||||
|
||||
//! Grid cell defined by (U, V) indices of the minimal
|
||||
//! corner of the cell
|
||||
struct GridCell
|
||||
{
|
||||
Standard_Integer UIndex; //!< U index of the minimal corner
|
||||
Standard_Integer VIndex; //!< V index of the minimal corner
|
||||
|
||||
GridCell (Standard_Integer theUInd = -1, Standard_Integer theVInd = -1)
|
||||
: UIndex (theUInd), VIndex (theVInd)
|
||||
{}
|
||||
};
|
||||
|
||||
//! typedef to BVH tree of the grid cells
|
||||
typedef BVH_BoxSet <Standard_Real, 3, GridCell> Extrema_GenExtPS_GridCellBoxSet;
|
||||
|
||||
|
||||
//! It calculates the extreme distances between a point and a surface.
|
||||
//! It calculates all the extremum distances
|
||||
//! between a point and a surface.
|
||||
//! These distances can be minimum or maximum.
|
||||
//!
|
||||
//! The function F(u,v) = distance (P, S(u,v)) has an extrema when
|
||||
//! gradient(F) = 0. The algorithm searches all the zeros inside
|
||||
//! the definition ranges of the surface.
|
||||
//!
|
||||
//! When defining the surface, the number of samples in U and V direction
|
||||
//! should be specified. These numbers should be great enough such
|
||||
//! that if there exist N extreme distances between the point and the surface,
|
||||
//! so there also exist N extrema between the point and the grid.
|
||||
//!
|
||||
//! It is possible to look for extrema distances in the whole parametric
|
||||
//! space of the surface or limit it with the specified range which can be
|
||||
//! useful when it is needed to look for local extrema distances.
|
||||
//!
|
||||
//! Parametric tolerances are used to determine the conditions to stop the
|
||||
//! iterations - at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV
|
||||
//!
|
||||
//! It is possible to look for only Minimal or Maximal distances,
|
||||
//! as well as for all solutions.
|
||||
//!
|
||||
//! The class is BVH enhanced - the grid cells are stored into BVH-organized
|
||||
//! structure. Depending on the Extrema target the traverse of the BVH tree
|
||||
//! is different.
|
||||
class Extrema_GenExtPS:
|
||||
protected BVH_Traverse <Standard_Real, 3, Extrema_GenExtPS_GridCellBoxSet>,
|
||||
public Standard_Transient
|
||||
class Extrema_GenExtPS
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (Extrema_GenExtPS, Standard_Transient)
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
public: //! @name Constructors computing the distances
|
||||
|
||||
//! Constructor for computation of the distances between specified point and surface.
|
||||
//! The whole parametric space of the surfaces is taken into account.
|
||||
//!
|
||||
//! Constructor is mostly used for one time projection of the point on the surface,
|
||||
//! but still the instances of extrema can be used for projecting other points on the surface
|
||||
//! with *Perform()* method.
|
||||
//!
|
||||
//! @param theP point
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
//! @param theTarget defines what solutions are required
|
||||
Standard_EXPORT Extrema_GenExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
//! Constructor for computation of the distances between specified point and surface.
|
||||
//! Only the specified parametric range of the surface is taken into account.
|
||||
//!
|
||||
//! Constructor is mostly used for one time projection of the point on the surface,
|
||||
//! but still the instances of extrema can be used for projecting other points on the surface
|
||||
//! with *Perform()* method.
|
||||
//!
|
||||
//! @param theP point
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theUMin Lower U bound
|
||||
//! @param theUMax Upper U bound
|
||||
//! @param theVMin Lower V bound
|
||||
//! @param theVMax Upper V bound
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
//! @param theTarget defines what solutions are required
|
||||
Standard_EXPORT Extrema_GenExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
public: //! @name Empty constructor + Initialization step
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Extrema_GenExtPS();
|
||||
|
||||
//! Initializes Extrema algorithm with the surfaces.
|
||||
//! Search is performed in whole parametric range of the surface.
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV);
|
||||
|
||||
//! Initializes Extrema algorithm with the surfaces.
|
||||
//! Search is performed in the given parametric range.
|
||||
//! @param S Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theUMin Lower U bound
|
||||
//! @param theUMax Upper U bound
|
||||
//! @param theVMin Lower V bound
|
||||
//! @param theVMax Upper V bound
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV);
|
||||
|
||||
public: //! @name Specifying the search options
|
||||
|
||||
//! Specifies what solutions are necessary:
|
||||
//! - *Extrema_ExtFlag_MIN* - only minimal solutions
|
||||
//! - *Extrema_ExtFlag_MAX* - only maximal solutions
|
||||
//! - *Extrema_ExtFlag_MINMAX - all solutions (default value).
|
||||
void SetTarget (const Extrema_ExtFlag theTarget)
|
||||
{
|
||||
myTarget = theTarget;
|
||||
}
|
||||
|
||||
//! Returns the Extrema target type
|
||||
Extrema_ExtFlag Target() const { return myTarget; }
|
||||
|
||||
//! Sets the tolerance for the search.
|
||||
//! These tolerances are used for projection of the point,
|
||||
//! and not used for surface initialization, so can be changed
|
||||
//! from point to point.
|
||||
void SetTolerance (const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
{
|
||||
myTolU = theTolU;
|
||||
myTolV = theTolV;
|
||||
}
|
||||
|
||||
|
||||
public: //! @name Performing projection
|
||||
|
||||
//! Performs projection of the point on the surface.
|
||||
//! Extrema must already be initialized with the surface.
|
||||
//! Allows multiple points be projected on the same surface.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& theP);
|
||||
|
||||
|
||||
public: //! @name Getting the results
|
||||
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searchs
|
||||
//! all the zeros inside the definition ranges of the
|
||||
//! surface.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
//! to find the zeros. They must be great enough
|
||||
//! such that if there is N extrema, there will
|
||||
//! be N extrema between P and the grid.
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searchs
|
||||
//! all the zeros inside the definition ranges of the
|
||||
//! surface.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
//! to find the zeros. They must be great enough
|
||||
//! such that if there is N extrema, there will
|
||||
//! be N extrema between P and the grid.
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! the algorithm is done with the point P.
|
||||
//! An exception is raised if the fields have not
|
||||
//! been initialized.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& P);
|
||||
|
||||
Standard_EXPORT void SetFlag (const Extrema_ExtFlag F);
|
||||
|
||||
Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
|
||||
|
||||
//! Returns True if the distances are found.
|
||||
Standard_Boolean IsDone() const { return myIsDone; }
|
||||
|
||||
//! Returns the number of extrema distances found.
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! Returns the number of extremum distances.
|
||||
Standard_EXPORT Standard_Integer NbExt() const;
|
||||
|
||||
|
||||
//! Returns the value of the Nth resulting square distance.
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
//! @throws Standard_OutOfRange if given index is out of range of found
|
||||
//! solutions ((N < 1) || (N > NbExt()).
|
||||
Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer theN) const;
|
||||
|
||||
Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
|
||||
|
||||
//! Returns the point of the Nth resulting distance.
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
//! @throws Standard_OutOfRange if given index is out of range of found
|
||||
//! solutions ((N < 1) || (N > NbExt()).
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer theN) const;
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
|
||||
|
||||
|
||||
protected: //! @name Protected methods performing the job
|
||||
|
||||
//! Creation of grid of parametric points (sampling of the surface)
|
||||
Standard_EXPORT void BuildGrid();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
|
||||
|
||||
Standard_EXPORT void BuildTree();
|
||||
|
||||
Standard_EXPORT void FindSolution (const gp_Pnt& P, const Extrema_POnSurfParams& theParams);
|
||||
|
||||
//! Selection of points to build grid, depending on the type of surface
|
||||
Standard_EXPORT void GetGridPoints (const Adaptor3d_Surface& theSurf);
|
||||
|
||||
//! Builds the BVH tree with bounding boxes of the cells of the grid
|
||||
Standard_EXPORT void BuildTree();
|
||||
|
||||
//! Looks for the solution starting at given point
|
||||
Standard_EXPORT Standard_Boolean FindSolution (const Extrema_POnSurfParams& theParams);
|
||||
|
||||
|
||||
//! Creation of grid of parametric points
|
||||
Standard_EXPORT void BuildGrid (const gp_Pnt& thePoint);
|
||||
|
||||
//! Compute new edge parameters.
|
||||
Standard_EXPORT const Extrema_POnSurfParams&
|
||||
ComputeFaceParameters (const Standard_Integer theU,
|
||||
const Standard_Integer theV,
|
||||
const gp_Pnt& thePoint);
|
||||
|
||||
//! Compute new edge parameters.
|
||||
Standard_EXPORT const Extrema_POnSurfParams&
|
||||
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
||||
Extrema_POnSurfParams& theParam0,
|
||||
Extrema_POnSurfParams& theParam1,
|
||||
const gp_Pnt& thePoint,
|
||||
const Standard_Real theDiffTol);
|
||||
|
||||
//! Looks for the Min or Max Solution (depending on the given target).
|
||||
Standard_EXPORT Standard_Boolean FindSolution (const Standard_Integer theUIndex,
|
||||
const Standard_Integer theVIndex,
|
||||
const Extrema_ExtFlag theTarget);
|
||||
Standard_EXPORT const Extrema_POnSurfParams& ComputeEdgeParameters (const Standard_Boolean IsUEdge, const Extrema_POnSurfParams& theParam0, const Extrema_POnSurfParams& theParam1, const gp_Pnt& thePoints, const Standard_Real theDiffTol);
|
||||
|
||||
|
||||
protected: //! @name Rules for BVH traverse
|
||||
|
||||
//! Rejection of the node by bounding box.
|
||||
//! Metric is computed to choose the best branch.
|
||||
//! Returns true if the node should be rejected, false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Rejects the node by the metric
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
RejectMetric (const Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Compares the two metrics and chooses the best one.
|
||||
//! Returns true if the first metric is better than the second,
|
||||
//! false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
IsMetricBetter (const Standard_Real& theLeft,
|
||||
const Standard_Real& theRight) const Standard_OVERRIDE;
|
||||
|
||||
//! Leaf element acceptance.
|
||||
//! Metric of the parent leaf-node is passed to avoid the check on the
|
||||
//! element and accept it unconditionally.
|
||||
//! Returns true if the element has been accepted, false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
Accept (const Standard_Integer theIndex,
|
||||
const Standard_Real& theMetric) Standard_OVERRIDE;
|
||||
|
||||
protected: //! @name Auxiliary types
|
||||
|
||||
//! Structure to keep and sort the results
|
||||
struct ExtPSResult
|
||||
{
|
||||
Extrema_POnSurf UV; //! UV coordinates of extrema solution
|
||||
Standard_Real SqDistance; //! Square distance to target point
|
||||
|
||||
ExtPSResult()
|
||||
: SqDistance (-1)
|
||||
{}
|
||||
|
||||
ExtPSResult (const Extrema_POnSurf& theUV,
|
||||
const Standard_Real theSqDist)
|
||||
: UV (theUV),
|
||||
SqDistance (theSqDist)
|
||||
{}
|
||||
|
||||
//! IsLess operator
|
||||
Standard_Boolean operator< (const ExtPSResult& Other) const
|
||||
{
|
||||
if (SqDistance != Other.SqDistance)
|
||||
return SqDistance < Other.SqDistance;
|
||||
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
UV.Parameter (U1, V1);
|
||||
Other.UV.Parameter (U2, V2);
|
||||
return (U1 < U2 || (U1 == U2 && V1 < V2));
|
||||
}
|
||||
};
|
||||
|
||||
protected: //! @name Fields
|
||||
|
||||
// Inputs
|
||||
NCollection_Vec3<Standard_Real> myPoint; //!< Point
|
||||
Adaptor3d_SurfacePtr myS; //!< Surface
|
||||
Extrema_FuncPSNorm myF; //!< Function
|
||||
|
||||
Standard_Real myUMin; //!< Surface parametric range: UMin
|
||||
Standard_Real myUMax; //!< Surface parametric range: UMax
|
||||
Standard_Real myVMin; //!< Surface parametric range: VMin
|
||||
Standard_Real myVMax; //!< Surface parametric range: VMax
|
||||
|
||||
Standard_Integer myNbUSamples; //!< Number of samples in U parametric direction
|
||||
Standard_Integer myNbVSamples; //!< Number of samples in V parametric direction
|
||||
|
||||
Standard_Real myTolU; //!< U parametric tolerance
|
||||
Standard_Real myTolV; //!< V parametric tolerance
|
||||
|
||||
Extrema_ExtFlag myTarget; //!< Extrema objective
|
||||
|
||||
// Intermediate data
|
||||
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myPoints; //!< Grid points
|
||||
Handle(TColStd_HArray1OfReal) myUParams; //!< Grid parameters in U parametric direction
|
||||
Handle(TColStd_HArray1OfReal) myVParams; //!< Grid parameters in V parametric direction
|
||||
|
||||
Standard_Boolean myDone;
|
||||
Standard_Boolean myInit;
|
||||
Standard_Real myumin;
|
||||
Standard_Real myusup;
|
||||
Standard_Real myvmin;
|
||||
Standard_Real myvsup;
|
||||
Standard_Integer myusample;
|
||||
Standard_Integer myvsample;
|
||||
Standard_Real mytolu;
|
||||
Standard_Real mytolv;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myPoints;
|
||||
Extrema_HUBTreeOfSphere mySphereUBTree;
|
||||
Handle(Bnd_HArray1OfSphere) mySphereArray;
|
||||
Extrema_FuncPSNorm myF;
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
Handle(TColStd_HArray1OfReal) myUParams;
|
||||
Handle(TColStd_HArray1OfReal) myVParams;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myFacePntParams;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myUEdgePntParams;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myVEdgePntParams;
|
||||
Extrema_POnSurfParams myGridParam;
|
||||
|
||||
Standard_Real mySqDistance; //!< Min/Max found square distance used in BVH tree traverse
|
||||
opencascade::handle
|
||||
<BVH_IndexedBoxSet<Standard_Real, 3, Handle(Extrema_GenExtPS_GridCellBoxSet)> > myGridBoxSet; //!< High-level BVH of BVH organized grid cells
|
||||
|
||||
// Results
|
||||
std::vector <ExtPSResult> mySolutions; //!< Found solutions (sorted first by distance to target point,
|
||||
//! second by the ascending U,V coordinates)
|
||||
Standard_Boolean myIsDone; //!< Done/Not done flag
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Extrema_GenExtPS, Standard_Transient)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Extrema_GenExtPS_HeaderFile
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline Extrema_POnSurfParams::Extrema_POnSurfParams()
|
||||
: mySqrDistance (-1),
|
||||
: mySqrDistance (0.),
|
||||
myElementType (Extrema_Node),
|
||||
myIndexU (0),
|
||||
myIndexV (0)
|
||||
@@ -22,7 +22,7 @@ inline Extrema_POnSurfParams::Extrema_POnSurfParams()
|
||||
inline Extrema_POnSurfParams::Extrema_POnSurfParams
|
||||
(const Standard_Real theU, const Standard_Real theV, const gp_Pnt &thePnt)
|
||||
: Extrema_POnSurf (theU, theV, thePnt),
|
||||
mySqrDistance (-1),
|
||||
mySqrDistance (0.),
|
||||
myElementType (Extrema_Node),
|
||||
myIndexU (0),
|
||||
myIndexV (0)
|
||||
|
@@ -33,6 +33,7 @@ Extrema_EPCOfExtPC.hxx
|
||||
Extrema_EPCOfExtPC2d.hxx
|
||||
Extrema_EPCOfExtPC2d_0.cxx
|
||||
Extrema_EPCOfExtPC_0.cxx
|
||||
Extrema_ExtAlgo.hxx
|
||||
Extrema_ExtCC.cxx
|
||||
Extrema_ExtCC.hxx
|
||||
Extrema_ExtCC2d.cxx
|
||||
|
@@ -1,5 +1,3 @@
|
||||
GCPnts.cxx
|
||||
GCPnts.hxx
|
||||
GCPnts_AbscissaPoint.cxx
|
||||
GCPnts_AbscissaPoint.pxx
|
||||
GCPnts_AbscissaPoint.hxx
|
||||
|
@@ -1,54 +0,0 @@
|
||||
// Created on: 2020-05-18
|
||||
// Copyright (c) 1999-2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
//=======================================================================
|
||||
//function : FillParams
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts::FillParams (const TColStd_Array1OfReal& theKnots,
|
||||
const Standard_Integer theDegree,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams)
|
||||
{
|
||||
Standard_Real aPrevPar = theParMin;
|
||||
theParams.Append (aPrevPar);
|
||||
|
||||
Standard_Integer aNbP = Max (theDegree, 1);
|
||||
|
||||
for (Standard_Integer i = 1;
|
||||
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
|
||||
{
|
||||
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
|
||||
continue;
|
||||
|
||||
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
|
||||
for (Standard_Integer k = 1; k <= aNbP ; ++k)
|
||||
{
|
||||
Standard_Real aPar = theKnots (i) + k * aStep;
|
||||
if (aPar > theParMax - Precision::PConfusion())
|
||||
break;
|
||||
|
||||
if (aPar > aPrevPar + Precision::PConfusion())
|
||||
{
|
||||
theParams.Append (aPar);
|
||||
aPrevPar = aPar;
|
||||
}
|
||||
}
|
||||
}
|
||||
theParams.Append (theParMax);
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
// Created on: 2020-05-18
|
||||
// Copyright (c) 1999-2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GCPnts_HeaderFile
|
||||
#define _GCPnts_HeaderFile
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
//! The GCPnts package provides general utilities for
|
||||
//! Curves analysis.
|
||||
class GCPnts
|
||||
{
|
||||
public:
|
||||
|
||||
//! Fills <theParams> vector with sampling parameters on the curve
|
||||
Standard_EXPORT static void FillParams (const TColStd_Array1OfReal& theKnots,
|
||||
const Standard_Integer theDegree,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams);
|
||||
};
|
||||
|
||||
#endif
|
@@ -37,9 +37,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface)
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
Init (P, Surface);
|
||||
Init (P, Surface, theProjAlgo);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -47,9 +48,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Tolerance)
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
Init (P, Surface, Tolerance);
|
||||
Init (P, Surface, Tolerance, theProjAlgo);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -60,10 +62,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup)
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
|
||||
{
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup);
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, theProjAlgo);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -75,10 +78,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance)
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
|
||||
{
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance);
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance, theProjAlgo);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
@@ -107,10 +111,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomAPI_ProjectPointOnSurf::Init (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface)
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
|
||||
{
|
||||
Init (P, Surface, Precision::Confusion());
|
||||
Init (P, Surface, Precision::Confusion(), theProjAlgo);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
@@ -118,15 +123,27 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//=======================================================================
|
||||
void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Tolerance)
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:37:55 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
|
||||
//modified by NIZNHY-PKV Mon Apr 8 11:13:37 2002 f XXX
|
||||
Standard_Real Umin, Usup, Vmin, Vsup;
|
||||
Surface->Bounds(Umin, Usup, Vmin, Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
//
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Mon Apr 8 11:13:44 2002 t XXX
|
||||
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:37:58 2002 t
|
||||
Init ();
|
||||
}
|
||||
|
||||
@@ -140,12 +157,20 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup)
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
Standard_Real Tolerance = Precision::PConfusion();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:38:30 2002 t
|
||||
Init ();
|
||||
}
|
||||
|
||||
@@ -159,11 +184,19 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance)
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:39:14 2002 t
|
||||
Init ();
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -174,11 +207,20 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup)
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
Standard_Real Tolerance = Precision::PConfusion();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:29 2002 t
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f
|
||||
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol);
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -190,10 +232,19 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance)
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:16 2002 t
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f
|
||||
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Standard_OutOfRange;
|
||||
@@ -50,38 +51,45 @@ public:
|
||||
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>. The solution are computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Init the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Init the projection of a point <P> on a surface
|
||||
//! <Surface>. The solution are computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Init the projection for many points on a surface
|
||||
//! <Surface>. The solutions will be computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Sets the Extrema search algorithm - Grad or Tree. <br>
|
||||
//! By default the Extrema is initialized with Grad algorithm.
|
||||
void SetExtremaAlgo(const Extrema_ExtAlgo theAlgo)
|
||||
{
|
||||
myExtPS.SetAlgo(theAlgo);
|
||||
}
|
||||
|
||||
//! Sets the Extrema search flag - MIN or MAX or MINMAX.<br>
|
||||
//! By default the Extrema is set to search the MinMax solutions.
|
||||
|
@@ -1112,8 +1112,9 @@ void GeomInt_IntSS::BuildPCurves (Standard_Real f,
|
||||
const gp_Pnt aP3d1 = C->Value(f);
|
||||
const gp_Pnt aP3d2 = C->Value(l);
|
||||
|
||||
anExtr.SetAlgo(Extrema_ExtAlgo_Grad);
|
||||
anExtr.Initialize(anAS, umin, umax, vmin, vmax,
|
||||
Precision::Confusion(), Precision::Confusion());
|
||||
Precision::Confusion(), Precision::Confusion());
|
||||
anExtr.Perform(aP3d1);
|
||||
|
||||
if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
|
||||
|
@@ -88,9 +88,9 @@ static void showProjSolution(Draw_Interpretor& di,
|
||||
|
||||
static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n != 5 && n != 7)
|
||||
if ( n < 5)
|
||||
{
|
||||
di.PrintHelp (a[0]);
|
||||
std::cout << " Use proj curve/surf x y z [{extrema algo: g(grad)/t(tree)}|{u v}]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,10 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
|
||||
|
||||
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]);
|
||||
Handle(Geom_Surface) GS;
|
||||
Extrema_ExtAlgo aProjAlgo = Extrema_ExtAlgo_Grad;
|
||||
|
||||
if (n == 6 && a[5][0] == 't')
|
||||
aProjAlgo = Extrema_ExtAlgo_Tree;
|
||||
|
||||
if (GC.IsNull())
|
||||
{
|
||||
@@ -106,12 +110,12 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
|
||||
if (GS.IsNull())
|
||||
return 1;
|
||||
|
||||
if (n == 5)
|
||||
if (n <= 6)
|
||||
{
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
GS->Bounds(U1,U2,V1,V2);
|
||||
|
||||
GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2);
|
||||
GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2,aProjAlgo);
|
||||
if (!proj.IsDone())
|
||||
{
|
||||
di << "projection failed.";
|
||||
@@ -748,7 +752,7 @@ void GeometryTest::APICommands(Draw_Interpretor& theCommands)
|
||||
|
||||
done = Standard_True;
|
||||
|
||||
theCommands.Add("proj", "proj curve/surf x y z [{u v}]\n"
|
||||
theCommands.Add("proj", "proj curve/surf x y z [{extrema algo: g(grad)/t(tree)}|{u v}]\n"
|
||||
"\t\tOptional parameters are relevant to surf only.\n"
|
||||
"\t\tIf initial {u v} are given then local extrema is called",__FILE__, proj);
|
||||
|
||||
|
@@ -31,7 +31,6 @@ public:
|
||||
Graphic3d_TextureMap (theFileName, Graphic3d_TOT_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myIsTopDown (true),
|
||||
myZIsInverted (false),
|
||||
myHasMipmaps (theToGenerateMipmaps)
|
||||
{}
|
||||
@@ -42,7 +41,6 @@ public:
|
||||
Graphic3d_TextureMap (thePixmap, Graphic3d_TOT_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myIsTopDown (true),
|
||||
myZIsInverted (false),
|
||||
myHasMipmaps (theToGenerateMipmaps)
|
||||
{}
|
||||
@@ -67,12 +65,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns whether row's memory layout is top-down.
|
||||
Standard_Boolean IsTopDown() const
|
||||
{
|
||||
return myIsTopDown;
|
||||
}
|
||||
|
||||
//! Sets Z axis inversion (vertical flipping).
|
||||
void SetZInversion (Standard_Boolean theZIsInverted)
|
||||
{
|
||||
@@ -91,9 +83,13 @@ public:
|
||||
//! Sets whether to generate mipmaps of cubemap or not.
|
||||
void SetMipmapsGeneration (Standard_Boolean theToGenerateMipmaps) { myHasMipmaps = theToGenerateMipmaps; }
|
||||
|
||||
//! Returns current cubemap side as compressed PixMap.
|
||||
//! Returns null handle if current side is invalid or if image is not in supported compressed format.
|
||||
virtual Handle(Image_CompressedPixMap) CompressedValue (const Handle(Image_SupportedFormats)& theSupported) = 0;
|
||||
|
||||
//! Returns PixMap containing current side of cubemap.
|
||||
//! Returns null handle if current side is invalid.
|
||||
virtual Handle(Image_PixMap) Value() = 0;
|
||||
virtual Handle(Image_PixMap) Value (const Handle(Image_SupportedFormats)& theSupported) = 0;
|
||||
|
||||
//! Sets iterator state to +X cubemap side.
|
||||
Graphic3d_CubeMap& Reset()
|
||||
@@ -110,7 +106,6 @@ protected:
|
||||
|
||||
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
|
||||
Standard_Boolean myEndIsReached; //!< Indicates whether end of iteration has been reached or hasn't
|
||||
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
|
||||
Standard_Boolean myZIsInverted; //!< Indicates whether Z axis is inverted that allows to synchronize vertical flip of cubemap
|
||||
Standard_Boolean myHasMipmaps; //!< Indicates whether mipmaps of cubemap will be generated or not
|
||||
|
||||
|
@@ -13,7 +13,9 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_CubeMapPacked.hxx>
|
||||
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Image_DDSParser.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMapPacked, Graphic3d_CubeMap)
|
||||
|
||||
@@ -40,17 +42,46 @@ Graphic3d_CubeMapPacked::Graphic3d_CubeMapPacked (const Handle(Image_PixMap)&
|
||||
myOrder (theOrder),
|
||||
myTileNumberX (1)
|
||||
{
|
||||
if (checkImage (theImage, myTileNumberX))
|
||||
if (checkImage (theImage, myTileNumberX))
|
||||
{
|
||||
myPixMap = theImage;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CompressedValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Graphic3d_CubeMapPacked::CompressedValue (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (myTileNumberX == 0
|
||||
|| !myPixMap.IsNull())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
TCollection_AsciiString aFilePath;
|
||||
myPath.SystemName (aFilePath);
|
||||
if (!aFilePath.IsEmpty())
|
||||
{
|
||||
const unsigned int aTileIndex = myOrder[myCurrentSide];
|
||||
Handle(Image_CompressedPixMap) anImage = Image_DDSParser::Load (theSupported, aFilePath, (Standard_Integer )aTileIndex);
|
||||
if (!anImage.IsNull()
|
||||
&& anImage->NbFaces() == 6
|
||||
&& anImage->SizeX() == anImage->SizeY())
|
||||
{
|
||||
myPixMap = theImage;
|
||||
myIsTopDown = anImage->IsTopDown();
|
||||
return anImage;
|
||||
}
|
||||
}
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Value
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_PixMap) Graphic3d_CubeMapPacked::Value()
|
||||
Handle(Image_PixMap) Graphic3d_CubeMapPacked::Value (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (myTileNumberX != 0)
|
||||
{
|
||||
@@ -60,7 +91,7 @@ Handle(Image_PixMap) Graphic3d_CubeMapPacked::Value()
|
||||
myPath.SystemName (aFilePath);
|
||||
if (!aFilePath.IsEmpty())
|
||||
{
|
||||
tryLoadImage (aFilePath);
|
||||
tryLoadImage (theSupported, aFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,13 +214,15 @@ Standard_Boolean Graphic3d_CubeMapPacked::checkImage (const Handle(Image_PixMap)
|
||||
// function : tryLoadImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CubeMapPacked::tryLoadImage (const TCollection_AsciiString& theFilePath)
|
||||
void Graphic3d_CubeMapPacked::tryLoadImage (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const TCollection_AsciiString& theFilePath)
|
||||
{
|
||||
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap;
|
||||
if (anImage->Load (theFilePath))
|
||||
{
|
||||
if (checkImage (anImage, myTileNumberX))
|
||||
{
|
||||
convertToCompatible (theSupported, anImage);
|
||||
myPixMap = anImage;
|
||||
}
|
||||
}
|
||||
|
@@ -25,23 +25,26 @@ class Graphic3d_CubeMapPacked : public Graphic3d_CubeMap
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMapPacked, Graphic3d_CubeMap)
|
||||
public:
|
||||
|
||||
//! Initialization to load cubemef from file.
|
||||
//! Initialization to load cubemap from file.
|
||||
//! @theFileName - path to the cubemap image
|
||||
//! @theOrder - array conaining six different indexes of cubemap sides which maps tile grid to cubemap sides
|
||||
//! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to cubemap sides
|
||||
Standard_EXPORT Graphic3d_CubeMapPacked (const TCollection_AsciiString& theFileName,
|
||||
const Graphic3d_ValidatedCubeMapOrder theOrder = Graphic3d_CubeMapOrder::Default());
|
||||
|
||||
//! Initialization to set cubemap directly by PixMap.
|
||||
//! @thePixMap - origin PixMap
|
||||
//! @theOrder - array conaining six different indexes of cubemap sides which maps tile grid to cubemap sides
|
||||
//! @theOrder - array containing six different indexes of cubemap sides which maps tile grid to cubemap sides
|
||||
Standard_EXPORT Graphic3d_CubeMapPacked (const Handle(Image_PixMap)& theImage,
|
||||
const Graphic3d_ValidatedCubeMapOrder theOrder = Graphic3d_CubeMapOrder::Default());
|
||||
|
||||
//! Returns current cubemap side as compressed PixMap.
|
||||
Standard_EXPORT virtual Handle(Image_CompressedPixMap) CompressedValue (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Returns current cubemap side as PixMap.
|
||||
//! Resulting PixMap is memory wrapper over original image.
|
||||
//! Returns null handle if current side or whole cubemap is invalid.
|
||||
//! Origin image has to contain six quad tiles having one sizes without any gaps to be valid.
|
||||
Standard_EXPORT Handle(Image_PixMap) Value() Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) Value (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Empty destructor.
|
||||
~Graphic3d_CubeMapPacked() {}
|
||||
@@ -57,7 +60,8 @@ private:
|
||||
|
||||
//! Tries to load image from file and checks it after that.
|
||||
//! Does nothing in case of fail.
|
||||
void tryLoadImage (const TCollection_AsciiString &theFilePath);
|
||||
void tryLoadImage (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const TCollection_AsciiString &theFilePath);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -13,7 +13,9 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_CubeMapSeparate.hxx>
|
||||
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Image_DDSParser.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
@@ -83,11 +85,55 @@ Graphic3d_CubeMapSeparate::Graphic3d_CubeMapSeparate (const NCollection_Array1<H
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CompressedValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Graphic3d_CubeMapSeparate::CompressedValue (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (!myImages[0].IsNull())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
const Graphic3d_CubeMapOrder anOrder = Graphic3d_CubeMapOrder::Default();
|
||||
TCollection_AsciiString aFilePath;
|
||||
myPaths[anOrder[myCurrentSide]].SystemName(aFilePath);
|
||||
if (aFilePath.IsEmpty())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Handle(Image_CompressedPixMap) anImage = Image_DDSParser::Load (theSupported, aFilePath, 0);
|
||||
if (anImage.IsNull()
|
||||
|| anImage->SizeX() != anImage->SizeY())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (myCurrentSide == 0)
|
||||
{
|
||||
mySize = anImage->SizeX();
|
||||
myFormat = anImage->BaseFormat();
|
||||
myIsTopDown = anImage->IsTopDown();
|
||||
return anImage;
|
||||
}
|
||||
|
||||
if (anImage->BaseFormat() == myFormat
|
||||
&& anImage->SizeX() == (Standard_Integer )mySize)
|
||||
{
|
||||
return anImage;
|
||||
}
|
||||
|
||||
Message::SendWarning (TCollection_AsciiString() + "'" + aFilePath + "' inconsistent image format or dimension in Graphic3d_CubeMapSeparate");
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Value
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_PixMap) Graphic3d_CubeMapSeparate::Value()
|
||||
Handle(Image_PixMap) Graphic3d_CubeMapSeparate::Value (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
Graphic3d_CubeMapOrder anOrder = Graphic3d_CubeMapOrder::Default();
|
||||
if (!myIsTopDown)
|
||||
@@ -108,6 +154,7 @@ Handle(Image_PixMap) Graphic3d_CubeMapSeparate::Value()
|
||||
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap;
|
||||
if (anImage->Load(aFilePath))
|
||||
{
|
||||
convertToCompatible (theSupported, anImage);
|
||||
if (anImage->SizeX() == anImage->SizeY())
|
||||
{
|
||||
if (myCurrentSide == 0)
|
||||
|
@@ -33,13 +33,16 @@ public:
|
||||
//! @theImages - array if PixMaps (has to have size equal 6).
|
||||
Standard_EXPORT Graphic3d_CubeMapSeparate(const NCollection_Array1<Handle(Image_PixMap)>& theImages);
|
||||
|
||||
//! Returns current cubemap side as compressed PixMap.
|
||||
Standard_EXPORT virtual Handle(Image_CompressedPixMap) CompressedValue (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Returns current side of cubemap as PixMap.
|
||||
//! Returns null handle if current side or whole cubemap is invalid.
|
||||
//! All origin images have to have the same sizes, format and quad shapes to form valid cubemap.
|
||||
Standard_EXPORT Handle(Image_PixMap) Value() Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) Value (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Returns NULL.
|
||||
virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE
|
||||
virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& ) Standard_OVERRIDE
|
||||
{
|
||||
return Handle(Image_PixMap)();
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ Graphic3d_MediaTexture::Graphic3d_MediaTexture (const Handle(Media_HMutex)& theM
|
||||
// Function : GetImage
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Handle(Image_PixMap) Graphic3d_MediaTexture::GetImage() const
|
||||
Handle(Image_PixMap) Graphic3d_MediaTexture::GetImage (const Handle(Image_SupportedFormats)& )
|
||||
{
|
||||
Standard_Mutex::Sentry aLock (myMutex.get());
|
||||
if (myFrame.IsNull()
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
Standard_Integer thePlane = -1);
|
||||
|
||||
//! Image reader.
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
//! Return the frame.
|
||||
const Handle(Media_Frame)& Frame() const { return myFrame; }
|
||||
|
@@ -72,22 +72,22 @@ public:
|
||||
//! @param theLevel level of anisontropy texture filter.
|
||||
Standard_EXPORT void SetAnisoFilter (const Graphic3d_LevelOfTextureAnisotropy theLevel);
|
||||
|
||||
//! @return rotation angle in degrees
|
||||
//! Default value is 0.
|
||||
//! Return rotation angle in degrees; 0 by default.
|
||||
//! Complete transformation matrix: Rotation -> Translation -> Scale.
|
||||
Standard_ShortReal Rotation() const { return myRotAngle; }
|
||||
|
||||
//! @param theAngleDegrees rotation angle.
|
||||
Standard_EXPORT void SetRotation (const Standard_ShortReal theAngleDegrees);
|
||||
|
||||
//! @return scale factor
|
||||
//! Default value is no scaling (1.0; 1.0).
|
||||
//! Return scale factor; (1.0; 1.0) by default, which means no scaling.
|
||||
//! Complete transformation matrix: Rotation -> Translation -> Scale.
|
||||
const Graphic3d_Vec2& Scale() const { return myScale; }
|
||||
|
||||
//! @param theScale scale factor.
|
||||
Standard_EXPORT void SetScale (const Graphic3d_Vec2 theScale);
|
||||
|
||||
//! @return translation vector
|
||||
//! Default value is no translation (0.0; 0.0).
|
||||
|
||||
//! Return translation vector; (0.0; 0.0), which means no translation.
|
||||
//! Complete transformation matrix: Rotation -> Translation -> Scale.
|
||||
const Graphic3d_Vec2& Translation() const { return myTranslation; }
|
||||
|
||||
//! @param theVec translation vector.
|
||||
@@ -109,7 +109,8 @@ public:
|
||||
//! @return base texture mipmap level; 0 by default.
|
||||
Standard_Integer BaseLevel() const { return myBaseLevel; }
|
||||
|
||||
//! @return maximum texture mipmap array level; 1000 by default.
|
||||
//! Return maximum texture mipmap array level; 1000 by default.
|
||||
//! Real rendering limit will take into account mipmap generation flags and presence of mipmaps in loaded image.
|
||||
Standard_Integer MaxLevel() const { return myMaxLevel; }
|
||||
|
||||
//! Setups texture mipmap array levels range.
|
||||
|
@@ -19,9 +19,12 @@
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Image_DDSParser.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <Standard_Atomic.hxx>
|
||||
|
||||
@@ -90,7 +93,8 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const TCollection_AsciiString& the
|
||||
myPath (theFileName),
|
||||
myRevision (0),
|
||||
myType (theType),
|
||||
myIsColorMap (true)
|
||||
myIsColorMap (true),
|
||||
myIsTopDown (true)
|
||||
{
|
||||
generateId();
|
||||
}
|
||||
@@ -105,7 +109,8 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const Handle(Image_PixMap)& theP
|
||||
myPixMap (thePixMap),
|
||||
myRevision (0),
|
||||
myType (theType),
|
||||
myIsColorMap (true)
|
||||
myIsColorMap (true),
|
||||
myIsTopDown (true)
|
||||
{
|
||||
generateId();
|
||||
}
|
||||
@@ -129,15 +134,57 @@ void Graphic3d_TextureRoot::generateId()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_TEXTURE_COUNTER));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetCompressedImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Graphic3d_TextureRoot::GetCompressedImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (!myPixMap.IsNull())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
// Case 2: texture source is specified as path
|
||||
TCollection_AsciiString aFilePath;
|
||||
myPath.SystemName (aFilePath);
|
||||
if (aFilePath.IsEmpty())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
TCollection_AsciiString aFilePathLower = aFilePath;
|
||||
aFilePathLower.LowerCase();
|
||||
if (!aFilePathLower.EndsWith (".dds"))
|
||||
{
|
||||
// do not waste time on file system access in case of wrong file extension
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (Handle(Image_CompressedPixMap) anImage = Image_DDSParser::Load (theSupported, aFilePath, 0))
|
||||
{
|
||||
myIsTopDown = anImage->IsTopDown();
|
||||
return anImage;
|
||||
}
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage() const
|
||||
Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (Handle(Image_PixMap) anOldImage = GetImage())
|
||||
{
|
||||
myIsTopDown = anOldImage->IsTopDown();
|
||||
return anOldImage; // compatibility with old API
|
||||
}
|
||||
|
||||
// Case 1: texture source is specified as pixmap
|
||||
if (!myPixMap.IsNull())
|
||||
{
|
||||
myIsTopDown = myPixMap->IsTopDown();
|
||||
return myPixMap;
|
||||
}
|
||||
|
||||
@@ -150,12 +197,38 @@ Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage() const
|
||||
}
|
||||
|
||||
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap();
|
||||
if (!anImage->Load (aFilePath))
|
||||
if (anImage->Load (aFilePath))
|
||||
{
|
||||
return Handle(Image_PixMap)();
|
||||
myIsTopDown = anImage->IsTopDown();
|
||||
convertToCompatible (theSupported, anImage);
|
||||
return anImage;
|
||||
}
|
||||
|
||||
return anImage;
|
||||
return Handle(Image_PixMap)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : convertToCompatible
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(Image_PixMap)& theImage)
|
||||
{
|
||||
if (theSupported.IsNull()
|
||||
|| theSupported->IsSupported (theImage->Format())
|
||||
|| theImage.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((theImage->Format() == Image_Format_BGR32
|
||||
|| theImage->Format() == Image_Format_BGR32))
|
||||
{
|
||||
Image_PixMap::SwapRgbaBgra (*theImage);
|
||||
theImage->SetFormat (theImage->Format() == Image_Format_BGR32
|
||||
? Image_Format_RGB32
|
||||
: Image_Format_RGBA);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
class Image_CompressedPixMap;
|
||||
class Image_SupportedFormats;
|
||||
class Graphic3d_TextureParams;
|
||||
|
||||
//! This is the texture root class enable the dialog with the GraphicDriver allows the loading of texture.
|
||||
@@ -79,6 +81,13 @@ public:
|
||||
//! without re-creating texture source itself (since unique id should be never modified).
|
||||
void UpdateRevision() { ++myRevision; }
|
||||
|
||||
//! This method will be called by graphic driver each time when texture resource should be created.
|
||||
//! It is called in front of GetImage() for uploading compressed image formats natively supported by GPU.
|
||||
//! @param theSupported [in] the list of supported compressed texture formats;
|
||||
//! returning image in unsupported format will result in texture upload failure
|
||||
//! @return compressed pixmap or NULL if image is not in supported compressed format
|
||||
Standard_EXPORT virtual Handle(Image_CompressedPixMap) GetCompressedImage (const Handle(Image_SupportedFormats)& theSupported);
|
||||
|
||||
//! This method will be called by graphic driver each time when texture resource should be created.
|
||||
//! Default constructors allow defining the texture source as path to texture image or directly as pixmap.
|
||||
//! If the source is defined as path, then the image will be dynamically loaded when this method is called
|
||||
@@ -86,7 +95,7 @@ public:
|
||||
//! Inheritors may dynamically generate the image.
|
||||
//! Notice, image data should be in Bottom-Up order (see Image_PixMap::IsTopDown())!
|
||||
//! @return the image for texture.
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage() const;
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported);
|
||||
|
||||
//! @return low-level texture parameters
|
||||
const Handle(Graphic3d_TextureParams)& GetParams() const { return myParams; }
|
||||
@@ -104,6 +113,9 @@ public:
|
||||
//! Set flag indicating color nature of values within the texture.
|
||||
void SetColorMap (Standard_Boolean theIsColor) { myIsColorMap = theIsColor; }
|
||||
|
||||
//! Returns whether row's memory layout is top-down.
|
||||
Standard_Boolean IsTopDown() const { return myIsTopDown; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a texture from a file
|
||||
@@ -119,6 +131,13 @@ protected:
|
||||
//! Unconditionally generate new texture id. Should be called only within constructor.
|
||||
Standard_EXPORT void generateId();
|
||||
|
||||
//! Try converting image to compatible format.
|
||||
Standard_EXPORT static void convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(Image_PixMap)& theImage);
|
||||
|
||||
//! Method for supporting old API; another GetImage() method should be implemented instead.
|
||||
virtual Handle(Image_PixMap) GetImage() const { return Handle(Image_PixMap)(); }
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_TextureParams) myParams; //!< associated texture parameters
|
||||
@@ -128,6 +147,8 @@ protected:
|
||||
Standard_Size myRevision; //!< image revision - for signaling changes in the texture source (e.g. file update, pixmap update)
|
||||
Graphic3d_TypeOfTexture myType; //!< texture type
|
||||
Standard_Boolean myIsColorMap; //!< flag indicating color nature of values within the texture
|
||||
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -86,7 +86,8 @@ typedef enum
|
||||
MT_BoundaryEdge = 4, //!< Boundary edge (related to a single face)
|
||||
MT_SharedEdge = 5, //!< Shared edge (related to several faces)
|
||||
MT_WireFrameFace = 6, //!< Wireframe face
|
||||
MT_ShadedFace = 7 //!< Shaded face
|
||||
MT_ShadedFace = 7, //!< Shaded face
|
||||
MT_SeamEdge = 8 //!< Seam edge between faces
|
||||
} IVtk_MeshType;
|
||||
|
||||
//! @enum IVtk_DisplayMode Display modes for 3D shapes
|
||||
|
@@ -180,16 +180,16 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
TopAbs_EDGE,
|
||||
TopAbs_FACE,
|
||||
anEdgesMap);
|
||||
|
||||
int aNbFaces;
|
||||
IVtk_MeshType aType;
|
||||
myEdgesTypes.Clear();
|
||||
|
||||
TopExp_Explorer anEdgeIter (GetShapeObj()->GetShape(), TopAbs_EDGE);
|
||||
for (; anEdgeIter.More(); anEdgeIter.Next())
|
||||
TopTools_IndexedDataMapOfShapeListOfShape::Iterator aEdgeIt(anEdgesMap);
|
||||
for (; aEdgeIt.More(); aEdgeIt.Next())
|
||||
{
|
||||
const TopoDS_Edge& anOcctEdge = TopoDS::Edge (anEdgeIter.Current());
|
||||
aNbFaces = anEdgesMap.FindFromKey (anOcctEdge).Extent();
|
||||
const TopoDS_Edge& anOcctEdge = TopoDS::Edge (aEdgeIt.Key());
|
||||
const TopTools_ListOfShape& aFaceList = aEdgeIt.Value();
|
||||
aNbFaces = aFaceList.Extent();
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
aType = MT_FreeEdge;
|
||||
@@ -200,7 +200,8 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
}
|
||||
else
|
||||
{
|
||||
aType = MT_SharedEdge;
|
||||
aType = (aNbFaces >= 2) && (BRep_Tool::MaxContinuity(anOcctEdge) > GeomAbs_G2) ?
|
||||
MT_SeamEdge : MT_SharedEdge;
|
||||
}
|
||||
addEdge (anOcctEdge, GetShapeObj()->GetSubShapeId (anOcctEdge), aType);
|
||||
myEdgesTypes.Bind (anOcctEdge, aType);
|
||||
|
@@ -48,6 +48,7 @@ IVtkTools_DisplayModeFilter::IVtkTools_DisplayModeFilter()
|
||||
aTypes.Add (MT_FreeEdge);
|
||||
aTypes.Add (MT_BoundaryEdge);
|
||||
aTypes.Add (MT_SharedEdge);
|
||||
aTypes.Add (MT_SeamEdge);
|
||||
aTypes.Add (MT_WireFrameFace);
|
||||
|
||||
myModesDefinition[DM_Wireframe] = aTypes;
|
||||
|
@@ -1,6 +1,10 @@
|
||||
Image_AlienPixMap.cxx
|
||||
Image_AlienPixMap.hxx
|
||||
Image_Color.hxx
|
||||
Image_CompressedFormat.hxx
|
||||
Image_CompressedPixMap.hxx
|
||||
Image_DDSParser.cxx
|
||||
Image_DDSParser.hxx
|
||||
Image_Diff.cxx
|
||||
Image_Diff.hxx
|
||||
Image_Format.hxx
|
||||
@@ -8,6 +12,8 @@ Image_PixMap.cxx
|
||||
Image_PixMap.hxx
|
||||
Image_PixMapData.hxx
|
||||
Image_PixMapTypedData.hxx
|
||||
Image_SupportedFormats.cxx
|
||||
Image_SupportedFormats.hxx
|
||||
Image_Texture.cxx
|
||||
Image_Texture.hxx
|
||||
Image_VideoRecorder.cxx
|
||||
|
31
src/Image/Image_CompressedFormat.hxx
Normal file
31
src/Image/Image_CompressedFormat.hxx
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Image_CompressedFormat_HeaderFile
|
||||
#define _Image_CompressedFormat_HeaderFile
|
||||
|
||||
#include <Image_Format.hxx>
|
||||
|
||||
//! List of compressed pixel formats natively supported by various graphics hardware (e.g. for efficient decoding on-the-fly).
|
||||
//! It is defined as extension of Image_Format.
|
||||
enum Image_CompressedFormat
|
||||
{
|
||||
Image_CompressedFormat_UNKNOWN = Image_Format_UNKNOWN,
|
||||
Image_CompressedFormat_RGB_S3TC_DXT1 = Image_Format_NB,
|
||||
Image_CompressedFormat_RGBA_S3TC_DXT1,
|
||||
Image_CompressedFormat_RGBA_S3TC_DXT3,
|
||||
Image_CompressedFormat_RGBA_S3TC_DXT5
|
||||
};
|
||||
enum { Image_CompressedFormat_NB = Image_CompressedFormat_RGBA_S3TC_DXT5 + 1 };
|
||||
|
||||
#endif // _Image_CompressedFormat_HeaderFile
|
108
src/Image/Image_CompressedPixMap.hxx
Normal file
108
src/Image/Image_CompressedPixMap.hxx
Normal file
@@ -0,0 +1,108 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Image_CompressedPixMap_HeaderFile
|
||||
#define _Image_CompressedPixMap_HeaderFile
|
||||
|
||||
#include <Image_Format.hxx>
|
||||
#include <Image_CompressedFormat.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <NCollection_Buffer.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//! Compressed pixmap data definition.
|
||||
//! It is defined independently from Image_PixMap, which defines only uncompressed formats.
|
||||
class Image_CompressedPixMap : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Image_CompressedPixMap, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Return base (uncompressed) pixel format.
|
||||
Image_Format BaseFormat() const { return myBaseFormat; }
|
||||
|
||||
//! Set base (uncompressed) pixel format.
|
||||
void SetBaseFormat (Image_Format theFormat) { myBaseFormat = theFormat; }
|
||||
|
||||
//! Return compressed format.
|
||||
Image_CompressedFormat CompressedFormat() const { return myFormat; }
|
||||
|
||||
//! Set compressed format.
|
||||
void SetCompressedFormat (Image_CompressedFormat theFormat) { myFormat = theFormat; }
|
||||
|
||||
//! Return raw (compressed) data.
|
||||
const Handle(NCollection_Buffer)& FaceData() const { return myFaceData; }
|
||||
|
||||
//! Set raw (compressed) data.
|
||||
void SetFaceData (const Handle(NCollection_Buffer)& theBuffer) { myFaceData = theBuffer; }
|
||||
|
||||
//! Return Array of mipmap sizes, including base level.
|
||||
const NCollection_Array1<Standard_Integer>& MipMaps() const { return myMipMaps; }
|
||||
|
||||
//! Return Array of mipmap sizes, including base level.
|
||||
NCollection_Array1<Standard_Integer>& ChangeMipMaps() { return myMipMaps; }
|
||||
|
||||
//! Return TRUE if complete mip map level set (up to 1x1 resolution).
|
||||
Standard_Boolean IsCompleteMipMapSet() const { return myIsCompleteMips; }
|
||||
|
||||
//! Set if complete mip map level set (up to 1x1 resolution).
|
||||
void SetCompleteMipMapSet (Standard_Boolean theIsComplete) { myIsCompleteMips = theIsComplete; }
|
||||
|
||||
//! Return surface length in bytes.
|
||||
Standard_Size FaceBytes() const { return myFaceBytes; }
|
||||
|
||||
//! Set surface length in bytes.
|
||||
void SetFaceBytes (Standard_Size theSize) { myFaceBytes = theSize; }
|
||||
|
||||
//! Return surface width.
|
||||
Standard_Integer SizeX() const { return mySizeX; }
|
||||
|
||||
//! Return surface height.
|
||||
Standard_Integer SizeY() const { return mySizeY; }
|
||||
|
||||
//! Set surface width x height.
|
||||
void SetSize (Standard_Integer theSizeX, Standard_Integer theSizeY)
|
||||
{
|
||||
mySizeX = theSizeX;
|
||||
mySizeY = theSizeY;
|
||||
}
|
||||
|
||||
//! Return TRUE if image layout is top-down (always true).
|
||||
bool IsTopDown() const { return true; }
|
||||
|
||||
//! Return number of faces in the file; should be 6 for cubemap.
|
||||
Standard_Integer NbFaces() const { return myNbFaces; }
|
||||
|
||||
//! Set number of faces in the file.
|
||||
void SetNbFaces (Standard_Integer theSize) { myNbFaces = theSize; }
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Image_CompressedPixMap()
|
||||
: myFaceBytes (0), myNbFaces (0), mySizeX (0), mySizeY (0), myBaseFormat (Image_Format_UNKNOWN), myFormat (Image_CompressedFormat_UNKNOWN), myIsCompleteMips (false) {}
|
||||
|
||||
protected:
|
||||
|
||||
NCollection_Array1<Standard_Integer> myMipMaps; //!< Array of mipmap sizes, including base level
|
||||
Handle(NCollection_Buffer) myFaceData; //!< raw compressed data
|
||||
Standard_Size myFaceBytes; //!< surface length in bytes
|
||||
Standard_Integer myNbFaces; //!< number of faces in the file
|
||||
Standard_Integer mySizeX; //!< surface width
|
||||
Standard_Integer mySizeY; //!< surface height
|
||||
Image_Format myBaseFormat; //!< base (uncompressed) pixel format
|
||||
Image_CompressedFormat myFormat; //!< compressed format
|
||||
Standard_Boolean myIsCompleteMips; //!< flag indicating complete mip map level set (up to 1x1 resolution)
|
||||
|
||||
};
|
||||
|
||||
#endif // _Image_CompressedPixMap_HeaderFile
|
255
src/Image/Image_DDSParser.cxx
Normal file
255
src/Image/Image_DDSParser.cxx
Normal file
@@ -0,0 +1,255 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Image_DDSParser.hxx>
|
||||
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_CompressedPixMap, Standard_Transient)
|
||||
|
||||
//! DDS Pixel Format structure.
|
||||
struct Image_DDSParser::DDSPixelFormat
|
||||
{
|
||||
uint32_t Size;
|
||||
uint32_t Flags;
|
||||
uint32_t FourCC;
|
||||
uint32_t RGBBitCount;
|
||||
uint32_t RBitMask;
|
||||
uint32_t GBitMask;
|
||||
uint32_t BBitMask;
|
||||
uint32_t ABitMask;
|
||||
};
|
||||
|
||||
//! DDS File header structure.
|
||||
struct Image_DDSParser::DDSFileHeader
|
||||
{
|
||||
//! Caps2 flag indicating complete (6 faces) cubemap.
|
||||
enum { DDSCompleteCubemap = 0xFE00 };
|
||||
|
||||
//! Return TRUE if cubmap flag is set.
|
||||
bool IscompleteCubemap() const { return (Caps2 & DDSFileHeader::DDSCompleteCubemap) == DDSFileHeader::DDSCompleteCubemap; }
|
||||
|
||||
uint32_t Size;
|
||||
uint32_t Flags;
|
||||
uint32_t Height;
|
||||
uint32_t Width;
|
||||
uint32_t PitchOrLinearSize;
|
||||
uint32_t Depth;
|
||||
uint32_t MipMapCount;
|
||||
uint32_t Reserved1[11];
|
||||
DDSPixelFormat PixelFormatDef;
|
||||
uint32_t Caps;
|
||||
uint32_t Caps2;
|
||||
uint32_t Caps3;
|
||||
uint32_t Caps4;
|
||||
uint32_t Reserved2;
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : Load
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Image_DDSParser::Load (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const TCollection_AsciiString& theFile,
|
||||
const Standard_Integer theFaceIndex,
|
||||
const int64_t theFileOffset)
|
||||
{
|
||||
std::ifstream aFile;
|
||||
OSD_OpenStream (aFile, theFile.ToCString(), std::ios::in | std::ios::binary);
|
||||
|
||||
char aHeader[128] = {};
|
||||
if (!aFile.is_open()
|
||||
|| !aFile.good())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
if (theFileOffset != 0)
|
||||
{
|
||||
aFile.seekg ((std::streamoff )theFileOffset, std::ios::beg);
|
||||
}
|
||||
aFile.read (aHeader, 128);
|
||||
Standard_Size aNbReadBytes = (Standard_Size )aFile.gcount();
|
||||
if (aNbReadBytes < 128
|
||||
|| ::memcmp (aHeader, "DDS ", 4) != 0)
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Handle(Image_CompressedPixMap) aDef = parseHeader (*(const DDSFileHeader* )(aHeader + 4));
|
||||
if (aDef.IsNull())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (!theSupported.IsNull()
|
||||
&& !theSupported->IsSupported (aDef->CompressedFormat()))
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (theFaceIndex < 0)
|
||||
{
|
||||
return aDef;
|
||||
}
|
||||
|
||||
if (theFaceIndex >= aDef->NbFaces()
|
||||
|| aDef->FaceBytes() == 0)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("DDS Reader error - invalid face index #") + theFaceIndex + " within file\n" + theFile);
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
const Standard_Size anOffset = aDef->FaceBytes() * theFaceIndex;
|
||||
if (anOffset != 0)
|
||||
{
|
||||
aFile.seekg ((std::streamoff )anOffset, std::ios::cur);
|
||||
}
|
||||
Handle(NCollection_Buffer) aBuffer = new NCollection_Buffer (Image_PixMap::DefaultAllocator(), aDef->FaceBytes());
|
||||
aFile.read ((char* )aBuffer->ChangeData(), aDef->FaceBytes());
|
||||
aNbReadBytes = (Standard_Size )aFile.gcount();
|
||||
if (aNbReadBytes < aDef->FaceBytes())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("DDS Reader error - unable to read face #") + theFaceIndex + " data from file\n" + theFile);
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
aDef->SetFaceData (aBuffer);
|
||||
return aDef;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Load
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Image_DDSParser::Load (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(NCollection_Buffer)& theBuffer,
|
||||
const Standard_Integer theFaceIndex)
|
||||
{
|
||||
if (theBuffer.IsNull()
|
||||
|| theBuffer->Size() < 128
|
||||
|| ::memcmp (theBuffer->Data(), "DDS ", 4) != 0)
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Handle(Image_CompressedPixMap) aDef = parseHeader (*(const DDSFileHeader* )(theBuffer->Data() + 4));
|
||||
if (aDef.IsNull())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (!theSupported.IsNull()
|
||||
&& !theSupported->IsSupported (aDef->CompressedFormat()))
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (theFaceIndex < 0)
|
||||
{
|
||||
return aDef;
|
||||
}
|
||||
|
||||
if (theFaceIndex >= aDef->NbFaces()
|
||||
|| aDef->FaceBytes() == 0)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("DDS Reader error - invalid face index #") + theFaceIndex + " within buffer");
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
const Standard_Size anOffset = aDef->FaceBytes() * theFaceIndex + 128;
|
||||
if (theBuffer->Size() < anOffset + aDef->FaceBytes())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("DDS Reader error - unable to read face #") + theFaceIndex + " data from buffer");
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Handle(NCollection_Buffer) aBuffer = new NCollection_Buffer (Image_PixMap::DefaultAllocator(), aDef->FaceBytes());
|
||||
memcpy (aBuffer->ChangeData(), theBuffer->Data() + anOffset, aDef->FaceBytes());
|
||||
aDef->SetFaceData (aBuffer);
|
||||
return aDef;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : parseHeader
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_CompressedPixMap) Image_DDSParser::parseHeader (const DDSFileHeader& theHeader)
|
||||
{
|
||||
if (theHeader.Size != 124
|
||||
|| theHeader.Width == 0
|
||||
|| theHeader.Height == 0
|
||||
|| theHeader.PixelFormatDef.Size != 32)
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Image_Format aBaseFormat = Image_Format_UNKNOWN;
|
||||
Image_CompressedFormat aFormat = Image_CompressedFormat_UNKNOWN;
|
||||
Standard_Integer aBlockSize = 8;
|
||||
const bool hasAlpha = (theHeader.PixelFormatDef.Flags & 0x1) != 0;
|
||||
if (::memcmp (&theHeader.PixelFormatDef.FourCC, "DXT5", 4) == 0)
|
||||
{
|
||||
aBaseFormat = Image_Format_RGBA;
|
||||
aFormat = Image_CompressedFormat_RGBA_S3TC_DXT5;
|
||||
aBlockSize = 16;
|
||||
}
|
||||
else if (::memcmp (&theHeader.PixelFormatDef.FourCC, "DXT3", 4) == 0)
|
||||
{
|
||||
aBaseFormat = Image_Format_RGBA;
|
||||
aFormat = Image_CompressedFormat_RGBA_S3TC_DXT3;
|
||||
aBlockSize = 16;
|
||||
}
|
||||
else if (::memcmp (&theHeader.PixelFormatDef.FourCC, "DXT1", 4) == 0)
|
||||
{
|
||||
aBaseFormat = hasAlpha ? Image_Format_RGBA : Image_Format_RGB;
|
||||
aFormat = hasAlpha ? Image_CompressedFormat_RGBA_S3TC_DXT1 : Image_CompressedFormat_RGB_S3TC_DXT1;
|
||||
aBlockSize = 8;
|
||||
}
|
||||
if (aFormat == Image_CompressedFormat_UNKNOWN)
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
Handle(Image_CompressedPixMap) aDef = new Image_CompressedPixMap();
|
||||
aDef->SetSize ((Standard_Integer )theHeader.Width, (Standard_Integer )theHeader.Height);
|
||||
aDef->SetNbFaces (theHeader.IscompleteCubemap() != 0 ? 6 : 1);
|
||||
aDef->SetBaseFormat (aBaseFormat);
|
||||
aDef->SetCompressedFormat (aFormat);
|
||||
|
||||
const Standard_Integer aNbMipMaps = Max ((Standard_Integer )theHeader.MipMapCount, 1);
|
||||
aDef->ChangeMipMaps().Resize (0, aNbMipMaps - 1, false);
|
||||
{
|
||||
Standard_Size aFaceSize = 0;
|
||||
NCollection_Vec2<Standard_Integer> aMipSizeXY (aDef->SizeX(), aDef->SizeY());
|
||||
for (Standard_Integer aMipIter = 0;; ++aMipIter)
|
||||
{
|
||||
const Standard_Integer aMipLength = ((aMipSizeXY.x() + 3) / 4) * ((aMipSizeXY.y() + 3) / 4) * aBlockSize;
|
||||
aFaceSize += aMipLength;
|
||||
aDef->ChangeMipMaps().SetValue (aMipIter, aMipLength);
|
||||
if (aMipIter + 1 >= aNbMipMaps)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
aMipSizeXY /= 2;
|
||||
if (aMipSizeXY.x() == 0) { aMipSizeXY.x() = 1; }
|
||||
if (aMipSizeXY.y() == 0) { aMipSizeXY.y() = 1; }
|
||||
}
|
||||
aDef->SetCompleteMipMapSet (aMipSizeXY.x() == 1 && aMipSizeXY.y() == 1);
|
||||
aDef->SetFaceBytes (aFaceSize);
|
||||
}
|
||||
|
||||
return aDef;
|
||||
}
|
62
src/Image/Image_DDSParser.hxx
Normal file
62
src/Image/Image_DDSParser.hxx
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Image_DDSParser_HeaderFile
|
||||
#define _Image_DDSParser_HeaderFile
|
||||
|
||||
#include <Image_CompressedPixMap.hxx>
|
||||
#include <NCollection_Buffer.hxx>
|
||||
|
||||
class Image_SupportedFormats;
|
||||
|
||||
//! Auxiliary tool for parsing DDS file structure (without decoding).
|
||||
class Image_DDSParser
|
||||
{
|
||||
public:
|
||||
|
||||
//! Load the face from DDS file.
|
||||
//! @param theSupported [in] list of supported image formats
|
||||
//! @param theFile [in] file path
|
||||
//! @param theFaceIndex [in] face index, within [0, Image_CompressedPixMap::NbFaces()) range;
|
||||
//! use -1 to skip reading the face data
|
||||
//! @param theFileOffset [in] offset to the DDS data
|
||||
//! @return loaded face or NULL if file cannot be read or not valid DDS file
|
||||
Standard_EXPORT static Handle(Image_CompressedPixMap) Load (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const TCollection_AsciiString& theFile,
|
||||
const Standard_Integer theFaceIndex,
|
||||
const int64_t theFileOffset = 0);
|
||||
|
||||
//! Load the face from DDS file.
|
||||
//! @param theSupported [in] list of supported image formats
|
||||
//! @param theBuffer [in] pre-loaded file data, should be at least of 128 bytes long defining DDS header.
|
||||
//! @param theFaceIndex [in] face index, within [0, Image_CompressedPixMap::NbFaces()) range;
|
||||
//! use -1 to skip reading the face data
|
||||
//! @return loaded face or NULL if file cannot be read or not valid DDS file
|
||||
Standard_EXPORT static Handle(Image_CompressedPixMap) Load (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(NCollection_Buffer)& theBuffer,
|
||||
const Standard_Integer theFaceIndex);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
struct DDSPixelFormat;
|
||||
struct DDSFileHeader;
|
||||
|
||||
private:
|
||||
|
||||
//! Parse DDS header.
|
||||
static Handle(Image_CompressedPixMap) parseHeader (const DDSFileHeader& theHeader);
|
||||
|
||||
};
|
||||
|
||||
#endif // _Image_DDSParser_HeaderFile
|
@@ -34,5 +34,6 @@ enum Image_Format
|
||||
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane
|
||||
Image_Format_BGRAF, //!< same as RGBAF but with different components order
|
||||
};
|
||||
enum { Image_Format_NB = Image_Format_BGRAF + 1 };
|
||||
|
||||
#endif // _Image_Format_HeaderFile
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Image_PixMap.hxx>
|
||||
|
||||
#include <NCollection_AlignedAllocator.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
@@ -21,6 +22,16 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap,Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : DefaultAllocator
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Handle(NCollection_BaseAllocator)& Image_PixMap::DefaultAllocator()
|
||||
{
|
||||
static const Handle(NCollection_BaseAllocator) THE_ALLOC = new NCollection_AlignedAllocator (16);
|
||||
return THE_ALLOC;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Image_PixMap
|
||||
// purpose :
|
||||
@@ -40,6 +51,10 @@ Image_PixMap::~Image_PixMap()
|
||||
Clear();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SizePixelBytes
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Size Image_PixMap::SizePixelBytes (const Image_Format thePixelFormat)
|
||||
{
|
||||
switch (thePixelFormat)
|
||||
@@ -135,8 +150,7 @@ bool Image_PixMap::InitTrash (Image_Format thePixelFormat,
|
||||
|
||||
// use argument only if it greater
|
||||
const Standard_Size aSizeRowBytes = std::max (theSizeRowBytes, theSizeX * SizePixelBytes (thePixelFormat));
|
||||
Handle(NCollection_BaseAllocator) anAlloc = new NCollection_AlignedAllocator (16);
|
||||
myData.Init (anAlloc, Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
myData.Init (DefaultAllocator(), Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
theSizeX, theSizeY, aSizeRowBytes, NULL);
|
||||
return !myData.IsEmpty();
|
||||
}
|
||||
|
@@ -48,6 +48,9 @@ public:
|
||||
//! Convert image to Black/White.
|
||||
Standard_EXPORT static void ToBlackWhite (Image_PixMap& theImage);
|
||||
|
||||
//! Return default image data allocator.
|
||||
Standard_EXPORT static const Handle(NCollection_BaseAllocator)& DefaultAllocator();
|
||||
|
||||
public: // high-level API
|
||||
|
||||
Image_Format Format() const { return myImgFormat; }
|
||||
|
27
src/Image/Image_SupportedFormats.cxx
Normal file
27
src/Image/Image_SupportedFormats.cxx
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_SupportedFormats, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Image_SupportedFormats
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Image_SupportedFormats::Image_SupportedFormats()
|
||||
: myFormats (Image_Format_UNKNOWN, Image_CompressedFormat_NB - 1),
|
||||
myHasCompressed (false)
|
||||
{
|
||||
myFormats.Init (false);
|
||||
}
|
63
src/Image/Image_SupportedFormats.hxx
Normal file
63
src/Image/Image_SupportedFormats.hxx
Normal file
@@ -0,0 +1,63 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Image_SupportedFormats_HeaderFile
|
||||
#define _Image_SupportedFormats_HeaderFile
|
||||
|
||||
#include <Image_CompressedFormat.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//! Structure holding information about supported texture formats.
|
||||
class Image_SupportedFormats : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Image_SupportedFormats, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT Image_SupportedFormats();
|
||||
|
||||
//! Return TRUE if image format is supported.
|
||||
bool IsSupported (Image_Format theFormat) const { return myFormats.Value (theFormat); }
|
||||
|
||||
//! Set if image format is supported or not.
|
||||
void Add (Image_Format theFormat) { myFormats.SetValue (theFormat, true); }
|
||||
|
||||
//! Return TRUE if there are compressed image formats supported.
|
||||
bool HasCompressed() const { return myHasCompressed; }
|
||||
|
||||
//! Return TRUE if compressed image format is supported.
|
||||
bool IsSupported (Image_CompressedFormat theFormat) const { return myFormats.Value (theFormat); }
|
||||
|
||||
//! Set if compressed image format is supported or not.
|
||||
void Add (Image_CompressedFormat theFormat)
|
||||
{
|
||||
myFormats.SetValue (theFormat, true);
|
||||
myHasCompressed = true;
|
||||
}
|
||||
|
||||
//! Reset flags.
|
||||
void Clear()
|
||||
{
|
||||
myFormats.Init (false);
|
||||
myHasCompressed = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
NCollection_Array1<bool> myFormats; //!< list of supported formats
|
||||
Standard_Boolean myHasCompressed; //!< flag indicating that some compressed image formats are supported
|
||||
|
||||
};
|
||||
|
||||
#endif // _Image_SupportedFormats_HeaderFile
|
@@ -15,6 +15,8 @@
|
||||
#include <Image_Texture.hxx>
|
||||
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Image_DDSParser.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
@@ -73,11 +75,41 @@ Image_Texture::Image_Texture (const Handle(NCollection_Buffer)& theBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : ReadCompressedImage
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Handle(Image_CompressedPixMap) Image_Texture::ReadCompressedImage (const Handle(Image_SupportedFormats)& theSupported) const
|
||||
{
|
||||
if (!theSupported->HasCompressed())
|
||||
{
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
|
||||
if (!myBuffer.IsNull())
|
||||
{
|
||||
return Image_DDSParser::Load (theSupported, myBuffer, 0);
|
||||
}
|
||||
else if (myOffset >= 0)
|
||||
{
|
||||
return Image_DDSParser::Load (theSupported, myImagePath, 0, myOffset);
|
||||
}
|
||||
|
||||
TCollection_AsciiString aFilePathLower = myImagePath;
|
||||
aFilePathLower.LowerCase();
|
||||
if (!aFilePathLower.EndsWith (".dds"))
|
||||
{
|
||||
// do not waste time on file system access in case of wrong file extension
|
||||
return Handle(Image_CompressedPixMap)();
|
||||
}
|
||||
return Image_DDSParser::Load (theSupported, myImagePath, 0);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : ReadImage
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
Handle(Image_PixMap) Image_Texture::ReadImage() const
|
||||
Handle(Image_PixMap) Image_Texture::ReadImage (const Handle(Image_SupportedFormats)& ) const
|
||||
{
|
||||
Handle(Image_PixMap) anImage;
|
||||
if (!myBuffer.IsNull())
|
||||
@@ -240,6 +272,10 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
|
||||
{
|
||||
return "webp";
|
||||
}
|
||||
else if (memcmp (aBuffer, "DDS ", 4) == 0)
|
||||
{
|
||||
return "dds";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <NCollection_Buffer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
class Image_CompressedPixMap;
|
||||
class Image_SupportedFormats;
|
||||
class Image_PixMap;
|
||||
|
||||
//! Texture image definition.
|
||||
@@ -57,8 +59,11 @@ public:
|
||||
//! Return image file format.
|
||||
Standard_EXPORT TCollection_AsciiString ProbeImageFileFormat() const;
|
||||
|
||||
//! Image reader without decoding data for formats supported natively by GPUs.
|
||||
Standard_EXPORT virtual Handle(Image_CompressedPixMap) ReadCompressedImage (const Handle(Image_SupportedFormats)& theSupported) const;
|
||||
|
||||
//! Image reader.
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) ReadImage() const;
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) ReadImage (const Handle(Image_SupportedFormats)& theSupported) const;
|
||||
|
||||
//! Write image to specified file without decoding data.
|
||||
Standard_EXPORT virtual Standard_Boolean WriteImage (const TCollection_AsciiString& theFile);
|
||||
|
@@ -758,7 +758,7 @@ Quantity_Date OSD_FileNode::CreationMoment () {
|
||||
|
||||
TEST_RAISE( "CreationMoment" );
|
||||
|
||||
if (_get_file_time (fNameW.ToWideString(), &stCreationSystemMoment, TRUE))
|
||||
if (_get_file_time (fNameW.ToWideString(), &stCreationSystemMoment, FALSE))
|
||||
{
|
||||
SYSTEMTIME * aSysTime = &stCreationMoment;
|
||||
BOOL aFlag = SystemTimeToTzSpecificLocalTime (NULL,
|
||||
|
@@ -77,6 +77,7 @@ OpenGl_Context.cxx
|
||||
OpenGl_Context.hxx
|
||||
OpenGl_Context_1.mm
|
||||
OpenGl_ExtGS.hxx
|
||||
OpenGl_GLESExtensions.hxx
|
||||
OpenGl_GlFunctions.hxx
|
||||
OpenGl_Flipper.cxx
|
||||
OpenGl_Flipper.hxx
|
||||
|
@@ -19,12 +19,14 @@
|
||||
#include <OpenGl_GlFunctions.hxx>
|
||||
|
||||
//! Instancing is available on OpenGL 3.0+ hardware
|
||||
//! (in core since OpenGL 3.1 or GL_ARB_draw_instanced extension).
|
||||
//!
|
||||
//! Note that this structure does not include glVertexAttribDivisor(),
|
||||
//! which has been introduced in later OpenGL versions (OpenGL 3.3 or OpenGL ES 3.0).
|
||||
struct OpenGl_ArbIns : protected OpenGl_GlFunctions
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
using OpenGl_GlFunctions::glDrawArraysInstanced;
|
||||
using OpenGl_GlFunctions::glDrawElementsInstanced;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _OpenGl_ArbIns_H__
|
||||
|
@@ -25,6 +25,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Caps,Standard_Transient)
|
||||
// =======================================================================
|
||||
OpenGl_Caps::OpenGl_Caps()
|
||||
: sRGBDisable (Standard_False),
|
||||
compressedTexturesDisable (Standard_False),
|
||||
vboDisable (Standard_False),
|
||||
pntSpritesDisable (Standard_False),
|
||||
keepArrayData (Standard_False),
|
||||
@@ -54,6 +55,7 @@ OpenGl_Caps::OpenGl_Caps()
|
||||
contextNoExtensions (Standard_False),
|
||||
contextMajorVersionUpper (-1),
|
||||
contextMinorVersionUpper (-1),
|
||||
isTopDownTextureUV(Standard_False),
|
||||
glslWarnings (Standard_False),
|
||||
suppressExtraMsg (Standard_True),
|
||||
glslDumpLevel (OpenGl_ShaderProgramDumpLevel_Off)
|
||||
@@ -68,6 +70,7 @@ OpenGl_Caps::OpenGl_Caps()
|
||||
OpenGl_Caps& OpenGl_Caps::operator= (const OpenGl_Caps& theCopy)
|
||||
{
|
||||
sRGBDisable = theCopy.sRGBDisable;
|
||||
compressedTexturesDisable = theCopy.compressedTexturesDisable;
|
||||
vboDisable = theCopy.vboDisable;
|
||||
pntSpritesDisable = theCopy.pntSpritesDisable;
|
||||
keepArrayData = theCopy.keepArrayData;
|
||||
@@ -83,6 +86,7 @@ OpenGl_Caps& OpenGl_Caps::operator= (const OpenGl_Caps& theCopy)
|
||||
contextNoExtensions = theCopy.contextNoExtensions;
|
||||
contextMajorVersionUpper = theCopy.contextMajorVersionUpper;
|
||||
contextMinorVersionUpper = theCopy.contextMinorVersionUpper;
|
||||
isTopDownTextureUV = theCopy.isTopDownTextureUV;
|
||||
glslWarnings = theCopy.glslWarnings;
|
||||
suppressExtraMsg = theCopy.suppressExtraMsg;
|
||||
glslDumpLevel = theCopy.glslDumpLevel;
|
||||
|
@@ -28,6 +28,7 @@ class OpenGl_Caps : public Standard_Transient
|
||||
public: //! @name flags to disable particular functionality, should be used only for testing purposes!
|
||||
|
||||
Standard_Boolean sRGBDisable; //!< Disables sRGB rendering (OFF by default)
|
||||
Standard_Boolean compressedTexturesDisable; //!< Disables uploading of compressed texture formats native to GPU (OFF by default)
|
||||
Standard_Boolean vboDisable; //!< disallow VBO usage for debugging purposes (OFF by default)
|
||||
Standard_Boolean pntSpritesDisable; //!< flag permits Point Sprites usage, will significantly affect performance (OFF by default)
|
||||
Standard_Boolean keepArrayData; //!< Disables freeing CPU memory after building VBOs (OFF by default)
|
||||
@@ -125,6 +126,19 @@ public: //! @name context creation parameters
|
||||
Standard_Integer contextMajorVersionUpper;
|
||||
Standard_Integer contextMinorVersionUpper;
|
||||
|
||||
/**
|
||||
* Define if 2D texture UV coordinates are defined top-down or bottom-up. FALSE by default.
|
||||
*
|
||||
* Proper rendering requires image texture uploading and UV texture coordinates being consistent,
|
||||
* otherwise texture mapping might appear vertically flipped.
|
||||
* Historically, OCCT used image library loading images bottom-up,
|
||||
* so that applications have to generate UV accordingly (flip V when necessary, V' = 1.0 - V).
|
||||
*
|
||||
* Graphic driver now compares this flag with image layout reported by Image_PixMap::IsTopDown(),
|
||||
* and in case of mismatch applies implicit texture coordinates conversion in GLSL program.
|
||||
*/
|
||||
Standard_Boolean isTopDownTextureUV;
|
||||
|
||||
public: //! @name flags to activate verbose output
|
||||
|
||||
//! Print GLSL program compilation/linkage warnings, if any. OFF by default.
|
||||
|
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <Graphic3d_TransformUtils.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
@@ -64,6 +65,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context,Standard_Transient)
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
//! Check if WebGL extension is available and activate it
|
||||
@@ -120,6 +122,8 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
core15fwd (NULL),
|
||||
core20 (NULL),
|
||||
core20fwd (NULL),
|
||||
core30 (NULL),
|
||||
core30fwd (NULL),
|
||||
core32 (NULL),
|
||||
core32back (NULL),
|
||||
core33 (NULL),
|
||||
@@ -135,6 +139,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
core45 (NULL),
|
||||
core45back (NULL),
|
||||
caps (!theCaps.IsNull() ? theCaps : new OpenGl_Caps()),
|
||||
hasGetBufferData (Standard_False),
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
hasHighp (Standard_False),
|
||||
hasUintIndex(Standard_False),
|
||||
@@ -188,6 +193,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
myClippingState (),
|
||||
myGlLibHandle (NULL),
|
||||
myFuncs (new OpenGl_GlFunctions()),
|
||||
mySupportedFormats (new Image_SupportedFormats()),
|
||||
myAnisoMax (1),
|
||||
myTexClamp (GL_CLAMP_TO_EDGE),
|
||||
myMaxTexDim (1024),
|
||||
@@ -1319,6 +1325,14 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
myVendor = (const char* )::glGetString (GL_VENDOR);
|
||||
myVendor.LowerCase();
|
||||
|
||||
// standard formats
|
||||
mySupportedFormats->Clear();
|
||||
mySupportedFormats->Add (Image_PixMap::ImgGray);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgAlpha);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgRGB);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgRGB32);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgRGBA);
|
||||
|
||||
if (caps->contextMajorVersionUpper != -1)
|
||||
{
|
||||
// synthetically restrict OpenGL version for testing
|
||||
@@ -1413,6 +1427,8 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
core15fwd = NULL;
|
||||
core20 = NULL;
|
||||
core20fwd = NULL;
|
||||
core30 = NULL;
|
||||
core30fwd = NULL;
|
||||
core32 = NULL;
|
||||
core32back = NULL;
|
||||
core33 = NULL;
|
||||
@@ -1467,6 +1483,13 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (extBgra)
|
||||
{
|
||||
// no BGR on OpenGL ES - only BGRA as extension
|
||||
mySupportedFormats->Add (Image_PixMap::ImgBGR32);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgBGRA);
|
||||
}
|
||||
|
||||
core11fwd = (OpenGl_GlCore11Fwd* )(&(*myFuncs));
|
||||
if (IsGlGreaterEqual (2, 0))
|
||||
{
|
||||
@@ -1520,27 +1543,240 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
hasHighp = Standard_True;
|
||||
}
|
||||
|
||||
arbTexFloat = IsGlGreaterEqual (3, 0)
|
||||
&& FindProcShort (glTexImage3D);
|
||||
arbTexFloat = (IsGlGreaterEqual (3, 0)
|
||||
&& FindProcShort (glTexImage3D))
|
||||
|| CheckExtension ("GL_OES_texture_float");
|
||||
hasTexFloatLinear = arbTexFloat
|
||||
&& CheckExtension ("GL_OES_texture_float_linear");
|
||||
|
||||
const Standard_Boolean hasTexBuffer32 = IsGlGreaterEqual (3, 2) && FindProcShort (glTexBuffer);
|
||||
const Standard_Boolean hasExtTexBuffer = CheckExtension ("GL_EXT_texture_buffer") && FindProc ("glTexBufferEXT", myFuncs->glTexBuffer);
|
||||
|
||||
const bool hasTexBuffer32 = IsGlGreaterEqual (3, 2) && FindProcShort (glTexBuffer);
|
||||
const bool hasExtTexBuffer = CheckExtension ("GL_EXT_texture_buffer") && FindProc ("glTexBufferEXT", myFuncs->glTexBuffer);
|
||||
if (hasTexBuffer32 || hasExtTexBuffer)
|
||||
{
|
||||
arbTBO = reinterpret_cast<OpenGl_ArbTBO*> (myFuncs.get());
|
||||
}
|
||||
|
||||
bool hasInstanced = IsGlGreaterEqual (3, 0)
|
||||
&& FindProcShort (glVertexAttribDivisor)
|
||||
&& FindProcShort (glDrawArraysInstanced)
|
||||
&& FindProcShort (glDrawElementsInstanced);
|
||||
if (!hasInstanced)
|
||||
{
|
||||
hasInstanced = CheckExtension ("GL_ANGLE_instanced_arrays")
|
||||
&& FindProc ("glVertexAttribDivisorANGLE", myFuncs->glVertexAttribDivisor)
|
||||
&& FindProc ("glDrawArraysInstancedANGLE", myFuncs->glDrawArraysInstanced)
|
||||
&& FindProc ("glDrawElementsInstancedANGLE", myFuncs->glDrawElementsInstanced);
|
||||
}
|
||||
if (hasInstanced)
|
||||
{
|
||||
arbIns = (OpenGl_ArbIns* )(&(*myFuncs));
|
||||
}
|
||||
|
||||
const bool hasVAO = IsGlGreaterEqual (3, 0)
|
||||
&& FindProcShort (glBindVertexArray)
|
||||
&& FindProcShort (glDeleteVertexArrays)
|
||||
&& FindProcShort (glGenVertexArrays)
|
||||
&& FindProcShort (glIsVertexArray);
|
||||
const bool hasMapBufferRange = IsGlGreaterEqual (3, 0)
|
||||
&& FindProcShort (glMapBufferRange)
|
||||
&& FindProcShort (glFlushMappedBufferRange);
|
||||
|
||||
// load OpenGL ES 3.0 new functions
|
||||
const bool has30es = IsGlGreaterEqual (3, 0)
|
||||
&& hasVAO
|
||||
&& hasMapBufferRange
|
||||
&& hasInstanced
|
||||
&& arbSamplerObject != NULL
|
||||
&& arbFBOBlit != NULL
|
||||
&& FindProcShort (glReadBuffer)
|
||||
&& FindProcShort (glDrawRangeElements)
|
||||
&& FindProcShort (glTexImage3D)
|
||||
&& FindProcShort (glTexSubImage3D)
|
||||
&& FindProcShort (glCopyTexSubImage3D)
|
||||
&& FindProcShort (glCompressedTexImage3D)
|
||||
&& FindProcShort (glCompressedTexSubImage3D)
|
||||
&& FindProcShort (glGenQueries)
|
||||
&& FindProcShort (glDeleteQueries)
|
||||
&& FindProcShort (glIsQuery)
|
||||
&& FindProcShort (glBeginQuery)
|
||||
&& FindProcShort (glEndQuery)
|
||||
&& FindProcShort (glGetQueryiv)
|
||||
&& FindProcShort (glGetQueryObjectuiv)
|
||||
&& FindProcShort (glUnmapBuffer)
|
||||
&& FindProcShort (glGetBufferPointerv)
|
||||
&& FindProcShort (glDrawBuffers)
|
||||
&& FindProcShort (glUniformMatrix2x3fv)
|
||||
&& FindProcShort (glUniformMatrix3x2fv)
|
||||
&& FindProcShort (glUniformMatrix2x4fv)
|
||||
&& FindProcShort (glUniformMatrix4x2fv)
|
||||
&& FindProcShort (glUniformMatrix3x4fv)
|
||||
&& FindProcShort (glUniformMatrix4x3fv)
|
||||
&& FindProcShort (glRenderbufferStorageMultisample)
|
||||
&& FindProcShort (glFramebufferTextureLayer)
|
||||
&& FindProcShort (glGetIntegeri_v)
|
||||
&& FindProcShort (glBeginTransformFeedback)
|
||||
&& FindProcShort (glEndTransformFeedback)
|
||||
&& FindProcShort (glBindBufferRange)
|
||||
&& FindProcShort (glBindBufferBase)
|
||||
&& FindProcShort (glTransformFeedbackVaryings)
|
||||
&& FindProcShort (glGetTransformFeedbackVarying)
|
||||
&& FindProcShort (glVertexAttribIPointer)
|
||||
&& FindProcShort (glGetVertexAttribIiv)
|
||||
&& FindProcShort (glGetVertexAttribIuiv)
|
||||
&& FindProcShort (glVertexAttribI4i)
|
||||
&& FindProcShort (glVertexAttribI4ui)
|
||||
&& FindProcShort (glVertexAttribI4iv)
|
||||
&& FindProcShort (glVertexAttribI4uiv)
|
||||
&& FindProcShort (glGetUniformuiv)
|
||||
&& FindProcShort (glGetFragDataLocation)
|
||||
&& FindProcShort (glUniform1ui)
|
||||
&& FindProcShort (glUniform2ui)
|
||||
&& FindProcShort (glUniform3ui)
|
||||
&& FindProcShort (glUniform4ui)
|
||||
&& FindProcShort (glUniform1uiv)
|
||||
&& FindProcShort (glUniform2uiv)
|
||||
&& FindProcShort (glUniform3uiv)
|
||||
&& FindProcShort (glUniform4uiv)
|
||||
&& FindProcShort (glClearBufferiv)
|
||||
&& FindProcShort (glClearBufferuiv)
|
||||
&& FindProcShort (glClearBufferfv)
|
||||
&& FindProcShort (glClearBufferfi)
|
||||
&& FindProcShort (glGetStringi)
|
||||
&& FindProcShort (glCopyBufferSubData)
|
||||
&& FindProcShort (glGetUniformIndices)
|
||||
&& FindProcShort (glGetActiveUniformsiv)
|
||||
&& FindProcShort (glGetUniformBlockIndex)
|
||||
&& FindProcShort (glGetActiveUniformBlockiv)
|
||||
&& FindProcShort (glGetActiveUniformBlockName)
|
||||
&& FindProcShort (glUniformBlockBinding)
|
||||
&& FindProcShort (glFenceSync)
|
||||
&& FindProcShort (glIsSync)
|
||||
&& FindProcShort (glDeleteSync)
|
||||
&& FindProcShort (glClientWaitSync)
|
||||
&& FindProcShort (glWaitSync)
|
||||
&& FindProcShort (glGetInteger64v)
|
||||
&& FindProcShort (glGetSynciv)
|
||||
&& FindProcShort (glGetInteger64i_v)
|
||||
&& FindProcShort (glGetBufferParameteri64v)
|
||||
&& FindProcShort (glBindTransformFeedback)
|
||||
&& FindProcShort (glDeleteTransformFeedbacks)
|
||||
&& FindProcShort (glGenTransformFeedbacks)
|
||||
&& FindProcShort (glIsTransformFeedback)
|
||||
&& FindProcShort (glPauseTransformFeedback)
|
||||
&& FindProcShort (glResumeTransformFeedback)
|
||||
&& FindProcShort (glGetProgramBinary)
|
||||
&& FindProcShort (glProgramBinary)
|
||||
&& FindProcShort (glProgramParameteri)
|
||||
&& FindProcShort (glInvalidateFramebuffer)
|
||||
&& FindProcShort (glInvalidateSubFramebuffer)
|
||||
&& FindProcShort (glTexStorage2D)
|
||||
&& FindProcShort (glTexStorage3D)
|
||||
&& FindProcShort (glGetInternalformativ);
|
||||
if (!has30es)
|
||||
{
|
||||
checkWrongVersion (3, 0, aLastFailedProc);
|
||||
}
|
||||
else
|
||||
{
|
||||
core30 = (OpenGl_GlCore30* )(&(*myFuncs));
|
||||
core30fwd = (OpenGl_GlCore30Fwd* )(&(*myFuncs));
|
||||
hasGetBufferData = true;
|
||||
}
|
||||
|
||||
// load OpenGL ES 3.1 new functions
|
||||
const bool has31es = IsGlGreaterEqual (3, 1)
|
||||
&& has30es
|
||||
&& FindProcShort (glDispatchCompute)
|
||||
&& FindProcShort (glDispatchComputeIndirect)
|
||||
&& FindProcShort (glDrawArraysIndirect)
|
||||
&& FindProcShort (glDrawElementsIndirect)
|
||||
&& FindProcShort (glFramebufferParameteri)
|
||||
&& FindProcShort (glGetFramebufferParameteriv)
|
||||
&& FindProcShort (glGetProgramInterfaceiv)
|
||||
&& FindProcShort (glGetProgramResourceIndex)
|
||||
&& FindProcShort (glGetProgramResourceName)
|
||||
&& FindProcShort (glGetProgramResourceiv)
|
||||
&& FindProcShort (glGetProgramResourceLocation)
|
||||
&& FindProcShort (glUseProgramStages)
|
||||
&& FindProcShort (glActiveShaderProgram)
|
||||
&& FindProcShort (glCreateShaderProgramv)
|
||||
&& FindProcShort (glBindProgramPipeline)
|
||||
&& FindProcShort (glDeleteProgramPipelines)
|
||||
&& FindProcShort (glGenProgramPipelines)
|
||||
&& FindProcShort (glIsProgramPipeline)
|
||||
&& FindProcShort (glGetProgramPipelineiv)
|
||||
&& FindProcShort (glProgramUniform1i)
|
||||
&& FindProcShort (glProgramUniform2i)
|
||||
&& FindProcShort (glProgramUniform3i)
|
||||
&& FindProcShort (glProgramUniform4i)
|
||||
&& FindProcShort (glProgramUniform1ui)
|
||||
&& FindProcShort (glProgramUniform2ui)
|
||||
&& FindProcShort (glProgramUniform3ui)
|
||||
&& FindProcShort (glProgramUniform4ui)
|
||||
&& FindProcShort (glProgramUniform1f)
|
||||
&& FindProcShort (glProgramUniform2f)
|
||||
&& FindProcShort (glProgramUniform3f)
|
||||
&& FindProcShort (glProgramUniform4f)
|
||||
&& FindProcShort (glProgramUniform1iv)
|
||||
&& FindProcShort (glProgramUniform2iv)
|
||||
&& FindProcShort (glProgramUniform3iv)
|
||||
&& FindProcShort (glProgramUniform4iv)
|
||||
&& FindProcShort (glProgramUniform1uiv)
|
||||
&& FindProcShort (glProgramUniform2uiv)
|
||||
&& FindProcShort (glProgramUniform3uiv)
|
||||
&& FindProcShort (glProgramUniform4uiv)
|
||||
&& FindProcShort (glProgramUniform1fv)
|
||||
&& FindProcShort (glProgramUniform2fv)
|
||||
&& FindProcShort (glProgramUniform3fv)
|
||||
&& FindProcShort (glProgramUniform4fv)
|
||||
&& FindProcShort (glProgramUniformMatrix2fv)
|
||||
&& FindProcShort (glProgramUniformMatrix3fv)
|
||||
&& FindProcShort (glProgramUniformMatrix4fv)
|
||||
&& FindProcShort (glProgramUniformMatrix2x3fv)
|
||||
&& FindProcShort (glProgramUniformMatrix3x2fv)
|
||||
&& FindProcShort (glProgramUniformMatrix2x4fv)
|
||||
&& FindProcShort (glProgramUniformMatrix4x2fv)
|
||||
&& FindProcShort (glProgramUniformMatrix3x4fv)
|
||||
&& FindProcShort (glProgramUniformMatrix4x3fv)
|
||||
&& FindProcShort (glValidateProgramPipeline)
|
||||
&& FindProcShort (glGetProgramPipelineInfoLog)
|
||||
&& FindProcShort (glBindImageTexture)
|
||||
&& FindProcShort (glGetBooleani_v)
|
||||
&& FindProcShort (glMemoryBarrier)
|
||||
&& FindProcShort (glMemoryBarrierByRegion)
|
||||
&& FindProcShort (glTexStorage2DMultisample)
|
||||
&& FindProcShort (glGetMultisamplefv)
|
||||
&& FindProcShort (glSampleMaski)
|
||||
&& FindProcShort (glGetTexLevelParameteriv)
|
||||
&& FindProcShort (glGetTexLevelParameterfv)
|
||||
&& FindProcShort (glBindVertexBuffer)
|
||||
&& FindProcShort (glVertexAttribFormat)
|
||||
&& FindProcShort (glVertexAttribIFormat)
|
||||
&& FindProcShort (glVertexAttribBinding)
|
||||
&& FindProcShort (glVertexBindingDivisor);
|
||||
if (!has31es)
|
||||
{
|
||||
checkWrongVersion (3, 1, aLastFailedProc);
|
||||
}
|
||||
|
||||
// initialize debug context extension
|
||||
if (CheckExtension ("GL_KHR_debug"))
|
||||
if (IsGlGreaterEqual (3, 2)
|
||||
|| CheckExtension ("GL_KHR_debug"))
|
||||
{
|
||||
// this functionality become a part of OpenGL ES 3.2
|
||||
arbDbg = NULL;
|
||||
if (IsGlGreaterEqual (3, 2)
|
||||
&& FindProcShort (glDebugMessageControl)
|
||||
&& FindProcShort (glDebugMessageInsert)
|
||||
&& FindProcShort (glDebugMessageCallback)
|
||||
&& FindProcShort (glGetDebugMessageLog))
|
||||
{
|
||||
arbDbg = (OpenGl_ArbDbg* )(&(*myFuncs));
|
||||
}
|
||||
// According to GL_KHR_debug spec, all functions should have KHR suffix.
|
||||
// However, some implementations can export these functions without suffix.
|
||||
if (FindProc ("glDebugMessageControlKHR", myFuncs->glDebugMessageControl)
|
||||
else if (!IsGlGreaterEqual (3, 2)
|
||||
&& FindProc ("glDebugMessageControlKHR", myFuncs->glDebugMessageControl)
|
||||
&& FindProc ("glDebugMessageInsertKHR", myFuncs->glDebugMessageInsert)
|
||||
&& FindProc ("glDebugMessageCallbackKHR", myFuncs->glDebugMessageCallback)
|
||||
&& FindProc ("glGetDebugMessageLogKHR", myFuncs->glGetDebugMessageLog))
|
||||
@@ -1563,6 +1799,55 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
}
|
||||
}
|
||||
|
||||
// load OpenGL ES 3.2 new functions
|
||||
const bool has32es = IsGlGreaterEqual (3, 2)
|
||||
&& has31es
|
||||
&& hasTexBuffer32
|
||||
&& arbDbg != NULL
|
||||
&& FindProcShort (glBlendBarrier)
|
||||
&& FindProcShort (glCopyImageSubData)
|
||||
&& FindProcShort (glPushDebugGroup)
|
||||
&& FindProcShort (glPopDebugGroup)
|
||||
&& FindProcShort (glObjectLabel)
|
||||
&& FindProcShort (glGetObjectLabel)
|
||||
&& FindProcShort (glObjectPtrLabel)
|
||||
&& FindProcShort (glGetObjectPtrLabel)
|
||||
&& FindProcShort (glGetPointerv)
|
||||
&& FindProcShort (glEnablei)
|
||||
&& FindProcShort (glDisablei)
|
||||
&& FindProcShort (glBlendEquationi)
|
||||
&& FindProcShort (glBlendEquationSeparatei)
|
||||
&& FindProcShort (glBlendFunci)
|
||||
&& FindProcShort (glBlendFuncSeparatei)
|
||||
&& FindProcShort (glColorMaski)
|
||||
&& FindProcShort (glIsEnabledi)
|
||||
&& FindProcShort (glDrawElementsBaseVertex)
|
||||
&& FindProcShort (glDrawRangeElementsBaseVertex)
|
||||
&& FindProcShort (glDrawElementsInstancedBaseVertex)
|
||||
&& FindProcShort (glFramebufferTexture)
|
||||
&& FindProcShort (glPrimitiveBoundingBox)
|
||||
&& FindProcShort (glGetGraphicsResetStatus)
|
||||
&& FindProcShort (glReadnPixels)
|
||||
&& FindProcShort (glGetnUniformfv)
|
||||
&& FindProcShort (glGetnUniformiv)
|
||||
&& FindProcShort (glGetnUniformuiv)
|
||||
&& FindProcShort (glMinSampleShading)
|
||||
&& FindProcShort (glPatchParameteri)
|
||||
&& FindProcShort (glTexParameterIiv)
|
||||
&& FindProcShort (glTexParameterIuiv)
|
||||
&& FindProcShort (glGetTexParameterIiv)
|
||||
&& FindProcShort (glGetTexParameterIuiv)
|
||||
&& FindProcShort (glSamplerParameterIiv)
|
||||
&& FindProcShort (glSamplerParameterIuiv)
|
||||
&& FindProcShort (glGetSamplerParameterIiv)
|
||||
&& FindProcShort (glGetSamplerParameterIuiv)
|
||||
&& FindProcShort (glTexBufferRange)
|
||||
&& FindProcShort (glTexStorage3DMultisample);
|
||||
if (!has32es)
|
||||
{
|
||||
checkWrongVersion (3, 2, aLastFailedProc);
|
||||
}
|
||||
|
||||
extDrawBuffers = CheckExtension ("GL_EXT_draw_buffers") && FindProc ("glDrawBuffersEXT", myFuncs->glDrawBuffers);
|
||||
arbDrawBuffers = CheckExtension ("GL_ARB_draw_buffers") && FindProc ("glDrawBuffersARB", myFuncs->glDrawBuffers);
|
||||
|
||||
@@ -1613,7 +1898,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
myTexClamp = IsGlGreaterEqual (1, 2) ? GL_CLAMP_TO_EDGE : GL_CLAMP;
|
||||
|
||||
hasTexRGBA8 = Standard_True;
|
||||
hasTexSRGB = IsGlGreaterEqual (2, 0);
|
||||
hasTexSRGB = IsGlGreaterEqual (2, 1);
|
||||
hasFboSRGB = IsGlGreaterEqual (2, 1);
|
||||
hasSRGBControl = hasFboSRGB;
|
||||
arbDrawBuffers = CheckExtension ("GL_ARB_draw_buffers");
|
||||
@@ -1622,12 +1907,20 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
|| CheckExtension ("GL_ARB_texture_float");
|
||||
hasTexFloatLinear = arbTexFloat;
|
||||
arbSampleShading = CheckExtension ("GL_ARB_sample_shading");
|
||||
extBgra = CheckExtension ("GL_EXT_bgra");
|
||||
extBgra = IsGlGreaterEqual (1, 2)
|
||||
|| CheckExtension ("GL_EXT_bgra");
|
||||
extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
|
||||
extPDS = CheckExtension ("GL_EXT_packed_depth_stencil");
|
||||
atiMem = CheckExtension ("GL_ATI_meminfo");
|
||||
nvxMem = CheckExtension ("GL_NVX_gpu_memory_info");
|
||||
|
||||
if (extBgra)
|
||||
{
|
||||
mySupportedFormats->Add (Image_PixMap::ImgBGR);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgBGR32);
|
||||
mySupportedFormats->Add (Image_PixMap::ImgBGRA);
|
||||
}
|
||||
|
||||
hasDrawBuffers = IsGlGreaterEqual (2, 0) ? OpenGl_FeatureInCore :
|
||||
arbDrawBuffers ? OpenGl_FeatureInExtensions
|
||||
: OpenGl_FeatureNotAvailable;
|
||||
@@ -1894,6 +2187,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
core15 = (OpenGl_GlCore15* )(&(*myFuncs));
|
||||
}
|
||||
core15fwd = (OpenGl_GlCore15Fwd* )(&(*myFuncs));
|
||||
hasGetBufferData = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2158,6 +2452,12 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
// but doesn't hardware accelerated by some ancient OpenGL 2.1 hardware (GeForce FX, RadeOn 9700 etc.)
|
||||
arbNPTW = Standard_True;
|
||||
arbTexRG = Standard_True;
|
||||
|
||||
if (!isCoreProfile)
|
||||
{
|
||||
core30 = (OpenGl_GlCore30* )(&(*myFuncs));
|
||||
}
|
||||
core30fwd = (OpenGl_GlCore30Fwd* )(&(*myFuncs));
|
||||
}
|
||||
|
||||
// load OpenGL 3.1 new functions
|
||||
@@ -2974,6 +3274,59 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
}
|
||||
}
|
||||
|
||||
if (arbTexFloat)
|
||||
{
|
||||
mySupportedFormats->Add (Image_Format_GrayF);
|
||||
mySupportedFormats->Add (Image_Format_AlphaF);
|
||||
mySupportedFormats->Add (Image_Format_RGBF);
|
||||
mySupportedFormats->Add (Image_Format_RGBAF);
|
||||
if (arbTexRG)
|
||||
{
|
||||
mySupportedFormats->Add (Image_Format_RGF);
|
||||
}
|
||||
if (extBgra)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
mySupportedFormats->Add (Image_Format_BGRF);
|
||||
#endif
|
||||
mySupportedFormats->Add (Image_Format_BGRAF);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (checkEnableWebGlExtension (*this, "GL_WEBGL_compressed_texture_s3tc")) // GL_WEBGL_compressed_texture_s3tc_srgb for sRGB formats
|
||||
{
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGB_S3TC_DXT1);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT1);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT3);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT5);
|
||||
}
|
||||
#else
|
||||
if (CheckExtension ("GL_EXT_texture_compression_s3tc")) // GL_EXT_texture_sRGB for sRGB formats
|
||||
{
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGB_S3TC_DXT1);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT1);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT3);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT5);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckExtension ("GL_EXT_texture_compression_dxt1"))
|
||||
{
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGB_S3TC_DXT1);
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT1);
|
||||
}
|
||||
if (CheckExtension ("GL_ANGLE_texture_compression_dxt3"))
|
||||
{
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT3);
|
||||
}
|
||||
if (CheckExtension ("GL_ANGLE_texture_compression_dxt5"))
|
||||
{
|
||||
mySupportedFormats->Add (Image_CompressedFormat_RGBA_S3TC_DXT5);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check whether PBR shading model is supported
|
||||
myHasPBR = arbFBO != NULL
|
||||
&& myMaxTexCombined >= 4
|
||||
@@ -3461,7 +3814,7 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_Sampler::applySamplerParams (aThisCtx, aTextureNew->Sampler()->Parameters(), aTextureNew->Sampler().get(), aTextureNew->GetTarget(), aTextureNew->HasMipmaps());
|
||||
OpenGl_Sampler::applySamplerParams (aThisCtx, aTextureNew->Sampler()->Parameters(), aTextureNew->Sampler().get(), aTextureNew->GetTarget(), aTextureNew->MaxMipmapLevel());
|
||||
}
|
||||
}
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
@@ -3791,13 +4144,17 @@ void OpenGl_Context::SetLineWidth (const Standard_ShortReal theWidth)
|
||||
// function : SetTextureMatrix
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams)
|
||||
void OpenGl_Context::SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams,
|
||||
const Standard_Boolean theIsTopDown)
|
||||
{
|
||||
if (theParams.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!myActiveProgram.IsNull())
|
||||
|
||||
const Graphic3d_Vec2& aScale = theParams->Scale();
|
||||
const Graphic3d_Vec2& aTrans = theParams->Translation();
|
||||
if (!myActiveProgram.IsNull())
|
||||
{
|
||||
const GLint aUniLoc = myActiveProgram->GetStateLocation (OpenGl_OCCT_TEXTURE_TRSF2D);
|
||||
if (aUniLoc == OpenGl_ShaderProgram::INVALID_LOCATION)
|
||||
@@ -3808,14 +4165,17 @@ void OpenGl_Context::SetTextureMatrix (const Handle(Graphic3d_TextureParams)& th
|
||||
// pack transformation parameters
|
||||
OpenGl_Vec4 aTrsf[2] =
|
||||
{
|
||||
OpenGl_Vec4 (-theParams->Translation().x(),
|
||||
-theParams->Translation().y(),
|
||||
theParams->Scale().x(),
|
||||
theParams->Scale().y()),
|
||||
OpenGl_Vec4 (-aTrans.x(), -aTrans.y(), aScale.x(), aScale.y()),
|
||||
OpenGl_Vec4 (static_cast<float> (std::sin (-theParams->Rotation() * M_PI / 180.0)),
|
||||
static_cast<float> (std::cos (-theParams->Rotation() * M_PI / 180.0)),
|
||||
0.0f, 0.0f)
|
||||
};
|
||||
if (caps->isTopDownTextureUV != theIsTopDown)
|
||||
{
|
||||
// flip V
|
||||
aTrsf[0].y() = -aTrans.y() + 1.0f / aScale.y();
|
||||
aTrsf[0].w() = -aScale.y();
|
||||
}
|
||||
myActiveProgram->SetUniform (this, aUniLoc, 2, aTrsf);
|
||||
return;
|
||||
}
|
||||
@@ -3828,11 +4188,18 @@ void OpenGl_Context::SetTextureMatrix (const Handle(Graphic3d_TextureParams)& th
|
||||
|
||||
core11->glMatrixMode (GL_TEXTURE);
|
||||
OpenGl_Mat4 aTextureMat;
|
||||
const Graphic3d_Vec2& aScale = theParams->Scale();
|
||||
const Graphic3d_Vec2& aTrans = theParams->Translation();
|
||||
Graphic3d_TransformUtils::Scale (aTextureMat, aScale.x(), aScale.y(), 1.0f);
|
||||
Graphic3d_TransformUtils::Translate (aTextureMat, -aTrans.x(), -aTrans.y(), 0.0f);
|
||||
Graphic3d_TransformUtils::Rotate (aTextureMat, -theParams->Rotation(), 0.0f, 0.0f, 1.0f);
|
||||
if (caps->isTopDownTextureUV != theIsTopDown)
|
||||
{
|
||||
// flip V
|
||||
Graphic3d_TransformUtils::Scale (aTextureMat, aScale.x(), -aScale.y(), 1.0f);
|
||||
Graphic3d_TransformUtils::Translate (aTextureMat, -aTrans.x(), -aTrans.y() + 1.0f / aScale.y(), 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphic3d_TransformUtils::Scale (aTextureMat, aScale.x(), aScale.y(), 1.0f);
|
||||
Graphic3d_TransformUtils::Translate (aTextureMat, -aTrans.x(), -aTrans.y(), 0.0f);
|
||||
}
|
||||
Graphic3d_TransformUtils::Rotate (aTextureMat, -theParams->Rotation(), 0.0f, 0.0f, 1.0f);
|
||||
core11->glLoadMatrixf (aTextureMat);
|
||||
core11->glMatrixMode (aMatrixMode);
|
||||
}
|
||||
@@ -4250,6 +4617,36 @@ bool OpenGl_Context::SetSampleAlphaToCoverage (bool theToEnable)
|
||||
return anOldValue;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetBufferSubData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_Context::GetBufferSubData (GLenum theTarget, GLintptr theOffset, GLsizeiptr theSize, void* theData)
|
||||
{
|
||||
if (!hasGetBufferData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#ifdef __EMSCRIPTEN__
|
||||
EM_ASM_(
|
||||
{
|
||||
Module.ctx.getBufferSubData($0, $1, HEAPU8.subarray($2, $2 + $3));
|
||||
}, theTarget, theOffset, theData, theSize);
|
||||
return true;
|
||||
#elif defined(GL_ES_VERSION_2_0)
|
||||
if (void* aData = core30fwd->glMapBufferRange (theTarget, theOffset, theSize, GL_MAP_READ_BIT))
|
||||
{
|
||||
memcpy (theData, aData, theSize);
|
||||
core30fwd->glUnmapBuffer (theTarget);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
core15fwd->glGetBufferSubData (theTarget, theOffset, theSize, theData);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DumpJson
|
||||
// purpose :
|
||||
|
@@ -506,6 +506,9 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Return map of supported texture formats.
|
||||
const Handle(Image_SupportedFormats)& SupportedTextureFormats() const { return mySupportedFormats; }
|
||||
|
||||
//! @return maximum degree of anisotropy texture filter
|
||||
Standard_Integer MaxDegreeOfAnisotropy() const { return myAnisoMax; }
|
||||
|
||||
@@ -911,7 +914,10 @@ public: //! @name methods to alter or retrieve current state
|
||||
Standard_EXPORT void SetPointSpriteOrigin();
|
||||
|
||||
//! Setup texture matrix to active GLSL program or to FFP global state using glMatrixMode (GL_TEXTURE).
|
||||
Standard_EXPORT void SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams);
|
||||
//! @param theParams [in] texture parameters
|
||||
//! @param theIsTopDown [in] texture top-down flag
|
||||
Standard_EXPORT void SetTextureMatrix (const Handle(Graphic3d_TextureParams)& theParams,
|
||||
const Standard_Boolean theIsTopDown);
|
||||
|
||||
//! Bind default Vertex Array Object
|
||||
Standard_EXPORT void BindDefaultVao();
|
||||
@@ -981,6 +987,17 @@ public: //! @name methods to alter or retrieve current state
|
||||
//! Set line feater width.
|
||||
void SetLineFeather(Standard_ShortReal theValue) { myLineFeather = theValue; }
|
||||
|
||||
//! Wrapper over glGetBufferSubData(), implemented as:
|
||||
//! - OpenGL 1.5+ (desktop) via glGetBufferSubData();
|
||||
//! - OpenGL ES 3.0+ via glMapBufferRange();
|
||||
//! - WebGL 2.0+ via gl.getBufferSubData().
|
||||
//! @param theTarget [in] target buffer to map
|
||||
//! @param theOffset [in] offset to the beginning of sub-data
|
||||
//! @param theSize [in] number of bytes to read
|
||||
//! @param theData [out] destination pointer to fill
|
||||
//! @return FALSE if functionality is unavailable
|
||||
Standard_EXPORT bool GetBufferSubData (GLenum theTarget, GLintptr theOffset, GLsizeiptr theSize, void* theData);
|
||||
|
||||
//! Return Graphics Driver's vendor.
|
||||
const TCollection_AsciiString& Vendor() const { return myVendor; }
|
||||
|
||||
@@ -1017,6 +1034,8 @@ public: //! @name core profiles
|
||||
OpenGl_GlCore15Fwd* core15fwd; //!< OpenGL 1.5 without deprecated entry points
|
||||
OpenGl_GlCore20* core20; //!< OpenGL 2.0 core functionality (includes 1.5)
|
||||
OpenGl_GlCore20Fwd* core20fwd; //!< OpenGL 2.0 without deprecated entry points
|
||||
OpenGl_GlCore30* core30; //!< OpenGL 3.0 core functionality
|
||||
OpenGl_GlCore30Fwd* core30fwd; //!< OpenGL 3.0 without deprecated entry points
|
||||
OpenGl_GlCore32* core32; //!< OpenGL 3.2 core profile
|
||||
OpenGl_GlCore32Back* core32back; //!< OpenGL 3.2 backward compatibility profile
|
||||
OpenGl_GlCore33* core33; //!< OpenGL 3.3 core profile
|
||||
@@ -1036,11 +1055,12 @@ public: //! @name core profiles
|
||||
|
||||
public: //! @name extensions
|
||||
|
||||
Standard_Boolean hasGetBufferData; //!< flag indicating if GetBufferSubData() is supported
|
||||
Standard_Boolean hasHighp; //!< highp in GLSL ES fragment shader is supported
|
||||
Standard_Boolean hasUintIndex; //!< GLuint for index buffer is supported (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_element_index_uint)
|
||||
Standard_Boolean hasTexRGBA8; //!< always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
|
||||
Standard_Boolean hasTexFloatLinear; //!< texture-filterable state for 32-bit floating texture formats (always on desktop, GL_OES_texture_float_linear within OpenGL ES)
|
||||
Standard_Boolean hasTexSRGB; //!< sRGB texture formats (desktop OpenGL 2.0, OpenGL ES 3.0 or GL_EXT_texture_sRGB)
|
||||
Standard_Boolean hasTexSRGB; //!< sRGB texture formats (desktop OpenGL 2.1, OpenGL ES 3.0 or GL_EXT_texture_sRGB)
|
||||
Standard_Boolean hasFboSRGB; //!< sRGB FBO render targets (desktop OpenGL 2.1, OpenGL ES 3.0)
|
||||
Standard_Boolean hasSRGBControl; //!< sRGB write control (any desktop OpenGL, OpenGL ES + GL_EXT_sRGB_write_control extension)
|
||||
OpenGl_FeatureFlag hasFlatShading; //!< Complex flag indicating support of Flat shading (Graphic3d_TOSM_FACET) (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_standard_derivatives)
|
||||
@@ -1056,10 +1076,10 @@ public: //! @name extensions
|
||||
Standard_Boolean arbTexFloat; //!< GL_ARB_texture_float (on desktop OpenGL - since 3.0 or as extension GL_ARB_texture_float; on OpenGL ES - since 3.0); @sa hasTexFloatLinear for linear filtering support
|
||||
OpenGl_ArbSamplerObject* arbSamplerObject; //!< GL_ARB_sampler_objects (on desktop OpenGL - since 3.3 or as extension GL_ARB_sampler_objects; on OpenGL ES - since 3.0)
|
||||
OpenGl_ArbTexBindless* arbTexBindless; //!< GL_ARB_bindless_texture
|
||||
OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
|
||||
OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object (on desktop OpenGL - since 3.1 or as extension GL_ARB_texture_buffer_object; on OpenGL ES - since 3.2)
|
||||
Standard_Boolean arbTboRGB32; //!< GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0
|
||||
OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
|
||||
OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
|
||||
OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced (on desktop OpenGL - since 3.1 or as extebsion GL_ARB_draw_instanced; on OpenGL ES - since 3.0 or as extension GL_ANGLE_instanced_arrays to WebGL 1.0)
|
||||
OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output (on desktop OpenGL - since 4.3 or as extension GL_ARB_debug_output; on OpenGL ES - since 3.2 or as extension GL_KHR_debug)
|
||||
OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
|
||||
OpenGl_ArbFBOBlit* arbFBOBlit; //!< glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
|
||||
Standard_Boolean arbSampleShading; //!< GL_ARB_sample_shading
|
||||
@@ -1116,6 +1136,8 @@ private: // context info
|
||||
void* myGlLibHandle; //!< optional handle to GL library
|
||||
NCollection_Handle<OpenGl_GlFunctions>
|
||||
myFuncs; //!< mega structure for all GL functions
|
||||
Handle(Image_SupportedFormats)
|
||||
mySupportedFormats; //!< map of supported texture formats
|
||||
Standard_Integer myAnisoMax; //!< maximum level of anisotropy texture filter
|
||||
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
|
||||
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
||||
|
352
src/OpenGl/OpenGl_GLESExtensions.hxx
Normal file
352
src/OpenGl/OpenGl_GLESExtensions.hxx
Normal file
@@ -0,0 +1,352 @@
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_GLESExtensions_Header
|
||||
#define _OpenGl_GLESExtensions_Header
|
||||
|
||||
// define items to unify code paths with desktop OpenGL
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
|
||||
// GL_EXT_sRGB_write_control extension for OpenGL ES
|
||||
// adds GL_FRAMEBUFFER_SRGB_EXT flag as on desktop OpenGL
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
|
||||
// OpenGL ES 3.1+
|
||||
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
|
||||
|
||||
// OpenGL ES 3.2+ or GL_EXT_texture_buffer for OpenGL ES 3.1+
|
||||
#define GL_TEXTURE_BUFFER 0x8C2A
|
||||
|
||||
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
|
||||
#define GL_LUMINANCE8 0x8040
|
||||
// GL_EXT_texture_format_BGRA8888
|
||||
#define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop
|
||||
|
||||
#define GL_R16 0x822A
|
||||
#define GL_RGB4 0x804F
|
||||
#define GL_RGB5 0x8050
|
||||
#define GL_RGB10 0x8052
|
||||
#define GL_RGB12 0x8053
|
||||
#define GL_RGB16 0x8054
|
||||
#define GL_RGB10_A2 0x8059
|
||||
#define GL_RGBA12 0x805A
|
||||
#define GL_RGBA16 0x805B
|
||||
#define GL_ALPHA8 0x803C
|
||||
#define GL_ALPHA16 0x803E
|
||||
#define GL_RG16 0x822C
|
||||
|
||||
#define GL_R16_SNORM 0x8F98
|
||||
#define GL_RG16_SNORM 0x8F99
|
||||
#define GL_RGB16_SNORM 0x8F9A
|
||||
#define GL_RGBA16_SNORM 0x8F9B
|
||||
|
||||
#define GL_RED_SNORM 0x8F90
|
||||
#define GL_RG_SNORM 0x8F91
|
||||
#define GL_RGB_SNORM 0x8F92
|
||||
#define GL_RGBA_SNORM 0x8F93
|
||||
|
||||
// GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
|
||||
// debug ARB extension
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
|
||||
#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
|
||||
#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
|
||||
#define GL_DEBUG_SOURCE_API 0x8246
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER 0x824B
|
||||
#define GL_DEBUG_TYPE_ERROR 0x824C
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
|
||||
#define GL_DEBUG_TYPE_PORTABILITY 0x824F
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
|
||||
#define GL_DEBUG_TYPE_OTHER 0x8251
|
||||
#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
|
||||
#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
|
||||
#define GL_DEBUG_LOGGED_MESSAGES 0x9145
|
||||
#define GL_DEBUG_SEVERITY_HIGH 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
|
||||
// OpenGL ES 3.0+ or OES_texture_half_float
|
||||
#define GL_HALF_FLOAT_OES 0x8D61
|
||||
|
||||
// OpenGL ES 3.1+
|
||||
#define GL_COMPUTE_SHADER 0x91B9
|
||||
|
||||
// OpenGL ES 3.2+
|
||||
#define GL_GEOMETRY_SHADER 0x8DD9
|
||||
#define GL_TESS_CONTROL_SHADER 0x8E88
|
||||
#define GL_TESS_EVALUATION_SHADER 0x8E87
|
||||
#define GL_LINES_ADJACENCY 0x000A
|
||||
#define GL_LINE_STRIP_ADJACENCY 0x000B
|
||||
#define GL_TRIANGLES_ADJACENCY 0x000C
|
||||
#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
|
||||
#define GL_PATCHES 0x000E
|
||||
|
||||
// GL_EXT_texture_compression_s3tc extension
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
//
|
||||
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
// put into namespace to avoid collisions with system headers
|
||||
namespace opencascade
|
||||
{
|
||||
|
||||
//#ifndef GL_ES_VERSION_3_0
|
||||
typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISQUERYPROC) (GLuint id);
|
||||
typedef void (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
|
||||
typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
|
||||
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
|
||||
typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
|
||||
typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
|
||||
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
|
||||
typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
|
||||
typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
|
||||
typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
|
||||
//#endif GL_ES_VERSION_3_0
|
||||
|
||||
//#ifndef GL_ES_VERSION_3_1
|
||||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
|
||||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
|
||||
typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
|
||||
typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
|
||||
//#endif GL_ES_VERSION_3_1
|
||||
|
||||
//#ifndef GL_ES_VERSION_3_2
|
||||
typedef void (GL_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
|
||||
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDBARRIERPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
|
||||
typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
|
||||
typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
|
||||
typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
|
||||
typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
|
||||
//#endif GL_ES_VERSION_3_2
|
||||
|
||||
} // namespace opencascade
|
||||
|
||||
#endif // _OpenGl_GLESExtensions_Header
|
@@ -28,8 +28,6 @@ struct OpenGl_TmplCore30 : public theBaseClass_t
|
||||
|
||||
public: //! @name GL_ARB_framebuffer_object (added to OpenGL 3.0 core)
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
|
||||
using theBaseClass_t::glIsRenderbuffer;
|
||||
using theBaseClass_t::glBindRenderbuffer;
|
||||
using theBaseClass_t::glDeleteRenderbuffers;
|
||||
@@ -41,15 +39,17 @@ public: //! @name GL_ARB_framebuffer_object (added to OpenGL 3.0 core)
|
||||
using theBaseClass_t::glDeleteFramebuffers;
|
||||
using theBaseClass_t::glGenFramebuffers;
|
||||
using theBaseClass_t::glCheckFramebufferStatus;
|
||||
using theBaseClass_t::glFramebufferTexture1D;
|
||||
using theBaseClass_t::glFramebufferTexture2D;
|
||||
using theBaseClass_t::glFramebufferTexture3D;
|
||||
using theBaseClass_t::glFramebufferRenderbuffer;
|
||||
using theBaseClass_t::glGetFramebufferAttachmentParameteriv;
|
||||
using theBaseClass_t::glGenerateMipmap;
|
||||
using theBaseClass_t::glBlitFramebuffer;
|
||||
using theBaseClass_t::glRenderbufferStorageMultisample;
|
||||
using theBaseClass_t::glFramebufferTextureLayer;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
using theBaseClass_t::glFramebufferTexture1D;
|
||||
using theBaseClass_t::glFramebufferTexture3D;
|
||||
#endif
|
||||
|
||||
public: //! @name GL_ARB_vertex_array_object (added to OpenGL 3.0 core)
|
||||
|
||||
@@ -65,46 +65,22 @@ public: //! @name GL_ARB_map_buffer_range (added to OpenGL 3.0 core)
|
||||
|
||||
public: //! @name OpenGL 3.0 additives to 2.1
|
||||
|
||||
using theBaseClass_t::glColorMaski;
|
||||
using theBaseClass_t::glGetBooleani_v;
|
||||
using theBaseClass_t::glGetIntegeri_v;
|
||||
using theBaseClass_t::glEnablei;
|
||||
using theBaseClass_t::glDisablei;
|
||||
using theBaseClass_t::glIsEnabledi;
|
||||
using theBaseClass_t::glBeginTransformFeedback;
|
||||
using theBaseClass_t::glEndTransformFeedback;
|
||||
using theBaseClass_t::glBindBufferRange;
|
||||
using theBaseClass_t::glBindBufferBase;
|
||||
using theBaseClass_t::glTransformFeedbackVaryings;
|
||||
using theBaseClass_t::glGetTransformFeedbackVarying;
|
||||
using theBaseClass_t::glClampColor;
|
||||
using theBaseClass_t::glBeginConditionalRender;
|
||||
using theBaseClass_t::glEndConditionalRender;
|
||||
using theBaseClass_t::glVertexAttribIPointer;
|
||||
using theBaseClass_t::glGetVertexAttribIiv;
|
||||
using theBaseClass_t::glGetVertexAttribIuiv;
|
||||
using theBaseClass_t::glVertexAttribI1i;
|
||||
using theBaseClass_t::glVertexAttribI2i;
|
||||
using theBaseClass_t::glVertexAttribI3i;
|
||||
using theBaseClass_t::glVertexAttribI4i;
|
||||
using theBaseClass_t::glVertexAttribI1ui;
|
||||
using theBaseClass_t::glVertexAttribI2ui;
|
||||
using theBaseClass_t::glVertexAttribI3ui;
|
||||
using theBaseClass_t::glVertexAttribI4ui;
|
||||
using theBaseClass_t::glVertexAttribI1iv;
|
||||
using theBaseClass_t::glVertexAttribI2iv;
|
||||
using theBaseClass_t::glVertexAttribI3iv;
|
||||
using theBaseClass_t::glVertexAttribI4iv;
|
||||
using theBaseClass_t::glVertexAttribI1uiv;
|
||||
using theBaseClass_t::glVertexAttribI2uiv;
|
||||
using theBaseClass_t::glVertexAttribI3uiv;
|
||||
using theBaseClass_t::glVertexAttribI4uiv;
|
||||
using theBaseClass_t::glVertexAttribI4bv;
|
||||
using theBaseClass_t::glVertexAttribI4sv;
|
||||
using theBaseClass_t::glVertexAttribI4ubv;
|
||||
using theBaseClass_t::glVertexAttribI4usv;
|
||||
using theBaseClass_t::glGetUniformuiv;
|
||||
using theBaseClass_t::glBindFragDataLocation;
|
||||
using theBaseClass_t::glGetFragDataLocation;
|
||||
using theBaseClass_t::glUniform1ui;
|
||||
using theBaseClass_t::glUniform2ui;
|
||||
@@ -114,18 +90,60 @@ public: //! @name OpenGL 3.0 additives to 2.1
|
||||
using theBaseClass_t::glUniform2uiv;
|
||||
using theBaseClass_t::glUniform3uiv;
|
||||
using theBaseClass_t::glUniform4uiv;
|
||||
using theBaseClass_t::glTexParameterIiv;
|
||||
using theBaseClass_t::glTexParameterIuiv;
|
||||
using theBaseClass_t::glGetTexParameterIiv;
|
||||
using theBaseClass_t::glGetTexParameterIuiv;
|
||||
using theBaseClass_t::glClearBufferiv;
|
||||
using theBaseClass_t::glClearBufferuiv;
|
||||
using theBaseClass_t::glClearBufferfv;
|
||||
using theBaseClass_t::glClearBufferfi;
|
||||
using theBaseClass_t::glGetStringi;
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
// the following have been added only in OpenGL ES 3.2
|
||||
using theBaseClass_t::glColorMaski;
|
||||
using theBaseClass_t::glEnablei;
|
||||
using theBaseClass_t::glDisablei;
|
||||
using theBaseClass_t::glIsEnabledi;
|
||||
|
||||
using theBaseClass_t::glTexParameterIiv;
|
||||
using theBaseClass_t::glTexParameterIuiv;
|
||||
using theBaseClass_t::glGetTexParameterIiv;
|
||||
using theBaseClass_t::glGetTexParameterIuiv;
|
||||
#endif
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
// the following are defined only on desktop OpenGL
|
||||
using theBaseClass_t::glClampColor;
|
||||
using theBaseClass_t::glBeginConditionalRender;
|
||||
using theBaseClass_t::glEndConditionalRender;
|
||||
using theBaseClass_t::glBindFragDataLocation;
|
||||
using theBaseClass_t::glVertexAttribI1i;
|
||||
using theBaseClass_t::glVertexAttribI2i;
|
||||
using theBaseClass_t::glVertexAttribI3i;
|
||||
using theBaseClass_t::glVertexAttribI1ui;
|
||||
using theBaseClass_t::glVertexAttribI2ui;
|
||||
using theBaseClass_t::glVertexAttribI3ui;
|
||||
using theBaseClass_t::glVertexAttribI1iv;
|
||||
using theBaseClass_t::glVertexAttribI2iv;
|
||||
using theBaseClass_t::glVertexAttribI3iv;
|
||||
using theBaseClass_t::glVertexAttribI1uiv;
|
||||
using theBaseClass_t::glVertexAttribI2uiv;
|
||||
using theBaseClass_t::glVertexAttribI3uiv;
|
||||
using theBaseClass_t::glVertexAttribI4bv;
|
||||
using theBaseClass_t::glVertexAttribI4sv;
|
||||
using theBaseClass_t::glVertexAttribI4ubv;
|
||||
using theBaseClass_t::glVertexAttribI4usv;
|
||||
#endif
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
// the following functions from OpenGL 1.5 have been added only in OpenGL ES 3.0
|
||||
using theBaseClass_t::glGenQueries;
|
||||
using theBaseClass_t::glDeleteQueries;
|
||||
using theBaseClass_t::glIsQuery;
|
||||
using theBaseClass_t::glBeginQuery;
|
||||
using theBaseClass_t::glEndQuery;
|
||||
using theBaseClass_t::glGetQueryiv;
|
||||
using theBaseClass_t::glGetQueryObjectuiv;
|
||||
using theBaseClass_t::glUnmapBuffer;
|
||||
#endif
|
||||
};
|
||||
|
||||
//! OpenGL 3.0 core based on 2.1 version.
|
||||
|
@@ -23,17 +23,17 @@ template<typename theBaseClass_t>
|
||||
struct OpenGl_TmplCore31 : public theBaseClass_t
|
||||
{
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
|
||||
public: //! @name GL_ARB_uniform_buffer_object (added to OpenGL 3.1 core)
|
||||
|
||||
using theBaseClass_t::glGetUniformIndices;
|
||||
using theBaseClass_t::glGetActiveUniformsiv;
|
||||
using theBaseClass_t::glGetActiveUniformName;
|
||||
using theBaseClass_t::glGetUniformBlockIndex;
|
||||
using theBaseClass_t::glGetActiveUniformBlockiv;
|
||||
using theBaseClass_t::glGetActiveUniformBlockName;
|
||||
using theBaseClass_t::glUniformBlockBinding;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
using theBaseClass_t::glGetActiveUniformName; // undefined in OpenGL ES
|
||||
#endif
|
||||
|
||||
public: //! @name GL_ARB_copy_buffer (added to OpenGL 3.1 core)
|
||||
|
||||
@@ -43,9 +43,9 @@ public: //! @name OpenGL 3.1 additives to 3.0
|
||||
|
||||
using theBaseClass_t::glDrawArraysInstanced;
|
||||
using theBaseClass_t::glDrawElementsInstanced;
|
||||
using theBaseClass_t::glTexBuffer;
|
||||
using theBaseClass_t::glPrimitiveRestartIndex;
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
using theBaseClass_t::glTexBuffer; // added in OpenGL ES 3.2
|
||||
using theBaseClass_t::glPrimitiveRestartIndex; // undefined in OpenGL ES
|
||||
#endif
|
||||
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1020,7 +1020,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
|
||||
{
|
||||
if (const Handle(OpenGl_Texture)& aFirstTexture = aTextureSet->First())
|
||||
{
|
||||
aCtx->SetTextureMatrix (aFirstTexture->Sampler()->Parameters());
|
||||
aCtx->SetTextureMatrix (aFirstTexture->Sampler()->Parameters(), aFirstTexture->IsTopDown());
|
||||
}
|
||||
}
|
||||
aCtx->SetSampleAlphaToCoverage (aCtx->ShaderManager()->MaterialState().HasAlphaCutoff());
|
||||
|
@@ -105,7 +105,7 @@ Standard_Boolean OpenGl_Sampler::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
else if (!myIsImmutable)
|
||||
{
|
||||
applySamplerParams (theCtx, myParams, this, theTexture.GetTarget(), theTexture.HasMipmaps());
|
||||
applySamplerParams (theCtx, myParams, this, theTexture.GetTarget(), theTexture.MaxMipmapLevel());
|
||||
return Standard_True;
|
||||
}
|
||||
Release (theCtx.get());
|
||||
@@ -116,7 +116,7 @@ Standard_Boolean OpenGl_Sampler::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
applySamplerParams (theCtx, myParams, this, theTexture.GetTarget(), theTexture.HasMipmaps());
|
||||
applySamplerParams (theCtx, myParams, this, theTexture.GetTarget(), theTexture.MaxMipmapLevel());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureParams)& theParams,
|
||||
OpenGl_Sampler* theSampler,
|
||||
const GLenum theTarget,
|
||||
const bool theHasMipMaps)
|
||||
const Standard_Integer theMaxMipLevels)
|
||||
{
|
||||
if (theSampler != NULL && theSampler->Parameters() == theParams)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
// setup texture filtering
|
||||
const GLenum aFilter = (theParams->Filter() == Graphic3d_TOTF_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||
GLenum aFilterMin = aFilter;
|
||||
if (theHasMipMaps)
|
||||
if (theMaxMipLevels > 0)
|
||||
{
|
||||
aFilterMin = GL_NEAREST_MIPMAP_NEAREST;
|
||||
if (theParams->Filter() == Graphic3d_TOTF_BILINEAR)
|
||||
@@ -226,7 +226,10 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
if (theTarget == GL_TEXTURE_3D
|
||||
|| theTarget == GL_TEXTURE_CUBE_MAP)
|
||||
{
|
||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode);
|
||||
if (theCtx->HasTextureBaseLevel())
|
||||
{
|
||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -266,8 +269,9 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
if (theCtx->HasTextureBaseLevel()
|
||||
&& (theSampler == NULL || !theSampler->isValidSampler()))
|
||||
{
|
||||
const Standard_Integer aMaxLevel = Min (theMaxMipLevels, theParams->MaxLevel());
|
||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_BASE_LEVEL, theParams->BaseLevel());
|
||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL, theParams->MaxLevel());
|
||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL, aMaxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -129,13 +129,17 @@ protected:
|
||||
GLint theValue);
|
||||
|
||||
//! Apply sampler parameters.
|
||||
//! If Sampler Object is not NULL and valid resource, the parameters will be set to it (and it is not required Sampler Object being bound).
|
||||
//! Otherwise, parameters will be applied to currently bound Texture object.
|
||||
//! @param theCtx [in] active OpenGL context
|
||||
//! @param theParams [in] texture parameters to apply
|
||||
//! @param theSampler [in] apply parameters to Texture object (NULL)
|
||||
//! or to specified Sampler object (non-NULL, sampler is not required to be bound)
|
||||
//! @param theTarget [in] OpenGL texture target
|
||||
//! @param theMaxMipLevel [in] maximum mipmap level defined within the texture
|
||||
Standard_EXPORT static void applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureParams)& theParams,
|
||||
OpenGl_Sampler* theSampler,
|
||||
const GLenum theTarget,
|
||||
const bool theHasMipMaps);
|
||||
const Standard_Integer theMaxMipLevel);
|
||||
|
||||
//! Apply global texture state for deprecated OpenGL functionality.
|
||||
Standard_EXPORT static void applyGlobalTextureParams (const Handle(OpenGl_Context)& theCtx,
|
||||
|
@@ -58,10 +58,9 @@ namespace
|
||||
const char THE_VARY_TexCoord_Trsf[] =
|
||||
EOL" float aRotSin = occTextureTrsf_RotationSin();"
|
||||
EOL" float aRotCos = occTextureTrsf_RotationCos();"
|
||||
EOL" vec2 aTex2 = (occTexCoord.xy + occTextureTrsf_Translation()) * occTextureTrsf_Scale();"
|
||||
EOL" vec2 aCopy = aTex2;"
|
||||
EOL" aTex2.x = aCopy.x * aRotCos - aCopy.y * aRotSin;"
|
||||
EOL" aTex2.y = aCopy.x * aRotSin + aCopy.y * aRotCos;"
|
||||
EOL" vec2 aTex2 = vec2 (occTexCoord.x * aRotCos - occTexCoord.y * aRotSin,"
|
||||
EOL" occTexCoord.x * aRotSin + occTexCoord.y * aRotCos);"
|
||||
EOL" aTex2 = (aTex2 + occTextureTrsf_Translation()) * occTextureTrsf_Scale();"
|
||||
EOL" TexCoord = vec4(aTex2, occTexCoord.zw);";
|
||||
|
||||
//! Auxiliary function to flip gl_PointCoord vertically
|
||||
|
@@ -1056,18 +1056,25 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
|
||||
GLint theLocation,
|
||||
const OpenGl_Vec2u& theValue)
|
||||
{
|
||||
if (theCtx->core32 == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
if (myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
{
|
||||
return Standard_False;
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
theCtx->core32->glUniform2uiv (theLocation, 1, theValue.GetData());
|
||||
return Standard_True;
|
||||
if (theCtx->core32 != NULL)
|
||||
{
|
||||
theCtx->core32->glUniform2uiv (theLocation, 1, theValue.GetData());
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void )theValue;
|
||||
return Standard_False;
|
||||
if (theCtx->core30fwd != NULL)
|
||||
{
|
||||
theCtx->core30fwd->glUniform2uiv (theLocation, 1, theValue.GetData());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1091,19 +1098,25 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
|
||||
const GLsizei theCount,
|
||||
const OpenGl_Vec2u* theValue)
|
||||
{
|
||||
if (theCtx->core32 == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
if (myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
{
|
||||
return Standard_False;
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
theCtx->core32->glUniform2uiv (theLocation, theCount, theValue->GetData());
|
||||
return Standard_True;
|
||||
if (theCtx->core32 != NULL)
|
||||
{
|
||||
theCtx->core32->glUniform2uiv (theLocation, theCount, theValue->GetData());
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void )theCount;
|
||||
(void )theValue;
|
||||
return Standard_False;
|
||||
if (theCtx->core30fwd != NULL)
|
||||
{
|
||||
theCtx->core30fwd->glUniform2uiv (theLocation, theCount, theValue->GetData());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -21,10 +21,15 @@
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <Standard_Assert.hxx>
|
||||
#include <Image_CompressedPixMap.hxx>
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Texture, OpenGl_NamedResource)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
//! Simple class to reset unpack alignment settings
|
||||
struct OpenGl_UnpackAlignmentSentry
|
||||
{
|
||||
@@ -47,6 +52,43 @@ struct OpenGl_UnpackAlignmentSentry
|
||||
|
||||
};
|
||||
|
||||
//! Compute the upper mipmap level for complete mipmap set (e.g. till the 1x1 level).
|
||||
static Standard_Integer computeUpperMipMapLevel (Standard_Integer theSize)
|
||||
{
|
||||
for (Standard_Integer aMipIter = 0;; ++aMipIter, theSize /= 2)
|
||||
{
|
||||
if (theSize <= 1)
|
||||
{
|
||||
return aMipIter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Compute the upper mipmap level for complete mipmap set (e.g. till the 1x1 level).
|
||||
static Standard_Integer computeUpperMipMapLevel (Standard_Integer theSizeX, Standard_Integer theSizeY)
|
||||
{
|
||||
return computeUpperMipMapLevel (Max (theSizeX, theSizeY));
|
||||
}
|
||||
|
||||
//! Compute size of the smallest defined mipmap level (for verbose messages).
|
||||
static Graphic3d_Vec2i computeSmallestMipMapSize (const Graphic3d_Vec2i& theBaseSize, Standard_Integer theMaxLevel)
|
||||
{
|
||||
Graphic3d_Vec2i aMipSizeXY = theBaseSize;
|
||||
for (Standard_Integer aMipIter = 0;; ++aMipIter)
|
||||
{
|
||||
if (aMipIter > theMaxLevel)
|
||||
{
|
||||
return aMipSizeXY;
|
||||
}
|
||||
|
||||
aMipSizeXY /= 2;
|
||||
if (aMipSizeXY.x() == 0) { aMipSizeXY.x() = 1; }
|
||||
if (aMipSizeXY.y() == 0) { aMipSizeXY.y() = 1; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_Texture
|
||||
// purpose :
|
||||
@@ -64,8 +106,9 @@ OpenGl_Texture::OpenGl_Texture (const TCollection_AsciiString& theResourceId,
|
||||
myTextFormat (GL_RGBA),
|
||||
mySizedFormat(GL_RGBA8),
|
||||
myNbSamples (1),
|
||||
myHasMipmaps (Standard_False),
|
||||
myIsAlpha (false)
|
||||
myMaxMipLevel(0),
|
||||
myIsAlpha (false),
|
||||
myIsTopDown (true)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -130,10 +173,10 @@ void OpenGl_Texture::Release (OpenGl_Context* theGlCtx)
|
||||
// =======================================================================
|
||||
void OpenGl_Texture::applyDefaultSamplerParams (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
OpenGl_Sampler::applySamplerParams (theCtx, mySampler->Parameters(), NULL, myTarget, myHasMipmaps);
|
||||
OpenGl_Sampler::applySamplerParams (theCtx, mySampler->Parameters(), NULL, myTarget, myMaxMipLevel);
|
||||
if (mySampler->IsValid() && !mySampler->IsImmutable())
|
||||
{
|
||||
OpenGl_Sampler::applySamplerParams (theCtx, mySampler->Parameters(), mySampler.get(), myTarget, myHasMipmaps);
|
||||
OpenGl_Sampler::applySamplerParams (theCtx, mySampler->Parameters(), mySampler.get(), myTarget, myMaxMipLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,11 +246,10 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
#else
|
||||
const GLenum aTarget = GL_TEXTURE_2D;
|
||||
#endif
|
||||
const Standard_Boolean toCreateMipMaps = (theType == Graphic3d_TOT_2D_MIPMAP);
|
||||
const bool toPatchExisting = IsValid()
|
||||
&& myTextFormat == theFormat.PixelFormat()
|
||||
&& myTarget == aTarget
|
||||
&& myHasMipmaps == toCreateMipMaps
|
||||
&& HasMipmaps() == (theType == Graphic3d_TOT_2D_MIPMAP)
|
||||
&& mySizeX == theSizeXY.x()
|
||||
&& (mySizeY == theSizeXY.y() || theType == Graphic3d_TOT_1D);
|
||||
if (!Create (theCtx))
|
||||
@@ -220,16 +262,19 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
{
|
||||
myIsAlpha = theImage->Format() == Image_Format_Alpha
|
||||
|| theImage->Format() == Image_Format_AlphaF;
|
||||
myIsTopDown = theImage->IsTopDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
myIsAlpha = theFormat.PixelFormat() == GL_ALPHA;
|
||||
}
|
||||
|
||||
myHasMipmaps = toCreateMipMaps;
|
||||
myTextFormat = theFormat.PixelFormat();
|
||||
mySizedFormat = theFormat.InternalFormat();
|
||||
myNbSamples = 1;
|
||||
myMaxMipLevel = theType == Graphic3d_TOT_2D_MIPMAP && theCtx->arbFBO != NULL
|
||||
? computeUpperMipMapLevel (theSizeXY.x(), theSizeXY.y())
|
||||
: 0;
|
||||
myTextFormat = theFormat.PixelFormat();
|
||||
mySizedFormat = theFormat.InternalFormat();
|
||||
myNbSamples = 1;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
const GLint anIntFormat = theFormat.InternalFormat();
|
||||
#else
|
||||
@@ -294,8 +339,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
#endif
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
GLint aTestWidth = 0;
|
||||
GLint aTestHeight = 0;
|
||||
GLint aTestWidth = 0, aTestHeight = 0;
|
||||
#endif
|
||||
GLvoid* aDataPtr = (theImage != NULL) ? (GLvoid* )theImage->Data() : NULL;
|
||||
|
||||
@@ -369,58 +413,6 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
#endif
|
||||
}
|
||||
case Graphic3d_TOT_2D:
|
||||
{
|
||||
Bind (theCtx);
|
||||
applyDefaultSamplerParams (theCtx);
|
||||
if (toPatchExisting)
|
||||
{
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
0, 0,
|
||||
theSizeXY.x(), theSizeXY.y(),
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
// use proxy to check texture could be created or not
|
||||
glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
|
||||
theSizeXY.x(), theSizeXY.y(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), NULL);
|
||||
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
|
||||
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
|
||||
glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
|
||||
if (aTestWidth == 0 || aTestHeight == 0)
|
||||
{
|
||||
// no memory or broken input parameters
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
|
||||
theSizeXY.x(), theSizeXY.y(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
const GLenum anErr = glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||
+ " IF: " + int(anIntFormat) + " PF: " + int(theFormat.PixelFormat())
|
||||
+ " DT: " + int(theFormat.DataType())
|
||||
+ " can not be created with error " + int(anErr) + ".");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = theSizeXY.x();
|
||||
mySizeY = theSizeXY.y();
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
case Graphic3d_TOT_2D_MIPMAP:
|
||||
{
|
||||
Bind (theCtx);
|
||||
@@ -431,15 +423,14 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
0, 0,
|
||||
theSizeXY.x(), theSizeXY.y(),
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
if (theCtx->arbFBO != NULL)
|
||||
|
||||
if (myMaxMipLevel > 0)
|
||||
{
|
||||
// generate mipmaps
|
||||
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
myMaxMipLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,18 +455,17 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
#endif
|
||||
|
||||
// upload main picture
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
|
||||
theSizeXY.x(), theSizeXY.y(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), theImage->Data());
|
||||
const GLenum aTexImgErr = glGetError();
|
||||
if (aTexImgErr != GL_NO_ERROR)
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
GLenum anErr = glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||
+ " IF: " + int(anIntFormat) + " PF: " + int(theFormat.PixelFormat())
|
||||
+ " DT: " + int(theFormat.DataType())
|
||||
+ " can not be created with error " + int(aTexImgErr) + ".");
|
||||
+ " IF: " + int(anIntFormat) + " PF: " + int(theFormat.PixelFormat())
|
||||
+ " DT: " + int(theFormat.DataType())
|
||||
+ " can not be created with error " + int(anErr) + ".");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
@@ -484,27 +474,19 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
mySizeX = theSizeXY.x();
|
||||
mySizeY = theSizeXY.y();
|
||||
|
||||
if (theCtx->arbFBO != NULL)
|
||||
if (myMaxMipLevel > 0)
|
||||
{
|
||||
// generate mipmaps
|
||||
//glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
anErr = glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
myMaxMipLevel = 0;
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Warning: generating mipmaps requires GL_ARB_framebuffer_object extension which is missing.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Warning: generating mipmaps requires GL_ARB_framebuffer_object extension which is missing.");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
@@ -568,7 +550,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
default:
|
||||
{
|
||||
Handle(Image_PixMap) anImage = theTextureMap->GetImage();
|
||||
if (theCtx->SupportedTextureFormats()->HasCompressed()
|
||||
&& !theCtx->caps->compressedTexturesDisable)
|
||||
{
|
||||
if (Handle(Image_CompressedPixMap) aCompressed = theTextureMap->GetCompressedImage (theCtx->SupportedTextureFormats()))
|
||||
{
|
||||
return InitCompressed (theCtx, *aCompressed, theTextureMap->IsColorMap());
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Image_PixMap) anImage = theTextureMap->GetImage (theCtx->SupportedTextureFormats());
|
||||
if (anImage.IsNull())
|
||||
{
|
||||
return false;
|
||||
@@ -578,6 +569,106 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitCompressed
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_Texture::InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
||||
const Image_CompressedPixMap& theImage,
|
||||
const Standard_Boolean theIsColorMap)
|
||||
{
|
||||
if (theImage.SizeX() < 1
|
||||
|| theImage.SizeY() < 1
|
||||
|| theImage.FaceData().IsNull())
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Error: texture of 0 size cannot be created.");
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
if (theImage.SizeX() > theCtx->MaxTextureSize()
|
||||
|| theImage.SizeY() > theCtx->MaxTextureSize())
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: Texture dimension - ") + theImage.SizeX() + "x" + theImage.SizeY()
|
||||
+ " exceeds hardware limits (" + theCtx->MaxTextureSize() + "x" + theCtx->MaxTextureSize() + ")");
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindCompressedFormat (theCtx, theImage.CompressedFormat(), theIsColorMap);
|
||||
if (!aFormat.IsValid())
|
||||
{
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Create (theCtx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myTarget = GL_TEXTURE_2D;
|
||||
myNbSamples = 1;
|
||||
myTextFormat = aFormat.Format();
|
||||
mySizedFormat = aFormat.Internal();
|
||||
myIsTopDown = theImage.IsTopDown();
|
||||
mySizeX = theImage.SizeX();
|
||||
mySizeY = theImage.SizeY();
|
||||
myMaxMipLevel = Max (theImage.MipMaps().Size() - 1, 0);
|
||||
if (myMaxMipLevel > 0
|
||||
&& !theImage.IsCompleteMipMapSet())
|
||||
{
|
||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (Graphic3d_Vec2i (mySizeX, mySizeY), myMaxMipLevel);
|
||||
if (!theCtx->HasTextureBaseLevel())
|
||||
{
|
||||
myMaxMipLevel = 0;
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_MEDIUM,
|
||||
TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySizeX + "x" + mySizeY
|
||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y() + "; mipmaps will be ignored");
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendTrace (TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySizeX + "x" + mySizeY
|
||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y());
|
||||
}
|
||||
}
|
||||
|
||||
Bind (theCtx);
|
||||
applyDefaultSamplerParams (theCtx);
|
||||
|
||||
// setup the alignment
|
||||
OpenGl_UnpackAlignmentSentry::Reset();
|
||||
|
||||
Graphic3d_Vec2i aMipSizeXY (theImage.SizeX(), theImage.SizeY());
|
||||
const Standard_Byte* aData = theImage.FaceData()->Data();
|
||||
for (Standard_Integer aMipIter = 0; aMipIter <= myMaxMipLevel; ++aMipIter)
|
||||
{
|
||||
const Standard_Integer aMipLength = theImage.MipMaps().Value (aMipIter);
|
||||
theCtx->Functions()->glCompressedTexImage2D (GL_TEXTURE_2D, aMipIter, mySizedFormat, aMipSizeXY.x(), aMipSizeXY.y(), 0, aMipLength, aData);
|
||||
const GLenum aTexImgErr = glGetError();
|
||||
if (aTexImgErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: 2D compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
|
||||
+ " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat())
|
||||
+ " DT: " + int(aFormat.DataType())
|
||||
+ " can not be created with error " + int(aTexImgErr) + ".");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
aData += aMipLength;
|
||||
aMipSizeXY /= 2;
|
||||
if (aMipSizeXY.x() == 0) { aMipSizeXY.x() = 1; }
|
||||
if (aMipSizeXY.y() == 0) { aMipSizeXY.y() = 1; }
|
||||
}
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init2DMultisample
|
||||
// purpose :
|
||||
@@ -597,7 +688,7 @@ bool OpenGl_Texture::Init2DMultisample (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
myNbSamples = OpenGl_Context::GetPowerOfTwo (theNbSamples, theCtx->MaxMsaaSamples());
|
||||
myTarget = GL_TEXTURE_2D_MULTISAMPLE;
|
||||
myHasMipmaps = false;
|
||||
myMaxMipLevel = 0;
|
||||
if(theSizeX > theCtx->MaxTextureSize()
|
||||
|| theSizeY > theCtx->MaxTextureSize())
|
||||
{
|
||||
@@ -649,7 +740,7 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myTarget = GL_TEXTURE_RECTANGLE;
|
||||
myNbSamples = 1;
|
||||
myHasMipmaps = false;
|
||||
myMaxMipLevel = 0;
|
||||
|
||||
const GLsizei aSizeX = Min (theCtx->MaxTextureSize(), theSizeX);
|
||||
const GLsizei aSizeY = Min (theCtx->MaxTextureSize(), theSizeY);
|
||||
@@ -726,7 +817,7 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
myTarget = GL_TEXTURE_3D;
|
||||
myNbSamples = 1;
|
||||
myHasMipmaps = false;
|
||||
myMaxMipLevel = 0;
|
||||
|
||||
const Graphic3d_Vec3i aSizeXYZ = theSizeXYZ.cwiseMin (Graphic3d_Vec3i (theCtx->MaxTextureSize()));
|
||||
if (aSizeXYZ != theSizeXYZ)
|
||||
@@ -809,24 +900,80 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle(Image_PixMap) anImage;
|
||||
Handle(Image_CompressedPixMap) aCompImage;
|
||||
OpenGl_TextureFormat aFormat;
|
||||
if (!theCubeMap.IsNull())
|
||||
{
|
||||
theToGenMipmap = theCubeMap->HasMipmaps();
|
||||
if (Handle(Image_PixMap) anImage = theCubeMap->Reset().Value())
|
||||
theCubeMap->Reset();
|
||||
if (theCtx->SupportedTextureFormats()->HasCompressed()
|
||||
&& !theCtx->caps->compressedTexturesDisable)
|
||||
{
|
||||
aCompImage = theCubeMap->CompressedValue (theCtx->SupportedTextureFormats());
|
||||
}
|
||||
if (!aCompImage.IsNull())
|
||||
{
|
||||
aFormat = OpenGl_TextureFormat::FindCompressedFormat (theCtx, aCompImage->CompressedFormat(), theIsColorMap);
|
||||
if (aFormat.IsValid())
|
||||
{
|
||||
theToGenMipmap = false;
|
||||
theSize = aCompImage->SizeX();
|
||||
theFormat = aCompImage->BaseFormat();
|
||||
myMaxMipLevel = Max (aCompImage->MipMaps().Size() - 1, 0);
|
||||
if (myMaxMipLevel > 0
|
||||
&& !aCompImage->IsCompleteMipMapSet())
|
||||
{
|
||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (Graphic3d_Vec2i (aCompImage->SizeX(), aCompImage->SizeY()), myMaxMipLevel);
|
||||
if (!theCtx->HasTextureBaseLevel())
|
||||
{
|
||||
myMaxMipLevel = 0;
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_MEDIUM,
|
||||
TCollection_AsciiString ("Warning: Cubemap compressed texture ") + theCubeMap->GetId() + " " + aCompImage->SizeX() + "x" + aCompImage->SizeX()
|
||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y() + "; mipmaps will be ignored");
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendTrace (TCollection_AsciiString ("Warning: Cubemap compressed texture ") + theCubeMap->GetId() + " " + aCompImage->SizeX() + "x" + aCompImage->SizeX()
|
||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y());
|
||||
}
|
||||
}
|
||||
|
||||
OpenGl_UnpackAlignmentSentry::Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
aCompImage.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
if (!aFormat.IsValid())
|
||||
{
|
||||
anImage = theCubeMap->Reset().Value (theCtx->SupportedTextureFormats());
|
||||
if (anImage.IsNull())
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Unable to get the first side of cubemap");
|
||||
Release(theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
theSize = anImage->SizeX();
|
||||
theFormat = anImage->Format();
|
||||
theToGenMipmap = theCubeMap->HasMipmaps();
|
||||
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Unable to get the first side of cubemap");
|
||||
Release(theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
myIsTopDown = theCubeMap->IsTopDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||
}
|
||||
|
||||
OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindFormat (theCtx, theFormat, theIsColorMap);
|
||||
if (!aFormat.IsValid())
|
||||
{
|
||||
aFormat = OpenGl_TextureFormat::FindFormat (theCtx, theFormat, theIsColorMap);
|
||||
}
|
||||
if (!aFormat.IsValid())
|
||||
{
|
||||
Unbind(theCtx);
|
||||
@@ -835,21 +982,69 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
|
||||
myTarget = GL_TEXTURE_CUBE_MAP;
|
||||
myHasMipmaps = theToGenMipmap;
|
||||
myNbSamples = 1;
|
||||
mySizeX = (GLsizei )theSize;
|
||||
mySizeY = (GLsizei )theSize;
|
||||
myTextFormat = aFormat.Format();
|
||||
mySizedFormat = aFormat.Internal();
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
const GLint anIntFormat = aFormat.InternalFormat();
|
||||
#else
|
||||
// ES 2.0 does not support sized formats and format conversions - them detected from data type
|
||||
const GLint anIntFormat = theCtx->IsGlGreaterEqual (3, 0) ? aFormat.InternalFormat() : aFormat.PixelFormat();
|
||||
#endif
|
||||
|
||||
Bind (theCtx);
|
||||
applyDefaultSamplerParams (theCtx);
|
||||
|
||||
for (Standard_Integer i = 0; i < 6; ++i)
|
||||
{
|
||||
const void* aData = NULL;
|
||||
Handle(Image_PixMap) anImage;
|
||||
const Standard_Byte* aData = NULL;
|
||||
|
||||
if (!theCubeMap.IsNull())
|
||||
{
|
||||
anImage = theCubeMap->Value();
|
||||
if (i != 0)
|
||||
{
|
||||
if (!aCompImage.IsNull())
|
||||
{
|
||||
aCompImage = theCubeMap->CompressedValue (theCtx->SupportedTextureFormats());
|
||||
}
|
||||
else
|
||||
{
|
||||
anImage = theCubeMap->Value (theCtx->SupportedTextureFormats());
|
||||
}
|
||||
}
|
||||
if (!aCompImage.IsNull())
|
||||
{
|
||||
Graphic3d_Vec2i aMipSizeXY (mySizeX, mySizeY);
|
||||
aData = aCompImage->FaceData()->Data();
|
||||
for (Standard_Integer aMipIter = 0; aMipIter <= myMaxMipLevel; ++aMipIter)
|
||||
{
|
||||
const Standard_Integer aMipLength = aCompImage->MipMaps().Value (aMipIter);
|
||||
theCtx->Functions()->glCompressedTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, aMipIter, mySizedFormat, aMipSizeXY.x(), aMipSizeXY.y(), 0, aMipLength, aData);
|
||||
const GLenum aTexImgErr = glGetError();
|
||||
if (aTexImgErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: cubemap compressed texture ") + aMipSizeXY.x() + "x" + aMipSizeXY.y()
|
||||
+ " IF: " + int(aFormat.Internal()) + " PF: " + int(aFormat.PixelFormat())
|
||||
+ " DT: " + int(aFormat.DataType())
|
||||
+ " can not be created with error " + int(aTexImgErr) + ".");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
aData += aMipLength;
|
||||
aMipSizeXY /= 2;
|
||||
if (aMipSizeXY.x() == 0) { aMipSizeXY.x() = 1; }
|
||||
if (aMipSizeXY.y() == 0) { aMipSizeXY.y() = 1; }
|
||||
}
|
||||
|
||||
theCubeMap->Next();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!anImage.IsNull())
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
@@ -892,7 +1087,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
|
||||
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
|
||||
aFormat.InternalFormat(),
|
||||
anIntFormat,
|
||||
GLsizei(theSize), GLsizei(theSize),
|
||||
0, aFormat.PixelFormat(), aFormat.DataType(),
|
||||
aData);
|
||||
@@ -970,8 +1165,18 @@ Standard_Size OpenGl_Texture::PixelSizeOfPixelFormat (Standard_Integer theIntern
|
||||
case GL_DEPTH_COMPONENT16: return 2;
|
||||
case GL_DEPTH_COMPONENT24: return 3;
|
||||
case GL_DEPTH_COMPONENT32F: return 4;
|
||||
// compressed
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // DXT1 uses circa half a byte per pixel (64 bits per 4x4 block)
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: // DXT3/5 uses circa 1 byte per pixel (128 bits per 4x4 block)
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -998,7 +1203,7 @@ Standard_Size OpenGl_Texture::EstimatedDataSize() const
|
||||
{
|
||||
aSize *= 6; // cube sides
|
||||
}
|
||||
if (myHasMipmaps)
|
||||
if (myMaxMipLevel > 0)
|
||||
{
|
||||
aSize = aSize + aSize / 3;
|
||||
}
|
||||
|
@@ -72,10 +72,17 @@ public:
|
||||
//! Return true for GL_RED and GL_ALPHA formats.
|
||||
bool IsAlpha() const { return myIsAlpha; }
|
||||
|
||||
//! Setup to interprete the format as Alpha by Shader Manager
|
||||
//! Setup to interpret the format as Alpha by Shader Manager
|
||||
//! (should be GL_ALPHA within compatible context or GL_RED otherwise).
|
||||
void SetAlpha (const bool theValue) { myIsAlpha = theValue; }
|
||||
|
||||
//! Return if 2D surface is defined top-down (TRUE) or bottom-up (FALSE).
|
||||
//! Normally set from Image_PixMap::IsTopDown() within texture initialization.
|
||||
bool IsTopDown() const { return myIsTopDown; }
|
||||
|
||||
//! Set if 2D surface is defined top-down (TRUE) or bottom-up (FALSE).
|
||||
void SetTopDown (bool theIsTopDown) { myIsTopDown = theIsTopDown; }
|
||||
|
||||
//! Creates Texture id if not yet generated.
|
||||
//! Data should be initialized by another method.
|
||||
Standard_EXPORT bool Create (const Handle(OpenGl_Context)& theCtx);
|
||||
@@ -144,6 +151,11 @@ public:
|
||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureMap)& theTextureMap);
|
||||
|
||||
//! Initialize the texture with Image_CompressedPixMap.
|
||||
Standard_EXPORT bool InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
||||
const Image_CompressedPixMap& theImage,
|
||||
const Standard_Boolean theIsColorMap);
|
||||
|
||||
//! Initialize the 2D multisampling texture using glTexImage2DMultisample().
|
||||
Standard_EXPORT bool Init2DMultisample (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLsizei theNbSamples,
|
||||
@@ -165,7 +177,10 @@ public:
|
||||
const void* thePixels);
|
||||
|
||||
//! @return true if texture was generated within mipmaps
|
||||
Standard_Boolean HasMipmaps() const { return myHasMipmaps; }
|
||||
Standard_Boolean HasMipmaps() const { return myMaxMipLevel > 0; }
|
||||
|
||||
//! Return upper mipmap level index (0 means no mipmaps).
|
||||
Standard_Integer MaxMipmapLevel() const { return myMaxMipLevel; }
|
||||
|
||||
//! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
|
||||
Standard_EXPORT virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE;
|
||||
@@ -278,8 +293,9 @@ protected:
|
||||
GLenum myTextFormat; //!< texture format - GL_RGB, GL_RGBA,...
|
||||
GLint mySizedFormat;//!< internal (sized) texture format
|
||||
Standard_Integer myNbSamples; //!< number of MSAA samples
|
||||
Standard_Boolean myHasMipmaps; //!< flag indicates that texture was uploaded with mipmaps
|
||||
Standard_Integer myMaxMipLevel;//!< upper mipmap level index (0 means no mipmaps)
|
||||
bool myIsAlpha; //!< indicates alpha format
|
||||
bool myIsTopDown; //!< indicates if 2D surface is defined top-down (TRUE) or bottom-up (FALSE)
|
||||
|
||||
};
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <OpenGl_TextureFormat.hxx>
|
||||
|
||||
#include <Image_SupportedFormats.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
|
||||
// =======================================================================
|
||||
@@ -157,7 +158,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
|
||||
return OpenGl_TextureFormat();
|
||||
}
|
||||
aFormat.SetNbComponents (4);
|
||||
aFormat.SetInternalFormat (GL_BGRA_EXT);
|
||||
aFormat.SetInternalFormat (GL_BGRA_EXT);
|
||||
#endif
|
||||
aFormat.SetPixelFormat (GL_BGRA_EXT); // equals to GL_BGRA
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
@@ -449,3 +450,79 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindSizedFormat (const Handle(OpenGl_
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : FindCompressedFormat
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_TextureFormat OpenGl_TextureFormat::FindCompressedFormat (const Handle(OpenGl_Context)& theCtx,
|
||||
Image_CompressedFormat theFormat,
|
||||
bool theIsColorMap)
|
||||
{
|
||||
OpenGl_TextureFormat aFormat;
|
||||
if (!theCtx->SupportedTextureFormats()->IsSupported (theFormat))
|
||||
{
|
||||
return aFormat;
|
||||
}
|
||||
|
||||
switch (theFormat)
|
||||
{
|
||||
case Image_CompressedFormat_UNKNOWN:
|
||||
{
|
||||
return aFormat;
|
||||
}
|
||||
case Image_CompressedFormat_RGB_S3TC_DXT1:
|
||||
{
|
||||
aFormat.SetNbComponents (3);
|
||||
aFormat.SetPixelFormat (GL_RGB);
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
|
||||
if (theIsColorMap
|
||||
&& theCtx->ToRenderSRGB())
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_SRGB_S3TC_DXT1_EXT);
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
case Image_CompressedFormat_RGBA_S3TC_DXT1:
|
||||
{
|
||||
aFormat.SetNbComponents (4);
|
||||
aFormat.SetPixelFormat (GL_RGBA);
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
|
||||
if (theIsColorMap
|
||||
&& theCtx->ToRenderSRGB())
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT);
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
case Image_CompressedFormat_RGBA_S3TC_DXT3:
|
||||
{
|
||||
aFormat.SetNbComponents (4);
|
||||
aFormat.SetPixelFormat (GL_RGBA);
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT);
|
||||
if (theIsColorMap
|
||||
&& theCtx->ToRenderSRGB())
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT);
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
case Image_CompressedFormat_RGBA_S3TC_DXT5:
|
||||
{
|
||||
aFormat.SetNbComponents (4);
|
||||
aFormat.SetPixelFormat (GL_RGBA);
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
|
||||
if (theIsColorMap
|
||||
&& theCtx->ToRenderSRGB())
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT);
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#ifndef _OpenGl_TextureFormat_HeaderFile
|
||||
#define _OpenGl_TextureFormat_HeaderFile
|
||||
|
||||
#include <Image_CompressedFormat.hxx>
|
||||
#include <Image_Format.hxx>
|
||||
#include <OpenGl_GlCore13.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
@@ -47,6 +48,14 @@ public:
|
||||
Standard_EXPORT static OpenGl_TextureFormat FindSizedFormat (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theSizedFormat);
|
||||
|
||||
//! Find texture format suitable to specified compressed texture format.
|
||||
//! @param theCtx [in] OpenGL context defining supported texture formats
|
||||
//! @param theFormat [in] compressed texture format
|
||||
//! @return found format or invalid format
|
||||
Standard_EXPORT static OpenGl_TextureFormat FindCompressedFormat (const Handle(OpenGl_Context)& theCtx,
|
||||
Image_CompressedFormat theFormat,
|
||||
bool theIsColorMap);
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor (invalid texture format).
|
||||
|
@@ -160,6 +160,33 @@ bool OpenGl_VertexBuffer::subData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
return isDone;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getSubData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_VertexBuffer::getSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
void* theData,
|
||||
const GLenum theDataType)
|
||||
{
|
||||
if (!IsValid() || myDataType != theDataType
|
||||
|| theElemFrom < 0 || ((theElemFrom + theElemsNb) > myElemsNb)
|
||||
|| !theGlCtx->hasGetBufferData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Bind (theGlCtx);
|
||||
const size_t aDataSize = sizeOfGlType (theDataType);
|
||||
const GLintptr anOffset = GLintptr (theElemFrom) * GLintptr (myComponentsNb) * aDataSize;
|
||||
const GLsizeiptr aSize = GLsizeiptr(theElemsNb) * GLsizeiptr(myComponentsNb) * aDataSize;
|
||||
bool isDone = theGlCtx->GetBufferSubData (GetTarget(), anOffset, aSize, theData);
|
||||
isDone = isDone && (glGetError() == GL_NO_ERROR);
|
||||
Unbind (theGlCtx);
|
||||
return isDone;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BindVertexAttrib
|
||||
// purpose :
|
||||
|
@@ -154,6 +154,20 @@ public:
|
||||
return subData (theGlCtx, theElemFrom, theElemsNb, theData, GL_FLOAT);
|
||||
}
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function reads portion of data from this VBO using glGetBufferSubData().
|
||||
//! @param theElemFrom [in] element id from which replace buffer data (>=0);
|
||||
//! @param theElemsNb [in] elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||
//! @param theData [out] destination pointer to GLfloat data.
|
||||
bool GetSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
GLfloat* theData)
|
||||
{
|
||||
return getSubData (theGlCtx, theElemFrom, theElemsNb, theData, GL_FLOAT);
|
||||
}
|
||||
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function replaces portion of data within this VBO using glBufferSubData().
|
||||
//! The VBO should be initialized before call.
|
||||
@@ -168,6 +182,20 @@ public:
|
||||
return subData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_INT);
|
||||
}
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function reads portion of data from this VBO using glGetBufferSubData().
|
||||
//! @param theElemFrom [in] element id from which replace buffer data (>=0);
|
||||
//! @param theElemsNb [in] elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||
//! @param theData [out] destination pointer to GLuint data.
|
||||
bool GetSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
GLuint* theData)
|
||||
{
|
||||
return getSubData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_INT);
|
||||
}
|
||||
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function replaces portion of data within this VBO using glBufferSubData().
|
||||
//! The VBO should be initialized before call.
|
||||
@@ -182,6 +210,20 @@ public:
|
||||
return subData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_SHORT);
|
||||
}
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function reads portion of data from this VBO using glGetBufferSubData().
|
||||
//! @param theElemFrom [in] element id from which replace buffer data (>=0);
|
||||
//! @param theElemsNb [in] elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||
//! @param theData [out] destination pointer to GLushort data.
|
||||
bool GetSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
GLushort* theData)
|
||||
{
|
||||
return getSubData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_SHORT);
|
||||
}
|
||||
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function replaces portion of data within this VBO using glBufferSubData().
|
||||
//! The VBO should be initialized before call.
|
||||
@@ -196,6 +238,20 @@ public:
|
||||
return subData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
//! Notice that VBO will be unbound after this call.
|
||||
//! Function reads portion of data from this VBO using glGetBufferSubData().
|
||||
//! @param theElemFrom [in] element id from which replace buffer data (>=0);
|
||||
//! @param theElemsNb [in] elements count (theElemFrom + theElemsNb <= GetElemsNb());
|
||||
//! @param theData [out] destination pointer to GLubyte data.
|
||||
bool GetSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
GLubyte* theData)
|
||||
{
|
||||
return getSubData (theGlCtx, theElemFrom, theElemsNb, theData, GL_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
//! Bind this VBO to active GLSL program.
|
||||
Standard_EXPORT void BindVertexAttrib (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLuint theAttribLoc) const;
|
||||
@@ -286,6 +342,13 @@ public: //! @name advanced methods
|
||||
const void* theData,
|
||||
const GLenum theDataType);
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
Standard_EXPORT virtual bool getSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
void* theData,
|
||||
const GLenum theDataType);
|
||||
|
||||
//! Setup array pointer - either for active GLSL program OpenGl_Context::ActiveProgram()
|
||||
//! or for FFP using bindFixed() when no program bound.
|
||||
static void bindAttribute (const Handle(OpenGl_Context)& theGlCtx,
|
||||
|
@@ -175,3 +175,27 @@ bool OpenGl_VertexBufferCompat::subData (const Handle(OpenGl_Context)& ,
|
||||
memcpy (myData->ChangeData() + anOffset, theData, aNbBytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getSubData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_VertexBufferCompat::getSubData (const Handle(OpenGl_Context)& ,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
void* theData,
|
||||
const GLenum theDataType)
|
||||
{
|
||||
if (!IsValid() || myDataType != theDataType
|
||||
|| theElemFrom < 0 || ((theElemFrom + theElemsNb) > myElemsNb)
|
||||
|| theData == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t aDataSize = sizeOfGlType (theDataType);
|
||||
const size_t anOffset = size_t(theElemFrom) * size_t(myComponentsNb) * aDataSize;
|
||||
const size_t aNbBytes = size_t(theElemsNb) * size_t(myComponentsNb) * aDataSize;
|
||||
memcpy (theData, myData->Data() + anOffset, aNbBytes);
|
||||
return true;
|
||||
}
|
||||
|
@@ -82,6 +82,13 @@ public: //! @name advanced methods
|
||||
const void* theData,
|
||||
const GLenum theDataType) Standard_OVERRIDE;
|
||||
|
||||
//! Read back buffer sub-range.
|
||||
Standard_EXPORT virtual bool getSubData (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theElemFrom,
|
||||
const GLsizei theElemsNb,
|
||||
void* theData,
|
||||
const GLenum theDataType) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(NCollection_Buffer) myData; //!< buffer data
|
||||
|
@@ -282,7 +282,7 @@ void OpenGl_View::initTextureEnv (const Handle(OpenGl_Context)& theContext)
|
||||
}
|
||||
|
||||
Handle(OpenGl_Texture) aTextureEnv = new OpenGl_Texture (myTextureEnvData->GetId(), myTextureEnvData->GetParams());
|
||||
if (Handle(Image_PixMap) anImage = myTextureEnvData->GetImage())
|
||||
if (Handle(Image_PixMap) anImage = myTextureEnvData->GetImage (theContext->SupportedTextureFormats()))
|
||||
{
|
||||
aTextureEnv->Init (theContext, *anImage, myTextureEnvData->Type(), true);
|
||||
}
|
||||
|
@@ -532,8 +532,12 @@
|
||||
#include <RWStepVisual_RWSurfaceStyleControlGrid.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleFillArea.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleParameterLine.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleRendering.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleSegmentationCurve.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleSilhouette.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleTransparent.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleUsage.hxx>
|
||||
#include <RWStepVisual_RWTemplate.hxx>
|
||||
#include <RWStepVisual_RWTemplateInstance.hxx>
|
||||
@@ -1084,8 +1088,12 @@
|
||||
#include <StepVisual_SurfaceStyleControlGrid.hxx>
|
||||
#include <StepVisual_SurfaceStyleFillArea.hxx>
|
||||
#include <StepVisual_SurfaceStyleParameterLine.hxx>
|
||||
#include <StepVisual_SurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <StepVisual_SurfaceStyleRendering.hxx>
|
||||
#include <StepVisual_SurfaceStyleRenderingWithProperties.hxx>
|
||||
#include <StepVisual_SurfaceStyleSegmentationCurve.hxx>
|
||||
#include <StepVisual_SurfaceStyleSilhouette.hxx>
|
||||
#include <StepVisual_SurfaceStyleTransparent.hxx>
|
||||
#include <StepVisual_SurfaceStyleUsage.hxx>
|
||||
#include <StepVisual_Template.hxx>
|
||||
#include <StepVisual_TemplateInstance.hxx>
|
||||
@@ -5156,6 +5164,34 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 720:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleTransparent tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 721:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 722:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRendering tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 723:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRenderingWithProperties tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
default : break;
|
||||
}
|
||||
@@ -7169,8 +7205,18 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid
|
||||
case 719:
|
||||
ent = new StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem;
|
||||
break;
|
||||
|
||||
|
||||
case 720:
|
||||
ent = new StepVisual_SurfaceStyleTransparent;
|
||||
break;
|
||||
case 721:
|
||||
ent = new StepVisual_SurfaceStyleReflectanceAmbient;
|
||||
break;
|
||||
case 722:
|
||||
ent = new StepVisual_SurfaceStyleRendering;
|
||||
break;
|
||||
case 723:
|
||||
ent = new StepVisual_SurfaceStyleRenderingWithProperties;
|
||||
break;
|
||||
default:
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -7769,7 +7815,11 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber
|
||||
case 717:
|
||||
case 718: return cataux;
|
||||
case 719: return catdr;
|
||||
|
||||
case 720:
|
||||
case 721:
|
||||
case 722:
|
||||
case 723: return catdr;
|
||||
|
||||
default : break;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -433,6 +433,10 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
|
||||
#include <StepShape_ContextDependentShapeRepresentation.hxx>
|
||||
|
||||
#include <StepVisual_SurfaceStyleTransparent.hxx>
|
||||
#include <StepVisual_SurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <StepVisual_SurfaceStyleRendering.hxx>
|
||||
#include <StepVisual_SurfaceStyleRenderingWithProperties.hxx>
|
||||
|
||||
#include <RWStepBasic_RWAddress.hxx>
|
||||
#include <RWStepShape_RWAdvancedBrepShapeRepresentation.hxx>
|
||||
@@ -1405,6 +1409,10 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule)
|
||||
#include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
|
||||
#include <RWStepVisual_RWSurfaceStyleTransparent.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleRendering.hxx>
|
||||
#include <RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx>
|
||||
|
||||
// -- General Declarations (Recognize, StepType) ---
|
||||
|
||||
@@ -2046,6 +2054,12 @@ static TCollection_AsciiString Reco_CharacterizedRepresentation("CHARACTERIZED_R
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClipping("CAMERA_MODEL_D3_MULTI_CLIPPING");
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClippingIntersection("CAMERA_MODEL_D3_MULTI_CLIPPING_INTERSECTION");
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClippingUnion("CAMERA_MODEL_D3_MULTI_CLIPPING_UNION");
|
||||
|
||||
static TCollection_AsciiString Reco_SurfaceStyleTransparent("SURFACE_STYLE_TRANSPARENT");
|
||||
static TCollection_AsciiString Reco_SurfaceStyleReflectanceAmbient("SURFACE_STYLE_REFLECTANCE_AMBIENT");
|
||||
static TCollection_AsciiString Reco_SurfaceStyleRendering("SURFACE_STYLE_RENDERING");
|
||||
static TCollection_AsciiString Reco_SurfaceStyleRenderingWithProperties("SURFACE_STYLE_RENDERING_WITH_PROPERTIES");
|
||||
|
||||
// -- Definition of the libraries --
|
||||
|
||||
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
|
||||
@@ -2703,7 +2717,11 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
|
||||
typenums.Bind ( Reco_CameraModelD3MultiClippingIntersection, 717);
|
||||
typenums.Bind ( Reco_CameraModelD3MultiClippingUnion, 718);
|
||||
|
||||
|
||||
typenums.Bind (Reco_SurfaceStyleTransparent, 720);
|
||||
typenums.Bind (Reco_SurfaceStyleReflectanceAmbient, 721);
|
||||
typenums.Bind (Reco_SurfaceStyleRendering, 722);
|
||||
typenums.Bind (Reco_SurfaceStyleRenderingWithProperties, 723);
|
||||
|
||||
// SHORT NAMES
|
||||
// NB : la liste est celle de AP203
|
||||
// Directement exploite pour les types simples
|
||||
@@ -4558,6 +4576,11 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
|
||||
case 717 : return Reco_CameraModelD3MultiClippingIntersection;
|
||||
case 718 : return Reco_CameraModelD3MultiClippingUnion;
|
||||
|
||||
case 720 : return Reco_SurfaceStyleTransparent;
|
||||
case 721 : return Reco_SurfaceStyleReflectanceAmbient;
|
||||
case 722 : return Reco_SurfaceStyleRendering;
|
||||
case 723 : return Reco_SurfaceStyleRenderingWithProperties;
|
||||
|
||||
default : return PasReco;
|
||||
}
|
||||
}
|
||||
@@ -9457,7 +9480,34 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN,
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
|
||||
case 720:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleTransparent tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 721:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 722:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRendering tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 723:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRenderingWithProperties tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ach->AddFail("Type Mismatch when reading - Entity");
|
||||
@@ -14314,7 +14364,34 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
|
||||
case 720:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleTransparent tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 721:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 722:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRendering tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 723:
|
||||
{
|
||||
DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent);
|
||||
RWStepVisual_RWSurfaceStyleRenderingWithProperties tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@@ -118,10 +118,18 @@ RWStepVisual_RWSurfaceStyleFillArea.cxx
|
||||
RWStepVisual_RWSurfaceStyleFillArea.hxx
|
||||
RWStepVisual_RWSurfaceStyleParameterLine.cxx
|
||||
RWStepVisual_RWSurfaceStyleParameterLine.hxx
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient.cxx
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx
|
||||
RWStepVisual_RWSurfaceStyleRendering.cxx
|
||||
RWStepVisual_RWSurfaceStyleRendering.hxx
|
||||
RWStepVisual_RWSurfaceStyleRenderingWithProperties.cxx
|
||||
RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx
|
||||
RWStepVisual_RWSurfaceStyleSegmentationCurve.cxx
|
||||
RWStepVisual_RWSurfaceStyleSegmentationCurve.hxx
|
||||
RWStepVisual_RWSurfaceStyleSilhouette.cxx
|
||||
RWStepVisual_RWSurfaceStyleSilhouette.hxx
|
||||
RWStepVisual_RWSurfaceStyleTransparent.cxx
|
||||
RWStepVisual_RWSurfaceStyleTransparent.hxx
|
||||
RWStepVisual_RWSurfaceStyleUsage.cxx
|
||||
RWStepVisual_RWSurfaceStyleUsage.hxx
|
||||
RWStepVisual_RWTemplate.cxx
|
||||
|
@@ -0,0 +1,78 @@
|
||||
// Created on : Thu May 14 15:13:19 2020
|
||||
// Created by: Igor KHOZHANOV
|
||||
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
|
||||
// Copyright (c) Open CASCADE 2020
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepVisual_SurfaceStyleReflectanceAmbient.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWSurfaceStyleReflectanceAmbient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
RWStepVisual_RWSurfaceStyleReflectanceAmbient::RWStepVisual_RWSurfaceStyleReflectanceAmbient() {}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleReflectanceAmbient::ReadStep (const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if ( ! data->CheckNbParams(num,1,ach,"surface_style_reflectance_ambient") ) return;
|
||||
|
||||
// Own fields of SurfaceStyleReflectanceAmbient
|
||||
|
||||
Standard_Real aAmbientReflectance;
|
||||
data->ReadReal (num, 1, "ambient_reflectance", ach, aAmbientReflectance);
|
||||
|
||||
// Initialize entity
|
||||
ent->Init(aAmbientReflectance);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleReflectanceAmbient::WriteStep (StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const
|
||||
{
|
||||
|
||||
// Own fields of SurfaceStyleReflectanceAmbient
|
||||
|
||||
SW.Send (ent->AmbientReflectance());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleReflectanceAmbient::Share (const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ,
|
||||
Interface_EntityIterator& ) const
|
||||
{
|
||||
|
||||
// Own fields of SurfaceStyleReflectanceAmbient
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
// Created on : Thu May 14 15:13:19 2020
|
||||
// Created by: Igor KHOZHANOV
|
||||
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
|
||||
// Copyright (c) Open CASCADE 2020
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_
|
||||
#define _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
class StepVisual_SurfaceStyleReflectanceAmbient;
|
||||
|
||||
//! Read & Write tool for SurfaceStyleReflectanceAmbient
|
||||
class RWStepVisual_RWSurfaceStyleReflectanceAmbient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWSurfaceStyleReflectanceAmbient();
|
||||
|
||||
Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent, Interface_EntityIterator& iter) const;
|
||||
|
||||
};
|
||||
#endif // _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_
|
100
src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.cxx
Normal file
100
src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.cxx
Normal file
@@ -0,0 +1,100 @@
|
||||
// Created on : Thu May 14 15:13:19 2020
|
||||
// Created by: Igor KHOZHANOV
|
||||
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
|
||||
// Copyright (c) Open CASCADE 2020
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <RWStepVisual_RWSurfaceStyleRendering.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepVisual_SurfaceStyleRendering.hxx>
|
||||
#include <StepVisual_ShadingSurfaceMethod.hxx>
|
||||
#include <StepVisual_Colour.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWSurfaceStyleRendering
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
RWStepVisual_RWSurfaceStyleRendering::RWStepVisual_RWSurfaceStyleRendering() {}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleRendering::ReadStep (const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_SurfaceStyleRendering)& ent) const
|
||||
{
|
||||
// Check number of parameters
|
||||
if ( ! data->CheckNbParams(num,2,ach,"surface_style_rendering") ) return;
|
||||
|
||||
// Own fields of SurfaceStyleRendering
|
||||
|
||||
StepVisual_ShadingSurfaceMethod aRenderingMethod = StepVisual_ssmNormalShading;
|
||||
if (data->ParamType (num, 1) == Interface_ParamEnum) {
|
||||
Standard_CString text = data->ParamCValue(num, 1);
|
||||
if (strcmp(text, ".CONSTANT_SHADING.")) aRenderingMethod = StepVisual_ssmConstantShading;
|
||||
else if (strcmp(text, ".COLOUR_SHADING.")) aRenderingMethod = StepVisual_ssmColourShading;
|
||||
else if (strcmp(text, ".DOT_SHADING.")) aRenderingMethod = StepVisual_ssmDotShading;
|
||||
else if (strcmp(text, ".NORMAL_SHADING.")) aRenderingMethod = StepVisual_ssmNormalShading;
|
||||
else ach->AddFail("Parameter #1 (rendering_method) has not allowed value");
|
||||
}
|
||||
else ach->AddFail("Parameter #1 (rendering_method) is not enumeration");
|
||||
|
||||
Handle(StepVisual_Colour) aSurfaceColour;
|
||||
data->ReadEntity (num, 2, "surface_colour", ach, STANDARD_TYPE(StepVisual_Colour), aSurfaceColour);
|
||||
|
||||
// Initialize entity
|
||||
ent->Init(aRenderingMethod,
|
||||
aSurfaceColour);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleRendering::WriteStep (StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_SurfaceStyleRendering)& ent) const
|
||||
{
|
||||
|
||||
// Own fields of SurfaceStyleRendering
|
||||
|
||||
switch (ent->RenderingMethod()) {
|
||||
case StepVisual_ssmConstantShading: SW.SendEnum (".CONSTANT_SHADING."); break;
|
||||
case StepVisual_ssmColourShading: SW.SendEnum (".COLOUR_SHADING."); break;
|
||||
case StepVisual_ssmDotShading: SW.SendEnum (".DOT_SHADING."); break;
|
||||
case StepVisual_ssmNormalShading: SW.SendEnum (".NORMAL_SHADING."); break;
|
||||
}
|
||||
|
||||
SW.Send (ent->SurfaceColour());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void RWStepVisual_RWSurfaceStyleRendering::Share (const Handle(StepVisual_SurfaceStyleRendering)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
|
||||
// Own fields of SurfaceStyleRendering
|
||||
|
||||
iter.AddItem (ent->SurfaceColour());
|
||||
}
|
46
src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.hxx
Normal file
46
src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Created on : Thu May 14 15:13:19 2020
|
||||
// Created by: Igor KHOZHANOV
|
||||
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
|
||||
// Copyright (c) Open CASCADE 2020
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_
|
||||
#define _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
class StepVisual_SurfaceStyleRendering;
|
||||
|
||||
//! Read & Write tool for SurfaceStyleRendering
|
||||
class RWStepVisual_RWSurfaceStyleRendering
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWSurfaceStyleRendering();
|
||||
|
||||
Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleRendering)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleRendering)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleRendering)& ent, Interface_EntityIterator& iter) const;
|
||||
|
||||
};
|
||||
#endif // _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user