mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
678932f76f | ||
|
acce2c1448 | ||
|
633084b809 | ||
|
a9e5f65041 | ||
|
b9a372bbcd | ||
|
b5204c6c37 | ||
|
75e2ba1695 | ||
|
5c48956f8e | ||
|
b9184c2714 | ||
|
e61aa824db | ||
|
5a846a5d2c | ||
|
b91e601442 | ||
|
cfde7eebb3 |
@@ -56,6 +56,20 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
|
||||
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
|
||||
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
|
||||
|
||||
# set soversion variable determining compatibility version on platforms with symlinks
|
||||
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
|
||||
if (NOT BUILD_SOVERSION_NUMBERS)
|
||||
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
|
||||
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
|
||||
|
||||
# update default state of soversion on different platforms
|
||||
if (WIN32 OR ANDROID OR EMSCRIPTEN)
|
||||
set (BUILD_SOVERSION_NUMBERS 0)
|
||||
else()
|
||||
set (BUILD_SOVERSION_NUMBERS 2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
|
||||
|
||||
# Regeneration of OCCT resource files
|
||||
@@ -1225,7 +1239,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
||||
endforeach()
|
||||
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
|
||||
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
|
||||
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
|
||||
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
|
@@ -280,14 +280,17 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
||||
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
|
||||
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
|
||||
|
||||
if (ANDROID)
|
||||
# do not append version to the filename
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
|
||||
else()
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||
SOVERSION "${OCC_VERSION_MAJOR}"
|
||||
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
set (OCC_SOVERSION "")
|
||||
if (BUILD_SOVERSION_NUMBERS GREATER 2)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
|
||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
|
||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
|
||||
endif()
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||
SOVERSION "${OCC_SOVERSION}"
|
||||
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||
|
||||
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
|
||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||
|
@@ -28,6 +28,9 @@ Applies only for Debug configuration.")
|
||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
||||
"Append the postfix to names of output libraries")
|
||||
|
||||
set (BUILD_SOVERSION_NUMBERS_DESCR
|
||||
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
|
||||
|
||||
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
|
||||
"Disables exceptions like Standard_OutOfRange in Release builds.
|
||||
Defines No_Exception macros for Release builds when enabled (default).
|
||||
|
@@ -132,21 +132,31 @@ for (aPackage, aPackages) {
|
||||
}
|
||||
}
|
||||
|
||||
# extend clean with versioned .so files
|
||||
!win32 {
|
||||
aVerList = $$split(VERSION, ".")
|
||||
aVerMaj = $$member(aVerList, 0)
|
||||
aVerMin = $$member(aVerList, 1)
|
||||
aVerMic = $$member(aVerList, 2)
|
||||
|
||||
equals(TEMPLATE, app) {
|
||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
|
||||
} else {
|
||||
mac {
|
||||
# override qmake soname versionong logic
|
||||
QMAKE_LFLAGS_SONAME =
|
||||
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
|
||||
|
||||
# extend clean with versioned .dylib files
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
|
||||
} else {
|
||||
# override qmake soname versionong logic
|
||||
QMAKE_LFLAGS_SONAME =
|
||||
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||
|
||||
# extend clean with versioned .so files
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
|
||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -26,9 +26,7 @@
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Texture1D.hxx>
|
||||
#include <Graphic3d_Texture1Dsegment.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -81,7 +79,7 @@ void Sample2D_Image::SetContext (const Handle(AIS_InteractiveContext)& theContex
|
||||
this->Set(TopoDS_Shape(myFace));
|
||||
|
||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(myFilename);
|
||||
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (myFilename);
|
||||
aTexture->DisableModulate();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
@@ -278,17 +278,17 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
|
||||
TCollection_AsciiString aTextureDesc;
|
||||
if (!myTexturePixMap.IsNull())
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myTexturePixMap);
|
||||
myTexture = new Graphic3d_Texture2D (myTexturePixMap);
|
||||
aTextureDesc = " (custom image)";
|
||||
}
|
||||
else if (myPredefTexture != Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myPredefTexture);
|
||||
myTexture = new Graphic3d_Texture2D (myPredefTexture);
|
||||
aTextureDesc = TCollection_AsciiString(" (predefined texture ") + myTexture->GetId() + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
myTexture = new Graphic3d_Texture2Dmanual (myTextureFile.ToCString());
|
||||
myTexture = new Graphic3d_Texture2D (myTextureFile.ToCString());
|
||||
aTextureDesc = TCollection_AsciiString(" (") + myTextureFile + ")";
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
|
||||
class Graphic3d_AspectFillArea3d;
|
||||
class Graphic3d_Texture2Dmanual;
|
||||
class Graphic3d_Texture2D;
|
||||
|
||||
//! This class allows to map textures on shapes.
|
||||
//! Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape,
|
||||
@@ -184,7 +184,7 @@ protected: //! @name overridden methods
|
||||
|
||||
protected: //! @name presentation fields
|
||||
|
||||
Handle(Graphic3d_Texture2Dmanual) myTexture;
|
||||
Handle(Graphic3d_Texture2D) myTexture;
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||
|
||||
protected: //! @name texture source fields
|
||||
|
@@ -23,14 +23,14 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
//! Texture holder.
|
||||
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2Dmanual
|
||||
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2D
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
XRTexture (const Handle(Image_Texture)& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
|
||||
: Graphic3d_Texture2Dmanual (""), myImageSource (theImageSource)
|
||||
: Graphic3d_Texture2D (""), myImageSource (theImageSource)
|
||||
{
|
||||
if (!theImageSource->TextureId().IsEmpty())
|
||||
{
|
||||
|
@@ -114,19 +114,20 @@ public:
|
||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real VPeriod() const;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
|
||||
|
||||
//! Computes the point and the first derivatives on
|
||||
//! the surface.
|
||||
//! Raised if the continuity of the current
|
||||
//! intervals is not C1.
|
||||
//! Computes the point and the first derivatives on the surface.
|
||||
//! Raised if the continuity of the current intervals is not C1.
|
||||
//!
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
|
||||
//! Computes the point, the first and second
|
||||
//! derivatives on the surface.
|
||||
//! Raised if the continuity of the current
|
||||
|
@@ -141,17 +141,18 @@ public:
|
||||
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Computes the point of parameters U,V on the surface.
|
||||
Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the point and the first derivatives on
|
||||
//! the surface.
|
||||
//! Raised if the continuity of the current
|
||||
//! intervals is not C1.
|
||||
|
||||
//! Computes the point and the first derivatives on the surface.
|
||||
//! Raised if the continuity of the current intervals is not C1.
|
||||
//!
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Computes the point, the first and second
|
||||
//! derivatives on the surface.
|
||||
//! Raised if the continuity of the current
|
||||
|
@@ -316,6 +316,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||
Standard_Real eps = Precision::PConfusion();
|
||||
Standard_Boolean toRunParallel = !myMutex.IsNull();
|
||||
const Handle(Adaptor3d_Curve)& aLocalHCurve = GetEdgeCurve(TopoDS::Face(S));
|
||||
while (itcr.More()) {
|
||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
||||
@@ -372,13 +373,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
Handle(Geom_Surface) Sb = cr->Surface();
|
||||
Sb = Handle(Geom_Surface)::DownCast
|
||||
// (Su->Transformed(L.Transformation()));
|
||||
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
|
||||
(Su->Transformed(/*L*/TFloc.Transformation()));
|
||||
Handle(Geom2d_Curve) PC = cr->PCurve();
|
||||
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
|
||||
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
|
||||
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
||||
|
||||
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
|
||||
BRepLib_ValidateEdge aValidateEdge(aLocalHCurve, ACS, SameParameter);
|
||||
aValidateEdge.SetExitIfToleranceExceeded(Tol);
|
||||
aValidateEdge.SetExactMethod(myIsExactMethod);
|
||||
aValidateEdge.SetParallel(toRunParallel);
|
||||
@@ -402,7 +403,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
GHPC->Load(cr->PCurve2(),f,l); // same bounds
|
||||
ACS->Load(GHPC, GAHS); // sans doute inutile
|
||||
|
||||
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(myHCurve, ACS, SameParameter);
|
||||
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(aLocalHCurve, ACS, SameParameter);
|
||||
aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
|
||||
aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
|
||||
aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
|
||||
@@ -440,12 +441,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
// plan en position
|
||||
if (myGctrl) {
|
||||
P = Handle(Geom_Plane)::
|
||||
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
|
||||
DownCast(P->Transformed(/*L*/TFloc.Transformation()));// eap occ332
|
||||
//on projette Cref sur ce plan
|
||||
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
|
||||
|
||||
// Dub - Normalement myHCurve est une GeomAdaptor_Curve
|
||||
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(myHCurve);
|
||||
// Dub - Normalement aLocalHCurve est une GeomAdaptor_Curve
|
||||
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(aLocalHCurve);
|
||||
Handle(Geom_Curve) C3d = Gac->Curve();
|
||||
Handle(Geom_Curve) ProjOnPlane =
|
||||
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
|
||||
@@ -458,12 +459,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
||||
Handle(Geom2dAdaptor_Curve) GHPC =
|
||||
new Geom2dAdaptor_Curve(PC,
|
||||
myHCurve->FirstParameter(),
|
||||
myHCurve->LastParameter());
|
||||
aLocalHCurve->FirstParameter(),
|
||||
aLocalHCurve->LastParameter());
|
||||
|
||||
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
||||
|
||||
BRepLib_ValidateEdge aValidateEdgeProj(myHCurve, ACS, SameParameter);
|
||||
BRepLib_ValidateEdge aValidateEdgeProj(aLocalHCurve, ACS, SameParameter);
|
||||
aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
|
||||
aValidateEdgeProj.SetExactMethod(myIsExactMethod);
|
||||
aValidateEdgeProj.SetParallel(toRunParallel);
|
||||
@@ -665,6 +666,50 @@ Standard_Real BRepCheck_Edge::Tolerance()
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetEdgeCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Adaptor3d_Curve) BRepCheck_Edge::GetEdgeCurve(const TopoDS_Face& theFace)
|
||||
{
|
||||
Handle(Adaptor3d_Curve) aLocalCurve;
|
||||
Handle(BRep_GCurve) GCref(Handle(BRep_GCurve)::DownCast(myCref));
|
||||
Standard_Real First, Last;
|
||||
GCref->Range(First, Last);
|
||||
if (myCref->IsCurve3D())
|
||||
{
|
||||
TopLoc_Location aLoc = !theFace.IsNull()
|
||||
? (myShape.Location() * myCref->Location()).Predivided(theFace.Location())
|
||||
: myShape.Location() * myCref->Location();
|
||||
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
|
||||
(myCref->Curve3D()->Transformed
|
||||
(aLoc.Transformation()));
|
||||
|
||||
GeomAdaptor_Curve GAC3d(C3d, C3d->TransformedParameter(First, aLoc.Transformation()),
|
||||
C3d->TransformedParameter(Last, aLoc.Transformation()));
|
||||
aLocalCurve = new GeomAdaptor_Curve(GAC3d);
|
||||
}
|
||||
else // curve on surface
|
||||
{
|
||||
TopLoc_Location aFaceLoc = theFace.Location();
|
||||
Handle(Geom_Surface) Sref = myCref->Surface();
|
||||
Sref = !theFace.IsNull()
|
||||
? Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Predivided(aFaceLoc).Transformation()))
|
||||
: Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
|
||||
|
||||
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
|
||||
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
|
||||
Handle(Geom2dAdaptor_Curve) GHPCref =
|
||||
new Geom2dAdaptor_Curve(PCref, First, Last);
|
||||
Adaptor3d_CurveOnSurface ACSref(GHPCref, GAHSref);
|
||||
aLocalCurve = new Adaptor3d_CurveOnSurface(ACSref);
|
||||
}
|
||||
|
||||
return aLocalCurve;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPolygonOnTriangulation
|
||||
//purpose :
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
class BRep_CurveRepresentation;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
|
||||
class BRepCheck_Edge;
|
||||
@@ -49,6 +50,11 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real Tolerance();
|
||||
|
||||
//! Creates a 3d curve or curve on surface by subtracting the location of the face
|
||||
//! @param[in] theFace input face to get the location from it
|
||||
//! @return a 3d curve or curve on surface
|
||||
Standard_EXPORT Handle(Adaptor3d_Curve) GetEdgeCurve (const TopoDS_Face& theFace);
|
||||
|
||||
//! Sets status of Edge;
|
||||
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);
|
||||
|
||||
|
@@ -695,7 +695,7 @@ Standard_Boolean BRepTools::Write (const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
|
||||
if (aStream.get() == NULL || !aStream->good())
|
||||
{
|
||||
return Standard_False;
|
||||
|
@@ -78,19 +78,11 @@ Standard_Boolean CDF_Store::SetFolder(const Standard_ExtString aFolder) {
|
||||
Standard_Boolean CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
|
||||
|
||||
TCollection_ExtendedString theFolder(aFolder);
|
||||
Standard_Integer l = theFolder.Length();
|
||||
Standard_Integer aLen = theFolder.Length();
|
||||
|
||||
// if the last character is the folder separator (which is always the first character)
|
||||
// it is removed.
|
||||
// This is correct for Unix systems but not for Windows! VMS and MAC? Thomas Haller, 23.11.01
|
||||
if(l > 1) {
|
||||
#ifndef _WIN32
|
||||
if(theFolder.Value(l) == theFolder.Value(1)) theFolder.Trunc(l-1);
|
||||
#else
|
||||
if (theFolder.Value(l) == '/' || theFolder.Value(l) == '\\')
|
||||
theFolder.Trunc(l-1);
|
||||
#endif
|
||||
}
|
||||
// if the last character is the folder separator, remove it.
|
||||
if (aLen > 1 && (theFolder.Value(aLen) == '/' || theFolder.Value(aLen) == '\\'))
|
||||
theFolder.Trunc(aLen-1);
|
||||
|
||||
if(theMetaDataDriver->FindFolder(theFolder)) {
|
||||
myCurrentDocument->SetRequestedFolder(theFolder);
|
||||
|
@@ -195,7 +195,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
|
||||
|
||||
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
|
||||
if (aDepthFormat.IsValid()
|
||||
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
Release (theCtx.get());
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
|
@@ -92,7 +92,7 @@ static Standard_Integer save (Draw_Interpretor& theDI,
|
||||
|
||||
const char* aName = theArgVec[2];
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out | std::ios::binary);
|
||||
aStream->precision (15);
|
||||
if (aStream.get() == NULL || !aStream->good())
|
||||
{
|
||||
|
@@ -663,7 +663,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
// myIsParallel = TRUE and only the least distance will be returned.
|
||||
//4. Arcs are not parallel. Then several (or single) extremas will be returned.
|
||||
|
||||
if (aRng.Delta() > Precision::Angular())
|
||||
if (aRng.Delta() > Precision::Confusion())
|
||||
{
|
||||
Standard_Real aPar = 0.0;
|
||||
aRng.GetIntermediatePoint(0.5, aPar);
|
||||
@@ -703,7 +703,6 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Nearer solution can be found
|
||||
}
|
||||
else if (!aRng.IsVoid())
|
||||
|
@@ -120,6 +120,15 @@ Extrema_GenExtCS::Extrema_GenExtCS()
|
||||
{
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Extrema_GenExtCS
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Extrema_GenExtCS::~Extrema_GenExtCS()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extrema_GenExtCS
|
||||
//purpose :
|
||||
|
@@ -35,9 +35,12 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT Extrema_GenExtCS();
|
||||
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT ~Extrema_GenExtCS();
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searches
|
||||
|
@@ -224,7 +224,19 @@ Extrema_GenExtPS::Extrema_GenExtPS()
|
||||
myAlgo = Extrema_ExtAlgo_Grad;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Extrema_GenExtPS
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Extrema_GenExtPS::~Extrema_GenExtPS()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Extrema_GenExtPS
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Extrema_GenExtPS::Extrema_GenExtPS (const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Integer NbU,
|
||||
|
@@ -37,8 +37,12 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT Extrema_GenExtPS();
|
||||
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT ~Extrema_GenExtPS();
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searches
|
||||
|
@@ -118,6 +118,15 @@ Extrema_GenExtSS::Extrema_GenExtSS()
|
||||
myInit = Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Extrema_GenExtSS
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Extrema_GenExtSS::~Extrema_GenExtSS()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extrema_GenExtSS
|
||||
//purpose :
|
||||
|
@@ -36,9 +36,12 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT Extrema_GenExtSS();
|
||||
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT ~Extrema_GenExtSS();
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searches
|
||||
|
@@ -27,29 +27,24 @@ class gp_Vec;
|
||||
class Geom_Surface;
|
||||
DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
|
||||
|
||||
//! Describes the common behavior of surfaces in 3D
|
||||
//! space. The Geom package provides many
|
||||
//! implementations of concrete derived surfaces, such as
|
||||
//! planes, cylinders, cones, spheres and tori, surfaces of
|
||||
//! linear extrusion, surfaces of revolution, Bezier and
|
||||
//! BSpline surfaces, and so on.
|
||||
//! The key characteristic of these surfaces is that they
|
||||
//! are parameterized. Geom_Surface demonstrates:
|
||||
//! - how to work with the parametric equation of a
|
||||
//! surface to compute the point of parameters (u,
|
||||
//! v), and, at this point, the 1st, 2nd ... Nth derivative,
|
||||
//! Describes the common behavior of surfaces in 3D space.
|
||||
//! The Geom package provides many implementations of concrete derived surfaces,
|
||||
//! such as planes, cylinders, cones, spheres and tori, surfaces of linear extrusion,
|
||||
//! surfaces of revolution, Bezier and BSpline surfaces, and so on.
|
||||
//! The key characteristic of these surfaces is that they are parameterized.
|
||||
//! Geom_Surface demonstrates:
|
||||
//! - how to work with the parametric equation of a surface
|
||||
//! to compute the point of parameters (u, v), and, at this point, the 1st, 2nd ... Nth derivative;
|
||||
//! - how to find global information about a surface in
|
||||
//! each parametric direction (for example, level of
|
||||
//! continuity, whether the surface is closed, its
|
||||
//! periodicity, the bounds of the parameters and so on), and
|
||||
//! - how the parameters change when geometric
|
||||
//! transformations are applied to the surface, or the
|
||||
//! orientation is modified.
|
||||
//! Note that all surfaces must have a geometric
|
||||
//! continuity, and any surface is at least "C0". Generally,
|
||||
//! continuity is checked at construction time or when the
|
||||
//! curve is edited. Where this is not the case, the
|
||||
//! documentation makes this explicit.
|
||||
//! each parametric direction (for example, level of continuity, whether the surface is closed,
|
||||
//! its periodicity, the bounds of the parameters and so on);
|
||||
//! - how the parameters change when geometric transformations are applied to the surface,
|
||||
//! or the orientation is modified.
|
||||
//!
|
||||
//! Note that all surfaces must have a geometric continuity, and any surface is at least "C0".
|
||||
//! Generally, continuity is checked at construction time or when the curve is edited.
|
||||
//! Where this is not the case, the documentation makes this explicit.
|
||||
//!
|
||||
//! Warning
|
||||
//! The Geom package does not prevent the construction of
|
||||
//! surfaces with null areas, or surfaces which self-intersect.
|
||||
@@ -142,47 +137,42 @@ public:
|
||||
//! equal to Precision::Infinite: instead of Standard_Real::LastReal.
|
||||
Standard_EXPORT virtual void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const = 0;
|
||||
|
||||
//! Checks whether this surface is closed in the u
|
||||
//! parametric direction.
|
||||
//! Returns true if, in the u parametric direction: taking
|
||||
//! uFirst and uLast as the parametric bounds in
|
||||
//! the u parametric direction, for each parameter v, the
|
||||
//! distance between the points P(uFirst, v) and
|
||||
//! Checks whether this surface is closed in the u parametric direction.
|
||||
//! Returns true if, in the u parametric direction:
|
||||
//! taking uFirst and uLast as the parametric bounds in
|
||||
//! the u parametric direction, for each parameter v,
|
||||
//! the distance between the points P(uFirst, v) and
|
||||
//! P(uLast, v) is less than or equal to gp::Resolution().
|
||||
Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
|
||||
|
||||
//! Checks whether this surface is closed in the u
|
||||
//! parametric direction.
|
||||
//! Returns true if, in the v parametric
|
||||
//! direction: taking vFirst and vLast as the
|
||||
//! parametric bounds in the v parametric direction, for
|
||||
//! each parameter u, the distance between the points
|
||||
//! P(u, vFirst) and P(u, vLast) is less than
|
||||
//! or equal to gp::Resolution().
|
||||
//! Checks whether this surface is closed in the u parametric direction.
|
||||
//! Returns true if, in the v parametric direction:
|
||||
//! taking vFirst and vLast as the parametric bounds in the v parametric direction,
|
||||
//! for each parameter u, the distance between the points
|
||||
//! P(u, vFirst) and P(u, vLast) is less than or equal to gp::Resolution().
|
||||
Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
|
||||
|
||||
//! Checks if this surface is periodic in the u
|
||||
//! parametric direction. Returns true if:
|
||||
//! Checks if this surface is periodic in the u parametric direction.
|
||||
//! Returns true if:
|
||||
//! - this surface is closed in the u parametric direction, and
|
||||
//! - there is a constant T such that the distance
|
||||
//! between the points P (u, v) and P (u + T,
|
||||
//! v) (or the points P (u, v) and P (u, v +
|
||||
//! T)) is less than or equal to gp::Resolution().
|
||||
//! between the points P (u, v) and P (u + T, v)
|
||||
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
|
||||
//!
|
||||
//! Note: T is the parametric period in the u parametric direction.
|
||||
Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
|
||||
|
||||
//! Returns the period of this surface in the u
|
||||
//! parametric direction.
|
||||
//! raises if the surface is not uperiodic.
|
||||
//! Returns the period of this surface in the u parametric direction.
|
||||
//! Raises if the surface is not uperiodic.
|
||||
Standard_EXPORT virtual Standard_Real UPeriod() const;
|
||||
|
||||
//! Checks if this surface is periodic in the v
|
||||
//! parametric direction. Returns true if:
|
||||
//! Checks if this surface is periodic in the v parametric direction.
|
||||
//! Returns true if:
|
||||
//! - this surface is closed in the v parametric direction, and
|
||||
//! - there is a constant T such that the distance
|
||||
//! between the points P (u, v) and P (u + T,
|
||||
//! v) (or the points P (u, v) and P (u, v +
|
||||
//! T)) is less than or equal to gp::Resolution().
|
||||
//! between the points P (u, v) and P (u + T, v)
|
||||
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
|
||||
//!
|
||||
//! Note: T is the parametric period in the v parametric direction.
|
||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
|
||||
|
||||
@@ -197,25 +187,24 @@ public:
|
||||
Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0;
|
||||
|
||||
//! Returns the Global Continuity of the surface in direction U and V :
|
||||
//! C0 : only geometric continuity,
|
||||
//! C1 : continuity of the first derivative all along the surface,
|
||||
//! C2 : continuity of the second derivative all along the surface,
|
||||
//! C3 : continuity of the third derivative all along the surface,
|
||||
//! G1 : tangency continuity all along the surface,
|
||||
//! G2 : curvature continuity all along the surface,
|
||||
//! CN : the order of continuity is infinite.
|
||||
//! Example :
|
||||
//! - C0: only geometric continuity,
|
||||
//! - C1: continuity of the first derivative all along the surface,
|
||||
//! - C2: continuity of the second derivative all along the surface,
|
||||
//! - C3: continuity of the third derivative all along the surface,
|
||||
//! - G1: tangency continuity all along the surface,
|
||||
//! - G2: curvature continuity all along the surface,
|
||||
//! - CN: the order of continuity is infinite.
|
||||
//!
|
||||
//! Example:
|
||||
//! If the surface is C1 in the V parametric direction and C2
|
||||
//! in the U parametric direction Shape = C1.
|
||||
Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
|
||||
|
||||
//! Returns the order of continuity of the surface in the
|
||||
//! U parametric direction.
|
||||
//! Returns the order of continuity of the surface in the U parametric direction.
|
||||
//! Raised if N < 0.
|
||||
Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 0;
|
||||
|
||||
//! Returns the order of continuity of the surface in the
|
||||
//! V parametric direction.
|
||||
//! Returns the order of continuity of the surface in the V parametric direction.
|
||||
//! Raised if N < 0.
|
||||
Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
|
||||
|
||||
@@ -226,9 +215,10 @@ public:
|
||||
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const = 0;
|
||||
|
||||
|
||||
//! Computes the point P and the first derivatives in the
|
||||
//! directions U and V at this point.
|
||||
//! Computes the point P and the first derivatives in the directions U and V at this point.
|
||||
//! Raised if the continuity of the surface is not C1.
|
||||
//!
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const = 0;
|
||||
|
||||
//! Computes the point P, the first and the second derivatives in
|
||||
@@ -241,21 +231,18 @@ public:
|
||||
//! Raised if the continuity of the surface is not C2.
|
||||
Standard_EXPORT virtual void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const = 0;
|
||||
|
||||
//! ---Purpose ;
|
||||
//! Computes the derivative of order Nu in the direction U and Nv
|
||||
//! in the direction V at the point P(U, V).
|
||||
//! Computes the derivative of order Nu in the direction U and Nv in the direction V at the point P(U, V).
|
||||
//!
|
||||
//! Raised if the continuity of the surface is not CNu in the U
|
||||
//! direction or not CNv in the V direction.
|
||||
//! Raised if the continuity of the surface is not CNu in the U direction or not CNv in the V direction.
|
||||
//! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
|
||||
Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const = 0;
|
||||
|
||||
//! Computes the point of parameter U on the surface.
|
||||
//! Computes the point of parameter (U, V) on the surface.
|
||||
//!
|
||||
//! It is implemented with D0
|
||||
//! It is implemented with D0.
|
||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
||||
//!
|
||||
//! Raised only for an "OffsetSurface" if it is not possible to
|
||||
//! compute the current point.
|
||||
//! Raised only for an "OffsetSurface" if it is not possible to compute the current point.
|
||||
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
|
@@ -2371,119 +2371,143 @@ void GeomLib::CancelDenominatorDerivative(Handle(Geom_BSplineSurface) &
|
||||
|
||||
//=======================================================================
|
||||
//function : NormEstim
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer GeomLib::NormEstim(const Handle(Geom_Surface)& S,
|
||||
const gp_Pnt2d& UV,
|
||||
const Standard_Real Tol, gp_Dir& N)
|
||||
Standard_Integer GeomLib::NormEstim (const Handle(Geom_Surface)& theSurf,
|
||||
const gp_Pnt2d& theUV,
|
||||
const Standard_Real theTol,
|
||||
gp_Dir& theNorm)
|
||||
{
|
||||
const Standard_Real aTol2 = Square (theTol);
|
||||
|
||||
gp_Vec DU, DV;
|
||||
gp_Pnt DummyPnt;
|
||||
Standard_Real aTol2 = Square(Tol);
|
||||
gp_Pnt aDummyPnt;
|
||||
theSurf->D1 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV);
|
||||
|
||||
S->D1(UV.X(), UV.Y(), DummyPnt, DU, DV);
|
||||
|
||||
Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
|
||||
|
||||
if(MDU >= aTol2 && MDV >= aTol2) {
|
||||
gp_Vec Norm = DU^DV;
|
||||
Standard_Real Magn = Norm.SquareMagnitude();
|
||||
if(Magn < aTol2) return 3;
|
||||
|
||||
//Magn = sqrt(Magn);
|
||||
N.SetXYZ(Norm.XYZ());
|
||||
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
gp_Vec D2U, D2V, D2UV;
|
||||
Standard_Boolean isDone;
|
||||
CSLib_NormalStatus aStatus;
|
||||
gp_Dir aNormal;
|
||||
|
||||
S->D2(UV.X(), UV.Y(), DummyPnt, DU, DV, D2U, D2V, D2UV);
|
||||
CSLib::Normal(DU, DV, D2U, D2V, D2UV, Tol, isDone, aStatus, aNormal);
|
||||
|
||||
if (isDone) {
|
||||
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||
Standard_Real step = 1.0e-5;
|
||||
Standard_Real eps = 1.0e-16;
|
||||
Standard_Real sign = -1.0;
|
||||
|
||||
S->Bounds(Umin, Umax, Vmin, Vmax);
|
||||
|
||||
// check for cone apex singularity point
|
||||
if ((UV.Y() > Vmin + step) && (UV.Y() < Vmax - step))
|
||||
{
|
||||
gp_Dir aNormal1, aNormal2;
|
||||
Standard_Real aConeSingularityAngleEps = 1.0e-4;
|
||||
S->D1(UV.X(), UV.Y() - sign * step, DummyPnt, DU, DV);
|
||||
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps)) {
|
||||
aNormal1 = DU^DV;
|
||||
S->D1(UV.X(), UV.Y() + sign * step, DummyPnt, DU, DV);
|
||||
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps)) {
|
||||
aNormal2 = DU^DV;
|
||||
if (aNormal1.IsOpposite(aNormal2, aConeSingularityAngleEps))
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Along V
|
||||
if(MDU < aTol2 && MDV >= aTol2) {
|
||||
if ((Vmax - UV.Y()) > (UV.Y() - Vmin))
|
||||
sign = 1.0;
|
||||
S->D1(UV.X(), UV.Y() + sign * step, DummyPnt, DU, DV);
|
||||
gp_Vec Norm = DU^DV;
|
||||
if (Norm.SquareMagnitude() < eps) {
|
||||
Standard_Real sign1 = -1.0;
|
||||
if ((Umax - UV.X()) > (UV.X() - Umin))
|
||||
sign1 = 1.0;
|
||||
S->D1(UV.X() + sign1 * step, UV.Y() + sign * step, DummyPnt, DU, DV);
|
||||
Norm = DU^DV;
|
||||
}
|
||||
if ((Norm.SquareMagnitude() >= eps) && (Norm.Dot(aNormal) < 0.0))
|
||||
aNormal.Reverse();
|
||||
}
|
||||
|
||||
// Along U
|
||||
if(MDV < aTol2 && MDU >= aTol2) {
|
||||
if ((Umax - UV.X()) > (UV.X() - Umin))
|
||||
sign = 1.0;
|
||||
S->D1(UV.X() + sign * step, UV.Y(), DummyPnt, DU, DV);
|
||||
gp_Vec Norm = DU^DV;
|
||||
if (Norm.SquareMagnitude() < eps) {
|
||||
Standard_Real sign1 = -1.0;
|
||||
if ((Vmax - UV.Y()) > (UV.Y() - Vmin))
|
||||
sign1 = 1.0;
|
||||
S->D1(UV.X() + sign * step, UV.Y() + sign1 * step, DummyPnt, DU, DV);
|
||||
Norm = DU^DV;
|
||||
}
|
||||
if ((Norm.SquareMagnitude() >= eps) && (Norm.Dot(aNormal) < 0.0))
|
||||
aNormal.Reverse();
|
||||
}
|
||||
|
||||
// quasysingular
|
||||
if ((aStatus == CSLib_D1NuIsNull) || (aStatus == CSLib_D1NvIsNull) ||
|
||||
(aStatus == CSLib_D1NuIsParallelD1Nv)) {
|
||||
N.SetXYZ(aNormal.XYZ());
|
||||
return 1;
|
||||
}
|
||||
// conical
|
||||
if (aStatus == CSLib_InfinityOfSolutions)
|
||||
return 2;
|
||||
}
|
||||
// computation is impossible
|
||||
else {
|
||||
// conical
|
||||
if (aStatus == CSLib_D1NIsNull) {
|
||||
return 2;
|
||||
}
|
||||
const Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
|
||||
if (MDU >= aTol2
|
||||
&& MDV >= aTol2)
|
||||
{
|
||||
gp_Vec aNorm = DU ^ DV;
|
||||
Standard_Real aMagn = aNorm.SquareMagnitude();
|
||||
if (aMagn < aTol2)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
theNorm.SetXYZ (aNorm.XYZ());
|
||||
return 0;
|
||||
}
|
||||
return 3;
|
||||
|
||||
gp_Vec D2U, D2V, D2UV;
|
||||
Standard_Boolean isDone = false;
|
||||
CSLib_NormalStatus aStatus;
|
||||
gp_Dir aNormal;
|
||||
|
||||
theSurf->D2 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV, D2U, D2V, D2UV);
|
||||
CSLib::Normal (DU, DV, D2U, D2V, D2UV, theTol, isDone, aStatus, aNormal);
|
||||
if (!isDone)
|
||||
{
|
||||
// computation is impossible
|
||||
return aStatus == CSLib_D1NIsNull ? 2 : 3;
|
||||
}
|
||||
|
||||
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||
Standard_Real step = 1.0e-5;
|
||||
Standard_Real eps = 1.0e-16;
|
||||
Standard_Real sign = -1.0;
|
||||
theSurf->Bounds (Umin, Umax, Vmin, Vmax);
|
||||
|
||||
// check for cone apex singularity point
|
||||
if ((theUV.Y() > Vmin + step)
|
||||
&& (theUV.Y() < Vmax - step))
|
||||
{
|
||||
gp_Dir aNormal1, aNormal2;
|
||||
Standard_Real aConeSingularityAngleEps = 1.0e-4;
|
||||
theSurf->D1(theUV.X(), theUV.Y() - sign * step, aDummyPnt, DU, DV);
|
||||
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps))
|
||||
{
|
||||
aNormal1 = DU ^ DV;
|
||||
theSurf->D1 (theUV.X(), theUV.Y() + sign * step, aDummyPnt, DU, DV);
|
||||
if ((DU.XYZ().SquareModulus() > eps)
|
||||
&& (DV.XYZ().SquareModulus() > eps))
|
||||
{
|
||||
aNormal2 = DU^DV;
|
||||
if (aNormal1.IsOpposite (aNormal2, aConeSingularityAngleEps))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Along V
|
||||
if (MDU < aTol2
|
||||
&& MDV >= aTol2)
|
||||
{
|
||||
if ((Vmax - theUV.Y()) > (theUV.Y() - Vmin))
|
||||
{
|
||||
sign = 1.0;
|
||||
}
|
||||
|
||||
theSurf->D1 (theUV.X(), theUV.Y() + sign * step, aDummyPnt, DU, DV);
|
||||
gp_Vec Norm = DU ^ DV;
|
||||
if (Norm.SquareMagnitude() < eps)
|
||||
{
|
||||
Standard_Real sign1 = -1.0;
|
||||
if ((Umax - theUV.X()) > (theUV.X() - Umin))
|
||||
{
|
||||
sign1 = 1.0;
|
||||
}
|
||||
theSurf->D1 (theUV.X() + sign1 * step, theUV.Y() + sign * step, aDummyPnt, DU, DV);
|
||||
Norm = DU ^ DV;
|
||||
}
|
||||
if (Norm.SquareMagnitude() >= eps
|
||||
&& Norm.Dot (aNormal) < 0.0)
|
||||
{
|
||||
aNormal.Reverse();
|
||||
}
|
||||
}
|
||||
|
||||
// Along U
|
||||
if (MDV < aTol2
|
||||
&& MDU >= aTol2)
|
||||
{
|
||||
if ((Umax - theUV.X()) > (theUV.X() - Umin))
|
||||
{
|
||||
sign = 1.0;
|
||||
}
|
||||
|
||||
theSurf->D1 (theUV.X() + sign * step, theUV.Y(), aDummyPnt, DU, DV);
|
||||
gp_Vec Norm = DU ^ DV;
|
||||
if (Norm.SquareMagnitude() < eps)
|
||||
{
|
||||
Standard_Real sign1 = -1.0;
|
||||
if ((Vmax - theUV.Y()) > (theUV.Y() - Vmin))
|
||||
{
|
||||
sign1 = 1.0;
|
||||
}
|
||||
|
||||
theSurf->D1 (theUV.X() + sign * step, theUV.Y() + sign1 * step, aDummyPnt, DU, DV);
|
||||
Norm = DU ^ DV;
|
||||
}
|
||||
if (Norm.SquareMagnitude() >= eps
|
||||
&& Norm.Dot (aNormal) < 0.0)
|
||||
{
|
||||
aNormal.Reverse();
|
||||
}
|
||||
}
|
||||
|
||||
// quasysingular
|
||||
if (aStatus == CSLib_D1NuIsNull
|
||||
|| aStatus == CSLib_D1NvIsNull
|
||||
|| aStatus == CSLib_D1NuIsParallelD1Nv)
|
||||
{
|
||||
theNorm.SetXYZ (aNormal.XYZ());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return aStatus == CSLib_InfinityOfSolutions ? 2 : 3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -183,8 +183,19 @@ public:
|
||||
//! Cancel,on the boundaries,the denominator first derivative
|
||||
//! in the directions wished by the user and set its value to 1.
|
||||
Standard_EXPORT static void CancelDenominatorDerivative (Handle(Geom_BSplineSurface)& BSurf, const Standard_Boolean UDirection, const Standard_Boolean VDirection);
|
||||
|
||||
Standard_EXPORT static Standard_Integer NormEstim (const Handle(Geom_Surface)& S, const gp_Pnt2d& UV, const Standard_Real Tol, gp_Dir& N);
|
||||
|
||||
//! Estimate surface normal at the given (U, V) point.
|
||||
//! @param[in] theSurf input surface
|
||||
//! @param[in] theUV (U, V) point coordinates on the surface
|
||||
//! @param[in] theTol estimation tolerance
|
||||
//! @param[out] theNorm computed normal
|
||||
//! @return 0 if normal estimated from D1,
|
||||
//! 1 if estimated from D2 (quasysingular),
|
||||
//! >=2 in case of failure (undefined or infinite solutions)
|
||||
Standard_EXPORT static Standard_Integer NormEstim (const Handle(Geom_Surface)& theSurf,
|
||||
const gp_Pnt2d& theUV,
|
||||
const Standard_Real theTol,
|
||||
gp_Dir& theNorm);
|
||||
|
||||
//! This method defines if opposite boundaries of surface
|
||||
//! coincide with given tolerance
|
||||
|
@@ -154,10 +154,11 @@ Graphic3d_Texture1Dsegment.cxx
|
||||
Graphic3d_Texture1Dsegment.hxx
|
||||
Graphic3d_Texture2D.cxx
|
||||
Graphic3d_Texture2D.hxx
|
||||
Graphic3d_Texture2Dmanual.cxx
|
||||
Graphic3d_Texture2Dmanual.hxx
|
||||
Graphic3d_Texture2Dplane.cxx
|
||||
Graphic3d_Texture2Dplane.hxx
|
||||
Graphic3d_Texture3D.cxx
|
||||
Graphic3d_Texture3D.hxx
|
||||
Graphic3d_TextureEnv.cxx
|
||||
Graphic3d_TextureEnv.hxx
|
||||
Graphic3d_TextureMap.cxx
|
||||
|
@@ -15,3 +15,40 @@
|
||||
#include <Graphic3d_CubeMap.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMap, Graphic3d_TextureMap)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_CubeMap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_CubeMap::Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
|
||||
Standard_Boolean theToGenerateMipmaps)
|
||||
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myZIsInverted (false)
|
||||
{
|
||||
myHasMipmaps = theToGenerateMipmaps;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_CubeMap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_CubeMap::Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap,
|
||||
Standard_Boolean theToGenerateMipmaps)
|
||||
: Graphic3d_TextureMap (thePixmap, Graphic3d_TypeOfTexture_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myZIsInverted (false)
|
||||
{
|
||||
myHasMipmaps = theToGenerateMipmaps;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Graphic3d_CubeMap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_CubeMap::~Graphic3d_CubeMap()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -26,24 +26,12 @@ class Graphic3d_CubeMap : public Graphic3d_TextureMap
|
||||
public:
|
||||
|
||||
//! Constructor defining loading cubemap from file.
|
||||
Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
|
||||
Standard_Boolean theToGenerateMipmaps = Standard_False) :
|
||||
Graphic3d_TextureMap (theFileName, Graphic3d_TOT_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myZIsInverted (false),
|
||||
myHasMipmaps (theToGenerateMipmaps)
|
||||
{}
|
||||
Standard_EXPORT Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
|
||||
Standard_Boolean theToGenerateMipmaps = Standard_False);
|
||||
|
||||
//! Constructor defining direct cubemap initialization from PixMap.
|
||||
Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
|
||||
Standard_Boolean theToGenerateMipmaps = Standard_False) :
|
||||
Graphic3d_TextureMap (thePixmap, Graphic3d_TOT_CUBEMAP),
|
||||
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||
myEndIsReached (false),
|
||||
myZIsInverted (false),
|
||||
myHasMipmaps (theToGenerateMipmaps)
|
||||
{}
|
||||
Standard_EXPORT Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
|
||||
Standard_Boolean theToGenerateMipmaps = Standard_False);
|
||||
|
||||
//! Returns whether the iterator has reached the end (true if it hasn't).
|
||||
Standard_Boolean More() const { return !myEndIsReached; }
|
||||
@@ -100,14 +88,13 @@ public:
|
||||
}
|
||||
|
||||
//! Empty destructor.
|
||||
~Graphic3d_CubeMap() {}
|
||||
Standard_EXPORT virtual ~Graphic3d_CubeMap();
|
||||
|
||||
protected:
|
||||
|
||||
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
|
||||
Standard_Boolean myEndIsReached; //!< Indicates whether end of iteration has been reached or hasn't
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
|
@@ -42,7 +42,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MediaTexture, Graphic3d_Texture2D)
|
||||
// ================================================================
|
||||
Graphic3d_MediaTexture::Graphic3d_MediaTexture (const Handle(Standard_HMutex)& theMutex,
|
||||
Standard_Integer thePlane)
|
||||
: Graphic3d_Texture2D ("", Graphic3d_TOT_2D),
|
||||
: Graphic3d_Texture2D ("", Graphic3d_TypeOfTexture_2D),
|
||||
myMutex (theMutex),
|
||||
myPlane (thePlane)
|
||||
{
|
||||
|
@@ -14,10 +14,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Graphic3d_Texture1Dmanual.hxx>
|
||||
#include <Graphic3d_TypeOfTextureMode.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
||||
@@ -27,7 +25,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D)
|
||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -37,7 +35,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiStr
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfTexture1D theNOT)
|
||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D)
|
||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -47,7 +45,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D)
|
||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -17,55 +17,27 @@
|
||||
#ifndef _Graphic3d_Texture1Dmanual_HeaderFile
|
||||
#define _Graphic3d_Texture1Dmanual_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_Texture1D.hxx>
|
||||
#include <Graphic3d_NameOfTexture1D.hxx>
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
class Graphic3d_Texture1Dmanual;
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
|
||||
|
||||
//! This class provides the implementation of a manual 1D texture.
|
||||
//! you MUST provides texture coordinates on your facets if you want to see your texture.
|
||||
//! you MUST provide texture coordinates on your facets if you want to see your texture.
|
||||
class Graphic3d_Texture1Dmanual : public Graphic3d_Texture1D
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a texture from the file FileName.
|
||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const TCollection_AsciiString& theFileName);
|
||||
|
||||
|
||||
//! Create a texture from a predefined texture name set.
|
||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const Graphic3d_NameOfTexture1D theNOT);
|
||||
|
||||
|
||||
//! Creates a texture from the pixmap.
|
||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Graphic3d_Texture1Dmanual_HeaderFile
|
||||
|
@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dsegment,Graphic3d_Texture1D)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D),
|
||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D),
|
||||
myX1 (0.0f),
|
||||
myY1 (0.0f),
|
||||
myZ1 (0.0f),
|
||||
@@ -47,7 +47,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiS
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTexture1D theNOT)
|
||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D),
|
||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D),
|
||||
myX1 (0.0f),
|
||||
myY1 (0.0f),
|
||||
myZ1 (0.0f),
|
||||
@@ -66,7 +66,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTe
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D),
|
||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D),
|
||||
myX1 (0.0f),
|
||||
myY1 (0.0f),
|
||||
myZ1 (0.0f),
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2D,Graphic3d_TextureMap)
|
||||
@@ -46,6 +47,20 @@ static const char *NameOfTexture2d_to_FileName[] =
|
||||
"2d_chess.rgba"
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_2D),
|
||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
myHasMipmaps = true;
|
||||
myParams->SetModulate (true);
|
||||
myParams->SetRepeat (true);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2D
|
||||
// purpose :
|
||||
@@ -55,6 +70,25 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFile
|
||||
: Graphic3d_TextureMap (theFileName, theType),
|
||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT)
|
||||
: Graphic3d_TextureMap (NameOfTexture2d_to_FileName[theNOT], Graphic3d_TypeOfTexture_2D),
|
||||
myName (theNOT)
|
||||
{
|
||||
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
|
||||
myTexId = TCollection_AsciiString ("Graphic3d_Texture2D_")
|
||||
+ NameOfTexture2d_to_FileName[theNOT];
|
||||
|
||||
myHasMipmaps = true;
|
||||
myParams->SetModulate (true);
|
||||
myParams->SetRepeat (true);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -71,6 +105,20 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT
|
||||
+ NameOfTexture2d_to_FileName[theNOT];
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_TextureMap (thePixMap, Graphic3d_TypeOfTexture_2D),
|
||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
myHasMipmaps = true;
|
||||
myParams->SetModulate (true);
|
||||
myParams->SetRepeat (true);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2D
|
||||
// purpose :
|
||||
@@ -80,6 +128,7 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixM
|
||||
: Graphic3d_TextureMap (thePixMap, theType),
|
||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -34,6 +34,18 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//! Creates a texture from a file.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2D (const TCollection_AsciiString& theFileName);
|
||||
|
||||
//! Creates a texture from a predefined texture name set.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT);
|
||||
|
||||
//! Creates a texture from the pixmap.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
//! Returns the name of the predefined textures or NOT_2D_UNKNOWN
|
||||
//! when the name is given as a filename.
|
||||
Standard_EXPORT Graphic3d_NameOfTexture2D Name() const;
|
||||
@@ -42,13 +54,6 @@ public:
|
||||
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
|
||||
Standard_EXPORT void SetImage (const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
//! Return true if mip-maps should be used.
|
||||
Standard_Boolean HasMipMaps() const { return myType == Graphic3d_TOT_2D_MIPMAP; }
|
||||
|
||||
//! Set if mip-maps should be used (generated if needed).
|
||||
//! Note that this method should be called before loading / using the texture.
|
||||
void SetMipMaps (const Standard_Boolean theToUse) { myType = theToUse ? Graphic3d_TOT_2D_MIPMAP : Graphic3d_TOT_2D; }
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName, const Graphic3d_TypeOfTexture theType);
|
||||
|
@@ -1,58 +0,0 @@
|
||||
// Created on: 1997-07-28
|
||||
// Created by: Pierre CHALAMET
|
||||
// Copyright (c) 1997-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.
|
||||
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <Graphic3d_TypeOfTextureMode.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2Dmanual,Graphic3d_Texture2D)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2Dmanual
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_Texture2D (theFileName, Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2Dmanual
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const Graphic3d_NameOfTexture2D theNOT)
|
||||
: Graphic3d_Texture2D (theNOT, Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture2Dmanual
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_Texture2D (thePixMap, Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
@@ -20,28 +20,7 @@
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Graphic3d_NameOfTexture2D.hxx>
|
||||
|
||||
//! This class defined a manual texture 2D
|
||||
//! facets MUST define texture coordinate
|
||||
//! if you want to see somethings on.
|
||||
class Graphic3d_Texture2Dmanual : public Graphic3d_Texture2D
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2Dmanual,Graphic3d_Texture2D)
|
||||
public:
|
||||
|
||||
//! Creates a texture from a file.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2Dmanual(const TCollection_AsciiString& theFileName);
|
||||
|
||||
//! Creates a texture from a predefined texture name set.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2Dmanual(const Graphic3d_NameOfTexture2D theNOT);
|
||||
|
||||
//! Creates a texture from the pixmap.
|
||||
//! MipMaps levels will be automatically generated if needed.
|
||||
Standard_EXPORT Graphic3d_Texture2Dmanual(const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dmanual, Graphic3d_Texture2D)
|
||||
Standard_DEPRECATED ("Deprecated alias to Graphic3d_Texture2D")
|
||||
typedef Graphic3d_Texture2D Graphic3d_Texture2Dmanual;
|
||||
|
||||
#endif // _Graphic3d_Texture2Dmanual_HeaderFile
|
||||
|
@@ -28,11 +28,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_Texture2D (theFileName, Graphic3d_TOT_2D_MIPMAP)
|
||||
: Graphic3d_Texture2D (theFileName)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||
@@ -43,11 +40,8 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiStrin
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTexture2D theNOT)
|
||||
: Graphic3d_Texture2D (theNOT, Graphic3d_TOT_2D_MIPMAP)
|
||||
: Graphic3d_Texture2D (theNOT)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||
@@ -58,11 +52,8 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTextur
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_Texture2D (thePixMap, Graphic3d_TOT_2D_MIPMAP)
|
||||
: Graphic3d_Texture2D (thePixMap)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetRepeat (Standard_True);
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||
|
127
src/Graphic3d/Graphic3d_Texture3D.cxx
Normal file
127
src/Graphic3d/Graphic3d_Texture3D.cxx
Normal file
@@ -0,0 +1,127 @@
|
||||
// Copyright (c) 2022 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 <Graphic3d_Texture3D.hxx>
|
||||
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Message.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture3D, Graphic3d_TextureMap)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture3D::Graphic3d_Texture3D (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_3D)
|
||||
{
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture3D::Graphic3d_Texture3D (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_TextureMap (thePixMap, Graphic3d_TypeOfTexture_3D)
|
||||
{
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Texture3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture3D::Graphic3d_Texture3D (const NCollection_Array1<TCollection_AsciiString>& theFiles)
|
||||
: Graphic3d_TextureMap ("", Graphic3d_TypeOfTexture_3D)
|
||||
{
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myPaths.Resize (theFiles.Lower(), theFiles.Upper(), false);
|
||||
myPaths.Assign (theFiles);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~Graphic3d_Texture3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Texture3D::~Graphic3d_Texture3D()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Texture3D::SetImage (const Handle(Image_PixMap)& thePixMap)
|
||||
{
|
||||
myPixMap = thePixMap;
|
||||
myPath = OSD_Path();
|
||||
|
||||
NCollection_Array1<TCollection_AsciiString> anArr;
|
||||
myPaths.Move (anArr);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Image_PixMap) Graphic3d_Texture3D::GetImage (const Handle(Image_SupportedFormats)& theSupported)
|
||||
{
|
||||
if (myPaths.IsEmpty()
|
||||
|| !myPixMap.IsNull())
|
||||
{
|
||||
return base_type::GetImage (theSupported);
|
||||
}
|
||||
|
||||
Handle(Image_PixMap) anImage3D;
|
||||
const Standard_Integer aNbSlices = myPaths.Length();
|
||||
for (Standard_Integer aSlice = 0; aSlice < aNbSlices; ++aSlice)
|
||||
{
|
||||
const TCollection_AsciiString& aSlicePath = myPaths[myPaths.Lower() + aSlice];
|
||||
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap();
|
||||
if (!anImage->Load (aSlicePath))
|
||||
{
|
||||
Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to load slice " << aSlice << " from '" << aSlicePath << "'";
|
||||
return Handle(Image_PixMap)();
|
||||
}
|
||||
|
||||
convertToCompatible (theSupported, anImage);
|
||||
if (anImage3D.IsNull())
|
||||
{
|
||||
myIsTopDown = anImage->IsTopDown();
|
||||
anImage3D = new Image_PixMap();
|
||||
anImage3D->SetTopDown (myIsTopDown);
|
||||
if (!anImage3D->InitTrash3D (anImage->Format(),
|
||||
NCollection_Vec3<Standard_Size> (anImage->SizeX(), anImage->SizeY(), aNbSlices),
|
||||
anImage->SizeRowBytes()))
|
||||
{
|
||||
Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to allocate 3D image " << (int )anImage->SizeX() << "x" << (int )anImage->SizeY() << "x" << aNbSlices;
|
||||
return Handle(Image_PixMap)();
|
||||
}
|
||||
}
|
||||
if (anImage->Format() != anImage3D->Format()
|
||||
|| anImage->SizeX() != anImage3D->SizeX()
|
||||
|| anImage->SizeY() != anImage3D->SizeY()
|
||||
|| anImage->SizeRowBytes() != anImage3D->SizeRowBytes())
|
||||
{
|
||||
Message::SendFail() << "Graphic3d_Texture3D::GetImage() slice " << aSlice << " from '" << aSlicePath << "' have different dimensions";
|
||||
return Handle(Image_PixMap)();
|
||||
}
|
||||
|
||||
memcpy (anImage3D->ChangeSlice (aSlice), anImage->Data(), anImage->SizeBytes());
|
||||
}
|
||||
|
||||
return anImage3D;
|
||||
}
|
51
src/Graphic3d/Graphic3d_Texture3D.hxx
Normal file
51
src/Graphic3d/Graphic3d_Texture3D.hxx
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2022 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 _Graphic3d_Texture3D_HeaderFile
|
||||
#define _Graphic3d_Texture3D_HeaderFile
|
||||
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
//! This abstract class for managing 3D textures.
|
||||
class Graphic3d_Texture3D : public Graphic3d_TextureMap
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture3D, Graphic3d_TextureMap)
|
||||
public:
|
||||
|
||||
//! Creates a texture from a file.
|
||||
Standard_EXPORT Graphic3d_Texture3D (const TCollection_AsciiString& theFileName);
|
||||
|
||||
//! Creates a texture from the pixmap.
|
||||
Standard_EXPORT Graphic3d_Texture3D (const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
//! Creates a texture from a file.
|
||||
Standard_EXPORT Graphic3d_Texture3D (const NCollection_Array1<TCollection_AsciiString>& theFiles);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~Graphic3d_Texture3D();
|
||||
|
||||
//! Assign new image to the texture.
|
||||
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
|
||||
Standard_EXPORT void SetImage (const Handle(Image_PixMap)& thePixMap);
|
||||
|
||||
//! Load and return image.
|
||||
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
NCollection_Array1<TCollection_AsciiString> myPaths;
|
||||
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_Texture3D_HeaderFile
|
@@ -42,9 +42,10 @@ static const char *NameOfTextureEnv_to_FileName[] =
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFileName)
|
||||
: Graphic3d_TextureRoot (theFileName, Graphic3d_TOT_2D_MIPMAP),
|
||||
: Graphic3d_TextureRoot (theFileName, Graphic3d_TypeOfTexture_2D),
|
||||
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
||||
{
|
||||
myHasMipmaps = true;
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||
@@ -56,9 +57,10 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFi
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv theNOT)
|
||||
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TOT_2D_MIPMAP),
|
||||
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TypeOfTexture_2D),
|
||||
myName (theNOT)
|
||||
{
|
||||
myHasMipmaps = true;
|
||||
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
|
||||
myTexId = TCollection_AsciiString ("Graphic3d_TextureEnv_")
|
||||
+ NameOfTextureEnv_to_FileName[theNOT];
|
||||
@@ -74,9 +76,10 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv the
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Handle(Image_PixMap)& thePixMap)
|
||||
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TOT_2D_MIPMAP),
|
||||
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TypeOfTexture_2D),
|
||||
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
||||
{
|
||||
myHasMipmaps = true;
|
||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||
|
@@ -92,9 +92,10 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const TCollection_AsciiString& the
|
||||
: myParams (new Graphic3d_TextureParams()),
|
||||
myPath (theFileName),
|
||||
myRevision (0),
|
||||
myType (theType),
|
||||
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
|
||||
myIsColorMap (true),
|
||||
myIsTopDown (true)
|
||||
myIsTopDown (true),
|
||||
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
generateId();
|
||||
}
|
||||
@@ -108,9 +109,10 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const Handle(Image_PixMap)& theP
|
||||
: myParams (new Graphic3d_TextureParams()),
|
||||
myPixMap (thePixMap),
|
||||
myRevision (0),
|
||||
myType (theType),
|
||||
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
|
||||
myIsColorMap (true),
|
||||
myIsTopDown (true)
|
||||
myIsTopDown (true),
|
||||
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
generateId();
|
||||
}
|
||||
|
@@ -113,6 +113,12 @@ public:
|
||||
//! Set flag indicating color nature of values within the texture.
|
||||
void SetColorMap (Standard_Boolean theIsColor) { myIsColorMap = theIsColor; }
|
||||
|
||||
//! Returns whether mipmaps should be generated or not.
|
||||
Standard_Boolean HasMipmaps() const { return myHasMipmaps; }
|
||||
|
||||
//! Sets whether to generate mipmaps or not.
|
||||
void SetMipmapsGeneration (Standard_Boolean theToGenerateMipmaps) { myHasMipmaps = theToGenerateMipmaps; }
|
||||
|
||||
//! Returns whether row's memory layout is top-down.
|
||||
Standard_Boolean IsTopDown() const { return myIsTopDown; }
|
||||
|
||||
@@ -148,7 +154,7 @@ protected:
|
||||
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
|
||||
|
||||
Standard_Boolean myHasMipmaps; //!< Indicates whether mipmaps should be generated or not
|
||||
|
||||
};
|
||||
|
||||
|
@@ -20,10 +20,26 @@
|
||||
//! Type of the texture file format.
|
||||
enum Graphic3d_TypeOfTexture
|
||||
{
|
||||
Graphic3d_TOT_1D,
|
||||
Graphic3d_TOT_2D,
|
||||
Graphic3d_TOT_2D_MIPMAP,
|
||||
Graphic3d_TOT_CUBEMAP
|
||||
//! 1D texture (array).
|
||||
//! Note that this texture type might be unsupported by graphics API (emulated by 2D texture with 1 pixel height).
|
||||
Graphic3d_TypeOfTexture_1D,
|
||||
|
||||
//! 2D texture (image plane).
|
||||
Graphic3d_TypeOfTexture_2D,
|
||||
|
||||
//! 3D texture (a set of image planes).
|
||||
Graphic3d_TypeOfTexture_3D,
|
||||
|
||||
//! Cubemap texture (6 image planes defining cube sides).
|
||||
Graphic3d_TypeOfTexture_CUBEMAP,
|
||||
|
||||
//! Obsolete type - Graphic3d_TextureRoot::SetMipmapsGeneration() should be used instead.
|
||||
Graphic3d_TOT_2D_MIPMAP,
|
||||
|
||||
// old aliases
|
||||
Graphic3d_TOT_1D = Graphic3d_TypeOfTexture_1D,
|
||||
Graphic3d_TOT_2D = Graphic3d_TypeOfTexture_2D,
|
||||
Graphic3d_TOT_CUBEMAP = Graphic3d_TypeOfTexture_CUBEMAP
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_TypeOfTexture_HeaderFile
|
||||
|
@@ -254,7 +254,7 @@ Standard_Boolean IGESControl_Writer::Write
|
||||
(const Standard_CString file, const Standard_Boolean fnes)
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (file, std::ios::out);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (file, std::ios::out | std::ios::binary);
|
||||
if (aStream.get() == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
|
@@ -102,7 +102,7 @@ static Handle(IGESData_FileProtocol) IGESProto;
|
||||
|
||||
if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::binary);
|
||||
if (aStream.get() == NULL)
|
||||
{
|
||||
ctx.CCheck(0)->AddFail("IGES File could not be created");
|
||||
|
@@ -66,6 +66,8 @@ namespace
|
||||
case FIT_RGBF: return Image_Format_RGBF;
|
||||
case FIT_RGBAF: return Image_Format_RGBAF;
|
||||
case FIT_FLOAT: return Image_Format_GrayF;
|
||||
case FIT_INT16:
|
||||
case FIT_UINT16: return Image_Format_Gray16;
|
||||
case FIT_BITMAP:
|
||||
{
|
||||
switch (theColorTypeFI)
|
||||
@@ -118,6 +120,8 @@ namespace
|
||||
case Image_Format_Gray:
|
||||
case Image_Format_Alpha:
|
||||
return FIT_BITMAP;
|
||||
case Image_Format_Gray16:
|
||||
return FIT_UINT16;
|
||||
default:
|
||||
return FIT_UNKNOWN;
|
||||
}
|
||||
@@ -304,6 +308,10 @@ namespace
|
||||
{
|
||||
return Image_Format_Gray;
|
||||
}
|
||||
else if (theFormat == GUID_WICPixelFormat16bppGray)
|
||||
{
|
||||
return Image_Format_Gray16;
|
||||
}
|
||||
return Image_Format_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -318,6 +326,7 @@ namespace
|
||||
case Image_Format_BGR: return GUID_WICPixelFormat24bppBGR;
|
||||
case Image_Format_Gray: return GUID_WICPixelFormat8bppGray;
|
||||
case Image_Format_Alpha: return GUID_WICPixelFormat8bppGray; // GUID_WICPixelFormat8bppAlpha
|
||||
case Image_Format_Gray16: return GUID_WICPixelFormat16bppGray;
|
||||
case Image_Format_GrayF: // GUID_WICPixelFormat32bppGrayFloat
|
||||
case Image_Format_AlphaF:
|
||||
case Image_Format_RGBAF: // GUID_WICPixelFormat128bppRGBAFloat
|
||||
@@ -1081,7 +1090,8 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
|
||||
{
|
||||
aFileFormat = GUID_ContainerFormatJpeg;
|
||||
}
|
||||
else if (aFileNameLower.EndsWith (".tiff"))
|
||||
else if (aFileNameLower.EndsWith (".tiff")
|
||||
|| aFileNameLower.EndsWith (".tif"))
|
||||
{
|
||||
aFileFormat = GUID_ContainerFormatTiff;
|
||||
}
|
||||
|
@@ -33,9 +33,11 @@ enum Image_Format
|
||||
Image_Format_BGRF, //!< same as RGBF but with different components order
|
||||
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane
|
||||
Image_Format_BGRAF, //!< same as RGBAF but with different components order
|
||||
Image_Format_RGF_half, //!< 2 half-floats (4-bytes) RG image plane
|
||||
Image_Format_GrayF_half, //!< 1 half-float (2-bytes) intensity of color
|
||||
Image_Format_RGF_half, //!< 2 half-floats (4-bytes) RG image plane
|
||||
Image_Format_RGBAF_half, //!< 4 half-floats (8-bytes) RGBA image plane
|
||||
Image_Format_Gray16, //!< 2 bytes per pixel (unsigned short integer), intensity of the color
|
||||
};
|
||||
enum { Image_Format_NB = Image_Format_RGBAF_half + 1 };
|
||||
enum { Image_Format_NB = Image_Format_Gray16 + 1 };
|
||||
|
||||
#endif // _Image_Format_HeaderFile
|
||||
|
@@ -62,8 +62,10 @@ namespace
|
||||
ImageFormatInfo(BGRF, 3, sizeof(float) * 3),
|
||||
ImageFormatInfo(RGBAF, 4, sizeof(float) * 4),
|
||||
ImageFormatInfo(BGRAF, 4, sizeof(float) * 4),
|
||||
ImageFormatInfo(GrayF_half, 1, sizeof(uint16_t) * 1),
|
||||
ImageFormatInfo(RGF_half, 2, sizeof(uint16_t) * 2),
|
||||
ImageFormatInfo(RGBAF_half, 4, sizeof(uint16_t) * 4),
|
||||
ImageFormatInfo(Gray16, 1, 2),
|
||||
CompressedImageFormatInfo(RGB_S3TC_DXT1, 3, 1), // DXT1 uses circa half a byte per pixel (64 bits per 4x4 block)
|
||||
CompressedImageFormatInfo(RGBA_S3TC_DXT1, 4, 1),
|
||||
CompressedImageFormatInfo(RGBA_S3TC_DXT3, 4, 1), // DXT3/5 uses circa 1 byte per pixel (128 bits per 4x4 block)
|
||||
@@ -71,7 +73,8 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMapData, NCollection_Buffer)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : DefaultAllocator
|
||||
@@ -150,6 +153,31 @@ void Image_PixMap::SetFormat (Image_Format thePixelFormat)
|
||||
myImgFormat = thePixelFormat;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitWrapper3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Image_PixMap::InitWrapper3D (Image_Format thePixelFormat,
|
||||
Standard_Byte* theDataPtr,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes)
|
||||
{
|
||||
Clear();
|
||||
myImgFormat = thePixelFormat;
|
||||
if (theSizeXYZ.x() == 0
|
||||
|| theSizeXYZ.y() == 0
|
||||
|| theSizeXYZ.z() == 0
|
||||
|| theDataPtr == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
||||
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
theSizeXYZ, theSizeRowBytes, theDataPtr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitWrapper
|
||||
// purpose :
|
||||
@@ -159,18 +187,32 @@ bool Image_PixMap::InitWrapper (Image_Format thePixelFormat,
|
||||
const Standard_Size theSizeX,
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes)
|
||||
{
|
||||
return InitWrapper3D (thePixelFormat, theDataPtr, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), theSizeRowBytes);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitTrash3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Image_PixMap::InitTrash3D (Image_Format thePixelFormat,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes)
|
||||
{
|
||||
Clear();
|
||||
myImgFormat = thePixelFormat;
|
||||
if ((theSizeX == 0) || (theSizeY == 0) || (theDataPtr == NULL))
|
||||
if (theSizeXYZ.x() == 0
|
||||
|| theSizeXYZ.y() == 0
|
||||
|| theSizeXYZ.z() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
||||
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
theSizeX, theSizeY, theSizeRowBytes, theDataPtr);
|
||||
return true;
|
||||
// use argument only if it greater
|
||||
const Standard_Size aSizeRowBytes = std::max (theSizeRowBytes, theSizeXYZ.x() * SizePixelBytes (thePixelFormat));
|
||||
myData.Init (DefaultAllocator(), Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
theSizeXYZ, aSizeRowBytes, NULL);
|
||||
return !myData.IsEmpty();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -182,33 +224,31 @@ bool Image_PixMap::InitTrash (Image_Format thePixelFormat,
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes)
|
||||
{
|
||||
Clear();
|
||||
myImgFormat = thePixelFormat;
|
||||
if ((theSizeX == 0) || (theSizeY == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// use argument only if it greater
|
||||
const Standard_Size aSizeRowBytes = std::max (theSizeRowBytes, theSizeX * SizePixelBytes (thePixelFormat));
|
||||
myData.Init (DefaultAllocator(), Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||
theSizeX, theSizeY, aSizeRowBytes, NULL);
|
||||
return !myData.IsEmpty();
|
||||
return InitTrash3D (thePixelFormat, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), theSizeRowBytes);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitZero
|
||||
// function : InitZero3D
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Image_PixMap::InitZero (Image_Format thePixelFormat,
|
||||
const Standard_Size theSizeX,
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes,
|
||||
const Standard_Byte theValue)
|
||||
bool Image_PixMap::InitZero3D (Image_Format thePixelFormat,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes,
|
||||
const Standard_Byte theValue)
|
||||
{
|
||||
if (!InitTrash (thePixelFormat, theSizeX, theSizeY, theSizeRowBytes))
|
||||
if (theSizeXYZ.z() > 1)
|
||||
{
|
||||
return false;
|
||||
if (!InitTrash3D (thePixelFormat, theSizeXYZ, theSizeRowBytes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!InitTrash (thePixelFormat, theSizeXYZ.x(), theSizeXYZ.y(), theSizeRowBytes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
memset (myData.ChangeData(), (int )theValue, SizeBytes());
|
||||
return true;
|
||||
@@ -225,12 +265,24 @@ bool Image_PixMap::InitCopy (const Image_PixMap& theCopy)
|
||||
// self-copying disallowed
|
||||
return false;
|
||||
}
|
||||
if (InitTrash (theCopy.myImgFormat, theCopy.SizeX(), theCopy.SizeY(), theCopy.SizeRowBytes()))
|
||||
|
||||
if (theCopy.SizeZ() > 1)
|
||||
{
|
||||
memcpy (myData.ChangeData(), theCopy.myData.Data(), theCopy.SizeBytes());
|
||||
return true;
|
||||
if (!InitTrash3D (theCopy.myImgFormat, theCopy.SizeXYZ(), theCopy.SizeRowBytes()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
if (!InitTrash (theCopy.myImgFormat, theCopy.SizeX(), theCopy.SizeY(), theCopy.SizeRowBytes()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (myData.ChangeData(), theCopy.myData.Data(), theCopy.SizeBytes());
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -241,75 +293,73 @@ void Image_PixMap::Clear()
|
||||
{
|
||||
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
||||
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (myImgFormat),
|
||||
0, 0, 0, NULL);
|
||||
NCollection_Vec3<Standard_Size> (0), 0, nullptr);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PixelColor
|
||||
// function : ColorFromRawPixel
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Standard_Boolean theToLinearize) const
|
||||
Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawValue,
|
||||
const Image_Format theFormat,
|
||||
const Standard_Boolean theToLinearize)
|
||||
{
|
||||
if (IsEmpty()
|
||||
|| theX < 0 || (Standard_Size )theX >= SizeX()
|
||||
|| theY < 0 || (Standard_Size )theY >= SizeY())
|
||||
{
|
||||
return Quantity_ColorRGBA (0.0f, 0.0f, 0.0f, 0.0f); // transparent
|
||||
}
|
||||
|
||||
switch (myImgFormat)
|
||||
switch (theFormat)
|
||||
{
|
||||
case Image_Format_GrayF:
|
||||
{
|
||||
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
|
||||
const Standard_ShortReal& aPixel = *reinterpret_cast<const Standard_ShortReal*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel, aPixel, aPixel, 1.0f)); // opaque
|
||||
}
|
||||
case Image_Format_AlphaF:
|
||||
{
|
||||
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
|
||||
const Standard_ShortReal& aPixel = *reinterpret_cast<const Standard_ShortReal*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (1.0f, 1.0f, 1.0f, aPixel));
|
||||
}
|
||||
case Image_Format_RGF:
|
||||
{
|
||||
const Image_ColorRGF& aPixel = Value<Image_ColorRGF> (theY, theX);
|
||||
const Image_ColorRGF& aPixel = *reinterpret_cast<const Image_ColorRGF*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), 0.0f, 1.0f));
|
||||
}
|
||||
case Image_Format_RGBAF:
|
||||
{
|
||||
const Image_ColorRGBAF& aPixel = Value<Image_ColorRGBAF> (theY, theX);
|
||||
const Image_ColorRGBAF& aPixel = *reinterpret_cast<const Image_ColorRGBAF*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
||||
}
|
||||
case Image_Format_BGRAF:
|
||||
{
|
||||
const Image_ColorBGRAF& aPixel = Value<Image_ColorBGRAF> (theY, theX);
|
||||
const Image_ColorBGRAF& aPixel = *reinterpret_cast<const Image_ColorBGRAF*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
||||
}
|
||||
case Image_Format_RGBF:
|
||||
{
|
||||
const Image_ColorRGBF& aPixel = Value<Image_ColorRGBF> (theY, theX);
|
||||
const Image_ColorRGBF& aPixel = *reinterpret_cast<const Image_ColorRGBF*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
|
||||
}
|
||||
case Image_Format_BGRF:
|
||||
{
|
||||
const Image_ColorBGRF& aPixel = Value<Image_ColorBGRF> (theY, theX);
|
||||
const Image_ColorBGRF& aPixel = *reinterpret_cast<const Image_ColorBGRF*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
|
||||
}
|
||||
case Image_Format_GrayF_half:
|
||||
{
|
||||
const uint16_t& aPixel = *reinterpret_cast<const uint16_t*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel), 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
case Image_Format_RGF_half:
|
||||
{
|
||||
const NCollection_Vec2<uint16_t>& aPixel = Value<NCollection_Vec2<uint16_t>> (theY, theX);
|
||||
const NCollection_Vec2<uint16_t>& aPixel = *reinterpret_cast<const NCollection_Vec2<uint16_t>*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.x()), ConvertFromHalfFloat (aPixel.y()), 0.0f, 1.0f));
|
||||
}
|
||||
case Image_Format_RGBAF_half:
|
||||
{
|
||||
const NCollection_Vec4<uint16_t>& aPixel = Value<NCollection_Vec4<uint16_t>> (theY, theX);
|
||||
const NCollection_Vec4<uint16_t>& aPixel = *reinterpret_cast<const NCollection_Vec4<uint16_t>*> (theRawValue);
|
||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.r()), ConvertFromHalfFloat (aPixel.g()),
|
||||
ConvertFromHalfFloat (aPixel.b()), ConvertFromHalfFloat (aPixel.a())));
|
||||
}
|
||||
case Image_Format_RGBA:
|
||||
{
|
||||
const Image_ColorRGBA& aPixel = Value<Image_ColorRGBA> (theY, theX);
|
||||
const Image_ColorRGBA& aPixel = *reinterpret_cast<const Image_ColorRGBA*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -319,7 +369,7 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGRA:
|
||||
{
|
||||
const Image_ColorBGRA& aPixel = Value<Image_ColorBGRA> (theY, theX);
|
||||
const Image_ColorBGRA& aPixel = *reinterpret_cast<const Image_ColorBGRA*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -329,7 +379,7 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGB32:
|
||||
{
|
||||
const Image_ColorRGB32& aPixel = Value<Image_ColorRGB32> (theY, theX);
|
||||
const Image_ColorRGB32& aPixel = *reinterpret_cast<const Image_ColorRGB32*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -338,7 +388,7 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGR32:
|
||||
{
|
||||
const Image_ColorBGR32& aPixel = Value<Image_ColorBGR32> (theY, theX);
|
||||
const Image_ColorBGR32& aPixel = *reinterpret_cast<const Image_ColorBGR32*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -347,7 +397,7 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGB:
|
||||
{
|
||||
const Image_ColorRGB& aPixel = Value<Image_ColorRGB> (theY, theX);
|
||||
const Image_ColorRGB& aPixel = *reinterpret_cast<const Image_ColorRGB*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -356,7 +406,7 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGR:
|
||||
{
|
||||
const Image_ColorBGR& aPixel = Value<Image_ColorBGR> (theY, theX);
|
||||
const Image_ColorBGR& aPixel = *reinterpret_cast<const Image_ColorBGR*> (theRawValue);
|
||||
return theToLinearize
|
||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||
@@ -365,14 +415,21 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_Gray:
|
||||
{
|
||||
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
|
||||
return Quantity_ColorRGBA (float(aPixel) / 255.0f, float(aPixel) / 255.0f, float(aPixel) / 255.0f, 1.0f); // opaque
|
||||
const Standard_Byte& aPixel = *reinterpret_cast<const Standard_Byte*> (theRawValue);
|
||||
const float anIntensity = float(aPixel) / 255.0f;
|
||||
return Quantity_ColorRGBA (anIntensity, anIntensity, anIntensity, 1.0f); // opaque
|
||||
}
|
||||
case Image_Format_Alpha:
|
||||
{
|
||||
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
|
||||
const Standard_Byte& aPixel = *reinterpret_cast<const Standard_Byte*> (theRawValue);
|
||||
return Quantity_ColorRGBA (1.0f, 1.0f, 1.0f, float(aPixel) / 255.0f);
|
||||
}
|
||||
case Image_Format_Gray16:
|
||||
{
|
||||
const uint16_t& aPixel = *reinterpret_cast<const uint16_t*> (theRawValue);
|
||||
const float anIntensity = float(aPixel) / 65535.0f;
|
||||
return Quantity_ColorRGBA (anIntensity, anIntensity, anIntensity, 1.0f); // opaque
|
||||
}
|
||||
case Image_Format_UNKNOWN:
|
||||
{
|
||||
break;
|
||||
@@ -384,44 +441,37 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPixelColor
|
||||
// function : ColorToRawPixel
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Quantity_ColorRGBA& theColor,
|
||||
const Standard_Boolean theToDeLinearize)
|
||||
void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
||||
const Image_Format theFormat,
|
||||
const Quantity_ColorRGBA& theColor,
|
||||
const Standard_Boolean theToDeLinearize)
|
||||
{
|
||||
if (IsEmpty()
|
||||
|| theX < 0 || Standard_Size(theX) >= SizeX()
|
||||
|| theY < 0 || Standard_Size(theY) >= SizeY())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const NCollection_Vec4<float>& aColor = theColor;
|
||||
switch (myImgFormat)
|
||||
switch (theFormat)
|
||||
{
|
||||
case Image_Format_GrayF:
|
||||
{
|
||||
ChangeValue<Standard_ShortReal> (theY, theX) = aColor.r();
|
||||
*reinterpret_cast<Standard_ShortReal*> (theRawValue) = aColor.r();
|
||||
return;
|
||||
}
|
||||
case Image_Format_AlphaF:
|
||||
{
|
||||
ChangeValue<Standard_ShortReal> (theY, theX) = aColor.a();
|
||||
*reinterpret_cast<Standard_ShortReal*> (theRawValue) = aColor.a();
|
||||
return;
|
||||
}
|
||||
case Image_Format_RGF:
|
||||
{
|
||||
Image_ColorRGF& aPixel = ChangeValue<Image_ColorRGF> (theY, theX);
|
||||
Image_ColorRGF& aPixel = *reinterpret_cast<Image_ColorRGF*> (theRawValue);
|
||||
aPixel.r() = aColor.r();
|
||||
aPixel.g() = aColor.g();
|
||||
return;
|
||||
}
|
||||
case Image_Format_RGBAF:
|
||||
{
|
||||
Image_ColorRGBAF& aPixel = ChangeValue<Image_ColorRGBAF> (theY, theX);
|
||||
Image_ColorRGBAF& aPixel = *reinterpret_cast<Image_ColorRGBAF*> (theRawValue);
|
||||
aPixel.r() = aColor.r();
|
||||
aPixel.g() = aColor.g();
|
||||
aPixel.b() = aColor.b();
|
||||
@@ -430,7 +480,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGRAF:
|
||||
{
|
||||
Image_ColorBGRAF& aPixel = ChangeValue<Image_ColorBGRAF> (theY, theX);
|
||||
Image_ColorBGRAF& aPixel = *reinterpret_cast<Image_ColorBGRAF*> (theRawValue);
|
||||
aPixel.r() = aColor.r();
|
||||
aPixel.g() = aColor.g();
|
||||
aPixel.b() = aColor.b();
|
||||
@@ -439,7 +489,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGBF:
|
||||
{
|
||||
Image_ColorRGBF& aPixel = ChangeValue<Image_ColorRGBF> (theY, theX);
|
||||
Image_ColorRGBF& aPixel = *reinterpret_cast<Image_ColorRGBF*> (theRawValue);
|
||||
aPixel.r() = aColor.r();
|
||||
aPixel.g() = aColor.g();
|
||||
aPixel.b() = aColor.b();
|
||||
@@ -447,22 +497,28 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGRF:
|
||||
{
|
||||
Image_ColorBGRF& aPixel = ChangeValue<Image_ColorBGRF> (theY, theX);
|
||||
Image_ColorBGRF& aPixel = *reinterpret_cast<Image_ColorBGRF*> (theRawValue);
|
||||
aPixel.r() = aColor.r();
|
||||
aPixel.g() = aColor.g();
|
||||
aPixel.b() = aColor.b();
|
||||
return;
|
||||
}
|
||||
case Image_Format_GrayF_half:
|
||||
{
|
||||
uint16_t& aPixel = *reinterpret_cast<uint16_t*> (theRawValue);
|
||||
aPixel = ConvertToHalfFloat (aColor.r());
|
||||
return;
|
||||
}
|
||||
case Image_Format_RGF_half:
|
||||
{
|
||||
NCollection_Vec2<uint16_t>& aPixel = ChangeValue<NCollection_Vec2<uint16_t>> (theY, theX);
|
||||
NCollection_Vec2<uint16_t>& aPixel = *reinterpret_cast<NCollection_Vec2<uint16_t>*> (theRawValue);
|
||||
aPixel.x() = ConvertToHalfFloat (aColor.r());
|
||||
aPixel.y() = ConvertToHalfFloat (aColor.g());
|
||||
return;
|
||||
}
|
||||
case Image_Format_RGBAF_half:
|
||||
{
|
||||
NCollection_Vec4<uint16_t>& aPixel = ChangeValue<NCollection_Vec4<uint16_t>> (theY, theX);
|
||||
NCollection_Vec4<uint16_t>& aPixel = *reinterpret_cast<NCollection_Vec4<uint16_t>*> (theRawValue);
|
||||
aPixel.r() = ConvertToHalfFloat (aColor.r());
|
||||
aPixel.g() = ConvertToHalfFloat (aColor.g());
|
||||
aPixel.b() = ConvertToHalfFloat (aColor.b());
|
||||
@@ -471,7 +527,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGBA:
|
||||
{
|
||||
Image_ColorRGBA& aPixel = ChangeValue<Image_ColorRGBA> (theY, theX);
|
||||
Image_ColorRGBA& aPixel = *reinterpret_cast<Image_ColorRGBA*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -489,7 +545,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGRA:
|
||||
{
|
||||
Image_ColorBGRA& aPixel = ChangeValue<Image_ColorBGRA> (theY, theX);
|
||||
Image_ColorBGRA& aPixel = *reinterpret_cast<Image_ColorBGRA*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -507,7 +563,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGB32:
|
||||
{
|
||||
Image_ColorRGB32& aPixel = ChangeValue<Image_ColorRGB32> (theY, theX);
|
||||
Image_ColorRGB32& aPixel = *reinterpret_cast<Image_ColorRGB32*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -525,7 +581,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGR32:
|
||||
{
|
||||
Image_ColorBGR32& aPixel = ChangeValue<Image_ColorBGR32> (theY, theX);
|
||||
Image_ColorBGR32& aPixel = *reinterpret_cast<Image_ColorBGR32*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -543,7 +599,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_RGB:
|
||||
{
|
||||
Image_ColorRGB& aPixel = ChangeValue<Image_ColorRGB> (theY, theX);
|
||||
Image_ColorRGB& aPixel = *reinterpret_cast<Image_ColorRGB*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -560,7 +616,7 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_BGR:
|
||||
{
|
||||
Image_ColorBGR& aPixel = ChangeValue<Image_ColorBGR> (theY, theX);
|
||||
Image_ColorBGR& aPixel = *reinterpret_cast<Image_ColorBGR*> (theRawValue);
|
||||
if (theToDeLinearize)
|
||||
{
|
||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||
@@ -577,12 +633,17 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||
}
|
||||
case Image_Format_Gray:
|
||||
{
|
||||
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(aColor.r() * 255.0f);
|
||||
*reinterpret_cast<Standard_Byte*>(theRawValue) = Standard_Byte(aColor.r() * 255.0f);
|
||||
return;
|
||||
}
|
||||
case Image_Format_Alpha:
|
||||
{
|
||||
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(aColor.a() * 255.0f);
|
||||
*reinterpret_cast<Standard_Byte*>(theRawValue) = Standard_Byte(aColor.a() * 255.0f);
|
||||
return;
|
||||
}
|
||||
case Image_Format_Gray16:
|
||||
{
|
||||
*reinterpret_cast<uint16_t*>(theRawValue) = uint16_t(aColor.r() * 65535.0f);
|
||||
return;
|
||||
}
|
||||
case Image_Format_UNKNOWN:
|
||||
@@ -607,18 +668,21 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
||||
{
|
||||
const bool toResetAlpha = theImage.Format() == Image_Format_BGR32
|
||||
|| theImage.Format() == Image_Format_RGB32;
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
Image_ColorRGBA& aPixel = theImage.ChangeValue<Image_ColorRGBA> (aRow, aCol);
|
||||
Image_ColorBGRA aPixelCopy = theImage.Value <Image_ColorBGRA> (aRow, aCol);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
if (toResetAlpha)
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
aPixel.a() = 255;
|
||||
Image_ColorRGBA& aPixel = theImage.ChangeValueXYZ<Image_ColorRGBA> (aCol, aRow, aSlice);
|
||||
Image_ColorBGRA aPixelCopy = theImage.ValueXYZ <Image_ColorBGRA> (aCol, aRow, aSlice);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
if (toResetAlpha)
|
||||
{
|
||||
aPixel.a() = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -627,15 +691,18 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
||||
case Image_Format_BGR:
|
||||
case Image_Format_RGB:
|
||||
{
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
Image_ColorRGB& aPixel = theImage.ChangeValue<Image_ColorRGB> (aRow, aCol);
|
||||
Image_ColorBGR aPixelCopy = theImage.Value <Image_ColorBGR> (aRow, aCol);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
Image_ColorRGB& aPixel = theImage.ChangeValueXYZ<Image_ColorRGB> (aCol, aRow, aSlice);
|
||||
Image_ColorBGR aPixelCopy = theImage.ValueXYZ <Image_ColorBGR> (aCol, aRow, aSlice);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -645,15 +712,18 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
||||
case Image_Format_BGRAF:
|
||||
case Image_Format_RGBAF:
|
||||
{
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
Image_ColorRGBF& aPixel = theImage.ChangeValue<Image_ColorRGBF> (aRow, aCol);
|
||||
Image_ColorBGRF aPixelCopy = theImage.Value <Image_ColorBGRF> (aRow, aCol);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
Image_ColorRGBF& aPixel = theImage.ChangeValueXYZ<Image_ColorRGBF> (aCol, aRow, aSlice);
|
||||
Image_ColorBGRF aPixelCopy = theImage.ValueXYZ <Image_ColorBGRF> (aCol, aRow, aSlice);
|
||||
aPixel.r() = aPixelCopy.r();
|
||||
aPixel.g() = aPixelCopy.g();
|
||||
aPixel.b() = aPixelCopy.b();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -673,14 +743,35 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
||||
case Image_Format_Gray:
|
||||
case Image_Format_Alpha:
|
||||
{
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
unsigned char& aPixel = theImage.ChangeValue<unsigned char> (aRow, aCol);
|
||||
if (aPixel != 0)
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
aPixel = 255;
|
||||
uint8_t& aPixel = theImage.ChangeValueXYZ<uint8_t> (aCol, aRow, aSlice);
|
||||
if (aPixel != 0)
|
||||
{
|
||||
aPixel = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Image_Format_Gray16:
|
||||
{
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
uint16_t& aPixel = theImage.ChangeValueXYZ<uint16_t> (aCol, aRow, aSlice);
|
||||
if (aPixel != 0)
|
||||
{
|
||||
aPixel = 65535;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,17 +784,20 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
||||
case Image_Format_RGBA:
|
||||
case Image_Format_BGRA:
|
||||
{
|
||||
const NCollection_Vec3<unsigned char> aWhite24 (255, 255, 255);
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
const NCollection_Vec3<uint8_t> aWhite24 (255, 255, 255);
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
NCollection_Vec3<unsigned char>& aPixel = theImage.ChangeValue< NCollection_Vec3<unsigned char> > (aRow, aCol);
|
||||
if (aPixel[0] != 0
|
||||
|| aPixel[1] != 0
|
||||
|| aPixel[2] != 0)
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
aPixel = aWhite24;
|
||||
NCollection_Vec3<uint8_t>& aPixel = theImage.ChangeValueXYZ< NCollection_Vec3<uint8_t> > (aCol, aRow, aSlice);
|
||||
if (aPixel[0] != 0
|
||||
|| aPixel[1] != 0
|
||||
|| aPixel[2] != 0)
|
||||
{
|
||||
aPixel = aWhite24;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,17 +806,21 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
||||
default:
|
||||
{
|
||||
const Quantity_ColorRGBA aWhiteRgba (1.0f, 1.0f, 1.0f, 1.0f);
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||
{
|
||||
const Quantity_ColorRGBA aPixelRgba = theImage.PixelColor (Standard_Integer(aCol), Standard_Integer(aRow));
|
||||
const NCollection_Vec4<float>& aPixel = aPixelRgba;
|
||||
if (aPixel[0] != 0.0f
|
||||
|| aPixel[1] != 0.0f
|
||||
|| aPixel[2] != 0.0f)
|
||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||
{
|
||||
theImage.SetPixelColor (int(aCol), int(aRow), aWhiteRgba);
|
||||
Standard_Byte* aRawPixel = theImage.ChangeRawValueXYZ (aCol, aRow, aSlice);
|
||||
const Quantity_ColorRGBA aPixelRgba = ColorFromRawPixel (aRawPixel, theImage.Format());
|
||||
const NCollection_Vec4<float>& aPixel = aPixelRgba;
|
||||
if (aPixel[0] != 0.0f
|
||||
|| aPixel[1] != 0.0f
|
||||
|| aPixel[2] != 0.0f)
|
||||
{
|
||||
ColorToRawPixel (aRawPixel, theImage.Format(), aWhiteRgba);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -732,7 +830,7 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitCopy
|
||||
// function : FlipY
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Image_PixMap::FlipY (Image_PixMap& theImage)
|
||||
@@ -753,13 +851,16 @@ bool Image_PixMap::FlipY (Image_PixMap& theImage)
|
||||
|
||||
// for odd height middle row should be left as is
|
||||
Standard_Size aNbRowsHalf = theImage.SizeY() / 2;
|
||||
for (Standard_Size aRowT = 0, aRowB = theImage.SizeY() - 1; aRowT < aNbRowsHalf; ++aRowT, --aRowB)
|
||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
||||
{
|
||||
Standard_Byte* aTop = theImage.ChangeRow (aRowT);
|
||||
Standard_Byte* aBot = theImage.ChangeRow (aRowB);
|
||||
memcpy (aTmp.ChangeData(), aTop, aRowSize);
|
||||
memcpy (aTop, aBot, aRowSize);
|
||||
memcpy (aBot, aTmp.Data(), aRowSize);
|
||||
for (Standard_Size aRowT = 0, aRowB = theImage.SizeY() - 1; aRowT < aNbRowsHalf; ++aRowT, --aRowB)
|
||||
{
|
||||
Standard_Byte* aTop = theImage.ChangeSliceRow (aSlice, aRowT);
|
||||
Standard_Byte* aBot = theImage.ChangeSliceRow (aSlice, aRowB);
|
||||
memcpy (aTmp.ChangeData(), aTop, aRowSize);
|
||||
memcpy (aTop, aBot, aRowSize);
|
||||
memcpy (aBot, aTmp.Data(), aRowSize);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -35,6 +35,9 @@ public:
|
||||
return !aUnion.myChar[0];
|
||||
}
|
||||
|
||||
//! Return bytes reserved for one pixel (may include extra bytes for alignment).
|
||||
Standard_EXPORT static Standard_Size SizePixelBytes (const Image_Format thePixelFormat);
|
||||
|
||||
//! Auxiliary method for swapping bytes between RGB and BGR formats.
|
||||
//! This method modifies the image data but does not change pixel format!
|
||||
//! Method will fail if pixel format is not one of the following:
|
||||
@@ -60,8 +63,28 @@ public:
|
||||
//! Return string representation of compressed pixel format.
|
||||
Standard_EXPORT static Standard_CString ImageFormatToString (Image_CompressedFormat theFormat);
|
||||
|
||||
//! Convert raw pixel value into Quantity_ColorRGBA. This function is relatively slow.
|
||||
//! @param[in] theRawValue pointer to pixel definition
|
||||
//! @param[in] theFormat pixel format
|
||||
//! @param[in] theToLinearize when TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
|
||||
//! @return the pixel color
|
||||
Standard_EXPORT static Quantity_ColorRGBA ColorFromRawPixel (const Standard_Byte* theRawValue,
|
||||
const Image_Format theFormat,
|
||||
const Standard_Boolean theToLinearize = false);
|
||||
|
||||
//! Set raw pixel value from Quantity_ColorRGBA. This function is relatively slow.
|
||||
//! @param[out] theRawValue pointer to pixel definition to modify
|
||||
//! @param[in] theFormat pixel format
|
||||
//! @param[in] theColor color value to convert from
|
||||
//! @param[in] theToDeLinearize when TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)
|
||||
Standard_EXPORT static void ColorToRawPixel (Standard_Byte* theRawValue,
|
||||
const Image_Format theFormat,
|
||||
const Quantity_ColorRGBA& theColor,
|
||||
const Standard_Boolean theToDeLinearize = false);
|
||||
|
||||
public: // high-level API
|
||||
|
||||
//! Return pixel format.
|
||||
Image_Format Format() const { return myImgFormat; }
|
||||
|
||||
//! Override pixel format specified by InitXXX() methods.
|
||||
@@ -70,41 +93,38 @@ public: // high-level API
|
||||
//! (e.g. ImgGray and ImgAlpha).
|
||||
Standard_EXPORT void SetFormat (const Image_Format thePixelFormat);
|
||||
|
||||
//! @return image width in pixels
|
||||
inline Standard_Size Width() const
|
||||
//! Return image width in pixels.
|
||||
Standard_Size Width() const { return myData.SizeX; }
|
||||
|
||||
//! Return image height in pixels.
|
||||
Standard_Size Height() const { return myData.SizeY; }
|
||||
|
||||
//! Return image depth in pixels.
|
||||
Standard_Size Depth() const { return myData.SizeZ; }
|
||||
|
||||
//! Return image width in pixels.
|
||||
Standard_Size SizeX() const { return myData.SizeX; }
|
||||
|
||||
//! Return image height in pixels.
|
||||
Standard_Size SizeY() const { return myData.SizeY; }
|
||||
|
||||
//! Return image depth in pixels.
|
||||
Standard_Size SizeZ() const { return myData.SizeZ; }
|
||||
|
||||
//! Return image width x height x depth in pixels.
|
||||
NCollection_Vec3<Standard_Size> SizeXYZ() const
|
||||
{
|
||||
return myData.SizeX;
|
||||
return NCollection_Vec3<Standard_Size> (myData.SizeX, myData.SizeY, myData.SizeZ);
|
||||
}
|
||||
|
||||
//! @return image height in pixels
|
||||
inline Standard_Size Height() const
|
||||
{
|
||||
return myData.SizeY;
|
||||
}
|
||||
|
||||
//! @return image width in pixels
|
||||
inline Standard_Size SizeX() const
|
||||
{
|
||||
return myData.SizeX;
|
||||
}
|
||||
|
||||
//! @return image height in pixels
|
||||
inline Standard_Size SizeY() const
|
||||
{
|
||||
return myData.SizeY;
|
||||
}
|
||||
|
||||
//! @return width / height.
|
||||
inline Standard_Real Ratio() const
|
||||
//! Return width / height.
|
||||
Standard_Real Ratio() const
|
||||
{
|
||||
return (SizeY() > 0) ? (Standard_Real(SizeX()) / Standard_Real(SizeY())) : 1.0;
|
||||
}
|
||||
|
||||
//! @return true if data is NULL.
|
||||
bool IsEmpty() const
|
||||
{
|
||||
return myData.IsEmpty();
|
||||
}
|
||||
//! Return true if data is NULL.
|
||||
bool IsEmpty() const { return myData.IsEmpty(); }
|
||||
|
||||
//! Empty constructor. Initialize the NULL image plane.
|
||||
Standard_EXPORT Image_PixMap();
|
||||
@@ -114,38 +134,60 @@ public: // high-level API
|
||||
|
||||
//! Returns the pixel color. This function is relatively slow.
|
||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||
//! @param theX [in] column index from left
|
||||
//! @param theY [in] row index from top
|
||||
//! @param theToLinearize [in] when TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
|
||||
//! @param[in] theX column index from left, starting from 0
|
||||
//! @param[in] theY row index from top, starting from 0
|
||||
//! @param[in] theToLinearize when TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
|
||||
//! @return the pixel color
|
||||
Standard_EXPORT Quantity_ColorRGBA PixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Standard_Boolean theToLinearize = Standard_False) const;
|
||||
Quantity_ColorRGBA PixelColor (Standard_Integer theX,
|
||||
Standard_Integer theY,
|
||||
Standard_Boolean theToLinearize = false) const
|
||||
{
|
||||
if (IsEmpty()
|
||||
|| theX < 0 || (Standard_Size )theX >= SizeX()
|
||||
|| theY < 0 || (Standard_Size )theY >= SizeY())
|
||||
{
|
||||
return Quantity_ColorRGBA (0.0f, 0.0f, 0.0f, 0.0f); // transparent
|
||||
}
|
||||
|
||||
const Standard_Byte* aRawPixel = RawValueXY (theX, theY);
|
||||
return ColorFromRawPixel (aRawPixel, myImgFormat, theToLinearize);
|
||||
}
|
||||
|
||||
//! Sets the pixel color. This function is relatively slow.
|
||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||
//! @param theX [in] column index from left
|
||||
//! @param theY [in] row index from top
|
||||
//! @param theColor [in] color to store
|
||||
//! @param theToDeLinearize [in] when TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)
|
||||
//! @param[in] theX column index from left
|
||||
//! @param[in] theY row index from top
|
||||
//! @param[in] theColor color to store
|
||||
//! @param[in] theToDeLinearize when TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)
|
||||
void SetPixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Quantity_Color& theColor,
|
||||
const Standard_Boolean theToDeLinearize = Standard_False)
|
||||
const Standard_Boolean theToDeLinearize = false)
|
||||
{
|
||||
SetPixelColor (theX, theY, Quantity_ColorRGBA (theColor, 1.0f), theToDeLinearize);
|
||||
}
|
||||
|
||||
//! Sets the pixel color. This function is relatively slow.
|
||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||
//! @param theX [in] column index from left
|
||||
//! @param theY [in] row index from top
|
||||
//! @param theColor [in] color to store
|
||||
//! @param theToDeLinearize [in] when TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)
|
||||
Standard_EXPORT void SetPixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Quantity_ColorRGBA& theColor,
|
||||
const Standard_Boolean theToDeLinearize = Standard_False);
|
||||
//! @param[in] theX column index from left
|
||||
//! @param[in] theY row index from top
|
||||
//! @param[in] theColor color to store
|
||||
//! @param[in] theToDeLinearize when TRUE, the gamma correction will be applied for storing in non-linear color space (e.g. Image_Format_RGB)
|
||||
void SetPixelColor (const Standard_Integer theX,
|
||||
const Standard_Integer theY,
|
||||
const Quantity_ColorRGBA& theColor,
|
||||
const Standard_Boolean theToDeLinearize = false)
|
||||
{
|
||||
if (IsEmpty()
|
||||
|| theX < 0 || Standard_Size(theX) >= SizeX()
|
||||
|| theY < 0 || Standard_Size(theY) >= SizeY())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Byte* aRawPixel = ChangeRawValueXY (theX, theY);
|
||||
ColorToRawPixel (aRawPixel, myImgFormat, theColor, theToDeLinearize);
|
||||
}
|
||||
|
||||
//! Initialize image plane as wrapper over alien data.
|
||||
//! Data will not be copied! Notice that caller should ensure
|
||||
@@ -170,15 +212,42 @@ public: // high-level API
|
||||
|
||||
//! Initialize image plane with required dimensions.
|
||||
//! Buffer will be zeroed (black color for most formats).
|
||||
Standard_EXPORT bool InitZero (Image_Format thePixelFormat,
|
||||
const Standard_Size theSizeX,
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes = 0,
|
||||
const Standard_Byte theValue = 0);
|
||||
bool InitZero (Image_Format thePixelFormat,
|
||||
const Standard_Size theSizeX,
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes = 0,
|
||||
const Standard_Byte theValue = 0)
|
||||
{
|
||||
return InitZero3D (thePixelFormat, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), theSizeRowBytes, theValue);
|
||||
}
|
||||
|
||||
//! Method correctly deallocate internal buffer.
|
||||
Standard_EXPORT virtual void Clear();
|
||||
|
||||
public:
|
||||
|
||||
//! Initialize 2D/3D image as wrapper over alien data.
|
||||
//! Data will not be copied! Notice that caller should ensure
|
||||
//! that data pointer will not be released during this wrapper lifetime.
|
||||
//! You may call InitCopy() to perform data copying.
|
||||
Standard_EXPORT virtual bool InitWrapper3D (Image_Format thePixelFormat,
|
||||
Standard_Byte* theDataPtr,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes = 0);
|
||||
|
||||
//! Initialize 2D/3D image with required dimensions.
|
||||
//! Memory will be left uninitialized (performance trick).
|
||||
Standard_EXPORT virtual bool InitTrash3D (Image_Format thePixelFormat,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes = 0);
|
||||
|
||||
//! Initialize 2D/3D image with required dimensions.
|
||||
//! Buffer will be zeroed (black color for most formats).
|
||||
Standard_EXPORT bool InitZero3D (Image_Format thePixelFormat,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes = 0,
|
||||
const Standard_Byte theValue = 0);
|
||||
|
||||
public: //! @name low-level API for batch-processing (pixels reading / comparison / modification)
|
||||
|
||||
//! Returns TRUE if image data is stored from Top to the Down.
|
||||
@@ -190,105 +259,106 @@ public: //! @name low-level API for batch-processing (pixels reading / compariso
|
||||
//! convert input row-index to apply this flag!
|
||||
//! You should use this flag only if interconnect with alien APIs and buffers.
|
||||
//! @return true if image data is top-down
|
||||
inline bool IsTopDown() const
|
||||
{
|
||||
return myData.TopToDown == 1;
|
||||
}
|
||||
bool IsTopDown() const { return myData.TopToDown == 1; }
|
||||
|
||||
//! Setup scanlines order in memory - top-down or bottom-up.
|
||||
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
||||
//! @param theIsTopDown top-down flag
|
||||
inline void SetTopDown (const bool theIsTopDown)
|
||||
{
|
||||
myData.SetTopDown (theIsTopDown);
|
||||
}
|
||||
void SetTopDown (const bool theIsTopDown) { myData.SetTopDown (theIsTopDown); }
|
||||
|
||||
//! Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.
|
||||
//! @return scanline increment for Top->Down iteration
|
||||
inline Standard_Size TopDownInc() const
|
||||
Standard_Size TopDownInc() const { return myData.TopToDown; }
|
||||
|
||||
//! Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||
const Standard_Byte* Data() const { return myData.Data(); }
|
||||
|
||||
//! Return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||
Standard_Byte* ChangeData() { return myData.ChangeData(); }
|
||||
|
||||
//! Return data pointer to requested row (first column).
|
||||
//! Indexation starts from 0.
|
||||
const Standard_Byte* Row (Standard_Size theRow) const { return myData.Row (theRow); }
|
||||
|
||||
//! Return data pointer to requested row (first column).
|
||||
//! Indexation starts from 0.
|
||||
Standard_Byte* ChangeRow (Standard_Size theRow) { return myData.ChangeRow (theRow); }
|
||||
|
||||
//! Return data pointer to requested 2D slice.
|
||||
//! Indexation starts from 0.
|
||||
const Standard_Byte* Slice (Standard_Size theSlice) const { return myData.Slice (theSlice); }
|
||||
|
||||
//! Return data pointer to requested 2D slice.
|
||||
//! Indexation starts from 0.
|
||||
Standard_Byte* ChangeSlice (Standard_Size theSlice) { return myData.ChangeSlice (theSlice); }
|
||||
|
||||
//! Return data pointer to requested row (first column).
|
||||
//! Indexation starts from 0.
|
||||
const Standard_Byte* SliceRow (Standard_Size theSlice,
|
||||
Standard_Size theRow) const
|
||||
{
|
||||
return myData.TopToDown;
|
||||
return myData.SliceRow (theSlice, theRow);
|
||||
}
|
||||
|
||||
//! @return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||
inline const Standard_Byte* Data() const
|
||||
//! Return data pointer to requested row (first column).
|
||||
//! Indexation starts from 0.
|
||||
Standard_Byte* ChangeSliceRow (Standard_Size theSlice,
|
||||
Standard_Size theRow)
|
||||
{
|
||||
return myData.Data();
|
||||
return myData.ChangeSliceRow (theSlice, theRow);
|
||||
}
|
||||
|
||||
//! @return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||
inline Standard_Byte* ChangeData()
|
||||
{
|
||||
return myData.ChangeData();
|
||||
}
|
||||
//! Return bytes reserved for one pixel (may include extra bytes for alignment).
|
||||
Standard_Size SizePixelBytes() const { return myData.SizeBPP; }
|
||||
|
||||
//! @return data pointer to requested row (first column).
|
||||
inline const Standard_Byte* Row (const Standard_Size theRow) const
|
||||
{
|
||||
return myData.Row (theRow);
|
||||
}
|
||||
|
||||
//! @return data pointer to requested row (first column).
|
||||
inline Standard_Byte* ChangeRow (const Standard_Size theRow)
|
||||
{
|
||||
return myData.ChangeRow (theRow);
|
||||
}
|
||||
|
||||
//! @return bytes reserved for one pixel (may include extra bytes for alignment).
|
||||
inline Standard_Size SizePixelBytes() const
|
||||
{
|
||||
return myData.SizeBPP;
|
||||
}
|
||||
|
||||
//! @return bytes reserved for one pixel (may include extra bytes for alignment).
|
||||
Standard_EXPORT static Standard_Size SizePixelBytes (const Image_Format thePixelFormat);
|
||||
|
||||
//! @return bytes reserved per row.
|
||||
//! Return bytes reserved per row.
|
||||
//! Could be larger than needed to store packed row (extra bytes for alignment etc.).
|
||||
inline Standard_Size SizeRowBytes() const
|
||||
{
|
||||
return myData.SizeRowBytes;
|
||||
}
|
||||
Standard_Size SizeRowBytes() const { return myData.SizeRowBytes; }
|
||||
|
||||
//! @return the extra bytes in the row.
|
||||
inline Standard_Size RowExtraBytes() const
|
||||
//! Return the extra bytes in the row.
|
||||
Standard_Size RowExtraBytes() const
|
||||
{
|
||||
return SizeRowBytes() - SizeX() * SizePixelBytes();
|
||||
}
|
||||
|
||||
//! Compute the maximal row alignment for current row size.
|
||||
//! @return maximal row alignment in bytes (up to 16 bytes).
|
||||
inline Standard_Size MaxRowAligmentBytes() const
|
||||
{
|
||||
return myData.MaxRowAligmentBytes();
|
||||
}
|
||||
Standard_Size MaxRowAligmentBytes() const { return myData.MaxRowAligmentBytes(); }
|
||||
|
||||
//! @return buffer size
|
||||
inline Standard_Size SizeBytes() const
|
||||
{
|
||||
return myData.Size();
|
||||
}
|
||||
//! Return number of bytes per 2D slice.
|
||||
Standard_Size SizeSliceBytes() const { return myData.SizeSliceBytes; }
|
||||
|
||||
//! Return buffer size
|
||||
Standard_Size SizeBytes() const { return myData.Size(); }
|
||||
|
||||
public:
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
|
||||
template <typename ColorType_t>
|
||||
inline const ColorType_t& Value (const Standard_Size theRow,
|
||||
const Standard_Size theCol) const
|
||||
const ColorType_t& Value (Standard_Size theRow,
|
||||
Standard_Size theCol) const
|
||||
{
|
||||
return *reinterpret_cast<const ColorType_t*>(myData.Value (theRow, theCol));
|
||||
}
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
|
||||
template <typename ColorType_t>
|
||||
inline ColorType_t& ChangeValue (const Standard_Size theRow,
|
||||
const Standard_Size theCol)
|
||||
ColorType_t& ChangeValue (Standard_Size theRow,
|
||||
Standard_Size theCol)
|
||||
{
|
||||
return *reinterpret_cast<ColorType_t* >(myData.ChangeValue (theRow, theCol));
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
|
||||
const Standard_Byte* RawValue (Standard_Size theRow,
|
||||
Standard_Size theCol) const
|
||||
{
|
||||
@@ -296,13 +366,105 @@ public: //! @name low-level API for batch-processing (pixels reading / compariso
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in the decreasing majority following memory layout - e.g. row first, column next.
|
||||
Standard_Byte* ChangeRawValue (Standard_Size theRow,
|
||||
Standard_Size theCol)
|
||||
{
|
||||
return myData.ChangeValue (theRow, theCol);
|
||||
}
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y order.
|
||||
template <typename ColorType_t>
|
||||
const ColorType_t& ValueXY (Standard_Size theX,
|
||||
Standard_Size theY) const
|
||||
{
|
||||
return *reinterpret_cast<const ColorType_t*>(myData.ValueXY (theX, theY));
|
||||
}
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y order.
|
||||
template <typename ColorType_t>
|
||||
ColorType_t& ChangeValueXY (Standard_Size theX,
|
||||
Standard_Size theY)
|
||||
{
|
||||
return *reinterpret_cast<ColorType_t* >(myData.ChangeValueXY (theX, theY));
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y order.
|
||||
const Standard_Byte* RawValueXY (Standard_Size theX,
|
||||
Standard_Size theY) const
|
||||
{
|
||||
return myData.ValueXY (theX, theY);
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y order.
|
||||
Standard_Byte* ChangeRawValueXY (Standard_Size theX,
|
||||
Standard_Size theY)
|
||||
{
|
||||
return myData.ChangeValueXY (theX, theY);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y, Z order.
|
||||
template <typename ColorType_t>
|
||||
const ColorType_t& ValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ) const
|
||||
{
|
||||
return *reinterpret_cast<const ColorType_t*>(myData.ValueXYZ (theX, theY, theZ));
|
||||
}
|
||||
|
||||
//! Access image pixel with specified color type.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y, Z order.
|
||||
template <typename ColorType_t>
|
||||
ColorType_t& ChangeValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ)
|
||||
{
|
||||
return *reinterpret_cast<ColorType_t* >(myData.ChangeValueXYZ (theX, theY, theZ));
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y, Z order.
|
||||
const Standard_Byte* RawValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ) const
|
||||
{
|
||||
return myData.ValueXYZ (theX, theY, theZ);
|
||||
}
|
||||
|
||||
//! Access image pixel as raw data pointer.
|
||||
//! Indexation starts from 0.
|
||||
//! This method does not perform any type checks - use on own risk (check Format() before)!
|
||||
//! WARNING: Input parameters are defined in traditional X, Y, Z order.
|
||||
Standard_Byte* ChangeRawValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ)
|
||||
{
|
||||
return myData.ChangeValueXYZ (theX, theY, theZ);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Convert 16-bit half-float value into 32-bit float (simple conversion).
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <Image_Color.hxx>
|
||||
#include <NCollection_Buffer.hxx>
|
||||
#include <NCollection_Vec3.hxx>
|
||||
|
||||
//! Structure to manage image buffer.
|
||||
class Image_PixMapData : public NCollection_Buffer
|
||||
@@ -31,7 +32,9 @@ public:
|
||||
SizeBPP (0),
|
||||
SizeX (0),
|
||||
SizeY (0),
|
||||
SizeZ (0),
|
||||
SizeRowBytes (0),
|
||||
SizeSliceBytes (0),
|
||||
TopToDown (Standard_Size(-1))
|
||||
{
|
||||
//
|
||||
@@ -44,16 +47,28 @@ public:
|
||||
const Standard_Size theSizeY,
|
||||
const Standard_Size theSizeRowBytes,
|
||||
Standard_Byte* theDataPtr)
|
||||
{
|
||||
return Init (theAlloc, theSizeBPP, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), theSizeRowBytes, theDataPtr);
|
||||
}
|
||||
|
||||
//! Initializer.
|
||||
bool Init (const Handle(NCollection_BaseAllocator)& theAlloc,
|
||||
const Standard_Size theSizeBPP,
|
||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
||||
const Standard_Size theSizeRowBytes,
|
||||
Standard_Byte* theDataPtr)
|
||||
{
|
||||
SetAllocator (theAlloc); // will free old data as well
|
||||
|
||||
myData = theDataPtr;
|
||||
myTopRowPtr = NULL;
|
||||
SizeBPP = theSizeBPP;
|
||||
SizeX = theSizeX;
|
||||
SizeY = theSizeY;
|
||||
SizeRowBytes = theSizeRowBytes != 0 ? theSizeRowBytes : (theSizeX * theSizeBPP);
|
||||
mySize = SizeRowBytes * SizeY;
|
||||
SizeX = theSizeXYZ.x();
|
||||
SizeY = theSizeXYZ.y();
|
||||
SizeZ = theSizeXYZ.z();
|
||||
SizeRowBytes = theSizeRowBytes != 0 ? theSizeRowBytes : (SizeX * theSizeBPP);
|
||||
SizeSliceBytes = SizeRowBytes * SizeY;
|
||||
mySize = SizeSliceBytes * SizeZ;
|
||||
if (myData == NULL)
|
||||
{
|
||||
Allocate (mySize);
|
||||
@@ -71,35 +86,93 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//! @return data pointer to requested row (first column).
|
||||
inline const Standard_Byte* Row (const Standard_Size theRow) const
|
||||
//! Return data pointer to requested row (first column).
|
||||
const Standard_Byte* Row (const Standard_Size theRow) const
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
||||
}
|
||||
|
||||
//! @return data pointer to requested row (first column).
|
||||
inline Standard_Byte* ChangeRow (const Standard_Size theRow)
|
||||
//! Return data pointer to requested row (first column).
|
||||
Standard_Byte* ChangeRow (const Standard_Size theRow)
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
||||
}
|
||||
|
||||
//! @return data pointer to requested position.
|
||||
inline const Standard_Byte* Value (const Standard_Size theRow,
|
||||
const Standard_Size theCol) const
|
||||
//! Return data pointer to requested position.
|
||||
const Standard_Byte* Value (const Standard_Size theRow,
|
||||
const Standard_Size theCol) const
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol;
|
||||
}
|
||||
|
||||
//! @return data pointer to requested position.
|
||||
inline Standard_Byte* ChangeValue (const Standard_Size theRow,
|
||||
const Standard_Size theCol)
|
||||
//! Return data pointer to requested position.
|
||||
Standard_Byte* ChangeValue (Standard_Size theRow,
|
||||
Standard_Size theCol)
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol;
|
||||
}
|
||||
|
||||
//! Return data pointer to requested position.
|
||||
const Standard_Byte* ValueXY (Standard_Size theX,
|
||||
Standard_Size theY) const
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX;
|
||||
}
|
||||
|
||||
//! Return data pointer to requested position.
|
||||
Standard_Byte* ChangeValueXY (Standard_Size theX,
|
||||
Standard_Size theY)
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Return data pointer to requested 2D slice.
|
||||
const Standard_Byte* Slice (Standard_Size theSlice) const
|
||||
{
|
||||
return myData + ptrdiff_t(SizeSliceBytes * theSlice);
|
||||
}
|
||||
|
||||
//! Return data pointer to requested 2D slice.
|
||||
Standard_Byte* ChangeSlice (Standard_Size theSlice)
|
||||
{
|
||||
return myData + ptrdiff_t(SizeSliceBytes * theSlice);
|
||||
}
|
||||
|
||||
//! Return data pointer to requested row (first column).
|
||||
const Standard_Byte* SliceRow (Standard_Size theSlice,
|
||||
Standard_Size theRow) const
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + ptrdiff_t(SizeSliceBytes * theSlice);
|
||||
}
|
||||
|
||||
//! Return data pointer to requested row (first column).
|
||||
Standard_Byte* ChangeSliceRow (Standard_Size theSlice,
|
||||
Standard_Size theRow)
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + ptrdiff_t(SizeSliceBytes * theSlice);
|
||||
}
|
||||
|
||||
//! Return data pointer to requested position.
|
||||
const Standard_Byte* ValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ) const
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX + ptrdiff_t(SizeSliceBytes * theZ);
|
||||
}
|
||||
|
||||
//! Return data pointer to requested position.
|
||||
Standard_Byte* ChangeValueXYZ (Standard_Size theX,
|
||||
Standard_Size theY,
|
||||
Standard_Size theZ)
|
||||
{
|
||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theY * TopToDown) + SizeBPP * theX + ptrdiff_t(SizeSliceBytes * theZ);
|
||||
}
|
||||
|
||||
//! Compute the maximal row alignment for current row size.
|
||||
//! @return maximal row alignment in bytes (up to 16 bytes).
|
||||
inline Standard_Size MaxRowAligmentBytes() const
|
||||
Standard_Size MaxRowAligmentBytes() const
|
||||
{
|
||||
Standard_Size anAlignment = 2;
|
||||
for (; anAlignment <= 16; anAlignment <<= 1)
|
||||
@@ -115,7 +188,7 @@ public:
|
||||
//! Setup scanlines order in memory - top-down or bottom-up.
|
||||
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
||||
//! @param theIsTopDown top-down flag
|
||||
inline void SetTopDown (const bool theIsTopDown)
|
||||
void SetTopDown (const bool theIsTopDown)
|
||||
{
|
||||
TopToDown = (theIsTopDown ? 1 : Standard_Size(-1));
|
||||
myTopRowPtr = ((TopToDown == 1 || myData == NULL)
|
||||
@@ -128,16 +201,17 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
Standard_Size SizeBPP; //!< bytes per pixel
|
||||
Standard_Size SizeX; //!< width in pixels
|
||||
Standard_Size SizeY; //!< height in pixels
|
||||
Standard_Size SizeRowBytes; //!< number of bytes per line (in most cases equal to 3 * sizeX)
|
||||
Standard_Size TopToDown; //!< image scanlines direction in memory from Top to the Down
|
||||
|
||||
Standard_Size SizeBPP; //!< bytes per pixel
|
||||
Standard_Size SizeX; //!< width in pixels
|
||||
Standard_Size SizeY; //!< height in pixels
|
||||
Standard_Size SizeZ; //!< depth in pixels
|
||||
Standard_Size SizeRowBytes; //!< number of bytes per line (in most cases equal to 3 * sizeX)
|
||||
Standard_Size SizeSliceBytes; //!< number of bytes per 2D slice
|
||||
Standard_Size TopToDown; //!< image scanlines direction in memory from Top to the Down
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(Image_PixMapData,NCollection_Buffer) // Type definition
|
||||
DEFINE_STANDARD_RTTIEXT(Image_PixMapData, NCollection_Buffer)
|
||||
|
||||
};
|
||||
|
||||
|
@@ -433,10 +433,32 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
if(aStep < Epsilon(theLPar))
|
||||
break;
|
||||
|
||||
Standard_Boolean isStepReduced = Standard_False;
|
||||
Standard_Real aLPar = theLPar;
|
||||
|
||||
for (Standard_Integer i = aVertexParams.Lower(); i <= aVertexParams.Upper(); i++)
|
||||
{
|
||||
if (hasVertexBeenChecked(i))
|
||||
continue;
|
||||
|
||||
aLPar = aVertexParams(i);
|
||||
if (Abs(aLPar - aParameter) < aPrmTol)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((aStep - (aLPar - aParameter) > aPrmTol) &&
|
||||
(Abs(aLPar - aParameter) > aPrmTol))
|
||||
{
|
||||
aStep = Max((aLPar - aParameter) / 5, 1.e-5);
|
||||
isStepReduced = Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer aNewVertID = 0;
|
||||
aLinOn2S = new IntSurf_LineOn2S;
|
||||
|
||||
const Standard_Real aStepMin = 0.1*aStep, aStepMax = 10.0*aStep;
|
||||
Standard_Real aStepMin = 0.1 * aStep, aStepMax = 10.0 * aStep;
|
||||
|
||||
Standard_Boolean isLast = Standard_False;
|
||||
Standard_Real aPrevParam = aParameter;
|
||||
@@ -586,8 +608,12 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
{
|
||||
if (isPointValid)
|
||||
{
|
||||
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
||||
aStepMin, aStepMax, myTol3D, aStep);
|
||||
if (!isStepReduced)
|
||||
{
|
||||
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
||||
aStepMin, aStepMax, myTol3D, aStep);
|
||||
}
|
||||
|
||||
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
||||
aPrevLPoint = aPOn2S;
|
||||
}
|
||||
@@ -694,6 +720,38 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
|
||||
if ((aPrePointExist != IntPatch_SPntNone) && (aLinOn2S->NbPoints() > 1))
|
||||
break;
|
||||
|
||||
if (isStepReduced)
|
||||
{
|
||||
isStepReduced = Standard_False;
|
||||
|
||||
aStep = (theLPar - aParameter) / (Standard_Real)(myNbPointsInWline - 1);
|
||||
if(aStep < Epsilon(theLPar))
|
||||
break;
|
||||
|
||||
aLPar = aVertexParams(aNbVert);
|
||||
for (Standard_Integer i = aVertexParams.Lower(); i <= aVertexParams.Upper(); i++)
|
||||
{
|
||||
if (hasVertexBeenChecked(i))
|
||||
continue;
|
||||
|
||||
aLPar = aVertexParams(i);
|
||||
if (Abs(aLPar - aParameter) < aPrmTol)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ((aStep - (aLPar - aParameter) > aPrmTol) &&
|
||||
(Abs(aLPar - aParameter) > aPrmTol))
|
||||
{
|
||||
aStep = Max((aLPar - aParameter) / 5, 1.e-5);
|
||||
isStepReduced = Standard_True;
|
||||
}
|
||||
|
||||
aStepMin = 0.1 * aStep;
|
||||
aStepMax = 10.0 * aStep;
|
||||
}
|
||||
}//for(; !isLast; aParameter += aStep)
|
||||
|
||||
if(aLinOn2S->NbPoints() < 2)
|
||||
|
@@ -1717,6 +1717,38 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsNeedSkipWL
|
||||
//purpose : Detect is WLine need to skip.
|
||||
//=======================================================================
|
||||
static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
|
||||
const Bnd_Box2d& theBoxS1,
|
||||
const Bnd_Box2d& theBoxS2,
|
||||
const Standard_Real* const theArrPeriods)
|
||||
{
|
||||
Standard_Real aFirstp, aLastp;
|
||||
Standard_Integer aNbVtx = theWL->NbVertex();
|
||||
Standard_Boolean isNeedSkip = Standard_True;
|
||||
|
||||
for (Standard_Integer i = 1; i < aNbVtx; i++) {
|
||||
aFirstp = theWL->Vertex (i).ParameterOnLine();
|
||||
aLastp = theWL->Vertex (i + 1).ParameterOnLine();
|
||||
|
||||
Standard_Real aU1, aV1, aU2, aV2;
|
||||
const Standard_Integer pmid = (Standard_Integer)((aFirstp + aLastp) / 2);
|
||||
const IntSurf_PntOn2S& aPmid = theWL->Point (pmid);
|
||||
aPmid.Parameters (aU1, aV1, aU2, aV2);
|
||||
|
||||
if (!IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
|
||||
{
|
||||
isNeedSkip = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isNeedSkip;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtendTwoWLines
|
||||
//purpose : Performs extending theWLine1 and theWLine2 through their
|
||||
@@ -1737,8 +1769,17 @@ void IntPatch_WLineTool::
|
||||
|
||||
gp_Vec aVec1, aVec2, aVec3;
|
||||
|
||||
unsigned int hasBeenJoinedCounter = 0;
|
||||
|
||||
for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
|
||||
{
|
||||
if (hasBeenJoinedCounter > 0)
|
||||
{
|
||||
aNumOfLine1--;
|
||||
}
|
||||
|
||||
hasBeenJoinedCounter = 0;
|
||||
|
||||
Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::
|
||||
DownCast(theSlin.Value(aNumOfLine1)));
|
||||
|
||||
@@ -1761,6 +1802,11 @@ void IntPatch_WLineTool::
|
||||
const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
|
||||
const IntSurf_PntOn2S& aPntLm1WL1 = aWLine1->Point(aNbPntsWL1-1);
|
||||
|
||||
if (IsNeedSkipWL(aWLine1, theBoxS1, theBoxS2, theArrPeriods))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Enable/Disable of some ckeck. Bit-mask is used for it.
|
||||
//E.g. if 1st point of aWLine1 matches with
|
||||
//1st point of aWLine2 then we do not need in check
|
||||
@@ -1781,16 +1827,24 @@ void IntPatch_WLineTool::
|
||||
const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
|
||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aWLine2->NbPnts());
|
||||
|
||||
if( aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntFWL1.IsSame(aPntLWL2, theToler3D) )
|
||||
if (!(aPntFWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
||||
!(aPntFWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
||||
if (aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntFWL1.IsSame(aPntLWL2, theToler3D))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
||||
}
|
||||
}
|
||||
|
||||
if( aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntLWL1.IsSame(aPntFWL2, theToler3D))
|
||||
if (!(aPntLWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
||||
!(aPntLWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
||||
if (aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||
aPntLWL1.IsSame(aPntLWL2, theToler3D))
|
||||
{
|
||||
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
||||
}
|
||||
}
|
||||
|
||||
if (!theListOfCriticalPoints.IsEmpty())
|
||||
@@ -1862,8 +1916,13 @@ void IntPatch_WLineTool::
|
||||
|
||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
|
||||
const IntSurf_PntOn2S& aPntLm1WL2 = aWLine2->Point(aNbPntsWL2-1);
|
||||
|
||||
//if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
||||
|
||||
if (IsNeedSkipWL(aWLine2, theBoxS1, theBoxS2, theArrPeriods))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
||||
{// First/First
|
||||
aVec1.SetXYZ(aPntFp1WL1.Value().XYZ() - aPntFWL1.Value().XYZ());
|
||||
aVec2.SetXYZ(aPntFWL2.Value().XYZ() - aPntFp1WL2.Value().XYZ());
|
||||
@@ -1909,6 +1968,7 @@ void IntPatch_WLineTool::
|
||||
|
||||
if(hasBeenJoined)
|
||||
{
|
||||
hasBeenJoinedCounter++;
|
||||
theSlin.Remove(aNumOfLine2);
|
||||
aNumOfLine2--;
|
||||
}
|
||||
|
@@ -56,6 +56,8 @@ Image_Format Media_Frame::FormatFFmpeg2Occt (int theFormat)
|
||||
return Image_Format_BGR;
|
||||
case AV_PIX_FMT_GRAY8:
|
||||
return Image_Format_Gray;
|
||||
case AV_PIX_FMT_GRAY16:
|
||||
return Image_Format_Gray16;
|
||||
default:
|
||||
return Image_Format_UNKNOWN;
|
||||
}
|
||||
@@ -90,6 +92,8 @@ int Media_Frame::FormatOcct2FFmpeg (Image_Format theFormat)
|
||||
return AV_PIX_FMT_GRAY8;
|
||||
case Image_Format_Alpha:
|
||||
return AV_PIX_FMT_GRAY8;
|
||||
case Image_Format_Gray16:
|
||||
return AV_PIX_FMT_GRAY16;
|
||||
case Image_Format_GrayF:
|
||||
case Image_Format_AlphaF:
|
||||
case Image_Format_RGF:
|
||||
@@ -97,6 +101,7 @@ int Media_Frame::FormatOcct2FFmpeg (Image_Format theFormat)
|
||||
case Image_Format_RGBF:
|
||||
case Image_Format_BGRAF:
|
||||
case Image_Format_BGRF:
|
||||
case Image_Format_GrayF_half:
|
||||
case Image_Format_RGF_half:
|
||||
case Image_Format_RGBAF_half:
|
||||
case Image_Format_UNKNOWN:
|
||||
|
@@ -70,9 +70,10 @@ class MeshVS_ImageTexture2D : public Graphic3d_Texture2D
|
||||
{
|
||||
public:
|
||||
|
||||
MeshVS_ImageTexture2D (const Handle(Image_PixMap)& theImg) : Graphic3d_Texture2D (theImg, Graphic3d_TOT_2D)
|
||||
MeshVS_ImageTexture2D (const Handle(Image_PixMap)& theImg)
|
||||
: Graphic3d_Texture2D (theImg, Graphic3d_TypeOfTexture_2D)
|
||||
{
|
||||
myParams->SetModulate (Standard_True);
|
||||
myParams->SetModulate (true);
|
||||
myParams->SetFilter (Graphic3d_TOTF_BILINEAR);
|
||||
}
|
||||
|
||||
@@ -81,9 +82,6 @@ public:
|
||||
DEFINE_STANDARD_RTTI_INLINE(MeshVS_ImageTexture2D,Graphic3d_Texture2D)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (MeshVS_ImageTexture2D, Graphic3d_Texture2D)
|
||||
|
||||
|
||||
//================================================================
|
||||
// Function : getNearestPow2
|
||||
// Purpose : Returns the nearest power of two greater than the
|
||||
|
@@ -261,13 +261,13 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (!hadAlreadyRGBA)
|
||||
{
|
||||
aSprite->Init (theCtx, *anImage, Graphic3d_TOT_2D, true);
|
||||
aSprite->Init (theCtx, *anImage, Graphic3d_TypeOfTexture_2D, true);
|
||||
}
|
||||
if (!hadAlreadyAlpha)
|
||||
{
|
||||
if (Handle(Image_PixMap) anImageA = aSprite->GetFormat() != GL_ALPHA ? aNewMarkerImage->GetImageAlpha() : Handle(Image_PixMap)())
|
||||
{
|
||||
aSpriteA->Init (theCtx, *anImageA, Graphic3d_TOT_2D, true);
|
||||
aSpriteA->Init (theCtx, *anImageA, Graphic3d_TypeOfTexture_2D, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -176,6 +176,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
extDrawBuffers (Standard_False),
|
||||
extGS (NULL),
|
||||
extBgra(Standard_False),
|
||||
extTexR16(Standard_False),
|
||||
extAnis(Standard_False),
|
||||
extPDS (Standard_False),
|
||||
atiMem (Standard_False),
|
||||
@@ -1552,6 +1553,10 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
mySupportedFormats->Add (Image_Format_BGR32);
|
||||
mySupportedFormats->Add (Image_Format_BGRA);
|
||||
}
|
||||
if (extTexR16)
|
||||
{
|
||||
mySupportedFormats->Add (Image_Format_Gray16);
|
||||
}
|
||||
if (arbTexFloat)
|
||||
{
|
||||
mySupportedFormats->Add (Image_Format_GrayF);
|
||||
@@ -1567,6 +1572,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
mySupportedFormats->Add (Image_Format_RGF);
|
||||
if (hasHalfFloatBuffer != OpenGl_FeatureNotAvailable)
|
||||
{
|
||||
mySupportedFormats->Add (Image_Format_GrayF_half);
|
||||
mySupportedFormats->Add (Image_Format_RGF_half);
|
||||
}
|
||||
}
|
||||
@@ -2130,13 +2136,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
|
||||
myTextureRgbaWhite = new OpenGl_Texture();
|
||||
Image_PixMap anImage;
|
||||
anImage.InitZero (Image_Format_RGBA, 2, 2, 0, (Standard_Byte )0);
|
||||
if (!myTextureRgbaBlack->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TOT_2D, &anImage))
|
||||
if (!myTextureRgbaBlack->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TypeOfTexture_2D, &anImage))
|
||||
{
|
||||
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Error: unable to create unit mock PBR texture map.");
|
||||
}
|
||||
anImage.InitZero (Image_Format_RGBA, 2, 2, 0, (Standard_Byte )255);
|
||||
if (!myTextureRgbaWhite->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TOT_2D, &anImage))
|
||||
if (!myTextureRgbaWhite->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TypeOfTexture_2D, &anImage))
|
||||
{
|
||||
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Error: unable to create normal mock PBR texture map.");
|
||||
|
@@ -1069,6 +1069,7 @@ public: //! @name extensions
|
||||
Standard_Boolean extDrawBuffers; //!< GL_EXT_draw_buffers
|
||||
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
||||
Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
|
||||
Standard_Boolean extTexR16; //!< GL_EXT_texture_norm16 on OpenGL ES; always available on desktop
|
||||
Standard_Boolean extAnis; //!< GL_EXT_texture_filter_anisotropic
|
||||
Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
|
||||
Standard_Boolean atiMem; //!< GL_ATI_meminfo
|
||||
|
@@ -147,7 +147,7 @@ bool OpenGl_Font::createTexture (const Handle(OpenGl_Context)& theCtx)
|
||||
|
||||
Image_PixMap aBlackImg;
|
||||
if (!aBlackImg.InitZero (Image_Format_Alpha, Standard_Size(aTextureSizeX), Standard_Size(aTextureSizeY))
|
||||
|| !aTexture->Init (theCtx, aBlackImg, Graphic3d_TOT_2D, true)) // myTextureFormat
|
||||
|| !aTexture->Init (theCtx, aBlackImg, Graphic3d_TypeOfTexture_2D, true)) // myTextureFormat
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("New texture initialization of size ")
|
||||
|
@@ -277,7 +277,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
||||
if (!aFormat.IsValid()
|
||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
Release (theGlContext.get());
|
||||
return Standard_False;
|
||||
@@ -415,7 +415,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
||||
if (!aFormat.IsValid()
|
||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
@@ -426,7 +426,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
// instead of just trying to create such texture
|
||||
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, myDepthFormat);
|
||||
if (aDepthFormat.IsValid()
|
||||
&& !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||
&& !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Warning! Depth textures are not supported by hardware!");
|
||||
@@ -983,6 +983,17 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
|
||||
aType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
}
|
||||
case Image_Format_Gray16:
|
||||
{
|
||||
if (theGlCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
aFormat = theBufferType == Graphic3d_BT_Depth ? GL_DEPTH_COMPONENT : GL_RED;
|
||||
aType = GL_UNSIGNED_SHORT;
|
||||
break;
|
||||
}
|
||||
case Image_Format_GrayF:
|
||||
{
|
||||
if (theGlCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||
@@ -1090,6 +1101,7 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
|
||||
case Image_Format_Alpha:
|
||||
case Image_Format_AlphaF:
|
||||
return Standard_False; // GL_ALPHA is no more supported in core context
|
||||
case Image_Format_GrayF_half:
|
||||
case Image_Format_RGF_half:
|
||||
case Image_Format_UNKNOWN:
|
||||
return Standard_False;
|
||||
|
@@ -1733,6 +1733,7 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
|
||||
theCtx.arbTexRG = isGlGreaterEqualShort (3, 0)
|
||||
|| checkExtensionShort ("GL_EXT_texture_rg");
|
||||
theCtx.extBgra = checkExtensionShort ("GL_EXT_texture_format_BGRA8888");
|
||||
theCtx.extTexR16 = checkExtensionShort ("GL_EXT_texture_norm16");
|
||||
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
||||
theCtx.extPDS = isGlGreaterEqualShort (3, 0)
|
||||
|| checkExtensionShort ("GL_OES_packed_depth_stencil");
|
||||
@@ -2160,6 +2161,7 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
|
||||
|| checkExtensionShort ("NV_depth_clamp");
|
||||
theCtx.extBgra = isGlGreaterEqualShort (1, 2)
|
||||
|| checkExtensionShort ("GL_EXT_bgra");
|
||||
theCtx.extTexR16 = true;
|
||||
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
||||
theCtx.extPDS = checkExtensionShort ("GL_EXT_packed_depth_stencil");
|
||||
theCtx.atiMem = checkExtensionShort ("GL_ATI_meminfo");
|
||||
|
@@ -333,6 +333,9 @@ typedef double GLclampd;
|
||||
#define GL_RGB8 0x8051
|
||||
#define GL_RGBA8 0x8058
|
||||
|
||||
// only in desktop OpenGL
|
||||
#define GL_LUMINANCE16 0x8042
|
||||
|
||||
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
|
||||
#define GL_LUMINANCE8 0x8040
|
||||
// GL_EXT_texture_format_BGRA8888
|
||||
|
@@ -290,7 +290,7 @@ bool OpenGl_PBREnvironment::initTextures (const Handle(OpenGl_Context)& theCtx)
|
||||
// NVIDIA's driver didn't work properly with 3 channel texture for diffuse SH coefficients so that alpha channel has been added
|
||||
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseSH].Init (theCtx,
|
||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
||||
Graphic3d_Vec2i (9, 1), Graphic3d_TOT_2D))
|
||||
Graphic3d_Vec2i (9, 1), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture creation failed";
|
||||
return false;
|
||||
@@ -305,7 +305,7 @@ bool OpenGl_PBREnvironment::initTextures (const Handle(OpenGl_Context)& theCtx)
|
||||
|
||||
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseFallback].Init (theCtx,
|
||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBA, false),
|
||||
Graphic3d_Vec2i (10, 4), Graphic3d_TOT_2D))
|
||||
Graphic3d_Vec2i (10, 4), Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseFallback texture creation failed";
|
||||
return false;
|
||||
@@ -432,7 +432,7 @@ bool OpenGl_PBREnvironment::processDiffIBLMap (const Handle(OpenGl_Context)& the
|
||||
{
|
||||
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseSH].Init (theCtx,
|
||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
||||
Graphic3d_Vec2i (9, 1), Graphic3d_TOT_2D, &anImageF))
|
||||
Graphic3d_Vec2i (9, 1), Graphic3d_TypeOfTexture_2D, &anImageF))
|
||||
{
|
||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture update failed";
|
||||
return false;
|
||||
|
@@ -378,7 +378,11 @@ void OpenGl_Sampler::applyGlobalTextureParams (const Handle(OpenGl_Context)& the
|
||||
theCtx->core11fwd->glEnable (GL_TEXTURE_2D);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
case GL_TEXTURE_3D:
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +432,10 @@ void OpenGl_Sampler::resetGlobalTextureParams (const Handle(OpenGl_Context)& the
|
||||
theCtx->core11fwd->glDisable (GL_TEXTURE_2D);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
case GL_TEXTURE_3D:
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -69,12 +69,6 @@ static Standard_Integer computeUpperMipMapLevel (Standard_Integer theSize)
|
||||
}
|
||||
}
|
||||
|
||||
//! 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)
|
||||
{
|
||||
@@ -105,9 +99,6 @@ OpenGl_Texture::OpenGl_Texture (const TCollection_AsciiString& theResourceId,
|
||||
myRevision (0),
|
||||
myTextureId (NO_TEXTURE),
|
||||
myTarget (GL_TEXTURE_2D),
|
||||
mySizeX (0),
|
||||
mySizeY (0),
|
||||
mySizeZ (0),
|
||||
myTextFormat (GL_RGBA),
|
||||
mySizedFormat(GL_RGBA8),
|
||||
myNbSamples (1),
|
||||
@@ -169,7 +160,7 @@ void OpenGl_Texture::Release (OpenGl_Context* theGlCtx)
|
||||
theGlCtx->core11fwd->glDeleteTextures (1, &myTextureId);
|
||||
}
|
||||
myTextureId = NO_TEXTURE;
|
||||
mySizeX = mySizeY = mySizeZ = 0;
|
||||
mySize.SetValues (0, 0, 0);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -231,12 +222,13 @@ bool OpenGl_Texture::InitSamplerObject (const Handle(OpenGl_Context)& theCtx)
|
||||
// =======================================================================
|
||||
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_TextureFormat& theFormat,
|
||||
const Graphic3d_Vec2i& theSizeXY,
|
||||
const Graphic3d_Vec3i& theSizeXYZ,
|
||||
const Graphic3d_TypeOfTexture theType,
|
||||
const Image_PixMap* theImage)
|
||||
{
|
||||
if (theSizeXY.x() < 1
|
||||
|| theSizeXY.y() < 1)
|
||||
if (theSizeXYZ.x() < 1
|
||||
|| theSizeXYZ.y() < 1
|
||||
|| theSizeXYZ.z() < 1)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: texture of 0 size cannot be created [") + myResourceId +"]");
|
||||
@@ -244,16 +236,39 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
const GLenum aTarget = (theType == Graphic3d_TOT_1D
|
||||
&& theCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
|
||||
? GL_TEXTURE_1D
|
||||
: GL_TEXTURE_2D;
|
||||
GLenum aTarget = GL_TEXTURE_2D;
|
||||
switch (theType)
|
||||
{
|
||||
case Graphic3d_TypeOfTexture_1D:
|
||||
{
|
||||
aTarget = theCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES
|
||||
? GL_TEXTURE_1D
|
||||
: GL_TEXTURE_2D;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TypeOfTexture_2D:
|
||||
case Graphic3d_TOT_2D_MIPMAP:
|
||||
{
|
||||
aTarget = GL_TEXTURE_2D;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TypeOfTexture_3D:
|
||||
{
|
||||
aTarget = GL_TEXTURE_3D;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TypeOfTexture_CUBEMAP:
|
||||
{
|
||||
aTarget = GL_TEXTURE_CUBE_MAP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const bool toPatchExisting = IsValid()
|
||||
&& myTextFormat == theFormat.PixelFormat()
|
||||
&& myTarget == aTarget
|
||||
&& HasMipmaps() == (theType == Graphic3d_TOT_2D_MIPMAP)
|
||||
&& mySizeX == theSizeXY.x()
|
||||
&& (mySizeY == theSizeXY.y() || theType == Graphic3d_TOT_1D);
|
||||
&& mySize.x() == theSizeXYZ.x()
|
||||
&& (mySize.y() == theSizeXYZ.y() || theType == Graphic3d_TypeOfTexture_1D)
|
||||
&& mySize.z() == theSizeXYZ.z();
|
||||
if (!Create (theCtx))
|
||||
{
|
||||
Release (theCtx.get());
|
||||
@@ -271,9 +286,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
myIsAlpha = theFormat.PixelFormat() == GL_ALPHA;
|
||||
}
|
||||
|
||||
myMaxMipLevel = theType == Graphic3d_TOT_2D_MIPMAP && theCtx->arbFBO != NULL
|
||||
? computeUpperMipMapLevel (theSizeXY.x(), theSizeXY.y())
|
||||
: 0;
|
||||
myMaxMipLevel = 0;
|
||||
myTextFormat = theFormat.PixelFormat();
|
||||
mySizedFormat = theFormat.InternalFormat();
|
||||
myNbSamples = 1;
|
||||
@@ -293,12 +306,12 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
const GLsizei aMaxSize = theCtx->MaxTextureSize();
|
||||
if (theSizeXY.x() > aMaxSize
|
||||
|| theSizeXY.y() > aMaxSize)
|
||||
const Standard_Integer aMaxSize = theCtx->MaxTextureSize();
|
||||
if (theSizeXYZ.maxComp() > aMaxSize)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: Texture dimension - ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||
TCollection_AsciiString ("Error: Texture dimension - ") + theSizeXYZ.x() + "x" + theSizeXYZ.y()
|
||||
+ (theSizeXYZ.z() > 1 ? TCollection_AsciiString ("x") + theSizeXYZ.z() : TCollection_AsciiString())
|
||||
+ " exceeds hardware limits (" + aMaxSize + "x" + aMaxSize + ")"
|
||||
+ " [" + myResourceId +"]");
|
||||
Release (theCtx.get());
|
||||
@@ -312,34 +325,18 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
// however some hardware (NV30 - GeForce FX, RadeOn 9xxx and Xxxx) supports GLSL but not NPOT!
|
||||
// Trying to create NPOT textures on such hardware will not fail
|
||||
// but driver will fall back into software rendering,
|
||||
const GLsizei aWidthP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.x(), aMaxSize);
|
||||
const GLsizei aHeightP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.y(), aMaxSize);
|
||||
if (theSizeXY.x() != aWidthP2
|
||||
|| (theType != Graphic3d_TOT_1D && theSizeXY.y() != aHeightP2))
|
||||
const Graphic3d_Vec2i aSizeP2 (OpenGl_Context::GetPowerOfTwo (theSizeXYZ.x(), aMaxSize),
|
||||
OpenGl_Context::GetPowerOfTwo (theSizeXYZ.y(), aMaxSize));
|
||||
if (theSizeXYZ.x() != aSizeP2.x()
|
||||
|| (theType != Graphic3d_TypeOfTexture_1D && theSizeXYZ.y() != aSizeP2.y()))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: NPOT Textures (") + theSizeXY.x() + "x" + theSizeXY.y() + ")"
|
||||
TCollection_AsciiString ("Error: NPOT Textures (") + theSizeXYZ.x() + "x" + theSizeXYZ.y() + ")"
|
||||
" are not supported by hardware [" + myResourceId +"]");
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||
&& !theCtx->IsGlGreaterEqual (3, 0)
|
||||
&& theType == Graphic3d_TOT_2D_MIPMAP)
|
||||
{
|
||||
// Mipmap NPOT textures are not supported by OpenGL ES 2.0.
|
||||
const GLsizei aWidthP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.x(), aMaxSize);
|
||||
const GLsizei aHeightP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.y(), aMaxSize);
|
||||
if (theSizeXY.x() != aWidthP2
|
||||
|| theSizeXY.y() != aHeightP2)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: Mipmap NPOT Textures (") + theSizeXY.x() + "x" + theSizeXY.y() + ")"
|
||||
" are not supported by OpenGL ES 2.0 [" + myResourceId +"]");
|
||||
myMaxMipLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GLint aTestWidth = 0, aTestHeight = 0;
|
||||
GLvoid* aDataPtr = (theImage != NULL) ? (GLvoid* )theImage->Data() : NULL;
|
||||
@@ -370,7 +367,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
myTarget = aTarget;
|
||||
switch (theType)
|
||||
{
|
||||
case Graphic3d_TOT_1D:
|
||||
case Graphic3d_TypeOfTexture_1D:
|
||||
{
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||
{
|
||||
@@ -385,14 +382,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
if (toPatchExisting)
|
||||
{
|
||||
theCtx->core11fwd->glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
|
||||
theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
theSizeXYZ.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
break;
|
||||
}
|
||||
|
||||
// use proxy to check texture could be created or not
|
||||
theCtx->core11fwd->glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
|
||||
theSizeXY.x(), 0,
|
||||
theSizeXYZ.x(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), NULL);
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
|
||||
@@ -405,7 +401,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
|
||||
theCtx->core11fwd->glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
|
||||
theSizeXY.x(), 0,
|
||||
theSizeXYZ.x(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
@@ -414,13 +410,10 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = theSizeXY.x();
|
||||
mySizeY = 1;
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
mySize.SetValues (theSizeXYZ.x(), 1, 1);
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOT_2D:
|
||||
case Graphic3d_TypeOfTexture_2D:
|
||||
case Graphic3d_TOT_2D_MIPMAP:
|
||||
{
|
||||
Bind (theCtx);
|
||||
@@ -429,28 +422,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
{
|
||||
theCtx->core11fwd->glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
0, 0,
|
||||
theSizeXY.x(), theSizeXY.y(),
|
||||
theSizeXYZ.x(), theSizeXYZ.y(),
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
|
||||
if (myMaxMipLevel > 0)
|
||||
{
|
||||
// generate mipmaps
|
||||
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||
if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
myMaxMipLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL)
|
||||
{
|
||||
// use proxy to check texture could be created or not
|
||||
theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
|
||||
theSizeXY.x(), theSizeXY.y(), 0,
|
||||
theSizeXYZ.x(), theSizeXYZ.y(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), NULL);
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &aTestWidth);
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
|
||||
@@ -465,13 +446,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
|
||||
theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
|
||||
theSizeXY.x(), theSizeXY.y(), 0,
|
||||
theSizeXYZ.x(), theSizeXYZ.y(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
GLenum anErr = theCtx->core11fwd->glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||
TCollection_AsciiString ("Error: 2D texture ") + theSizeXYZ.x() + "x" + theSizeXYZ.y()
|
||||
+ " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
|
||||
+ " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
|
||||
+ " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
|
||||
@@ -482,38 +463,63 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = theSizeXY.x();
|
||||
mySizeY = theSizeXY.y();
|
||||
|
||||
if (myMaxMipLevel > 0)
|
||||
mySize.SetValues (theSizeXYZ.xy(), 1);
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TypeOfTexture_3D:
|
||||
{
|
||||
if (theCtx->Functions()->glTexImage3D == nullptr)
|
||||
{
|
||||
// generate mipmaps
|
||||
//glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||
anErr = theCtx->core11fwd->glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
"Error: three-dimensional textures are not supported by hardware.");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
Bind (theCtx);
|
||||
applyDefaultSamplerParams (theCtx);
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL)
|
||||
{
|
||||
theCtx->Functions()->glTexImage3D (GL_PROXY_TEXTURE_3D, 0, anIntFormat,
|
||||
theSizeXYZ.x(), theSizeXYZ.y(), theSizeXYZ.z(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), nullptr);
|
||||
|
||||
NCollection_Vec3<GLint> aTestSizeXYZ;
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH, &aTestSizeXYZ.x());
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_HEIGHT, &aTestSizeXYZ.y());
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_DEPTH, &aTestSizeXYZ.z());
|
||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
|
||||
if (aTestSizeXYZ.x() == 0 || aTestSizeXYZ.y() == 0 || aTestSizeXYZ.z() == 0)
|
||||
{
|
||||
myMaxMipLevel = 0;
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||
&& (theFormat.InternalFormat() == GL_RGB8
|
||||
|| theFormat.InternalFormat() == GL_SRGB8))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: generating mipmaps requires color-renderable format, while giving ")
|
||||
+ OpenGl_TextureFormat::FormatFormat (anIntFormat) + " [" + myResourceId +"]");
|
||||
}
|
||||
else
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: generating mipmaps has failed [") + myResourceId +"]");
|
||||
}
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
theCtx->Functions()->glTexImage3D (GL_TEXTURE_3D, 0, anIntFormat,
|
||||
theSizeXYZ.x(), theSizeXYZ.y(), theSizeXYZ.z(), 0,
|
||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||
GLenum anErr = theCtx->core11fwd->glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Error: 3D texture ") + theSizeXYZ.x() + "x" + theSizeXYZ.y() + "x" + theSizeXYZ.z()
|
||||
+ " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
|
||||
+ " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
|
||||
+ " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
|
||||
+ " can not be created with error " + OpenGl_Context::FormatGlError (anErr)
|
||||
+ " [" + myResourceId +"]");
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
}
|
||||
|
||||
mySize = theSizeXYZ;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOT_CUBEMAP:
|
||||
case Graphic3d_TypeOfTexture_CUBEMAP:
|
||||
{
|
||||
Unbind (theCtx);
|
||||
Release (theCtx.get());
|
||||
@@ -521,8 +527,82 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
}
|
||||
|
||||
Release (theCtx.get());
|
||||
return false;
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GenerateMipmaps
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_Texture::GenerateMipmaps (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
if (theCtx->arbFBO == nullptr
|
||||
|| !IsValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
myMaxMipLevel = computeUpperMipMapLevel (mySize.maxComp());
|
||||
|
||||
const Standard_Integer aMaxSize = theCtx->MaxTextureSize();
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||
&& !theCtx->IsGlGreaterEqual (3, 0))
|
||||
{
|
||||
// Mipmap NPOT textures are not supported by OpenGL ES 2.0.
|
||||
const Graphic3d_Vec2i aSizeP2 (OpenGl_Context::GetPowerOfTwo (mySize.x(), aMaxSize),
|
||||
OpenGl_Context::GetPowerOfTwo (mySize.y(), aMaxSize));
|
||||
if (mySize.xy() != aSizeP2)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: Mipmap NPOT Textures (") + mySize.x() + "x" + mySize.y() + ")"
|
||||
" are not supported by OpenGL ES 2.0 [" + myResourceId +"]");
|
||||
myMaxMipLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (myMaxMipLevel <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
Bind (theCtx);
|
||||
if (theCtx->HasTextureBaseLevel()
|
||||
&& !mySampler->isValidSampler())
|
||||
{
|
||||
const Standard_Integer aMaxLevel = Min (myMaxMipLevel, mySampler->Parameters()->MaxLevel());
|
||||
mySampler->SetParameter (theCtx, myTarget, GL_TEXTURE_MAX_LEVEL, aMaxLevel);
|
||||
}
|
||||
theCtx->arbFBO->glGenerateMipmap (myTarget);
|
||||
GLenum anErr = theCtx->core11fwd->glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
myMaxMipLevel = 0;
|
||||
if (theCtx->HasTextureBaseLevel()
|
||||
&& !mySampler->isValidSampler())
|
||||
{
|
||||
mySampler->SetParameter (theCtx, myTarget, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
}
|
||||
|
||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||
&& (mySizedFormat == GL_RGB8
|
||||
|| mySizedFormat == GL_SRGB8))
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: generating mipmaps requires color-renderable format, while giving ")
|
||||
+ OpenGl_TextureFormat::FormatFormat (mySizedFormat) + " [" + myResourceId +"]");
|
||||
}
|
||||
else
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Warning: generating mipmaps has failed [") + myResourceId +"]");
|
||||
}
|
||||
}
|
||||
|
||||
applyDefaultSamplerParams (theCtx);
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -550,16 +630,15 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
return Init (theCtx, aFormat, Graphic3d_Vec2i ((Standard_Integer)theImage.SizeX(), (Standard_Integer)theImage.SizeY()),
|
||||
theType, &theImage);
|
||||
return Init (theCtx, aFormat, Graphic3d_Vec3i (theImage.SizeXYZ()), theType, &theImage);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureMap)& theTextureMap)
|
||||
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureRoot)& theTextureMap)
|
||||
{
|
||||
if (theTextureMap.IsNull())
|
||||
{
|
||||
@@ -568,7 +647,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
switch (theTextureMap->Type())
|
||||
{
|
||||
case Graphic3d_TOT_CUBEMAP:
|
||||
case Graphic3d_TypeOfTexture_CUBEMAP:
|
||||
{
|
||||
return InitCubeMap (theCtx, Handle(Graphic3d_CubeMap)::DownCast(theTextureMap),
|
||||
0, Image_Format_RGB, false, theTextureMap->IsColorMap());
|
||||
@@ -589,7 +668,15 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Init (theCtx, *anImage, theTextureMap->Type(), theTextureMap->IsColorMap());
|
||||
if (!Init (theCtx, *anImage, theTextureMap->Type(), theTextureMap->IsColorMap()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (theTextureMap->HasMipmaps())
|
||||
{
|
||||
GenerateMipmaps (theCtx);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,23 +728,22 @@ bool OpenGl_Texture::InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
||||
myTextFormat = aFormat.Format();
|
||||
mySizedFormat = aFormat.Internal();
|
||||
myIsTopDown = theImage.IsTopDown();
|
||||
mySizeX = theImage.SizeX();
|
||||
mySizeY = theImage.SizeY();
|
||||
mySize.SetValues (theImage.SizeX(), theImage.SizeY(), 1);
|
||||
myMaxMipLevel = Max (theImage.MipMaps().Size() - 1, 0);
|
||||
if (myMaxMipLevel > 0
|
||||
&& !theImage.IsCompleteMipMapSet())
|
||||
{
|
||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (Graphic3d_Vec2i (mySizeX, mySizeY), myMaxMipLevel);
|
||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (mySize.xy(), 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
|
||||
TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySize.x() + "x" + mySize.y()
|
||||
+ " 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
|
||||
Message::SendTrace (TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySize.x() + "x" + mySize.y()
|
||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y());
|
||||
}
|
||||
}
|
||||
@@ -762,8 +848,7 @@ bool OpenGl_Texture::Init2DMultisample (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = theSizeX;
|
||||
mySizeY = theSizeY;
|
||||
mySize.SetValues (theSizeX, theSizeY, 1);
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
@@ -824,8 +909,7 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = aSizeX;
|
||||
mySizeY = aSizeY;
|
||||
mySize.SetValues (aSizeX, aSizeY, 1);
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
}
|
||||
@@ -912,9 +996,7 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
|
||||
return false;
|
||||
}
|
||||
|
||||
mySizeX = aSizeXYZ.x();
|
||||
mySizeY = aSizeXYZ.y();
|
||||
mySizeZ = aSizeXYZ.z();
|
||||
mySize = aSizeXYZ;
|
||||
|
||||
Unbind (theCtx);
|
||||
return true;
|
||||
@@ -940,6 +1022,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
Handle(Image_PixMap) anImage;
|
||||
Handle(Image_CompressedPixMap) aCompImage;
|
||||
OpenGl_TextureFormat aFormat;
|
||||
myMaxMipLevel = 0;
|
||||
if (!theCubeMap.IsNull())
|
||||
{
|
||||
theCubeMap->Reset();
|
||||
@@ -997,15 +1080,10 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
theSize = anImage->SizeX();
|
||||
theFormat = anImage->Format();
|
||||
theToGenMipmap = theCubeMap->HasMipmaps();
|
||||
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||
}
|
||||
|
||||
myIsTopDown = theCubeMap->IsTopDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||
}
|
||||
|
||||
if (!aFormat.IsValid())
|
||||
{
|
||||
@@ -1036,8 +1114,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
myTarget = GL_TEXTURE_CUBE_MAP;
|
||||
myNbSamples = 1;
|
||||
mySizeX = (GLsizei )theSize;
|
||||
mySizeY = (GLsizei )theSize;
|
||||
mySize.SetValues ((GLsizei )theSize, (GLsizei )theSize, 1);
|
||||
myTextFormat = aFormat.Format();
|
||||
mySizedFormat = aFormat.Internal();
|
||||
|
||||
@@ -1069,7 +1146,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
if (!aCompImage.IsNull())
|
||||
{
|
||||
Graphic3d_Vec2i aMipSizeXY (mySizeX, mySizeY);
|
||||
Graphic3d_Vec2i aMipSizeXY = mySize.xy();
|
||||
aData = aCompImage->FaceData()->Data();
|
||||
for (Standard_Integer aMipIter = 0; aMipIter <= myMaxMipLevel; ++aMipIter)
|
||||
{
|
||||
@@ -1167,16 +1244,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (theToGenMipmap && theCtx->arbFBO != NULL)
|
||||
{
|
||||
theCtx->arbFBO->glGenerateMipmap (myTarget);
|
||||
const GLenum anErr = theCtx->core11fwd->glGetError();
|
||||
if (anErr != GL_NO_ERROR)
|
||||
{
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString ("Unable to generate mipmap of cubemap with format ")
|
||||
+ OpenGl_TextureFormat::FormatFormat (anIntFormat)
|
||||
+ ", error " + OpenGl_Context::FormatGlError (anErr));
|
||||
myMaxMipLevel = 0;
|
||||
}
|
||||
GenerateMipmaps (theCtx);
|
||||
}
|
||||
|
||||
Unbind (theCtx.get());
|
||||
@@ -1250,14 +1318,14 @@ Standard_Size OpenGl_Texture::EstimatedDataSize() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Size aSize = PixelSizeOfPixelFormat (mySizedFormat) * mySizeX * myNbSamples;
|
||||
if (mySizeY != 0)
|
||||
Standard_Size aSize = PixelSizeOfPixelFormat (mySizedFormat) * mySize.x() * myNbSamples;
|
||||
if (mySize.y() != 0)
|
||||
{
|
||||
aSize *= Standard_Size(mySizeY);
|
||||
aSize *= Standard_Size(mySize.y());
|
||||
}
|
||||
if (mySizeZ != 0)
|
||||
if (mySize.z() != 0)
|
||||
{
|
||||
aSize *= Standard_Size(mySizeZ);
|
||||
aSize *= Standard_Size(mySize.z());
|
||||
}
|
||||
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
||||
{
|
||||
@@ -1294,7 +1362,7 @@ bool OpenGl_Texture::ImageDump (Image_PixMap& theImage,
|
||||
}
|
||||
|
||||
GLenum aTarget = myTarget;
|
||||
Graphic3d_Vec2i aSize (mySizeX, mySizeY);
|
||||
Graphic3d_Vec2i aSize = mySize.xy();
|
||||
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
||||
{
|
||||
aTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + theCubeSide;
|
||||
|
@@ -53,11 +53,17 @@ public:
|
||||
//! @return target to which the texture is bound (GL_TEXTURE_1D, GL_TEXTURE_2D)
|
||||
unsigned int GetTarget() const { return myTarget; }
|
||||
|
||||
//! @return texture width (0 LOD)
|
||||
GLsizei SizeX() const { return mySizeX; }
|
||||
//! Return texture dimensions (0 LOD)
|
||||
const Graphic3d_Vec3i& Size() const { return mySize; }
|
||||
|
||||
//! @return texture height (0 LOD)
|
||||
GLsizei SizeY() const { return mySizeY; }
|
||||
//! Return texture width (0 LOD)
|
||||
Standard_Integer SizeX() const { return mySize.x(); }
|
||||
|
||||
//! Return texture height (0 LOD)
|
||||
Standard_Integer SizeY() const { return mySize.y(); }
|
||||
|
||||
//! Return texture depth (0 LOD)
|
||||
Standard_Integer SizeZ() const { return mySize.z(); }
|
||||
|
||||
//! @return texture ID
|
||||
unsigned int TextureId() const { return myTextureId; }
|
||||
@@ -140,15 +146,30 @@ public:
|
||||
//! Notice that texture will be unbound after this call.
|
||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_TextureFormat& theFormat,
|
||||
const Graphic3d_Vec2i& theSizeXY,
|
||||
const Graphic3d_Vec3i& theSizeXYZ,
|
||||
const Graphic3d_TypeOfTexture theType,
|
||||
const Image_PixMap* theImage = NULL);
|
||||
|
||||
//! Initialize the 2D texture with specified format, size and texture type.
|
||||
//! If theImage is empty the texture data will contain trash.
|
||||
//! Notice that texture will be unbound after this call.
|
||||
bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_TextureFormat& theFormat,
|
||||
const Graphic3d_Vec2i& theSizeXY,
|
||||
const Graphic3d_TypeOfTexture theType,
|
||||
const Image_PixMap* theImage = NULL)
|
||||
{
|
||||
return Init (theCtx, theFormat, Graphic3d_Vec3i (theSizeXY, 1), theType, theImage);
|
||||
}
|
||||
|
||||
//! Initialize the texture with Graphic3d_TextureMap.
|
||||
//! It is an universal way to initialize.
|
||||
//! Suitable initialization method will be chosen.
|
||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureMap)& theTextureMap);
|
||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_TextureRoot)& theTextureMap);
|
||||
|
||||
//! Generate mipmaps.
|
||||
Standard_EXPORT bool GenerateMipmaps (const Handle(OpenGl_Context)& theCtx);
|
||||
|
||||
//! Initialize the texture with Image_CompressedPixMap.
|
||||
Standard_EXPORT bool InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
||||
@@ -302,9 +323,7 @@ protected:
|
||||
Standard_Size myRevision; //!< revision of associated data source
|
||||
unsigned int myTextureId; //!< GL resource ID
|
||||
unsigned int myTarget; //!< GL_TEXTURE_1D/GL_TEXTURE_2D/GL_TEXTURE_3D
|
||||
Standard_Integer mySizeX; //!< texture width
|
||||
Standard_Integer mySizeY; //!< texture height
|
||||
Standard_Integer mySizeZ; //!< texture depth
|
||||
Graphic3d_Vec3i mySize; //!< texture width x height x depth
|
||||
unsigned int myTextFormat; //!< texture format - GL_RGB, GL_RGBA,...
|
||||
Standard_Integer mySizedFormat;//!< internal (sized) texture format
|
||||
Standard_Integer myNbSamples; //!< number of MSAA samples
|
||||
|
@@ -72,6 +72,7 @@ TCollection_AsciiString OpenGl_TextureFormat::FormatFormat (GLint theInternalFor
|
||||
case 0x803C: return "GL_ALPHA8";
|
||||
case 0x803E: return "GL_ALPHA16";
|
||||
case GL_LUMINANCE: return "GL_LUMINANCE";
|
||||
case GL_LUMINANCE16: return "GL_LUMINANCE16";
|
||||
case GL_LUMINANCE_ALPHA: return "GL_LUMINANCE_ALPHA";
|
||||
//
|
||||
case GL_DEPTH_COMPONENT: return "GL_DEPTH_COMPONENT";
|
||||
@@ -219,6 +220,19 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
|
||||
aFormat.SetDataType (GL_FLOAT);
|
||||
return aFormat;
|
||||
}
|
||||
case Image_Format_GrayF_half:
|
||||
{
|
||||
aFormat.SetNbComponents (1);
|
||||
aFormat.SetInternalFormat (GL_R16F);
|
||||
aFormat.SetPixelFormat (GL_RED);
|
||||
aFormat.SetDataType (GL_HALF_FLOAT);
|
||||
if (theCtx->hasHalfFloatBuffer == OpenGl_FeatureInExtensions
|
||||
&& theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||
{
|
||||
aFormat.SetDataType (GL_HALF_FLOAT_OES);
|
||||
}
|
||||
return aFormat;
|
||||
}
|
||||
case Image_Format_RGF_half:
|
||||
{
|
||||
aFormat.SetNbComponents (2);
|
||||
@@ -443,6 +457,28 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
|
||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||
return aFormat;
|
||||
}
|
||||
case Image_Format_Gray16:
|
||||
{
|
||||
if (!theCtx->extTexR16)
|
||||
{
|
||||
return OpenGl_TextureFormat();
|
||||
}
|
||||
|
||||
aFormat.SetNbComponents (1);
|
||||
if (useRedRedAlpha
|
||||
|| theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_R16);
|
||||
aFormat.SetPixelFormat (GL_RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormat.SetInternalFormat (GL_LUMINANCE16);
|
||||
aFormat.SetPixelFormat (GL_LUMINANCE);
|
||||
}
|
||||
aFormat.SetDataType (GL_UNSIGNED_SHORT);
|
||||
return aFormat;
|
||||
}
|
||||
case Image_Format_UNKNOWN:
|
||||
{
|
||||
return OpenGl_TextureFormat();
|
||||
@@ -509,7 +545,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindSizedFormat (const Handle(OpenGl_
|
||||
aFormat.SetInternalFormat (theSizedFormat);
|
||||
aFormat.SetPixelFormat (GL_RED);
|
||||
aFormat.SetDataType (GL_HALF_FLOAT);
|
||||
aFormat.SetImageFormat (Image_Format_GrayF);
|
||||
aFormat.SetImageFormat (Image_Format_GrayF_half);
|
||||
if (theCtx->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||
{
|
||||
aFormat.SetDataType (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||
|
@@ -302,7 +302,7 @@ bool OpenGl_TileSampler::upload (const Handle(OpenGl_Context)& theContext,
|
||||
if (!theOffsetsTexture->Init (theContext,
|
||||
OpenGl_TextureFormat::FindSizedFormat (theContext, GL_RG32I),
|
||||
Graphic3d_Vec2i ((int )anOffsets.SizeX, (int )anOffsets.SizeY),
|
||||
Graphic3d_TOT_2D))
|
||||
Graphic3d_TypeOfTexture_2D))
|
||||
{
|
||||
hasErrors = true;
|
||||
}
|
||||
|
@@ -343,10 +343,8 @@ 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 (theContext->SupportedTextureFormats()))
|
||||
{
|
||||
aTextureEnv->Init (theContext, *anImage, myTextureEnvData->Type(), true);
|
||||
}
|
||||
aTextureEnv->Init (theContext, myTextureEnvData);
|
||||
|
||||
myTextureEnv = new OpenGl_TextureSet (aTextureEnv);
|
||||
myTextureEnv->ChangeTextureSetBits() = Graphic3d_TextureSetBits_BaseColor;
|
||||
}
|
||||
@@ -1391,7 +1389,7 @@ bool OpenGl_View::prepareFrameBuffers (Graphic3d_Camera::Projection& theProj)
|
||||
aParams->SetTextureUnit (aCtx->PBREnvLUTTexUnit());
|
||||
anEnvLUT = new OpenGl_Texture(THE_SHARED_ENV_LUT_KEY, aParams);
|
||||
if (!aTexFormat.IsValid()
|
||||
|| !anEnvLUT->Init (aCtx, aTexFormat, Graphic3d_Vec2i((Standard_Integer)Textures_EnvLUTSize), Graphic3d_TOT_2D, aPixMap.get()))
|
||||
|| !anEnvLUT->Init (aCtx, aTexFormat, Graphic3d_Vec2i((Standard_Integer)Textures_EnvLUTSize), Graphic3d_TypeOfTexture_2D, aPixMap.get()))
|
||||
{
|
||||
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, "Failed allocation of LUT for PBR");
|
||||
anEnvLUT.Nullify();
|
||||
|
@@ -1949,13 +1949,13 @@ Standard_Boolean OpenGl_View::updateRaytraceBuffers (const Standard_Integer
|
||||
myRaytraceVisualErrorTexture[aViewIter]->Init (theGlContext,
|
||||
OpenGl_TextureFormat::FindSizedFormat (theGlContext, GL_R32I),
|
||||
Graphic3d_Vec2i (myTileSampler.NbTilesX(), myTileSampler.NbTilesY()),
|
||||
Graphic3d_TOT_2D);
|
||||
Graphic3d_TypeOfTexture_2D);
|
||||
if (!myRaytraceParameters.AdaptiveScreenSamplingAtomic)
|
||||
{
|
||||
myRaytraceTileSamplesTexture[aViewIter]->Init (theGlContext,
|
||||
OpenGl_TextureFormat::FindSizedFormat (theGlContext, GL_R32I),
|
||||
Graphic3d_Vec2i (myTileSampler.NbTilesX(), myTileSampler.NbTilesY()),
|
||||
Graphic3d_TOT_2D);
|
||||
Graphic3d_TypeOfTexture_2D);
|
||||
}
|
||||
}
|
||||
else // non-adaptive mode
|
||||
|
@@ -508,7 +508,7 @@ static Standard_Integer OCC30182 (Draw_Interpretor& , Standard_Integer theNbArgs
|
||||
const Handle(Graphic3d_AspectFillArea3d)& anAspect = aPrs->Attributes()->ShadingAspect()->Aspect();
|
||||
anAspect->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
|
||||
anAspect->SetTextureMapOn (true);
|
||||
anAspect->SetTextureMap (new Graphic3d_Texture2Dmanual (anImage));
|
||||
anAspect->SetTextureMap (new Graphic3d_Texture2D (anImage));
|
||||
if (anImage->IsTopDown())
|
||||
{
|
||||
anAspect->TextureMap()->GetParams()->SetTranslation(Graphic3d_Vec2 (0.0f, -1.0f));
|
||||
|
@@ -4184,10 +4184,15 @@ static Standard_Integer OCC32744(Draw_Interpretor& theDi, Standard_Integer theNb
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OCC24472
|
||||
//function : QACheckBends
|
||||
//purpose :
|
||||
//Checks whether the Curve has a loop/bend
|
||||
//Use: QACheckBends curve [CosMaxAngle [NbPoints]]
|
||||
//NbPoints sets the interval of discretization;
|
||||
//CosMaxAngle sets the maximal rotation angle between two adjacent segments.
|
||||
//This value must be equal to the cosine of this angle.
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC24472(Draw_Interpretor& theDI,
|
||||
static Standard_Integer QACheckBends(Draw_Interpretor& theDI,
|
||||
Standard_Integer theNArg,
|
||||
const char ** theArgVal)
|
||||
{
|
||||
@@ -4195,7 +4200,7 @@ static Standard_Integer OCC24472(Draw_Interpretor& theDI,
|
||||
|
||||
if (theNArg < 2)
|
||||
{
|
||||
theDI << "Use: " << theArgVal[0] << " CheckLoops curve [CosMaxAngle [theNbPoints]]" << "/n";
|
||||
theDI << "Use: " << theArgVal[0] << " QACheckBends curve [CosMaxAngle [theNbPoints]]" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4240,7 +4245,7 @@ static Standard_Integer OCC24472(Draw_Interpretor& theDI,
|
||||
{
|
||||
aCurve->D1(p, aP, aDC2);
|
||||
gp_Dir aD2(aDC2);
|
||||
Standard_Real aCos = Abs(aD1*aD2);
|
||||
Standard_Real aCos = aD1*aD2;
|
||||
|
||||
if (aCos < aCosMaxAngle)
|
||||
{
|
||||
@@ -4346,10 +4351,10 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
__FILE__,
|
||||
OCC32744, group);
|
||||
|
||||
theCommands.Add("OCC24472",
|
||||
"CheckLoops curve [CosMaxAngle [theNbPoints]]",
|
||||
theCommands.Add("QACheckBends",
|
||||
"QACheckBends curve [CosMaxAngle [theNbPoints]]",
|
||||
__FILE__,
|
||||
OCC24472, group);
|
||||
QACheckBends, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -2535,7 +2535,6 @@ Standard_Boolean ShapeFix_Wire::FixIntersectingEdges (const Standard_Integer num
|
||||
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE6 );
|
||||
locMayEdit = Standard_False;
|
||||
}
|
||||
newtol = 1.000001 * maxte;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -99,7 +99,7 @@ Standard_Boolean StepSelect_WorkLibrary::WriteFile
|
||||
if (stepmodel.IsNull() || stepro.IsNull()) return Standard_False;
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::trunc);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::binary | std::ios::trunc);
|
||||
|
||||
if (aStream.get() == NULL) {
|
||||
ctx.CCheck(0)->AddFail("Step File could not be created");
|
||||
|
@@ -479,7 +479,7 @@ void V3d_View::SetBackgroundImage (const Standard_CString theFileName,
|
||||
const Aspect_FillMethod theFillStyle,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
Handle(Graphic3d_Texture2D) aTextureMap = new Graphic3d_Texture2Dmanual (theFileName);
|
||||
Handle(Graphic3d_Texture2D) aTextureMap = new Graphic3d_Texture2D (theFileName);
|
||||
aTextureMap->DisableModulate();
|
||||
SetBackgroundImage (aTextureMap, theFillStyle, theToUpdate);
|
||||
}
|
||||
|
@@ -48,7 +48,8 @@
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_CStructure.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Graphic3d_Texture3D.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_MediaTextureSet.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
@@ -4145,13 +4146,8 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int toModulate = -1;
|
||||
int toSetSRgb = -1;
|
||||
bool toSetFilter = false;
|
||||
bool toSetAniso = false;
|
||||
bool toSetTrsfAngle = false;
|
||||
bool toSetTrsfTrans = false;
|
||||
bool toSetTrsfScale = false;
|
||||
int toModulate = -1, toSetSRgb = -1;
|
||||
bool toSetFilter = false, toSetAniso = false, toSetTrsfAngle = false, toSetTrsfTrans = false, toSetTrsfScale = false;
|
||||
Standard_ShortReal aTrsfRotAngle = 0.0f;
|
||||
Graphic3d_Vec2 aTrsfTrans (0.0f, 0.0f);
|
||||
Graphic3d_Vec2 aTrsfScale (1.0f, 1.0f);
|
||||
@@ -4161,12 +4157,8 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
Handle(AIS_InteractiveObject) aTexturedIO;
|
||||
Handle(AIS_Shape) aTexturedShape;
|
||||
Handle(Graphic3d_TextureSet) aTextureSetOld;
|
||||
NCollection_Vector<Handle(Graphic3d_Texture2Dmanual)> aTextureVecNew;
|
||||
bool toSetGenRepeat = false;
|
||||
bool toSetGenScale = false;
|
||||
bool toSetGenOrigin = false;
|
||||
bool toSetImage = false;
|
||||
bool toComputeUV = false;
|
||||
NCollection_Vector<Handle(Graphic3d_TextureMap)> aTextureVecNew;
|
||||
bool toSetGenRepeat = false, toSetGenScale = false, toSetGenOrigin = false, toSetImage = false, toComputeUV = false;
|
||||
|
||||
const TCollection_AsciiString aCommandName (theArgVec[0]);
|
||||
bool toSetDefaults = aCommandName == "vtexdefault";
|
||||
@@ -4441,6 +4433,38 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
aTexturedIO->Attributes()->ShadingAspect()->Aspect()->SetTextureSet (aMedia);
|
||||
aTextureSetOld.Nullify();
|
||||
}
|
||||
else if (aCommandName == "vtexture"
|
||||
&& aTextureVecNew.IsEmpty()
|
||||
&& aNameCase == "-3d")
|
||||
{
|
||||
TColStd_SequenceOfAsciiString aSlicesSeq;
|
||||
for (; anArgIter + 1 < theArgsNb; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString aSlicePath (theArgVec[anArgIter + 1]);
|
||||
if (aSlicePath.StartsWith ("-"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
aSlicesSeq.Append (aSlicePath);
|
||||
}
|
||||
|
||||
if (aSlicesSeq.Size() < 2)
|
||||
{
|
||||
Message::SendFail() << "Syntax error at '" << aNameCase << "'";
|
||||
return 1;
|
||||
}
|
||||
NCollection_Array1<TCollection_AsciiString> aSlices;
|
||||
aSlices.Resize (0, aSlicesSeq.Size() - 1, false);
|
||||
Standard_Integer aSliceIndex = 0;
|
||||
for (const TCollection_AsciiString& aSliceIter : aSlicesSeq)
|
||||
{
|
||||
aSlices[aSliceIndex++] = aSliceIter;
|
||||
}
|
||||
|
||||
toSetImage = true;
|
||||
aTextureVecNew.SetValue (0, new Graphic3d_Texture3D (aSlices));
|
||||
}
|
||||
else if (aCommandName == "vtexture"
|
||||
&& (aTextureVecNew.IsEmpty()
|
||||
|| aNameCase.StartsWith ("-tex")))
|
||||
@@ -4483,7 +4507,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
Message::SendFail() << "Syntax error: texture with ID " << aValue << " is undefined!";
|
||||
return 1;
|
||||
}
|
||||
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (Graphic3d_NameOfTexture2D (aValue)));
|
||||
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2D (Graphic3d_NameOfTexture2D (aValue)));
|
||||
}
|
||||
else if (aTexName == "?")
|
||||
{
|
||||
@@ -4507,11 +4531,11 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
Message::SendFail() << "Syntax error: non-existing image file has been specified '" << aTexName << "'.";
|
||||
return 1;
|
||||
}
|
||||
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (aTexName));
|
||||
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2D (aTexName));
|
||||
}
|
||||
else
|
||||
{
|
||||
aTextureVecNew.SetValue (aTexIndex, Handle(Graphic3d_Texture2Dmanual)());
|
||||
aTextureVecNew.SetValue (aTexIndex, Handle(Graphic3d_TextureMap)());
|
||||
}
|
||||
|
||||
if (aTextureVecNew.Value (aTexIndex))
|
||||
@@ -4537,7 +4561,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
aTextureSetNew = new Graphic3d_TextureSet (aTextureVecNew.Size());
|
||||
for (Standard_Integer aTexIter = 0; aTexIter < aTextureSetNew->Size(); ++aTexIter)
|
||||
{
|
||||
Handle(Graphic3d_Texture2Dmanual)& aTextureNew = aTextureVecNew.ChangeValue (aTexIter);
|
||||
Handle(Graphic3d_TextureMap)& aTextureNew = aTextureVecNew.ChangeValue (aTexIter);
|
||||
Handle(Graphic3d_TextureRoot) aTextureOld;
|
||||
if (!aTextureSetOld.IsNull()
|
||||
&& aTexIter < aTextureSetOld->Size())
|
||||
@@ -4549,17 +4573,21 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
&& !aTextureNew.IsNull())
|
||||
{
|
||||
*aTextureNew->GetParams() = *aTextureOld->GetParams();
|
||||
if (Handle(Graphic3d_Texture2Dmanual) anOldManualTex = Handle(Graphic3d_Texture2Dmanual)::DownCast (aTextureOld))
|
||||
|
||||
Handle(Graphic3d_Texture2D) aTex2dNew = Handle(Graphic3d_Texture2D)::DownCast (aTextureNew);
|
||||
Handle(Graphic3d_Texture2D) aTex2dOld = Handle(Graphic3d_Texture2D)::DownCast (aTextureOld);
|
||||
if (!aTex2dOld.IsNull()
|
||||
&& !aTex2dNew.IsNull())
|
||||
{
|
||||
TCollection_AsciiString aFilePathOld, aFilePathNew;
|
||||
aTextureOld->Path().SystemName (aFilePathOld);
|
||||
aTextureNew->Path().SystemName (aFilePathNew);
|
||||
if (aTextureNew->Name() == anOldManualTex->Name()
|
||||
if (aTex2dNew->Name() == aTex2dOld->Name()
|
||||
&& aFilePathOld == aFilePathNew
|
||||
&& (!aFilePathNew.IsEmpty() || aTextureNew->Name() != Graphic3d_NOT_2D_UNKNOWN))
|
||||
&& (!aFilePathNew.IsEmpty() || aTex2dNew->Name() != Graphic3d_NOT_2D_UNKNOWN))
|
||||
{
|
||||
--aNbChanged;
|
||||
aTextureNew = anOldManualTex;
|
||||
aTextureNew = aTex2dOld;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6816,6 +6844,7 @@ Sets default deflection coefficient (0.0008) that defines the quality of the sha
|
||||
addCmd ("vtexture", VTexture, /* [vtexture] */ R"(
|
||||
vtexture [-noupdate|-update] name [ImageFile|IdOfTexture|off]
|
||||
[-tex0 Image0] [-tex1 Image1] [...]
|
||||
[-3d Image0 Image1 ... ImageN]
|
||||
[-origin {u v|off}] [-scale {u v|off}] [-repeat {u v|off}]
|
||||
[-trsfTrans du dv] [-trsfScale su sv] [-trsfAngle Angle]
|
||||
[-modulate {on|off}] [-srgb {on|off}]=on
|
||||
@@ -6836,6 +6865,7 @@ The options are:
|
||||
-setFilter Setup texture filter
|
||||
-setAnisoFilter Setup anisotropic filter for texture with mip-levels
|
||||
-default Sets texture mapping default parameters
|
||||
-3d Load 3D texture from the list of 2D image files
|
||||
)" /* [vtexture] */);
|
||||
|
||||
addCmd ("vtexscale", VTexture, /* [vtexscale] */ R"(
|
||||
|
@@ -411,6 +411,15 @@ static Standard_Integer VShaderProg (Draw_Interpretor& ,
|
||||
}
|
||||
aProgram->SetHeader (aHeader);
|
||||
}
|
||||
else if (!aProgram.IsNull()
|
||||
&& (anArg == "-defaultsampler"
|
||||
|| anArg == "-defampler"
|
||||
|| anArg == "-nodefaultsampler"
|
||||
|| anArg == "-nodefsampler"))
|
||||
{
|
||||
bool toUseDefSampler = Draw::ParseOnOffNoIterator (theArgNb, theArgVec, anArgIter);
|
||||
aProgram->SetDefaultSampler (toUseDefSampler);
|
||||
}
|
||||
else if (!anArg.StartsWith ("-")
|
||||
&& GetMapOfAIS().IsBound2 (theArgVec[anArgIter]))
|
||||
{
|
||||
@@ -1187,6 +1196,7 @@ vshader name -vert VertexShader -frag FragmentShader [-geom GeometryShader]
|
||||
[-header VersionHeader]
|
||||
[-tessControl TessControlShader -tessEval TessEvaluationShader]
|
||||
[-uniform Name FloatValue]
|
||||
[-defaultSampler {0|1}]=1
|
||||
Assign custom GLSL program to presentation aspects.
|
||||
)" /* [vshader] */);
|
||||
|
||||
|
@@ -55,7 +55,7 @@
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_GraphicDriverFactory.hxx>
|
||||
#include <Graphic3d_NameOfTextureEnv.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_Texture2D.hxx>
|
||||
#include <Graphic3d_TextureEnv.hxx>
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
#include <Graphic3d_TypeOfTextureFilter.hxx>
|
||||
@@ -3069,7 +3069,7 @@ static int VBackground (Draw_Interpretor& theDI,
|
||||
|
||||
if (!anImagePath.IsEmpty())
|
||||
{
|
||||
Handle(Graphic3d_Texture2D) aTextureMap = new Graphic3d_Texture2Dmanual (anImagePath);
|
||||
Handle(Graphic3d_Texture2D) aTextureMap = new Graphic3d_Texture2D (anImagePath);
|
||||
aTextureMap->DisableModulate();
|
||||
aTextureMap->SetColorMap (isSRgb);
|
||||
if (!aTextureMap->IsDone())
|
||||
@@ -5897,7 +5897,7 @@ public:
|
||||
aMat.SetSpecularColor (Quantity_NOC_BLACK);
|
||||
aMat.SetEmissiveColor (Quantity_NOC_BLACK);
|
||||
aFillAspect->SetFrontMaterial (aMat);
|
||||
aFillAspect->SetTextureMap (new Graphic3d_Texture2Dmanual (theImage));
|
||||
aFillAspect->SetTextureMap (new Graphic3d_Texture2D (theImage));
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
{
|
||||
@@ -8609,7 +8609,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
}
|
||||
|
||||
TCollection_AsciiString aTextureName (aChangeArgs[1]);
|
||||
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(aTextureName);
|
||||
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (aTextureName);
|
||||
if (!aTexture->IsDone())
|
||||
{
|
||||
aClipPlane->SetCappingTexture (NULL);
|
||||
|
@@ -226,7 +226,7 @@ Standard_Boolean VrmlAPI_Writer::write_v1(const TopoDS_Shape& aShape,const Stand
|
||||
OSD_Path thePath(aFile);
|
||||
TCollection_AsciiString theFile;thePath.SystemName(theFile);
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> anOutFile = aFileSystem->OpenOStream (theFile, std::ios::out);
|
||||
std::shared_ptr<std::ostream> anOutFile = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
|
||||
if (anOutFile.get() == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -370,7 +370,7 @@ Standard_Boolean VrmlAPI_Writer::write_v2(const TopoDS_Shape& aShape,const Stand
|
||||
aConv.Convert(anExtFace, anExtEdge);
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (aFile, std::ios::out);
|
||||
std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (aFile, std::ios::out | std::ios::binary);
|
||||
if (anOutStream.get() != NULL)
|
||||
{
|
||||
*anOutStream << aScene;
|
||||
@@ -395,7 +395,7 @@ Standard_Boolean VrmlAPI_Writer::WriteDoc(
|
||||
aConv.ConvertDocument(theDoc);
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (theFile, std::ios::out);
|
||||
std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
|
||||
if (anOutStream.get() != NULL)
|
||||
{
|
||||
*anOutStream << aScene;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <Graphic3d_TextureParams.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2Dmanual)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2D)
|
||||
|
||||
//=======================================================================
|
||||
//function : XCAFPrs_Texture
|
||||
@@ -23,7 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2Dmanual)
|
||||
//=======================================================================
|
||||
XCAFPrs_Texture::XCAFPrs_Texture (const Image_Texture& theImageSource,
|
||||
const Graphic3d_TextureUnit theUnit)
|
||||
: Graphic3d_Texture2Dmanual (""),
|
||||
: Graphic3d_Texture2D (""),
|
||||
myImageSource (theImageSource)
|
||||
{
|
||||
if (!myImageSource.TextureId().IsEmpty())
|
||||
|
@@ -21,9 +21,9 @@
|
||||
#include <Image_Texture.hxx>
|
||||
|
||||
//! Texture holder.
|
||||
class XCAFPrs_Texture : public Graphic3d_Texture2Dmanual
|
||||
class XCAFPrs_Texture : public Graphic3d_Texture2D
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2Dmanual)
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFPrs_Texture, Graphic3d_Texture2D)
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
|
@@ -76,7 +76,7 @@ void WriteShape(const TopoDS_Shape& shape, const Standard_Integer number)
|
||||
{
|
||||
char fname[110];
|
||||
sprintf(fname, "Shape_%d",number);
|
||||
std::ofstream f(fname,std::ios::out);
|
||||
std::ofstream f(fname,std::ios::out | std::ios::binary);
|
||||
std::cout << "Output file name : " << fname << std::endl;
|
||||
f << "DBRep_DrawableShape\n";
|
||||
|
||||
|
@@ -99,7 +99,7 @@ void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)&
|
||||
myFileName = theFileName;
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aFileStream = aFileSystem->OpenOStream (theFileName, std::ios::out);
|
||||
std::shared_ptr<std::ostream> aFileStream = aFileSystem->OpenOStream (theFileName, std::ios::out | std::ios::binary);
|
||||
if (aFileStream.get() != NULL && aFileStream->good())
|
||||
{
|
||||
Write (theDocument, *aFileStream, theRange);
|
||||
|
@@ -1,5 +1,3 @@
|
||||
##puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
|
||||
|
||||
#jmu
|
||||
#pro18457
|
||||
#cascade 2.1
|
||||
|
@@ -1,5 +1,3 @@
|
||||
##puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
|
||||
|
||||
puts "PRO15946"
|
||||
puts "Fuse"
|
||||
puts ""
|
||||
|
10
tests/bugs/heal/bug27170
Normal file
10
tests/bugs/heal/bug27170
Normal file
@@ -0,0 +1,10 @@
|
||||
puts "============"
|
||||
puts "0027170: Reading STEP files produces invalid shapes"
|
||||
puts "============"
|
||||
|
||||
restore [locate_data_file bug27170_f.brep] f
|
||||
|
||||
fixshape result f
|
||||
|
||||
ttranslate result 9.68119149294e-13 217.938944319 299.700009766
|
||||
checkshape result
|
@@ -22,5 +22,5 @@ checkprops result -s 66.672
|
||||
checkshape result
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 6 -edge 8 -wire 2 -face 2 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 21
|
||||
checknbshapes result -vertex 5 -edge 7 -wire 2 -face 2 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 19
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -22,5 +22,5 @@ checkprops result -s 1450.22
|
||||
checkshape result
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 6 -edge 8 -wire 4 -face 4 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 25
|
||||
checknbshapes result -vertex 5 -edge 7 -wire 4 -face 4 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 23
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -22,5 +22,5 @@ checkprops result -s 761.355
|
||||
checkshape result
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 6 -edge 8 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 23
|
||||
checknbshapes result -vertex 5 -edge 7 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 21
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -22,5 +22,5 @@ checkprops result -s 755.54
|
||||
checkshape result
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 6 -edge 8 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 23
|
||||
checknbshapes result -vertex 5 -edge 7 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 21
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -22,5 +22,5 @@ checkprops result -l 18.3861
|
||||
checkshape result
|
||||
checksection result
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 4 -edge 4 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 9
|
||||
checknbshapes result -vertex 3 -edge 3 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 7
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -22,5 +22,5 @@ checkprops result -l 122.816
|
||||
checkshape result
|
||||
checksection result
|
||||
# Analysis of "nbshapes res"
|
||||
checknbshapes result -vertex 6 -edge 6 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 13
|
||||
checknbshapes result -vertex 5 -edge 5 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 11
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -1,5 +1,3 @@
|
||||
##puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
|
||||
|
||||
puts "============"
|
||||
puts "OCC12918"
|
||||
puts "============"
|
||||
|
@@ -33,6 +33,6 @@ Number of shapes in .*
|
||||
"
|
||||
|
||||
checknbshapes result -ref $NbShapesRef
|
||||
checkmaxtol result -ref 0.013928665225777443
|
||||
checkmaxtol result -ref 2.0849512334752456e-05
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
||||
|
@@ -33,7 +33,7 @@ Number of shapes in .*
|
||||
|
||||
checknbshapes result -ref $NbShapesRef
|
||||
|
||||
checkmaxtol result -ref 0.013928665225777443
|
||||
checkmaxtol result -ref 2.0849512334752456e-05
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}_axo.png
|
||||
|
||||
|
@@ -33,7 +33,7 @@ Number of shapes in .*
|
||||
|
||||
checknbshapes result -ref $NbShapesRef
|
||||
|
||||
checkmaxtol result -ref 0.013928665225777443
|
||||
checkmaxtol result -ref 2.0849512334752456e-05
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}_axo.png
|
||||
|
||||
|
@@ -32,7 +32,7 @@ Number of shapes in .*
|
||||
"
|
||||
|
||||
checknbshapes result -ref $NbShapesRef
|
||||
checkmaxtol result -ref 0.013928665225777443
|
||||
checkmaxtol result -ref 2.0849512334752456e-05
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}_axo.png
|
||||
|
||||
|
@@ -33,7 +33,7 @@ Number of shapes in .*
|
||||
|
||||
checknbshapes result -ref $NbShapesRef
|
||||
|
||||
checkmaxtol result -ref 0.013928665225777443
|
||||
checkmaxtol result -ref 2.0849512334752456e-05
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}_axo.png
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
##puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
|
||||
|
||||
puts "============"
|
||||
puts "OCC697"
|
||||
puts "============"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user