mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7a7ba8bed2 |
@@ -56,20 +56,6 @@ 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_MINOR ${OCC_VERSION_MINOR})
|
||||||
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
|
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}")
|
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
|
||||||
|
|
||||||
# Regeneration of OCCT resource files
|
# Regeneration of OCCT resource files
|
||||||
@@ -1239,7 +1225,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
|||||||
endforeach()
|
endforeach()
|
||||||
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
|
# 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 "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
|
||||||
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
|
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)")
|
||||||
|
|
||||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||||
if (BUILD_MODULE_${OCCT_MODULE})
|
if (BUILD_MODULE_${OCCT_MODULE})
|
||||||
|
@@ -280,17 +280,14 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
|||||||
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
|
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
|
||||||
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
|
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
|
||||||
|
|
||||||
set (OCC_SOVERSION "")
|
if (ANDROID)
|
||||||
if (BUILD_SOVERSION_NUMBERS GREATER 2)
|
# do not append version to the filename
|
||||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
|
||||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
|
else()
|
||||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
|
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
|
||||||
elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
|
SOVERSION "${OCC_VERSION_MAJOR}"
|
||||||
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
|
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
|
||||||
endif()
|
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_TOOLKITS_BY_CURRENT_PROJECT)
|
||||||
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
|
||||||
|
@@ -28,9 +28,6 @@ Applies only for Debug configuration.")
|
|||||||
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
|
||||||
"Append the postfix to names of output libraries")
|
"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
|
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
|
||||||
"Disables exceptions like Standard_OutOfRange in Release builds.
|
"Disables exceptions like Standard_OutOfRange in Release builds.
|
||||||
Defines No_Exception macros for Release builds when enabled (default).
|
Defines No_Exception macros for Release builds when enabled (default).
|
||||||
|
@@ -132,31 +132,21 @@ for (aPackage, aPackages) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# extend clean with versioned .so files
|
||||||
!win32 {
|
!win32 {
|
||||||
aVerList = $$split(VERSION, ".")
|
aVerList = $$split(VERSION, ".")
|
||||||
aVerMaj = $$member(aVerList, 0)
|
aVerMaj = $$member(aVerList, 0)
|
||||||
aVerMin = $$member(aVerList, 1)
|
aVerMin = $$member(aVerList, 1)
|
||||||
aVerMic = $$member(aVerList, 2)
|
aVerMic = $$member(aVerList, 2)
|
||||||
|
|
||||||
equals(TEMPLATE, app) {
|
equals(TEMPLATE, app) {
|
||||||
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
|
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
|
||||||
} else {
|
} else {
|
||||||
mac {
|
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}.dylib
|
||||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
|
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
|
||||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
|
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
|
||||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
|
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
|
||||||
} else {
|
} 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
|
||||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
|
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
|
||||||
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,9 @@
|
|||||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <Graphic3d_Texture2D.hxx>
|
#include <Graphic3d_Texture1D.hxx>
|
||||||
|
#include <Graphic3d_Texture1Dsegment.hxx>
|
||||||
|
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||||
#include <Image_AlienPixMap.hxx>
|
#include <Image_AlienPixMap.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
@@ -79,7 +81,7 @@ void Sample2D_Image::SetContext (const Handle(AIS_InteractiveContext)& theContex
|
|||||||
this->Set(TopoDS_Shape(myFace));
|
this->Set(TopoDS_Shape(myFace));
|
||||||
|
|
||||||
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
|
||||||
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (myFilename);
|
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(myFilename);
|
||||||
aTexture->DisableModulate();
|
aTexture->DisableModulate();
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
|
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();
|
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||||
#include <Graphic3d_Group.hxx>
|
#include <Graphic3d_Group.hxx>
|
||||||
#include <Graphic3d_StructureManager.hxx>
|
#include <Graphic3d_StructureManager.hxx>
|
||||||
#include <Graphic3d_Texture2D.hxx>
|
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||||
#include <Message.hxx>
|
#include <Message.hxx>
|
||||||
#include <Message_Messenger.hxx>
|
#include <Message_Messenger.hxx>
|
||||||
#include <Prs3d_Drawer.hxx>
|
#include <Prs3d_Drawer.hxx>
|
||||||
@@ -278,17 +278,17 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
|
|||||||
TCollection_AsciiString aTextureDesc;
|
TCollection_AsciiString aTextureDesc;
|
||||||
if (!myTexturePixMap.IsNull())
|
if (!myTexturePixMap.IsNull())
|
||||||
{
|
{
|
||||||
myTexture = new Graphic3d_Texture2D (myTexturePixMap);
|
myTexture = new Graphic3d_Texture2Dmanual (myTexturePixMap);
|
||||||
aTextureDesc = " (custom image)";
|
aTextureDesc = " (custom image)";
|
||||||
}
|
}
|
||||||
else if (myPredefTexture != Graphic3d_NOT_2D_UNKNOWN)
|
else if (myPredefTexture != Graphic3d_NOT_2D_UNKNOWN)
|
||||||
{
|
{
|
||||||
myTexture = new Graphic3d_Texture2D (myPredefTexture);
|
myTexture = new Graphic3d_Texture2Dmanual (myPredefTexture);
|
||||||
aTextureDesc = TCollection_AsciiString(" (predefined texture ") + myTexture->GetId() + ")";
|
aTextureDesc = TCollection_AsciiString(" (predefined texture ") + myTexture->GetId() + ")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myTexture = new Graphic3d_Texture2D (myTextureFile.ToCString());
|
myTexture = new Graphic3d_Texture2Dmanual (myTextureFile.ToCString());
|
||||||
aTextureDesc = TCollection_AsciiString(" (") + myTextureFile + ")";
|
aTextureDesc = TCollection_AsciiString(" (") + myTextureFile + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include <PrsMgr_PresentationManager.hxx>
|
#include <PrsMgr_PresentationManager.hxx>
|
||||||
|
|
||||||
class Graphic3d_AspectFillArea3d;
|
class Graphic3d_AspectFillArea3d;
|
||||||
class Graphic3d_Texture2D;
|
class Graphic3d_Texture2Dmanual;
|
||||||
|
|
||||||
//! This class allows to map textures on shapes.
|
//! 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,
|
//! 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
|
protected: //! @name presentation fields
|
||||||
|
|
||||||
Handle(Graphic3d_Texture2D) myTexture;
|
Handle(Graphic3d_Texture2Dmanual) myTexture;
|
||||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||||
|
|
||||||
protected: //! @name texture source fields
|
protected: //! @name texture source fields
|
||||||
|
@@ -23,14 +23,14 @@
|
|||||||
#include <SelectMgr_EntityOwner.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
|
|
||||||
//! Texture holder.
|
//! Texture holder.
|
||||||
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2D
|
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2Dmanual
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
XRTexture (const Handle(Image_Texture)& theImageSource,
|
XRTexture (const Handle(Image_Texture)& theImageSource,
|
||||||
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
|
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
|
||||||
: Graphic3d_Texture2D (""), myImageSource (theImageSource)
|
: Graphic3d_Texture2Dmanual (""), myImageSource (theImageSource)
|
||||||
{
|
{
|
||||||
if (!theImageSource->TextureId().IsEmpty())
|
if (!theImageSource->TextureId().IsEmpty())
|
||||||
{
|
{
|
||||||
|
@@ -114,20 +114,19 @@ public:
|
|||||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
|
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Real VPeriod() const;
|
Standard_EXPORT virtual Standard_Real VPeriod() const;
|
||||||
|
|
||||||
//! Computes the point of parameters U,V on the surface.
|
//! 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;
|
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.
|
//! 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;
|
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.
|
//! Computes the point and the first derivatives on
|
||||||
//! Raised if the continuity of the current intervals is not C1.
|
//! the surface.
|
||||||
//!
|
//! Raised if the continuity of the current
|
||||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
//! intervals is not C1.
|
||||||
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
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
|
//! Computes the point, the first and second
|
||||||
//! derivatives on the surface.
|
//! derivatives on the surface.
|
||||||
//! Raised if the continuity of the current
|
//! Raised if the continuity of the current
|
||||||
|
@@ -141,18 +141,17 @@ public:
|
|||||||
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
|
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
|
||||||
|
|
||||||
//! Computes the point of parameters U,V on the surface.
|
//! 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;
|
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.
|
//! 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;
|
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.
|
//! Computes the point and the first derivatives on
|
||||||
//! Raised if the continuity of the current intervals is not C1.
|
//! the surface.
|
||||||
//!
|
//! Raised if the continuity of the current
|
||||||
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
|
//! intervals is not C1.
|
||||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
|
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
|
//! Computes the point, the first and second
|
||||||
//! derivatives on the surface.
|
//! derivatives on the surface.
|
||||||
//! Raised if the continuity of the current
|
//! Raised if the continuity of the current
|
||||||
|
@@ -316,7 +316,6 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
|||||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
|
||||||
Standard_Real eps = Precision::PConfusion();
|
Standard_Real eps = Precision::PConfusion();
|
||||||
Standard_Boolean toRunParallel = !myMutex.IsNull();
|
Standard_Boolean toRunParallel = !myMutex.IsNull();
|
||||||
const Handle(Adaptor3d_Curve)& aLocalHCurve = GetEdgeCurve(TopoDS::Face(S));
|
|
||||||
while (itcr.More()) {
|
while (itcr.More()) {
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||||
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
|
||||||
@@ -373,13 +372,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
|||||||
Handle(Geom_Surface) Sb = cr->Surface();
|
Handle(Geom_Surface) Sb = cr->Surface();
|
||||||
Sb = Handle(Geom_Surface)::DownCast
|
Sb = Handle(Geom_Surface)::DownCast
|
||||||
// (Su->Transformed(L.Transformation()));
|
// (Su->Transformed(L.Transformation()));
|
||||||
(Su->Transformed(/*L*/TFloc.Transformation()));
|
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
|
||||||
Handle(Geom2d_Curve) PC = cr->PCurve();
|
Handle(Geom2d_Curve) PC = cr->PCurve();
|
||||||
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
|
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
|
||||||
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
|
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
|
||||||
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
||||||
|
|
||||||
BRepLib_ValidateEdge aValidateEdge(aLocalHCurve, ACS, SameParameter);
|
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
|
||||||
aValidateEdge.SetExitIfToleranceExceeded(Tol);
|
aValidateEdge.SetExitIfToleranceExceeded(Tol);
|
||||||
aValidateEdge.SetExactMethod(myIsExactMethod);
|
aValidateEdge.SetExactMethod(myIsExactMethod);
|
||||||
aValidateEdge.SetParallel(toRunParallel);
|
aValidateEdge.SetParallel(toRunParallel);
|
||||||
@@ -403,7 +402,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
|||||||
GHPC->Load(cr->PCurve2(),f,l); // same bounds
|
GHPC->Load(cr->PCurve2(),f,l); // same bounds
|
||||||
ACS->Load(GHPC, GAHS); // sans doute inutile
|
ACS->Load(GHPC, GAHS); // sans doute inutile
|
||||||
|
|
||||||
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(aLocalHCurve, ACS, SameParameter);
|
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(myHCurve, ACS, SameParameter);
|
||||||
aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
|
aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
|
||||||
aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
|
aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
|
||||||
aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
|
aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
|
||||||
@@ -441,12 +440,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
|||||||
// plan en position
|
// plan en position
|
||||||
if (myGctrl) {
|
if (myGctrl) {
|
||||||
P = Handle(Geom_Plane)::
|
P = Handle(Geom_Plane)::
|
||||||
DownCast(P->Transformed(/*L*/TFloc.Transformation()));// eap occ332
|
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
|
||||||
//on projette Cref sur ce plan
|
//on projette Cref sur ce plan
|
||||||
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
|
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
|
||||||
|
|
||||||
// Dub - Normalement aLocalHCurve est une GeomAdaptor_Curve
|
// Dub - Normalement myHCurve est une GeomAdaptor_Curve
|
||||||
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(aLocalHCurve);
|
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(myHCurve);
|
||||||
Handle(Geom_Curve) C3d = Gac->Curve();
|
Handle(Geom_Curve) C3d = Gac->Curve();
|
||||||
Handle(Geom_Curve) ProjOnPlane =
|
Handle(Geom_Curve) ProjOnPlane =
|
||||||
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
|
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
|
||||||
@@ -459,12 +458,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
|
|||||||
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
|
||||||
Handle(Geom2dAdaptor_Curve) GHPC =
|
Handle(Geom2dAdaptor_Curve) GHPC =
|
||||||
new Geom2dAdaptor_Curve(PC,
|
new Geom2dAdaptor_Curve(PC,
|
||||||
aLocalHCurve->FirstParameter(),
|
myHCurve->FirstParameter(),
|
||||||
aLocalHCurve->LastParameter());
|
myHCurve->LastParameter());
|
||||||
|
|
||||||
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
|
||||||
|
|
||||||
BRepLib_ValidateEdge aValidateEdgeProj(aLocalHCurve, ACS, SameParameter);
|
BRepLib_ValidateEdge aValidateEdgeProj(myHCurve, ACS, SameParameter);
|
||||||
aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
|
aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
|
||||||
aValidateEdgeProj.SetExactMethod(myIsExactMethod);
|
aValidateEdgeProj.SetExactMethod(myIsExactMethod);
|
||||||
aValidateEdgeProj.SetParallel(toRunParallel);
|
aValidateEdgeProj.SetParallel(toRunParallel);
|
||||||
@@ -666,50 +665,6 @@ 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
|
//function : CheckPolygonOnTriangulation
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
class BRep_CurveRepresentation;
|
class BRep_CurveRepresentation;
|
||||||
class TopoDS_Edge;
|
class TopoDS_Edge;
|
||||||
class TopoDS_Face;
|
|
||||||
class TopoDS_Shape;
|
class TopoDS_Shape;
|
||||||
|
|
||||||
class BRepCheck_Edge;
|
class BRepCheck_Edge;
|
||||||
@@ -50,11 +49,6 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Standard_Real Tolerance();
|
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;
|
//! Sets status of Edge;
|
||||||
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);
|
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);
|
||||||
|
|
||||||
|
@@ -370,6 +370,18 @@ Standard_Boolean BRepToIGES_BREntity::GetPCurveMode () const
|
|||||||
{
|
{
|
||||||
return myPCurveMode;
|
return myPCurveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BRepToIGES_BREntity::SetConvertSurfaceMode(const Standard_Boolean theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.convertsurface.mode", theVal);
|
||||||
|
myConvSurface = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_EXPORT void BRepToIGES_BREntity::SetPCurveMode(const Standard_Boolean theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.surfacecurve.mode", theVal);
|
||||||
|
myPCurveMode = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ~BRepToIGES_BREntity
|
//function : ~BRepToIGES_BREntity
|
||||||
|
@@ -109,15 +109,24 @@ public:
|
|||||||
//! Returns mode for writing pcurves
|
//! Returns mode for writing pcurves
|
||||||
//! (value of parameter write.surfacecurve.mode)
|
//! (value of parameter write.surfacecurve.mode)
|
||||||
Standard_EXPORT Standard_Boolean GetPCurveMode() const;
|
Standard_EXPORT Standard_Boolean GetPCurveMode() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetConvertSurfaceMode(const Standard_Boolean theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPCurveMode(const Standard_Boolean theVal);
|
||||||
|
|
||||||
Standard_EXPORT virtual ~BRepToIGES_BREntity();
|
Standard_EXPORT virtual ~BRepToIGES_BREntity();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
Handle(IGESData_IGESModel) TheModel;
|
|
||||||
Standard_Real TheUnitFactor;
|
|
||||||
Standard_Boolean myConvSurface;
|
Standard_Boolean myConvSurface;
|
||||||
Standard_Boolean myPCurveMode;
|
Standard_Boolean myPCurveMode;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Handle(IGESData_IGESModel) TheModel;
|
||||||
|
Standard_Real TheUnitFactor;
|
||||||
Handle(Transfer_FinderProcess) TheMap;
|
Handle(Transfer_FinderProcess) TheMap;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BRepToIGES_BREntity_HeaderFile
|
#endif // _BRepToIGES_BREntity_HeaderFile
|
||||||
|
@@ -494,7 +494,7 @@ Handle(IGESSolid_Face) BRepToIGESBRep_Entity ::TransferFace(const TopoDS_Face& s
|
|||||||
GeomToIGES_GeomSurface GS;
|
GeomToIGES_GeomSurface GS;
|
||||||
//S4181 pdn 17.04.99 Boolean flags in order to define write of elementary surfaces added.
|
//S4181 pdn 17.04.99 Boolean flags in order to define write of elementary surfaces added.
|
||||||
GS.SetBRepMode(Standard_True);
|
GS.SetBRepMode(Standard_True);
|
||||||
GS.SetAnalyticMode ( Interface_Static::IVal("write.convertsurface.mode") ==0 );
|
GS.SetAnalyticMode (myConvSurface == 0 );
|
||||||
GS.SetModel(GetModel());
|
GS.SetModel(GetModel());
|
||||||
|
|
||||||
Handle(Geom_Surface) st;
|
Handle(Geom_Surface) st;
|
||||||
|
@@ -140,7 +140,6 @@ private:
|
|||||||
Handle(IGESSolid_EdgeList) myEdgeList;
|
Handle(IGESSolid_EdgeList) myEdgeList;
|
||||||
Handle(IGESSolid_VertexList) myVertexList;
|
Handle(IGESSolid_VertexList) myVertexList;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -695,7 +695,7 @@ Standard_Boolean BRepTools::Write (const TopoDS_Shape& theShape,
|
|||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
|
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out);
|
||||||
if (aStream.get() == NULL || !aStream->good())
|
if (aStream.get() == NULL || !aStream->good())
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@@ -217,7 +217,7 @@ void BndLib_Add3dCurve::Add( const Adaptor3d_Curve& C,
|
|||||||
if(Bsaux->LastParameter() < U2 ) u2 = Bsaux->LastParameter();
|
if(Bsaux->LastParameter() < U2 ) u2 = Bsaux->LastParameter();
|
||||||
// modified by NIZHNY-EAP Fri Dec 3 14:29:18 1999 ___END___
|
// modified by NIZHNY-EAP Fri Dec 3 14:29:18 1999 ___END___
|
||||||
}
|
}
|
||||||
Standard_Real aSegmentTol = 2. * Precision::PConfusion();
|
Standard_Real aSegmentTol = Precision::PConfusion();
|
||||||
if (Abs(u2 - u1) < aSegmentTol)
|
if (Abs(u2 - u1) < aSegmentTol)
|
||||||
aSegmentTol = Abs(u2 - u1) * 0.01;
|
aSegmentTol = Abs(u2 - u1) * 0.01;
|
||||||
Bsaux->Segment(u1, u2, aSegmentTol);
|
Bsaux->Segment(u1, u2, aSegmentTol);
|
||||||
|
@@ -78,11 +78,19 @@ Standard_Boolean CDF_Store::SetFolder(const Standard_ExtString aFolder) {
|
|||||||
Standard_Boolean CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
|
Standard_Boolean CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
|
||||||
|
|
||||||
TCollection_ExtendedString theFolder(aFolder);
|
TCollection_ExtendedString theFolder(aFolder);
|
||||||
Standard_Integer aLen = theFolder.Length();
|
Standard_Integer l = theFolder.Length();
|
||||||
|
|
||||||
// if the last character is the folder separator, remove it.
|
// if the last character is the folder separator (which is always the first character)
|
||||||
if (aLen > 1 && (theFolder.Value(aLen) == '/' || theFolder.Value(aLen) == '\\'))
|
// it is removed.
|
||||||
theFolder.Trunc(aLen-1);
|
// 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(theMetaDataDriver->FindFolder(theFolder)) {
|
if(theMetaDataDriver->FindFolder(theFolder)) {
|
||||||
myCurrentDocument->SetRequestedFolder(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);
|
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
|
||||||
if (aDepthFormat.IsValid()
|
if (aDepthFormat.IsValid()
|
||||||
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
Release (theCtx.get());
|
Release (theCtx.get());
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
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 char* aName = theArgVec[2];
|
||||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out | std::ios::binary);
|
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out);
|
||||||
aStream->precision (15);
|
aStream->precision (15);
|
||||||
if (aStream.get() == NULL || !aStream->good())
|
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.
|
// myIsParallel = TRUE and only the least distance will be returned.
|
||||||
//4. Arcs are not parallel. Then several (or single) extremas will be returned.
|
//4. Arcs are not parallel. Then several (or single) extremas will be returned.
|
||||||
|
|
||||||
if (aRng.Delta() > Precision::Confusion())
|
if (aRng.Delta() > Precision::Angular())
|
||||||
{
|
{
|
||||||
Standard_Real aPar = 0.0;
|
Standard_Real aPar = 0.0;
|
||||||
aRng.GetIntermediatePoint(0.5, aPar);
|
aRng.GetIntermediatePoint(0.5, aPar);
|
||||||
@@ -703,6 +703,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Nearer solution can be found
|
//Nearer solution can be found
|
||||||
}
|
}
|
||||||
else if (!aRng.IsVoid())
|
else if (!aRng.IsVoid())
|
||||||
|
@@ -120,15 +120,6 @@ Extrema_GenExtCS::Extrema_GenExtCS()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : ~Extrema_GenExtCS
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Extrema_GenExtCS::~Extrema_GenExtCS()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Extrema_GenExtCS
|
//function : Extrema_GenExtCS
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@@ -35,12 +35,9 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
//! Empty constructor.
|
|
||||||
Standard_EXPORT Extrema_GenExtCS();
|
Standard_EXPORT Extrema_GenExtCS();
|
||||||
|
|
||||||
//! Destructor.
|
|
||||||
Standard_EXPORT ~Extrema_GenExtCS();
|
|
||||||
|
|
||||||
//! It calculates all the distances.
|
//! It calculates all the distances.
|
||||||
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
||||||
//! extremum when gradient(F)=0. The algorithm searches
|
//! extremum when gradient(F)=0. The algorithm searches
|
||||||
|
@@ -224,19 +224,7 @@ Extrema_GenExtPS::Extrema_GenExtPS()
|
|||||||
myAlgo = Extrema_ExtAlgo_Grad;
|
myAlgo = Extrema_ExtAlgo_Grad;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : ~Extrema_GenExtPS
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Extrema_GenExtPS::~Extrema_GenExtPS()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Extrema_GenExtPS
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Extrema_GenExtPS::Extrema_GenExtPS (const gp_Pnt& P,
|
Extrema_GenExtPS::Extrema_GenExtPS (const gp_Pnt& P,
|
||||||
const Adaptor3d_Surface& S,
|
const Adaptor3d_Surface& S,
|
||||||
const Standard_Integer NbU,
|
const Standard_Integer NbU,
|
||||||
|
@@ -37,12 +37,8 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
//! Empty constructor.
|
|
||||||
Standard_EXPORT Extrema_GenExtPS();
|
Standard_EXPORT Extrema_GenExtPS();
|
||||||
|
|
||||||
//! Destructor.
|
|
||||||
Standard_EXPORT ~Extrema_GenExtPS();
|
|
||||||
|
|
||||||
//! It calculates all the distances.
|
//! It calculates all the distances.
|
||||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||||
//! extremum when gradient(F)=0. The algorithm searches
|
//! extremum when gradient(F)=0. The algorithm searches
|
||||||
|
@@ -118,15 +118,6 @@ Extrema_GenExtSS::Extrema_GenExtSS()
|
|||||||
myInit = Standard_False;
|
myInit = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : ~Extrema_GenExtSS
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Extrema_GenExtSS::~Extrema_GenExtSS()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Extrema_GenExtSS
|
//function : Extrema_GenExtSS
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@@ -36,12 +36,9 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
//! Empty constructor.
|
|
||||||
Standard_EXPORT Extrema_GenExtSS();
|
Standard_EXPORT Extrema_GenExtSS();
|
||||||
|
|
||||||
//! Destructor.
|
|
||||||
Standard_EXPORT ~Extrema_GenExtSS();
|
|
||||||
|
|
||||||
//! It calculates all the distances.
|
//! It calculates all the distances.
|
||||||
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
|
||||||
//! extremum when gradient(F)=0. The algorithm searches
|
//! extremum when gradient(F)=0. The algorithm searches
|
||||||
|
@@ -27,24 +27,29 @@ class gp_Vec;
|
|||||||
class Geom_Surface;
|
class Geom_Surface;
|
||||||
DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
|
DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
|
||||||
|
|
||||||
//! Describes the common behavior of surfaces in 3D space.
|
//! Describes the common behavior of surfaces in 3D
|
||||||
//! The Geom package provides many implementations of concrete derived surfaces,
|
//! space. The Geom package provides many
|
||||||
//! such as planes, cylinders, cones, spheres and tori, surfaces of linear extrusion,
|
//! implementations of concrete derived surfaces, such as
|
||||||
//! surfaces of revolution, Bezier and BSpline surfaces, and so on.
|
//! planes, cylinders, cones, spheres and tori, surfaces of
|
||||||
//! The key characteristic of these surfaces is that they are parameterized.
|
//! linear extrusion, surfaces of revolution, Bezier and
|
||||||
//! Geom_Surface demonstrates:
|
//! BSpline surfaces, and so on.
|
||||||
//! - how to work with the parametric equation of a surface
|
//! The key characteristic of these surfaces is that they
|
||||||
//! to compute the point of parameters (u, v), and, at this point, the 1st, 2nd ... Nth derivative;
|
//! 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
|
//! - how to find global information about a surface in
|
||||||
//! each parametric direction (for example, level of continuity, whether the surface is closed,
|
//! each parametric direction (for example, level of
|
||||||
//! its periodicity, the bounds of the parameters and so on);
|
//! continuity, whether the surface is closed, its
|
||||||
//! - how the parameters change when geometric transformations are applied to the surface,
|
//! periodicity, the bounds of the parameters and so on), and
|
||||||
//! or the orientation is modified.
|
//! - how the parameters change when geometric
|
||||||
//!
|
//! transformations are applied to the surface, or the
|
||||||
//! Note that all surfaces must have a geometric continuity, and any surface is at least "C0".
|
//! orientation is modified.
|
||||||
//! Generally, continuity is checked at construction time or when the curve is edited.
|
//! Note that all surfaces must have a geometric
|
||||||
//! Where this is not the case, the documentation makes this explicit.
|
//! 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
|
//! Warning
|
||||||
//! The Geom package does not prevent the construction of
|
//! The Geom package does not prevent the construction of
|
||||||
//! surfaces with null areas, or surfaces which self-intersect.
|
//! surfaces with null areas, or surfaces which self-intersect.
|
||||||
@@ -137,42 +142,47 @@ public:
|
|||||||
//! equal to Precision::Infinite: instead of Standard_Real::LastReal.
|
//! 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;
|
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.
|
//! Checks whether this surface is closed in the u
|
||||||
//! Returns true if, in the u parametric direction:
|
//! parametric direction.
|
||||||
//! taking uFirst and uLast as the parametric bounds in
|
//! Returns true if, in the u parametric direction: taking
|
||||||
//! the u parametric direction, for each parameter v,
|
//! uFirst and uLast as the parametric bounds in
|
||||||
//! the distance between the points P(uFirst, v) and
|
//! 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().
|
//! P(uLast, v) is less than or equal to gp::Resolution().
|
||||||
Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
|
Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
|
||||||
|
|
||||||
//! Checks whether this surface is closed in the u parametric direction.
|
//! Checks whether this surface is closed in the u
|
||||||
//! Returns true if, in the v parametric direction:
|
//! parametric direction.
|
||||||
//! taking vFirst and vLast as the parametric bounds in the v parametric direction,
|
//! Returns true if, in the v parametric
|
||||||
//! for each parameter u, the distance between the points
|
//! direction: taking vFirst and vLast as the
|
||||||
//! P(u, vFirst) and P(u, vLast) is less than or equal to gp::Resolution().
|
//! 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;
|
Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
|
||||||
|
|
||||||
//! Checks if this surface is periodic in the u parametric direction.
|
//! Checks if this surface is periodic in the u
|
||||||
//! Returns true if:
|
//! parametric direction. Returns true if:
|
||||||
//! - this surface is closed in the u parametric direction, and
|
//! - this surface is closed in the u parametric direction, and
|
||||||
//! - there is a constant T such that the distance
|
//! - there is a constant T such that the distance
|
||||||
//! between the points P (u, v) and P (u + T, v)
|
//! between the points P (u, v) and P (u + T,
|
||||||
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
|
//! 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.
|
//! Note: T is the parametric period in the u parametric direction.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
|
Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
|
||||||
|
|
||||||
//! Returns the period of this surface in the u parametric direction.
|
//! Returns the period of this surface in the u
|
||||||
//! Raises if the surface is not uperiodic.
|
//! parametric direction.
|
||||||
|
//! raises if the surface is not uperiodic.
|
||||||
Standard_EXPORT virtual Standard_Real UPeriod() const;
|
Standard_EXPORT virtual Standard_Real UPeriod() const;
|
||||||
|
|
||||||
//! Checks if this surface is periodic in the v parametric direction.
|
//! Checks if this surface is periodic in the v
|
||||||
//! Returns true if:
|
//! parametric direction. Returns true if:
|
||||||
//! - this surface is closed in the v parametric direction, and
|
//! - this surface is closed in the v parametric direction, and
|
||||||
//! - there is a constant T such that the distance
|
//! - there is a constant T such that the distance
|
||||||
//! between the points P (u, v) and P (u + T, v)
|
//! between the points P (u, v) and P (u + T,
|
||||||
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
|
//! 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.
|
//! Note: T is the parametric period in the v parametric direction.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
|
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
|
||||||
|
|
||||||
@@ -187,24 +197,25 @@ public:
|
|||||||
Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0;
|
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 :
|
//! Returns the Global Continuity of the surface in direction U and V :
|
||||||
//! - C0: only geometric continuity,
|
//! C0 : only geometric continuity,
|
||||||
//! - C1: continuity of the first derivative all along the surface,
|
//! C1 : continuity of the first derivative all along the surface,
|
||||||
//! - C2: continuity of the second 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,
|
//! C3 : continuity of the third derivative all along the surface,
|
||||||
//! - G1: tangency continuity all along the surface,
|
//! G1 : tangency continuity all along the surface,
|
||||||
//! - G2: curvature continuity all along the surface,
|
//! G2 : curvature continuity all along the surface,
|
||||||
//! - CN: the order of continuity is infinite.
|
//! CN : the order of continuity is infinite.
|
||||||
//!
|
//! Example :
|
||||||
//! Example:
|
|
||||||
//! If the surface is C1 in the V parametric direction and C2
|
//! If the surface is C1 in the V parametric direction and C2
|
||||||
//! in the U parametric direction Shape = C1.
|
//! in the U parametric direction Shape = C1.
|
||||||
Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
|
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.
|
//! Raised if N < 0.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 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.
|
//! Raised if N < 0.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
|
Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
|
||||||
|
|
||||||
@@ -215,10 +226,9 @@ public:
|
|||||||
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const = 0;
|
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.
|
//! 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;
|
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
|
//! Computes the point P, the first and the second derivatives in
|
||||||
@@ -231,18 +241,21 @@ public:
|
|||||||
//! Raised if the continuity of the surface is not C2.
|
//! 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;
|
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;
|
||||||
|
|
||||||
//! Computes the derivative of order Nu in the direction U and Nv in the direction V at the point P(U, V).
|
//! ---Purpose ;
|
||||||
|
//! 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.
|
//! 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;
|
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, V) on the surface.
|
//! Computes the point of parameter U 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;
|
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||||
|
|
||||||
//! Dumps the content of me into the stream
|
//! Dumps the content of me into the stream
|
||||||
|
@@ -80,16 +80,11 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
|||||||
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool(myHS1);
|
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool(myHS1);
|
||||||
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool(myHS2);
|
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool(myHS2);
|
||||||
myLConstruct.Load(dom1,dom2,myHS1,myHS2);
|
myLConstruct.Load(dom1,dom2,myHS1,myHS2);
|
||||||
|
|
||||||
Standard_Real TolArc = Tol;
|
Standard_Real TolArc = Tol;
|
||||||
Standard_Real TolTang = Tol;
|
Standard_Real TolTang = Tol;
|
||||||
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
||||||
Standard_Real Deflection = 0.1;
|
Standard_Real Deflection = 0.1;
|
||||||
if (myHS1->GetType() == GeomAbs_BSplineSurface && myHS2->GetType() == GeomAbs_BSplineSurface)
|
|
||||||
{
|
|
||||||
Deflection /= 10.;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
|
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
|
||||||
|
|
||||||
|
@@ -2371,143 +2371,119 @@ void GeomLib::CancelDenominatorDerivative(Handle(Geom_BSplineSurface) &
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : NormEstim
|
//function : NormEstim
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer GeomLib::NormEstim (const Handle(Geom_Surface)& theSurf,
|
|
||||||
const gp_Pnt2d& theUV,
|
Standard_Integer GeomLib::NormEstim(const Handle(Geom_Surface)& S,
|
||||||
const Standard_Real theTol,
|
const gp_Pnt2d& UV,
|
||||||
gp_Dir& theNorm)
|
const Standard_Real Tol, gp_Dir& N)
|
||||||
{
|
{
|
||||||
const Standard_Real aTol2 = Square (theTol);
|
|
||||||
|
|
||||||
gp_Vec DU, DV;
|
gp_Vec DU, DV;
|
||||||
gp_Pnt aDummyPnt;
|
gp_Pnt DummyPnt;
|
||||||
theSurf->D1 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV);
|
Standard_Real aTol2 = Square(Tol);
|
||||||
|
|
||||||
const Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
|
S->D1(UV.X(), UV.Y(), DummyPnt, DU, DV);
|
||||||
if (MDU >= aTol2
|
|
||||||
&& MDV >= aTol2)
|
Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
|
||||||
{
|
|
||||||
gp_Vec aNorm = DU ^ DV;
|
if(MDU >= aTol2 && MDV >= aTol2) {
|
||||||
Standard_Real aMagn = aNorm.SquareMagnitude();
|
gp_Vec Norm = DU^DV;
|
||||||
if (aMagn < aTol2)
|
Standard_Real Magn = Norm.SquareMagnitude();
|
||||||
{
|
if(Magn < aTol2) return 3;
|
||||||
return 3;
|
|
||||||
}
|
//Magn = sqrt(Magn);
|
||||||
|
N.SetXYZ(Norm.XYZ());
|
||||||
|
|
||||||
theNorm.SetXYZ (aNorm.XYZ());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
gp_Vec D2U, D2V, D2UV;
|
||||||
|
Standard_Boolean isDone;
|
||||||
|
CSLib_NormalStatus aStatus;
|
||||||
|
gp_Dir aNormal;
|
||||||
|
|
||||||
gp_Vec D2U, D2V, D2UV;
|
S->D2(UV.X(), UV.Y(), DummyPnt, DU, DV, D2U, D2V, D2UV);
|
||||||
Standard_Boolean isDone = false;
|
CSLib::Normal(DU, DV, D2U, D2V, D2UV, Tol, isDone, aStatus, aNormal);
|
||||||
CSLib_NormalStatus aStatus;
|
|
||||||
gp_Dir aNormal;
|
|
||||||
|
|
||||||
theSurf->D2 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV, D2U, D2V, D2UV);
|
if (isDone) {
|
||||||
CSLib::Normal (DU, DV, D2U, D2V, D2UV, theTol, isDone, aStatus, aNormal);
|
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||||
if (!isDone)
|
Standard_Real step = 1.0e-5;
|
||||||
{
|
Standard_Real eps = 1.0e-16;
|
||||||
// computation is impossible
|
Standard_Real sign = -1.0;
|
||||||
return aStatus == CSLib_D1NIsNull ? 2 : 3;
|
|
||||||
}
|
S->Bounds(Umin, Umax, Vmin, Vmax);
|
||||||
|
|
||||||
Standard_Real Umin, Umax, Vmin, Vmax;
|
// check for cone apex singularity point
|
||||||
Standard_Real step = 1.0e-5;
|
if ((UV.Y() > Vmin + step) && (UV.Y() < Vmax - step))
|
||||||
Standard_Real eps = 1.0e-16;
|
{
|
||||||
Standard_Real sign = -1.0;
|
gp_Dir aNormal1, aNormal2;
|
||||||
theSurf->Bounds (Umin, Umax, Vmin, Vmax);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check for cone apex singularity point
|
// Along V
|
||||||
if ((theUV.Y() > Vmin + step)
|
if(MDU < aTol2 && MDV >= aTol2) {
|
||||||
&& (theUV.Y() < Vmax - step))
|
if ((Vmax - UV.Y()) > (UV.Y() - Vmin))
|
||||||
{
|
sign = 1.0;
|
||||||
gp_Dir aNormal1, aNormal2;
|
S->D1(UV.X(), UV.Y() + sign * step, DummyPnt, DU, DV);
|
||||||
Standard_Real aConeSingularityAngleEps = 1.0e-4;
|
gp_Vec Norm = DU^DV;
|
||||||
theSurf->D1(theUV.X(), theUV.Y() - sign * step, aDummyPnt, DU, DV);
|
if (Norm.SquareMagnitude() < eps) {
|
||||||
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps))
|
Standard_Real sign1 = -1.0;
|
||||||
{
|
if ((Umax - UV.X()) > (UV.X() - Umin))
|
||||||
aNormal1 = DU ^ DV;
|
sign1 = 1.0;
|
||||||
theSurf->D1 (theUV.X(), theUV.Y() + sign * step, aDummyPnt, DU, DV);
|
S->D1(UV.X() + sign1 * step, UV.Y() + sign * step, DummyPnt, DU, DV);
|
||||||
if ((DU.XYZ().SquareModulus() > eps)
|
Norm = DU^DV;
|
||||||
&& (DV.XYZ().SquareModulus() > eps))
|
}
|
||||||
{
|
if ((Norm.SquareMagnitude() >= eps) && (Norm.Dot(aNormal) < 0.0))
|
||||||
aNormal2 = DU^DV;
|
aNormal.Reverse();
|
||||||
if (aNormal1.IsOpposite (aNormal2, aConeSingularityAngleEps))
|
}
|
||||||
{
|
|
||||||
|
// 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;
|
return 2;
|
||||||
}
|
}
|
||||||
|
// computation is impossible
|
||||||
|
else {
|
||||||
|
// conical
|
||||||
|
if (aStatus == CSLib_D1NIsNull) {
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 3;
|
||||||
// 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,19 +183,8 @@ public:
|
|||||||
//! Cancel,on the boundaries,the denominator first derivative
|
//! Cancel,on the boundaries,the denominator first derivative
|
||||||
//! in the directions wished by the user and set its value to 1.
|
//! 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 void CancelDenominatorDerivative (Handle(Geom_BSplineSurface)& BSurf, const Standard_Boolean UDirection, const Standard_Boolean VDirection);
|
||||||
|
|
||||||
//! Estimate surface normal at the given (U, V) point.
|
Standard_EXPORT static Standard_Integer NormEstim (const Handle(Geom_Surface)& S, const gp_Pnt2d& UV, const Standard_Real Tol, gp_Dir& N);
|
||||||
//! @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
|
//! This method defines if opposite boundaries of surface
|
||||||
//! coincide with given tolerance
|
//! coincide with given tolerance
|
||||||
|
@@ -87,6 +87,7 @@
|
|||||||
GeomToIGES_GeomCurve::GeomToIGES_GeomCurve()
|
GeomToIGES_GeomCurve::GeomToIGES_GeomCurve()
|
||||||
:GeomToIGES_GeomEntity()
|
:GeomToIGES_GeomEntity()
|
||||||
{
|
{
|
||||||
|
myOffsetModeIVal = Interface_Static::IVal("write.iges.offset.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -98,6 +99,7 @@ GeomToIGES_GeomCurve::GeomToIGES_GeomCurve
|
|||||||
(const GeomToIGES_GeomEntity& GE)
|
(const GeomToIGES_GeomEntity& GE)
|
||||||
:GeomToIGES_GeomEntity(GE)
|
:GeomToIGES_GeomEntity(GE)
|
||||||
{
|
{
|
||||||
|
myOffsetModeIVal = Interface_Static::IVal("write.iges.offset.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -815,7 +817,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
|||||||
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
|
||||||
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
|
||||||
|
|
||||||
if (Interface_Static::IVal("write.iges.offset.mode") == 0)
|
if (myOffsetModeIVal == 0)
|
||||||
{
|
{
|
||||||
res = TransferCurve(GeomConvert::CurveToBSplineCurve(start),U1,U2);
|
res = TransferCurve(GeomConvert::CurveToBSplineCurve(start),U1,U2);
|
||||||
return res;
|
return res;
|
||||||
@@ -853,3 +855,14 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
|
|||||||
res = OffsetC;
|
res = OffsetC;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeomToIGES_GeomCurve::SetOffsetModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.iges.offset.mode", theVal);
|
||||||
|
myOffsetModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer GeomToIGES_GeomCurve::GetOffsetModeIVal() const
|
||||||
|
{
|
||||||
|
return myOffsetModeIVal;
|
||||||
|
}
|
||||||
|
@@ -92,7 +92,9 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCurve (const Handle(Geom_OffsetCurve)& start, const Standard_Real Udeb, const Standard_Real Ufin);
|
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCurve (const Handle(Geom_OffsetCurve)& start, const Standard_Real Udeb, const Standard_Real Ufin);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetOffsetModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetOffsetModeIVal() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -104,7 +106,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
Standard_Integer myOffsetModeIVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -100,6 +100,7 @@ GeomToIGES_GeomSurface::GeomToIGES_GeomSurface()
|
|||||||
{
|
{
|
||||||
myBRepMode = Standard_False;
|
myBRepMode = Standard_False;
|
||||||
myAnalytic = Standard_False;
|
myAnalytic = Standard_False;
|
||||||
|
myPlaneModeIVal = Interface_Static::IVal("write.iges.plane.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ GeomToIGES_GeomSurface::GeomToIGES_GeomSurface(const GeomToIGES_GeomEntity& GE)
|
|||||||
{
|
{
|
||||||
myBRepMode = Standard_False;
|
myBRepMode = Standard_False;
|
||||||
myAnalytic = Standard_False;
|
myAnalytic = Standard_False;
|
||||||
|
myPlaneModeIVal = Interface_Static::IVal("write.iges.plane.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -537,7 +539,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle
|
|||||||
if (start.IsNull()) {
|
if (start.IsNull()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (Interface_Static::IVal("write.iges.plane.mode") == 0){
|
if (myPlaneModeIVal == 0){
|
||||||
Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane;
|
Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane;
|
||||||
Standard_Real A,B,C,D;
|
Standard_Real A,B,C,D;
|
||||||
start->Coefficients(A,B,C,D);
|
start->Coefficients(A,B,C,D);
|
||||||
@@ -1347,3 +1349,13 @@ void GeomToIGES_GeomSurface::SetAnalyticMode(const Standard_Boolean flag)
|
|||||||
myAnalytic = flag;
|
myAnalytic = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeomToIGES_GeomSurface::SetPlaneModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.iges.plane.mode", theVal);
|
||||||
|
myPlaneModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer GeomToIGES_GeomSurface::GetPlaneModeIVal() const
|
||||||
|
{
|
||||||
|
return myPlaneModeIVal;
|
||||||
|
}
|
||||||
|
@@ -129,7 +129,9 @@ public:
|
|||||||
//! Setst flag for writing elementary surfaces
|
//! Setst flag for writing elementary surfaces
|
||||||
Standard_EXPORT void SetAnalyticMode (const Standard_Boolean flag);
|
Standard_EXPORT void SetAnalyticMode (const Standard_Boolean flag);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPlaneModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetPlaneModeIVal() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -145,6 +147,7 @@ private:
|
|||||||
Standard_Real TheLength;
|
Standard_Real TheLength;
|
||||||
Standard_Boolean myBRepMode;
|
Standard_Boolean myBRepMode;
|
||||||
Standard_Boolean myAnalytic;
|
Standard_Boolean myAnalytic;
|
||||||
|
Standard_Integer myPlaneModeIVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -154,11 +154,10 @@ Graphic3d_Texture1Dsegment.cxx
|
|||||||
Graphic3d_Texture1Dsegment.hxx
|
Graphic3d_Texture1Dsegment.hxx
|
||||||
Graphic3d_Texture2D.cxx
|
Graphic3d_Texture2D.cxx
|
||||||
Graphic3d_Texture2D.hxx
|
Graphic3d_Texture2D.hxx
|
||||||
|
Graphic3d_Texture2Dmanual.cxx
|
||||||
Graphic3d_Texture2Dmanual.hxx
|
Graphic3d_Texture2Dmanual.hxx
|
||||||
Graphic3d_Texture2Dplane.cxx
|
Graphic3d_Texture2Dplane.cxx
|
||||||
Graphic3d_Texture2Dplane.hxx
|
Graphic3d_Texture2Dplane.hxx
|
||||||
Graphic3d_Texture3D.cxx
|
|
||||||
Graphic3d_Texture3D.hxx
|
|
||||||
Graphic3d_TextureEnv.cxx
|
Graphic3d_TextureEnv.cxx
|
||||||
Graphic3d_TextureEnv.hxx
|
Graphic3d_TextureEnv.hxx
|
||||||
Graphic3d_TextureMap.cxx
|
Graphic3d_TextureMap.cxx
|
||||||
|
@@ -15,40 +15,3 @@
|
|||||||
#include <Graphic3d_CubeMap.hxx>
|
#include <Graphic3d_CubeMap.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMap, Graphic3d_TextureMap)
|
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,12 +26,24 @@ class Graphic3d_CubeMap : public Graphic3d_TextureMap
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor defining loading cubemap from file.
|
//! Constructor defining loading cubemap from file.
|
||||||
Standard_EXPORT Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
|
Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
|
||||||
Standard_Boolean theToGenerateMipmaps = Standard_False);
|
Standard_Boolean theToGenerateMipmaps = Standard_False) :
|
||||||
|
Graphic3d_TextureMap (theFileName, Graphic3d_TOT_CUBEMAP),
|
||||||
|
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||||
|
myEndIsReached (false),
|
||||||
|
myZIsInverted (false),
|
||||||
|
myHasMipmaps (theToGenerateMipmaps)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Constructor defining direct cubemap initialization from PixMap.
|
//! Constructor defining direct cubemap initialization from PixMap.
|
||||||
Standard_EXPORT Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
|
Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
|
||||||
Standard_Boolean theToGenerateMipmaps = Standard_False);
|
Standard_Boolean theToGenerateMipmaps = Standard_False) :
|
||||||
|
Graphic3d_TextureMap (thePixmap, Graphic3d_TOT_CUBEMAP),
|
||||||
|
myCurrentSide (Graphic3d_CMS_POS_X),
|
||||||
|
myEndIsReached (false),
|
||||||
|
myZIsInverted (false),
|
||||||
|
myHasMipmaps (theToGenerateMipmaps)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Returns whether the iterator has reached the end (true if it hasn't).
|
//! Returns whether the iterator has reached the end (true if it hasn't).
|
||||||
Standard_Boolean More() const { return !myEndIsReached; }
|
Standard_Boolean More() const { return !myEndIsReached; }
|
||||||
@@ -88,13 +100,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Empty destructor.
|
//! Empty destructor.
|
||||||
Standard_EXPORT virtual ~Graphic3d_CubeMap();
|
~Graphic3d_CubeMap() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
|
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
|
||||||
Standard_Boolean myEndIsReached; //!< Indicates whether end of iteration has been reached or hasn't
|
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 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,
|
Graphic3d_MediaTexture::Graphic3d_MediaTexture (const Handle(Standard_HMutex)& theMutex,
|
||||||
Standard_Integer thePlane)
|
Standard_Integer thePlane)
|
||||||
: Graphic3d_Texture2D ("", Graphic3d_TypeOfTexture_2D),
|
: Graphic3d_Texture2D ("", Graphic3d_TOT_2D),
|
||||||
myMutex (theMutex),
|
myMutex (theMutex),
|
||||||
myPlane (thePlane)
|
myPlane (thePlane)
|
||||||
{
|
{
|
||||||
|
@@ -14,8 +14,10 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
#include <Graphic3d_Texture1Dmanual.hxx>
|
|
||||||
|
|
||||||
|
#include <Graphic3d_Texture1Dmanual.hxx>
|
||||||
|
#include <Graphic3d_TypeOfTextureMode.hxx>
|
||||||
|
#include <Standard_Type.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
||||||
@@ -25,7 +27,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiString& theFileName)
|
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiString& theFileName)
|
||||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D)
|
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -35,7 +37,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiStr
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfTexture1D theNOT)
|
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfTexture1D theNOT)
|
||||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D)
|
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -45,7 +47,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfText
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Handle(Image_PixMap)& thePixMap)
|
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Handle(Image_PixMap)& thePixMap)
|
||||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D)
|
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
@@ -17,27 +17,55 @@
|
|||||||
#ifndef _Graphic3d_Texture1Dmanual_HeaderFile
|
#ifndef _Graphic3d_Texture1Dmanual_HeaderFile
|
||||||
#define _Graphic3d_Texture1Dmanual_HeaderFile
|
#define _Graphic3d_Texture1Dmanual_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
#include <Graphic3d_Texture1D.hxx>
|
#include <Graphic3d_Texture1D.hxx>
|
||||||
#include <Graphic3d_NameOfTexture1D.hxx>
|
#include <Graphic3d_NameOfTexture1D.hxx>
|
||||||
|
class TCollection_AsciiString;
|
||||||
|
|
||||||
|
|
||||||
|
class Graphic3d_Texture1Dmanual;
|
||||||
DEFINE_STANDARD_HANDLE(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
|
DEFINE_STANDARD_HANDLE(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
|
||||||
|
|
||||||
//! This class provides the implementation of a manual 1D texture.
|
//! This class provides the implementation of a manual 1D texture.
|
||||||
//! you MUST provide texture coordinates on your facets if you want to see your texture.
|
//! you MUST provides texture coordinates on your facets if you want to see your texture.
|
||||||
class Graphic3d_Texture1Dmanual : public Graphic3d_Texture1D
|
class Graphic3d_Texture1Dmanual : public Graphic3d_Texture1D
|
||||||
{
|
{
|
||||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
//! Creates a texture from the file FileName.
|
//! Creates a texture from the file FileName.
|
||||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const TCollection_AsciiString& theFileName);
|
Standard_EXPORT Graphic3d_Texture1Dmanual(const TCollection_AsciiString& theFileName);
|
||||||
|
|
||||||
//! Create a texture from a predefined texture name set.
|
//! Create a texture from a predefined texture name set.
|
||||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const Graphic3d_NameOfTexture1D theNOT);
|
Standard_EXPORT Graphic3d_Texture1Dmanual(const Graphic3d_NameOfTexture1D theNOT);
|
||||||
|
|
||||||
//! Creates a texture from the pixmap.
|
//! Creates a texture from the pixmap.
|
||||||
Standard_EXPORT Graphic3d_Texture1Dmanual(const Handle(Image_PixMap)& thePixMap);
|
Standard_EXPORT Graphic3d_Texture1Dmanual(const Handle(Image_PixMap)& thePixMap);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _Graphic3d_Texture1Dmanual_HeaderFile
|
#endif // _Graphic3d_Texture1Dmanual_HeaderFile
|
||||||
|
@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dsegment,Graphic3d_Texture1D)
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiString& theFileName)
|
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiString& theFileName)
|
||||||
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D),
|
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D),
|
||||||
myX1 (0.0f),
|
myX1 (0.0f),
|
||||||
myY1 (0.0f),
|
myY1 (0.0f),
|
||||||
myZ1 (0.0f),
|
myZ1 (0.0f),
|
||||||
@@ -47,7 +47,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiS
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTexture1D theNOT)
|
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTexture1D theNOT)
|
||||||
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D),
|
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D),
|
||||||
myX1 (0.0f),
|
myX1 (0.0f),
|
||||||
myY1 (0.0f),
|
myY1 (0.0f),
|
||||||
myZ1 (0.0f),
|
myZ1 (0.0f),
|
||||||
@@ -66,7 +66,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTe
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Handle(Image_PixMap)& thePixMap)
|
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Handle(Image_PixMap)& thePixMap)
|
||||||
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D),
|
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D),
|
||||||
myX1 (0.0f),
|
myX1 (0.0f),
|
||||||
myY1 (0.0f),
|
myY1 (0.0f),
|
||||||
myZ1 (0.0f),
|
myZ1 (0.0f),
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <Graphic3d_Texture2D.hxx>
|
#include <Graphic3d_Texture2D.hxx>
|
||||||
|
|
||||||
#include <Graphic3d_TextureParams.hxx>
|
|
||||||
#include <Standard_OutOfRange.hxx>
|
#include <Standard_OutOfRange.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2D,Graphic3d_TextureMap)
|
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2D,Graphic3d_TextureMap)
|
||||||
@@ -47,20 +46,6 @@ static const char *NameOfTexture2d_to_FileName[] =
|
|||||||
"2d_chess.rgba"
|
"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
|
// function : Graphic3d_Texture2D
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -70,25 +55,6 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFile
|
|||||||
: Graphic3d_TextureMap (theFileName, theType),
|
: Graphic3d_TextureMap (theFileName, theType),
|
||||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -105,20 +71,6 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT
|
|||||||
+ NameOfTexture2d_to_FileName[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
|
// function : Graphic3d_Texture2D
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -128,7 +80,6 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixM
|
|||||||
: Graphic3d_TextureMap (thePixMap, theType),
|
: Graphic3d_TextureMap (thePixMap, theType),
|
||||||
myName (Graphic3d_NOT_2D_UNKNOWN)
|
myName (Graphic3d_NOT_2D_UNKNOWN)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@@ -34,18 +34,6 @@ public:
|
|||||||
|
|
||||||
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
|
//! Returns the name of the predefined textures or NOT_2D_UNKNOWN
|
||||||
//! when the name is given as a filename.
|
//! when the name is given as a filename.
|
||||||
Standard_EXPORT Graphic3d_NameOfTexture2D Name() const;
|
Standard_EXPORT Graphic3d_NameOfTexture2D Name() const;
|
||||||
@@ -54,6 +42,13 @@ public:
|
|||||||
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
|
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
|
||||||
Standard_EXPORT void SetImage (const Handle(Image_PixMap)& thePixMap);
|
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:
|
protected:
|
||||||
|
|
||||||
Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName, const Graphic3d_TypeOfTexture theType);
|
Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName, const Graphic3d_TypeOfTexture theType);
|
||||||
|
58
src/Graphic3d/Graphic3d_Texture2Dmanual.cxx
Normal file
58
src/Graphic3d/Graphic3d_Texture2Dmanual.cxx
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// 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,7 +20,28 @@
|
|||||||
#include <Graphic3d_Texture2D.hxx>
|
#include <Graphic3d_Texture2D.hxx>
|
||||||
#include <Graphic3d_NameOfTexture2D.hxx>
|
#include <Graphic3d_NameOfTexture2D.hxx>
|
||||||
|
|
||||||
Standard_DEPRECATED ("Deprecated alias to Graphic3d_Texture2D")
|
//! This class defined a manual texture 2D
|
||||||
typedef Graphic3d_Texture2D Graphic3d_Texture2Dmanual;
|
//! 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)
|
||||||
|
|
||||||
#endif // _Graphic3d_Texture2Dmanual_HeaderFile
|
#endif // _Graphic3d_Texture2Dmanual_HeaderFile
|
||||||
|
@@ -28,8 +28,11 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiString& theFileName)
|
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiString& theFileName)
|
||||||
: Graphic3d_Texture2D (theFileName)
|
: Graphic3d_Texture2D (theFileName, Graphic3d_TOT_2D_MIPMAP)
|
||||||
{
|
{
|
||||||
|
myParams->SetModulate (Standard_True);
|
||||||
|
myParams->SetRepeat (Standard_True);
|
||||||
|
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||||
@@ -40,8 +43,11 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiStrin
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTexture2D theNOT)
|
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTexture2D theNOT)
|
||||||
: Graphic3d_Texture2D (theNOT)
|
: Graphic3d_Texture2D (theNOT, Graphic3d_TOT_2D_MIPMAP)
|
||||||
{
|
{
|
||||||
|
myParams->SetModulate (Standard_True);
|
||||||
|
myParams->SetRepeat (Standard_True);
|
||||||
|
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||||
@@ -52,8 +58,11 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTextur
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Handle(Image_PixMap)& thePixMap)
|
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Handle(Image_PixMap)& thePixMap)
|
||||||
: Graphic3d_Texture2D (thePixMap)
|
: Graphic3d_Texture2D (thePixMap, Graphic3d_TOT_2D_MIPMAP)
|
||||||
{
|
{
|
||||||
|
myParams->SetModulate (Standard_True);
|
||||||
|
myParams->SetRepeat (Standard_True);
|
||||||
|
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||||
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
|
||||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||||
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
|
||||||
|
@@ -1,127 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
@@ -1,51 +0,0 @@
|
|||||||
// 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,10 +42,9 @@ static const char *NameOfTextureEnv_to_FileName[] =
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFileName)
|
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFileName)
|
||||||
: Graphic3d_TextureRoot (theFileName, Graphic3d_TypeOfTexture_2D),
|
: Graphic3d_TextureRoot (theFileName, Graphic3d_TOT_2D_MIPMAP),
|
||||||
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
||||||
{
|
{
|
||||||
myHasMipmaps = true;
|
|
||||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||||
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
||||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||||
@@ -57,10 +56,9 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFi
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv theNOT)
|
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv theNOT)
|
||||||
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TypeOfTexture_2D),
|
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TOT_2D_MIPMAP),
|
||||||
myName (theNOT)
|
myName (theNOT)
|
||||||
{
|
{
|
||||||
myHasMipmaps = true;
|
|
||||||
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
|
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
|
||||||
myTexId = TCollection_AsciiString ("Graphic3d_TextureEnv_")
|
myTexId = TCollection_AsciiString ("Graphic3d_TextureEnv_")
|
||||||
+ NameOfTextureEnv_to_FileName[theNOT];
|
+ NameOfTextureEnv_to_FileName[theNOT];
|
||||||
@@ -76,10 +74,9 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv the
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Handle(Image_PixMap)& thePixMap)
|
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Handle(Image_PixMap)& thePixMap)
|
||||||
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TypeOfTexture_2D),
|
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TOT_2D_MIPMAP),
|
||||||
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
myName (Graphic3d_NOT_ENV_UNKNOWN)
|
||||||
{
|
{
|
||||||
myHasMipmaps = true;
|
|
||||||
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
|
||||||
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
|
||||||
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
|
||||||
|
@@ -92,10 +92,9 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const TCollection_AsciiString& the
|
|||||||
: myParams (new Graphic3d_TextureParams()),
|
: myParams (new Graphic3d_TextureParams()),
|
||||||
myPath (theFileName),
|
myPath (theFileName),
|
||||||
myRevision (0),
|
myRevision (0),
|
||||||
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
|
myType (theType),
|
||||||
myIsColorMap (true),
|
myIsColorMap (true),
|
||||||
myIsTopDown (true),
|
myIsTopDown (true)
|
||||||
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
|
|
||||||
{
|
{
|
||||||
generateId();
|
generateId();
|
||||||
}
|
}
|
||||||
@@ -109,10 +108,9 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const Handle(Image_PixMap)& theP
|
|||||||
: myParams (new Graphic3d_TextureParams()),
|
: myParams (new Graphic3d_TextureParams()),
|
||||||
myPixMap (thePixMap),
|
myPixMap (thePixMap),
|
||||||
myRevision (0),
|
myRevision (0),
|
||||||
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
|
myType (theType),
|
||||||
myIsColorMap (true),
|
myIsColorMap (true),
|
||||||
myIsTopDown (true),
|
myIsTopDown (true)
|
||||||
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
|
|
||||||
{
|
{
|
||||||
generateId();
|
generateId();
|
||||||
}
|
}
|
||||||
|
@@ -113,12 +113,6 @@ public:
|
|||||||
//! Set flag indicating color nature of values within the texture.
|
//! Set flag indicating color nature of values within the texture.
|
||||||
void SetColorMap (Standard_Boolean theIsColor) { myIsColorMap = theIsColor; }
|
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.
|
//! Returns whether row's memory layout is top-down.
|
||||||
Standard_Boolean IsTopDown() const { return myIsTopDown; }
|
Standard_Boolean IsTopDown() const { return myIsTopDown; }
|
||||||
|
|
||||||
@@ -154,7 +148,7 @@ protected:
|
|||||||
Graphic3d_TypeOfTexture myType; //!< texture type
|
Graphic3d_TypeOfTexture myType; //!< texture type
|
||||||
Standard_Boolean myIsColorMap; //!< flag indicating color nature of values within the texture
|
Standard_Boolean myIsColorMap; //!< flag indicating color nature of values within the texture
|
||||||
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
|
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
|
||||||
Standard_Boolean myHasMipmaps; //!< Indicates whether mipmaps should be generated or not
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,26 +20,10 @@
|
|||||||
//! Type of the texture file format.
|
//! Type of the texture file format.
|
||||||
enum Graphic3d_TypeOfTexture
|
enum Graphic3d_TypeOfTexture
|
||||||
{
|
{
|
||||||
//! 1D texture (array).
|
Graphic3d_TOT_1D,
|
||||||
//! Note that this texture type might be unsupported by graphics API (emulated by 2D texture with 1 pixel height).
|
Graphic3d_TOT_2D,
|
||||||
Graphic3d_TypeOfTexture_1D,
|
Graphic3d_TOT_2D_MIPMAP,
|
||||||
|
Graphic3d_TOT_CUBEMAP
|
||||||
//! 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
|
#endif // _Graphic3d_TypeOfTexture_HeaderFile
|
||||||
|
@@ -35,7 +35,12 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||||
|
|
||||||
IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; }
|
IGESControl_ActorWrite::IGESControl_ActorWrite ()
|
||||||
|
{
|
||||||
|
ModeTrans() = 0;
|
||||||
|
myPrecRVal = Interface_Static::RVal("write.precision.val");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean IGESControl_ActorWrite::Recognize
|
Standard_Boolean IGESControl_ActorWrite::Recognize
|
||||||
(const Handle(Transfer_Finder)& start)
|
(const Handle(Transfer_Finder)& start)
|
||||||
@@ -70,8 +75,8 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
|
|||||||
if (shape.IsNull()) return NullResult();
|
if (shape.IsNull()) return NullResult();
|
||||||
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
||||||
Handle(Standard_Transient) info;
|
Handle(Standard_Transient) info;
|
||||||
Standard_Real Tol = Interface_Static::RVal("write.precision.val");
|
Standard_Real Tol = myPrecRVal;
|
||||||
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
|
Standard_Real maxTol = myMaxPrecRVal;
|
||||||
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
|
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
|
||||||
"write.iges.resource.name",
|
"write.iges.resource.name",
|
||||||
"write.iges.sequence", info,
|
"write.iges.sequence", info,
|
||||||
@@ -113,3 +118,25 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
|
|||||||
|
|
||||||
return NullResult();
|
return NullResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESControl_ActorWrite::SetPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("write.precision.val", theVal);
|
||||||
|
myPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESControl_ActorWrite::SetMaxPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("read.maxprecision.val", theVal);
|
||||||
|
myMaxPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESControl_ActorWrite::GetPrecRVal() const
|
||||||
|
{
|
||||||
|
return myPrecRVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESControl_ActorWrite::GetMaxPrecRVal() const
|
||||||
|
{
|
||||||
|
return myMaxPrecRVal;
|
||||||
|
}
|
||||||
|
@@ -51,8 +51,13 @@ public:
|
|||||||
const Handle(Transfer_FinderProcess)& FP,
|
const Handle(Transfer_FinderProcess)& FP,
|
||||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetMaxPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetPrecRVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetMaxPrecRVal() const;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
|
||||||
|
|
||||||
@@ -63,7 +68,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Standard_Real myPrecRVal;
|
||||||
|
Standard_Real myMaxPrecRVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -52,6 +52,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESControl_IGESBoundary,IGESToBRep_IGESBoundary)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
|
IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
|
||||||
{
|
{
|
||||||
|
myParModeIVal = Interface_Static::IVal("read.stdsameparameter.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -62,6 +63,7 @@ IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
|
|||||||
IGESControl_IGESBoundary::IGESControl_IGESBoundary(const IGESToBRep_CurveAndSurface& CS) :
|
IGESControl_IGESBoundary::IGESControl_IGESBoundary(const IGESToBRep_CurveAndSurface& CS) :
|
||||||
IGESToBRep_IGESBoundary (CS)
|
IGESToBRep_IGESBoundary (CS)
|
||||||
{
|
{
|
||||||
|
myParModeIVal = Interface_Static::IVal("read.stdsameparameter.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -302,7 +304,7 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
//#74 rln 10.03.99 S4135: handling use of BRepLib::SameParameter by new static parameter
|
//#74 rln 10.03.99 S4135: handling use of BRepLib::SameParameter by new static parameter
|
||||||
if (Interface_Static::IVal ("read.stdsameparameter.mode")) {
|
if (myParModeIVal) {
|
||||||
Standard_Real first, last;
|
Standard_Real first, last;
|
||||||
BRep_Tool::Range(edge3d,first,last);
|
BRep_Tool::Range(edge3d,first,last);
|
||||||
// pdn 08.04.99 S4135 optimizing in computation of SPTol
|
// pdn 08.04.99 S4135 optimizing in computation of SPTol
|
||||||
@@ -405,3 +407,13 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
|
|||||||
return okCurve;
|
return okCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESControl_IGESBoundary::SetParModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.stdsameparameter.mode", theVal);
|
||||||
|
myParModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESControl_IGESBoundary::GetParModeIVal() const
|
||||||
|
{
|
||||||
|
return myParModeIVal;
|
||||||
|
}
|
@@ -54,12 +54,20 @@ public:
|
|||||||
//! wire to contain only closed representation.
|
//! wire to contain only closed representation.
|
||||||
Standard_EXPORT virtual void Check (const Standard_Boolean result, const Standard_Boolean checkclosure, const Standard_Boolean okCurve3d, const Standard_Boolean okCurve2d) Standard_OVERRIDE;
|
Standard_EXPORT virtual void Check (const Standard_Boolean result, const Standard_Boolean checkclosure, const Standard_Boolean okCurve3d, const Standard_Boolean okCurve2d) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetParModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetParModeIVal() const;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(IGESControl_IGESBoundary,IGESToBRep_IGESBoundary)
|
DEFINE_STANDARD_RTTIEXT(IGESControl_IGESBoundary,IGESToBRep_IGESBoundary)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Transfer (Standard_Boolean& okCurve, Standard_Boolean& okCurve3d, Standard_Boolean& okCurve2d, const Handle(IGESData_IGESEntity)& icurve3d, const Handle(ShapeExtend_WireData)& scurve3d, const Standard_Boolean usescurve, const Standard_Boolean toreverse3d, const Handle(IGESData_HArray1OfIGESEntity)& curves2d, const Standard_Boolean toreverse2d, const Standard_Integer number, Handle(ShapeExtend_WireData)& lsewd) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean Transfer (Standard_Boolean& okCurve, Standard_Boolean& okCurve3d, Standard_Boolean& okCurve2d, const Handle(IGESData_IGESEntity)& icurve3d, const Handle(ShapeExtend_WireData)& scurve3d, const Standard_Boolean usescurve, const Standard_Boolean toreverse3d, const Handle(IGESData_HArray1OfIGESEntity)& curves2d, const Standard_Boolean toreverse2d, const Standard_Integer number, Handle(ShapeExtend_WireData)& lsewd) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Standard_Integer myParModeIVal;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _IGESControl_IGESBoundary_HeaderFile
|
#endif // _IGESControl_IGESBoundary_HeaderFile
|
||||||
|
@@ -61,7 +61,7 @@ IGESControl_Reader::IGESControl_Reader ()
|
|||||||
SetWS (new XSControl_WorkSession);
|
SetWS (new XSControl_WorkSession);
|
||||||
SetNorm("IGES");
|
SetNorm("IGES");
|
||||||
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
theReadOnlyVisible = (onlyvisible == 1);
|
myOnlyVisIVal = (onlyvisible == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ IGESControl_Reader::IGESControl_Reader
|
|||||||
SetWS (WS,scratch);
|
SetWS (WS,scratch);
|
||||||
SetNorm ("IGES");
|
SetNorm ("IGES");
|
||||||
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
theReadOnlyVisible = (onlyvisible == 1);
|
myOnlyVisIVal = (onlyvisible == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -114,14 +114,14 @@ Standard_Integer IGESControl_Reader::NbRootsForTransfer()
|
|||||||
Interface_ShareFlags SH (model,protocol);
|
Interface_ShareFlags SH (model,protocol);
|
||||||
|
|
||||||
// sln 11.06.2002 OCC448
|
// sln 11.06.2002 OCC448
|
||||||
Interface_Static::SetIVal("read.iges.onlyvisible",theReadOnlyVisible);
|
Interface_Static::SetIVal("read.iges.onlyvisible",myOnlyVisIVal);
|
||||||
|
|
||||||
Standard_Integer nb = model->NbEntities();
|
Standard_Integer nb = model->NbEntities();
|
||||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||||
Handle(IGESData_IGESEntity) ent = model->Entity(i);
|
Handle(IGESData_IGESEntity) ent = model->Entity(i);
|
||||||
if ( SH.IsShared(ent) || ! actor->Recognize (ent) ) continue;
|
if ( SH.IsShared(ent) || ! actor->Recognize (ent) ) continue;
|
||||||
// on ajoute un traitement pour ne prendre que les entites visibles
|
// on ajoute un traitement pour ne prendre que les entites visibles
|
||||||
if ( ! theReadOnlyVisible || ent->BlankStatus() == 0 ) {
|
if ( ! myOnlyVisIVal || ent->BlankStatus() == 0 ) {
|
||||||
theroots.Append(ent);
|
theroots.Append(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,3 +320,14 @@ void IGESControl_Reader::PrintTransferInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESControl_Reader::SetOnlyVisibleIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.onlyvisible", theVal);
|
||||||
|
myOnlyVisIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESControl_Reader::GetOnlyVisibleIVal() const
|
||||||
|
{
|
||||||
|
return myOnlyVisIVal;
|
||||||
|
}
|
||||||
|
@@ -97,7 +97,9 @@ public:
|
|||||||
//! Prints Statistics and check list for Transfer
|
//! Prints Statistics and check list for Transfer
|
||||||
Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
|
Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetOnlyVisibleIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetOnlyVisibleIVal() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -110,7 +112,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean theReadOnlyVisible;
|
Standard_Boolean myOnlyVisIVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot)
|
inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot)
|
||||||
{
|
{
|
||||||
theReadOnlyVisible = ReadRoot;
|
myOnlyVisIVal = ReadRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,5 +29,5 @@ inline void IGESControl_Reader::SetReadVisible (const Standard_Boolean ReadRoot)
|
|||||||
|
|
||||||
inline Standard_Boolean IGESControl_Reader::GetReadVisible ()const
|
inline Standard_Boolean IGESControl_Reader::GetReadVisible ()const
|
||||||
{
|
{
|
||||||
return theReadOnlyVisible;
|
return myOnlyVisIVal;
|
||||||
}
|
}
|
||||||
|
@@ -54,20 +54,29 @@ IGESControl_Writer::IGESControl_Writer ()
|
|||||||
myIsComputed (Standard_False)
|
myIsComputed (Standard_False)
|
||||||
{
|
{
|
||||||
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
||||||
|
myUnitCVal = Interface_Static::CVal("write.iges.unit");
|
||||||
|
myBRepModeIVal = Interface_Static::IVal("write.iges.brep.mode");
|
||||||
|
myPrecRVal = Interface_Static::RVal("write.precision.val");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
myPrecModeIVal = Interface_Static::IVal("write.precision.mode");
|
||||||
IGESControl_Controller::Init();
|
IGESControl_Controller::Init();
|
||||||
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
||||||
myEditor.SetUnitName(Interface_Static::CVal ("write.iges.unit"));
|
myEditor.SetUnitName(myUnitCVal);
|
||||||
myEditor.ApplyUnit();
|
myEditor.ApplyUnit();
|
||||||
myWriteMode = Interface_Static::IVal ("write.iges.brep.mode");
|
|
||||||
myModel = myEditor.Model();
|
myModel = myEditor.Model();
|
||||||
}
|
}
|
||||||
|
|
||||||
IGESControl_Writer::IGESControl_Writer
|
IGESControl_Writer::IGESControl_Writer
|
||||||
(const Standard_CString unit, const Standard_Integer modecr)
|
(const Standard_CString unit, const Standard_Integer modecr)
|
||||||
: myTP (new Transfer_FinderProcess(10000)) ,
|
: myTP (new Transfer_FinderProcess(10000)) ,
|
||||||
myWriteMode (modecr) , myIsComputed (Standard_False)
|
myBRepModeIVal (modecr) , myIsComputed (Standard_False)
|
||||||
{
|
{
|
||||||
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
// faudrait aussi (?) prendre les parametres par defaut ... ?
|
||||||
|
myUnitCVal = Interface_Static::CVal("write.iges.unit");
|
||||||
|
myBRepModeIVal = Interface_Static::IVal("write.iges.brep.mode");
|
||||||
|
myPrecRVal = Interface_Static::RVal("write.precision.val");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
myPrecModeIVal = Interface_Static::IVal("write.precision.mode");
|
||||||
IGESControl_Controller::Init();
|
IGESControl_Controller::Init();
|
||||||
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol());
|
||||||
myEditor.SetUnitName(unit);
|
myEditor.SetUnitName(unit);
|
||||||
@@ -80,7 +89,14 @@ IGESControl_Writer::IGESControl_Writer
|
|||||||
: myTP (new Transfer_FinderProcess(10000)) ,
|
: myTP (new Transfer_FinderProcess(10000)) ,
|
||||||
myModel (model) ,
|
myModel (model) ,
|
||||||
myEditor (model,IGESSelect_WorkLibrary::DefineProtocol()) ,
|
myEditor (model,IGESSelect_WorkLibrary::DefineProtocol()) ,
|
||||||
myWriteMode (modecr) , myIsComputed (Standard_False) { }
|
myBRepModeIVal (modecr) , myIsComputed (Standard_False)
|
||||||
|
{
|
||||||
|
myUnitCVal = Interface_Static::CVal("write.iges.unit");
|
||||||
|
myBRepModeIVal = Interface_Static::IVal("write.iges.brep.mode");
|
||||||
|
myPrecRVal = Interface_Static::RVal("write.precision.val");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
|
myPrecModeIVal = Interface_Static::IVal("write.precision.mode");
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
@@ -92,8 +108,8 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
|||||||
Message_ProgressScope aPS(theProgress, NULL, 2);
|
Message_ProgressScope aPS(theProgress, NULL, 2);
|
||||||
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
|
||||||
Handle(Standard_Transient) info;
|
Handle(Standard_Transient) info;
|
||||||
Standard_Real Tol = Interface_Static::RVal("write.precision.val");
|
Standard_Real Tol = myPrecRVal;
|
||||||
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
|
Standard_Real maxTol = myMaxPrecRVal;
|
||||||
TopoDS_Shape Shape = XSAlgo::AlgoContainer()->ProcessShape( theShape, Tol, maxTol,
|
TopoDS_Shape Shape = XSAlgo::AlgoContainer()->ProcessShape( theShape, Tol, maxTol,
|
||||||
"write.iges.resource.name",
|
"write.iges.resource.name",
|
||||||
"write.iges.sequence", info,
|
"write.iges.sequence", info,
|
||||||
@@ -104,7 +120,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
|||||||
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
|
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
|
||||||
BRepToIGES_BREntity B0; B0.SetTransferProcess(myTP); B0.SetModel(myModel);
|
BRepToIGES_BREntity B0; B0.SetTransferProcess(myTP); B0.SetModel(myModel);
|
||||||
BRepToIGESBRep_Entity B1; B1.SetTransferProcess(myTP); B1.SetModel(myModel);
|
BRepToIGESBRep_Entity B1; B1.SetTransferProcess(myTP); B1.SetModel(myModel);
|
||||||
Handle(IGESData_IGESEntity) ent = myWriteMode?
|
Handle(IGESData_IGESEntity) ent = myBRepModeIVal?
|
||||||
B1.TransferShape (Shape, aPS.Next()) : B0.TransferShape(Shape, aPS.Next());
|
B1.TransferShape (Shape, aPS.Next()) : B0.TransferShape(Shape, aPS.Next());
|
||||||
if (!aPS.More())
|
if (!aPS.More())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -123,9 +139,9 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
|
|||||||
|
|
||||||
Standard_Real oldtol = myModel->GlobalSection().Resolution(), newtol;
|
Standard_Real oldtol = myModel->GlobalSection().Resolution(), newtol;
|
||||||
|
|
||||||
Standard_Integer tolmod = Interface_Static::IVal("write.precision.mode");
|
Standard_Integer tolmod = myPrecModeIVal;
|
||||||
if (tolmod == 2)
|
if (tolmod == 2)
|
||||||
newtol = Interface_Static::RVal("write.precision.val");
|
newtol = myPrecRVal;
|
||||||
else {
|
else {
|
||||||
ShapeAnalysis_ShapeTolerance stu;
|
ShapeAnalysis_ShapeTolerance stu;
|
||||||
Standard_Real Tolv = stu.Tolerance (Shape, tolmod, TopAbs_VERTEX);
|
Standard_Real Tolv = stu.Tolerance (Shape, tolmod, TopAbs_VERTEX);
|
||||||
@@ -254,7 +270,7 @@ Standard_Boolean IGESControl_Writer::Write
|
|||||||
(const Standard_CString file, const Standard_Boolean fnes)
|
(const Standard_CString file, const Standard_Boolean fnes)
|
||||||
{
|
{
|
||||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (file, std::ios::out | std::ios::binary);
|
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (file, std::ios::out);
|
||||||
if (aStream.get() == NULL)
|
if (aStream.get() == NULL)
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -271,3 +287,57 @@ Standard_Boolean IGESControl_Writer::Write
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESControl_Writer::SetUnitCVal(const Standard_CString& theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetCVal("write.iges.unit", theVal);
|
||||||
|
myUnitCVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESControl_Writer::SetBRepModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.iges.brep.mode", theVal);
|
||||||
|
myBRepModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESControl_Writer::SetPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("write.precision.val", theVal);
|
||||||
|
myPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESControl_Writer::SetMaxPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("read.maxprecision.val", theVal);
|
||||||
|
myMaxPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESControl_Writer::SetPrecModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("write.precision.mode", theVal);
|
||||||
|
myPrecModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_CString IGESControl_Writer::GetUnitCVal() const
|
||||||
|
{
|
||||||
|
return myUnitCVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESControl_Writer::GetBRepModeIVal() const
|
||||||
|
{
|
||||||
|
return myBRepModeIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESControl_Writer::GetPrecRVal() const
|
||||||
|
{
|
||||||
|
return myPrecRVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESControl_Writer::GetMaxPrecRVal() const
|
||||||
|
{
|
||||||
|
return myMaxPrecRVal;
|
||||||
|
}
|
||||||
|
Standard_Integer IGESControl_Writer::GetPrecModeIVal() const
|
||||||
|
{
|
||||||
|
return myPrecModeIVal;
|
||||||
|
}
|
||||||
|
@@ -115,12 +115,36 @@ public:
|
|||||||
//! if the processor could not create the file).
|
//! if the processor could not create the file).
|
||||||
Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
|
Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetUnitCVal(const Standard_CString& theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetBRepModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetMaxPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_CString GetUnitCVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetBRepModeIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetPrecRVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetMaxPrecRVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetPrecModeIVal() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Handle(Transfer_FinderProcess) myTP;
|
Handle(Transfer_FinderProcess) myTP;
|
||||||
Handle(IGESData_IGESModel) myModel;
|
Handle(IGESData_IGESModel) myModel;
|
||||||
IGESData_BasicEditor myEditor;
|
IGESData_BasicEditor myEditor;
|
||||||
Standard_Integer myWriteMode;
|
Standard_CString myUnitCVal;
|
||||||
|
Standard_Integer myBRepModeIVal;
|
||||||
|
Standard_Real myPrecRVal;
|
||||||
|
Standard_Real myMaxPrecRVal;
|
||||||
|
Standard_Integer myPrecModeIVal;
|
||||||
Standard_Boolean myIsComputed;
|
Standard_Boolean myIsComputed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -256,21 +256,20 @@ Standard_Boolean IGESData_IGESModel::ApplyStatic
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_CString val;
|
|
||||||
if (param[0] == 'r') {
|
if (param[0] == 'r') {
|
||||||
val = Interface_Static::CVal("write.iges.header.receiver");
|
myHeadRecCVal = Interface_Static::CVal("write.iges.header.receiver");
|
||||||
if (!val || val[0] == '\0') return Standard_False;
|
if (!myHeadRecCVal || myHeadRecCVal[0] == '\0') return Standard_False;
|
||||||
theheader.SetReceiveName (new TCollection_HAsciiString(val));
|
theheader.SetReceiveName (new TCollection_HAsciiString(myHeadRecCVal));
|
||||||
}
|
}
|
||||||
if (param[0] == 'a') {
|
if (param[0] == 'a') {
|
||||||
val = Interface_Static::CVal("write.iges.header.author");
|
myHeadAuthorCVal = Interface_Static::CVal("write.iges.header.author");
|
||||||
if (!val || val[0] == '\0') return Standard_False;
|
if (!myHeadAuthorCVal || myHeadAuthorCVal[0] == '\0') return Standard_False;
|
||||||
theheader.SetAuthorName (new TCollection_HAsciiString(val));
|
theheader.SetAuthorName (new TCollection_HAsciiString(myHeadAuthorCVal));
|
||||||
}
|
}
|
||||||
if (param[0] == 'c') {
|
if (param[0] == 'c') {
|
||||||
val = Interface_Static::CVal("write.iges.header.company");
|
myHeadCompCVal = Interface_Static::CVal("write.iges.header.company");
|
||||||
if (!val || val[0] == '\0') return Standard_False;
|
if (!myHeadCompCVal || myHeadCompCVal[0] == '\0') return Standard_False;
|
||||||
theheader.SetCompanyName (new TCollection_HAsciiString(val));
|
theheader.SetCompanyName (new TCollection_HAsciiString(myHeadCompCVal));
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@@ -624,3 +623,36 @@ Handle(TCollection_HAsciiString) IGESData_IGESModel::StringLabel(const Handle(St
|
|||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESData_IGESModel::SetHeaderReciever(const Standard_CString& theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetCVal("write.iges.header.receiver", theVal);
|
||||||
|
myHeadRecCVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESData_IGESModel::SetHeaderAuthor(const Standard_CString& theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetCVal("write.iges.header.author", theVal);
|
||||||
|
myHeadRecCVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESData_IGESModel::SetHeaderCompany(const Standard_CString& theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetCVal("write.iges.header.company", theVal);
|
||||||
|
myHeadRecCVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_CString IGESData_IGESModel::GetHeaderReciever() const
|
||||||
|
{
|
||||||
|
return myHeadRecCVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_CString IGESData_IGESModel::GetHeaderAuthor() const
|
||||||
|
{
|
||||||
|
return myHeadAuthorCVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_CString IGESData_IGESModel::GetHeaderCompany() const
|
||||||
|
{
|
||||||
|
return myHeadCompCVal;
|
||||||
|
}
|
||||||
|
@@ -152,7 +152,17 @@ public:
|
|||||||
//! i.e. a string "Dnn" with nn = directory entry number (2*N-1)
|
//! i.e. a string "Dnn" with nn = directory entry number (2*N-1)
|
||||||
Standard_EXPORT Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
Standard_EXPORT Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetHeaderReciever(const Standard_CString& theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetHeaderAuthor(const Standard_CString& theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetHeaderCompany(const Standard_CString& theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_CString GetHeaderReciever() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_CString GetHeaderAuthor() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_CString GetHeaderCompany() const;
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(IGESData_IGESModel,Interface_InterfaceModel)
|
DEFINE_STANDARD_RTTIEXT(IGESData_IGESModel,Interface_InterfaceModel)
|
||||||
@@ -167,6 +177,10 @@ private:
|
|||||||
|
|
||||||
Handle(TColStd_HSequenceOfHAsciiString) thestart;
|
Handle(TColStd_HSequenceOfHAsciiString) thestart;
|
||||||
IGESData_GlobalSection theheader;
|
IGESData_GlobalSection theheader;
|
||||||
|
Standard_CString myHeadRecCVal;
|
||||||
|
Standard_CString myHeadAuthorCVal;
|
||||||
|
Standard_CString myHeadCompCVal;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -102,7 +102,7 @@ static Handle(IGESData_FileProtocol) IGESProto;
|
|||||||
|
|
||||||
if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
|
if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
|
||||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out | std::ios::binary);
|
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (ctx.FileName(), std::ios::out);
|
||||||
if (aStream.get() == NULL)
|
if (aStream.get() == NULL)
|
||||||
{
|
{
|
||||||
ctx.CCheck(0)->AddFail("IGES File could not be created");
|
ctx.CCheck(0)->AddFail("IGES File could not be created");
|
||||||
|
@@ -44,7 +44,10 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
IGESToBRep_Actor::IGESToBRep_Actor ()
|
IGESToBRep_Actor::IGESToBRep_Actor ()
|
||||||
{ thecontinuity = 0; theeps = 0.0001; }
|
{
|
||||||
|
thecontinuity = 0;
|
||||||
|
theeps = 0.0001;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -55,6 +58,11 @@ void IGESToBRep_Actor::SetModel (const Handle(Interface_InterfaceModel)& model)
|
|||||||
{
|
{
|
||||||
themodel = model;
|
themodel = model;
|
||||||
theeps = Handle(IGESData_IGESModel)::DownCast(themodel)->GlobalSection().Resolution();
|
theeps = Handle(IGESData_IGESModel)::DownCast(themodel)->GlobalSection().Resolution();
|
||||||
|
myApproxd1IVal = Interface_Static::IVal("read.iges.bspline.approxd1.mode");
|
||||||
|
myFaultyEntIVal = Interface_Static::IVal("read.iges.faulty.entities");
|
||||||
|
myPrecModeIVal = Interface_Static::IVal("read.precision.mode");
|
||||||
|
myPrecRVal = Interface_Static::RVal("read.precision.val");;
|
||||||
|
mySurfaceCurIVal = Interface_Static::IVal("read.surfacecurve.mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -149,7 +157,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
|||||||
if (mymodel.IsNull() || ent.IsNull()) return NullResult();
|
if (mymodel.IsNull() || ent.IsNull()) return NullResult();
|
||||||
Standard_Integer anum = mymodel->Number(start);
|
Standard_Integer anum = mymodel->Number(start);
|
||||||
|
|
||||||
if (Interface_Static::IVal("read.iges.faulty.entities") == 0 && mymodel->IsErrorEntity(anum))
|
if (myFaultyEntIVal == 0 && mymodel->IsErrorEntity(anum))
|
||||||
return NullResult();
|
return NullResult();
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
|
|
||||||
@@ -170,15 +178,15 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
|||||||
CAS.SetModel(mymodel);
|
CAS.SetModel(mymodel);
|
||||||
CAS.SetContinuity(thecontinuity);
|
CAS.SetContinuity(thecontinuity);
|
||||||
CAS.SetTransferProcess(TP);
|
CAS.SetTransferProcess(TP);
|
||||||
Standard_Integer Ival = Interface_Static::IVal("read.precision.mode");
|
Standard_Integer Ival = myPrecModeIVal;
|
||||||
if ( Ival == 0)
|
if ( Ival == 0)
|
||||||
eps = mymodel->GlobalSection().Resolution();
|
eps = mymodel->GlobalSection().Resolution();
|
||||||
else
|
else
|
||||||
eps = Interface_Static::RVal("read.precision.val"); //:10 ABV 11 Nov 97
|
eps = myPrecRVal; //:10 ABV 11 Nov 97
|
||||||
//:10 eps = BRepAPI::Precision();
|
//:10 eps = BRepAPI::Precision();
|
||||||
Ival = Interface_Static::IVal("read.iges.bspline.approxd1.mode");
|
Ival = myApproxd1IVal;
|
||||||
CAS.SetModeApprox ( (Ival > 0) );
|
CAS.SetModeApprox ( (Ival > 0) );
|
||||||
Ival = Interface_Static::IVal("read.surfacecurve.mode");
|
Ival = mySurfaceCurIVal;
|
||||||
CAS.SetSurfaceCurve (Ival);
|
CAS.SetSurfaceCurve (Ival);
|
||||||
|
|
||||||
if (eps > 1.E-08) {
|
if (eps > 1.E-08) {
|
||||||
@@ -221,5 +229,62 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Standard_Real IGESToBRep_Actor::UsedTolerance () const
|
Standard_Real IGESToBRep_Actor::UsedTolerance () const
|
||||||
{ return theeps; }
|
{
|
||||||
|
return theeps;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Actor::SetApproxd1IVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.bspline.approxd1.mode", theVal);
|
||||||
|
myApproxd1IVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Actor::SetFaultyEntIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.faulty.entities", theVal);
|
||||||
|
myFaultyEntIVal = myFaultyEntIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Actor::SetPrecModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.precision.mode", theVal);
|
||||||
|
myPrecModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Actor::SetPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("read.precision.val", theVal);
|
||||||
|
myPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Actor::SetSurfaceCurIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.surfacecurve.mode", theVal);
|
||||||
|
mySurfaceCurIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Actor::GetApproxd1IVal() const
|
||||||
|
{
|
||||||
|
return myApproxd1IVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Actor::GetFaultyEntIVal() const
|
||||||
|
{
|
||||||
|
return myFaultyEntIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Actor::GetPrecModeIVal() const
|
||||||
|
{
|
||||||
|
return myPrecModeIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESToBRep_Actor::GetPrecRVal() const
|
||||||
|
{
|
||||||
|
return myPrecRVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Actor::GetSurfaceCurIVal() const
|
||||||
|
{
|
||||||
|
return mySurfaceCurIVal;
|
||||||
|
}
|
||||||
|
@@ -68,7 +68,25 @@ public:
|
|||||||
//! the file or from statics
|
//! the file or from statics
|
||||||
Standard_EXPORT Standard_Real UsedTolerance() const;
|
Standard_EXPORT Standard_Real UsedTolerance() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetApproxd1IVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetFaultyEntIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetSurfaceCurIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetApproxd1IVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetFaultyEntIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetPrecModeIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetPrecRVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetSurfaceCurIVal() const;
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
|
DEFINE_STANDARD_RTTIEXT(IGESToBRep_Actor,Transfer_ActorOfTransientProcess)
|
||||||
@@ -84,6 +102,11 @@ private:
|
|||||||
Handle(Interface_InterfaceModel) themodel;
|
Handle(Interface_InterfaceModel) themodel;
|
||||||
Standard_Integer thecontinuity;
|
Standard_Integer thecontinuity;
|
||||||
Standard_Real theeps;
|
Standard_Real theeps;
|
||||||
|
Standard_Integer myApproxd1IVal;
|
||||||
|
Standard_Integer myFaultyEntIVal;
|
||||||
|
Standard_Integer myPrecModeIVal;
|
||||||
|
Standard_Real myPrecRVal;
|
||||||
|
Standard_Integer mySurfaceCurIVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -74,6 +74,8 @@ IGESToBRep_CurveAndSurface::IGESToBRep_CurveAndSurface()
|
|||||||
myIsResolCom (Standard_False),
|
myIsResolCom (Standard_False),
|
||||||
myTP (new Transfer_TransientProcess())
|
myTP (new Transfer_TransientProcess())
|
||||||
{
|
{
|
||||||
|
myOnlyVisibleIVal = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
UpdateMinMaxTol();
|
UpdateMinMaxTol();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +106,8 @@ IGESToBRep_CurveAndSurface::IGESToBRep_CurveAndSurface
|
|||||||
myIsResolCom (Standard_False),
|
myIsResolCom (Standard_False),
|
||||||
myTP (new Transfer_TransientProcess())
|
myTP (new Transfer_TransientProcess())
|
||||||
{
|
{
|
||||||
|
myOnlyVisibleIVal = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
UpdateMinMaxTol();
|
UpdateMinMaxTol();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +132,8 @@ void IGESToBRep_CurveAndSurface::Init()
|
|||||||
mySurface.Nullify();
|
mySurface.Nullify();
|
||||||
myIsResolCom = Standard_False;
|
myIsResolCom = Standard_False;
|
||||||
myUVResolution = 0.;
|
myUVResolution = 0.;
|
||||||
|
myOnlyVisibleIVal = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
|
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
|
||||||
UpdateMinMaxTol();
|
UpdateMinMaxTol();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +157,9 @@ void IGESToBRep_CurveAndSurface::UpdateMinMaxTol()
|
|||||||
{
|
{
|
||||||
//#74 rln 11.03.99 S4135: Setting maximum tolerances according to
|
//#74 rln 11.03.99 S4135: Setting maximum tolerances according to
|
||||||
//static parameter
|
//static parameter
|
||||||
myMaxTol = Max (Interface_Static::RVal ("read.maxprecision.val"), myEpsGeom * myUnitFactor);
|
myMaxTol = Max (myMaxPrecRVal, myEpsGeom * myUnitFactor);
|
||||||
myMinTol = Precision::Confusion();
|
myMinTol = Precision::Confusion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -258,7 +265,7 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
|
|||||||
|
|
||||||
// sln 13.06.2002 OCC448: Avoid transferring invisible sub entities which
|
// sln 13.06.2002 OCC448: Avoid transferring invisible sub entities which
|
||||||
// logically depend on the one
|
// logically depend on the one
|
||||||
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
|
Standard_Integer onlyvisible = myOnlyVisibleIVal;
|
||||||
|
|
||||||
if (IGESToBRep::IsCurveAndSurface(start)) {
|
if (IGESToBRep::IsCurveAndSurface(start)) {
|
||||||
if(onlyvisible && start->BlankStatus() == 1)
|
if(onlyvisible && start->BlankStatus() == 1)
|
||||||
@@ -653,7 +660,27 @@ Standard_Real IGESToBRep_CurveAndSurface::GetUVResolution()
|
|||||||
return myUVResolution;
|
return myUVResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_CurveAndSurface::SetOnlyVisibleIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.onlyvisible", theVal);
|
||||||
|
myOnlyVisibleIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_CurveAndSurface::SetMaxPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("read.maxprecision.val", theVal);
|
||||||
|
myMaxPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_CurveAndSurface::GetOnlyVisibleIVal() const
|
||||||
|
{
|
||||||
|
return myOnlyVisibleIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESToBRep_CurveAndSurface::GetMaxPrecRVal() const
|
||||||
|
{
|
||||||
|
return myMaxPrecRVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -191,7 +191,13 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Standard_Real GetUVResolution();
|
Standard_EXPORT Standard_Real GetUVResolution();
|
||||||
|
|
||||||
|
Standard_EXPORT void SetOnlyVisibleIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetMaxPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetOnlyVisibleIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetMaxPrecRVal() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -220,6 +226,8 @@ private:
|
|||||||
Standard_Boolean myIsResolCom;
|
Standard_Boolean myIsResolCom;
|
||||||
Handle(IGESData_IGESModel) myModel;
|
Handle(IGESData_IGESModel) myModel;
|
||||||
Handle(Transfer_TransientProcess) myTP;
|
Handle(Transfer_TransientProcess) myTP;
|
||||||
|
Standard_Integer myOnlyVisibleIVal;
|
||||||
|
Standard_Real myMaxPrecRVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -210,6 +210,12 @@ Standard_Integer IGESToBRep_Reader::LoadFile (const Standard_CString filename)
|
|||||||
theModel = model;
|
theModel = model;
|
||||||
theDone = Standard_False;
|
theDone = Standard_False;
|
||||||
theShapes.Clear();
|
theShapes.Clear();
|
||||||
|
myApproxd1IVal = Interface_Static::IVal("read.iges.bspline.approxd1.mode");
|
||||||
|
myBSContinuityIVal = Interface_Static::IVal("read.iges.bspline.continuity");
|
||||||
|
myOnlyVisIVal = Interface_Static::IVal("read.iges.onlyvisible");
|
||||||
|
myPrecModeIVal = Interface_Static::IVal("read.precision.mode");
|
||||||
|
myPrecRVal = Interface_Static::RVal("read.precision.val");
|
||||||
|
mySurfaceCurIVal = Interface_Static::IVal("read.surfacecurve.mode");
|
||||||
if ( theProc.IsNull() )
|
if ( theProc.IsNull() )
|
||||||
theProc = new Transfer_TransientProcess (theModel->NbEntities());
|
theProc = new Transfer_TransientProcess (theModel->NbEntities());
|
||||||
else
|
else
|
||||||
@@ -368,7 +374,7 @@ static void TrimTolerances (const TopoDS_Shape& shape,
|
|||||||
//function : TransferRoots
|
//function : TransferRoots
|
||||||
//purpose : Transfers all Roots Entities
|
//purpose : Transfers all Roots Entities
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
void IGESToBRep_Reader::TransferRoots (const Standard_Boolean theOnlyVisible,
|
||||||
const Message_ProgressRange& theProgress)
|
const Message_ProgressRange& theProgress)
|
||||||
{
|
{
|
||||||
if (theModel.IsNull() || theProc.IsNull()) return;
|
if (theModel.IsNull() || theProc.IsNull()) return;
|
||||||
@@ -387,7 +393,7 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
|||||||
theProc->SetRootManagement(Standard_True);
|
theProc->SetRootManagement(Standard_True);
|
||||||
// PrepareTransfer(); -> protocol, actor
|
// PrepareTransfer(); -> protocol, actor
|
||||||
theActor->SetModel(theModel);
|
theActor->SetModel(theModel);
|
||||||
Standard_Integer continuity = Interface_Static::IVal("read.iges.bspline.continuity");
|
Standard_Integer continuity = myBSContinuityIVal;
|
||||||
theActor->SetContinuity (continuity);
|
theActor->SetContinuity (continuity);
|
||||||
theProc->SetModel (theModel);
|
theProc->SetModel (theModel);
|
||||||
theProc->SetActor (theActor);
|
theProc->SetActor (theActor);
|
||||||
@@ -399,24 +405,24 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
|||||||
ShapeExtend_Explorer SBE;
|
ShapeExtend_Explorer SBE;
|
||||||
|
|
||||||
|
|
||||||
Standard_Integer precisionMode = Interface_Static::IVal("read.precision.mode");
|
Standard_Integer precisionMode = myPrecModeIVal;
|
||||||
Message_Msg msg2035("IGES_2035");
|
Message_Msg msg2035("IGES_2035");
|
||||||
msg2035.Arg(precisionMode);
|
msg2035.Arg(precisionMode);
|
||||||
TF->Send (msg2035, Message_Info);
|
TF->Send (msg2035, Message_Info);
|
||||||
if (precisionMode==1) {
|
if (precisionMode==1) {
|
||||||
Message_Msg msg2040("IGES_2040");
|
Message_Msg msg2040("IGES_2040");
|
||||||
msg2040.Arg(Interface_Static::RVal("read.precision.val"));//#70 rln 03.03.99
|
msg2040.Arg(myPrecRVal);//#70 rln 03.03.99
|
||||||
TF->Send (msg2040, Message_Info);
|
TF->Send (msg2040, Message_Info);
|
||||||
}
|
}
|
||||||
Message_Msg msg2045("IGES_2045");
|
Message_Msg msg2045("IGES_2045");
|
||||||
msg2045.Arg(continuity);
|
msg2045.Arg(continuity);
|
||||||
TF->Send (msg2045, Message_Info);
|
TF->Send (msg2045, Message_Info);
|
||||||
Message_Msg msg2050("IGES_2050");
|
Message_Msg msg2050("IGES_2050");
|
||||||
msg2050.Arg(Interface_Static::IVal("read.surfacecurve.mode"));
|
msg2050.Arg(mySurfaceCurIVal);
|
||||||
TF->Send (msg2050, Message_Info);
|
TF->Send (msg2050, Message_Info);
|
||||||
|
|
||||||
// sln 11.06.2002 OCC448
|
// sln 11.06.2002 OCC448
|
||||||
Interface_Static::SetIVal("read.iges.onlyvisible",onlyvisible);
|
SetOnlyVisIVal(theOnlyVisible);
|
||||||
|
|
||||||
Message_ProgressScope PS (theProgress, "Root", nb);
|
Message_ProgressScope PS (theProgress, "Root", nb);
|
||||||
for (Standard_Integer i = 1; i <= nb && PS.More(); i++)
|
for (Standard_Integer i = 1; i <= nb && PS.More(); i++)
|
||||||
@@ -431,7 +437,7 @@ void IGESToBRep_Reader::TransferRoots (const Standard_Boolean onlyvisible,
|
|||||||
TF->Send (msg2070, Message_Info);
|
TF->Send (msg2070, Message_Info);
|
||||||
}
|
}
|
||||||
// on ajoute un traitement pour ne prendre que les entites visibles
|
// on ajoute un traitement pour ne prendre que les entites visibles
|
||||||
if ( ! onlyvisible || ent->BlankStatus() == 0 ) {
|
if ( ! theOnlyVisible || ent->BlankStatus() == 0 ) {
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
theDone = Standard_True;
|
theDone = Standard_True;
|
||||||
try {
|
try {
|
||||||
@@ -511,7 +517,7 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
|||||||
IGESToBRep_CurveAndSurface CAS;
|
IGESToBRep_CurveAndSurface CAS;
|
||||||
CAS.SetModel(theModel);
|
CAS.SetModel(theModel);
|
||||||
Standard_Real eps;
|
Standard_Real eps;
|
||||||
Standard_Integer Ival = Interface_Static::IVal("read.precision.mode");
|
Standard_Integer Ival = myPrecModeIVal;
|
||||||
Message_Msg msg2035("IGES_2035");
|
Message_Msg msg2035("IGES_2035");
|
||||||
msg2035.Arg(Ival);
|
msg2035.Arg(Ival);
|
||||||
TF->Send (msg2035, Message_Info);
|
TF->Send (msg2035, Message_Info);
|
||||||
@@ -519,21 +525,21 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
|||||||
eps = theModel->GlobalSection().Resolution();
|
eps = theModel->GlobalSection().Resolution();
|
||||||
else {
|
else {
|
||||||
//mjm : modif du 19/12/97 pour prise en compte effective du parametre
|
//mjm : modif du 19/12/97 pour prise en compte effective du parametre
|
||||||
eps = Interface_Static::RVal("read.precision.val");
|
eps = myPrecRVal;
|
||||||
Message_Msg msg2040("IGES_2040");
|
Message_Msg msg2040("IGES_2040");
|
||||||
msg2040.Arg(eps);//#70 rln 03.03.99
|
msg2040.Arg(eps);//#70 rln 03.03.99
|
||||||
TF->Send (msg2040, Message_Info);
|
TF->Send (msg2040, Message_Info);
|
||||||
|
|
||||||
}
|
}
|
||||||
Ival = Interface_Static::IVal("read.iges.bspline.approxd1.mode");
|
Ival = myApproxd1IVal;
|
||||||
CAS.SetModeApprox ( (Ival > 0) );
|
CAS.SetModeApprox ( (Ival > 0) );
|
||||||
Message_Msg msg2045("IGES_2045");
|
Message_Msg msg2045("IGES_2045");
|
||||||
Ival = Interface_Static::IVal("read.iges.bspline.continuity");
|
Ival = myBSContinuityIVal;
|
||||||
msg2045.Arg(Ival);
|
msg2045.Arg(Ival);
|
||||||
TF->Send (msg2045, Message_Info);
|
TF->Send (msg2045, Message_Info);
|
||||||
CAS.SetContinuity(Ival);
|
CAS.SetContinuity(Ival);
|
||||||
Message_Msg msg2050("IGES_2050");
|
Message_Msg msg2050("IGES_2050");
|
||||||
Ival = Interface_Static::IVal("read.surfacecurve.mode");
|
Ival = mySurfaceCurIVal;
|
||||||
msg2050.Arg(Ival);
|
msg2050.Arg(Ival);
|
||||||
TF->Send (msg2050, Message_Info);
|
TF->Send (msg2050, Message_Info);
|
||||||
CAS.SetSurfaceCurve (Ival);
|
CAS.SetSurfaceCurve (Ival);
|
||||||
@@ -648,3 +654,69 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
|
|||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetBSContinuityIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.bspline.continuity", theVal);
|
||||||
|
myBSContinuityIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetPrecModeIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.precision.mode", theVal);
|
||||||
|
myPrecModeIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetPrecRVal(const Standard_Real theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetRVal("read.precision.val", theVal);
|
||||||
|
myPrecRVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetSurfaceCurIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.surfacecurve.mode", theVal);
|
||||||
|
mySurfaceCurIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetOnlyVisIVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.onlyvisible", theVal);
|
||||||
|
myOnlyVisIVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IGESToBRep_Reader::SetApproxd1IVal(const Standard_Integer theVal)
|
||||||
|
{
|
||||||
|
Interface_Static::SetIVal("read.iges.bspline.approxd1.mode", theVal);
|
||||||
|
myApproxd1IVal = theVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Reader::GetBSContinuityIVal() const
|
||||||
|
{
|
||||||
|
return myBSContinuityIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Reader::GetPrecModeIVal() const
|
||||||
|
{
|
||||||
|
return myPrecModeIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real IGESToBRep_Reader::GetPrecRVal() const
|
||||||
|
{
|
||||||
|
return myPrecRVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Reader::GetSurfaceCurIVal() const
|
||||||
|
{
|
||||||
|
return mySurfaceCurIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Reader::GetOnlyVisIVal() const
|
||||||
|
{
|
||||||
|
return myOnlyVisIVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer IGESToBRep_Reader::GetApproxd1IVal() const
|
||||||
|
{
|
||||||
|
return myApproxd1IVal;
|
||||||
|
}
|
||||||
|
@@ -110,7 +110,29 @@ public:
|
|||||||
//! - a compound containing the resulting shapes if there are several.
|
//! - a compound containing the resulting shapes if there are several.
|
||||||
Standard_EXPORT TopoDS_Shape OneShape() const;
|
Standard_EXPORT TopoDS_Shape OneShape() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetBSContinuityIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecModeIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetPrecRVal(const Standard_Real theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetSurfaceCurIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetOnlyVisIVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT void SetApproxd1IVal(const Standard_Integer theVal);
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetBSContinuityIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetPrecModeIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Real GetPrecRVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetSurfaceCurIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetOnlyVisIVal() const;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Integer GetApproxd1IVal() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -128,6 +150,12 @@ private:
|
|||||||
TopTools_SequenceOfShape theShapes;
|
TopTools_SequenceOfShape theShapes;
|
||||||
Handle(IGESToBRep_Actor) theActor;
|
Handle(IGESToBRep_Actor) theActor;
|
||||||
Handle(Transfer_TransientProcess) theProc;
|
Handle(Transfer_TransientProcess) theProc;
|
||||||
|
Standard_Integer myBSContinuityIVal;
|
||||||
|
Standard_Integer myPrecModeIVal;
|
||||||
|
Standard_Real myPrecRVal;
|
||||||
|
Standard_Integer mySurfaceCurIVal;
|
||||||
|
Standard_Integer myOnlyVisIVal; // setter
|
||||||
|
Standard_Integer myApproxd1IVal;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -66,8 +66,6 @@ namespace
|
|||||||
case FIT_RGBF: return Image_Format_RGBF;
|
case FIT_RGBF: return Image_Format_RGBF;
|
||||||
case FIT_RGBAF: return Image_Format_RGBAF;
|
case FIT_RGBAF: return Image_Format_RGBAF;
|
||||||
case FIT_FLOAT: return Image_Format_GrayF;
|
case FIT_FLOAT: return Image_Format_GrayF;
|
||||||
case FIT_INT16:
|
|
||||||
case FIT_UINT16: return Image_Format_Gray16;
|
|
||||||
case FIT_BITMAP:
|
case FIT_BITMAP:
|
||||||
{
|
{
|
||||||
switch (theColorTypeFI)
|
switch (theColorTypeFI)
|
||||||
@@ -120,8 +118,6 @@ namespace
|
|||||||
case Image_Format_Gray:
|
case Image_Format_Gray:
|
||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
return FIT_BITMAP;
|
return FIT_BITMAP;
|
||||||
case Image_Format_Gray16:
|
|
||||||
return FIT_UINT16;
|
|
||||||
default:
|
default:
|
||||||
return FIT_UNKNOWN;
|
return FIT_UNKNOWN;
|
||||||
}
|
}
|
||||||
@@ -308,10 +304,6 @@ namespace
|
|||||||
{
|
{
|
||||||
return Image_Format_Gray;
|
return Image_Format_Gray;
|
||||||
}
|
}
|
||||||
else if (theFormat == GUID_WICPixelFormat16bppGray)
|
|
||||||
{
|
|
||||||
return Image_Format_Gray16;
|
|
||||||
}
|
|
||||||
return Image_Format_UNKNOWN;
|
return Image_Format_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +318,6 @@ namespace
|
|||||||
case Image_Format_BGR: return GUID_WICPixelFormat24bppBGR;
|
case Image_Format_BGR: return GUID_WICPixelFormat24bppBGR;
|
||||||
case Image_Format_Gray: return GUID_WICPixelFormat8bppGray;
|
case Image_Format_Gray: return GUID_WICPixelFormat8bppGray;
|
||||||
case Image_Format_Alpha: return GUID_WICPixelFormat8bppGray; // GUID_WICPixelFormat8bppAlpha
|
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_GrayF: // GUID_WICPixelFormat32bppGrayFloat
|
||||||
case Image_Format_AlphaF:
|
case Image_Format_AlphaF:
|
||||||
case Image_Format_RGBAF: // GUID_WICPixelFormat128bppRGBAFloat
|
case Image_Format_RGBAF: // GUID_WICPixelFormat128bppRGBAFloat
|
||||||
@@ -1090,8 +1081,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
|
|||||||
{
|
{
|
||||||
aFileFormat = GUID_ContainerFormatJpeg;
|
aFileFormat = GUID_ContainerFormatJpeg;
|
||||||
}
|
}
|
||||||
else if (aFileNameLower.EndsWith (".tiff")
|
else if (aFileNameLower.EndsWith (".tiff"))
|
||||||
|| aFileNameLower.EndsWith (".tif"))
|
|
||||||
{
|
{
|
||||||
aFileFormat = GUID_ContainerFormatTiff;
|
aFileFormat = GUID_ContainerFormatTiff;
|
||||||
}
|
}
|
||||||
|
@@ -33,11 +33,9 @@ enum Image_Format
|
|||||||
Image_Format_BGRF, //!< same as RGBF but with different components order
|
Image_Format_BGRF, //!< same as RGBF but with different components order
|
||||||
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane
|
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane
|
||||||
Image_Format_BGRAF, //!< same as RGBAF but with different components order
|
Image_Format_BGRAF, //!< same as RGBAF but with different components order
|
||||||
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_RGF_half, //!< 2 half-floats (4-bytes) RG image plane
|
|
||||||
Image_Format_RGBAF_half, //!< 4 half-floats (8-bytes) RGBA 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_Gray16 + 1 };
|
enum { Image_Format_NB = Image_Format_RGBAF_half + 1 };
|
||||||
|
|
||||||
#endif // _Image_Format_HeaderFile
|
#endif // _Image_Format_HeaderFile
|
||||||
|
@@ -62,10 +62,8 @@ namespace
|
|||||||
ImageFormatInfo(BGRF, 3, sizeof(float) * 3),
|
ImageFormatInfo(BGRF, 3, sizeof(float) * 3),
|
||||||
ImageFormatInfo(RGBAF, 4, sizeof(float) * 4),
|
ImageFormatInfo(RGBAF, 4, sizeof(float) * 4),
|
||||||
ImageFormatInfo(BGRAF, 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(RGF_half, 2, sizeof(uint16_t) * 2),
|
||||||
ImageFormatInfo(RGBAF_half, 4, sizeof(uint16_t) * 4),
|
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(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_DXT1, 4, 1),
|
||||||
CompressedImageFormatInfo(RGBA_S3TC_DXT3, 4, 1), // DXT3/5 uses circa 1 byte per pixel (128 bits per 4x4 block)
|
CompressedImageFormatInfo(RGBA_S3TC_DXT3, 4, 1), // DXT3/5 uses circa 1 byte per pixel (128 bits per 4x4 block)
|
||||||
@@ -73,8 +71,7 @@ namespace
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMapData, NCollection_Buffer)
|
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap,Standard_Transient)
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Image_PixMap, Standard_Transient)
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : DefaultAllocator
|
// function : DefaultAllocator
|
||||||
@@ -153,31 +150,6 @@ void Image_PixMap::SetFormat (Image_Format thePixelFormat)
|
|||||||
myImgFormat = 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
|
// function : InitWrapper
|
||||||
// purpose :
|
// purpose :
|
||||||
@@ -187,32 +159,18 @@ bool Image_PixMap::InitWrapper (Image_Format thePixelFormat,
|
|||||||
const Standard_Size theSizeX,
|
const Standard_Size theSizeX,
|
||||||
const Standard_Size theSizeY,
|
const Standard_Size theSizeY,
|
||||||
const Standard_Size theSizeRowBytes)
|
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();
|
Clear();
|
||||||
myImgFormat = thePixelFormat;
|
myImgFormat = thePixelFormat;
|
||||||
if (theSizeXYZ.x() == 0
|
if ((theSizeX == 0) || (theSizeY == 0) || (theDataPtr == NULL))
|
||||||
|| theSizeXYZ.y() == 0
|
|
||||||
|| theSizeXYZ.z() == 0)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use argument only if it greater
|
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
||||||
const Standard_Size aSizeRowBytes = std::max (theSizeRowBytes, theSizeXYZ.x() * SizePixelBytes (thePixelFormat));
|
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (thePixelFormat),
|
||||||
myData.Init (DefaultAllocator(), Image_PixMap::SizePixelBytes (thePixelFormat),
|
theSizeX, theSizeY, theSizeRowBytes, theDataPtr);
|
||||||
theSizeXYZ, aSizeRowBytes, NULL);
|
return true;
|
||||||
return !myData.IsEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -224,31 +182,33 @@ bool Image_PixMap::InitTrash (Image_Format thePixelFormat,
|
|||||||
const Standard_Size theSizeY,
|
const Standard_Size theSizeY,
|
||||||
const Standard_Size theSizeRowBytes)
|
const Standard_Size theSizeRowBytes)
|
||||||
{
|
{
|
||||||
return InitTrash3D (thePixelFormat, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : InitZero3D
|
// function : InitZero
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
bool Image_PixMap::InitZero3D (Image_Format thePixelFormat,
|
bool Image_PixMap::InitZero (Image_Format thePixelFormat,
|
||||||
const NCollection_Vec3<Standard_Size>& theSizeXYZ,
|
const Standard_Size theSizeX,
|
||||||
const Standard_Size theSizeRowBytes,
|
const Standard_Size theSizeY,
|
||||||
const Standard_Byte theValue)
|
const Standard_Size theSizeRowBytes,
|
||||||
|
const Standard_Byte theValue)
|
||||||
{
|
{
|
||||||
if (theSizeXYZ.z() > 1)
|
if (!InitTrash (thePixelFormat, theSizeX, theSizeY, theSizeRowBytes))
|
||||||
{
|
{
|
||||||
if (!InitTrash3D (thePixelFormat, theSizeXYZ, theSizeRowBytes))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!InitTrash (thePixelFormat, theSizeXYZ.x(), theSizeXYZ.y(), theSizeRowBytes))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
memset (myData.ChangeData(), (int )theValue, SizeBytes());
|
memset (myData.ChangeData(), (int )theValue, SizeBytes());
|
||||||
return true;
|
return true;
|
||||||
@@ -265,24 +225,12 @@ bool Image_PixMap::InitCopy (const Image_PixMap& theCopy)
|
|||||||
// self-copying disallowed
|
// self-copying disallowed
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (InitTrash (theCopy.myImgFormat, theCopy.SizeX(), theCopy.SizeY(), theCopy.SizeRowBytes()))
|
||||||
if (theCopy.SizeZ() > 1)
|
|
||||||
{
|
{
|
||||||
if (!InitTrash3D (theCopy.myImgFormat, theCopy.SizeXYZ(), theCopy.SizeRowBytes()))
|
memcpy (myData.ChangeData(), theCopy.myData.Data(), theCopy.SizeBytes());
|
||||||
{
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
return false;
|
||||||
{
|
|
||||||
if (!InitTrash (theCopy.myImgFormat, theCopy.SizeX(), theCopy.SizeY(), theCopy.SizeRowBytes()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (myData.ChangeData(), theCopy.myData.Data(), theCopy.SizeBytes());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -293,73 +241,75 @@ void Image_PixMap::Clear()
|
|||||||
{
|
{
|
||||||
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
Handle(NCollection_BaseAllocator) anEmptyAlloc;
|
||||||
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (myImgFormat),
|
myData.Init (anEmptyAlloc, Image_PixMap::SizePixelBytes (myImgFormat),
|
||||||
NCollection_Vec3<Standard_Size> (0), 0, nullptr);
|
0, 0, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : ColorFromRawPixel
|
// function : PixelColor
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawValue,
|
Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
|
||||||
const Image_Format theFormat,
|
const Standard_Integer theY,
|
||||||
const Standard_Boolean theToLinearize)
|
const Standard_Boolean theToLinearize) const
|
||||||
{
|
{
|
||||||
switch (theFormat)
|
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)
|
||||||
{
|
{
|
||||||
case Image_Format_GrayF:
|
case Image_Format_GrayF:
|
||||||
{
|
{
|
||||||
const Standard_ShortReal& aPixel = *reinterpret_cast<const Standard_ShortReal*> (theRawValue);
|
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel, aPixel, aPixel, 1.0f)); // opaque
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel, aPixel, aPixel, 1.0f)); // opaque
|
||||||
}
|
}
|
||||||
case Image_Format_AlphaF:
|
case Image_Format_AlphaF:
|
||||||
{
|
{
|
||||||
const Standard_ShortReal& aPixel = *reinterpret_cast<const Standard_ShortReal*> (theRawValue);
|
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (1.0f, 1.0f, 1.0f, aPixel));
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (1.0f, 1.0f, 1.0f, aPixel));
|
||||||
}
|
}
|
||||||
case Image_Format_RGF:
|
case Image_Format_RGF:
|
||||||
{
|
{
|
||||||
const Image_ColorRGF& aPixel = *reinterpret_cast<const Image_ColorRGF*> (theRawValue);
|
const Image_ColorRGF& aPixel = Value<Image_ColorRGF> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), 0.0f, 1.0f));
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
case Image_Format_RGBAF:
|
case Image_Format_RGBAF:
|
||||||
{
|
{
|
||||||
const Image_ColorRGBAF& aPixel = *reinterpret_cast<const Image_ColorRGBAF*> (theRawValue);
|
const Image_ColorRGBAF& aPixel = Value<Image_ColorRGBAF> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
||||||
}
|
}
|
||||||
case Image_Format_BGRAF:
|
case Image_Format_BGRAF:
|
||||||
{
|
{
|
||||||
const Image_ColorBGRAF& aPixel = *reinterpret_cast<const Image_ColorBGRAF*> (theRawValue);
|
const Image_ColorBGRAF& aPixel = Value<Image_ColorBGRAF> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), aPixel.a()));
|
||||||
}
|
}
|
||||||
case Image_Format_RGBF:
|
case Image_Format_RGBF:
|
||||||
{
|
{
|
||||||
const Image_ColorRGBF& aPixel = *reinterpret_cast<const Image_ColorRGBF*> (theRawValue);
|
const Image_ColorRGBF& aPixel = Value<Image_ColorRGBF> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
|
||||||
}
|
}
|
||||||
case Image_Format_BGRF:
|
case Image_Format_BGRF:
|
||||||
{
|
{
|
||||||
const Image_ColorBGRF& aPixel = *reinterpret_cast<const Image_ColorBGRF*> (theRawValue);
|
const Image_ColorBGRF& aPixel = Value<Image_ColorBGRF> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
|
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:
|
case Image_Format_RGF_half:
|
||||||
{
|
{
|
||||||
const NCollection_Vec2<uint16_t>& aPixel = *reinterpret_cast<const NCollection_Vec2<uint16_t>*> (theRawValue);
|
const NCollection_Vec2<uint16_t>& aPixel = Value<NCollection_Vec2<uint16_t>> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.x()), ConvertFromHalfFloat (aPixel.y()), 0.0f, 1.0f));
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.x()), ConvertFromHalfFloat (aPixel.y()), 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
case Image_Format_RGBAF_half:
|
case Image_Format_RGBAF_half:
|
||||||
{
|
{
|
||||||
const NCollection_Vec4<uint16_t>& aPixel = *reinterpret_cast<const NCollection_Vec4<uint16_t>*> (theRawValue);
|
const NCollection_Vec4<uint16_t>& aPixel = Value<NCollection_Vec4<uint16_t>> (theY, theX);
|
||||||
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.r()), ConvertFromHalfFloat (aPixel.g()),
|
return Quantity_ColorRGBA (NCollection_Vec4<float> (ConvertFromHalfFloat (aPixel.r()), ConvertFromHalfFloat (aPixel.g()),
|
||||||
ConvertFromHalfFloat (aPixel.b()), ConvertFromHalfFloat (aPixel.a())));
|
ConvertFromHalfFloat (aPixel.b()), ConvertFromHalfFloat (aPixel.a())));
|
||||||
}
|
}
|
||||||
case Image_Format_RGBA:
|
case Image_Format_RGBA:
|
||||||
{
|
{
|
||||||
const Image_ColorRGBA& aPixel = *reinterpret_cast<const Image_ColorRGBA*> (theRawValue);
|
const Image_ColorRGBA& aPixel = Value<Image_ColorRGBA> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -369,7 +319,7 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_BGRA:
|
case Image_Format_BGRA:
|
||||||
{
|
{
|
||||||
const Image_ColorBGRA& aPixel = *reinterpret_cast<const Image_ColorBGRA*> (theRawValue);
|
const Image_ColorBGRA& aPixel = Value<Image_ColorBGRA> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -379,7 +329,7 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_RGB32:
|
case Image_Format_RGB32:
|
||||||
{
|
{
|
||||||
const Image_ColorRGB32& aPixel = *reinterpret_cast<const Image_ColorRGB32*> (theRawValue);
|
const Image_ColorRGB32& aPixel = Value<Image_ColorRGB32> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -388,7 +338,7 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_BGR32:
|
case Image_Format_BGR32:
|
||||||
{
|
{
|
||||||
const Image_ColorBGR32& aPixel = *reinterpret_cast<const Image_ColorBGR32*> (theRawValue);
|
const Image_ColorBGR32& aPixel = Value<Image_ColorBGR32> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -397,7 +347,7 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_RGB:
|
case Image_Format_RGB:
|
||||||
{
|
{
|
||||||
const Image_ColorRGB& aPixel = *reinterpret_cast<const Image_ColorRGB*> (theRawValue);
|
const Image_ColorRGB& aPixel = Value<Image_ColorRGB> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -406,7 +356,7 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_BGR:
|
case Image_Format_BGR:
|
||||||
{
|
{
|
||||||
const Image_ColorBGR& aPixel = *reinterpret_cast<const Image_ColorBGR*> (theRawValue);
|
const Image_ColorBGR& aPixel = Value<Image_ColorBGR> (theY, theX);
|
||||||
return theToLinearize
|
return theToLinearize
|
||||||
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
? Quantity_ColorRGBA (Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.r()) / 255.0f),
|
||||||
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
Quantity_Color::Convert_sRGB_To_LinearRGB (float(aPixel.g()) / 255.0f),
|
||||||
@@ -415,21 +365,14 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
case Image_Format_Gray:
|
case Image_Format_Gray:
|
||||||
{
|
{
|
||||||
const Standard_Byte& aPixel = *reinterpret_cast<const Standard_Byte*> (theRawValue);
|
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
|
||||||
const float anIntensity = float(aPixel) / 255.0f;
|
return Quantity_ColorRGBA (float(aPixel) / 255.0f, float(aPixel) / 255.0f, float(aPixel) / 255.0f, 1.0f); // opaque
|
||||||
return Quantity_ColorRGBA (anIntensity, anIntensity, anIntensity, 1.0f); // opaque
|
|
||||||
}
|
}
|
||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
{
|
{
|
||||||
const Standard_Byte& aPixel = *reinterpret_cast<const Standard_Byte*> (theRawValue);
|
const Standard_Byte& aPixel = Value<Standard_Byte> (theY, theX);
|
||||||
return Quantity_ColorRGBA (1.0f, 1.0f, 1.0f, float(aPixel) / 255.0f);
|
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:
|
case Image_Format_UNKNOWN:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@@ -441,37 +384,44 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : ColorToRawPixel
|
// function : SetPixelColor
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
void Image_PixMap::SetPixelColor (const Standard_Integer theX,
|
||||||
const Image_Format theFormat,
|
const Standard_Integer theY,
|
||||||
const Quantity_ColorRGBA& theColor,
|
const Quantity_ColorRGBA& theColor,
|
||||||
const Standard_Boolean theToDeLinearize)
|
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;
|
const NCollection_Vec4<float>& aColor = theColor;
|
||||||
switch (theFormat)
|
switch (myImgFormat)
|
||||||
{
|
{
|
||||||
case Image_Format_GrayF:
|
case Image_Format_GrayF:
|
||||||
{
|
{
|
||||||
*reinterpret_cast<Standard_ShortReal*> (theRawValue) = aColor.r();
|
ChangeValue<Standard_ShortReal> (theY, theX) = aColor.r();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_AlphaF:
|
case Image_Format_AlphaF:
|
||||||
{
|
{
|
||||||
*reinterpret_cast<Standard_ShortReal*> (theRawValue) = aColor.a();
|
ChangeValue<Standard_ShortReal> (theY, theX) = aColor.a();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_RGF:
|
case Image_Format_RGF:
|
||||||
{
|
{
|
||||||
Image_ColorRGF& aPixel = *reinterpret_cast<Image_ColorRGF*> (theRawValue);
|
Image_ColorRGF& aPixel = ChangeValue<Image_ColorRGF> (theY, theX);
|
||||||
aPixel.r() = aColor.r();
|
aPixel.r() = aColor.r();
|
||||||
aPixel.g() = aColor.g();
|
aPixel.g() = aColor.g();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_RGBAF:
|
case Image_Format_RGBAF:
|
||||||
{
|
{
|
||||||
Image_ColorRGBAF& aPixel = *reinterpret_cast<Image_ColorRGBAF*> (theRawValue);
|
Image_ColorRGBAF& aPixel = ChangeValue<Image_ColorRGBAF> (theY, theX);
|
||||||
aPixel.r() = aColor.r();
|
aPixel.r() = aColor.r();
|
||||||
aPixel.g() = aColor.g();
|
aPixel.g() = aColor.g();
|
||||||
aPixel.b() = aColor.b();
|
aPixel.b() = aColor.b();
|
||||||
@@ -480,7 +430,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_BGRAF:
|
case Image_Format_BGRAF:
|
||||||
{
|
{
|
||||||
Image_ColorBGRAF& aPixel = *reinterpret_cast<Image_ColorBGRAF*> (theRawValue);
|
Image_ColorBGRAF& aPixel = ChangeValue<Image_ColorBGRAF> (theY, theX);
|
||||||
aPixel.r() = aColor.r();
|
aPixel.r() = aColor.r();
|
||||||
aPixel.g() = aColor.g();
|
aPixel.g() = aColor.g();
|
||||||
aPixel.b() = aColor.b();
|
aPixel.b() = aColor.b();
|
||||||
@@ -489,7 +439,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_RGBF:
|
case Image_Format_RGBF:
|
||||||
{
|
{
|
||||||
Image_ColorRGBF& aPixel = *reinterpret_cast<Image_ColorRGBF*> (theRawValue);
|
Image_ColorRGBF& aPixel = ChangeValue<Image_ColorRGBF> (theY, theX);
|
||||||
aPixel.r() = aColor.r();
|
aPixel.r() = aColor.r();
|
||||||
aPixel.g() = aColor.g();
|
aPixel.g() = aColor.g();
|
||||||
aPixel.b() = aColor.b();
|
aPixel.b() = aColor.b();
|
||||||
@@ -497,28 +447,22 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_BGRF:
|
case Image_Format_BGRF:
|
||||||
{
|
{
|
||||||
Image_ColorBGRF& aPixel = *reinterpret_cast<Image_ColorBGRF*> (theRawValue);
|
Image_ColorBGRF& aPixel = ChangeValue<Image_ColorBGRF> (theY, theX);
|
||||||
aPixel.r() = aColor.r();
|
aPixel.r() = aColor.r();
|
||||||
aPixel.g() = aColor.g();
|
aPixel.g() = aColor.g();
|
||||||
aPixel.b() = aColor.b();
|
aPixel.b() = aColor.b();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_GrayF_half:
|
|
||||||
{
|
|
||||||
uint16_t& aPixel = *reinterpret_cast<uint16_t*> (theRawValue);
|
|
||||||
aPixel = ConvertToHalfFloat (aColor.r());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case Image_Format_RGF_half:
|
case Image_Format_RGF_half:
|
||||||
{
|
{
|
||||||
NCollection_Vec2<uint16_t>& aPixel = *reinterpret_cast<NCollection_Vec2<uint16_t>*> (theRawValue);
|
NCollection_Vec2<uint16_t>& aPixel = ChangeValue<NCollection_Vec2<uint16_t>> (theY, theX);
|
||||||
aPixel.x() = ConvertToHalfFloat (aColor.r());
|
aPixel.x() = ConvertToHalfFloat (aColor.r());
|
||||||
aPixel.y() = ConvertToHalfFloat (aColor.g());
|
aPixel.y() = ConvertToHalfFloat (aColor.g());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_RGBAF_half:
|
case Image_Format_RGBAF_half:
|
||||||
{
|
{
|
||||||
NCollection_Vec4<uint16_t>& aPixel = *reinterpret_cast<NCollection_Vec4<uint16_t>*> (theRawValue);
|
NCollection_Vec4<uint16_t>& aPixel = ChangeValue<NCollection_Vec4<uint16_t>> (theY, theX);
|
||||||
aPixel.r() = ConvertToHalfFloat (aColor.r());
|
aPixel.r() = ConvertToHalfFloat (aColor.r());
|
||||||
aPixel.g() = ConvertToHalfFloat (aColor.g());
|
aPixel.g() = ConvertToHalfFloat (aColor.g());
|
||||||
aPixel.b() = ConvertToHalfFloat (aColor.b());
|
aPixel.b() = ConvertToHalfFloat (aColor.b());
|
||||||
@@ -527,7 +471,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_RGBA:
|
case Image_Format_RGBA:
|
||||||
{
|
{
|
||||||
Image_ColorRGBA& aPixel = *reinterpret_cast<Image_ColorRGBA*> (theRawValue);
|
Image_ColorRGBA& aPixel = ChangeValue<Image_ColorRGBA> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -545,7 +489,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_BGRA:
|
case Image_Format_BGRA:
|
||||||
{
|
{
|
||||||
Image_ColorBGRA& aPixel = *reinterpret_cast<Image_ColorBGRA*> (theRawValue);
|
Image_ColorBGRA& aPixel = ChangeValue<Image_ColorBGRA> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -563,7 +507,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_RGB32:
|
case Image_Format_RGB32:
|
||||||
{
|
{
|
||||||
Image_ColorRGB32& aPixel = *reinterpret_cast<Image_ColorRGB32*> (theRawValue);
|
Image_ColorRGB32& aPixel = ChangeValue<Image_ColorRGB32> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -581,7 +525,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_BGR32:
|
case Image_Format_BGR32:
|
||||||
{
|
{
|
||||||
Image_ColorBGR32& aPixel = *reinterpret_cast<Image_ColorBGR32*> (theRawValue);
|
Image_ColorBGR32& aPixel = ChangeValue<Image_ColorBGR32> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -599,7 +543,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_RGB:
|
case Image_Format_RGB:
|
||||||
{
|
{
|
||||||
Image_ColorRGB& aPixel = *reinterpret_cast<Image_ColorRGB*> (theRawValue);
|
Image_ColorRGB& aPixel = ChangeValue<Image_ColorRGB> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -616,7 +560,7 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_BGR:
|
case Image_Format_BGR:
|
||||||
{
|
{
|
||||||
Image_ColorBGR& aPixel = *reinterpret_cast<Image_ColorBGR*> (theRawValue);
|
Image_ColorBGR& aPixel = ChangeValue<Image_ColorBGR> (theY, theX);
|
||||||
if (theToDeLinearize)
|
if (theToDeLinearize)
|
||||||
{
|
{
|
||||||
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
aPixel.r() = Standard_Byte(Quantity_Color::Convert_LinearRGB_To_sRGB (aColor.r()) * 255.0f);
|
||||||
@@ -633,17 +577,12 @@ void Image_PixMap::ColorToRawPixel (Standard_Byte* theRawValue,
|
|||||||
}
|
}
|
||||||
case Image_Format_Gray:
|
case Image_Format_Gray:
|
||||||
{
|
{
|
||||||
*reinterpret_cast<Standard_Byte*>(theRawValue) = Standard_Byte(aColor.r() * 255.0f);
|
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(aColor.r() * 255.0f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
{
|
{
|
||||||
*reinterpret_cast<Standard_Byte*>(theRawValue) = Standard_Byte(aColor.a() * 255.0f);
|
ChangeValue<Standard_Byte> (theY, theX) = Standard_Byte(aColor.a() * 255.0f);
|
||||||
return;
|
|
||||||
}
|
|
||||||
case Image_Format_Gray16:
|
|
||||||
{
|
|
||||||
*reinterpret_cast<uint16_t*>(theRawValue) = uint16_t(aColor.r() * 65535.0f);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Image_Format_UNKNOWN:
|
case Image_Format_UNKNOWN:
|
||||||
@@ -668,21 +607,18 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
|||||||
{
|
{
|
||||||
const bool toResetAlpha = theImage.Format() == Image_Format_BGR32
|
const bool toResetAlpha = theImage.Format() == Image_Format_BGR32
|
||||||
|| theImage.Format() == Image_Format_RGB32;
|
|| theImage.Format() == Image_Format_RGB32;
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
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)
|
||||||
{
|
{
|
||||||
Image_ColorRGBA& aPixel = theImage.ChangeValueXYZ<Image_ColorRGBA> (aCol, aRow, aSlice);
|
aPixel.a() = 255;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -691,18 +627,15 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
|||||||
case Image_Format_BGR:
|
case Image_Format_BGR:
|
||||||
case Image_Format_RGB:
|
case Image_Format_RGB:
|
||||||
{
|
{
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
Image_ColorRGB& aPixel = theImage.ChangeValue<Image_ColorRGB> (aRow, aCol);
|
||||||
{
|
Image_ColorBGR aPixelCopy = theImage.Value <Image_ColorBGR> (aRow, aCol);
|
||||||
Image_ColorRGB& aPixel = theImage.ChangeValueXYZ<Image_ColorRGB> (aCol, aRow, aSlice);
|
aPixel.r() = aPixelCopy.r();
|
||||||
Image_ColorBGR aPixelCopy = theImage.ValueXYZ <Image_ColorBGR> (aCol, aRow, aSlice);
|
aPixel.g() = aPixelCopy.g();
|
||||||
aPixel.r() = aPixelCopy.r();
|
aPixel.b() = aPixelCopy.b();
|
||||||
aPixel.g() = aPixelCopy.g();
|
|
||||||
aPixel.b() = aPixelCopy.b();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -712,18 +645,15 @@ bool Image_PixMap::SwapRgbaBgra (Image_PixMap& theImage)
|
|||||||
case Image_Format_BGRAF:
|
case Image_Format_BGRAF:
|
||||||
case Image_Format_RGBAF:
|
case Image_Format_RGBAF:
|
||||||
{
|
{
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
Image_ColorRGBF& aPixel = theImage.ChangeValue<Image_ColorRGBF> (aRow, aCol);
|
||||||
{
|
Image_ColorBGRF aPixelCopy = theImage.Value <Image_ColorBGRF> (aRow, aCol);
|
||||||
Image_ColorRGBF& aPixel = theImage.ChangeValueXYZ<Image_ColorRGBF> (aCol, aRow, aSlice);
|
aPixel.r() = aPixelCopy.r();
|
||||||
Image_ColorBGRF aPixelCopy = theImage.ValueXYZ <Image_ColorBGRF> (aCol, aRow, aSlice);
|
aPixel.g() = aPixelCopy.g();
|
||||||
aPixel.r() = aPixelCopy.r();
|
aPixel.b() = aPixelCopy.b();
|
||||||
aPixel.g() = aPixelCopy.g();
|
|
||||||
aPixel.b() = aPixelCopy.b();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -743,35 +673,14 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
|||||||
case Image_Format_Gray:
|
case Image_Format_Gray:
|
||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
{
|
{
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
unsigned char& aPixel = theImage.ChangeValue<unsigned char> (aRow, aCol);
|
||||||
|
if (aPixel != 0)
|
||||||
{
|
{
|
||||||
uint8_t& aPixel = theImage.ChangeValueXYZ<uint8_t> (aCol, aRow, aSlice);
|
aPixel = 255;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,20 +693,17 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
|||||||
case Image_Format_RGBA:
|
case Image_Format_RGBA:
|
||||||
case Image_Format_BGRA:
|
case Image_Format_BGRA:
|
||||||
{
|
{
|
||||||
const NCollection_Vec3<uint8_t> aWhite24 (255, 255, 255);
|
const NCollection_Vec3<unsigned char> aWhite24 (255, 255, 255);
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
NCollection_Vec3<unsigned char>& aPixel = theImage.ChangeValue< NCollection_Vec3<unsigned char> > (aRow, aCol);
|
||||||
|
if (aPixel[0] != 0
|
||||||
|
|| aPixel[1] != 0
|
||||||
|
|| aPixel[2] != 0)
|
||||||
{
|
{
|
||||||
NCollection_Vec3<uint8_t>& aPixel = theImage.ChangeValueXYZ< NCollection_Vec3<uint8_t> > (aCol, aRow, aSlice);
|
aPixel = aWhite24;
|
||||||
if (aPixel[0] != 0
|
|
||||||
|| aPixel[1] != 0
|
|
||||||
|| aPixel[2] != 0)
|
|
||||||
{
|
|
||||||
aPixel = aWhite24;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -806,21 +712,17 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const Quantity_ColorRGBA aWhiteRgba (1.0f, 1.0f, 1.0f, 1.0f);
|
const Quantity_ColorRGBA aWhiteRgba (1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
|
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
||||||
{
|
{
|
||||||
for (Standard_Size aCol = 0; aCol < theImage.SizeX(); ++aCol)
|
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)
|
||||||
{
|
{
|
||||||
Standard_Byte* aRawPixel = theImage.ChangeRawValueXYZ (aCol, aRow, aSlice);
|
theImage.SetPixelColor (int(aCol), int(aRow), aWhiteRgba);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -830,7 +732,7 @@ void Image_PixMap::ToBlackWhite (Image_PixMap& theImage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : FlipY
|
// function : InitCopy
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
bool Image_PixMap::FlipY (Image_PixMap& theImage)
|
bool Image_PixMap::FlipY (Image_PixMap& theImage)
|
||||||
@@ -851,16 +753,13 @@ bool Image_PixMap::FlipY (Image_PixMap& theImage)
|
|||||||
|
|
||||||
// for odd height middle row should be left as is
|
// for odd height middle row should be left as is
|
||||||
Standard_Size aNbRowsHalf = theImage.SizeY() / 2;
|
Standard_Size aNbRowsHalf = theImage.SizeY() / 2;
|
||||||
for (Standard_Size aSlice = 0; aSlice < theImage.SizeZ(); ++aSlice)
|
for (Standard_Size aRowT = 0, aRowB = theImage.SizeY() - 1; aRowT < aNbRowsHalf; ++aRowT, --aRowB)
|
||||||
{
|
{
|
||||||
for (Standard_Size aRowT = 0, aRowB = theImage.SizeY() - 1; aRowT < aNbRowsHalf; ++aRowT, --aRowB)
|
Standard_Byte* aTop = theImage.ChangeRow (aRowT);
|
||||||
{
|
Standard_Byte* aBot = theImage.ChangeRow (aRowB);
|
||||||
Standard_Byte* aTop = theImage.ChangeSliceRow (aSlice, aRowT);
|
memcpy (aTmp.ChangeData(), aTop, aRowSize);
|
||||||
Standard_Byte* aBot = theImage.ChangeSliceRow (aSlice, aRowB);
|
memcpy (aTop, aBot, aRowSize);
|
||||||
memcpy (aTmp.ChangeData(), aTop, aRowSize);
|
memcpy (aBot, aTmp.Data(), aRowSize);
|
||||||
memcpy (aTop, aBot, aRowSize);
|
|
||||||
memcpy (aBot, aTmp.Data(), aRowSize);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,6 @@ public:
|
|||||||
return !aUnion.myChar[0];
|
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.
|
//! Auxiliary method for swapping bytes between RGB and BGR formats.
|
||||||
//! This method modifies the image data but does not change pixel format!
|
//! This method modifies the image data but does not change pixel format!
|
||||||
//! Method will fail if pixel format is not one of the following:
|
//! Method will fail if pixel format is not one of the following:
|
||||||
@@ -63,28 +60,8 @@ public:
|
|||||||
//! Return string representation of compressed pixel format.
|
//! Return string representation of compressed pixel format.
|
||||||
Standard_EXPORT static Standard_CString ImageFormatToString (Image_CompressedFormat theFormat);
|
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
|
public: // high-level API
|
||||||
|
|
||||||
//! Return pixel format.
|
|
||||||
Image_Format Format() const { return myImgFormat; }
|
Image_Format Format() const { return myImgFormat; }
|
||||||
|
|
||||||
//! Override pixel format specified by InitXXX() methods.
|
//! Override pixel format specified by InitXXX() methods.
|
||||||
@@ -93,38 +70,41 @@ public: // high-level API
|
|||||||
//! (e.g. ImgGray and ImgAlpha).
|
//! (e.g. ImgGray and ImgAlpha).
|
||||||
Standard_EXPORT void SetFormat (const Image_Format thePixelFormat);
|
Standard_EXPORT void SetFormat (const Image_Format thePixelFormat);
|
||||||
|
|
||||||
//! Return image width in pixels.
|
//! @return image width in pixels
|
||||||
Standard_Size Width() const { return myData.SizeX; }
|
inline Standard_Size Width() const
|
||||||
|
|
||||||
//! 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 NCollection_Vec3<Standard_Size> (myData.SizeX, myData.SizeY, myData.SizeZ);
|
return myData.SizeX;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return width / height.
|
//! @return image height in pixels
|
||||||
Standard_Real Ratio() const
|
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 (SizeY() > 0) ? (Standard_Real(SizeX()) / Standard_Real(SizeY())) : 1.0;
|
return (SizeY() > 0) ? (Standard_Real(SizeX()) / Standard_Real(SizeY())) : 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return true if data is NULL.
|
//! @return true if data is NULL.
|
||||||
bool IsEmpty() const { return myData.IsEmpty(); }
|
bool IsEmpty() const
|
||||||
|
{
|
||||||
|
return myData.IsEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
//! Empty constructor. Initialize the NULL image plane.
|
//! Empty constructor. Initialize the NULL image plane.
|
||||||
Standard_EXPORT Image_PixMap();
|
Standard_EXPORT Image_PixMap();
|
||||||
@@ -134,60 +114,38 @@ public: // high-level API
|
|||||||
|
|
||||||
//! Returns the pixel color. This function is relatively slow.
|
//! Returns the pixel color. This function is relatively slow.
|
||||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||||
//! @param[in] theX column index from left, starting from 0
|
//! @param theX [in] column index from left
|
||||||
//! @param[in] theY row index from top, starting from 0
|
//! @param theY [in] row index from top
|
||||||
//! @param[in] theToLinearize when TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
|
//! @param theToLinearize [in] when TRUE, the color stored in non-linear color space (e.g. Image_Format_RGB) will be linearized
|
||||||
//! @return the pixel color
|
//! @return the pixel color
|
||||||
Quantity_ColorRGBA PixelColor (Standard_Integer theX,
|
Standard_EXPORT Quantity_ColorRGBA PixelColor (const Standard_Integer theX,
|
||||||
Standard_Integer theY,
|
const Standard_Integer theY,
|
||||||
Standard_Boolean theToLinearize = false) const
|
const Standard_Boolean theToLinearize = Standard_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.
|
//! Sets the pixel color. This function is relatively slow.
|
||||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||||
//! @param[in] theX column index from left
|
//! @param theX [in] column index from left
|
||||||
//! @param[in] theY row index from top
|
//! @param theY [in] row index from top
|
||||||
//! @param[in] theColor color to store
|
//! @param theColor [in] 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)
|
//! @param theToDeLinearize [in] 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,
|
void SetPixelColor (const Standard_Integer theX,
|
||||||
const Standard_Integer theY,
|
const Standard_Integer theY,
|
||||||
const Quantity_Color& theColor,
|
const Quantity_Color& theColor,
|
||||||
const Standard_Boolean theToDeLinearize = false)
|
const Standard_Boolean theToDeLinearize = Standard_False)
|
||||||
{
|
{
|
||||||
SetPixelColor (theX, theY, Quantity_ColorRGBA (theColor, 1.0f), theToDeLinearize);
|
SetPixelColor (theX, theY, Quantity_ColorRGBA (theColor, 1.0f), theToDeLinearize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets the pixel color. This function is relatively slow.
|
//! Sets the pixel color. This function is relatively slow.
|
||||||
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
//! Beware that this method takes coordinates in opposite order in contrast to ::Value() and ::ChangeValue().
|
||||||
//! @param[in] theX column index from left
|
//! @param theX [in] column index from left
|
||||||
//! @param[in] theY row index from top
|
//! @param theY [in] row index from top
|
||||||
//! @param[in] theColor color to store
|
//! @param theColor [in] 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)
|
//! @param theToDeLinearize [in] 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,
|
Standard_EXPORT void SetPixelColor (const Standard_Integer theX,
|
||||||
const Standard_Integer theY,
|
const Standard_Integer theY,
|
||||||
const Quantity_ColorRGBA& theColor,
|
const Quantity_ColorRGBA& theColor,
|
||||||
const Standard_Boolean theToDeLinearize = false)
|
const Standard_Boolean theToDeLinearize = Standard_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.
|
//! Initialize image plane as wrapper over alien data.
|
||||||
//! Data will not be copied! Notice that caller should ensure
|
//! Data will not be copied! Notice that caller should ensure
|
||||||
@@ -212,42 +170,15 @@ public: // high-level API
|
|||||||
|
|
||||||
//! Initialize image plane with required dimensions.
|
//! Initialize image plane with required dimensions.
|
||||||
//! Buffer will be zeroed (black color for most formats).
|
//! Buffer will be zeroed (black color for most formats).
|
||||||
bool InitZero (Image_Format thePixelFormat,
|
Standard_EXPORT bool InitZero (Image_Format thePixelFormat,
|
||||||
const Standard_Size theSizeX,
|
const Standard_Size theSizeX,
|
||||||
const Standard_Size theSizeY,
|
const Standard_Size theSizeY,
|
||||||
const Standard_Size theSizeRowBytes = 0,
|
const Standard_Size theSizeRowBytes = 0,
|
||||||
const Standard_Byte theValue = 0)
|
const Standard_Byte theValue = 0);
|
||||||
{
|
|
||||||
return InitZero3D (thePixelFormat, NCollection_Vec3<Standard_Size> (theSizeX, theSizeY, 1), theSizeRowBytes, theValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Method correctly deallocate internal buffer.
|
//! Method correctly deallocate internal buffer.
|
||||||
Standard_EXPORT virtual void Clear();
|
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)
|
public: //! @name low-level API for batch-processing (pixels reading / comparison / modification)
|
||||||
|
|
||||||
//! Returns TRUE if image data is stored from Top to the Down.
|
//! Returns TRUE if image data is stored from Top to the Down.
|
||||||
@@ -259,106 +190,105 @@ public: //! @name low-level API for batch-processing (pixels reading / compariso
|
|||||||
//! convert input row-index to apply this flag!
|
//! convert input row-index to apply this flag!
|
||||||
//! You should use this flag only if interconnect with alien APIs and buffers.
|
//! You should use this flag only if interconnect with alien APIs and buffers.
|
||||||
//! @return true if image data is top-down
|
//! @return true if image data is top-down
|
||||||
bool IsTopDown() const { return myData.TopToDown == 1; }
|
inline bool IsTopDown() const
|
||||||
|
{
|
||||||
|
return myData.TopToDown == 1;
|
||||||
|
}
|
||||||
|
|
||||||
//! Setup scanlines order in memory - top-down or bottom-up.
|
//! Setup scanlines order in memory - top-down or bottom-up.
|
||||||
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
||||||
//! @param theIsTopDown top-down flag
|
//! @param theIsTopDown top-down flag
|
||||||
void SetTopDown (const bool theIsTopDown) { myData.SetTopDown (theIsTopDown); }
|
inline void SetTopDown (const bool theIsTopDown)
|
||||||
|
{
|
||||||
|
myData.SetTopDown (theIsTopDown);
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.
|
//! Returns +1 if scanlines ordered in Top->Down order in memory and -1 otherwise.
|
||||||
//! @return scanline increment for Top->Down iteration
|
//! @return scanline increment for Top->Down iteration
|
||||||
Standard_Size TopDownInc() const { return myData.TopToDown; }
|
inline Standard_Size TopDownInc() const
|
||||||
|
|
||||||
//! 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.SliceRow (theSlice, theRow);
|
return myData.TopToDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return data pointer to requested row (first column).
|
//! @return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||||
//! Indexation starts from 0.
|
inline const Standard_Byte* Data() const
|
||||||
Standard_Byte* ChangeSliceRow (Standard_Size theSlice,
|
|
||||||
Standard_Size theRow)
|
|
||||||
{
|
{
|
||||||
return myData.ChangeSliceRow (theSlice, theRow);
|
return myData.Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return bytes reserved for one pixel (may include extra bytes for alignment).
|
//! @return data pointer for low-level operations (copying entire buffer, parsing with extra tools etc.).
|
||||||
Standard_Size SizePixelBytes() const { return myData.SizeBPP; }
|
inline Standard_Byte* ChangeData()
|
||||||
|
{
|
||||||
|
return myData.ChangeData();
|
||||||
|
}
|
||||||
|
|
||||||
//! Return bytes reserved per row.
|
//! @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.
|
||||||
//! Could be larger than needed to store packed row (extra bytes for alignment etc.).
|
//! Could be larger than needed to store packed row (extra bytes for alignment etc.).
|
||||||
Standard_Size SizeRowBytes() const { return myData.SizeRowBytes; }
|
inline Standard_Size SizeRowBytes() const
|
||||||
|
{
|
||||||
|
return myData.SizeRowBytes;
|
||||||
|
}
|
||||||
|
|
||||||
//! Return the extra bytes in the row.
|
//! @return the extra bytes in the row.
|
||||||
Standard_Size RowExtraBytes() const
|
inline Standard_Size RowExtraBytes() const
|
||||||
{
|
{
|
||||||
return SizeRowBytes() - SizeX() * SizePixelBytes();
|
return SizeRowBytes() - SizeX() * SizePixelBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Compute the maximal row alignment for current row size.
|
//! Compute the maximal row alignment for current row size.
|
||||||
//! @return maximal row alignment in bytes (up to 16 bytes).
|
//! @return maximal row alignment in bytes (up to 16 bytes).
|
||||||
Standard_Size MaxRowAligmentBytes() const { return myData.MaxRowAligmentBytes(); }
|
inline Standard_Size MaxRowAligmentBytes() const
|
||||||
|
{
|
||||||
|
return myData.MaxRowAligmentBytes();
|
||||||
|
}
|
||||||
|
|
||||||
//! Return number of bytes per 2D slice.
|
//! @return buffer size
|
||||||
Standard_Size SizeSliceBytes() const { return myData.SizeSliceBytes; }
|
inline Standard_Size SizeBytes() const
|
||||||
|
{
|
||||||
//! Return buffer size
|
return myData.Size();
|
||||||
Standard_Size SizeBytes() const { return myData.Size(); }
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Access image pixel with specified color type.
|
//! 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)!
|
//! 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>
|
template <typename ColorType_t>
|
||||||
const ColorType_t& Value (Standard_Size theRow,
|
inline const ColorType_t& Value (const Standard_Size theRow,
|
||||||
Standard_Size theCol) const
|
const Standard_Size theCol) const
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<const ColorType_t*>(myData.Value (theRow, theCol));
|
return *reinterpret_cast<const ColorType_t*>(myData.Value (theRow, theCol));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Access image pixel with specified color type.
|
//! 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)!
|
//! 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>
|
template <typename ColorType_t>
|
||||||
ColorType_t& ChangeValue (Standard_Size theRow,
|
inline ColorType_t& ChangeValue (const Standard_Size theRow,
|
||||||
Standard_Size theCol)
|
const Standard_Size theCol)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<ColorType_t* >(myData.ChangeValue (theRow, theCol));
|
return *reinterpret_cast<ColorType_t* >(myData.ChangeValue (theRow, theCol));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Access image pixel as raw data pointer.
|
//! 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)!
|
//! 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,
|
const Standard_Byte* RawValue (Standard_Size theRow,
|
||||||
Standard_Size theCol) const
|
Standard_Size theCol) const
|
||||||
{
|
{
|
||||||
@@ -366,105 +296,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Access image pixel as raw data pointer.
|
//! 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)!
|
//! 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_Byte* ChangeRawValue (Standard_Size theRow,
|
||||||
Standard_Size theCol)
|
Standard_Size theCol)
|
||||||
{
|
{
|
||||||
return myData.ChangeValue (theRow, 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:
|
public:
|
||||||
|
|
||||||
//! Convert 16-bit half-float value into 32-bit float (simple conversion).
|
//! Convert 16-bit half-float value into 32-bit float (simple conversion).
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include <Image_Color.hxx>
|
#include <Image_Color.hxx>
|
||||||
#include <NCollection_Buffer.hxx>
|
#include <NCollection_Buffer.hxx>
|
||||||
#include <NCollection_Vec3.hxx>
|
|
||||||
|
|
||||||
//! Structure to manage image buffer.
|
//! Structure to manage image buffer.
|
||||||
class Image_PixMapData : public NCollection_Buffer
|
class Image_PixMapData : public NCollection_Buffer
|
||||||
@@ -32,9 +31,7 @@ public:
|
|||||||
SizeBPP (0),
|
SizeBPP (0),
|
||||||
SizeX (0),
|
SizeX (0),
|
||||||
SizeY (0),
|
SizeY (0),
|
||||||
SizeZ (0),
|
|
||||||
SizeRowBytes (0),
|
SizeRowBytes (0),
|
||||||
SizeSliceBytes (0),
|
|
||||||
TopToDown (Standard_Size(-1))
|
TopToDown (Standard_Size(-1))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -47,28 +44,16 @@ public:
|
|||||||
const Standard_Size theSizeY,
|
const Standard_Size theSizeY,
|
||||||
const Standard_Size theSizeRowBytes,
|
const Standard_Size theSizeRowBytes,
|
||||||
Standard_Byte* theDataPtr)
|
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
|
SetAllocator (theAlloc); // will free old data as well
|
||||||
|
|
||||||
myData = theDataPtr;
|
myData = theDataPtr;
|
||||||
myTopRowPtr = NULL;
|
myTopRowPtr = NULL;
|
||||||
SizeBPP = theSizeBPP;
|
SizeBPP = theSizeBPP;
|
||||||
SizeX = theSizeXYZ.x();
|
SizeX = theSizeX;
|
||||||
SizeY = theSizeXYZ.y();
|
SizeY = theSizeY;
|
||||||
SizeZ = theSizeXYZ.z();
|
SizeRowBytes = theSizeRowBytes != 0 ? theSizeRowBytes : (theSizeX * theSizeBPP);
|
||||||
SizeRowBytes = theSizeRowBytes != 0 ? theSizeRowBytes : (SizeX * theSizeBPP);
|
mySize = SizeRowBytes * SizeY;
|
||||||
SizeSliceBytes = SizeRowBytes * SizeY;
|
|
||||||
mySize = SizeSliceBytes * SizeZ;
|
|
||||||
if (myData == NULL)
|
if (myData == NULL)
|
||||||
{
|
{
|
||||||
Allocate (mySize);
|
Allocate (mySize);
|
||||||
@@ -86,93 +71,35 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return data pointer to requested row (first column).
|
//! @return data pointer to requested row (first column).
|
||||||
const Standard_Byte* Row (const Standard_Size theRow) const
|
inline const Standard_Byte* Row (const Standard_Size theRow) const
|
||||||
{
|
{
|
||||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return data pointer to requested row (first column).
|
//! @return data pointer to requested row (first column).
|
||||||
Standard_Byte* ChangeRow (const Standard_Size theRow)
|
inline Standard_Byte* ChangeRow (const Standard_Size theRow)
|
||||||
{
|
{
|
||||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return data pointer to requested position.
|
//! @return data pointer to requested position.
|
||||||
const Standard_Byte* Value (const Standard_Size theRow,
|
inline const Standard_Byte* Value (const Standard_Size theRow,
|
||||||
const Standard_Size theCol) const
|
const Standard_Size theCol) const
|
||||||
{
|
{
|
||||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol;
|
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * theCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return data pointer to requested position.
|
//! @return data pointer to requested position.
|
||||||
Standard_Byte* ChangeValue (Standard_Size theRow,
|
inline Standard_Byte* ChangeValue (const Standard_Size theRow,
|
||||||
Standard_Size theCol)
|
const Standard_Size theCol)
|
||||||
{
|
{
|
||||||
return myTopRowPtr + ptrdiff_t(SizeRowBytes * theRow * TopToDown) + SizeBPP * 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.
|
//! Compute the maximal row alignment for current row size.
|
||||||
//! @return maximal row alignment in bytes (up to 16 bytes).
|
//! @return maximal row alignment in bytes (up to 16 bytes).
|
||||||
Standard_Size MaxRowAligmentBytes() const
|
inline Standard_Size MaxRowAligmentBytes() const
|
||||||
{
|
{
|
||||||
Standard_Size anAlignment = 2;
|
Standard_Size anAlignment = 2;
|
||||||
for (; anAlignment <= 16; anAlignment <<= 1)
|
for (; anAlignment <= 16; anAlignment <<= 1)
|
||||||
@@ -188,7 +115,7 @@ public:
|
|||||||
//! Setup scanlines order in memory - top-down or bottom-up.
|
//! Setup scanlines order in memory - top-down or bottom-up.
|
||||||
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
//! Drawers should explicitly specify this value if current state IsTopDown() was ignored!
|
||||||
//! @param theIsTopDown top-down flag
|
//! @param theIsTopDown top-down flag
|
||||||
void SetTopDown (const bool theIsTopDown)
|
inline void SetTopDown (const bool theIsTopDown)
|
||||||
{
|
{
|
||||||
TopToDown = (theIsTopDown ? 1 : Standard_Size(-1));
|
TopToDown = (theIsTopDown ? 1 : Standard_Size(-1));
|
||||||
myTopRowPtr = ((TopToDown == 1 || myData == NULL)
|
myTopRowPtr = ((TopToDown == 1 || myData == NULL)
|
||||||
@@ -201,17 +128,16 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Standard_Size SizeBPP; //!< bytes per pixel
|
Standard_Size SizeBPP; //!< bytes per pixel
|
||||||
Standard_Size SizeX; //!< width in pixels
|
Standard_Size SizeX; //!< width in pixels
|
||||||
Standard_Size SizeY; //!< height 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 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 SizeSliceBytes; //!< number of bytes per 2D slice
|
|
||||||
Standard_Size TopToDown; //!< image scanlines direction in memory from Top to the Down
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Image_PixMapData, NCollection_Buffer)
|
DEFINE_STANDARD_RTTI_INLINE(Image_PixMapData,NCollection_Buffer) // Type definition
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -433,32 +433,10 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
|||||||
if(aStep < Epsilon(theLPar))
|
if(aStep < Epsilon(theLPar))
|
||||||
break;
|
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;
|
Standard_Integer aNewVertID = 0;
|
||||||
aLinOn2S = new IntSurf_LineOn2S;
|
aLinOn2S = new IntSurf_LineOn2S;
|
||||||
|
|
||||||
Standard_Real aStepMin = 0.1 * aStep, aStepMax = 10.0 * aStep;
|
const Standard_Real aStepMin = 0.1*aStep, aStepMax = 10.0*aStep;
|
||||||
|
|
||||||
Standard_Boolean isLast = Standard_False;
|
Standard_Boolean isLast = Standard_False;
|
||||||
Standard_Real aPrevParam = aParameter;
|
Standard_Real aPrevParam = aParameter;
|
||||||
@@ -608,12 +586,8 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
|||||||
{
|
{
|
||||||
if (isPointValid)
|
if (isPointValid)
|
||||||
{
|
{
|
||||||
if (!isStepReduced)
|
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
||||||
{
|
aStepMin, aStepMax, myTol3D, aStep);
|
||||||
StepComputing(theALine, aPOn2S, theLPar, aParameter, aTgMagn,
|
|
||||||
aStepMin, aStepMax, myTol3D, aStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
||||||
aPrevLPoint = aPOn2S;
|
aPrevLPoint = aPOn2S;
|
||||||
}
|
}
|
||||||
@@ -720,38 +694,6 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
|||||||
|
|
||||||
if ((aPrePointExist != IntPatch_SPntNone) && (aLinOn2S->NbPoints() > 1))
|
if ((aPrePointExist != IntPatch_SPntNone) && (aLinOn2S->NbPoints() > 1))
|
||||||
break;
|
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)
|
}//for(; !isLast; aParameter += aStep)
|
||||||
|
|
||||||
if(aLinOn2S->NbPoints() < 2)
|
if(aLinOn2S->NbPoints() < 2)
|
||||||
|
@@ -1717,38 +1717,6 @@ 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
|
//function : ExtendTwoWLines
|
||||||
//purpose : Performs extending theWLine1 and theWLine2 through their
|
//purpose : Performs extending theWLine1 and theWLine2 through their
|
||||||
@@ -1769,17 +1737,8 @@ void IntPatch_WLineTool::
|
|||||||
|
|
||||||
gp_Vec aVec1, aVec2, aVec3;
|
gp_Vec aVec1, aVec2, aVec3;
|
||||||
|
|
||||||
unsigned int hasBeenJoinedCounter = 0;
|
|
||||||
|
|
||||||
for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
|
for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
|
||||||
{
|
{
|
||||||
if (hasBeenJoinedCounter > 0)
|
|
||||||
{
|
|
||||||
aNumOfLine1--;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasBeenJoinedCounter = 0;
|
|
||||||
|
|
||||||
Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::
|
Handle(IntPatch_WLine) aWLine1 (Handle(IntPatch_WLine)::
|
||||||
DownCast(theSlin.Value(aNumOfLine1)));
|
DownCast(theSlin.Value(aNumOfLine1)));
|
||||||
|
|
||||||
@@ -1802,11 +1761,6 @@ void IntPatch_WLineTool::
|
|||||||
const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
|
const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
|
||||||
const IntSurf_PntOn2S& aPntLm1WL1 = aWLine1->Point(aNbPntsWL1-1);
|
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.
|
//Enable/Disable of some ckeck. Bit-mask is used for it.
|
||||||
//E.g. if 1st point of aWLine1 matches with
|
//E.g. if 1st point of aWLine1 matches with
|
||||||
//1st point of aWLine2 then we do not need in check
|
//1st point of aWLine2 then we do not need in check
|
||||||
@@ -1827,24 +1781,16 @@ void IntPatch_WLineTool::
|
|||||||
const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
|
const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
|
||||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aWLine2->NbPnts());
|
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aWLine2->NbPnts());
|
||||||
|
|
||||||
if (!(aPntFWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
if( aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||||
!(aPntFWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
aPntFWL1.IsSame(aPntLWL2, theToler3D) )
|
||||||
{
|
{
|
||||||
if (aPntFWL1.IsSame(aPntFWL2, theToler3D) ||
|
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
||||||
aPntFWL1.IsSame(aPntLWL2, theToler3D))
|
|
||||||
{
|
|
||||||
aCheckResult |= IntPatchWT_DisFirstFirst | IntPatchWT_DisFirstLast;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(aPntLWL1.IsSame(aPntFWL2, theToler3D, Precision::PConfusion())) &&
|
if( aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
||||||
!(aPntLWL1.IsSame(aPntLWL2, theToler3D, Precision::PConfusion())))
|
aPntLWL1.IsSame(aPntFWL2, theToler3D))
|
||||||
{
|
{
|
||||||
if (aPntLWL1.IsSame(aPntFWL2, theToler3D) ||
|
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
||||||
aPntLWL1.IsSame(aPntLWL2, theToler3D))
|
|
||||||
{
|
|
||||||
aCheckResult |= IntPatchWT_DisLastFirst | IntPatchWT_DisLastLast;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theListOfCriticalPoints.IsEmpty())
|
if (!theListOfCriticalPoints.IsEmpty())
|
||||||
@@ -1916,13 +1862,8 @@ void IntPatch_WLineTool::
|
|||||||
|
|
||||||
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
|
const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
|
||||||
const IntSurf_PntOn2S& aPntLm1WL2 = aWLine2->Point(aNbPntsWL2-1);
|
const IntSurf_PntOn2S& aPntLm1WL2 = aWLine2->Point(aNbPntsWL2-1);
|
||||||
|
|
||||||
if (IsNeedSkipWL(aWLine2, theBoxS1, theBoxS2, theArrPeriods))
|
//if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(aCheckResult & IntPatchWT_DisFirstFirst))
|
|
||||||
{// First/First
|
{// First/First
|
||||||
aVec1.SetXYZ(aPntFp1WL1.Value().XYZ() - aPntFWL1.Value().XYZ());
|
aVec1.SetXYZ(aPntFp1WL1.Value().XYZ() - aPntFWL1.Value().XYZ());
|
||||||
aVec2.SetXYZ(aPntFWL2.Value().XYZ() - aPntFp1WL2.Value().XYZ());
|
aVec2.SetXYZ(aPntFWL2.Value().XYZ() - aPntFp1WL2.Value().XYZ());
|
||||||
@@ -1968,7 +1909,6 @@ void IntPatch_WLineTool::
|
|||||||
|
|
||||||
if(hasBeenJoined)
|
if(hasBeenJoined)
|
||||||
{
|
{
|
||||||
hasBeenJoinedCounter++;
|
|
||||||
theSlin.Remove(aNumOfLine2);
|
theSlin.Remove(aNumOfLine2);
|
||||||
aNumOfLine2--;
|
aNumOfLine2--;
|
||||||
}
|
}
|
||||||
|
@@ -29,8 +29,12 @@
|
|||||||
|
|
||||||
#include <NCollection_Map.hxx>
|
#include <NCollection_Map.hxx>
|
||||||
|
|
||||||
|
static Standard_Boolean IsAdvRequired(IntPolyh_PMaillageAffinage& theMaillage);
|
||||||
|
|
||||||
static Standard_Integer ComputeIntersection(IntPolyh_PMaillageAffinage& theMaillage);
|
static Standard_Integer ComputeIntersection(IntPolyh_PMaillageAffinage& theMaillage);
|
||||||
|
|
||||||
|
static Standard_Boolean AnalyzeIntersection(IntPolyh_PMaillageAffinage& theMaillage);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IntPolyh_Intersection
|
//function : IntPolyh_Intersection
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -45,7 +49,6 @@ IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_Surface)& th
|
|||||||
myNbSU2 = 10;
|
myNbSU2 = 10;
|
||||||
myNbSV2 = 10;
|
myNbSV2 = 10;
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
myIsParallel = Standard_False;
|
|
||||||
mySectionLines.Init(1000);
|
mySectionLines.Init(1000);
|
||||||
myTangentZones.Init(10000);
|
myTangentZones.Init(10000);
|
||||||
Perform();
|
Perform();
|
||||||
@@ -69,7 +72,6 @@ IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_Surface)& th
|
|||||||
myNbSU2 = theNbSU2;
|
myNbSU2 = theNbSU2;
|
||||||
myNbSV2 = theNbSV2;
|
myNbSV2 = theNbSV2;
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
myIsParallel = Standard_False;
|
|
||||||
mySectionLines.Init(1000);
|
mySectionLines.Init(1000);
|
||||||
myTangentZones.Init(10000);
|
myTangentZones.Init(10000);
|
||||||
Perform();
|
Perform();
|
||||||
@@ -93,7 +95,6 @@ IntPolyh_Intersection::IntPolyh_Intersection(const Handle(Adaptor3d_Surface)& th
|
|||||||
myNbSU2 = theUPars2.Length();
|
myNbSU2 = theUPars2.Length();
|
||||||
myNbSV2 = theVPars2.Length();
|
myNbSV2 = theVPars2.Length();
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
myIsParallel = Standard_False;
|
|
||||||
mySectionLines.Init(1000);
|
mySectionLines.Init(1000);
|
||||||
myTangentZones.Init(10000);
|
myTangentZones.Init(10000);
|
||||||
Perform(theUPars1, theVPars1, theUPars2, theVPars2);
|
Perform(theUPars1, theVPars1, theUPars2, theVPars2);
|
||||||
@@ -441,7 +442,7 @@ void IntPolyh_Intersection::MergeCouples(IntPolyh_ListOfCouples &anArrayFF,
|
|||||||
// too small (less than 5 deg), the advanced intersection is required.
|
// too small (less than 5 deg), the advanced intersection is required.
|
||||||
// Otherwise, the standard intersection is considered satisfactory.
|
// Otherwise, the standard intersection is considered satisfactory.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean IntPolyh_Intersection::IsAdvRequired(IntPolyh_PMaillageAffinage& theMaillage)
|
Standard_Boolean IsAdvRequired(IntPolyh_PMaillageAffinage& theMaillage)
|
||||||
{
|
{
|
||||||
if (!theMaillage)
|
if (!theMaillage)
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
@@ -451,7 +452,7 @@ Standard_Boolean IntPolyh_Intersection::IsAdvRequired(IntPolyh_PMaillageAffinage
|
|||||||
// Number of interfering pairs
|
// Number of interfering pairs
|
||||||
Standard_Integer aNbCouples = Couples.Extent();
|
Standard_Integer aNbCouples = Couples.Extent();
|
||||||
// Flag to define whether advanced intersection is required or not
|
// Flag to define whether advanced intersection is required or not
|
||||||
Standard_Boolean isAdvReq = (aNbCouples == 0) && !IsParallel();
|
Standard_Boolean isAdvReq = (aNbCouples == 0);
|
||||||
if (isAdvReq)
|
if (isAdvReq)
|
||||||
// No interfering triangles are found -> perform advanced intersection
|
// No interfering triangles are found -> perform advanced intersection
|
||||||
return isAdvReq;
|
return isAdvReq;
|
||||||
@@ -506,7 +507,7 @@ Standard_Integer ComputeIntersection(IntPolyh_PMaillageAffinage& theMaillage)
|
|||||||
//function : AnalyzeIntersection
|
//function : AnalyzeIntersection
|
||||||
//purpose : Analyzes the intersection on the number of interfering triangles
|
//purpose : Analyzes the intersection on the number of interfering triangles
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean IntPolyh_Intersection::AnalyzeIntersection(IntPolyh_PMaillageAffinage& theMaillage)
|
Standard_Boolean AnalyzeIntersection(IntPolyh_PMaillageAffinage& theMaillage)
|
||||||
{
|
{
|
||||||
if (!theMaillage)
|
if (!theMaillage)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -527,9 +528,7 @@ Standard_Boolean IntPolyh_Intersection::AnalyzeIntersection(IntPolyh_PMaillageAf
|
|||||||
if (npara >= theMaillage->GetArrayOfTriangles(1).NbItems() ||
|
if (npara >= theMaillage->GetArrayOfTriangles(1).NbItems() ||
|
||||||
npara >= theMaillage->GetArrayOfTriangles(2).NbItems())
|
npara >= theMaillage->GetArrayOfTriangles(2).NbItems())
|
||||||
{
|
{
|
||||||
Couples.Clear();
|
return Standard_False;
|
||||||
myIsParallel = Standard_True;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
|
@@ -83,12 +83,6 @@ public: //! @name Getting the results
|
|||||||
return myIsDone;
|
return myIsDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns state of the operation
|
|
||||||
Standard_Boolean IsParallel() const
|
|
||||||
{
|
|
||||||
return myIsParallel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns the number of section lines
|
//! Returns the number of section lines
|
||||||
Standard_Integer NbSectionLines() const
|
Standard_Integer NbSectionLines() const
|
||||||
{
|
{
|
||||||
@@ -192,9 +186,6 @@ private: //! @name Performing the intersection
|
|||||||
IntPolyh_ListOfCouples& theArrayRF,
|
IntPolyh_ListOfCouples& theArrayRF,
|
||||||
IntPolyh_ListOfCouples& theArrayRR) const;
|
IntPolyh_ListOfCouples& theArrayRR) const;
|
||||||
|
|
||||||
Standard_Boolean AnalyzeIntersection(IntPolyh_PMaillageAffinage& theMaillage);
|
|
||||||
Standard_Boolean IsAdvRequired(IntPolyh_PMaillageAffinage& theMaillage);
|
|
||||||
|
|
||||||
|
|
||||||
private: //! @name Fields
|
private: //! @name Fields
|
||||||
|
|
||||||
@@ -209,7 +200,6 @@ private: //! @name Fields
|
|||||||
Standard_Boolean myIsDone; //!< State of the operation
|
Standard_Boolean myIsDone; //!< State of the operation
|
||||||
IntPolyh_ArrayOfSectionLines mySectionLines; //!< Section lines
|
IntPolyh_ArrayOfSectionLines mySectionLines; //!< Section lines
|
||||||
IntPolyh_ArrayOfTangentZones myTangentZones; //!< Tangent zones
|
IntPolyh_ArrayOfTangentZones myTangentZones; //!< Tangent zones
|
||||||
Standard_Boolean myIsParallel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _IntPolyh_Intersection_HeaderFile
|
#endif // _IntPolyh_Intersection_HeaderFile
|
||||||
|
@@ -504,11 +504,7 @@ void IntTools_FaceFace::Perform (const TopoDS_Face& aF1,
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
const Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
||||||
Standard_Real Deflection = 0.1;
|
const Standard_Real Deflection = 0.1;
|
||||||
if (aType1 == GeomAbs_BSplineSurface && aType2 == GeomAbs_BSplineSurface)
|
|
||||||
{
|
|
||||||
Deflection /= 10.;
|
|
||||||
}
|
|
||||||
myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection);
|
myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -448,5 +448,5 @@ void IntTools_TopolTool::SamplePnts(const Standard_Real theDefl,
|
|||||||
myV0 = myVPars->Value(1);
|
myV0 = myVPars->Value(1);
|
||||||
|
|
||||||
myDU = (myUPars->Value(myNbSmplU) - myU0)/(myNbSmplU-1);
|
myDU = (myUPars->Value(myNbSmplU) - myU0)/(myNbSmplU-1);
|
||||||
myDV = (myVPars->Value(myNbSmplV) - myV0)/(myNbSmplV-1);
|
myDV = (myVPars->Value(myNbSmplV) - myU0)/(myNbSmplV-1);
|
||||||
}
|
}
|
||||||
|
@@ -56,8 +56,6 @@ Image_Format Media_Frame::FormatFFmpeg2Occt (int theFormat)
|
|||||||
return Image_Format_BGR;
|
return Image_Format_BGR;
|
||||||
case AV_PIX_FMT_GRAY8:
|
case AV_PIX_FMT_GRAY8:
|
||||||
return Image_Format_Gray;
|
return Image_Format_Gray;
|
||||||
case AV_PIX_FMT_GRAY16:
|
|
||||||
return Image_Format_Gray16;
|
|
||||||
default:
|
default:
|
||||||
return Image_Format_UNKNOWN;
|
return Image_Format_UNKNOWN;
|
||||||
}
|
}
|
||||||
@@ -92,8 +90,6 @@ int Media_Frame::FormatOcct2FFmpeg (Image_Format theFormat)
|
|||||||
return AV_PIX_FMT_GRAY8;
|
return AV_PIX_FMT_GRAY8;
|
||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
return AV_PIX_FMT_GRAY8;
|
return AV_PIX_FMT_GRAY8;
|
||||||
case Image_Format_Gray16:
|
|
||||||
return AV_PIX_FMT_GRAY16;
|
|
||||||
case Image_Format_GrayF:
|
case Image_Format_GrayF:
|
||||||
case Image_Format_AlphaF:
|
case Image_Format_AlphaF:
|
||||||
case Image_Format_RGF:
|
case Image_Format_RGF:
|
||||||
@@ -101,7 +97,6 @@ int Media_Frame::FormatOcct2FFmpeg (Image_Format theFormat)
|
|||||||
case Image_Format_RGBF:
|
case Image_Format_RGBF:
|
||||||
case Image_Format_BGRAF:
|
case Image_Format_BGRAF:
|
||||||
case Image_Format_BGRF:
|
case Image_Format_BGRF:
|
||||||
case Image_Format_GrayF_half:
|
|
||||||
case Image_Format_RGF_half:
|
case Image_Format_RGF_half:
|
||||||
case Image_Format_RGBAF_half:
|
case Image_Format_RGBAF_half:
|
||||||
case Image_Format_UNKNOWN:
|
case Image_Format_UNKNOWN:
|
||||||
|
@@ -70,10 +70,9 @@ class MeshVS_ImageTexture2D : public Graphic3d_Texture2D
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MeshVS_ImageTexture2D (const Handle(Image_PixMap)& theImg)
|
MeshVS_ImageTexture2D (const Handle(Image_PixMap)& theImg) : Graphic3d_Texture2D (theImg, Graphic3d_TOT_2D)
|
||||||
: Graphic3d_Texture2D (theImg, Graphic3d_TypeOfTexture_2D)
|
|
||||||
{
|
{
|
||||||
myParams->SetModulate (true);
|
myParams->SetModulate (Standard_True);
|
||||||
myParams->SetFilter (Graphic3d_TOTF_BILINEAR);
|
myParams->SetFilter (Graphic3d_TOTF_BILINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +81,9 @@ public:
|
|||||||
DEFINE_STANDARD_RTTI_INLINE(MeshVS_ImageTexture2D,Graphic3d_Texture2D)
|
DEFINE_STANDARD_RTTI_INLINE(MeshVS_ImageTexture2D,Graphic3d_Texture2D)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE (MeshVS_ImageTexture2D, Graphic3d_Texture2D)
|
||||||
|
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : getNearestPow2
|
// Function : getNearestPow2
|
||||||
// Purpose : Returns the nearest power of two greater than the
|
// 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)
|
if (!hadAlreadyRGBA)
|
||||||
{
|
{
|
||||||
aSprite->Init (theCtx, *anImage, Graphic3d_TypeOfTexture_2D, true);
|
aSprite->Init (theCtx, *anImage, Graphic3d_TOT_2D, true);
|
||||||
}
|
}
|
||||||
if (!hadAlreadyAlpha)
|
if (!hadAlreadyAlpha)
|
||||||
{
|
{
|
||||||
if (Handle(Image_PixMap) anImageA = aSprite->GetFormat() != GL_ALPHA ? aNewMarkerImage->GetImageAlpha() : Handle(Image_PixMap)())
|
if (Handle(Image_PixMap) anImageA = aSprite->GetFormat() != GL_ALPHA ? aNewMarkerImage->GetImageAlpha() : Handle(Image_PixMap)())
|
||||||
{
|
{
|
||||||
aSpriteA->Init (theCtx, *anImageA, Graphic3d_TypeOfTexture_2D, true);
|
aSpriteA->Init (theCtx, *anImageA, Graphic3d_TOT_2D, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -176,7 +176,6 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
|||||||
extDrawBuffers (Standard_False),
|
extDrawBuffers (Standard_False),
|
||||||
extGS (NULL),
|
extGS (NULL),
|
||||||
extBgra(Standard_False),
|
extBgra(Standard_False),
|
||||||
extTexR16(Standard_False),
|
|
||||||
extAnis(Standard_False),
|
extAnis(Standard_False),
|
||||||
extPDS (Standard_False),
|
extPDS (Standard_False),
|
||||||
atiMem (Standard_False),
|
atiMem (Standard_False),
|
||||||
@@ -1553,10 +1552,6 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
mySupportedFormats->Add (Image_Format_BGR32);
|
mySupportedFormats->Add (Image_Format_BGR32);
|
||||||
mySupportedFormats->Add (Image_Format_BGRA);
|
mySupportedFormats->Add (Image_Format_BGRA);
|
||||||
}
|
}
|
||||||
if (extTexR16)
|
|
||||||
{
|
|
||||||
mySupportedFormats->Add (Image_Format_Gray16);
|
|
||||||
}
|
|
||||||
if (arbTexFloat)
|
if (arbTexFloat)
|
||||||
{
|
{
|
||||||
mySupportedFormats->Add (Image_Format_GrayF);
|
mySupportedFormats->Add (Image_Format_GrayF);
|
||||||
@@ -1572,7 +1567,6 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
mySupportedFormats->Add (Image_Format_RGF);
|
mySupportedFormats->Add (Image_Format_RGF);
|
||||||
if (hasHalfFloatBuffer != OpenGl_FeatureNotAvailable)
|
if (hasHalfFloatBuffer != OpenGl_FeatureNotAvailable)
|
||||||
{
|
{
|
||||||
mySupportedFormats->Add (Image_Format_GrayF_half);
|
|
||||||
mySupportedFormats->Add (Image_Format_RGF_half);
|
mySupportedFormats->Add (Image_Format_RGF_half);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2136,13 +2130,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
|
|||||||
myTextureRgbaWhite = new OpenGl_Texture();
|
myTextureRgbaWhite = new OpenGl_Texture();
|
||||||
Image_PixMap anImage;
|
Image_PixMap anImage;
|
||||||
anImage.InitZero (Image_Format_RGBA, 2, 2, 0, (Standard_Byte )0);
|
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_TypeOfTexture_2D, &anImage))
|
if (!myTextureRgbaBlack->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TOT_2D, &anImage))
|
||||||
{
|
{
|
||||||
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
"Error: unable to create unit mock PBR texture map.");
|
"Error: unable to create unit mock PBR texture map.");
|
||||||
}
|
}
|
||||||
anImage.InitZero (Image_Format_RGBA, 2, 2, 0, (Standard_Byte )255);
|
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_TypeOfTexture_2D, &anImage))
|
if (!myTextureRgbaWhite->Init (this, OpenGl_TextureFormat::Create<GLubyte, 4>(), Graphic3d_Vec2i (2, 2), Graphic3d_TOT_2D, &anImage))
|
||||||
{
|
{
|
||||||
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
"Error: unable to create normal mock PBR texture map.");
|
"Error: unable to create normal mock PBR texture map.");
|
||||||
|
@@ -1069,7 +1069,6 @@ public: //! @name extensions
|
|||||||
Standard_Boolean extDrawBuffers; //!< GL_EXT_draw_buffers
|
Standard_Boolean extDrawBuffers; //!< GL_EXT_draw_buffers
|
||||||
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
||||||
Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
|
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 extAnis; //!< GL_EXT_texture_filter_anisotropic
|
||||||
Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
|
Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
|
||||||
Standard_Boolean atiMem; //!< GL_ATI_meminfo
|
Standard_Boolean atiMem; //!< GL_ATI_meminfo
|
||||||
|
@@ -147,7 +147,7 @@ bool OpenGl_Font::createTexture (const Handle(OpenGl_Context)& theCtx)
|
|||||||
|
|
||||||
Image_PixMap aBlackImg;
|
Image_PixMap aBlackImg;
|
||||||
if (!aBlackImg.InitZero (Image_Format_Alpha, Standard_Size(aTextureSizeX), Standard_Size(aTextureSizeY))
|
if (!aBlackImg.InitZero (Image_Format_Alpha, Standard_Size(aTextureSizeX), Standard_Size(aTextureSizeY))
|
||||||
|| !aTexture->Init (theCtx, aBlackImg, Graphic3d_TypeOfTexture_2D, true)) // myTextureFormat
|
|| !aTexture->Init (theCtx, aBlackImg, Graphic3d_TOT_2D, true)) // myTextureFormat
|
||||||
{
|
{
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
TCollection_AsciiString ("New texture initialization of size ")
|
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 GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||||
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
||||||
if (!aFormat.IsValid()
|
if (!aFormat.IsValid()
|
||||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
Release (theGlContext.get());
|
Release (theGlContext.get());
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -415,7 +415,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
|||||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||||
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
const OpenGl_TextureFormat aFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, aColorFormat);
|
||||||
if (!aFormat.IsValid()
|
if (!aFormat.IsValid()
|
||||||
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
|| !aColorTexture->Init (theGlContext, aFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
Release (theGlContext.operator->());
|
Release (theGlContext.operator->());
|
||||||
return Standard_False;
|
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
|
// instead of just trying to create such texture
|
||||||
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, myDepthFormat);
|
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theGlContext, myDepthFormat);
|
||||||
if (aDepthFormat.IsValid()
|
if (aDepthFormat.IsValid()
|
||||||
&& !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
|
&& !myDepthStencilTexture->Init (theGlContext, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
"Warning! Depth textures are not supported by hardware!");
|
"Warning! Depth textures are not supported by hardware!");
|
||||||
@@ -983,17 +983,6 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
|
|||||||
aType = GL_UNSIGNED_BYTE;
|
aType = GL_UNSIGNED_BYTE;
|
||||||
break;
|
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:
|
case Image_Format_GrayF:
|
||||||
{
|
{
|
||||||
if (theGlCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
if (theGlCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||||
@@ -1101,7 +1090,6 @@ Standard_Boolean OpenGl_FrameBuffer::BufferDump (const Handle(OpenGl_Context)& t
|
|||||||
case Image_Format_Alpha:
|
case Image_Format_Alpha:
|
||||||
case Image_Format_AlphaF:
|
case Image_Format_AlphaF:
|
||||||
return Standard_False; // GL_ALPHA is no more supported in core context
|
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_RGF_half:
|
||||||
case Image_Format_UNKNOWN:
|
case Image_Format_UNKNOWN:
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@@ -1733,7 +1733,6 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
|
|||||||
theCtx.arbTexRG = isGlGreaterEqualShort (3, 0)
|
theCtx.arbTexRG = isGlGreaterEqualShort (3, 0)
|
||||||
|| checkExtensionShort ("GL_EXT_texture_rg");
|
|| checkExtensionShort ("GL_EXT_texture_rg");
|
||||||
theCtx.extBgra = checkExtensionShort ("GL_EXT_texture_format_BGRA8888");
|
theCtx.extBgra = checkExtensionShort ("GL_EXT_texture_format_BGRA8888");
|
||||||
theCtx.extTexR16 = checkExtensionShort ("GL_EXT_texture_norm16");
|
|
||||||
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
||||||
theCtx.extPDS = isGlGreaterEqualShort (3, 0)
|
theCtx.extPDS = isGlGreaterEqualShort (3, 0)
|
||||||
|| checkExtensionShort ("GL_OES_packed_depth_stencil");
|
|| checkExtensionShort ("GL_OES_packed_depth_stencil");
|
||||||
@@ -2161,7 +2160,6 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
|
|||||||
|| checkExtensionShort ("NV_depth_clamp");
|
|| checkExtensionShort ("NV_depth_clamp");
|
||||||
theCtx.extBgra = isGlGreaterEqualShort (1, 2)
|
theCtx.extBgra = isGlGreaterEqualShort (1, 2)
|
||||||
|| checkExtensionShort ("GL_EXT_bgra");
|
|| checkExtensionShort ("GL_EXT_bgra");
|
||||||
theCtx.extTexR16 = true;
|
|
||||||
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
theCtx.extAnis = checkExtensionShort ("GL_EXT_texture_filter_anisotropic");
|
||||||
theCtx.extPDS = checkExtensionShort ("GL_EXT_packed_depth_stencil");
|
theCtx.extPDS = checkExtensionShort ("GL_EXT_packed_depth_stencil");
|
||||||
theCtx.atiMem = checkExtensionShort ("GL_ATI_meminfo");
|
theCtx.atiMem = checkExtensionShort ("GL_ATI_meminfo");
|
||||||
|
@@ -333,9 +333,6 @@ typedef double GLclampd;
|
|||||||
#define GL_RGB8 0x8051
|
#define GL_RGB8 0x8051
|
||||||
#define GL_RGBA8 0x8058
|
#define GL_RGBA8 0x8058
|
||||||
|
|
||||||
// only in desktop OpenGL
|
|
||||||
#define GL_LUMINANCE16 0x8042
|
|
||||||
|
|
||||||
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
|
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
|
||||||
#define GL_LUMINANCE8 0x8040
|
#define GL_LUMINANCE8 0x8040
|
||||||
// GL_EXT_texture_format_BGRA8888
|
// 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
|
// 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,
|
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseSH].Init (theCtx,
|
||||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
||||||
Graphic3d_Vec2i (9, 1), Graphic3d_TypeOfTexture_2D))
|
Graphic3d_Vec2i (9, 1), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture creation failed";
|
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture creation failed";
|
||||||
return false;
|
return false;
|
||||||
@@ -305,7 +305,7 @@ bool OpenGl_PBREnvironment::initTextures (const Handle(OpenGl_Context)& theCtx)
|
|||||||
|
|
||||||
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseFallback].Init (theCtx,
|
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseFallback].Init (theCtx,
|
||||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBA, false),
|
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBA, false),
|
||||||
Graphic3d_Vec2i (10, 4), Graphic3d_TypeOfTexture_2D))
|
Graphic3d_Vec2i (10, 4), Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseFallback texture creation failed";
|
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseFallback texture creation failed";
|
||||||
return false;
|
return false;
|
||||||
@@ -432,7 +432,7 @@ bool OpenGl_PBREnvironment::processDiffIBLMap (const Handle(OpenGl_Context)& the
|
|||||||
{
|
{
|
||||||
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseSH].Init (theCtx,
|
if (!myIBLMaps[OpenGl_TypeOfIBLMap_DiffuseSH].Init (theCtx,
|
||||||
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
OpenGl_TextureFormat::FindFormat (theCtx, Image_Format_RGBAF, false),
|
||||||
Graphic3d_Vec2i (9, 1), Graphic3d_TypeOfTexture_2D, &anImageF))
|
Graphic3d_Vec2i (9, 1), Graphic3d_TOT_2D, &anImageF))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture update failed";
|
Message::SendFail() << "OpenGl_PBREnvironment, DiffuseSH texture update failed";
|
||||||
return false;
|
return false;
|
||||||
|
@@ -378,11 +378,7 @@ void OpenGl_Sampler::applyGlobalTextureParams (const Handle(OpenGl_Context)& the
|
|||||||
theCtx->core11fwd->glEnable (GL_TEXTURE_2D);
|
theCtx->core11fwd->glEnable (GL_TEXTURE_2D);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_TEXTURE_3D:
|
default: break;
|
||||||
default:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,10 +428,6 @@ void OpenGl_Sampler::resetGlobalTextureParams (const Handle(OpenGl_Context)& the
|
|||||||
theCtx->core11fwd->glDisable (GL_TEXTURE_2D);
|
theCtx->core11fwd->glDisable (GL_TEXTURE_2D);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_TEXTURE_3D:
|
default: break;
|
||||||
default:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -69,6 +69,12 @@ 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).
|
//! Compute size of the smallest defined mipmap level (for verbose messages).
|
||||||
static Graphic3d_Vec2i computeSmallestMipMapSize (const Graphic3d_Vec2i& theBaseSize, Standard_Integer theMaxLevel)
|
static Graphic3d_Vec2i computeSmallestMipMapSize (const Graphic3d_Vec2i& theBaseSize, Standard_Integer theMaxLevel)
|
||||||
{
|
{
|
||||||
@@ -99,6 +105,9 @@ OpenGl_Texture::OpenGl_Texture (const TCollection_AsciiString& theResourceId,
|
|||||||
myRevision (0),
|
myRevision (0),
|
||||||
myTextureId (NO_TEXTURE),
|
myTextureId (NO_TEXTURE),
|
||||||
myTarget (GL_TEXTURE_2D),
|
myTarget (GL_TEXTURE_2D),
|
||||||
|
mySizeX (0),
|
||||||
|
mySizeY (0),
|
||||||
|
mySizeZ (0),
|
||||||
myTextFormat (GL_RGBA),
|
myTextFormat (GL_RGBA),
|
||||||
mySizedFormat(GL_RGBA8),
|
mySizedFormat(GL_RGBA8),
|
||||||
myNbSamples (1),
|
myNbSamples (1),
|
||||||
@@ -160,7 +169,7 @@ void OpenGl_Texture::Release (OpenGl_Context* theGlCtx)
|
|||||||
theGlCtx->core11fwd->glDeleteTextures (1, &myTextureId);
|
theGlCtx->core11fwd->glDeleteTextures (1, &myTextureId);
|
||||||
}
|
}
|
||||||
myTextureId = NO_TEXTURE;
|
myTextureId = NO_TEXTURE;
|
||||||
mySize.SetValues (0, 0, 0);
|
mySizeX = mySizeY = mySizeZ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -222,13 +231,12 @@ bool OpenGl_Texture::InitSamplerObject (const Handle(OpenGl_Context)& theCtx)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_TextureFormat& theFormat,
|
const OpenGl_TextureFormat& theFormat,
|
||||||
const Graphic3d_Vec3i& theSizeXYZ,
|
const Graphic3d_Vec2i& theSizeXY,
|
||||||
const Graphic3d_TypeOfTexture theType,
|
const Graphic3d_TypeOfTexture theType,
|
||||||
const Image_PixMap* theImage)
|
const Image_PixMap* theImage)
|
||||||
{
|
{
|
||||||
if (theSizeXYZ.x() < 1
|
if (theSizeXY.x() < 1
|
||||||
|| theSizeXYZ.y() < 1
|
|| theSizeXY.y() < 1)
|
||||||
|| theSizeXYZ.z() < 1)
|
|
||||||
{
|
{
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
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 +"]");
|
TCollection_AsciiString ("Error: texture of 0 size cannot be created [") + myResourceId +"]");
|
||||||
@@ -236,39 +244,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum aTarget = GL_TEXTURE_2D;
|
const GLenum aTarget = (theType == Graphic3d_TOT_1D
|
||||||
switch (theType)
|
&& theCtx->GraphicsLibrary() != Aspect_GraphicsLibrary_OpenGLES)
|
||||||
{
|
? GL_TEXTURE_1D
|
||||||
case Graphic3d_TypeOfTexture_1D:
|
: GL_TEXTURE_2D;
|
||||||
{
|
|
||||||
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()
|
const bool toPatchExisting = IsValid()
|
||||||
&& myTextFormat == theFormat.PixelFormat()
|
&& myTextFormat == theFormat.PixelFormat()
|
||||||
&& myTarget == aTarget
|
&& myTarget == aTarget
|
||||||
&& mySize.x() == theSizeXYZ.x()
|
&& HasMipmaps() == (theType == Graphic3d_TOT_2D_MIPMAP)
|
||||||
&& (mySize.y() == theSizeXYZ.y() || theType == Graphic3d_TypeOfTexture_1D)
|
&& mySizeX == theSizeXY.x()
|
||||||
&& mySize.z() == theSizeXYZ.z();
|
&& (mySizeY == theSizeXY.y() || theType == Graphic3d_TOT_1D);
|
||||||
if (!Create (theCtx))
|
if (!Create (theCtx))
|
||||||
{
|
{
|
||||||
Release (theCtx.get());
|
Release (theCtx.get());
|
||||||
@@ -286,7 +271,9 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myIsAlpha = theFormat.PixelFormat() == GL_ALPHA;
|
myIsAlpha = theFormat.PixelFormat() == GL_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
myMaxMipLevel = 0;
|
myMaxMipLevel = theType == Graphic3d_TOT_2D_MIPMAP && theCtx->arbFBO != NULL
|
||||||
|
? computeUpperMipMapLevel (theSizeXY.x(), theSizeXY.y())
|
||||||
|
: 0;
|
||||||
myTextFormat = theFormat.PixelFormat();
|
myTextFormat = theFormat.PixelFormat();
|
||||||
mySizedFormat = theFormat.InternalFormat();
|
mySizedFormat = theFormat.InternalFormat();
|
||||||
myNbSamples = 1;
|
myNbSamples = 1;
|
||||||
@@ -306,12 +293,12 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Standard_Integer aMaxSize = theCtx->MaxTextureSize();
|
const GLsizei aMaxSize = theCtx->MaxTextureSize();
|
||||||
if (theSizeXYZ.maxComp() > aMaxSize)
|
if (theSizeXY.x() > aMaxSize
|
||||||
|
|| theSizeXY.y() > aMaxSize)
|
||||||
{
|
{
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
TCollection_AsciiString ("Error: Texture dimension - ") + theSizeXYZ.x() + "x" + theSizeXYZ.y()
|
TCollection_AsciiString ("Error: Texture dimension - ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||||
+ (theSizeXYZ.z() > 1 ? TCollection_AsciiString ("x") + theSizeXYZ.z() : TCollection_AsciiString())
|
|
||||||
+ " exceeds hardware limits (" + aMaxSize + "x" + aMaxSize + ")"
|
+ " exceeds hardware limits (" + aMaxSize + "x" + aMaxSize + ")"
|
||||||
+ " [" + myResourceId +"]");
|
+ " [" + myResourceId +"]");
|
||||||
Release (theCtx.get());
|
Release (theCtx.get());
|
||||||
@@ -325,18 +312,34 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
// however some hardware (NV30 - GeForce FX, RadeOn 9xxx and Xxxx) supports GLSL but not NPOT!
|
// 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
|
// Trying to create NPOT textures on such hardware will not fail
|
||||||
// but driver will fall back into software rendering,
|
// but driver will fall back into software rendering,
|
||||||
const Graphic3d_Vec2i aSizeP2 (OpenGl_Context::GetPowerOfTwo (theSizeXYZ.x(), aMaxSize),
|
const GLsizei aWidthP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.x(), aMaxSize);
|
||||||
OpenGl_Context::GetPowerOfTwo (theSizeXYZ.y(), aMaxSize));
|
const GLsizei aHeightP2 = OpenGl_Context::GetPowerOfTwo (theSizeXY.y(), aMaxSize);
|
||||||
if (theSizeXYZ.x() != aSizeP2.x()
|
if (theSizeXY.x() != aWidthP2
|
||||||
|| (theType != Graphic3d_TypeOfTexture_1D && theSizeXYZ.y() != aSizeP2.y()))
|
|| (theType != Graphic3d_TOT_1D && theSizeXY.y() != aHeightP2))
|
||||||
{
|
{
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
TCollection_AsciiString ("Error: NPOT Textures (") + theSizeXYZ.x() + "x" + theSizeXYZ.y() + ")"
|
TCollection_AsciiString ("Error: NPOT Textures (") + theSizeXY.x() + "x" + theSizeXY.y() + ")"
|
||||||
" are not supported by hardware [" + myResourceId +"]");
|
" are not supported by hardware [" + myResourceId +"]");
|
||||||
Release (theCtx.get());
|
Release (theCtx.get());
|
||||||
return false;
|
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;
|
GLint aTestWidth = 0, aTestHeight = 0;
|
||||||
GLvoid* aDataPtr = (theImage != NULL) ? (GLvoid* )theImage->Data() : NULL;
|
GLvoid* aDataPtr = (theImage != NULL) ? (GLvoid* )theImage->Data() : NULL;
|
||||||
@@ -367,7 +370,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myTarget = aTarget;
|
myTarget = aTarget;
|
||||||
switch (theType)
|
switch (theType)
|
||||||
{
|
{
|
||||||
case Graphic3d_TypeOfTexture_1D:
|
case Graphic3d_TOT_1D:
|
||||||
{
|
{
|
||||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES)
|
||||||
{
|
{
|
||||||
@@ -382,13 +385,14 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
if (toPatchExisting)
|
if (toPatchExisting)
|
||||||
{
|
{
|
||||||
theCtx->core11fwd->glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
|
theCtx->core11fwd->glTexSubImage1D (GL_TEXTURE_1D, 0, 0,
|
||||||
theSizeXYZ.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
theSizeXY.x(), theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||||
break;
|
Unbind (theCtx);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use proxy to check texture could be created or not
|
// use proxy to check texture could be created or not
|
||||||
theCtx->core11fwd->glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
|
theCtx->core11fwd->glTexImage1D (GL_PROXY_TEXTURE_1D, 0, anIntFormat,
|
||||||
theSizeXYZ.x(), 0,
|
theSizeXY.x(), 0,
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), NULL);
|
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_WIDTH, &aTestWidth);
|
||||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
|
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_INTERNAL_FORMAT, &mySizedFormat);
|
||||||
@@ -401,7 +405,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
theCtx->core11fwd->glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
|
theCtx->core11fwd->glTexImage1D (GL_TEXTURE_1D, 0, anIntFormat,
|
||||||
theSizeXYZ.x(), 0,
|
theSizeXY.x(), 0,
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||||
if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
|
if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
@@ -410,10 +414,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySize.SetValues (theSizeXYZ.x(), 1, 1);
|
mySizeX = theSizeXY.x();
|
||||||
break;
|
mySizeY = 1;
|
||||||
|
|
||||||
|
Unbind (theCtx);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case Graphic3d_TypeOfTexture_2D:
|
case Graphic3d_TOT_2D:
|
||||||
case Graphic3d_TOT_2D_MIPMAP:
|
case Graphic3d_TOT_2D_MIPMAP:
|
||||||
{
|
{
|
||||||
Bind (theCtx);
|
Bind (theCtx);
|
||||||
@@ -422,16 +429,28 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
theCtx->core11fwd->glTexSubImage2D (GL_TEXTURE_2D, 0,
|
theCtx->core11fwd->glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||||
0, 0,
|
0, 0,
|
||||||
theSizeXYZ.x(), theSizeXYZ.y(),
|
theSizeXY.x(), theSizeXY.y(),
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||||
break;
|
|
||||||
|
if (myMaxMipLevel > 0)
|
||||||
|
{
|
||||||
|
// generate mipmaps
|
||||||
|
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||||
|
if (theCtx->core11fwd->glGetError() != GL_NO_ERROR)
|
||||||
|
{
|
||||||
|
myMaxMipLevel = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Unbind (theCtx);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL)
|
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL)
|
||||||
{
|
{
|
||||||
// use proxy to check texture could be created or not
|
// use proxy to check texture could be created or not
|
||||||
theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
|
theCtx->core11fwd->glTexImage2D (GL_PROXY_TEXTURE_2D, 0, anIntFormat,
|
||||||
theSizeXYZ.x(), theSizeXYZ.y(), 0,
|
theSizeXY.x(), theSizeXY.y(), 0,
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), NULL);
|
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_WIDTH, &aTestWidth);
|
||||||
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
|
theCtx->core11fwd->glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &aTestHeight);
|
||||||
@@ -446,13 +465,13 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
|
theCtx->core11fwd->glTexImage2D (GL_TEXTURE_2D, 0, anIntFormat,
|
||||||
theSizeXYZ.x(), theSizeXYZ.y(), 0,
|
theSizeXY.x(), theSizeXY.y(), 0,
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
theFormat.PixelFormat(), theFormat.DataType(), aDataPtr);
|
||||||
GLenum anErr = theCtx->core11fwd->glGetError();
|
GLenum anErr = theCtx->core11fwd->glGetError();
|
||||||
if (anErr != GL_NO_ERROR)
|
if (anErr != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||||
TCollection_AsciiString ("Error: 2D texture ") + theSizeXYZ.x() + "x" + theSizeXYZ.y()
|
TCollection_AsciiString ("Error: 2D texture ") + theSizeXY.x() + "x" + theSizeXY.y()
|
||||||
+ " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
|
+ " IF: " + OpenGl_TextureFormat::FormatFormat (anIntFormat)
|
||||||
+ " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
|
+ " PF: " + OpenGl_TextureFormat::FormatFormat (theFormat.PixelFormat())
|
||||||
+ " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
|
+ " DT: " + OpenGl_TextureFormat::FormatDataType (theFormat.DataType())
|
||||||
@@ -463,63 +482,38 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySize.SetValues (theSizeXYZ.xy(), 1);
|
mySizeX = theSizeXY.x();
|
||||||
break;
|
mySizeY = theSizeXY.y();
|
||||||
}
|
|
||||||
case Graphic3d_TypeOfTexture_3D:
|
|
||||||
{
|
|
||||||
if (theCtx->Functions()->glTexImage3D == nullptr)
|
|
||||||
{
|
|
||||||
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);
|
if (myMaxMipLevel > 0)
|
||||||
applyDefaultSamplerParams (theCtx);
|
|
||||||
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGL)
|
|
||||||
{
|
{
|
||||||
theCtx->Functions()->glTexImage3D (GL_PROXY_TEXTURE_3D, 0, anIntFormat,
|
// generate mipmaps
|
||||||
theSizeXYZ.x(), theSizeXYZ.y(), theSizeXYZ.z(), 0,
|
//glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||||
theFormat.PixelFormat(), theFormat.DataType(), nullptr);
|
theCtx->arbFBO->glGenerateMipmap (GL_TEXTURE_2D);
|
||||||
|
anErr = theCtx->core11fwd->glGetError();
|
||||||
NCollection_Vec3<GLint> aTestSizeXYZ;
|
if (anErr != GL_NO_ERROR)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
Unbind (theCtx);
|
myMaxMipLevel = 0;
|
||||||
Release (theCtx.get());
|
if (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||||
return false;
|
&& (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 +"]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
theCtx->Functions()->glTexImage3D (GL_TEXTURE_3D, 0, anIntFormat,
|
Unbind (theCtx);
|
||||||
theSizeXYZ.x(), theSizeXYZ.y(), theSizeXYZ.z(), 0,
|
return true;
|
||||||
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_TypeOfTexture_CUBEMAP:
|
case Graphic3d_TOT_CUBEMAP:
|
||||||
{
|
{
|
||||||
Unbind (theCtx);
|
Unbind (theCtx);
|
||||||
Release (theCtx.get());
|
Release (theCtx.get());
|
||||||
@@ -527,82 +521,8 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unbind (theCtx);
|
Release (theCtx.get());
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -630,15 +550,16 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Init (theCtx, aFormat, Graphic3d_Vec3i (theImage.SizeXYZ()), theType, &theImage);
|
return Init (theCtx, aFormat, Graphic3d_Vec2i ((Standard_Integer)theImage.SizeX(), (Standard_Integer)theImage.SizeY()),
|
||||||
|
theType, &theImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Init
|
// function : Init
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
||||||
const Handle(Graphic3d_TextureRoot)& theTextureMap)
|
const Handle(Graphic3d_TextureMap)& theTextureMap)
|
||||||
{
|
{
|
||||||
if (theTextureMap.IsNull())
|
if (theTextureMap.IsNull())
|
||||||
{
|
{
|
||||||
@@ -647,7 +568,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
switch (theTextureMap->Type())
|
switch (theTextureMap->Type())
|
||||||
{
|
{
|
||||||
case Graphic3d_TypeOfTexture_CUBEMAP:
|
case Graphic3d_TOT_CUBEMAP:
|
||||||
{
|
{
|
||||||
return InitCubeMap (theCtx, Handle(Graphic3d_CubeMap)::DownCast(theTextureMap),
|
return InitCubeMap (theCtx, Handle(Graphic3d_CubeMap)::DownCast(theTextureMap),
|
||||||
0, Image_Format_RGB, false, theTextureMap->IsColorMap());
|
0, Image_Format_RGB, false, theTextureMap->IsColorMap());
|
||||||
@@ -668,15 +589,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Init (theCtx, *anImage, theTextureMap->Type(), theTextureMap->IsColorMap()))
|
return Init (theCtx, *anImage, theTextureMap->Type(), theTextureMap->IsColorMap());
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (theTextureMap->HasMipmaps())
|
|
||||||
{
|
|
||||||
GenerateMipmaps (theCtx);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -728,22 +641,23 @@ bool OpenGl_Texture::InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myTextFormat = aFormat.Format();
|
myTextFormat = aFormat.Format();
|
||||||
mySizedFormat = aFormat.Internal();
|
mySizedFormat = aFormat.Internal();
|
||||||
myIsTopDown = theImage.IsTopDown();
|
myIsTopDown = theImage.IsTopDown();
|
||||||
mySize.SetValues (theImage.SizeX(), theImage.SizeY(), 1);
|
mySizeX = theImage.SizeX();
|
||||||
|
mySizeY = theImage.SizeY();
|
||||||
myMaxMipLevel = Max (theImage.MipMaps().Size() - 1, 0);
|
myMaxMipLevel = Max (theImage.MipMaps().Size() - 1, 0);
|
||||||
if (myMaxMipLevel > 0
|
if (myMaxMipLevel > 0
|
||||||
&& !theImage.IsCompleteMipMapSet())
|
&& !theImage.IsCompleteMipMapSet())
|
||||||
{
|
{
|
||||||
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (mySize.xy(), myMaxMipLevel);
|
const Graphic3d_Vec2i aMipSize = computeSmallestMipMapSize (Graphic3d_Vec2i (mySizeX, mySizeY), myMaxMipLevel);
|
||||||
if (!theCtx->HasTextureBaseLevel())
|
if (!theCtx->HasTextureBaseLevel())
|
||||||
{
|
{
|
||||||
myMaxMipLevel = 0;
|
myMaxMipLevel = 0;
|
||||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_MEDIUM,
|
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0, GL_DEBUG_SEVERITY_MEDIUM,
|
||||||
TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySize.x() + "x" + mySize.y()
|
TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySizeX + "x" + mySizeY
|
||||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y() + "; mipmaps will be ignored");
|
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y() + "; mipmaps will be ignored");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message::SendTrace (TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySize.x() + "x" + mySize.y()
|
Message::SendTrace (TCollection_AsciiString ("Warning: compressed 2D texture ") + myResourceId + " " + mySizeX + "x" + mySizeY
|
||||||
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y());
|
+ " has smallest mipmap " + aMipSize.x() + "x" + aMipSize.y());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -848,7 +762,8 @@ bool OpenGl_Texture::Init2DMultisample (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySize.SetValues (theSizeX, theSizeY, 1);
|
mySizeX = theSizeX;
|
||||||
|
mySizeY = theSizeY;
|
||||||
|
|
||||||
Unbind (theCtx);
|
Unbind (theCtx);
|
||||||
return true;
|
return true;
|
||||||
@@ -909,7 +824,8 @@ bool OpenGl_Texture::InitRectangle (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySize.SetValues (aSizeX, aSizeY, 1);
|
mySizeX = aSizeX;
|
||||||
|
mySizeY = aSizeY;
|
||||||
Unbind (theCtx);
|
Unbind (theCtx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -996,7 +912,9 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mySize = aSizeXYZ;
|
mySizeX = aSizeXYZ.x();
|
||||||
|
mySizeY = aSizeXYZ.y();
|
||||||
|
mySizeZ = aSizeXYZ.z();
|
||||||
|
|
||||||
Unbind (theCtx);
|
Unbind (theCtx);
|
||||||
return true;
|
return true;
|
||||||
@@ -1022,7 +940,6 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
|||||||
Handle(Image_PixMap) anImage;
|
Handle(Image_PixMap) anImage;
|
||||||
Handle(Image_CompressedPixMap) aCompImage;
|
Handle(Image_CompressedPixMap) aCompImage;
|
||||||
OpenGl_TextureFormat aFormat;
|
OpenGl_TextureFormat aFormat;
|
||||||
myMaxMipLevel = 0;
|
|
||||||
if (!theCubeMap.IsNull())
|
if (!theCubeMap.IsNull())
|
||||||
{
|
{
|
||||||
theCubeMap->Reset();
|
theCubeMap->Reset();
|
||||||
@@ -1080,10 +997,15 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
|||||||
theSize = anImage->SizeX();
|
theSize = anImage->SizeX();
|
||||||
theFormat = anImage->Format();
|
theFormat = anImage->Format();
|
||||||
theToGenMipmap = theCubeMap->HasMipmaps();
|
theToGenMipmap = theCubeMap->HasMipmaps();
|
||||||
|
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
myIsTopDown = theCubeMap->IsTopDown();
|
myIsTopDown = theCubeMap->IsTopDown();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myMaxMipLevel = theToGenMipmap ? computeUpperMipMapLevel ((Standard_Integer )theSize) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!aFormat.IsValid())
|
if (!aFormat.IsValid())
|
||||||
{
|
{
|
||||||
@@ -1114,7 +1036,8 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
myTarget = GL_TEXTURE_CUBE_MAP;
|
myTarget = GL_TEXTURE_CUBE_MAP;
|
||||||
myNbSamples = 1;
|
myNbSamples = 1;
|
||||||
mySize.SetValues ((GLsizei )theSize, (GLsizei )theSize, 1);
|
mySizeX = (GLsizei )theSize;
|
||||||
|
mySizeY = (GLsizei )theSize;
|
||||||
myTextFormat = aFormat.Format();
|
myTextFormat = aFormat.Format();
|
||||||
mySizedFormat = aFormat.Internal();
|
mySizedFormat = aFormat.Internal();
|
||||||
|
|
||||||
@@ -1146,7 +1069,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
if (!aCompImage.IsNull())
|
if (!aCompImage.IsNull())
|
||||||
{
|
{
|
||||||
Graphic3d_Vec2i aMipSizeXY = mySize.xy();
|
Graphic3d_Vec2i aMipSizeXY (mySizeX, mySizeY);
|
||||||
aData = aCompImage->FaceData()->Data();
|
aData = aCompImage->FaceData()->Data();
|
||||||
for (Standard_Integer aMipIter = 0; aMipIter <= myMaxMipLevel; ++aMipIter)
|
for (Standard_Integer aMipIter = 0; aMipIter <= myMaxMipLevel; ++aMipIter)
|
||||||
{
|
{
|
||||||
@@ -1244,7 +1167,16 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
|
|||||||
|
|
||||||
if (theToGenMipmap && theCtx->arbFBO != NULL)
|
if (theToGenMipmap && theCtx->arbFBO != NULL)
|
||||||
{
|
{
|
||||||
GenerateMipmaps (theCtx);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unbind (theCtx.get());
|
Unbind (theCtx.get());
|
||||||
@@ -1318,14 +1250,14 @@ Standard_Size OpenGl_Texture::EstimatedDataSize() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Size aSize = PixelSizeOfPixelFormat (mySizedFormat) * mySize.x() * myNbSamples;
|
Standard_Size aSize = PixelSizeOfPixelFormat (mySizedFormat) * mySizeX * myNbSamples;
|
||||||
if (mySize.y() != 0)
|
if (mySizeY != 0)
|
||||||
{
|
{
|
||||||
aSize *= Standard_Size(mySize.y());
|
aSize *= Standard_Size(mySizeY);
|
||||||
}
|
}
|
||||||
if (mySize.z() != 0)
|
if (mySizeZ != 0)
|
||||||
{
|
{
|
||||||
aSize *= Standard_Size(mySize.z());
|
aSize *= Standard_Size(mySizeZ);
|
||||||
}
|
}
|
||||||
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
||||||
{
|
{
|
||||||
@@ -1362,7 +1294,7 @@ bool OpenGl_Texture::ImageDump (Image_PixMap& theImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLenum aTarget = myTarget;
|
GLenum aTarget = myTarget;
|
||||||
Graphic3d_Vec2i aSize = mySize.xy();
|
Graphic3d_Vec2i aSize (mySizeX, mySizeY);
|
||||||
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
if (myTarget == GL_TEXTURE_CUBE_MAP)
|
||||||
{
|
{
|
||||||
aTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + theCubeSide;
|
aTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + theCubeSide;
|
||||||
|
@@ -53,17 +53,11 @@ public:
|
|||||||
//! @return target to which the texture is bound (GL_TEXTURE_1D, GL_TEXTURE_2D)
|
//! @return target to which the texture is bound (GL_TEXTURE_1D, GL_TEXTURE_2D)
|
||||||
unsigned int GetTarget() const { return myTarget; }
|
unsigned int GetTarget() const { return myTarget; }
|
||||||
|
|
||||||
//! Return texture dimensions (0 LOD)
|
//! @return texture width (0 LOD)
|
||||||
const Graphic3d_Vec3i& Size() const { return mySize; }
|
GLsizei SizeX() const { return mySizeX; }
|
||||||
|
|
||||||
//! Return texture width (0 LOD)
|
//! @return texture height (0 LOD)
|
||||||
Standard_Integer SizeX() const { return mySize.x(); }
|
GLsizei SizeY() const { return mySizeY; }
|
||||||
|
|
||||||
//! 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
|
//! @return texture ID
|
||||||
unsigned int TextureId() const { return myTextureId; }
|
unsigned int TextureId() const { return myTextureId; }
|
||||||
@@ -146,30 +140,15 @@ public:
|
|||||||
//! Notice that texture will be unbound after this call.
|
//! Notice that texture will be unbound after this call.
|
||||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||||
const OpenGl_TextureFormat& theFormat,
|
const OpenGl_TextureFormat& theFormat,
|
||||||
const Graphic3d_Vec3i& theSizeXYZ,
|
const Graphic3d_Vec2i& theSizeXY,
|
||||||
const Graphic3d_TypeOfTexture theType,
|
const Graphic3d_TypeOfTexture theType,
|
||||||
const Image_PixMap* theImage = NULL);
|
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.
|
//! Initialize the texture with Graphic3d_TextureMap.
|
||||||
//! It is an universal way to initialize.
|
//! It is an universal way to initialize.
|
||||||
//! Suitable initialization method will be chosen.
|
//! Suitable initialization method will be chosen.
|
||||||
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT bool Init (const Handle(OpenGl_Context)& theCtx,
|
||||||
const Handle(Graphic3d_TextureRoot)& theTextureMap);
|
const Handle(Graphic3d_TextureMap)& theTextureMap);
|
||||||
|
|
||||||
//! Generate mipmaps.
|
|
||||||
Standard_EXPORT bool GenerateMipmaps (const Handle(OpenGl_Context)& theCtx);
|
|
||||||
|
|
||||||
//! Initialize the texture with Image_CompressedPixMap.
|
//! Initialize the texture with Image_CompressedPixMap.
|
||||||
Standard_EXPORT bool InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
Standard_EXPORT bool InitCompressed (const Handle(OpenGl_Context)& theCtx,
|
||||||
@@ -323,7 +302,9 @@ protected:
|
|||||||
Standard_Size myRevision; //!< revision of associated data source
|
Standard_Size myRevision; //!< revision of associated data source
|
||||||
unsigned int myTextureId; //!< GL resource ID
|
unsigned int myTextureId; //!< GL resource ID
|
||||||
unsigned int myTarget; //!< GL_TEXTURE_1D/GL_TEXTURE_2D/GL_TEXTURE_3D
|
unsigned int myTarget; //!< GL_TEXTURE_1D/GL_TEXTURE_2D/GL_TEXTURE_3D
|
||||||
Graphic3d_Vec3i mySize; //!< texture width x height x depth
|
Standard_Integer mySizeX; //!< texture width
|
||||||
|
Standard_Integer mySizeY; //!< texture height
|
||||||
|
Standard_Integer mySizeZ; //!< texture depth
|
||||||
unsigned int myTextFormat; //!< texture format - GL_RGB, GL_RGBA,...
|
unsigned int myTextFormat; //!< texture format - GL_RGB, GL_RGBA,...
|
||||||
Standard_Integer mySizedFormat;//!< internal (sized) texture format
|
Standard_Integer mySizedFormat;//!< internal (sized) texture format
|
||||||
Standard_Integer myNbSamples; //!< number of MSAA samples
|
Standard_Integer myNbSamples; //!< number of MSAA samples
|
||||||
|
@@ -72,7 +72,6 @@ TCollection_AsciiString OpenGl_TextureFormat::FormatFormat (GLint theInternalFor
|
|||||||
case 0x803C: return "GL_ALPHA8";
|
case 0x803C: return "GL_ALPHA8";
|
||||||
case 0x803E: return "GL_ALPHA16";
|
case 0x803E: return "GL_ALPHA16";
|
||||||
case GL_LUMINANCE: return "GL_LUMINANCE";
|
case GL_LUMINANCE: return "GL_LUMINANCE";
|
||||||
case GL_LUMINANCE16: return "GL_LUMINANCE16";
|
|
||||||
case GL_LUMINANCE_ALPHA: return "GL_LUMINANCE_ALPHA";
|
case GL_LUMINANCE_ALPHA: return "GL_LUMINANCE_ALPHA";
|
||||||
//
|
//
|
||||||
case GL_DEPTH_COMPONENT: return "GL_DEPTH_COMPONENT";
|
case GL_DEPTH_COMPONENT: return "GL_DEPTH_COMPONENT";
|
||||||
@@ -220,19 +219,6 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
|
|||||||
aFormat.SetDataType (GL_FLOAT);
|
aFormat.SetDataType (GL_FLOAT);
|
||||||
return aFormat;
|
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:
|
case Image_Format_RGF_half:
|
||||||
{
|
{
|
||||||
aFormat.SetNbComponents (2);
|
aFormat.SetNbComponents (2);
|
||||||
@@ -457,28 +443,6 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindFormat (const Handle(OpenGl_Conte
|
|||||||
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
aFormat.SetDataType (GL_UNSIGNED_BYTE);
|
||||||
return aFormat;
|
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:
|
case Image_Format_UNKNOWN:
|
||||||
{
|
{
|
||||||
return OpenGl_TextureFormat();
|
return OpenGl_TextureFormat();
|
||||||
@@ -545,7 +509,7 @@ OpenGl_TextureFormat OpenGl_TextureFormat::FindSizedFormat (const Handle(OpenGl_
|
|||||||
aFormat.SetInternalFormat (theSizedFormat);
|
aFormat.SetInternalFormat (theSizedFormat);
|
||||||
aFormat.SetPixelFormat (GL_RED);
|
aFormat.SetPixelFormat (GL_RED);
|
||||||
aFormat.SetDataType (GL_HALF_FLOAT);
|
aFormat.SetDataType (GL_HALF_FLOAT);
|
||||||
aFormat.SetImageFormat (Image_Format_GrayF_half);
|
aFormat.SetImageFormat (Image_Format_GrayF);
|
||||||
if (theCtx->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
if (theCtx->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
|
||||||
{
|
{
|
||||||
aFormat.SetDataType (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
aFormat.SetDataType (theCtx->GraphicsLibrary() == Aspect_GraphicsLibrary_OpenGLES
|
||||||
|
@@ -302,7 +302,7 @@ bool OpenGl_TileSampler::upload (const Handle(OpenGl_Context)& theContext,
|
|||||||
if (!theOffsetsTexture->Init (theContext,
|
if (!theOffsetsTexture->Init (theContext,
|
||||||
OpenGl_TextureFormat::FindSizedFormat (theContext, GL_RG32I),
|
OpenGl_TextureFormat::FindSizedFormat (theContext, GL_RG32I),
|
||||||
Graphic3d_Vec2i ((int )anOffsets.SizeX, (int )anOffsets.SizeY),
|
Graphic3d_Vec2i ((int )anOffsets.SizeX, (int )anOffsets.SizeY),
|
||||||
Graphic3d_TypeOfTexture_2D))
|
Graphic3d_TOT_2D))
|
||||||
{
|
{
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
@@ -343,8 +343,10 @@ void OpenGl_View::initTextureEnv (const Handle(OpenGl_Context)& theContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle(OpenGl_Texture) aTextureEnv = new OpenGl_Texture (myTextureEnvData->GetId(), myTextureEnvData->GetParams());
|
Handle(OpenGl_Texture) aTextureEnv = new OpenGl_Texture (myTextureEnvData->GetId(), myTextureEnvData->GetParams());
|
||||||
aTextureEnv->Init (theContext, myTextureEnvData);
|
if (Handle(Image_PixMap) anImage = myTextureEnvData->GetImage (theContext->SupportedTextureFormats()))
|
||||||
|
{
|
||||||
|
aTextureEnv->Init (theContext, *anImage, myTextureEnvData->Type(), true);
|
||||||
|
}
|
||||||
myTextureEnv = new OpenGl_TextureSet (aTextureEnv);
|
myTextureEnv = new OpenGl_TextureSet (aTextureEnv);
|
||||||
myTextureEnv->ChangeTextureSetBits() = Graphic3d_TextureSetBits_BaseColor;
|
myTextureEnv->ChangeTextureSetBits() = Graphic3d_TextureSetBits_BaseColor;
|
||||||
}
|
}
|
||||||
@@ -1389,7 +1391,7 @@ bool OpenGl_View::prepareFrameBuffers (Graphic3d_Camera::Projection& theProj)
|
|||||||
aParams->SetTextureUnit (aCtx->PBREnvLUTTexUnit());
|
aParams->SetTextureUnit (aCtx->PBREnvLUTTexUnit());
|
||||||
anEnvLUT = new OpenGl_Texture(THE_SHARED_ENV_LUT_KEY, aParams);
|
anEnvLUT = new OpenGl_Texture(THE_SHARED_ENV_LUT_KEY, aParams);
|
||||||
if (!aTexFormat.IsValid()
|
if (!aTexFormat.IsValid()
|
||||||
|| !anEnvLUT->Init (aCtx, aTexFormat, Graphic3d_Vec2i((Standard_Integer)Textures_EnvLUTSize), Graphic3d_TypeOfTexture_2D, aPixMap.get()))
|
|| !anEnvLUT->Init (aCtx, aTexFormat, Graphic3d_Vec2i((Standard_Integer)Textures_EnvLUTSize), Graphic3d_TOT_2D, aPixMap.get()))
|
||||||
{
|
{
|
||||||
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, "Failed allocation of LUT for PBR");
|
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, "Failed allocation of LUT for PBR");
|
||||||
anEnvLUT.Nullify();
|
anEnvLUT.Nullify();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user