mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
36 Commits
CR33657
...
CR0_MW_vrm
Author | SHA1 | Date | |
---|---|---|---|
|
a80c56fbab | ||
|
d8c0506f55 | ||
|
75c9bb6ecc | ||
|
da62aa31d6 | ||
|
dc5cbfb6e6 | ||
|
1bebdb9c92 | ||
|
8f469cc38b | ||
|
9c2488148b | ||
|
865f597eda | ||
|
dc921b1ca4 | ||
|
2390f514ab | ||
|
aee5a1b3f6 | ||
|
d93ae7ffe5 | ||
|
1a4dc86e1c | ||
|
1f6c79b30f | ||
|
48c3706665 | ||
|
ac5eea5d0e | ||
|
918b022dae | ||
|
a5ad0b11f5 | ||
|
8feb46bb5d | ||
|
bc1c59d0a0 | ||
|
e66ddc4bab | ||
|
b87a2fa42c | ||
|
fdab3e717d | ||
|
7c10f53a43 | ||
|
5c003a4e44 | ||
|
93a4a91644 | ||
|
fb82a1c600 | ||
|
a5b83dcd65 | ||
|
2a1a7f5f5d | ||
|
e6853e7836 | ||
|
a0ba054ca2 | ||
|
b3cc2679cd | ||
|
987722157f | ||
|
7b35b14065 | ||
|
6a2e6be455 |
@@ -360,6 +360,7 @@ n XCAFApp
|
||||
n XCAFDimTolObjects
|
||||
n XCAFDoc
|
||||
n XCAFPrs
|
||||
n XCAFView
|
||||
n XSAlgo
|
||||
n XSControl
|
||||
n XmlMXCAFDoc
|
||||
|
@@ -1824,6 +1824,9 @@ proc osutils:tk:files { tkloc thePlatform } {
|
||||
"n" { set utyp "nocdlpack" }
|
||||
"x" { set utyp "executable" }
|
||||
}
|
||||
if { $utyp == "" } {
|
||||
puts "Error: '$loc' is undefined within UDLIST"
|
||||
}
|
||||
if [array exists map] { unset map }
|
||||
osutils:tk:loadunit $loc map
|
||||
#puts " loc = $loc === > [array names map]"
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 11 KiB |
@@ -477,6 +477,9 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
{
|
||||
aShadedGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
if (isClosed
|
||||
&& !myCappingStyle.IsNull())
|
||||
aShadedGroup->SetGroupPrimitivesAspect (myCappingStyle);
|
||||
}
|
||||
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
|
||||
aShadedGroup->AddPrimitiveArray (aTriangles);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Aspect_PolygonOffsetMode.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
@@ -298,6 +299,37 @@ void AIS_InteractiveObject::UnsetMaterial()
|
||||
hasOwnMaterial = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCappingStyle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
myCappingStyle = theStyle;
|
||||
|
||||
// Modify existing presentations
|
||||
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
|
||||
if (!aPrs3d.IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
if (!aStruct.IsNull())
|
||||
{
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (aGrp.IsNull())
|
||||
continue;
|
||||
|
||||
aGrp->SetGroupPrimitivesAspect (theStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransparency
|
||||
//purpose :
|
||||
@@ -647,10 +679,11 @@ void AIS_InteractiveObject::SynchronizeAspects()
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) aLineAspect = aGrp->LineAspect();
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = aGrp->FillAreaAspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = aGrp->MarkerAspect();
|
||||
Handle(Graphic3d_AspectText3d) aTextAspect = aGrp->TextAspect();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAspect = aGrp->LineAspect();
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = aGrp->FillAreaAspect();
|
||||
Handle(Graphic3d_AspectFillCapping) aCappingAspect = aGrp->FillCappingAspect();
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = aGrp->MarkerAspect();
|
||||
Handle(Graphic3d_AspectText3d) aTextAspect = aGrp->TextAspect();
|
||||
if (!aLineAspect.IsNull())
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (aLineAspect);
|
||||
@@ -659,6 +692,10 @@ void AIS_InteractiveObject::SynchronizeAspects()
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (aFaceAspect);
|
||||
}
|
||||
if (!aCappingAspect.IsNull())
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (aCappingAspect);
|
||||
}
|
||||
if (!aMarkerAspect.IsNull())
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (aMarkerAspect);
|
||||
@@ -667,6 +704,7 @@ void AIS_InteractiveObject::SynchronizeAspects()
|
||||
{
|
||||
aGrp->SetGroupPrimitivesAspect (aTextAspect);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -319,10 +319,16 @@ public:
|
||||
//! Material aspect determines shading aspect, color and
|
||||
//! transparency of visible entities.
|
||||
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& aName);
|
||||
|
||||
|
||||
//! Removes the setting for material.
|
||||
Standard_EXPORT virtual void UnsetMaterial();
|
||||
|
||||
|
||||
//! Set style of filling capping section created by clipping planes.
|
||||
Standard_EXPORT virtual void SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
|
||||
|
||||
//! Returns style for filling capping section created by clipping planes.
|
||||
const Handle(Graphic3d_AspectFillCapping)& CappingStyle() const { return myCappingStyle; }
|
||||
|
||||
//! Attributes a setting aValue for transparency.
|
||||
//! The transparency value should be between 0.0 and 1.0.
|
||||
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
|
||||
@@ -430,7 +436,7 @@ protected:
|
||||
Standard_Boolean hasOwnColor;
|
||||
Standard_Boolean hasOwnMaterial;
|
||||
Standard_Boolean myRecomputeEveryPrs;
|
||||
|
||||
Handle(Graphic3d_AspectFillCapping) myCappingStyle;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
||||
|
@@ -183,7 +183,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer);
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myCappingStyle);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
{
|
||||
@@ -981,7 +981,6 @@ void AIS_Shape::SetTransparency (const Standard_Real theValue)
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
@@ -1037,7 +1036,6 @@ void AIS_Shape::UnsetTransparency()
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
aPrs->ResetDisplayPriority();
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
|
||||
|
@@ -105,11 +105,6 @@ void AIS_Triangulation::updatePresentation()
|
||||
|
||||
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
|
||||
|
||||
if (IsTransparent())
|
||||
{
|
||||
aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
|
||||
@@ -118,11 +113,6 @@ void AIS_Triangulation::updatePresentation()
|
||||
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsTransparent())
|
||||
{
|
||||
aPrs->ResetDisplayPriority();
|
||||
}
|
||||
}
|
||||
|
||||
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <BinMDF_ADriverTable.hxx>
|
||||
#include <BinMNaming_NamedShapeDriver.hxx>
|
||||
#include <BinMXCAFDoc.hxx>
|
||||
#include <BinMXCAFDoc_AssemblyItemRefDriver.hxx>
|
||||
#include <BinMXCAFDoc_AreaDriver.hxx>
|
||||
#include <BinMXCAFDoc_CentroidDriver.hxx>
|
||||
#include <BinMXCAFDoc_ColorDriver.hxx>
|
||||
@@ -32,7 +33,13 @@
|
||||
#include <BinMXCAFDoc_LocationDriver.hxx>
|
||||
#include <BinMXCAFDoc_MaterialDriver.hxx>
|
||||
#include <BinMXCAFDoc_MaterialToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <BinMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ShapeToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_VolumeDriver.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
@@ -42,7 +49,8 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
const Handle(CDM_MessageDriver)& theMsgDrv) {
|
||||
const Handle(CDM_MessageDriver)& theMsgDrv)
|
||||
{
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_AreaDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_CentroidDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ColorDriver (theMsgDrv));
|
||||
@@ -61,12 +69,16 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
}
|
||||
|
||||
theDriverTable->AddDriver( aLocationDriver);
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_VolumeDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_AssemblyItemRefDriver(theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_VolumeDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_GeomToleranceDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver (new BinMXCAFDoc_ViewDriver (theMsgDrv));
|
||||
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DocumentToolDriver(theMsgDrv));
|
||||
@@ -74,4 +86,6 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ShapeToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialToolDriver(theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NotesToolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ViewToolDriver (theMsgDrv));
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ class BinMDF_ADriverTable;
|
||||
class CDM_MessageDriver;
|
||||
class BinMXCAFDoc_AreaDriver;
|
||||
class BinMXCAFDoc_CentroidDriver;
|
||||
class BinMXCAFDoc_ClippingPlaneToolDriver;
|
||||
class BinMXCAFDoc_ColorDriver;
|
||||
class BinMXCAFDoc_GraphNodeDriver;
|
||||
class BinMXCAFDoc_LocationDriver;
|
||||
@@ -33,12 +34,17 @@ class BinMXCAFDoc_GeomToleranceDriver;
|
||||
class BinMXCAFDoc_DimensionDriver;
|
||||
class BinMXCAFDoc_DimTolDriver;
|
||||
class BinMXCAFDoc_MaterialDriver;
|
||||
class BinMXCAFDoc_NoteCommentDriver;
|
||||
class BinMXCAFDoc_NoteBinDataDriver;
|
||||
class BinMXCAFDoc_NotesToolDriver;
|
||||
class BinMXCAFDoc_ColorToolDriver;
|
||||
class BinMXCAFDoc_DocumentToolDriver;
|
||||
class BinMXCAFDoc_LayerToolDriver;
|
||||
class BinMXCAFDoc_ShapeToolDriver;
|
||||
class BinMXCAFDoc_DimTolToolDriver;
|
||||
class BinMXCAFDoc_MaterialToolDriver;
|
||||
class BinMXCAFDoc_ViewDriver;
|
||||
class BinMXCAFDoc_ViewToolDriver;
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +74,7 @@ private:
|
||||
|
||||
friend class BinMXCAFDoc_AreaDriver;
|
||||
friend class BinMXCAFDoc_CentroidDriver;
|
||||
friend class BinMXCAFDoc_ClippingPlaneToolDriver;
|
||||
friend class BinMXCAFDoc_ColorDriver;
|
||||
friend class BinMXCAFDoc_GraphNodeDriver;
|
||||
friend class BinMXCAFDoc_LocationDriver;
|
||||
@@ -83,6 +90,8 @@ friend class BinMXCAFDoc_LayerToolDriver;
|
||||
friend class BinMXCAFDoc_ShapeToolDriver;
|
||||
friend class BinMXCAFDoc_DimTolToolDriver;
|
||||
friend class BinMXCAFDoc_MaterialToolDriver;
|
||||
friend class BinMXCAFDoc_ViewDriver;
|
||||
friend class BinMXCAFDoc_ViewToolDriver;
|
||||
|
||||
};
|
||||
|
||||
|
111
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
111
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.cxx
Normal file
@@ -0,0 +1,111 @@
|
||||
// Created on: 2017-02-16
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-2017 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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_AssemblyItemRefDriver.hxx>
|
||||
#include <XCAFDoc_AssemblyItemRef.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_AssemblyItemRefDriver::BinMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AssemblyItemRef)->Name())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_AssemblyItemRefDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_AssemblyItemRef();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_AssemblyItemRefDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theTarget);
|
||||
if (aThis.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_AsciiString aPathStr;
|
||||
if (!(theSource >> aPathStr))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetItem(aPathStr);
|
||||
|
||||
Standard_Integer anExtraRef = 0;
|
||||
if (!(theSource >> anExtraRef))
|
||||
return Standard_False;
|
||||
|
||||
if (anExtraRef == 1)
|
||||
{
|
||||
Standard_GUID aGUID;
|
||||
if (!(theSource >> aGUID))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetGUID(aGUID);
|
||||
}
|
||||
else if (anExtraRef == 2)
|
||||
{
|
||||
Standard_Integer aSubshapeIndex;
|
||||
if (!(theSource >> aSubshapeIndex))
|
||||
return Standard_False;
|
||||
|
||||
aThis->SetSubshapeIndex(aSubshapeIndex);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_AssemblyItemRefDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_AssemblyItemRef) aThis = Handle(XCAFDoc_AssemblyItemRef)::DownCast(theSource);
|
||||
if (!aThis.IsNull())
|
||||
{
|
||||
theTarget << aThis->GetItem().ToString();
|
||||
if (aThis->IsGUID())
|
||||
{
|
||||
theTarget << Standard_Integer(1);
|
||||
theTarget << aThis->GetGUID();
|
||||
}
|
||||
else if (aThis->IsSubshapeIndex())
|
||||
{
|
||||
theTarget << Standard_Integer(2);
|
||||
theTarget << aThis->GetSubshapeIndex();
|
||||
}
|
||||
else
|
||||
theTarget << Standard_Integer(0);
|
||||
}
|
||||
}
|
54
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.hxx
Normal file
54
src/BinMXCAFDoc/BinMXCAFDoc_AssemblyItemRefDriver.hxx
Normal file
@@ -0,0 +1,54 @@
|
||||
// Created on: 2017-02-16
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-2017 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 _BinMXCAFDoc_AssemblyItemRefDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_AssemblyItemRefDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
class BinMXCAFDoc_AssemblyItemRefDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_AssemblyItemRefDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_AssemblyItemRefDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AssemblyItemRefDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_AssemblyItemRefDriver_HeaderFile
|
65
src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx
Normal file
65
src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx
Normal file
@@ -0,0 +1,65 @@
|
||||
// Created on: 2016-11-30
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <BinMXCAFDoc_ClippingPlaneToolDriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_ClippingPlaneTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_ClippingPlaneToolDriver::BinMXCAFDoc_ClippingPlaneToolDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_ClippingPlaneTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_ClippingPlaneToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_ClippingPlaneTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_ClippingPlaneToolDriver::Paste
|
||||
(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_ClippingPlaneToolDriver::Paste
|
||||
(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
|
||||
}
|
50
src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx
Normal file
50
src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// Created on: 2016-11-30
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
|
||||
class BinMXCAFDoc_DimTolToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver)
|
||||
|
||||
|
||||
class BinMXCAFDoc_ClippingPlaneToolDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_ClippingPlaneToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Paste(const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
#endif // _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile
|
96
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
96
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.cxx
Normal file
@@ -0,0 +1,96 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-2017 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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBinDataDriver::BinMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteBinDataDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBinData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteBinDataDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aTitle;
|
||||
TCollection_AsciiString aMIMEtype;
|
||||
Standard_Integer nbSize;
|
||||
if (!(theSource >> aTitle >> aMIMEtype >> nbSize))
|
||||
return Standard_False;
|
||||
|
||||
Handle(TColStd_HArray1OfByte) aData;
|
||||
if (nbSize > 0)
|
||||
{
|
||||
aData.reset(new TColStd_HArray1OfByte(1, nbSize));
|
||||
theSource.GetByteArray(&aData->ChangeFirst(), nbSize);
|
||||
}
|
||||
|
||||
aNote->Set(aTitle, aMIMEtype, aData);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
theTarget << aNote->Title() << aNote->MIMEtype() << aNote->Size();
|
||||
if (aNote->Size() > 0)
|
||||
theTarget.PutByteArray(&aNote->Data()->ChangeFirst(), aNote->Size());
|
||||
}
|
||||
}
|
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.hxx
Normal file
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteBinDataDriver.hxx
Normal file
@@ -0,0 +1,44 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-2017 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 _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteBinDataDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
80
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
80
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.cxx
Normal file
@@ -0,0 +1,80 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-2017 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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteCommentDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteComment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteCommentDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aComment;
|
||||
if (!(theSource >> aComment))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aComment);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->Comment();
|
||||
}
|
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
44
src/BinMXCAFDoc/BinMXCAFDoc_NoteCommentDriver.hxx
Normal file
@@ -0,0 +1,44 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-2017 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 _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteCommentDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
68
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.cxx
Normal file
68
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.cxx
Normal file
@@ -0,0 +1,68 @@
|
||||
// Created on: 2017-02-10
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-2017 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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
#include <XCAFDoc_Note.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMDF_ADriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aUserName, aTimeStamp;
|
||||
if (!(theSource >> aUserName >> aTimeStamp))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aUserName, aTimeStamp);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->UserName() << aNote->TimeStamp();
|
||||
}
|
55
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.hxx
Normal file
55
src/BinMXCAFDoc/BinMXCAFDoc_NoteDriver.hxx
Normal file
@@ -0,0 +1,55 @@
|
||||
// Created on: 2017-02-10
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-2017 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 _BinMXCAFDoc_NoteDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
class BinMXCAFDoc_NoteDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_NoteDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteDriver_HeaderFile
|
62
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.cxx
Normal file
62
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.cxx
Normal file
@@ -0,0 +1,62 @@
|
||||
// Created on: 2017-02-10
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-2017 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 <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <XCAFDoc_NotesTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NotesToolDriver::BinMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NotesTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NotesToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NotesTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NotesToolDriver::Paste(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NotesToolDriver::Paste(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
}
|
54
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.hxx
Normal file
54
src/BinMXCAFDoc/BinMXCAFDoc_NotesToolDriver.hxx
Normal file
@@ -0,0 +1,54 @@
|
||||
// Created on: 2017-02-10
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-2017 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 _BinMXCAFDoc_NotesToolDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NotesToolDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
class BinMXCAFDoc_NotesToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_NotesToolDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NotesToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NotesToolDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NotesToolDriver_HeaderFile
|
63
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.cxx
Normal file
63
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.cxx
Normal file
@@ -0,0 +1,63 @@
|
||||
// Created on: 2016-10-24
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <BinMXCAFDoc_ViewDriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ViewDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_ViewDriver::BinMXCAFDoc_ViewDriver (const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_View)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_ViewDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_View();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_ViewDriver::Paste (const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_ViewDriver::Paste (const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
}
|
56
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.hxx
Normal file
56
src/BinMXCAFDoc/BinMXCAFDoc_ViewDriver.hxx
Normal file
@@ -0,0 +1,56 @@
|
||||
// Created on: 2016-10-24
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _BinMXCAFDoc_ViewDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_ViewDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
class BinMXCAFDoc_ViewDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ViewDriver, BinMDF_ADriver)
|
||||
|
||||
class BinMXCAFDoc_ViewDriver : public BinMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_ViewDriver (const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_ViewDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_ViewDriver_HeaderFile
|
65
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.cxx
Normal file
65
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.cxx
Normal file
@@ -0,0 +1,65 @@
|
||||
// Created on: 2016-10-24
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <BinMXCAFDoc_ViewToolDriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <CDM_MessageDriver.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_ViewTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ViewToolDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_ViewToolDriver::BinMXCAFDoc_ViewToolDriver
|
||||
(const Handle(CDM_MessageDriver)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_ViewTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_ViewToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_ViewTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_ViewToolDriver::Paste
|
||||
(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_ViewToolDriver::Paste
|
||||
(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
|
||||
}
|
52
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.hxx
Normal file
52
src/BinMXCAFDoc/BinMXCAFDoc_ViewToolDriver.hxx
Normal file
@@ -0,0 +1,52 @@
|
||||
// Created on: 2016-10-24
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _BinMXCAFDoc_ViewToolDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_ViewToolDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
class CDM_MessageDriver;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
|
||||
class BinMXCAFDoc_ViewToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ViewToolDriver, BinMDF_ADriver)
|
||||
|
||||
|
||||
class BinMXCAFDoc_ViewToolDriver : public BinMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_ViewToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_ViewToolDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
#endif // _BinMXCAFDoc_ViewToolDriver_HeaderFile
|
@@ -1,9 +1,13 @@
|
||||
BinMXCAFDoc.cxx
|
||||
BinMXCAFDoc.hxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.cxx
|
||||
BinMXCAFDoc_AssemblyItemRefDriver.hxx
|
||||
BinMXCAFDoc_AreaDriver.cxx
|
||||
BinMXCAFDoc_AreaDriver.hxx
|
||||
BinMXCAFDoc_CentroidDriver.cxx
|
||||
BinMXCAFDoc_CentroidDriver.hxx
|
||||
BinMXCAFDoc_ClippingPlaneToolDriver.cxx
|
||||
BinMXCAFDoc_ClippingPlaneToolDriver.hxx
|
||||
BinMXCAFDoc_ColorDriver.cxx
|
||||
BinMXCAFDoc_ColorDriver.hxx
|
||||
BinMXCAFDoc_ColorToolDriver.cxx
|
||||
@@ -31,7 +35,19 @@ BinMXCAFDoc_MaterialDriver.cxx
|
||||
BinMXCAFDoc_MaterialDriver.hxx
|
||||
BinMXCAFDoc_MaterialToolDriver.cxx
|
||||
BinMXCAFDoc_MaterialToolDriver.hxx
|
||||
BinMXCAFDoc_NoteDriver.cxx
|
||||
BinMXCAFDoc_NoteDriver.hxx
|
||||
BinMXCAFDoc_NoteCommentDriver.cxx
|
||||
BinMXCAFDoc_NoteCommentDriver.hxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.cxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.hxx
|
||||
BinMXCAFDoc_NotesToolDriver.cxx
|
||||
BinMXCAFDoc_NotesToolDriver.hxx
|
||||
BinMXCAFDoc_ShapeToolDriver.cxx
|
||||
BinMXCAFDoc_ShapeToolDriver.hxx
|
||||
BinMXCAFDoc_ViewDriver.cxx
|
||||
BinMXCAFDoc_ViewDriver.hxx
|
||||
BinMXCAFDoc_ViewToolDriver.cxx
|
||||
BinMXCAFDoc_ViewToolDriver.hxx
|
||||
BinMXCAFDoc_VolumeDriver.cxx
|
||||
BinMXCAFDoc_VolumeDriver.hxx
|
||||
|
@@ -74,8 +74,8 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const gp_Pnt P)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BinTools_ShapeSet::BinTools_ShapeSet(const Standard_Boolean isWithTriangles)
|
||||
:myFormatNb(3), myWithTriangles(isWithTriangles)
|
||||
BinTools_ShapeSet::BinTools_ShapeSet(const Standard_Boolean /*isWithTriangles*/)
|
||||
:myFormatNb(3), myWithTriangles(Standard_True/*isWithTriangles*/)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
@@ -517,6 +517,12 @@ void BinTools_ShapeSet::Read(TopoDS_Shape& S, Standard_IStream& IS,
|
||||
anOrient = (TopAbs_Orientation)aChar;
|
||||
Standard_Integer anIndx;
|
||||
BinTools::GetInteger(IS, anIndx);
|
||||
Standard_Integer anInd = nbshapes - anIndx + 1;
|
||||
if (anInd < 1 || anInd > myShapes.Extent())
|
||||
{
|
||||
S = TopoDS_Shape();
|
||||
return;
|
||||
}
|
||||
S = myShapes(nbshapes - anIndx + 1);
|
||||
S.Orientation(anOrient);
|
||||
|
||||
|
@@ -95,6 +95,8 @@ Standard_Integer BinTools_SurfaceSet::Add(const Handle(Geom_Surface)& S)
|
||||
Handle(Geom_Surface) BinTools_SurfaceSet::Surface
|
||||
(const Standard_Integer I)const
|
||||
{
|
||||
if (I < 1 || I > myMap.Extent())
|
||||
return Handle(Geom_Surface)();
|
||||
return Handle(Geom_Surface)::DownCast(myMap(I));
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,8 @@ Graphic3d_ArrayOfTriangleStrips.cxx
|
||||
Graphic3d_ArrayOfTriangleStrips.hxx
|
||||
Graphic3d_AspectFillArea3d.cxx
|
||||
Graphic3d_AspectFillArea3d.hxx
|
||||
Graphic3d_AspectFillCapping.cxx
|
||||
Graphic3d_AspectFillCapping.hxx
|
||||
Graphic3d_AspectLine3d.cxx
|
||||
Graphic3d_AspectLine3d.hxx
|
||||
Graphic3d_AspectMarker3d.cxx
|
||||
@@ -39,7 +41,6 @@ Graphic3d_BufferType.hxx
|
||||
Graphic3d_Camera.cxx
|
||||
Graphic3d_Camera.hxx
|
||||
Graphic3d_CameraTile.hxx
|
||||
Graphic3d_CappingFlags.hxx
|
||||
Graphic3d_CLight.hxx
|
||||
Graphic3d_ClipPlane.cxx
|
||||
Graphic3d_ClipPlane.hxx
|
||||
|
110
src/Graphic3d/Graphic3d_AspectFillCapping.cxx
Normal file
110
src/Graphic3d/Graphic3d_AspectFillCapping.cxx
Normal file
@@ -0,0 +1,110 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 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_AspectFillCapping.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectFillCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectFillCapping::Graphic3d_AspectFillCapping()
|
||||
: myFlags (Flags_None),
|
||||
myHatchingState (0)
|
||||
{
|
||||
Graphic3d_MaterialAspect aMaterial;
|
||||
aMaterial.SetColor (Quantity_NOC_BLACK);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
||||
aMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
SetHatchStyle (Aspect_HS_HORIZONTAL);
|
||||
SetHatchMaterial (aMaterial);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
myStippleHatch = new Graphic3d_HatchStyle (theStyle);
|
||||
myTextureHatch.Nullify();
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle)
|
||||
{
|
||||
myStippleHatch = theStyle;
|
||||
myTextureHatch.Nullify();
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
{
|
||||
myStippleHatch.Nullify();
|
||||
myTextureHatch = theTexture;
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchMaterial
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
myHatchMaterial = theMaterial;
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetToDrawHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetToDrawHatch (const Standard_Boolean theToDraw)
|
||||
{
|
||||
setFlag (theToDraw, Flags_DrawHatching);
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchZoomPeristent
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchZoomPeristent (const Standard_Boolean theToSet)
|
||||
{
|
||||
setFlag (theToSet, Flags_HatchZoomPersistent);
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchRotationPeristent
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchRotationPeristent (const Standard_Boolean theToSet)
|
||||
{
|
||||
setFlag (theToSet, Flags_HatchRotationPersistent);
|
||||
myHatchingState++;
|
||||
}
|
163
src/Graphic3d/Graphic3d_AspectFillCapping.hxx
Normal file
163
src/Graphic3d/Graphic3d_AspectFillCapping.hxx
Normal file
@@ -0,0 +1,163 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 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_AspectFillCapping_HeaderFile
|
||||
#define _Graphic3d_AspectFillCapping_HeaderFile
|
||||
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
#include <Graphic3d_HatchStyle.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_ShaderProgram.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//! Defines graphical attributes for drawing section planes on solids resulted from clipping (cutting) planes.
|
||||
class Graphic3d_AspectFillCapping : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT Graphic3d_AspectFillCapping();
|
||||
|
||||
public:
|
||||
|
||||
//! Sets material for filling section created by clipping.
|
||||
void SetMaterial (const Graphic3d_MaterialAspect& theMaterial) { myMaterial = theMaterial; }
|
||||
|
||||
//! Returns material for filling section created by clipping.
|
||||
const Graphic3d_MaterialAspect& Material() const { return myMaterial; }
|
||||
|
||||
//! Sets flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectMaterial (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectMaterial); }
|
||||
|
||||
//! Returns flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectMaterial() const { return (myFlags & Flags_UseObjectMaterial) != 0; }
|
||||
|
||||
//! Sets texture for filling section created by clipping.
|
||||
void SetTexture (const Handle(Graphic3d_TextureMap)& theTexture) { myTexture = theTexture; }
|
||||
|
||||
//! Returns texture for filling section created by clipping.
|
||||
const Handle(Graphic3d_TextureMap)& Texture() const { return myTexture; }
|
||||
|
||||
//! Sets flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectTexture (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectTexture); }
|
||||
|
||||
//! Returns flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectTexture() const { return (myFlags & Flags_UseObjectTexture) != 0; }
|
||||
|
||||
//! Sets OpenGL/GLSL shader program.
|
||||
void SetShader (const Handle(Graphic3d_ShaderProgram)& theShader) { myShader = theShader; }
|
||||
|
||||
//! Returns OpenGL/GLSL shader program.
|
||||
const Handle(Graphic3d_ShaderProgram)& Shader() const { return myShader; }
|
||||
|
||||
//! Sets flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectShader (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectShader); }
|
||||
|
||||
//! Returns flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectShader() const { return (myFlags & Flags_UseObjectShader) != 0; }
|
||||
|
||||
public:
|
||||
|
||||
//! Sets style of hatch defined by predefined stipple mask.
|
||||
Standard_EXPORT void SetHatchStyle (const Aspect_HatchStyle theStyle);
|
||||
|
||||
//! Sets style of hatch defined by custom stipple mask.
|
||||
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle);
|
||||
|
||||
//! Sets style of hatch defined by texture map (decal texture with alpha channel should be used).
|
||||
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture);
|
||||
|
||||
//! Sets material style for hatch lines (texture).
|
||||
Standard_EXPORT void SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial);
|
||||
|
||||
//! Returns material style for hatch lines (texture).
|
||||
const Graphic3d_MaterialAspect& HatchMaterial() const { return myHatchMaterial; }
|
||||
|
||||
//! Sets boolean flag indicating whether the hatch layer should be drawn or not.
|
||||
Standard_EXPORT void SetToDrawHatch (const Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns boolean flag indicating whether the hatch layer should be drawn or not.
|
||||
Standard_Boolean ToDrawHatch() const { return (myFlags & Flags_DrawHatching) != 0; }
|
||||
|
||||
//! Sets flag controlling behavior of hatch texture mapping on zooming.
|
||||
//! @param theToSet [in] if passed TRUE the texture will keep constant screen-scale independent of zooming.
|
||||
Standard_EXPORT void SetHatchZoomPeristent (const Standard_Boolean theToSet);
|
||||
|
||||
//! Returns value of flag controlling behavior of hatch texture mapping on zooming.
|
||||
Standard_Boolean IsHatchZoomPersistent() { return (myFlags & Flags_HatchZoomPersistent) != 0; }
|
||||
|
||||
//! Sets flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
|
||||
Standard_EXPORT void SetHatchRotationPeristent (const Standard_Boolean theToSet);
|
||||
|
||||
//! Returns value of flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
|
||||
Standard_Boolean IsHatchRotationPersistent() { return (myFlags & Flags_HatchRotationPersistent) != 0; }
|
||||
|
||||
//! Returns true if hatch is defined by texture.
|
||||
Standard_Boolean IsTextureHatch() const { return !myTextureHatch.IsNull(); }
|
||||
|
||||
//! Returns texture map defining the hatch.
|
||||
const Handle(Graphic3d_TextureMap)& TextureHatch() const { return myTextureHatch; }
|
||||
|
||||
//! Returns true if hatch is defined by stipple mask.
|
||||
Standard_Boolean IsStippleHatch() const { return !myStippleHatch.IsNull(); }
|
||||
|
||||
//! Returns the stipple mask.
|
||||
const Handle(Graphic3d_HatchStyle)& StippleHatch() const { return myStippleHatch; }
|
||||
|
||||
//! Returns modification counter for hatching state.
|
||||
Standard_Size HatchingState() const { return myHatchingState; }
|
||||
|
||||
private:
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Flags_None = 0x00, //!< no flags
|
||||
Flags_UseObjectMaterial = 0x01, //!< use object material
|
||||
Flags_UseObjectTexture = 0x02, //!< use object texture
|
||||
Flags_UseObjectShader = 0x04, //!< use object GLSL program
|
||||
Flags_HatchZoomPersistent = 0x08, //!< zoom-persistent texturing
|
||||
Flags_HatchRotationPersistent = 0x10, //!< rotation-persistent texturing
|
||||
Flags_DrawHatching = 0x20, //!< draw hatching
|
||||
Flags_UseObjectProperties = //!< use entire fill area aspect from object
|
||||
Flags_UseObjectMaterial
|
||||
| Flags_UseObjectTexture
|
||||
| Flags_UseObjectShader
|
||||
};
|
||||
|
||||
void setFlag (const Standard_Boolean theToUse, const unsigned int theFlag)
|
||||
{
|
||||
myFlags = theToUse ? myFlags | theFlag : myFlags & ~theFlag;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Graphic3d_MaterialAspect myMaterial;
|
||||
Handle(Graphic3d_TextureMap) myTexture;
|
||||
Handle(Graphic3d_ShaderProgram) myShader;
|
||||
Handle(Graphic3d_HatchStyle) myStippleHatch;
|
||||
Handle(Graphic3d_TextureMap) myTextureHatch;
|
||||
Graphic3d_MaterialAspect myHatchMaterial;
|
||||
unsigned int myFlags;
|
||||
Standard_Size myHatchingState;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Standard_Transient)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_AspectFillCapping, Standard_Transient)
|
||||
|
||||
#endif // _Graphic3d_AspectFillCapping_HeaderFile
|
@@ -1,29 +0,0 @@
|
||||
// Created on: 2016-08-04
|
||||
// Copyright (c) 2016 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_CappingFlags_HeaderFile
|
||||
#define _Graphic3d_CappingFlags_HeaderFile
|
||||
|
||||
//! Enumeration of capping flags.
|
||||
enum Graphic3d_CappingFlags
|
||||
{
|
||||
Graphic3d_CappingFlags_None = 0x0000, //!< no flags
|
||||
Graphic3d_CappingFlags_ObjectMaterial = 0x0001, //!< use object material
|
||||
Graphic3d_CappingFlags_ObjectTexture = 0x0002, //!< use object texture
|
||||
Graphic3d_CappingFlags_ObjectShader = 0x0008, //!< use object GLSL program
|
||||
Graphic3d_CappingFlags_ObjectAspect =
|
||||
Graphic3d_CappingFlags_ObjectMaterial | Graphic3d_CappingFlags_ObjectTexture | Graphic3d_CappingFlags_ObjectShader //!< use entire fill area aspect from object
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_CappingFlags_HeaderFile
|
@@ -19,24 +19,11 @@
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Standard_Atomic.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ClipPlane,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ClipPlane, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
static volatile Standard_Integer THE_CLIP_PLANE_COUNTER = 0;
|
||||
|
||||
static Handle(Graphic3d_AspectFillArea3d) defaultAspect()
|
||||
{
|
||||
const Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
|
||||
anAspect->SetDistinguishOff();
|
||||
anAspect->SetFrontMaterial (aMaterial);
|
||||
anAspect->SetHatchStyle (Aspect_HS_HORIZONTAL);
|
||||
anAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
anAspect->SetInteriorColor (aMaterial.Color());
|
||||
anAspect->SetSuppressBackFaces (false);
|
||||
return anAspect;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -44,69 +31,40 @@ namespace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
: myAspect (defaultAspect()),
|
||||
myPlane (0.0, 0.0, 1.0, 0.0),
|
||||
myEquation (0.0, 0.0, 1.0, 0.0),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
makeId();
|
||||
init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Equation& theEquation)
|
||||
: myAspect (defaultAspect()),
|
||||
myPlane (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w()),
|
||||
myEquation (theEquation),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Equation& theEquation)
|
||||
{
|
||||
makeId();
|
||||
init (gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.a()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient(theOther),
|
||||
myAspect (defaultAspect()),
|
||||
myPlane (theOther.myPlane),
|
||||
myEquation (theOther.myEquation),
|
||||
myFlags (theOther.myFlags),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (theOther.myIsOn),
|
||||
myIsCapping (theOther.myIsCapping)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient (theOther)
|
||||
{
|
||||
makeId();
|
||||
*myAspect = *theOther.CappingAspect();
|
||||
init (theOther.myPlane,
|
||||
theOther.myIsOn,
|
||||
theOther.myIsCapping,
|
||||
theOther.ToOverrideCappingAspect(),
|
||||
theOther.CappingSectionStyle());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
|
||||
: myAspect (defaultAspect()),
|
||||
myPlane (thePlane),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const gp_Pln& thePlane)
|
||||
{
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
makeId();
|
||||
init (thePlane);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -115,23 +73,20 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetEquation (const Equation& theEquation)
|
||||
{
|
||||
myPlane = gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w());
|
||||
myEquation = theEquation;
|
||||
myEquationMod++;
|
||||
myPlane = gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w());
|
||||
myEquation = theEquation;
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPlane
|
||||
// function : SetEquation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetEquation (const gp_Pln& thePlane)
|
||||
{
|
||||
myPlane = thePlane;
|
||||
thePlane.Coefficients (myEquation[0],
|
||||
myEquation[1],
|
||||
myEquation[2],
|
||||
myEquation[3]);
|
||||
myEquationMod++;
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -162,107 +117,100 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingMaterial
|
||||
// function : SetCappingSectionStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
void Graphic3d_ClipPlane::SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
myAspect->SetFrontMaterial (theMat);
|
||||
myAspect->SetInteriorColor (theMat.Color());
|
||||
++myAspectMod;
|
||||
mySectionStyle = theStyle;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingTexture
|
||||
// function : OrientationMatrix
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
const Graphic3d_Mat4& Graphic3d_ClipPlane::OrientationMatrix() const
|
||||
{
|
||||
myAspect->SetTextureMap (theTexture);
|
||||
if (!theTexture.IsNull())
|
||||
if (myOrientationDirty)
|
||||
{
|
||||
myAspect->SetTextureMapOn();
|
||||
const Standard_ShortReal aDirection[] = {
|
||||
static_cast<Standard_ShortReal> (myEquation[0]),
|
||||
static_cast<Standard_ShortReal> (myEquation[1]),
|
||||
static_cast<Standard_ShortReal> (myEquation[2])
|
||||
};
|
||||
|
||||
const Standard_ShortReal aTranslate[] = {
|
||||
static_cast<Standard_ShortReal> (myEquation[0] * -myEquation[3]),
|
||||
static_cast<Standard_ShortReal> (myEquation[1] * -myEquation[3]),
|
||||
static_cast<Standard_ShortReal> (myEquation[2] * -myEquation[3])
|
||||
};
|
||||
|
||||
Standard_ShortReal aSide1[] = { 0.0f, 0.0f, 0.0f };
|
||||
Standard_ShortReal aSide2[] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
const Standard_ShortReal aMagintude = static_cast<Standard_ShortReal> (Sqrt (myEquation[0] * myEquation[0] + myEquation[2] * myEquation[2]));
|
||||
|
||||
if (aMagintude < ShortRealSmall())
|
||||
{
|
||||
aSide1[0] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
aSide1[0] = aDirection[2] / aMagintude;
|
||||
aSide1[2] = -aDirection[0] / aMagintude;
|
||||
}
|
||||
|
||||
aSide2[0] = (-aSide1[1] * aDirection[2]) - (-aSide1[2] * aDirection[1]);
|
||||
aSide2[1] = (-aSide1[2] * aDirection[0]) - (-aSide1[0] * aDirection[2]);
|
||||
aSide2[2] = (-aSide1[0] * aDirection[1]) - (-aSide1[1] * aDirection[0]);
|
||||
|
||||
myOrientationMat.SetValue (0, 0, aSide1[0]);
|
||||
myOrientationMat.SetValue (1, 0, aSide1[1]);
|
||||
myOrientationMat.SetValue (2, 0, aSide1[2]);
|
||||
myOrientationMat.SetValue (3, 0, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 1, aDirection[0]);
|
||||
myOrientationMat.SetValue (1, 1, aDirection[1]);
|
||||
myOrientationMat.SetValue (2, 1, aDirection[2]);
|
||||
myOrientationMat.SetValue (3, 1, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 2, aSide2[0]);
|
||||
myOrientationMat.SetValue (1, 2, aSide2[1]);
|
||||
myOrientationMat.SetValue (2, 2, aSide2[2]);
|
||||
myOrientationMat.SetValue (3, 2, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 3, aTranslate[0]);
|
||||
myOrientationMat.SetValue (1, 3, aTranslate[1]);
|
||||
myOrientationMat.SetValue (2, 3, aTranslate[2]);
|
||||
myOrientationMat.SetValue (3, 3, 1.0F);
|
||||
|
||||
myOrientationDirty = Standard_False;
|
||||
}
|
||||
else
|
||||
|
||||
return myOrientationMat;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::init (const gp_Pln& thePlane,
|
||||
const Standard_Boolean theIsOn,
|
||||
const Standard_Boolean theIsCapping,
|
||||
const Standard_Boolean theOverrideStyle,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
if (myEntityUID.IsEmpty())
|
||||
{
|
||||
myAspect->SetTextureMapOff();
|
||||
myEntityUID = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatch (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
myAspect->SetHatchStyle (theStyle);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingCustomHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle)
|
||||
{
|
||||
myAspect->SetHatchStyle (theStyle);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOn
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOn()
|
||||
{
|
||||
myAspect->SetInteriorStyle (Aspect_IS_HATCH);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOff
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOff()
|
||||
{
|
||||
myAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
||||
{
|
||||
myAspect = theAspect;
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : setCappingFlag
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::setCappingFlag (bool theToUse, int theFlag)
|
||||
{
|
||||
if (theToUse)
|
||||
{
|
||||
myFlags |= theFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFlags &= ~(theFlag);
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : makeId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::makeId()
|
||||
{
|
||||
myId = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
myPlane = thePlane;
|
||||
myPlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
myIsOn = theIsOn;
|
||||
myIsCapping = theIsCapping;
|
||||
myOverrideObjectStyle = theOverrideStyle;
|
||||
mySectionStyle = theStyle.IsNull() ? new Graphic3d_AspectFillCapping() : theStyle;
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
@@ -17,14 +17,16 @@
|
||||
#define _Graphic3d_ClipPlane_HeaderFile
|
||||
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_CappingFlags.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_Mat4.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_Vec4.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
//! Container for properties describing graphic driver clipping planes.
|
||||
//! It is up to application to create instances of this class and specify its
|
||||
@@ -45,6 +47,8 @@ public:
|
||||
|
||||
typedef NCollection_Vec4<Standard_Real> Equation;
|
||||
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
//! Initializes clip plane container with the following properties:
|
||||
//! - Equation (0.0, 0.0, 1.0, 0)
|
||||
@@ -58,7 +62,7 @@ public:
|
||||
|
||||
//! Copy constructor.
|
||||
//! @param theOther [in] the copied plane.
|
||||
Standard_EXPORT Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther);
|
||||
Standard_EXPORT Graphic3d_ClipPlane (const Graphic3d_ClipPlane& theOther);
|
||||
|
||||
//! Construct clip plane for the passed equation.
|
||||
//! By default the plane is on, capping is turned off.
|
||||
@@ -82,37 +86,17 @@ public:
|
||||
|
||||
//! Get 4-component equation vector for clipping plane.
|
||||
//! @return clipping plane equation vector.
|
||||
const Equation& GetEquation() const
|
||||
{
|
||||
return myEquation;
|
||||
}
|
||||
const Equation& GetEquation() const { return myEquation; }
|
||||
|
||||
//! Check that the clipping plane is turned on.
|
||||
//! @return boolean flag indicating whether the plane is in on or off state.
|
||||
Standard_Boolean IsOn() const
|
||||
{
|
||||
return myIsOn;
|
||||
}
|
||||
Standard_Boolean IsOn() const { return myIsOn; }
|
||||
|
||||
//! Change state of the clipping plane.
|
||||
//! @param theIsOn [in] the flag specifying whether the graphic driver
|
||||
//! clipping by this plane should be turned on or off.
|
||||
Standard_EXPORT void SetOn(const Standard_Boolean theIsOn);
|
||||
|
||||
//! Change state of capping surface rendering.
|
||||
//! @param theIsOn [in] the flag specifying whether the graphic driver should
|
||||
//! perform rendering of capping surface produced by this plane. The graphic
|
||||
//! driver produces this surface for convex graphics by means of stencil-test
|
||||
//! and multi-pass rendering.
|
||||
Standard_EXPORT void SetCapping(const Standard_Boolean theIsOn);
|
||||
|
||||
//! Check state of capping surface rendering.
|
||||
//! @return true (turned on) or false depending on the state.
|
||||
Standard_Boolean IsCapping() const
|
||||
{
|
||||
return myIsCapping;
|
||||
}
|
||||
|
||||
//! Get geometrical definition.
|
||||
//! @return geometrical definition of clipping plane
|
||||
const gp_Pln& ToPlane() const { return myPlane; }
|
||||
@@ -123,45 +107,6 @@ public:
|
||||
//! @return new instance of clipping plane with same properties and attributes.
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ClipPlane) Clone() const;
|
||||
|
||||
public: // @name user-defined graphical attributes
|
||||
|
||||
//! Set material for rendering capping surface.
|
||||
//! @param theMat [in] the material.
|
||||
Standard_EXPORT void SetCappingMaterial (const Graphic3d_MaterialAspect& theMat);
|
||||
|
||||
//! @return capping material.
|
||||
const Graphic3d_MaterialAspect& CappingMaterial() const { return myAspect->FrontMaterial(); }
|
||||
|
||||
//! Set texture to be applied on capping surface.
|
||||
//! @param theTexture [in] the texture.
|
||||
Standard_EXPORT void SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture);
|
||||
|
||||
//! @return capping texture map.
|
||||
const Handle(Graphic3d_TextureMap)& CappingTexture() const { return myAspect->TextureMap(); }
|
||||
|
||||
//! Set hatch style (stipple) and turn hatching on.
|
||||
//! @param theStyle [in] the hatch style.
|
||||
Standard_EXPORT void SetCappingHatch (const Aspect_HatchStyle theStyle);
|
||||
|
||||
//! @return hatching style.
|
||||
Aspect_HatchStyle CappingHatch() const { return (Aspect_HatchStyle)myAspect->HatchStyle()->HatchType(); }
|
||||
|
||||
//! Set custom hatch style (stipple) and turn hatching on.
|
||||
//! @param theStyle [in] the hatch pattern.
|
||||
Standard_EXPORT void SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle);
|
||||
|
||||
//! @return hatching style.
|
||||
const Handle(Graphic3d_HatchStyle)& CappingCustomHatch() const { return myAspect->HatchStyle(); }
|
||||
|
||||
//! Turn on hatching.
|
||||
Standard_EXPORT void SetCappingHatchOn();
|
||||
|
||||
//! Turn off hatching.
|
||||
Standard_EXPORT void SetCappingHatchOff();
|
||||
|
||||
//! @return True if hatching mask is turned on.
|
||||
Standard_Boolean IsHatchOn() const { return myAspect->InteriorStyle() == Aspect_IS_HATCH; }
|
||||
|
||||
//! This ID is used for managing associated resources in graphical driver.
|
||||
//! The clip plane can be assigned within a range of IO which can be
|
||||
//! displayed in separate OpenGl contexts. For each of the context an associated
|
||||
@@ -169,81 +114,61 @@ public: // @name user-defined graphical attributes
|
||||
//! The resources are stored in graphical driver for each of individual groups
|
||||
//! of shared context under the clip plane identifier.
|
||||
//! @return clip plane resource identifier string.
|
||||
const TCollection_AsciiString& GetId() const
|
||||
{
|
||||
return myId;
|
||||
}
|
||||
const TCollection_AsciiString& GetId() const { return myEntityUID; }
|
||||
|
||||
public:
|
||||
|
||||
//! Return capping aspect.
|
||||
//! @return capping surface rendering aspect.
|
||||
const Handle(Graphic3d_AspectFillArea3d)& CappingAspect() const { return myAspect; }
|
||||
//! Change state of capping surface rendering.
|
||||
//! @param theIsOn [in] the flag specifying whether the graphic driver should
|
||||
//! perform rendering of capping surface produced by this plane. The graphic
|
||||
//! driver produces this surface for convex graphics by means of stencil-test
|
||||
//! and multi-pass rendering.
|
||||
Standard_EXPORT void SetCapping(const Standard_Boolean theIsOn);
|
||||
|
||||
//! Assign capping aspect.
|
||||
Standard_EXPORT void SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
|
||||
//! Check state of capping surface rendering.
|
||||
//! @return true (turned on) or false depending on the state.
|
||||
Standard_Boolean IsCapping() const { return myIsCapping; }
|
||||
|
||||
//! Flag indicating whether material for capping plane should be taken from object.
|
||||
//! Default value: FALSE (use dedicated capping plane material).
|
||||
bool ToUseObjectMaterial() const { return (myFlags & Graphic3d_CappingFlags_ObjectMaterial) != 0; }
|
||||
//! Sets clipping section filling aspect.
|
||||
Standard_EXPORT void SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
|
||||
|
||||
//! Set flag for controlling the source of capping plane material.
|
||||
void SetUseObjectMaterial (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectMaterial); }
|
||||
//! Returns style used for drawing capping section.
|
||||
const Handle(Graphic3d_AspectFillCapping)& CappingSectionStyle() const { return mySectionStyle; }
|
||||
|
||||
//! Flag indicating whether texture for capping plane should be taken from object.
|
||||
//! Default value: FALSE.
|
||||
bool ToUseObjectTexture() const { return (myFlags & Graphic3d_CappingFlags_ObjectTexture) != 0; }
|
||||
//! Flag indicating whether section style of the plane should overrides similar property of object presentation.
|
||||
//! Default value: FALSE (use dedicated presentation aspect style).
|
||||
bool ToOverrideCappingAspect() const { return myOverrideObjectStyle; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane texture.
|
||||
void SetUseObjectTexture (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectTexture); }
|
||||
//! Sets flag for controlling the preference of using section style between clip plane and object.
|
||||
void SetToOverrideCappingAspect (const bool theToOverride) { myOverrideObjectStyle = theToOverride; }
|
||||
|
||||
//! Flag indicating whether shader program for capping plane should be taken from object.
|
||||
//! Default value: FALSE.
|
||||
bool ToUseObjectShader() const { return (myFlags & Graphic3d_CappingFlags_ObjectShader) != 0; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane shader program.
|
||||
void SetUseObjectShader(bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectShader); }
|
||||
|
||||
//! Return true if some fill area aspect properties should be taken from object.
|
||||
bool ToUseObjectProperties() const { return myFlags != Graphic3d_CappingFlags_None; }
|
||||
|
||||
public: // @name modification counters
|
||||
|
||||
//! @return modification counter for equation.
|
||||
unsigned int MCountEquation() const
|
||||
{
|
||||
return myEquationMod;
|
||||
}
|
||||
|
||||
//! @return modification counter for aspect.
|
||||
unsigned int MCountAspect() const
|
||||
{
|
||||
return myAspectMod;
|
||||
}
|
||||
//! Returns plane's orientation matrix.
|
||||
Standard_EXPORT const Graphic3d_Mat4& OrientationMatrix() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Generate unique object id for OpenGL graphic resource manager.
|
||||
void makeId();
|
||||
|
||||
//! Set capping flag.
|
||||
Standard_EXPORT void setCappingFlag (bool theToUse, int theFlag);
|
||||
//! Initializes plane and makes unique identifier (UID) to differentiate clipping plane entities.
|
||||
void init (const gp_Pln& thePlane = gp_Pln(),
|
||||
const Standard_Boolean theIsOn = Standard_True,
|
||||
const Standard_Boolean theIsCapping = Standard_False,
|
||||
const Standard_Boolean theOverrideStyle = Standard_False,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theStyle = Handle(Graphic3d_AspectFillCapping)());
|
||||
|
||||
private:
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect; //!< fill area aspect
|
||||
TCollection_AsciiString myId; //!< resource id
|
||||
gp_Pln myPlane; //!< plane definition
|
||||
Equation myEquation; //!< plane equation vector
|
||||
unsigned int myFlags; //!< capping flags
|
||||
unsigned int myEquationMod; //!< modification counter for equation
|
||||
unsigned int myAspectMod; //!< modification counter of aspect
|
||||
Standard_Boolean myIsOn; //!< state of the clipping plane
|
||||
Standard_Boolean myIsCapping; //!< state of graphic driver capping
|
||||
TCollection_AsciiString myEntityUID; //!< Unique identifier for the plane
|
||||
gp_Pln myPlane; //!< Plane definition
|
||||
Equation myEquation; //!< Plane equation vector
|
||||
Standard_Boolean myIsOn; //!< State of the clipping plane
|
||||
Standard_Boolean myIsCapping; //!< State of graphic driver capping
|
||||
Standard_Boolean myOverrideObjectStyle; //!< Flag forcing to use plane's section style rather than section style defined for object
|
||||
Handle(Graphic3d_AspectFillCapping) mySectionStyle; //!< Style set for drawing capped solid section.
|
||||
mutable Standard_Boolean myOrientationDirty; //!< Boolean flag indicating whether orientation matrix is dirty or not.
|
||||
mutable Graphic3d_Mat4 myOrientationMat; //!< Plane orientation matrix (for visualization purposes).
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_ClipPlane,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT (Graphic3d_ClipPlane, Standard_Transient)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_ClipPlane, Standard_Transient)
|
||||
|
@@ -231,10 +231,11 @@ Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_Gr
|
||||
// function : GroupPrimitivesAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
||||
const Handle(Graphic3d_AspectText3d)& theAspText,
|
||||
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
|
||||
void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
||||
const Handle(Graphic3d_AspectText3d)& theAspText,
|
||||
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theAspCapping) const
|
||||
{
|
||||
if (!theAspLine.IsNull())
|
||||
{
|
||||
@@ -271,6 +272,15 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d
|
||||
*theAspFill.operator->() = *aFillAspect;
|
||||
}
|
||||
}
|
||||
|
||||
if (!theAspCapping.IsNull())
|
||||
{
|
||||
Handle(Graphic3d_AspectFillCapping) aCappingAspect = FillCappingAspect();
|
||||
if (!aCappingAspect.IsNull())
|
||||
{
|
||||
*theAspCapping.operator->() = *aCappingAspect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -17,31 +17,31 @@
|
||||
#ifndef _Graphic3d_Group_HeaderFile
|
||||
#define _Graphic3d_Group_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_BndBox4f.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Graphic3d_TextPath.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
#include <Graphic3d_TypeOfPrimitiveArray.hxx>
|
||||
#include <Graphic3d_IndexBuffer.hxx>
|
||||
#include <Graphic3d_Buffer.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_BndBox4f.hxx>
|
||||
#include <Graphic3d_BoundBuffer.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Graphic3d_Buffer.hxx>
|
||||
#include <Graphic3d_GroupAspect.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_IndexBuffer.hxx>
|
||||
#include <Graphic3d_TextPath.hxx>
|
||||
#include <Graphic3d_TypeOfPrimitiveArray.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
@@ -57,7 +57,7 @@ class Graphic3d_ArrayOfPrimitives;
|
||||
//! 1) Non-modifiable, or unbounded, group ('black box').
|
||||
//! Developers can repeat a sequence of
|
||||
//! SetPrimitivesAspect() with AddPrimitiveArray() methods arbitrary number of times
|
||||
//! to define arbitrary number of primitive "blocks" each having individual apect values.
|
||||
//! to define arbitrary number of primitive "blocks" each having individual aspect values.
|
||||
//! Any modification of such a group is forbidden, as aspects and primitives are mixed
|
||||
//! in memory without any high-level logical structure, and any modification is very likely to result
|
||||
//! in corruption of the group internal data.
|
||||
@@ -83,7 +83,7 @@ class Graphic3d_Group : public MMgt_TShared
|
||||
|
||||
public:
|
||||
|
||||
//! Supress all primitives and attributes of <me>.
|
||||
//! Suppress all primitives and attributes of <me>.
|
||||
//! To clear group without update in Graphic3d_StructureManager
|
||||
//! pass Standard_False as <theUpdateStructureMgr>. This
|
||||
//! used on context and viewer destruction, when the pointer
|
||||
@@ -92,13 +92,13 @@ public:
|
||||
//! cross-reference);
|
||||
Standard_EXPORT virtual void Clear (const Standard_Boolean theUpdateStructureMgr = Standard_True);
|
||||
|
||||
//! Supress the group <me> in the structure.
|
||||
//! Suppress the group <me> in the structure.
|
||||
Standard_EXPORT virtual ~Graphic3d_Group();
|
||||
|
||||
//! Supress the group <me> in the structure.
|
||||
//! Suppress the group <me> in the structure.
|
||||
//! Warning: No more graphic operations in <me> after this call.
|
||||
//! Modifies the current modelling transform persistence (pan, zoom or rotate)
|
||||
//! Get the current modelling transform persistence (pan, zoom or rotate)
|
||||
//! Modifies the current modeling transform persistence (pan, zoom or rotate)
|
||||
//! Get the current modeling transform persistence (pan, zoom or rotate)
|
||||
Standard_EXPORT void Remove();
|
||||
|
||||
public:
|
||||
@@ -127,6 +127,12 @@ public:
|
||||
//! Modifies the context for all the marker primitives of the group.
|
||||
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) = 0;
|
||||
|
||||
//! Returns style of filling clipping sections on closed shell primitives.
|
||||
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const = 0;
|
||||
|
||||
//! Modifies the context for filling clipping section for all closed shell primitives of the group.
|
||||
virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect) = 0;
|
||||
|
||||
//! Modifies the current context of the group to give
|
||||
//! another aspect for all the line primitives created
|
||||
//! after this call in the group.
|
||||
@@ -154,15 +160,17 @@ public:
|
||||
Standard_EXPORT void GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
||||
const Handle(Graphic3d_AspectText3d)& theAspText,
|
||||
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const;
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theAspFillCapping) const;
|
||||
|
||||
//! Returns the last inserted context in the group for each kind of primitives.
|
||||
void PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
||||
const Handle(Graphic3d_AspectText3d)& theAspText,
|
||||
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
|
||||
void PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
||||
const Handle(Graphic3d_AspectText3d)& theAspText,
|
||||
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theAspFill,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theAspFillCapping) const
|
||||
{
|
||||
GroupPrimitivesAspect (theAspLine, theAspText, theAspMarker, theAspFill);
|
||||
GroupPrimitivesAspect (theAspLine, theAspText, theAspMarker, theAspFill, theAspFillCapping);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@@ -21,13 +21,15 @@
|
||||
//! - ASPECT_LINE: aspect for line primitives;
|
||||
//! - ASPECT_TEXT: aspect for text primitives;
|
||||
//! - ASPECT_MARKER: aspect for marker primitives;
|
||||
//! - ASPECT_FILL_AREA: aspect for face primitives.
|
||||
//! - ASPECT_FILL_AREA: aspect for face primitives;
|
||||
//! - Graphic3d_ASPECT_FILL_CAPPING: aspect for filling clipping sections.
|
||||
enum Graphic3d_GroupAspect
|
||||
{
|
||||
Graphic3d_ASPECT_LINE,
|
||||
Graphic3d_ASPECT_TEXT,
|
||||
Graphic3d_ASPECT_MARKER,
|
||||
Graphic3d_ASPECT_FILL_AREA
|
||||
Graphic3d_ASPECT_LINE,
|
||||
Graphic3d_ASPECT_TEXT,
|
||||
Graphic3d_ASPECT_MARKER,
|
||||
Graphic3d_ASPECT_FILL_AREA,
|
||||
Graphic3d_ASPECT_FILL_CAPPING
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_GroupAspect_HeaderFile
|
||||
|
@@ -48,6 +48,8 @@ public:
|
||||
Graphic3d_RenderingParams()
|
||||
: Method (Graphic3d_RM_RASTERIZATION),
|
||||
NbMsaaSamples (0),
|
||||
IsOitEnabled (Standard_True),
|
||||
OitDepthWeight (0.0f),
|
||||
// ray tracing parameters
|
||||
IsGlobalIlluminationEnabled (Standard_False),
|
||||
RaytracingDepth (THE_DEFAULT_DEPTH),
|
||||
@@ -90,6 +92,8 @@ public:
|
||||
|
||||
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
||||
Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default
|
||||
Standard_Boolean IsOitEnabled; //!< enables/disables order-independent transparency for rasterization, True by default
|
||||
Standard_ShortReal OitDepthWeight; //!< scalar factor [0-1] controlling influence of depth of a fragment to its final coverage
|
||||
|
||||
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
||||
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
||||
|
@@ -291,7 +291,7 @@ public:
|
||||
|
||||
//! Compute per-element multiplication.
|
||||
//! @param theFactor [in] the scale factor.
|
||||
//! @return the result of multiplicaton.
|
||||
//! @return the result of multiplication.
|
||||
NCollection_Mat4 operator* (const Element_t theFactor) const
|
||||
{
|
||||
return Multiplied (theFactor);
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
|
||||
//! Compute per-element multiplication.
|
||||
//! @param theFactor [in] the scale factor.
|
||||
//! @return the result of multiplicaton.
|
||||
//! @return the result of multiplication.
|
||||
NCollection_Mat4 Multiplied (const Element_t theFactor) const
|
||||
{
|
||||
NCollection_Mat4 aTempMat (*this);
|
||||
|
@@ -6,6 +6,8 @@ OpenGl_ArbTBO.hxx
|
||||
OpenGl_ArbTexBindless.hxx
|
||||
OpenGl_AspectFace.cxx
|
||||
OpenGl_AspectFace.hxx
|
||||
OpenGl_AspectFillCapping.cxx
|
||||
OpenGl_AspectFillCapping.hxx
|
||||
OpenGl_AspectLine.cxx
|
||||
OpenGl_AspectLine.hxx
|
||||
OpenGl_AspectMarker.cxx
|
||||
@@ -63,10 +65,8 @@ OpenGl_BVHClipPrimitiveTrsfPersSet.cxx
|
||||
OpenGl_BVHClipPrimitiveTrsfPersSet.hxx
|
||||
OpenGl_BVHTreeSelector.cxx
|
||||
OpenGl_BVHTreeSelector.hxx
|
||||
OpenGl_CappingAlgo.cxx
|
||||
OpenGl_CappingAlgo.hxx
|
||||
OpenGl_CappingPlaneResource.cxx
|
||||
OpenGl_CappingPlaneResource.hxx
|
||||
OpenGl_CappingRenderer.cxx
|
||||
OpenGl_CappingRenderer.hxx
|
||||
OpenGl_Caps.cxx
|
||||
OpenGl_Caps.hxx
|
||||
OpenGl_Clipping.cxx
|
||||
@@ -104,6 +104,7 @@ OpenGl_IndexBuffer.cxx
|
||||
OpenGl_IndexBuffer.hxx
|
||||
OpenGl_Layer.cxx
|
||||
OpenGl_Layer.hxx
|
||||
OpenGl_OitUniformState.hxx
|
||||
OpenGl_RenderFilter.cxx
|
||||
OpenGl_RenderFilter.hxx
|
||||
OpenGl_Sampler.cxx
|
||||
|
247
src/OpenGl/OpenGl_AspectFillCapping.cxx
Normal file
247
src/OpenGl/OpenGl_AspectFillCapping.cxx
Normal file
@@ -0,0 +1,247 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 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 <OpenGl_AspectFillCapping.hxx>
|
||||
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) defaultMaterial()
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect;
|
||||
const Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
|
||||
anAspect = new Graphic3d_AspectFillArea3d();
|
||||
anAspect->SetDistinguishOff();
|
||||
anAspect->SetFrontMaterial (aMaterial);
|
||||
anAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
anAspect->SetInteriorColor (aMaterial.Color());
|
||||
anAspect->SetSuppressBackFaces (false);
|
||||
return anAspect;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_AspectFillCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_AspectFillCapping::OpenGl_AspectFillCapping (const Handle(Graphic3d_AspectFillCapping)& theAspect)
|
||||
: myCappingAspect (defaultMaterial()),
|
||||
myHatchingAspect (defaultMaterial()),
|
||||
myHatchingState (0)
|
||||
{
|
||||
SetAspect (theAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ~OpenGl_AspectFillCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_AspectFillCapping::~OpenGl_AspectFillCapping()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_AspectFillCapping::SetAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect)
|
||||
{
|
||||
myAspect = theAspect;
|
||||
|
||||
if (theAspect.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theAspect->ToUseObjectMaterial()
|
||||
|| !theAspect->ToUseObjectTexture()
|
||||
|| !theAspect->ToUseObjectShader())
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillAspect = myCappingAspect.Aspect();
|
||||
|
||||
if (!theAspect->ToUseObjectMaterial())
|
||||
{
|
||||
aFillAspect->SetFrontMaterial (theAspect->Material());
|
||||
aFillAspect->SetInteriorColor (theAspect->Material().Color());
|
||||
}
|
||||
|
||||
if (!theAspect->ToUseObjectTexture())
|
||||
{
|
||||
aFillAspect->SetTextureMap (theAspect->Texture());
|
||||
|
||||
if (!theAspect->Texture().IsNull())
|
||||
{
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMap (Handle(Graphic3d_TextureMap)());
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
|
||||
if (!theAspect->ToUseObjectShader())
|
||||
{
|
||||
aFillAspect->SetShaderProgram (theAspect->Shader());
|
||||
}
|
||||
|
||||
myCappingAspect.SetAspect (aFillAspect);
|
||||
}
|
||||
|
||||
if (theAspect->ToDrawHatch()
|
||||
&& (theAspect->IsTextureHatch()
|
||||
|| theAspect->IsStippleHatch()))
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillAspect = myHatchingAspect.Aspect();
|
||||
|
||||
aFillAspect->SetInteriorStyle (theAspect->IsStippleHatch() ? Aspect_IS_HATCH : Aspect_IS_SOLID);
|
||||
aFillAspect->SetHatchStyle (theAspect->IsStippleHatch() ? theAspect->StippleHatch() : Handle(Graphic3d_HatchStyle)());
|
||||
aFillAspect->SetTextureMap (theAspect->IsTextureHatch() ? theAspect->TextureHatch() : Handle(Graphic3d_TextureMap)());
|
||||
aFillAspect->SetFrontMaterial (theAspect->HatchMaterial());
|
||||
aFillAspect->SetInteriorColor (theAspect->HatchMaterial().Color());
|
||||
if (theAspect->IsTextureHatch())
|
||||
{
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
|
||||
myHatchingAspect.SetAspect (aFillAspect);
|
||||
myHatchingState = theAspect->HatchingState();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_AspectFillCapping::Release (OpenGl_Context* theContext)
|
||||
{
|
||||
myCappingAspect .Release (theContext);
|
||||
myHatchingAspect.Release (theContext);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CappingFaceAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const OpenGl_AspectFace* OpenGl_AspectFillCapping::CappingFaceAspect (const OpenGl_AspectFace* theObjectAspect) const
|
||||
{
|
||||
if (myAspect.IsNull())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillAspect = myCappingAspect.Aspect();
|
||||
|
||||
if (myAspect->ToUseObjectMaterial() && theObjectAspect != NULL)
|
||||
{
|
||||
// only front material currently supported by capping rendering
|
||||
aFillAspect->SetFrontMaterial (theObjectAspect->Aspect()->FrontMaterial());
|
||||
aFillAspect->SetInteriorColor (theObjectAspect->Aspect()->InteriorColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetFrontMaterial (myAspect->Material());
|
||||
aFillAspect->SetInteriorColor (myAspect->Material().Color());
|
||||
}
|
||||
|
||||
if (myAspect->ToUseObjectTexture() && theObjectAspect != NULL)
|
||||
{
|
||||
if (theObjectAspect->Aspect()->ToMapTexture())
|
||||
{
|
||||
aFillAspect->SetTextureMap (theObjectAspect->Aspect()->TextureMap());
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMap (myAspect->Texture());
|
||||
if (!myAspect->Texture().IsNull())
|
||||
{
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
}
|
||||
|
||||
if (myAspect->ToUseObjectShader() && theObjectAspect != NULL)
|
||||
{
|
||||
aFillAspect->SetShaderProgram (theObjectAspect->Aspect()->ShaderProgram());
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetShaderProgram (myAspect->Shader());
|
||||
}
|
||||
|
||||
myCappingAspect.SetAspect (aFillAspect);
|
||||
|
||||
return &myCappingAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : HatchingFaceAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const OpenGl_AspectFace* OpenGl_AspectFillCapping::HatchingFaceAspect() const
|
||||
{
|
||||
if (myAspect.IsNull())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const Standard_Size aHatchingState = myAspect->HatchingState();
|
||||
if (myHatchingState != aHatchingState)
|
||||
{
|
||||
if (myAspect->ToDrawHatch())
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) aFillAspect = myHatchingAspect.Aspect();
|
||||
|
||||
aFillAspect->SetInteriorStyle (myAspect->IsStippleHatch() ? Aspect_IS_HATCH : Aspect_IS_SOLID);
|
||||
aFillAspect->SetHatchStyle (myAspect->IsStippleHatch() ? myAspect->StippleHatch() : Handle(Graphic3d_HatchStyle)());
|
||||
aFillAspect->SetTextureMap (myAspect->IsTextureHatch() ? myAspect->TextureHatch() : Handle(Graphic3d_TextureMap)());
|
||||
aFillAspect->SetFrontMaterial (myAspect->HatchMaterial());
|
||||
aFillAspect->SetInteriorColor (myAspect->HatchMaterial().Color());
|
||||
if (myAspect->IsTextureHatch())
|
||||
{
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
|
||||
myHatchingAspect.SetAspect (aFillAspect);
|
||||
myHatchingState = aHatchingState;
|
||||
}
|
||||
}
|
||||
|
||||
return &myHatchingAspect;
|
||||
}
|
70
src/OpenGl/OpenGl_AspectFillCapping.hxx
Normal file
70
src/OpenGl/OpenGl_AspectFillCapping.hxx
Normal file
@@ -0,0 +1,70 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_AspectFillCapping_Header
|
||||
#define _OpenGl_AspectFillCapping_Header
|
||||
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_Resource.hxx>
|
||||
|
||||
//! Gl resource holding particular aspects for filling capping.
|
||||
class OpenGl_AspectFillCapping : public OpenGl_Resource
|
||||
{
|
||||
public:
|
||||
|
||||
//! Create and assign style.
|
||||
Standard_EXPORT OpenGl_AspectFillCapping (const Handle(Graphic3d_AspectFillCapping)& theAspect);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT ~OpenGl_AspectFillCapping();
|
||||
|
||||
//! Assign section style.
|
||||
Standard_EXPORT void SetAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect);
|
||||
|
||||
//! Returns section style parameters.
|
||||
const Handle(Graphic3d_AspectFillCapping)& Aspect() const { return myAspect; }
|
||||
|
||||
//! Release any allocated GL resources.
|
||||
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
|
||||
|
||||
//! Returns true if capping should draw hatch layer.
|
||||
Standard_Boolean ToDrawHatch() const
|
||||
{
|
||||
return myAspect->ToDrawHatch()
|
||||
&& (myAspect->IsStippleHatch()
|
||||
|| myAspect->IsTextureHatch());
|
||||
}
|
||||
|
||||
//! Returns the shading aspect for drawing face of a clipping section itself.
|
||||
//! @param theObjectAspect [in] the aspect of an object if it requires combining.
|
||||
Standard_EXPORT const OpenGl_AspectFace* CappingFaceAspect (const OpenGl_AspectFace* theObjectAspect) const;
|
||||
|
||||
//! Returns the shading aspect for drawing hatch layer of a section.
|
||||
Standard_EXPORT const OpenGl_AspectFace* HatchingFaceAspect() const;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectFillCapping) myAspect; //!< Section style settings from application's level.
|
||||
mutable OpenGl_AspectFace myCappingAspect; //!< GL aspect for shading base layer of a capping section.
|
||||
mutable OpenGl_AspectFace myHatchingAspect; //!< GL aspect for shading hatching layer (additional to base) of a capping section.
|
||||
mutable Standard_Size myHatchingState;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
};
|
||||
|
||||
#endif //_OpenGl_AspectFillCapping_Header
|
@@ -19,6 +19,7 @@
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Graphic3d_TypeOfBackground.hxx>
|
||||
#include <Graphic3d_TransformPers.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
|
@@ -1,223 +0,0 @@
|
||||
// Created on: 2013-09-05
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-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 <OpenGl_CappingAlgo.hxx>
|
||||
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_CappingPlaneResource.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_CappingAlgoFilter,OpenGl_RenderFilter)
|
||||
|
||||
namespace
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
|
||||
static const GLint THE_FILLPRIM_TO = GL_POLYGON;
|
||||
#else
|
||||
static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
|
||||
static const GLint THE_FILLPRIM_TO = GL_TRIANGLE_FAN;
|
||||
#endif
|
||||
|
||||
//! Render infinite capping plane.
|
||||
//! @param theWorkspace [in] the GL workspace, context state.
|
||||
//! @param thePlane [in] the graphical plane, for which the capping surface is rendered.
|
||||
static void renderPlane (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Handle(OpenGl_CappingPlaneResource)& thePlane,
|
||||
const OpenGl_AspectFace* theAspectFace)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
thePlane->Update (aContext, theAspectFace != NULL ? theAspectFace->Aspect() : Handle(Graphic3d_AspectFillArea3d)());
|
||||
|
||||
const OpenGl_AspectFace* aFaceAspect = theWorkspace->AspectFace();
|
||||
theWorkspace->SetAspectFace (thePlane->AspectFace());
|
||||
|
||||
// set identity model matrix
|
||||
aContext->ModelWorldState.Push();
|
||||
aContext->ModelWorldState.SetCurrent (OpenGl_Mat4::Map (*thePlane->Orientation()->mat));
|
||||
aContext->ApplyModelViewMatrix();
|
||||
|
||||
thePlane->Primitives().Render (theWorkspace);
|
||||
|
||||
aContext->ModelWorldState.Pop();
|
||||
aContext->ApplyModelViewMatrix();
|
||||
|
||||
theWorkspace->SetAspectFace (aFaceAspect);
|
||||
}
|
||||
|
||||
//! Render capping for specific structure.
|
||||
static void renderCappingForStructure (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure,
|
||||
const OpenGl_ClippingIterator& thePlaneIter,
|
||||
const Handle(OpenGl_CappingPlaneResource)& thePlane)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
const Handle(Graphic3d_ClipPlane)& aRenderPlane = thePlane->Plane();
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (theStructure.Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value()->IsClosed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// enable only the rendering plane to generate stencil mask
|
||||
aContext->ChangeClipping().DisableAllExcept (aContext, thePlaneIter);
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
glClear (GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// override aspects, disable culling
|
||||
theWorkspace->SetAspectFace (&theWorkspace->NoneCulling());
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
// evaluate number of pair faces
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDepthMask (GL_FALSE);
|
||||
glStencilFunc (GL_ALWAYS, 1, 0x01);
|
||||
glStencilOp (GL_KEEP, GL_INVERT, GL_INVERT);
|
||||
|
||||
// render closed primitives
|
||||
if (aRenderPlane->ToUseObjectProperties())
|
||||
{
|
||||
aGroupIter.Value()->Render (theWorkspace);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (aGroupIter.Value()->IsClosed())
|
||||
{
|
||||
aGroupIter.Value()->Render (theWorkspace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// override material, cull back faces
|
||||
theWorkspace->SetAspectFace (&theWorkspace->FrontCulling());
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
// enable all clip plane except the rendered one
|
||||
aContext->ChangeClipping().EnableAllExcept (aContext, thePlaneIter);
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
// render capping plane using the generated stencil mask
|
||||
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glDepthMask (GL_TRUE);
|
||||
glStencilFunc (GL_EQUAL, 1, 0x01);
|
||||
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
|
||||
renderPlane (theWorkspace, thePlane, aRenderPlane->ToUseObjectProperties()
|
||||
? aGroupIter.Value()->AspectFace()
|
||||
: NULL);
|
||||
|
||||
// turn on the current plane to restore initial state
|
||||
aContext->ChangeClipping().SetEnabled (aContext, thePlaneIter, Standard_True);
|
||||
aContext->ShaderManager()->RevertClippingState();
|
||||
aContext->ShaderManager()->RevertClippingState();
|
||||
}
|
||||
|
||||
if (theStructure.InstancedStructure() != NULL)
|
||||
{
|
||||
renderCappingForStructure (theWorkspace, *theStructure.InstancedStructure(), thePlaneIter, thePlane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RenderCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
if (!aContext->Clipping().IsCappingOn())
|
||||
{
|
||||
// do not perform algorithm if there is nothing to render
|
||||
return;
|
||||
}
|
||||
|
||||
// remember current aspect face defined in workspace
|
||||
const OpenGl_AspectFace* aFaceAsp = theWorkspace->AspectFace();
|
||||
|
||||
// replace primitive groups rendering filter
|
||||
Handle(OpenGl_RenderFilter) aRenderFilter = theWorkspace->GetRenderFilter();
|
||||
theWorkspace->SetRenderFilter (theWorkspace->DefaultCappingAlgoFilter());
|
||||
|
||||
// prepare for rendering the clip planes
|
||||
glEnable (GL_STENCIL_TEST);
|
||||
|
||||
// remember current state of depth
|
||||
// function and change its value
|
||||
GLint aDepthFuncPrev;
|
||||
glGetIntegerv (GL_DEPTH_FUNC, &aDepthFuncPrev);
|
||||
glDepthFunc (GL_LESS);
|
||||
|
||||
// generate capping for every clip plane
|
||||
for (OpenGl_ClippingIterator aCappingIt (aContext->Clipping()); aCappingIt.More(); aCappingIt.Next())
|
||||
{
|
||||
// get plane being rendered
|
||||
const Handle(Graphic3d_ClipPlane)& aRenderPlane = aCappingIt.Value();
|
||||
if (!aRenderPlane->IsCapping()
|
||||
|| aCappingIt.IsDisabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get resource for the plane
|
||||
const TCollection_AsciiString& aResId = aRenderPlane->GetId();
|
||||
Handle(OpenGl_CappingPlaneResource) aPlaneRes;
|
||||
if (!aContext->GetResource (aResId, aPlaneRes))
|
||||
{
|
||||
// share and register for release once the resource is no longer used
|
||||
aPlaneRes = new OpenGl_CappingPlaneResource (aRenderPlane);
|
||||
aContext->ShareResource (aResId, aPlaneRes);
|
||||
}
|
||||
|
||||
renderCappingForStructure (theWorkspace, theStructure, aCappingIt, aPlaneRes);
|
||||
|
||||
// set delayed resource release
|
||||
aPlaneRes.Nullify();
|
||||
aContext->ReleaseResource (aResId, Standard_True);
|
||||
}
|
||||
|
||||
// restore previous application state
|
||||
glClear (GL_STENCIL_BUFFER_BIT);
|
||||
glDepthFunc (aDepthFuncPrev);
|
||||
glStencilFunc (GL_ALWAYS, 0, 0xFF);
|
||||
glDisable (GL_STENCIL_TEST);
|
||||
|
||||
// restore rendering aspects
|
||||
theWorkspace->SetAspectFace (aFaceAsp);
|
||||
theWorkspace->SetRenderFilter (aRenderFilter);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CanRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_CappingAlgoFilter::CanRender (const OpenGl_Element* theElement)
|
||||
{
|
||||
const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theElement);
|
||||
return aPArray != NULL
|
||||
&& aPArray->DrawMode() >= THE_FILLPRIM_FROM
|
||||
&& aPArray->DrawMode() <= THE_FILLPRIM_TO;
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
// Created on: 2013-09-05
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_CappingAlgo_H__
|
||||
#define _OpenGl_CappingAlgo_H__
|
||||
|
||||
#include <OpenGl_RenderFilter.hxx>
|
||||
#include <OpenGl_Group.hxx>
|
||||
|
||||
// Forward declaration
|
||||
class OpenGl_CappingAlgoFilter;
|
||||
class OpenGl_CappingPlaneResource;
|
||||
class OpenGl_Structure;
|
||||
|
||||
DEFINE_STANDARD_HANDLE (OpenGl_CappingAlgoFilter, OpenGl_RenderFilter)
|
||||
|
||||
//! Capping surface rendering algorithm.
|
||||
class OpenGl_CappingAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Draw capping surfaces by OpenGl for the clipping planes enabled in current context state.
|
||||
//! Depth buffer must be generated for the passed groups.
|
||||
//! @param theWorkspace [in] the GL workspace, context state
|
||||
//! @param theStructure [in] the structure to be capped
|
||||
Standard_EXPORT static void RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure);
|
||||
|
||||
};
|
||||
|
||||
//! Graphical capping rendering algorithm filter.
|
||||
//! Filters out everything excepth shaded primitives.
|
||||
class OpenGl_CappingAlgoFilter : public OpenGl_RenderFilter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
OpenGl_CappingAlgoFilter() {}
|
||||
|
||||
//! Checks whether the element can be rendered or not.
|
||||
//! @param theElement [in] the element to check.
|
||||
//! @return True if element can be rendered.
|
||||
virtual Standard_Boolean CanRender (const OpenGl_Element* theElement) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(OpenGl_CappingAlgoFilter,OpenGl_RenderFilter)
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,244 +0,0 @@
|
||||
// Created on: 2013-08-15
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-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 <NCollection_AlignedAllocator.hxx>
|
||||
#include <OpenGl_CappingPlaneResource.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_CappingPlaneResource,OpenGl_Resource)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! 12 plane vertices, interleaved:
|
||||
//! - 4 floats, position
|
||||
//! - 4 floats, normal
|
||||
//! - 4 floats, UV texture coordinates
|
||||
static const GLfloat THE_CAPPING_PLN_VERTS[12 * (4 + 4 + 4)] =
|
||||
{
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,-1.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,-1.0f, 0.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f,-1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f,-1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f
|
||||
};
|
||||
|
||||
static const OpenGl_Matrix OpenGl_IdentityMatrix =
|
||||
{
|
||||
// mat[4][4]
|
||||
{ { 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f } }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_CappingPlaneResource
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane)
|
||||
: myPrimitives (NULL),
|
||||
myOrientation (OpenGl_IdentityMatrix),
|
||||
myAspect (NULL),
|
||||
myPlaneRoot (thePlane),
|
||||
myEquationMod ((unsigned int )-1),
|
||||
myAspectMod ((unsigned int )-1)
|
||||
{
|
||||
// Fill primitive array
|
||||
Handle(NCollection_AlignedAllocator) anAlloc = new NCollection_AlignedAllocator (16);
|
||||
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (anAlloc);
|
||||
Graphic3d_Attribute anAttribInfo[] =
|
||||
{
|
||||
{ Graphic3d_TOA_POS, Graphic3d_TOD_VEC4 },
|
||||
{ Graphic3d_TOA_NORM, Graphic3d_TOD_VEC4 },
|
||||
{ Graphic3d_TOA_UV, Graphic3d_TOD_VEC4 }
|
||||
};
|
||||
if (anAttribs->Init (12, anAttribInfo, 3))
|
||||
{
|
||||
memcpy (anAttribs->ChangeData(), THE_CAPPING_PLN_VERTS, sizeof(THE_CAPPING_PLN_VERTS));
|
||||
myPrimitives.InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_CappingPlaneResource
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_CappingPlaneResource::~OpenGl_CappingPlaneResource()
|
||||
{
|
||||
Release (NULL);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Update
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::Update (const Handle(OpenGl_Context)& ,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theObjAspect)
|
||||
{
|
||||
updateTransform();
|
||||
updateAspect (theObjAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
|
||||
{
|
||||
OpenGl_Element::Destroy (theContext, myAspect);
|
||||
myPrimitives.Release (theContext);
|
||||
myEquationMod = (unsigned int )-1;
|
||||
myAspectMod = (unsigned int )-1;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updateAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::updateAspect (const Handle(Graphic3d_AspectFillArea3d)& theObjAspect)
|
||||
{
|
||||
if (myAspect == NULL)
|
||||
{
|
||||
myAspect = new OpenGl_AspectFace();
|
||||
myAspectMod = myPlaneRoot->MCountAspect() - 1; // mark out of sync
|
||||
}
|
||||
|
||||
if (theObjAspect.IsNull())
|
||||
{
|
||||
if (myAspectMod != myPlaneRoot->MCountAspect())
|
||||
{
|
||||
myAspect->SetAspect (myPlaneRoot->CappingAspect());
|
||||
myAspectMod = myPlaneRoot->MCountAspect();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFillAreaAspect.IsNull())
|
||||
{
|
||||
myFillAreaAspect = new Graphic3d_AspectFillArea3d();
|
||||
}
|
||||
if (myAspectMod != myPlaneRoot->MCountAspect())
|
||||
{
|
||||
*myFillAreaAspect = *myPlaneRoot->CappingAspect();
|
||||
}
|
||||
|
||||
if (myPlaneRoot->ToUseObjectMaterial())
|
||||
{
|
||||
// only front material currently supported by capping rendering
|
||||
myFillAreaAspect->SetFrontMaterial (theObjAspect->FrontMaterial());
|
||||
myFillAreaAspect->SetInteriorColor (theObjAspect->InteriorColor());
|
||||
}
|
||||
if (myPlaneRoot->ToUseObjectTexture())
|
||||
{
|
||||
if (theObjAspect->ToMapTexture())
|
||||
{
|
||||
myFillAreaAspect->SetTextureMap (theObjAspect->TextureMap());
|
||||
myFillAreaAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
myFillAreaAspect->SetTextureMapOff();
|
||||
}
|
||||
}
|
||||
if (myPlaneRoot->ToUseObjectShader())
|
||||
{
|
||||
myFillAreaAspect->SetShaderProgram (theObjAspect->ShaderProgram());
|
||||
}
|
||||
|
||||
myAspect->SetAspect (myFillAreaAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updateTransform
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::updateTransform()
|
||||
{
|
||||
const Graphic3d_ClipPlane::Equation& anEquation = myPlaneRoot->GetEquation();
|
||||
if (myEquationMod == myPlaneRoot->MCountEquation())
|
||||
{
|
||||
return; // nothing to update
|
||||
}
|
||||
|
||||
// re-evaluate infinite plane transformation matrix
|
||||
Standard_ShortReal N[3] =
|
||||
{ (Standard_ShortReal)anEquation[0],
|
||||
(Standard_ShortReal)anEquation[1],
|
||||
(Standard_ShortReal)anEquation[2] };
|
||||
|
||||
Standard_ShortReal T[3] =
|
||||
{ (Standard_ShortReal)(anEquation[0] * -anEquation[3]),
|
||||
(Standard_ShortReal)(anEquation[1] * -anEquation[3]),
|
||||
(Standard_ShortReal)(anEquation[2] * -anEquation[3]) };
|
||||
|
||||
Standard_ShortReal L[3] = { 0.0f, 0.0f, 0.0f };
|
||||
Standard_ShortReal F[3] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// project plane normal onto OX to find left vector
|
||||
Standard_ShortReal aProjLen =
|
||||
sqrt ( (Standard_ShortReal)(anEquation[0] * anEquation[0])
|
||||
+ (Standard_ShortReal)(anEquation[2] * anEquation[2]));
|
||||
if (aProjLen < ShortRealSmall())
|
||||
{
|
||||
L[0] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
L[0] = N[2] / aProjLen;
|
||||
L[2] = -N[0] / aProjLen;
|
||||
}
|
||||
|
||||
// (-aLeft) x aNorm
|
||||
F[0] = (-L[1])*N[2] - (-L[2])*N[1];
|
||||
F[1] = (-L[2])*N[0] - (-L[0])*N[2];
|
||||
F[2] = (-L[0])*N[1] - (-L[1])*N[0];
|
||||
|
||||
myOrientation.mat[0][0] = L[0];
|
||||
myOrientation.mat[0][1] = L[1];
|
||||
myOrientation.mat[0][2] = L[2];
|
||||
myOrientation.mat[0][3] = 0.0f;
|
||||
|
||||
myOrientation.mat[1][0] = N[0];
|
||||
myOrientation.mat[1][1] = N[1];
|
||||
myOrientation.mat[1][2] = N[2];
|
||||
myOrientation.mat[1][3] = 0.0f;
|
||||
|
||||
myOrientation.mat[2][0] = F[0];
|
||||
myOrientation.mat[2][1] = F[1];
|
||||
myOrientation.mat[2][2] = F[2];
|
||||
myOrientation.mat[2][3] = 0.0f;
|
||||
|
||||
myOrientation.mat[3][0] = T[0];
|
||||
myOrientation.mat[3][1] = T[1];
|
||||
myOrientation.mat[3][2] = T[2];
|
||||
myOrientation.mat[3][3] = 1.0f;
|
||||
|
||||
myEquationMod = myPlaneRoot->MCountEquation();
|
||||
}
|
@@ -1,93 +0,0 @@
|
||||
// Created on: 2013-08-15
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_CappingPlaneResource_H__
|
||||
#define _OpenGl_CappingPlaneResource_H__
|
||||
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_Resource.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_Matrix.hxx>
|
||||
#include <Graphic3d_ClipPlane.hxx>
|
||||
|
||||
class OpenGl_CappingPlaneResource;
|
||||
DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
|
||||
|
||||
//! Container of graphical resources for rendering capping plane
|
||||
//! associated to graphical clipping plane.
|
||||
//! This resource holds data necessary for OpenGl_CappingAlgo.
|
||||
//! This object is implemented as OpenGl resource for the following reasons:
|
||||
//! - one instance should be shared between contexts.
|
||||
//! - instance associated to Graphic3d_ClipPlane data by id.
|
||||
//! - should created and released within context (owns OpenGl elements and resources).
|
||||
class OpenGl_CappingPlaneResource : public OpenGl_Resource
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
//! Create capping plane presentation associated to clipping plane data.
|
||||
//! @param thePlane [in] the plane data.
|
||||
Standard_EXPORT OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane);
|
||||
|
||||
//! Destroy object.
|
||||
Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
|
||||
|
||||
//! Update resource data in the passed context.
|
||||
//! @param theContext [in] the context
|
||||
//! @param theObjAspect [in] object aspect
|
||||
Standard_EXPORT void Update (const Handle(OpenGl_Context)& theContext,
|
||||
const Handle(Graphic3d_AspectFillArea3d)& theObjAspect);
|
||||
|
||||
//! Release associated OpenGl resources.
|
||||
//! @param theContext [in] the resource context.
|
||||
Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
|
||||
|
||||
//! Return parent clipping plane structure.
|
||||
const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
|
||||
|
||||
//! @return aspect face for rendering capping surface.
|
||||
inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }
|
||||
|
||||
//! @return evaluated orientation matrix to transform infinite plane.
|
||||
inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
|
||||
|
||||
//! @return primitive array of vertices to render infinite plane.
|
||||
inline const OpenGl_PrimitiveArray& Primitives() const { return myPrimitives; }
|
||||
|
||||
private:
|
||||
|
||||
//! Update precomputed plane orientation matrix.
|
||||
void updateTransform();
|
||||
|
||||
//! Update resources.
|
||||
void updateAspect (const Handle(Graphic3d_AspectFillArea3d)& theObjAspect);
|
||||
|
||||
private:
|
||||
|
||||
OpenGl_PrimitiveArray myPrimitives; //!< vertices and texture coordinates for rendering
|
||||
OpenGl_Matrix myOrientation; //!< plane transformation matrix.
|
||||
OpenGl_AspectFace* myAspect; //!< capping face aspect.
|
||||
Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
|
||||
Handle(Graphic3d_AspectFillArea3d) myFillAreaAspect; //!< own capping aspect
|
||||
unsigned int myEquationMod; //!< modification counter for plane equation.
|
||||
unsigned int myAspectMod; //!< modification counter for aspect.
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(OpenGl_CappingPlaneResource,OpenGl_Resource) // Type definition
|
||||
|
||||
};
|
||||
|
||||
#endif
|
447
src/OpenGl/OpenGl_CappingRenderer.cxx
Normal file
447
src/OpenGl/OpenGl_CappingRenderer.cxx
Normal file
@@ -0,0 +1,447 @@
|
||||
// Created on: 2013-09-05
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-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 <OpenGl_CappingRenderer.hxx>
|
||||
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectFillCapping.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_Resource.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <NCollection_AlignedAllocator.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_CappingRenderFilter, OpenGl_RenderFilter)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! interleaved (4x position, 4x normals, 4x (u,v) coordinates).
|
||||
//! o ----o
|
||||
//! representing | \ / |
|
||||
//! these | o |
|
||||
//! triangles: | / \ |
|
||||
//! o --- o
|
||||
static const GLfloat THE_CAPPING_PLN_VERTS[12 * (4 + 4 + 4)] =
|
||||
{
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,-1.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,-1.0f, 0.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f,-1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f,-1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f
|
||||
};
|
||||
|
||||
class OpenGl_SharedElement : public OpenGl_Resource
|
||||
{
|
||||
public:
|
||||
OpenGl_SharedElement (OpenGl_Element* theGlElement) : myGlElement (theGlElement) {}
|
||||
virtual void Release (OpenGl_Context* theGlCtx) Standard_OVERRIDE
|
||||
{
|
||||
OpenGl_Element::Destroy (theGlCtx, myGlElement);
|
||||
}
|
||||
OpenGl_Element* GlElement() const { return myGlElement; }
|
||||
|
||||
private:
|
||||
OpenGl_Element* myGlElement;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE (OpenGl_SharedElement, OpenGl_Resource)
|
||||
};
|
||||
|
||||
|
||||
static const TCollection_AsciiString THE_QUAD_PARRAY = "OpenGl_CappingRenderer_Quad";
|
||||
static const TCollection_AsciiString THE_PLANE_STYLE = "OpenGl_CappingRenderer_CappingStyle_";
|
||||
static const OpenGl_AspectFillCapping THE_DEFAULT_ASPECT = OpenGl_AspectFillCapping (new Graphic3d_AspectFillCapping);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Render
|
||||
// purpose : Renders capping surfaces for enabled clipping planes.
|
||||
// =======================================================================
|
||||
void OpenGl_CappingRenderer::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
if (!aContext->Clipping().IsCappingOn())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_PrimitiveArray* aCappingQuad = initQuad (aContext);
|
||||
if (!aCappingQuad)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_AspectFace* aPrevAspect = theWorkspace->AspectFace();
|
||||
Handle(OpenGl_RenderFilter) aPrevFilter = theWorkspace->GetRenderFilter();
|
||||
Handle(OpenGl_CappingRenderFilter) aCappingFilter = theWorkspace->CappingRenderFilter();
|
||||
aCappingFilter->SetPreviousFilter (aPrevFilter);
|
||||
|
||||
theWorkspace->SetRenderFilter (aCappingFilter);
|
||||
|
||||
GLint aDepthFuncPrev;
|
||||
glGetIntegerv (GL_DEPTH_FUNC, &aDepthFuncPrev);
|
||||
glDepthFunc (GL_LESS);
|
||||
glEnable (GL_STENCIL_TEST);
|
||||
|
||||
GLboolean aPrevBlend = glIsEnabled (GL_BLEND);
|
||||
GLint aPrevBlendSrc = GL_ONE;
|
||||
GLint aPrevBlendDst = GL_ZERO;
|
||||
if (aPrevBlend == GL_TRUE)
|
||||
{
|
||||
glGetIntegerv (GL_BLEND_SRC_ALPHA, &aPrevBlendSrc);
|
||||
glGetIntegerv (GL_BLEND_DST_ALPHA, &aPrevBlendDst);
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
|
||||
for (OpenGl_ClippingIterator aCappingIt (aContext->Clipping()); aCappingIt.More(); aCappingIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_ClipPlane)& aPlane = aCappingIt.Value();
|
||||
if (!aPlane->IsCapping()
|
||||
|| aCappingIt.IsDisabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(OpenGl_AspectFillCapping) anAspect;
|
||||
|
||||
TCollection_AsciiString aSharedStyleId;
|
||||
if (!aPlane->CappingSectionStyle().IsNull())
|
||||
{
|
||||
aSharedStyleId = THE_PLANE_STYLE + aPlane->GetId();
|
||||
|
||||
if (!aContext->GetResource (aSharedStyleId, anAspect))
|
||||
{
|
||||
anAspect = new OpenGl_AspectFillCapping (aPlane->CappingSectionStyle());
|
||||
aContext->ShareResource (aSharedStyleId, anAspect);
|
||||
}
|
||||
}
|
||||
|
||||
renderOne (theWorkspace, theStructure, aCappingIt, anAspect.get(), aCappingQuad);
|
||||
|
||||
if (!aSharedStyleId.IsEmpty())
|
||||
{
|
||||
// schedule release of resource if not used
|
||||
aContext->ReleaseResource (aSharedStyleId, Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
glClear (GL_STENCIL_BUFFER_BIT);
|
||||
glDepthFunc (aDepthFuncPrev);
|
||||
glStencilFunc (GL_ALWAYS, 0, 0xFF);
|
||||
glDisable (GL_STENCIL_TEST);
|
||||
|
||||
if (aPrevBlend == GL_TRUE)
|
||||
{
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (aPrevBlendSrc, aPrevBlendDst);
|
||||
}
|
||||
|
||||
theWorkspace->SetRenderFilter (aPrevFilter);
|
||||
theWorkspace->SetAspectFace (aPrevAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : renderOne
|
||||
// purpose : method to render capping section of one given plane for a structure.
|
||||
// =======================================================================
|
||||
void OpenGl_CappingRenderer::renderOne (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure,
|
||||
const OpenGl_ClippingIterator& thePlaneIter,
|
||||
const OpenGl_AspectFillCapping* thePlaneAspectCapping,
|
||||
const OpenGl_PrimitiveArray* theQuad)
|
||||
{
|
||||
const Handle(Graphic3d_ClipPlane)& aPlane = thePlaneIter.Value();
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
const Handle(Graphic3d_Camera) aCamera = theWorkspace->View() != NULL
|
||||
? theWorkspace->View()->Camera()
|
||||
: Handle(Graphic3d_Camera)();
|
||||
|
||||
const OpenGl_Mat4& aPlaneMat = OpenGl_Mat4::Map (aPlane->OrientationMatrix());
|
||||
Standard_ShortReal aRotateAngle = 0.0;
|
||||
Standard_ShortReal aViewScale = ShortRealLast();
|
||||
OpenGl_Mat4 aRotateZoomMat;
|
||||
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (theStructure.Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value()->IsClosed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// enable only the rendering plane to generate stencil mask
|
||||
aContext->ChangeClipping().DisableAllExcept (aContext, thePlaneIter);
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
glClear (GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// override aspects, disable culling
|
||||
theWorkspace->SetAspectFace (&theWorkspace->NoneCulling());
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
// evaluate number of pair faces
|
||||
if (theWorkspace->UseZBuffer())
|
||||
{
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
}
|
||||
if (theWorkspace->UseDepthWrite())
|
||||
{
|
||||
glDepthMask (GL_FALSE);
|
||||
}
|
||||
glStencilFunc (GL_ALWAYS, 1, 0x01);
|
||||
glStencilOp (GL_KEEP, GL_INVERT, GL_INVERT);
|
||||
|
||||
aGroupIter.Value()->Render (theWorkspace);
|
||||
|
||||
// override material, cull back faces
|
||||
theWorkspace->SetAspectFace (&theWorkspace->FrontCulling());
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
// enable all clip plane except the rendered one
|
||||
aContext->ChangeClipping().EnableAllExcept (aContext, thePlaneIter);
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
// render capping plane using the generated stencil mask
|
||||
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
if (theWorkspace->UseDepthWrite())
|
||||
{
|
||||
glDepthMask (GL_TRUE);
|
||||
}
|
||||
glStencilFunc (GL_EQUAL, 1, 0x01);
|
||||
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
if (theWorkspace->UseZBuffer())
|
||||
{
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
const OpenGl_AspectFace* aGroupAspectFace = aGroupIter.Value()->AspectFace();
|
||||
const OpenGl_AspectFillCapping* aGroupAspectCapping = aGroupIter.Value()->AspectFillCapping();
|
||||
const OpenGl_AspectFillCapping* anAspectCapping =
|
||||
thePlaneAspectCapping && (!aGroupAspectCapping || aGroupAspectCapping->Aspect().IsNull() || aPlane->ToOverrideCappingAspect())
|
||||
? thePlaneAspectCapping
|
||||
: aGroupAspectCapping;
|
||||
|
||||
if (anAspectCapping == NULL)
|
||||
{
|
||||
anAspectCapping = &THE_DEFAULT_ASPECT;
|
||||
}
|
||||
|
||||
const OpenGl_AspectFace* anAspectFace = anAspectCapping->CappingFaceAspect (aGroupAspectFace);
|
||||
const Standard_Boolean hasHatch = anAspectCapping->Aspect()->ToDrawHatch();
|
||||
const OpenGl_AspectFace* anAspectHatching = hasHatch ? anAspectCapping->HatchingFaceAspect() : NULL;
|
||||
const Standard_Boolean hasTextureHatch = hasHatch && !anAspectCapping->Aspect()->TextureHatch().IsNull();
|
||||
const Standard_Boolean isRotatePers = hasTextureHatch && !aCamera.IsNull() && anAspectCapping->Aspect()->IsHatchRotationPersistent();
|
||||
const Standard_Boolean isZoomPers = hasTextureHatch && !aCamera.IsNull() && anAspectCapping->Aspect()->IsHatchZoomPersistent();
|
||||
|
||||
Standard_ShortReal aHatchScale = 1.0;
|
||||
Standard_ShortReal aHatchAngle = 0.0;
|
||||
|
||||
if (isRotatePers || isZoomPers)
|
||||
{
|
||||
|
||||
if (isRotatePers)
|
||||
{
|
||||
if (aRotateAngle == 0.0)
|
||||
{
|
||||
const gp_Dir aPlaneSide (aPlaneMat.GetValue (0, 0), aPlaneMat.GetValue (1, 0), aPlaneMat.GetValue (2, 0));
|
||||
const gp_Dir aPlaneUp (aPlaneMat.GetValue (0, 2), aPlaneMat.GetValue (1, 2), aPlaneMat.GetValue (2, 2));
|
||||
const gp_Dir& aCameraUp = aCamera->Up();
|
||||
const gp_Vec aCameraPln = aPlaneSide.Dot (aCameraUp) * aPlaneSide + aPlaneUp.Dot (aCameraUp) * aPlaneUp;
|
||||
const gp_Dir& aCameraDir = aCamera->Direction();
|
||||
aRotateAngle = static_cast<Standard_ShortReal> (aCameraPln.AngleWithRef (aPlaneUp, aCameraDir) / M_PI * 180.0);
|
||||
}
|
||||
|
||||
aHatchAngle = aRotateAngle;
|
||||
}
|
||||
|
||||
if (isZoomPers)
|
||||
{
|
||||
if (aViewScale == ShortRealLast())
|
||||
{
|
||||
const Standard_Real aFocus = aCamera->IsOrthographic()
|
||||
? aCamera->Distance()
|
||||
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
|
||||
? Standard_Real(aCamera->ZFocus() * aCamera->Distance())
|
||||
: Standard_Real(aCamera->ZFocus()));
|
||||
|
||||
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus);
|
||||
aViewScale = static_cast<Standard_ShortReal> (aViewDim.Y() / aContext->Viewport()[3]);
|
||||
}
|
||||
|
||||
aHatchScale = 1.0f / (aViewScale * anAspectHatching->TextureRes (aContext)->SizeY());
|
||||
}
|
||||
}
|
||||
|
||||
renderSection (theWorkspace, theQuad, anAspectFace, hasHatch ? anAspectCapping->HatchingFaceAspect() : NULL, aPlaneMat, aHatchScale, aHatchAngle);
|
||||
|
||||
// turn on the current plane to restore initial state
|
||||
aContext->ChangeClipping().SetEnabled (aContext, thePlaneIter, Standard_True);
|
||||
aContext->ShaderManager()->RevertClippingState();
|
||||
aContext->ShaderManager()->RevertClippingState();
|
||||
}
|
||||
|
||||
if (theStructure.InstancedStructure() != NULL)
|
||||
{
|
||||
renderOne (theWorkspace, *theStructure.InstancedStructure(), thePlaneIter, thePlaneAspectCapping, theQuad);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : renderSection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingRenderer::renderSection (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_PrimitiveArray* theQuad,
|
||||
const OpenGl_AspectFace* theCappingAspect,
|
||||
const OpenGl_AspectFace* theHatchAspect,
|
||||
const OpenGl_Mat4& theCappingMatrix,
|
||||
const Standard_ShortReal theHatchScale,
|
||||
const Standard_ShortReal theHatchRotate)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
|
||||
const Standard_Boolean isTextureHatch =
|
||||
theHatchAspect != NULL
|
||||
&& theHatchAspect->Aspect()->TextureMapState();
|
||||
|
||||
aContext->ModelWorldState.Push();
|
||||
aContext->ModelWorldState.SetCurrent (theCappingMatrix);
|
||||
aContext->ApplyModelViewMatrix();
|
||||
|
||||
theWorkspace->SetAspectFace (theCappingAspect);
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
theQuad->Render (theWorkspace);
|
||||
|
||||
if (theHatchAspect != NULL)
|
||||
{
|
||||
Graphic3d_Vec2 aPrevScale;
|
||||
Standard_ShortReal aPrevRotate = 0.0;
|
||||
|
||||
if (isTextureHatch)
|
||||
{
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (theHatchScale != 1.0 || theHatchRotate != 0.0)
|
||||
{
|
||||
const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureParams();
|
||||
|
||||
aPrevScale = aTexParams->Scale();
|
||||
aPrevRotate = aTexParams->Rotation();
|
||||
|
||||
const Standard_Boolean isMirror = aPrevScale.x() * aPrevScale.y() < 0.0;
|
||||
aTexParams->SetScale (aPrevScale * theHatchScale);
|
||||
aTexParams->SetRotation (isMirror ? aPrevRotate - theHatchRotate : aPrevRotate + theHatchRotate);
|
||||
}
|
||||
}
|
||||
|
||||
theWorkspace->SetAspectFace (theHatchAspect);
|
||||
theWorkspace->ApplyAspectFace();
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
|
||||
theQuad->Render (theWorkspace);
|
||||
|
||||
glDepthFunc (GL_LESS);
|
||||
|
||||
if (isTextureHatch)
|
||||
{
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
if (theHatchScale != 1.0 || theHatchRotate != 0.0)
|
||||
{
|
||||
const Handle(Graphic3d_TextureParams)& aTexParams = theHatchAspect->TextureParams();
|
||||
|
||||
aTexParams->SetScale (aPrevScale);
|
||||
aTexParams->SetRotation (aPrevRotate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aContext->ModelWorldState.Pop();
|
||||
aContext->ApplyModelViewMatrix();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initQuad
|
||||
// purpose : initializes and returns vertex buffer for plane section
|
||||
// =======================================================================
|
||||
OpenGl_PrimitiveArray* OpenGl_CappingRenderer::initQuad (const Handle(OpenGl_Context)& theContext)
|
||||
{
|
||||
Handle(OpenGl_SharedElement) aSharedResource;
|
||||
|
||||
if (!theContext->GetResource (THE_QUAD_PARRAY, aSharedResource))
|
||||
{
|
||||
OpenGl_PrimitiveArray* aPArray = NULL;
|
||||
|
||||
Handle(NCollection_AlignedAllocator) anAlloc = new NCollection_AlignedAllocator (16);
|
||||
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (anAlloc);
|
||||
Graphic3d_Attribute anAttribInfo[] =
|
||||
{
|
||||
{ Graphic3d_TOA_POS, Graphic3d_TOD_VEC4 },
|
||||
{ Graphic3d_TOA_NORM, Graphic3d_TOD_VEC4 },
|
||||
{ Graphic3d_TOA_UV, Graphic3d_TOD_VEC4 }
|
||||
};
|
||||
if (anAttribs->Init (12, anAttribInfo, 3))
|
||||
{
|
||||
memcpy (anAttribs->ChangeData(), THE_CAPPING_PLN_VERTS, sizeof (THE_CAPPING_PLN_VERTS));
|
||||
|
||||
aPArray = new OpenGl_PrimitiveArray (NULL);
|
||||
aPArray->InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
||||
}
|
||||
aSharedResource = new OpenGl_SharedElement (aPArray);
|
||||
|
||||
theContext->ShareResource (THE_QUAD_PARRAY, aSharedResource);
|
||||
}
|
||||
|
||||
return dynamic_cast<OpenGl_PrimitiveArray*> (aSharedResource->GlElement());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CanRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_CappingRenderFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement)
|
||||
{
|
||||
if (!myFilter.IsNull() && !myFilter->ShouldRender (theWorkspace, theGlElement))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theGlElement);
|
||||
return aPArray != NULL
|
||||
&& aPArray->DrawMode() >= OpenGl_PrimitiveArray::THE_FILLPRIM_FROM
|
||||
&& aPArray->DrawMode() <= OpenGl_PrimitiveArray::THE_FILLPRIM_TO;
|
||||
}
|
120
src/OpenGl/OpenGl_CappingRenderer.hxx
Normal file
120
src/OpenGl/OpenGl_CappingRenderer.hxx
Normal file
@@ -0,0 +1,120 @@
|
||||
// Created on: 2013-09-05
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_CappingRenderer_H__
|
||||
#define _OpenGl_CappingRenderer_H__
|
||||
|
||||
#include <OpenGl_RenderFilter.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
|
||||
// Forward declaration
|
||||
class OpenGl_AspectFace;
|
||||
class OpenGl_AspectFillCapping;
|
||||
class OpenGl_AspectSection;
|
||||
class OpenGl_CappingStyle;
|
||||
class OpenGl_ClippingIterator;
|
||||
class OpenGl_Context;
|
||||
class OpenGl_Element;
|
||||
class OpenGl_PrimitiveArray;
|
||||
class OpenGl_Structure;
|
||||
class OpenGl_Texture;
|
||||
class OpenGl_Workspace;
|
||||
|
||||
//! Class implementing an OpenGL rasterization algorithm for drawing capping planes over clipped geometry.
|
||||
class OpenGl_CappingRenderer
|
||||
{
|
||||
public:
|
||||
|
||||
//! Renders capping surfaces for enabled clipping planes.
|
||||
//! @note Depth buffer must be generated for the passed groups.
|
||||
//! @param theWorkspace [in] the GL workspace, context state
|
||||
//! @param theStructure [in] the structure to be capped
|
||||
Standard_EXPORT static void Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure);
|
||||
|
||||
private:
|
||||
|
||||
//! Method to render capping section of one given plane for a structure.
|
||||
static void renderOne (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Structure& theStructure,
|
||||
const OpenGl_ClippingIterator& thePlaneIter,
|
||||
const OpenGl_AspectFillCapping* thePlaneAspectCapping,
|
||||
const OpenGl_PrimitiveArray* theQuad);
|
||||
|
||||
//! Render section plane using the given aspects.
|
||||
static void renderSection (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_PrimitiveArray* theQuad,
|
||||
const OpenGl_AspectFace* theCappingAspect,
|
||||
const OpenGl_AspectFace* theHatchAspect,
|
||||
const OpenGl_Mat4& theCappingMatrix,
|
||||
const Standard_ShortReal theHatchScale,
|
||||
const Standard_ShortReal theHatchRotate);
|
||||
|
||||
//! Initializes and returns face draw element for rendering section plane.
|
||||
//! @note once initialized, context will hold resource until destroyed.
|
||||
static OpenGl_PrimitiveArray* initQuad (const Handle(OpenGl_Context)& theContext);
|
||||
|
||||
//! Set rotation persistence components for the matrix to support persistent texturing.
|
||||
//! @param theWorkspace [in] the GL workspace, context state.
|
||||
//! @param thePlane [in] the plane.
|
||||
//! @param theRotateScaleMat [in/out] the matrix combining rotation and scaling persistence components.
|
||||
static void computePersistence (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_ClippingIterator& thePlane,
|
||||
const Handle(OpenGl_Texture)& theTexture,
|
||||
const bool theRotatePers,
|
||||
const bool theZoomPers,
|
||||
OpenGl_Mat4& theRotateScaleMat);
|
||||
|
||||
//! Set zoom persistence components for the matrix to support persistent texturing.
|
||||
//! @param theWorkspace [in] the GL workspace, context state.
|
||||
//! @param thePlane [in] the plane.
|
||||
//! @param theTexture [in] the texture.
|
||||
//! @param theRotateScaleMat [in/out] the matrix combining rotation and scaling persistence components.
|
||||
static void setZoomPersistence (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Handle(OpenGl_Texture)& theTexture,
|
||||
OpenGl_Mat4& theRotateScaleMat);
|
||||
};
|
||||
|
||||
//! Filters out everything except face primitives of solids.
|
||||
class OpenGl_CappingRenderFilter : public OpenGl_RenderFilter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
OpenGl_CappingRenderFilter() {}
|
||||
|
||||
//! Sets the current active filter in workspace.
|
||||
//! @param thePrevFilter [in] the previously active filter that should have additive effect.
|
||||
void SetPreviousFilter (const Handle(OpenGl_RenderFilter)& thePrevFitler) { myFilter = thePrevFitler; }
|
||||
|
||||
//! Checks whether the element can be rendered or not.
|
||||
//! @param theElement [in] the element to check.
|
||||
//! @return True if element can be rendered.
|
||||
Standard_EXPORT virtual
|
||||
Standard_Boolean ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Handle(OpenGl_RenderFilter) myFilter; //!< Previous active filter that should be combined.
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (OpenGl_CappingRenderFilter, OpenGl_RenderFilter)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (OpenGl_CappingRenderFilter, OpenGl_RenderFilter)
|
||||
|
||||
#endif
|
@@ -127,6 +127,8 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
arbNPTW (Standard_False),
|
||||
arbTexRG (Standard_False),
|
||||
arbTexFloat (Standard_False),
|
||||
arbTexHalfFloat (Standard_False),
|
||||
arbSampleShading (Standard_False),
|
||||
arbTexBindless (NULL),
|
||||
arbTBO (NULL),
|
||||
arbTboRGB32 (Standard_False),
|
||||
@@ -152,11 +154,13 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
myMaxTexDim (1024),
|
||||
myMaxClipPlanes (6),
|
||||
myMaxMsaaSamples(0),
|
||||
myMaxDrawBuffers (1),
|
||||
myGlVerMajor (0),
|
||||
myGlVerMinor (0),
|
||||
myIsInitialized (Standard_False),
|
||||
myIsStereoBuffers (Standard_False),
|
||||
myIsGlNormalizeEnabled (Standard_False),
|
||||
myHasHalfFloatTextures (Standard_False),
|
||||
myHasRayTracing (Standard_False),
|
||||
myHasRayTracingTextures (Standard_False),
|
||||
myHasRayTracingAdaptiveSampling (Standard_False),
|
||||
@@ -171,7 +175,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
#endif
|
||||
myToCullBackFaces (false),
|
||||
myReadBuffer (0),
|
||||
myDrawBuffer (0),
|
||||
myDrawBuffers (1),
|
||||
myDefaultVao (0),
|
||||
myIsGlDebugCtx (Standard_False),
|
||||
myResolutionRatio (1.0f)
|
||||
@@ -371,18 +375,60 @@ void OpenGl_Context::SetReadBuffer (const Standard_Integer theReadBuffer)
|
||||
void OpenGl_Context::SetDrawBuffer (const Standard_Integer theDrawBuffer)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myDrawBuffer = !myIsStereoBuffers ? stereoToMonoBuffer (theDrawBuffer) : theDrawBuffer;
|
||||
if (myDrawBuffer < GL_COLOR_ATTACHMENT0
|
||||
const Standard_Integer aDrawBuffer = !myIsStereoBuffers ? stereoToMonoBuffer (theDrawBuffer) : theDrawBuffer;
|
||||
if (aDrawBuffer < GL_COLOR_ATTACHMENT0
|
||||
&& arbFBO != NULL)
|
||||
{
|
||||
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||
}
|
||||
::glDrawBuffer (myDrawBuffer);
|
||||
::glDrawBuffer (aDrawBuffer);
|
||||
|
||||
myDrawBuffers.Clear();
|
||||
|
||||
if (aDrawBuffer != GL_NONE)
|
||||
{
|
||||
myDrawBuffers.SetValue (0, aDrawBuffer);
|
||||
}
|
||||
#else
|
||||
(void )theDrawBuffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDrawBuffers
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standard_Integer* theDrawBuffers)
|
||||
{
|
||||
Standard_ASSERT_RETURN (Functions()->glDrawBuffers != NULL, "Multiple render targets feature is not supported by the context", Standard_ASSERT_DO_NOTHING());
|
||||
|
||||
myDrawBuffers.Clear();
|
||||
|
||||
Standard_Boolean useDefaultFbo = Standard_False;
|
||||
for (Standard_Integer anI = 0; anI < theNb; ++anI)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
const Standard_Integer aDrawBuffer = !myIsStereoBuffers ? stereoToMonoBuffer (theDrawBuffers[anI]) : theDrawBuffers[anI];
|
||||
#else
|
||||
const Standard_Integer aDrawBuffer = theDrawBuffers[anI];
|
||||
#endif
|
||||
if (aDrawBuffer < GL_COLOR_ATTACHMENT0 && aDrawBuffer != GL_NONE)
|
||||
{
|
||||
useDefaultFbo = Standard_True;
|
||||
}
|
||||
else if (aDrawBuffer != GL_NONE)
|
||||
{
|
||||
myDrawBuffers.SetValue (anI, aDrawBuffer);
|
||||
}
|
||||
}
|
||||
if (arbFBO != NULL && useDefaultFbo)
|
||||
{
|
||||
arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, OpenGl_FrameBuffer::NO_FRAMEBUFFER);
|
||||
}
|
||||
|
||||
Functions()->glDrawBuffers (theNb, (const GLenum*)theDrawBuffers);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCullBackFaces
|
||||
// purpose :
|
||||
@@ -419,9 +465,35 @@ void OpenGl_Context::FetchState()
|
||||
::glGetIntegerv (GL_RENDER_MODE, &myRenderMode);
|
||||
}
|
||||
|
||||
// cache buffers state
|
||||
// cache read buffers state
|
||||
::glGetIntegerv (GL_READ_BUFFER, &myReadBuffer);
|
||||
::glGetIntegerv (GL_DRAW_BUFFER, &myDrawBuffer);
|
||||
|
||||
// cache draw buffers state
|
||||
myDrawBuffers.Clear();
|
||||
|
||||
Standard_Integer aDrawBuffer;
|
||||
|
||||
if (myMaxDrawBuffers == 1)
|
||||
{
|
||||
::glGetIntegerv (GL_DRAW_BUFFER, &aDrawBuffer);
|
||||
|
||||
if (aDrawBuffer != GL_NONE)
|
||||
{
|
||||
myDrawBuffers.SetValue (0, aDrawBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anI = 0; anI < myMaxDrawBuffers; ++anI)
|
||||
{
|
||||
::glGetIntegerv (GL_DRAW_BUFFER0 + anI, &aDrawBuffer);
|
||||
|
||||
if (aDrawBuffer != GL_NONE)
|
||||
{
|
||||
myDrawBuffers.SetValue (anI, aDrawBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1096,6 +1168,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
myGlVerMajor = 0;
|
||||
myGlVerMinor = 0;
|
||||
myMaxMsaaSamples = 0;
|
||||
myMaxDrawBuffers = 1;
|
||||
ReadGlVersion (myGlVerMajor, myGlVerMinor);
|
||||
myVendor = (const char* )::glGetString (GL_VENDOR);
|
||||
if (!caps->ffpEnable
|
||||
@@ -1188,6 +1261,8 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
arbNPTW = Standard_True;
|
||||
arbTexRG = IsGlGreaterEqual (3, 0)
|
||||
|| CheckExtension ("GL_EXT_texture_rg");
|
||||
arbSampleShading = IsGlGreaterEqual (3, 2)
|
||||
|| CheckExtension ("GL_OES_sample_variables");
|
||||
extBgra = CheckExtension ("GL_EXT_texture_format_BGRA8888");
|
||||
extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
|
||||
extPDS = CheckExtension ("GL_OES_packed_depth_stencil");
|
||||
@@ -1227,8 +1302,10 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
hasHighp = Standard_True;
|
||||
}
|
||||
|
||||
arbTexFloat = IsGlGreaterEqual (3, 0)
|
||||
&& FindProc ("glTexImage3D", myFuncs->glTexImage3D);
|
||||
arbTexFloat = IsGlGreaterEqual (3, 0)
|
||||
&& FindProc ("glTexImage3D", myFuncs->glTexImage3D);
|
||||
arbTexHalfFloat = IsGlGreaterEqual (3, 0)
|
||||
|| CheckExtension ("GL_OES_texture_half_float");
|
||||
|
||||
const Standard_Boolean hasTexBuffer32 = IsGlGreaterEqual (3, 2) && FindProc ("glTexBuffer", myFuncs->glTexBuffer);
|
||||
const Standard_Boolean hasExtTexBuffer = CheckExtension ("GL_EXT_texture_buffer") && FindProc ("glTexBufferEXT", myFuncs->glTexBuffer);
|
||||
@@ -1268,19 +1345,30 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Boolean hasDrawBuffersExt = (IsGlGreaterEqual (3, 0) || CheckExtension ("GL_EXT_draw_buffers"))
|
||||
&& FindProc ("glDrawBuffersEXT", myFuncs->glDrawBuffers);
|
||||
// get number of maximum supported draw buffers
|
||||
if (hasDrawBuffersExt)
|
||||
{
|
||||
glGetIntegerv (GL_MAX_DRAW_BUFFERS, &myMaxDrawBuffers);
|
||||
}
|
||||
#else
|
||||
|
||||
myTexClamp = IsGlGreaterEqual (1, 2) ? GL_CLAMP_TO_EDGE : GL_CLAMP;
|
||||
|
||||
hasTexRGBA8 = Standard_True;
|
||||
arbNPTW = CheckExtension ("GL_ARB_texture_non_power_of_two");
|
||||
arbTexFloat = IsGlGreaterEqual (3, 0)
|
||||
|| CheckExtension ("GL_ARB_texture_float");
|
||||
extBgra = CheckExtension ("GL_EXT_bgra");
|
||||
extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
|
||||
extPDS = CheckExtension ("GL_EXT_packed_depth_stencil");
|
||||
atiMem = CheckExtension ("GL_ATI_meminfo");
|
||||
nvxMem = CheckExtension ("GL_NVX_gpu_memory_info");
|
||||
hasTexRGBA8 = Standard_True;
|
||||
arbNPTW = CheckExtension ("GL_ARB_texture_non_power_of_two");
|
||||
arbTexFloat = IsGlGreaterEqual (3, 0)
|
||||
|| CheckExtension ("GL_ARB_texture_float");
|
||||
arbTexHalfFloat = IsGlGreaterEqual (3, 0)
|
||||
|| CheckExtension ("GL_ARB_half_float_pixel");
|
||||
arbSampleShading = IsGlGreaterEqual (4, 0)
|
||||
|| CheckExtension("GL_ARB_sample_shading");
|
||||
extBgra = CheckExtension ("GL_EXT_bgra");
|
||||
extAnis = CheckExtension ("GL_EXT_texture_filter_anisotropic");
|
||||
extPDS = CheckExtension ("GL_EXT_packed_depth_stencil");
|
||||
atiMem = CheckExtension ("GL_ATI_meminfo");
|
||||
nvxMem = CheckExtension ("GL_NVX_gpu_memory_info");
|
||||
|
||||
GLint aStereo = GL_FALSE;
|
||||
glGetIntegerv (GL_STEREO, &aStereo);
|
||||
@@ -1288,6 +1376,12 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
||||
|
||||
// get number of maximum clipping planes
|
||||
glGetIntegerv (GL_MAX_CLIP_PLANES, &myMaxClipPlanes);
|
||||
|
||||
// get number of maximum supported draw buffers
|
||||
if (IsGlGreaterEqual (2, 0))
|
||||
{
|
||||
glGetIntegerv (GL_MAX_DRAW_BUFFERS, &myMaxDrawBuffers);
|
||||
}
|
||||
#endif
|
||||
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
|
||||
@@ -2848,7 +2942,6 @@ Handle(OpenGl_FrameBuffer) OpenGl_Context::SetDefaultFrameBuffer (const Handle(O
|
||||
// =======================================================================
|
||||
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||
const Standard_Boolean theUseDepthWrite,
|
||||
Standard_Integer& theRenderingPassFlags)
|
||||
{
|
||||
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
|
||||
@@ -2902,26 +2995,12 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
||||
theRenderingPassFlags |= OPENGL_NS_2NDPASSNEED;
|
||||
}
|
||||
|
||||
GLboolean aDepthMask = GL_TRUE;
|
||||
if (aTranspFront != 0.0f
|
||||
|| aTranspBack != 0.0f)
|
||||
{
|
||||
// render transparent
|
||||
myMatFront.Diffuse.a() = 1.0f - aTranspFront;
|
||||
myMatBack .Diffuse.a() = 1.0f - aTranspBack;
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable (GL_BLEND);
|
||||
aDepthMask = GL_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// render opaque
|
||||
glBlendFunc (GL_ONE, GL_ZERO);
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
if (theUseDepthWrite)
|
||||
{
|
||||
glDepthMask (aDepthMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,9 +24,11 @@
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Graphic3d_DiagnosticInfo.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_SparseArray.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <OpenGl_Caps.hxx>
|
||||
#include <OpenGl_LineAttributes.hxx>
|
||||
@@ -43,6 +45,8 @@
|
||||
|
||||
#include <NCollection_Shared.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//! Forward declarations
|
||||
#if defined(__APPLE__)
|
||||
#import <TargetConditionals.h>
|
||||
@@ -456,12 +460,18 @@ public:
|
||||
//! @return value for GL_MAX_SAMPLES
|
||||
Standard_Integer MaxMsaaSamples() const { return myMaxMsaaSamples; }
|
||||
|
||||
//! @return value for GL_MAX_DRAW_BUFFERS
|
||||
Standard_Integer MaxDrawBuffers() const { return myMaxDrawBuffers; }
|
||||
|
||||
//! Get maximum number of clip planes supported by OpenGl.
|
||||
//! This value is implementation dependent. At least 6
|
||||
//! planes should be supported by OpenGl (see specs).
|
||||
//! @return value for GL_MAX_CLIP_PLANES
|
||||
Standard_Integer MaxClipPlanes() const { return myMaxClipPlanes; }
|
||||
|
||||
//! @return TRUE if half-float textures are supported by OpenGl.
|
||||
Standard_Boolean HasHalfFloatTextures() const { return myHasHalfFloatTextures; }
|
||||
|
||||
//! @return TRUE if ray tracing mode is supported
|
||||
Standard_Boolean HasRayTracing() const { return myHasRayTracing; }
|
||||
|
||||
@@ -583,12 +593,18 @@ public: //! @name methods to alter or retrieve current state
|
||||
//! Switch read buffer, wrapper for ::glReadBuffer().
|
||||
Standard_EXPORT void SetReadBuffer (const Standard_Integer theReadBuffer);
|
||||
|
||||
//! Return active draw buffer.
|
||||
Standard_Integer DrawBuffer() { return myDrawBuffer; }
|
||||
//! Return active draw buffer attached to a render target referred by layout location.
|
||||
Standard_Integer DrawBuffer (const Standard_Integer theLayoutIdx = 0)
|
||||
{
|
||||
return myDrawBuffers.IsBound (theLayoutIdx) ? myDrawBuffers.Value (theLayoutIdx) : GL_NONE;
|
||||
}
|
||||
|
||||
//! Switch draw buffer, wrapper for ::glDrawBuffer().
|
||||
Standard_EXPORT void SetDrawBuffer (const Standard_Integer theDrawBuffer);
|
||||
|
||||
//! Switch draw buffer, wrapper for ::glDrawBuffers (GLsizei, const GLenum*).
|
||||
Standard_EXPORT void SetDrawBuffers (const Standard_Integer theNb, const Standard_Integer* theDrawBuffers);
|
||||
|
||||
//! Switch read/draw buffers.
|
||||
void SetReadDrawBuffer (const Standard_Integer theBuffer)
|
||||
{
|
||||
@@ -628,7 +644,6 @@ public: //! @name methods to alter or retrieve current state
|
||||
//! Setup current shading material.
|
||||
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||
const Standard_Boolean theUseDepthWrite,
|
||||
Standard_Integer& theRenderingPassFlags);
|
||||
|
||||
//! Setup current color.
|
||||
@@ -723,26 +738,28 @@ public: //! @name core profiles
|
||||
|
||||
public: //! @name extensions
|
||||
|
||||
Standard_Boolean hasHighp; //!< highp in GLSL ES fragment shader is supported
|
||||
Standard_Boolean hasUintIndex; //!< GLuint for index buffer is supported (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_element_index_uint)
|
||||
Standard_Boolean hasTexRGBA8; //!< always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
|
||||
Standard_Boolean arbNPTW; //!< GL_ARB_texture_non_power_of_two
|
||||
Standard_Boolean arbTexRG; //!< GL_ARB_texture_rg
|
||||
Standard_Boolean arbTexFloat; //!< GL_ARB_texture_float (on desktop OpenGL - since 3.0 or as extension GL_ARB_texture_float; on OpenGL ES - since 3.0)
|
||||
OpenGl_ArbTexBindless* arbTexBindless; //!< GL_ARB_bindless_texture
|
||||
OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
|
||||
Standard_Boolean arbTboRGB32; //!< GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0
|
||||
OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
|
||||
OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
|
||||
OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
|
||||
OpenGl_ArbFBOBlit* arbFBOBlit; //!< glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
|
||||
Standard_Boolean extFragDepth; //!< GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0)
|
||||
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
||||
Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
|
||||
Standard_Boolean extAnis; //!< GL_EXT_texture_filter_anisotropic
|
||||
Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
|
||||
Standard_Boolean atiMem; //!< GL_ATI_meminfo
|
||||
Standard_Boolean nvxMem; //!< GL_NVX_gpu_memory_info
|
||||
Standard_Boolean hasHighp; //!< highp in GLSL ES fragment shader is supported
|
||||
Standard_Boolean hasUintIndex; //!< GLuint for index buffer is supported (always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_element_index_uint)
|
||||
Standard_Boolean hasTexRGBA8; //!< always available on desktop; on OpenGL ES - since 3.0 or as extension GL_OES_rgb8_rgba8
|
||||
Standard_Boolean arbNPTW; //!< GL_ARB_texture_non_power_of_two
|
||||
Standard_Boolean arbTexRG; //!< GL_ARB_texture_rg
|
||||
Standard_Boolean arbTexFloat; //!< GL_ARB_texture_float (on desktop OpenGL - since 3.0 or as extension GL_ARB_texture_float; on OpenGL ES - since 3.0)
|
||||
Standard_Boolean arbTexHalfFloat; //!< GL_ARB_half_float_pixel (on desktop OpenGL - since 3.0 or as extension GL_ARB_half_float_pixel; on OpenGL ES - since 3.0 or as extension GL_OES_texture_half_float)
|
||||
Standard_Boolean arbSampleShading;//!< GL_ARB_sample_shading
|
||||
OpenGl_ArbTexBindless* arbTexBindless; //!< GL_ARB_bindless_texture
|
||||
OpenGl_ArbTBO* arbTBO; //!< GL_ARB_texture_buffer_object
|
||||
Standard_Boolean arbTboRGB32; //!< GL_ARB_texture_buffer_object_rgb32 (3-component TBO), in core since 4.0
|
||||
OpenGl_ArbIns* arbIns; //!< GL_ARB_draw_instanced
|
||||
OpenGl_ArbDbg* arbDbg; //!< GL_ARB_debug_output
|
||||
OpenGl_ArbFBO* arbFBO; //!< GL_ARB_framebuffer_object
|
||||
OpenGl_ArbFBOBlit* arbFBOBlit; //!< glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
|
||||
Standard_Boolean extFragDepth; //!< GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0)
|
||||
OpenGl_ExtGS* extGS; //!< GL_EXT_geometry_shader4
|
||||
Standard_Boolean extBgra; //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
|
||||
Standard_Boolean extAnis; //!< GL_EXT_texture_filter_anisotropic
|
||||
Standard_Boolean extPDS; //!< GL_EXT_packed_depth_stencil
|
||||
Standard_Boolean atiMem; //!< GL_ATI_meminfo
|
||||
Standard_Boolean nvxMem; //!< GL_NVX_gpu_memory_info
|
||||
|
||||
public: //! @name public properties tracking current state
|
||||
|
||||
@@ -777,6 +794,7 @@ private: // context info
|
||||
typedef NCollection_Shared< NCollection_DataMap<TCollection_AsciiString, Standard_Integer> > OpenGl_DelayReleaseMap;
|
||||
typedef NCollection_Shared< NCollection_DataMap<TCollection_AsciiString, Handle(OpenGl_Resource)> > OpenGl_ResourcesMap;
|
||||
typedef NCollection_Shared< NCollection_List<Handle(OpenGl_Resource)> > OpenGl_ResourcesStack;
|
||||
typedef NCollection_SparseArray<Standard_Integer> OpenGl_DrawBuffers;
|
||||
|
||||
Handle(OpenGl_ResourcesMap) mySharedResources; //!< shared resources with unique identification key
|
||||
Handle(OpenGl_DelayReleaseMap) myDelayed; //!< shared resources for delayed release
|
||||
@@ -792,6 +810,7 @@ private: // context info
|
||||
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
||||
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
|
||||
Standard_Integer myMaxMsaaSamples; //!< value for GL_MAX_SAMPLES
|
||||
Standard_Integer myMaxDrawBuffers; //!< value for GL_MAX_DRAW_BUFFERS
|
||||
Standard_Integer myGlVerMajor; //!< cached GL version major number
|
||||
Standard_Integer myGlVerMinor; //!< cached GL version minor number
|
||||
Standard_Boolean myIsInitialized; //!< flag indicates initialization state
|
||||
@@ -799,6 +818,7 @@ private: // context info
|
||||
Standard_Boolean myIsGlNormalizeEnabled; //!< GL_NORMALIZE flag
|
||||
//!< Used to tell OpenGl that normals should be normalized
|
||||
|
||||
Standard_Boolean myHasHalfFloatTextures; //! indicates whether half-float textures are supported
|
||||
Standard_Boolean myHasRayTracing; //! indicates whether ray tracing mode is supported
|
||||
Standard_Boolean myHasRayTracingTextures; //! indicates whether textures in ray tracing mode are supported
|
||||
Standard_Boolean myHasRayTracingAdaptiveSampling; //! indicates whether adaptive screen sampling in ray tracing mode is supported
|
||||
@@ -817,7 +837,7 @@ private: //! @name fields tracking current state
|
||||
Standard_Integer myPolygonMode; //!< currently used polygon rasterization mode (glPolygonMode)
|
||||
bool myToCullBackFaces; //!< back face culling mode enabled state (glIsEnabled (GL_CULL_FACE))
|
||||
Standard_Integer myReadBuffer; //!< current read buffer
|
||||
Standard_Integer myDrawBuffer; //!< current draw buffer
|
||||
OpenGl_DrawBuffers myDrawBuffers; //!< current draw buffers
|
||||
unsigned int myDefaultVao; //!< default Vertex Array Object
|
||||
Standard_Boolean myIsGlDebugCtx; //!< debug context initialization state
|
||||
TCollection_AsciiString myVendor; //!< Graphics Driver's vendor
|
||||
|
@@ -63,12 +63,12 @@ public:
|
||||
//! @param theWorkspace [in] the rendering workspace.
|
||||
//! @param theFilter [in] the rendering filter to check whether the element
|
||||
//! should be rendered or not.
|
||||
//! @return True if element passes the filering check and is rendered.
|
||||
//! @return True if element passes the filtering check and is rendered.
|
||||
inline Standard_Boolean
|
||||
RenderFiltered (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Handle(OpenGl_RenderFilter)& theFilter) const
|
||||
{
|
||||
if (!theFilter.IsNull() && !theFilter->CanRender (this))
|
||||
if (!theFilter.IsNull() && !theFilter->ShouldRender (theWorkspace, this))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <Standard_Assert.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_FrameBuffer,OpenGl_Resource)
|
||||
|
||||
namespace
|
||||
@@ -64,6 +66,68 @@ namespace
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Determine data type from texture sized format.
|
||||
static bool getColorDataFormat (GLint theTextFormat,
|
||||
GLenum& thePixelFormat,
|
||||
GLenum& theDataType)
|
||||
{
|
||||
switch (theTextFormat)
|
||||
{
|
||||
case GL_RGBA32F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_R32F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA16F:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_R16F:
|
||||
{
|
||||
thePixelFormat = GL_RED;
|
||||
theDataType = GL_HALF_FLOAT;
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA8:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_UNSIGNED_INT;
|
||||
return true;
|
||||
}
|
||||
case GL_RGBA:
|
||||
{
|
||||
thePixelFormat = GL_RGBA;
|
||||
theDataType = GL_UNSIGNED_BYTE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Checks whether two format arrays are equal or not.
|
||||
static bool operator== (const OpenGl_ColorFormats& theFmt1,
|
||||
const OpenGl_ColorFormats& theFmt2)
|
||||
{
|
||||
if (theFmt1.Length() != theFmt2.Length())
|
||||
return false;
|
||||
OpenGl_ColorFormats::Iterator anIt1 (theFmt1);
|
||||
OpenGl_ColorFormats::Iterator anIt2 (theFmt1);
|
||||
for (; anIt1.More(); anIt1.Next(), anIt2.Next())
|
||||
{
|
||||
if (anIt1.Value() != anIt2.Value())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -74,16 +138,16 @@ OpenGl_FrameBuffer::OpenGl_FrameBuffer()
|
||||
: myVPSizeX (0),
|
||||
myVPSizeY (0),
|
||||
myNbSamples (0),
|
||||
myColorFormat (GL_RGBA8),
|
||||
myDepthFormat (GL_DEPTH24_STENCIL8),
|
||||
myGlFBufferId (NO_FRAMEBUFFER),
|
||||
myGlColorRBufferId (NO_RENDERBUFFER),
|
||||
myGlDepthRBufferId (NO_RENDERBUFFER),
|
||||
myIsOwnBuffer (false),
|
||||
myColorTexture (new OpenGl_Texture()),
|
||||
myIsOwnDepth (false),
|
||||
myDepthStencilTexture (new OpenGl_Texture())
|
||||
{
|
||||
//
|
||||
myColorFormats.Append (GL_RGBA8);
|
||||
myColorTextures.Append (new OpenGl_Texture());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -100,15 +164,49 @@ OpenGl_FrameBuffer::~OpenGl_FrameBuffer()
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlContext,
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const GLint theColorFormat,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples)
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const GLint theColorFormat,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples)
|
||||
{
|
||||
myColorFormat = theColorFormat;
|
||||
myDepthFormat = theDepthFormat;
|
||||
myNbSamples = theNbSamples;
|
||||
OpenGl_ColorFormats aColorFormats;
|
||||
|
||||
aColorFormats.Append (theColorFormat);
|
||||
|
||||
return Init (theGlContext, theSizeX, theSizeY, aColorFormats, theDepthFormat, theNbSamples);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlContext,
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const Handle(OpenGl_Texture)& theDepthStencilTexture,
|
||||
const GLsizei theNbSamples)
|
||||
{
|
||||
myColorFormats = theColorFormats;
|
||||
|
||||
OpenGl_TextureArray aTextures (myColorTextures);
|
||||
if (!myColorTextures.IsEmpty())
|
||||
{
|
||||
OpenGl_TextureArray::Iterator aTextureIt (myColorTextures);
|
||||
for (; aTextureIt.More(); aTextureIt.Next())
|
||||
{
|
||||
aTextureIt.Value()->Release (theGlContext.operator->());
|
||||
}
|
||||
myColorTextures.Clear();
|
||||
}
|
||||
for (Standard_Integer aLength = 0; aLength < myColorFormats.Length(); ++aLength)
|
||||
{
|
||||
myColorTextures.Append (aLength < aTextures.Length() ? aTextures.Value (aLength) : new OpenGl_Texture());
|
||||
}
|
||||
|
||||
myDepthFormat = theDepthStencilTexture->GetFormat();
|
||||
myNbSamples = theNbSamples;
|
||||
if (theGlContext->arbFBO == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -116,12 +214,14 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
|
||||
// clean up previous state
|
||||
Release (theGlContext.operator->());
|
||||
if (myColorFormat == 0
|
||||
if (std::count (myColorFormats.begin(), myColorFormats.end(), 0) == myColorFormats.Length()
|
||||
&& myDepthFormat == 0)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myDepthStencilTexture = theDepthStencilTexture;
|
||||
myIsOwnDepth = false;
|
||||
myIsOwnBuffer = true;
|
||||
|
||||
// setup viewport sizes as is
|
||||
@@ -133,63 +233,54 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
// Create the textures (will be used as color buffer and depth-stencil buffer)
|
||||
if (theNbSamples != 0)
|
||||
{
|
||||
if (myColorFormat != 0
|
||||
&& !myColorTexture ->Init2DMultisample (theGlContext, theNbSamples, myColorFormat, aSizeX, aSizeY))
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
if (myDepthFormat != 0
|
||||
&& !myDepthStencilTexture->Init2DMultisample (theGlContext, theNbSamples, myDepthFormat, aSizeX, aSizeY))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
if (aColorFormat != 0
|
||||
&& !aColorTexture->Init2DMultisample (theGlContext, theNbSamples,
|
||||
aColorFormat, aSizeX, aSizeY))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myColorFormat != 0
|
||||
&& !myColorTexture->Init (theGlContext, myColorFormat,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// extensions (GL_OES_packed_depth_stencil, GL_OES_depth_texture) + GL version might be used to determine supported formats
|
||||
// instead of just trying to create such texture
|
||||
GLenum aPixelFormat = 0;
|
||||
GLenum aDataType = 0;
|
||||
if (myDepthFormat != 0
|
||||
&& getDepthDataFormat (myDepthFormat, aPixelFormat, aDataType)
|
||||
&& !myDepthStencilTexture->Init (theGlContext, myDepthFormat,
|
||||
aPixelFormat, aDataType,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "Warning! Depth textures are not supported by hardware!";
|
||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_PORTABILITY,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
|
||||
theGlContext->arbFBO->glGenRenderbuffers (1, &myGlDepthRBufferId);
|
||||
theGlContext->arbFBO->glBindRenderbuffer (GL_RENDERBUFFER, myGlDepthRBufferId);
|
||||
theGlContext->arbFBO->glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, aSizeX, aSizeY);
|
||||
theGlContext->arbFBO->glBindRenderbuffer (GL_RENDERBUFFER, NO_RENDERBUFFER);
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
if (aColorFormat != 0
|
||||
&& getColorDataFormat (aColorFormat, aPixelFormat, aDataType)
|
||||
&& !aColorTexture->Init (theGlContext, aColorFormat,
|
||||
aPixelFormat, aDataType,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build FBO and setup it as texture
|
||||
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||
if (myColorTexture->IsValid())
|
||||
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
myColorTexture->GetTarget(), myColorTexture->TextureId(), 0);
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
|
||||
if (aColorTexture->IsValid())
|
||||
{
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + aColorBufferIdx,
|
||||
aColorTexture->GetTarget(), aColorTexture->TextureId(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (myDepthStencilTexture->IsValid())
|
||||
{
|
||||
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
|
||||
@@ -221,6 +312,164 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlContext,
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples)
|
||||
{
|
||||
myColorFormats = theColorFormats;
|
||||
|
||||
OpenGl_TextureArray aTextures (myColorTextures);
|
||||
if (!myColorTextures.IsEmpty())
|
||||
{
|
||||
OpenGl_TextureArray::Iterator aTextureIt (myColorTextures);
|
||||
for (; aTextureIt.More(); aTextureIt.Next())
|
||||
{
|
||||
aTextureIt.Value()->Release (theGlContext.operator->());
|
||||
}
|
||||
myColorTextures.Clear();
|
||||
}
|
||||
for (Standard_Integer aLength = 0; aLength < myColorFormats.Length(); ++aLength)
|
||||
{
|
||||
myColorTextures.Append (aLength < aTextures.Length() ? aTextures.Value (aLength) : new OpenGl_Texture());
|
||||
}
|
||||
|
||||
myDepthFormat = theDepthFormat;
|
||||
myNbSamples = theNbSamples;
|
||||
if (theGlContext->arbFBO == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// clean up previous state
|
||||
Release (theGlContext.operator->());
|
||||
if (std::count (myColorFormats.begin(), myColorFormats.end(), 0) == myColorFormats.Length()
|
||||
&& myDepthFormat == 0)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myIsOwnBuffer = true;
|
||||
myIsOwnDepth = true;
|
||||
|
||||
// setup viewport sizes as is
|
||||
myVPSizeX = theSizeX;
|
||||
myVPSizeY = theSizeY;
|
||||
const Standard_Integer aSizeX = theSizeX > 0 ? theSizeX : 2;
|
||||
const Standard_Integer aSizeY = theSizeY > 0 ? theSizeY : 2;
|
||||
|
||||
// Create the textures (will be used as color buffer and depth-stencil buffer)
|
||||
if (theNbSamples != 0)
|
||||
{
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
if (aColorFormat != 0
|
||||
&& !aColorTexture->Init2DMultisample (theGlContext, theNbSamples,
|
||||
aColorFormat, aSizeX, aSizeY))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
if (myDepthFormat != 0
|
||||
&& !myDepthStencilTexture->Init2DMultisample (theGlContext, theNbSamples, myDepthFormat, aSizeX, aSizeY))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GLenum aPixelFormat = 0;
|
||||
GLenum aDataType = 0;
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
const GLint aColorFormat = myColorFormats (aColorBufferIdx);
|
||||
if (aColorFormat != 0
|
||||
&& getColorDataFormat (aColorFormat, aPixelFormat, aDataType)
|
||||
&& !aColorTexture->Init (theGlContext, aColorFormat,
|
||||
aPixelFormat, aDataType,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// extensions (GL_OES_packed_depth_stencil, GL_OES_depth_texture) + GL version might be used to determine supported formats
|
||||
// instead of just trying to create such texture
|
||||
if (myDepthFormat != 0
|
||||
&& getDepthDataFormat (myDepthFormat, aPixelFormat, aDataType)
|
||||
&& !myDepthStencilTexture->Init (theGlContext, myDepthFormat,
|
||||
aPixelFormat, aDataType,
|
||||
aSizeX, aSizeY, Graphic3d_TOT_2D))
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "Warning! Depth textures are not supported by hardware!";
|
||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_PORTABILITY,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
|
||||
theGlContext->arbFBO->glGenRenderbuffers (1, &myGlDepthRBufferId);
|
||||
theGlContext->arbFBO->glBindRenderbuffer (GL_RENDERBUFFER, myGlDepthRBufferId);
|
||||
theGlContext->arbFBO->glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, aSizeX, aSizeY);
|
||||
theGlContext->arbFBO->glBindRenderbuffer (GL_RENDERBUFFER, NO_RENDERBUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
// Build FBO and setup it as texture
|
||||
theGlContext->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
|
||||
theGlContext->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
|
||||
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < myColorTextures.Length(); ++aColorBufferIdx)
|
||||
{
|
||||
const Handle(OpenGl_Texture)& aColorTexture = myColorTextures (aColorBufferIdx);
|
||||
|
||||
if (aColorTexture->IsValid())
|
||||
{
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + aColorBufferIdx,
|
||||
aColorTexture->GetTarget(), aColorTexture->TextureId(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (myDepthStencilTexture->IsValid())
|
||||
{
|
||||
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
#else
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
theGlContext->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
|
||||
#endif
|
||||
}
|
||||
else if (myGlDepthRBufferId != NO_RENDERBUFFER)
|
||||
{
|
||||
theGlContext->arbFBO->glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, myGlDepthRBufferId);
|
||||
}
|
||||
if (theGlContext->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
Release (theGlContext.operator->());
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
UnbindBuffer (theGlContext);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitLazy
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::InitLazy (const Handle(OpenGl_Context)& theGlContext,
|
||||
const GLsizei theViewportSizeX,
|
||||
const GLsizei theViewportSizeY,
|
||||
@@ -228,16 +477,44 @@ Standard_Boolean OpenGl_FrameBuffer::InitLazy (const Handle(OpenGl_Context)& the
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples)
|
||||
{
|
||||
if (myVPSizeX == theViewportSizeX
|
||||
&& myVPSizeY == theViewportSizeY
|
||||
&& myColorFormat == theColorFormat
|
||||
&& myDepthFormat == theDepthFormat
|
||||
&& myNbSamples == theNbSamples)
|
||||
OpenGl_ColorFormats aColorFormats;
|
||||
|
||||
aColorFormats.Append (theColorFormat);
|
||||
|
||||
return InitLazy (theGlContext, theViewportSizeX, theViewportSizeY, aColorFormats, theDepthFormat, theNbSamples);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitLazy
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::InitLazy (const Handle(OpenGl_Context)& theGlContext,
|
||||
const GLsizei theViewportSizeX,
|
||||
const GLsizei theViewportSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples)
|
||||
{
|
||||
if (myVPSizeX == theViewportSizeX
|
||||
&& myVPSizeY == theViewportSizeY
|
||||
&& myColorFormats == theColorFormats
|
||||
&& myDepthFormat == theDepthFormat
|
||||
&& myNbSamples == theNbSamples)
|
||||
{
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
return Init (theGlContext, theViewportSizeX, theViewportSizeY, theColorFormat, theDepthFormat, theNbSamples);
|
||||
return Init (theGlContext, theViewportSizeX, theViewportSizeY, theColorFormats, theDepthFormat, theNbSamples);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitLazy
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_FrameBuffer::InitLazy (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const OpenGl_FrameBuffer& theFbo)
|
||||
{
|
||||
return InitLazy (theGlCtx, theFbo.myVPSizeX, theFbo.myVPSizeY, theFbo.myColorFormats, theFbo.myDepthFormat, theFbo.myNbSamples);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -251,9 +528,22 @@ Standard_Boolean OpenGl_FrameBuffer::InitWithRB (const Handle(OpenGl_Context)& t
|
||||
const GLint theDepthFormat,
|
||||
const GLuint theColorRBufferFromWindow)
|
||||
{
|
||||
myColorFormat = theColorFormat;
|
||||
myDepthFormat = theDepthFormat;
|
||||
myNbSamples = 0;
|
||||
myColorFormats.Clear();
|
||||
myColorFormats.Append (theColorFormat);
|
||||
if (!myColorTextures.IsEmpty())
|
||||
{
|
||||
Handle(OpenGl_Texture) aTexutre = myColorTextures.First();
|
||||
OpenGl_TextureArray::Iterator aTextureIt (myColorTextures);
|
||||
for (; aTextureIt.More(); aTextureIt.Next())
|
||||
{
|
||||
aTextureIt.Value()->Release (theGlCtx.operator->());
|
||||
}
|
||||
myColorTextures.Clear();
|
||||
myColorTextures.Append (aTexutre);
|
||||
}
|
||||
|
||||
myDepthFormat = theDepthFormat;
|
||||
myNbSamples = 0;
|
||||
if (theGlCtx->arbFBO == NULL)
|
||||
{
|
||||
return Standard_False;
|
||||
@@ -263,6 +553,7 @@ Standard_Boolean OpenGl_FrameBuffer::InitWithRB (const Handle(OpenGl_Context)& t
|
||||
Release (theGlCtx.operator->());
|
||||
|
||||
myIsOwnBuffer = true;
|
||||
myIsOwnDepth = true;
|
||||
|
||||
// setup viewport sizes as is
|
||||
myVPSizeX = theSizeX;
|
||||
@@ -275,11 +566,11 @@ Standard_Boolean OpenGl_FrameBuffer::InitWithRB (const Handle(OpenGl_Context)& t
|
||||
{
|
||||
myGlColorRBufferId = theColorRBufferFromWindow;
|
||||
}
|
||||
else if (myColorFormat != 0)
|
||||
else if (theColorFormat != 0)
|
||||
{
|
||||
theGlCtx->arbFBO->glGenRenderbuffers (1, &myGlColorRBufferId);
|
||||
theGlCtx->arbFBO->glBindRenderbuffer (GL_RENDERBUFFER, myGlColorRBufferId);
|
||||
theGlCtx->arbFBO->glRenderbufferStorage (GL_RENDERBUFFER, myColorFormat, aSizeX, aSizeY);
|
||||
theGlCtx->arbFBO->glRenderbufferStorage (GL_RENDERBUFFER, theColorFormat, aSizeX, aSizeY);
|
||||
}
|
||||
|
||||
if (myDepthFormat != 0)
|
||||
@@ -344,17 +635,19 @@ Standard_Boolean OpenGl_FrameBuffer::InitWrapper (const Handle(OpenGl_Context)&
|
||||
GLint aColorId = 0;
|
||||
GLint aDepthType = 0;
|
||||
GLint aDepthId = 0;
|
||||
|
||||
theGlCtx->arbFBO->glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &aColorType);
|
||||
theGlCtx->arbFBO->glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &aDepthType);
|
||||
|
||||
myGlFBufferId = GLuint(anFbo);
|
||||
myIsOwnBuffer = false;
|
||||
myIsOwnDepth = false;
|
||||
if (aColorType == GL_RENDERBUFFER)
|
||||
{
|
||||
theGlCtx->arbFBO->glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &aColorId);
|
||||
myGlColorRBufferId = aColorId;
|
||||
}
|
||||
else if (aColorType != GL_NONE)
|
||||
else if (aColorType != 0)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = "OpenGl_FrameBuffer::InitWrapper(), color attachment of unsupported type has been skipped!";
|
||||
theGlCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
@@ -369,7 +662,7 @@ Standard_Boolean OpenGl_FrameBuffer::InitWrapper (const Handle(OpenGl_Context)&
|
||||
theGlCtx->arbFBO->glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &aDepthId);
|
||||
myGlDepthRBufferId = aDepthId;
|
||||
}
|
||||
else if (aDepthType != GL_NONE)
|
||||
else if (aDepthType != 0)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = "OpenGl_FrameBuffer::InitWrapper(), depth attachment of unsupported type has been skipped!";
|
||||
theGlCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
@@ -422,8 +715,17 @@ void OpenGl_FrameBuffer::Release (OpenGl_Context* theGlCtx)
|
||||
myIsOwnBuffer = false;
|
||||
}
|
||||
|
||||
myColorTexture->Release (theGlCtx);
|
||||
myDepthStencilTexture->Release (theGlCtx);
|
||||
for (Standard_Integer aColorBufferIdx = 0; aColorBufferIdx < NbColorBuffers(); ++aColorBufferIdx)
|
||||
{
|
||||
myColorTextures (aColorBufferIdx)->Release (theGlCtx);
|
||||
}
|
||||
|
||||
if (myIsOwnDepth)
|
||||
{
|
||||
myDepthStencilTexture->Release (theGlCtx);
|
||||
|
||||
myIsOwnDepth = false;
|
||||
}
|
||||
|
||||
myVPSizeX = 0;
|
||||
myVPSizeY = 0;
|
||||
|
@@ -19,14 +19,18 @@
|
||||
#include <OpenGl_Resource.hxx>
|
||||
#include <OpenGl_Texture.hxx>
|
||||
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
class OpenGl_FrameBuffer;
|
||||
DEFINE_STANDARD_HANDLE(OpenGl_FrameBuffer, OpenGl_Resource)
|
||||
|
||||
//! Short declaration of useful collection types.
|
||||
typedef NCollection_Vector<GLint> OpenGl_ColorFormats;
|
||||
|
||||
//! Class implements FrameBuffer Object (FBO) resource
|
||||
//! intended for off-screen rendering.
|
||||
class OpenGl_FrameBuffer : public OpenGl_Resource
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Helpful constants
|
||||
@@ -35,7 +39,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
//! Constructor.
|
||||
Standard_EXPORT OpenGl_FrameBuffer();
|
||||
|
||||
//! Destructor
|
||||
@@ -50,10 +54,16 @@ public:
|
||||
return myNbSamples;
|
||||
}
|
||||
|
||||
//! Return true if FBO has been created with color attachment.
|
||||
bool HasColor() const
|
||||
//! Number of color buffers.
|
||||
GLsizei NbColorBuffers() const
|
||||
{
|
||||
return myColorFormat != 0;
|
||||
return myColorTextures.Length();
|
||||
}
|
||||
|
||||
//! Return true if FBO has been created with color attachment.
|
||||
bool HasColor (const GLint theColorBufferIdx = 0) const
|
||||
{
|
||||
return myColorFormats (theColorBufferIdx) != 0;
|
||||
}
|
||||
|
||||
//! Return true if FBO has been created with depth attachment.
|
||||
@@ -65,13 +75,13 @@ public:
|
||||
//! Textures width.
|
||||
GLsizei GetSizeX() const
|
||||
{
|
||||
return myColorTexture->SizeX();
|
||||
return myColorTextures (0)->SizeX();
|
||||
}
|
||||
|
||||
//! Textures height.
|
||||
GLsizei GetSizeY() const
|
||||
{
|
||||
return myColorTexture->SizeY();
|
||||
return myColorTextures (0)->SizeY();
|
||||
}
|
||||
|
||||
//! Viewport width.
|
||||
@@ -92,13 +102,20 @@ public:
|
||||
return isValidFrameBuffer();
|
||||
}
|
||||
|
||||
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const Handle(OpenGl_Texture)& theDepthStencilTexture,
|
||||
const GLsizei theNbSamples = 0);
|
||||
|
||||
//! Initialize FBO for rendering into textures.
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @param theColorFormat color texture sized format (0 means no color attachment), e.g. GL_RGBA8
|
||||
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
|
||||
//! @param theNbSamples MSAA number of samples (0 means normal texture)
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @param theColorFormat color texture sized format (0 means no color attachment), e.g. GL_RGBA8
|
||||
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
|
||||
//! @param theNbSamples MSAA number of samples (0 means normal texture)
|
||||
//! @return true on success
|
||||
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theSizeX,
|
||||
@@ -107,6 +124,21 @@ public:
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples = 0);
|
||||
|
||||
//! Initialize FBO for rendering into textures.
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theSizeX texture width
|
||||
//! @param theSizeY texture height
|
||||
//! @param theColorFormats color texture sized format (0 means no color attachment), e.g. GL_RGBA8
|
||||
//! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
|
||||
//! @param theNbSamples MSAA number of samples (0 means normal texture)
|
||||
//! @return true on success
|
||||
Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theSizeX,
|
||||
const GLsizei theSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples = 0);
|
||||
|
||||
//! (Re-)initialize FBO with specified dimensions.
|
||||
Standard_EXPORT Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theViewportSizeX,
|
||||
@@ -115,20 +147,25 @@ public:
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples = 0);
|
||||
|
||||
//! (Re-)initialize FBO with specified dimensions.
|
||||
Standard_EXPORT Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theViewportSizeX,
|
||||
const GLsizei theViewportSizeY,
|
||||
const OpenGl_ColorFormats& theColorFormats,
|
||||
const GLint theDepthFormat,
|
||||
const GLsizei theNbSamples = 0);
|
||||
|
||||
//! (Re-)initialize FBO with properties taken from another FBO.
|
||||
Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const OpenGl_FrameBuffer& theFbo)
|
||||
{
|
||||
return InitLazy (theGlCtx, theFbo.myVPSizeX, theFbo.myVPSizeY, theFbo.myColorFormat, theFbo.myDepthFormat, theFbo.myNbSamples);
|
||||
}
|
||||
Standard_EXPORT Standard_Boolean InitLazy (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const OpenGl_FrameBuffer& theFbo);
|
||||
|
||||
//! (Re-)initialize FBO with specified dimensions.
|
||||
//! The Render Buffer Objects will be used for Color, Depth and Stencil attachments (as opposite to textures).
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theSizeX render buffer width
|
||||
//! @param theSizeY render buffer height
|
||||
//! @param theColorFormat color render buffer sized format, e.g. GL_RGBA8
|
||||
//! @param theDepthFormat depth-stencil render buffer sized format, e.g. GL_DEPTH24_STENCIL8
|
||||
//! @param theGlCtx currently bound OpenGL context
|
||||
//! @param theSizeX render buffer width
|
||||
//! @param theSizeY render buffer height
|
||||
//! @param theColorFormat color render buffer sized format, e.g. GL_RGBA8
|
||||
//! @param theDepthFormat depth-stencil render buffer sized format, e.g. GL_DEPTH24_STENCIL8
|
||||
//! @param theColorRBufferFromWindow when specified - should be ID of already initialized RB object, which will be released within this class
|
||||
Standard_EXPORT Standard_Boolean InitWithRB (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const GLsizei theSizeX,
|
||||
@@ -161,9 +198,9 @@ public:
|
||||
Standard_EXPORT virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Returns the color texture.
|
||||
inline const Handle(OpenGl_Texture)& ColorTexture() const
|
||||
inline const Handle(OpenGl_Texture)& ColorTexture (const GLint theColorBufferIdx = 0) const
|
||||
{
|
||||
return myColorTexture;
|
||||
return myColorTextures (theColorBufferIdx);
|
||||
}
|
||||
|
||||
//! Returns the depth-stencil texture.
|
||||
@@ -193,16 +230,19 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
typedef NCollection_Vector<Handle(OpenGl_Texture)> OpenGl_TextureArray;
|
||||
|
||||
GLsizei myVPSizeX; //!< viewport width (should be <= texture width)
|
||||
GLsizei myVPSizeY; //!< viewport height (should be <= texture height)
|
||||
GLsizei myNbSamples; //!< number of MSAA samples
|
||||
GLint myColorFormat; //!< sized format for color texture, GL_RGBA8 by default
|
||||
OpenGl_ColorFormats myColorFormats; //!< sized format for color texture, GL_RGBA8 by default
|
||||
GLint myDepthFormat; //!< sized format for depth-stencil texture, GL_DEPTH24_STENCIL8 by default
|
||||
GLuint myGlFBufferId; //!< FBO object ID
|
||||
GLuint myGlColorRBufferId; //!< color Render Buffer object (alternative to myColorTexture)
|
||||
GLuint myGlDepthRBufferId; //!< depth-stencil Render Buffer object (alternative to myDepthStencilTexture)
|
||||
bool myIsOwnBuffer; //!< flag indicating that FBO should be deallocated by this class
|
||||
Handle(OpenGl_Texture) myColorTexture; //!< color texture object
|
||||
bool myIsOwnDepth; //!< flag indicating that FBO should be deallocated by this class
|
||||
OpenGl_TextureArray myColorTextures; //!< color texture objects
|
||||
Handle(OpenGl_Texture) myDepthStencilTexture; //!< depth-stencil texture object
|
||||
|
||||
public:
|
||||
|
@@ -186,6 +186,45 @@
|
||||
#define GL_DEBUG_SEVERITY_HIGH 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
|
||||
// GL_EXT_draw_buffers
|
||||
#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
|
||||
#define GL_MAX_DRAW_BUFFERS 0x8824
|
||||
#define GL_DRAW_BUFFER0 0x8825
|
||||
#define GL_DRAW_BUFFER1 0x8826
|
||||
#define GL_DRAW_BUFFER2 0x8827
|
||||
#define GL_DRAW_BUFFER3 0x8828
|
||||
#define GL_DRAW_BUFFER4 0x8829
|
||||
#define GL_DRAW_BUFFER5 0x882A
|
||||
#define GL_DRAW_BUFFER6 0x882B
|
||||
#define GL_DRAW_BUFFER7 0x882C
|
||||
#define GL_DRAW_BUFFER8 0x882D
|
||||
#define GL_DRAW_BUFFER9 0x882E
|
||||
#define GL_DRAW_BUFFER10 0x882F
|
||||
#define GL_DRAW_BUFFER11 0x8830
|
||||
#define GL_DRAW_BUFFER12 0x8831
|
||||
#define GL_DRAW_BUFFER13 0x8832
|
||||
#define GL_DRAW_BUFFER14 0x8833
|
||||
#define GL_DRAW_BUFFER15 0x8834
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2 0x8CE2
|
||||
#define GL_COLOR_ATTACHMENT3 0x8CE3
|
||||
#define GL_COLOR_ATTACHMENT4 0x8CE4
|
||||
#define GL_COLOR_ATTACHMENT5 0x8CE5
|
||||
#define GL_COLOR_ATTACHMENT6 0x8CE6
|
||||
#define GL_COLOR_ATTACHMENT7 0x8CE7
|
||||
#define GL_COLOR_ATTACHMENT8 0x8CE8
|
||||
#define GL_COLOR_ATTACHMENT9 0x8CE9
|
||||
#define GL_COLOR_ATTACHMENT10 0x8CEA
|
||||
#define GL_COLOR_ATTACHMENT11 0x8CEB
|
||||
#define GL_COLOR_ATTACHMENT12 0x8CEC
|
||||
#define GL_COLOR_ATTACHMENT13 0x8CED
|
||||
#define GL_COLOR_ATTACHMENT14 0x8CEE
|
||||
#define GL_COLOR_ATTACHMENT15 0x8CEF
|
||||
|
||||
// OES_texture_half_float
|
||||
#define GL_HALF_FLOAT 0x8D61
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_EGL) && (defined(__ANDROID__) || defined(__QNX__) || defined(HAVE_GLES2) || defined(OCCT_UWP))
|
||||
@@ -752,6 +791,9 @@ public: //! @name OpenGL ES 3.0
|
||||
typedef void (*glTexImage3D_t)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data);
|
||||
glTexImage3D_t glTexImage3D;
|
||||
|
||||
typedef void (*glDrawBuffers_t)(GLsizei n, const GLenum* bufs);
|
||||
glDrawBuffers_t glDrawBuffers;
|
||||
|
||||
public: //! @name OpenGL ES 3.1
|
||||
|
||||
typedef void (*glTexStorage2DMultisample_t)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
|
@@ -242,6 +242,28 @@ void OpenGl_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& th
|
||||
Update();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetGroupPrimitivesAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (myAspectFillCapping == NULL)
|
||||
{
|
||||
myAspectFillCapping = new OpenGl_AspectFillCapping (theAspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
myAspectFillCapping->SetAspect (theAspect);
|
||||
}
|
||||
Update();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddPrimitiveArray
|
||||
// purpose :
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <NCollection_List.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectFillCapping.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
@@ -103,6 +104,17 @@ public:
|
||||
//! Append text aspect as an element.
|
||||
Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspect) Standard_OVERRIDE;
|
||||
|
||||
//! Update section style aspect.
|
||||
Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect) Standard_OVERRIDE;
|
||||
|
||||
//! Returns section style aspect.
|
||||
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const Standard_OVERRIDE
|
||||
{
|
||||
return myAspectFillCapping != NULL
|
||||
? myAspectFillCapping->Aspect()
|
||||
: Handle(Graphic3d_AspectFillCapping)();
|
||||
}
|
||||
|
||||
//! Add primitive array element
|
||||
Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
|
||||
const Handle(Graphic3d_IndexBuffer)& theIndices,
|
||||
@@ -153,6 +165,9 @@ public:
|
||||
//! Returns OpenGL face aspect.
|
||||
const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
|
||||
|
||||
//! Returns OpenGL capping filling aspect.
|
||||
const OpenGl_AspectFillCapping* AspectFillCapping() const { return myAspectFillCapping; }
|
||||
|
||||
//! Is the group ray-tracable (contains ray-tracable elements)?
|
||||
Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
|
||||
|
||||
@@ -162,10 +177,11 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
OpenGl_AspectLine* myAspectLine;
|
||||
OpenGl_AspectFace* myAspectFace;
|
||||
OpenGl_AspectMarker* myAspectMarker;
|
||||
OpenGl_AspectText* myAspectText;
|
||||
OpenGl_AspectLine* myAspectLine;
|
||||
OpenGl_AspectFace* myAspectFace;
|
||||
OpenGl_AspectMarker* myAspectMarker;
|
||||
OpenGl_AspectText* myAspectText;
|
||||
OpenGl_AspectFillCapping* myAspectFillCapping;
|
||||
|
||||
OpenGl_ElementNode* myFirst;
|
||||
OpenGl_ElementNode* myLast;
|
||||
|
@@ -687,7 +687,9 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
theWorkspace->SetPolygonOffset (myLayerSettings.PolygonOffset());
|
||||
|
||||
// handle depth write
|
||||
theWorkspace->UseDepthWrite() = myLayerSettings.ToEnableDepthWrite();
|
||||
theWorkspace->UseDepthWrite() = myLayerSettings.ToEnableDepthWrite()
|
||||
&& theDefaultSettings.DepthMask == GL_TRUE;
|
||||
|
||||
glDepthMask (theWorkspace->UseDepthWrite() ? GL_TRUE : GL_FALSE);
|
||||
|
||||
const Standard_Boolean hasLocalCS = !myLayerSettings.OriginTransformation().IsNull();
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
|
||||
struct OpenGl_GlobalLayerSettings
|
||||
{
|
||||
GLint DepthFunc;
|
||||
|
@@ -13,10 +13,14 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_GlCore15.hxx>
|
||||
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <OpenGl_LayerList.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_VertexBuffer.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
@@ -31,7 +35,9 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
||||
myNbPriorities (theNbPriorities),
|
||||
myNbStructures (0),
|
||||
myImmediateNbStructures (0),
|
||||
myModifStateOfRaytraceable (0)
|
||||
myModifStateOfRaytraceable (0),
|
||||
myRenderOpaqueFilter (new OpenGl_OpaqueFilter()),
|
||||
myRenderTranspFilter (new OpenGl_TransparentFilter())
|
||||
{
|
||||
// insert default priority layers
|
||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||
@@ -50,6 +56,8 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
||||
myLayerIds.Bind (Graphic3d_ZLayerId_TopOSD, myLayers.Upper());
|
||||
|
||||
myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
|
||||
|
||||
myTransparentToProcess.Allocate (myLayers.Length());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -76,6 +84,8 @@ void OpenGl_LayerList::AddLayer (const Graphic3d_ZLayerId theLayerId)
|
||||
// add the new layer
|
||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||
myLayerIds.Bind (theLayerId, myLayers.Length());
|
||||
|
||||
myTransparentToProcess.Allocate (myLayers.Length());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -128,6 +138,8 @@ void OpenGl_LayerList::RemoveLayer (const Graphic3d_ZLayerId theLayerId)
|
||||
}
|
||||
|
||||
myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
|
||||
|
||||
myTransparentToProcess.Allocate (myLayers.Length());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -378,17 +390,39 @@ void OpenGl_LayerList::SetLayerSettings (const Graphic3d_ZLayerId theLaye
|
||||
//=======================================================================
|
||||
void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Standard_Boolean theToDrawImmediate,
|
||||
const OpenGl_LayerFilter theLayersToProcess) const
|
||||
const OpenGl_LayerFilter theLayersToProcess,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo) const
|
||||
{
|
||||
// Remember global settings for glDepth function and write mask.
|
||||
OpenGl_GlobalLayerSettings aDefaultSettings;
|
||||
|
||||
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
|
||||
aCtx->core11fwd->glGetIntegerv (GL_DEPTH_FUNC, &aDefaultSettings.DepthFunc);
|
||||
aCtx->core11fwd->glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
|
||||
|
||||
// Two render filters are used to support transparency draw. Opaque filter accepts
|
||||
// only non-transparent OpenGl elements of a layer and counts number of skipped
|
||||
// transparent ones. If the counter has positive value the layer is added into
|
||||
// transparency post-processing stack. At the end of drawing or once the depth
|
||||
// buffer is to be cleared the layers in the stack should be drawn using
|
||||
// blending and depth mask settings and another transparency filter which accepts
|
||||
// only transparent OpenGl elements of a layer. The stack <myTransparentToProcess>
|
||||
// was preallocated before going into this method and has enough space to keep
|
||||
// maximum number of references to layers, therefore it will not increase memory
|
||||
// fragmentation during regular rendering.
|
||||
const Handle(OpenGl_RenderFilter) aPrevFilter = theWorkspace->GetRenderFilter();
|
||||
myRenderOpaqueFilter->SetPreviousFilter (aPrevFilter);
|
||||
myRenderTranspFilter->SetPreviousFilter (aPrevFilter);
|
||||
theWorkspace->SetRenderFilter (myRenderOpaqueFilter);
|
||||
|
||||
myTransparentToProcess.Clear();
|
||||
|
||||
OpenGl_LayerStack ::iterator aStackIter (myTransparentToProcess.Origin());
|
||||
OpenGl_SequenceOfLayers::iterator anIts (myLayers.begin());
|
||||
Standard_Integer aSeqId = myLayers.Lower();
|
||||
bool toClearDepth = false;
|
||||
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
|
||||
bool toClearDepth = false;
|
||||
for (; anIts != myLayers.end(); ++anIts, ++aSeqId)
|
||||
{
|
||||
if (theLayersToProcess == OpenGl_LF_Bottom)
|
||||
{
|
||||
@@ -403,28 +437,54 @@ void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
if (aSeqId != myDefaultLayerIndex) continue;
|
||||
}
|
||||
|
||||
const OpenGl_Layer& aLayer = anIts.Value();
|
||||
const OpenGl_Layer& aLayer = (*anIts);
|
||||
if (aLayer.IsImmediate() != theToDrawImmediate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (aLayer.NbStructures() < 1)
|
||||
{
|
||||
// make sure to clear depth of previous layers even if layer has no structures
|
||||
// Make sure to clear depth of previous layers even if layer has no structures.
|
||||
toClearDepth = toClearDepth || aLayer.LayerSettings().ToClearDepth();
|
||||
continue;
|
||||
}
|
||||
|
||||
// depth buffers
|
||||
// At this point the depth buffer may be set to clear by
|
||||
// previous configuration of layers or configuration of the
|
||||
// current layer. Additional rendering pass to handle transparent
|
||||
// elements of recently drawn layers require use of current depth
|
||||
// buffer so we put remaining layers for processing as one bunch before
|
||||
// erasing the depth buffer.
|
||||
if (toClearDepth
|
||||
|| aLayer.LayerSettings().ToClearDepth())
|
||||
{
|
||||
if (!myTransparentToProcess.IsEmpty())
|
||||
{
|
||||
renderTransparent (theWorkspace, aStackIter, aDefaultSettings, theReadDrawFbo, theOitAccumFbo);
|
||||
}
|
||||
|
||||
toClearDepth = false;
|
||||
glDepthMask (GL_TRUE);
|
||||
glClear (GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
// Render opaque OpenGl elements of a layer and count the number of skipped.
|
||||
// If a layer has skipped (e.g. transparent) elements it should be added into
|
||||
// the transparency post-processing stack.
|
||||
myRenderOpaqueFilter->SetSkippedCounter (0);
|
||||
|
||||
aLayer.Render (theWorkspace, aDefaultSettings);
|
||||
|
||||
if (myRenderOpaqueFilter->NbSkipped() > 0)
|
||||
{
|
||||
myTransparentToProcess.Push (&aLayer);
|
||||
}
|
||||
}
|
||||
|
||||
// Before finishing process the remaining collected layers with transparency.
|
||||
if (!myTransparentToProcess.IsEmpty())
|
||||
{
|
||||
renderTransparent (theWorkspace, aStackIter, aDefaultSettings, theReadDrawFbo, theOitAccumFbo);
|
||||
}
|
||||
|
||||
if (toClearDepth)
|
||||
@@ -435,4 +495,232 @@ void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
|
||||
aCtx->core11fwd->glDepthMask (aDefaultSettings.DepthMask);
|
||||
aCtx->core11fwd->glDepthFunc (aDefaultSettings.DepthFunc);
|
||||
|
||||
theWorkspace->SetRenderFilter (aPrevFilter);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : renderTransparent
|
||||
//purpose : Render transparent objects using blending operator.
|
||||
//=======================================================================
|
||||
void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
OpenGl_LayerStack::iterator& theLayerIter,
|
||||
const OpenGl_GlobalLayerSettings& theGlobalSettings,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo) const
|
||||
{
|
||||
// Blended order-independent transparency algorithm require several preconditions
|
||||
// to be enabled. It should be requested by user, at least two outputs from
|
||||
// fragment shader should be supported by GPU, so is the given framebuffer
|
||||
// should contain two additional color buffers to handle accumulated color channels,
|
||||
// blended alpha channel and weight factors - these accumulation buffers are required
|
||||
// to implement commuting blend operator (at least OpenGl 2.0 should be available).
|
||||
const bool isEnabledOit = theOitAccumFbo != NULL
|
||||
&& theOitAccumFbo->NbColorBuffers() >= 2
|
||||
&& theOitAccumFbo->ColorTexture (0)->IsValid()
|
||||
&& theOitAccumFbo->ColorTexture (1)->IsValid();
|
||||
|
||||
// Check if current iterator has already reached the end of the stack.
|
||||
// This should happen if no additional layers has been added to
|
||||
// the processing stack after last transparency pass.
|
||||
if (theLayerIter == myTransparentToProcess.Back())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(OpenGl_Context) aCtx = theWorkspace->GetGlContext();
|
||||
const Handle(OpenGl_ShaderManager)& aManager = aCtx->ShaderManager();
|
||||
const OpenGl_View* aView = theWorkspace->View();
|
||||
const float aOitDepthWeight = aView ? aView->RenderingParams().OitDepthWeight : 0.0f;
|
||||
|
||||
theWorkspace->SetRenderFilter (myRenderTranspFilter);
|
||||
|
||||
aCtx->core11fwd->glEnable (GL_BLEND);
|
||||
|
||||
if (isEnabledOit)
|
||||
{
|
||||
aManager->SetOitState (true, aOitDepthWeight);
|
||||
|
||||
theOitAccumFbo->BindBuffer (aCtx);
|
||||
|
||||
static const Standard_Integer aDrawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
|
||||
aCtx->SetDrawBuffers (2, aDrawBuffers);
|
||||
aCtx->core11fwd->glClearColor (0.f, 0.f, 0.f, 1.f);
|
||||
aCtx->core11fwd->glClear (GL_COLOR_BUFFER_BIT);
|
||||
aCtx->core15fwd->glBlendFuncSeparate (GL_ONE, GL_ONE, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else
|
||||
{
|
||||
aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
// During blended order-independent transparency pass the depth test
|
||||
// should be enabled to discard fragments covered by opaque geometry
|
||||
// and depth writing should be disabled, because transparent fragments
|
||||
// overal each other with non unitary coverage factor.
|
||||
OpenGl_GlobalLayerSettings aGlobalSettings = theGlobalSettings;
|
||||
aGlobalSettings.DepthMask = GL_FALSE;
|
||||
aCtx->core11fwd->glDepthMask (GL_FALSE);
|
||||
|
||||
for (; theLayerIter != myTransparentToProcess.Back(); ++theLayerIter)
|
||||
{
|
||||
(*theLayerIter)->Render (theWorkspace, aGlobalSettings);
|
||||
}
|
||||
|
||||
// Revert state of rendering.
|
||||
if (isEnabledOit)
|
||||
{
|
||||
aManager->SetOitState (false, aOitDepthWeight);
|
||||
|
||||
theOitAccumFbo->UnbindBuffer (aCtx);
|
||||
|
||||
if (theReadDrawFbo)
|
||||
{
|
||||
theReadDrawFbo->BindBuffer (aCtx);
|
||||
}
|
||||
|
||||
static const Standard_Integer aDrawBuffers[] = { GL_COLOR_ATTACHMENT0 };
|
||||
|
||||
aCtx->SetDrawBuffers (1, aDrawBuffers);
|
||||
}
|
||||
|
||||
theWorkspace->SetRenderFilter (myRenderOpaqueFilter);
|
||||
|
||||
if (isEnabledOit)
|
||||
{
|
||||
const Standard_Boolean isMSAA = theReadDrawFbo && theReadDrawFbo->NbSamples() > 0;
|
||||
|
||||
OpenGl_VertexBuffer* aVerts = theWorkspace->View()->initBlitQuad (Standard_False);
|
||||
|
||||
if (aVerts->IsValid() && aManager->BindOitCompositingProgram (isMSAA))
|
||||
{
|
||||
aCtx->core11fwd->glDepthFunc (GL_ALWAYS);
|
||||
aCtx->core11fwd->glDepthMask (GL_FALSE);
|
||||
|
||||
// Bind full screen quad buffer and framebuffer resources.
|
||||
aVerts->BindVertexAttrib (aCtx, Graphic3d_TOA_POS);
|
||||
|
||||
const Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
|
||||
|
||||
theOitAccumFbo->ColorTexture (0)->Bind (aCtx, GL_TEXTURE0 + 0);
|
||||
theOitAccumFbo->ColorTexture (1)->Bind (aCtx, GL_TEXTURE0 + 1);
|
||||
|
||||
// Draw full screen quad with special shader to compose the buffers.
|
||||
aCtx->core11fwd->glBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
|
||||
aCtx->core11fwd->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
// Unbind OpenGL texture objects and shader program.
|
||||
aVerts->UnbindVertexAttrib (aCtx, Graphic3d_TOA_POS);
|
||||
theOitAccumFbo->ColorTexture (0)->Unbind (aCtx, GL_TEXTURE0 + 0);
|
||||
theOitAccumFbo->ColorTexture (1)->Unbind (aCtx, GL_TEXTURE0 + 1);
|
||||
aCtx->BindProgram (NULL);
|
||||
|
||||
if (!aTextureBack.IsNull())
|
||||
{
|
||||
theWorkspace->EnableTexture (aTextureBack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "Initialization of OIT compositing pass has failed.\n"
|
||||
+ " Blended order-independent transparency will not be available.\n";
|
||||
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
OpenGl_View* aView = theWorkspace->View();
|
||||
if (aView)
|
||||
{
|
||||
Standard_Boolean& aOITFlag = isMSAA ? aView->myToDisableOITMSAA : aView->myToDisableOIT;
|
||||
aOITFlag = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aCtx->core11fwd->glDisable (GL_BLEND);
|
||||
aCtx->core11fwd->glBlendFunc (GL_ONE, GL_ZERO);
|
||||
aCtx->core11fwd->glDepthMask (theGlobalSettings.DepthMask);
|
||||
aCtx->core11fwd->glDepthFunc (theGlobalSettings.DepthFunc);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : OpenGl_OpaqueFilter
|
||||
//function : ShouldRender
|
||||
//purpose : Checks whether the element should be rendered or skipped.
|
||||
//=======================================================================
|
||||
Standard_Boolean OpenGl_LayerList::OpenGl_OpaqueFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement)
|
||||
{
|
||||
if (!myFilter.IsNull() && !myFilter->ShouldRender (theWorkspace, theGlElement))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theGlElement);
|
||||
if (aPArray != NULL
|
||||
&& aPArray->DrawMode() >= OpenGl_PrimitiveArray::THE_FILLPRIM_FROM
|
||||
&& aPArray->DrawMode() <= OpenGl_PrimitiveArray::THE_FILLPRIM_TO)
|
||||
{
|
||||
const OpenGl_AspectFace* anAspect = theWorkspace->AspectFace();
|
||||
if (anAspect)
|
||||
{
|
||||
const bool toDistinguish = anAspect->Aspect()->Distinguish();
|
||||
const Graphic3d_MaterialAspect& aMatFrontSrc = anAspect->Aspect()->FrontMaterial();
|
||||
const Graphic3d_MaterialAspect& aMatBackSrc = toDistinguish
|
||||
? anAspect->Aspect()->BackMaterial()
|
||||
: aMatFrontSrc;
|
||||
|
||||
const Standard_Size aSkippedCounter = mySkippedCounter;
|
||||
if (((float)aMatFrontSrc.Transparency() > ShortRealEpsilon())
|
||||
|| ((float)aMatBackSrc .Transparency() > ShortRealEpsilon()))
|
||||
{
|
||||
mySkippedCounter++;
|
||||
}
|
||||
|
||||
return mySkippedCounter == aSkippedCounter;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : OpenGl_TransparentFilter
|
||||
//function : ShouldRender
|
||||
//purpose : Checks whether the element should be rendered or skipped.
|
||||
//=======================================================================
|
||||
Standard_Boolean OpenGl_LayerList::OpenGl_TransparentFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement)
|
||||
{
|
||||
if (!myFilter.IsNull() && !myFilter->ShouldRender (theWorkspace, theGlElement))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theGlElement);
|
||||
if (aPArray != NULL
|
||||
&& aPArray->DrawMode() >= OpenGl_PrimitiveArray::THE_FILLPRIM_FROM
|
||||
&& aPArray->DrawMode() <= OpenGl_PrimitiveArray::THE_FILLPRIM_TO)
|
||||
{
|
||||
const OpenGl_AspectFace* anAspect = theWorkspace->ApplyAspectFace();
|
||||
if (anAspect)
|
||||
{
|
||||
const bool toDistinguish = anAspect->Aspect()->Distinguish();
|
||||
const Graphic3d_MaterialAspect& aMatFrontSrc = anAspect->Aspect()->FrontMaterial();
|
||||
const Graphic3d_MaterialAspect& aMatBackSrc = toDistinguish
|
||||
? anAspect->Aspect()->BackMaterial()
|
||||
: aMatFrontSrc;
|
||||
|
||||
return ((float)aMatFrontSrc.Transparency() > ShortRealEpsilon())
|
||||
|| ((float)aMatBackSrc .Transparency() > ShortRealEpsilon());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return dynamic_cast<const OpenGl_AspectFace*> (theGlElement) != NULL;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <OpenGl_Layer.hxx>
|
||||
#include <OpenGl_LayerFilter.hxx>
|
||||
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
@@ -89,7 +91,9 @@ public:
|
||||
//! Render this element
|
||||
void Render (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Standard_Boolean theToDrawImmediate,
|
||||
const OpenGl_LayerFilter theLayersToProcess) const;
|
||||
const OpenGl_LayerFilter theLayersToProcess,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo) const;
|
||||
|
||||
//! Returns the set of OpenGL Z-layers.
|
||||
const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
|
||||
@@ -104,6 +108,132 @@ public:
|
||||
//! Returns structure modification state (for ray-tracing).
|
||||
Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Filter of TKOpenGl elements for processing only shading geometry and
|
||||
//! for collecting number of skipped elements to an external counter.
|
||||
class OpenGl_OpaqueFilter : public OpenGl_RenderFilter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
//! @param thePrevFilter [in] the previously active filter that should have additive effect.
|
||||
OpenGl_OpaqueFilter() : mySkippedCounter (0) {}
|
||||
|
||||
//! Sets the current active filter in workspace.
|
||||
//! @param thePrevFilter [in] the previously active filter that should have additive effect.
|
||||
void SetPreviousFilter (const Handle(OpenGl_RenderFilter)& thePrevFitler) { myFilter = thePrevFitler; }
|
||||
|
||||
//! Sets the value of the skipped elements counter.
|
||||
void SetSkippedCounter (const Standard_Size theCounter) { mySkippedCounter = theCounter; }
|
||||
|
||||
//! Returns number of skipped elements.
|
||||
Standard_Size NbSkipped() const { return mySkippedCounter; }
|
||||
|
||||
//! Checks whether the element should be rendered or skipped.
|
||||
//! @param theWorkspace [in] the currently used workspace for rendering.
|
||||
//! @param theGlElement [in] the TKOpenGl rendering queue element that should be checked before streaming to GPU.
|
||||
Standard_EXPORT virtual Standard_Boolean ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE (OpenGl_OpaqueFilter, OpenGl_RenderFilter)
|
||||
|
||||
private:
|
||||
|
||||
Standard_Size mySkippedCounter; //!< Counter of skipped elements.
|
||||
Handle(OpenGl_RenderFilter) myFilter; //!< Previous active filter that should be combined.
|
||||
};
|
||||
|
||||
//! Filter of TKOpenGl elements for keeping only shading geometry with transparency.
|
||||
class OpenGl_TransparentFilter : public OpenGl_RenderFilter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
OpenGl_TransparentFilter() {}
|
||||
|
||||
//! Sets the current active filter in workspace.
|
||||
//! @param thePrevFilter [in] the previously active filter that should have additive effect.
|
||||
void SetPreviousFilter (const Handle(OpenGl_RenderFilter)& thePrevFitler) { myFilter = thePrevFitler; }
|
||||
|
||||
//! Checks whether the element should be rendered or skipped.
|
||||
//! @param theWorkspace [in] the currently used workspace for rendering.
|
||||
//! @param theGlElement [in] the TKOpenGl rendering queue element that should be checked before streaming to GPU.
|
||||
Standard_EXPORT virtual Standard_Boolean ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theGlElement) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE (OpenGl_TransparentFilter, OpenGl_RenderFilter)
|
||||
|
||||
private:
|
||||
|
||||
Handle(OpenGl_RenderFilter) myFilter; //!< Previous active filter that should be combined.
|
||||
};
|
||||
|
||||
//! Stack of references to existing layers of predefined maximum size.
|
||||
class OpenGl_LayerStack
|
||||
{
|
||||
public:
|
||||
typedef NCollection_Array1<const OpenGl_Layer*>::iterator iterator;
|
||||
|
||||
//! Reallocate internal buffer of the stack.
|
||||
void Allocate (const Standard_Integer theSize)
|
||||
{
|
||||
if (theSize > 0)
|
||||
{
|
||||
myStackSpace = new NCollection_Array1<const OpenGl_Layer*> (1, theSize);
|
||||
myStackSpace->Init (NULL);
|
||||
myBackPtr = myStackSpace->begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
myStackSpace.Nullify();
|
||||
myBackPtr = iterator();
|
||||
}
|
||||
}
|
||||
|
||||
//! Clear stack.
|
||||
void Clear()
|
||||
{
|
||||
if (myStackSpace)
|
||||
{
|
||||
myStackSpace->Init (NULL);
|
||||
myBackPtr = myStackSpace->begin();
|
||||
}
|
||||
}
|
||||
|
||||
//! Push a new layer reference to the stack.
|
||||
void Push (const OpenGl_Layer* theLayer) { (*myBackPtr++) = theLayer; }
|
||||
|
||||
//! Returns iterator to the origin of the stack.
|
||||
iterator Origin() const { return myStackSpace.IsNull() ? iterator() : myStackSpace->begin(); }
|
||||
|
||||
//! Returns iterator to the back of the stack (after last item added).
|
||||
iterator Back() const { return myBackPtr; }
|
||||
|
||||
//! Returns true if nothing has been pushed into the stack.
|
||||
Standard_Boolean IsEmpty() const { return Back() == Origin(); }
|
||||
|
||||
private:
|
||||
|
||||
NCollection_Handle<NCollection_Array1<const OpenGl_Layer*> > myStackSpace;
|
||||
iterator myBackPtr;
|
||||
};
|
||||
|
||||
//! Render transparent objects using blending operator.
|
||||
//! Additional accumulation framebuffer is used for blended order-independent
|
||||
//! transparency algorithm. It should support floating-point color components
|
||||
//! and share depth with main reading/drawing framebuffer.
|
||||
//! @param theWorkspace [in] the currently used workspace for rendering.
|
||||
//! @param theLayerIter [in/out] the current iterator of transparent layers to process.
|
||||
//! @param theGlobalSettings [in] the set of global settings used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for reading depth and writing final color.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
void renderTransparent (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
OpenGl_LayerStack::iterator& theLayerIter,
|
||||
const OpenGl_GlobalLayerSettings& theGlobalSettings,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo) const;
|
||||
|
||||
protected:
|
||||
|
||||
// number of structures temporary put to default layer
|
||||
@@ -117,6 +247,12 @@ protected:
|
||||
|
||||
mutable Standard_Size myModifStateOfRaytraceable;
|
||||
|
||||
//! Collection of references to layers with transparency gathered during rendering pass.
|
||||
mutable OpenGl_LayerStack myTransparentToProcess;
|
||||
|
||||
Handle(OpenGl_OpaqueFilter) myRenderOpaqueFilter; //!< rendering filter for opaque drawing pass (blended OIT).
|
||||
Handle(OpenGl_TransparentFilter) myRenderTranspFilter; //!< rendering filter for transparency drawing pass (blended OIT).
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
55
src/OpenGl/OpenGl_OitUniformState.hxx
Normal file
55
src/OpenGl/OpenGl_OitUniformState.hxx
Normal file
@@ -0,0 +1,55 @@
|
||||
// Created on: 2017-01-26
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _OpenGl_OitUniformState_HeaderFile
|
||||
#define _OpenGl_OitUniformState_HeaderFile
|
||||
|
||||
#include <OpenGl_ShaderStates.hxx>
|
||||
|
||||
//! Defines generic state of order-independent transparency rendering properties.
|
||||
class OpenGl_OitUniformState : public OpenGl_StateInterface
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates new uniform state.
|
||||
OpenGl_OitUniformState() : myToEnableWrite (false), myDepthWeight (0.5f) {}
|
||||
|
||||
//! Sets the uniform values.
|
||||
//! @param theToEnableWrite [in] flag indicating whether color and coverage
|
||||
//! values for OIT processing should be written by shader program.
|
||||
//! @param theDepthWeight [in] scalar factor [0-1] defining influence of depth
|
||||
//! component of a fragment to its final coverage coefficient.
|
||||
void Set (const bool theToEnableWrite,
|
||||
const float theDepthWeight)
|
||||
{
|
||||
myToEnableWrite = theToEnableWrite;
|
||||
myDepthWeight = Max (0.f, Min (1.f, theDepthWeight));
|
||||
}
|
||||
|
||||
//! Returns flag indicating whether writing of output for OIT processing
|
||||
//! should be enabled/disabled.
|
||||
bool ToEnableWrite() const { return myToEnableWrite; }
|
||||
|
||||
//! Returns factor defining influence of depth component of a fragment
|
||||
//! to its final coverage coefficient.
|
||||
float DepthWeight() const { return myDepthWeight; }
|
||||
|
||||
private:
|
||||
|
||||
bool myToEnableWrite; //!< writing color and coverage.
|
||||
float myDepthWeight; //!< factor of depth influence to coverage.
|
||||
};
|
||||
|
||||
#endif // _OpenGl_OitUniformState_HeaderFile
|
@@ -40,6 +40,14 @@ public:
|
||||
DRAW_MODE_NONE = -1
|
||||
};
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
|
||||
static const GLint THE_FILLPRIM_TO = GL_POLYGON;
|
||||
#else
|
||||
static const GLint THE_FILLPRIM_FROM = GL_TRIANGLES;
|
||||
static const GLint THE_FILLPRIM_TO = GL_TRIANGLE_FAN;
|
||||
#endif
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT OpenGl_PrimitiveArray (const OpenGl_GraphicDriver* theDriver);
|
||||
|
||||
|
@@ -23,6 +23,7 @@ class OpenGl_RenderFilter;
|
||||
DEFINE_STANDARD_HANDLE (OpenGl_RenderFilter, Standard_Transient)
|
||||
|
||||
class OpenGl_Element;
|
||||
class OpenGl_Workspace;
|
||||
|
||||
//! Base class for defining element rendering filters.
|
||||
//! This class can be used in pair with advance rendering passes, and for
|
||||
@@ -32,13 +33,14 @@ class OpenGl_RenderFilter : public Standard_Transient
|
||||
public:
|
||||
|
||||
//! Checks whether the element can be rendered or not.
|
||||
//! @param theWorkspace [in] the current workspace.
|
||||
//! @param theElement [in] the element to check.
|
||||
//! @return True if element can be rendered.
|
||||
virtual Standard_Boolean CanRender (const OpenGl_Element* theElement) = 0;
|
||||
virtual Standard_Boolean ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace, const OpenGl_Element* theElement) = 0;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(OpenGl_RenderFilter,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(OpenGl_RenderFilter, Standard_Transient)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -31,7 +31,8 @@ enum OpenGl_ProgramOptions
|
||||
OpenGl_PO_ClipPlanes1 = 0x040, //!< handle 1 clipping plane
|
||||
OpenGl_PO_ClipPlanes2 = 0x080, //!< handle 2 clipping planes
|
||||
OpenGl_PO_ClipPlanesN = 0x100, //!< handle N clipping planes
|
||||
OpenGl_PO_NB = 0x200 //!< overall number of combinations
|
||||
OpenGl_PO_WriteOit = 0x200, //!< write color/coverage buffer for blended order independet transparency
|
||||
OpenGl_PO_NB = 0x400 //!< overall number of combinations
|
||||
};
|
||||
|
||||
//! Alias to programs array of predefined length
|
||||
|
@@ -331,6 +331,12 @@ const char THE_FRAG_CLIP_PLANES_2[] =
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Output color and coverage for accumulation by OIT algorithm.
|
||||
const char THE_FRAG_write_oit_buffers[] =
|
||||
EOL" float aWeight = occFragColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthWeight, 3.0), 1e-2, 1e+2);"
|
||||
EOL" occFragCoverage.r = occFragColor.a * aWeight;"
|
||||
EOL" occFragColor = vec4 (occFragColor.rgb * occFragColor.a * aWeight, occFragColor.a);";
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1069,6 +1075,37 @@ void OpenGl_ShaderManager::PushMaterialState (const Handle(OpenGl_ShaderProgram)
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PushOitUniformState
|
||||
// purpose : Pushes state of OIT uniforms to the specified program
|
||||
// =======================================================================
|
||||
void OpenGl_ShaderManager::PushOitUniformState (const Handle(OpenGl_ShaderProgram)& theProgram) const
|
||||
{
|
||||
if (!theProgram->IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (myOitUniformState.Index() == theProgram->ActiveState (OpenGL_OIT_UNIFORM_STATE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const GLint aLocEnableWrite = theProgram->GetStateLocation (OpenGl_OCCT_OIT_ENABLE_WRITE);
|
||||
if (aLocEnableWrite != OpenGl_ShaderProgram::INVALID_LOCATION)
|
||||
{
|
||||
theProgram->SetUniform (myContext, aLocEnableWrite,
|
||||
myOitUniformState.ToEnableWrite());
|
||||
}
|
||||
|
||||
const GLint aLocDepthWeight = theProgram->GetStateLocation (OpenGl_OCCT_OIT_DEPTH_WEIGHT);
|
||||
if (aLocDepthWeight != OpenGl_ShaderProgram::INVALID_LOCATION)
|
||||
{
|
||||
theProgram->SetUniform (myContext, aLocDepthWeight,
|
||||
myOitUniformState.DepthWeight());
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : PushState
|
||||
// purpose : Pushes state of OCCT graphics parameters to the program
|
||||
@@ -1082,6 +1119,7 @@ void OpenGl_ShaderManager::PushState (const Handle(OpenGl_ShaderProgram)& thePro
|
||||
PushProjectionState (aProgram);
|
||||
PushLightSourceState (aProgram);
|
||||
PushMaterialState (aProgram);
|
||||
PushOitUniformState (aProgram);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1208,6 +1246,82 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFboBlit()
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : prepareStdProgramOitCompositing
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderManager::prepareStdProgramOitCompositing (const Standard_Boolean theMsaa)
|
||||
{
|
||||
Handle(OpenGl_ShaderProgram)& aProgram = myOitCompositingProgram [theMsaa ? 1 : 0];
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
TCollection_AsciiString aSrcVert, aSrcFrag;
|
||||
|
||||
aSrcVert =
|
||||
EOL"THE_SHADER_OUT vec2 TexCoord;"
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" TexCoord = occVertex.zw;"
|
||||
EOL" gl_Position = vec4(occVertex.x, occVertex.y, 0.0, 1.0);"
|
||||
EOL"}";
|
||||
|
||||
if (!theMsaa)
|
||||
{
|
||||
aSrcFrag =
|
||||
EOL"uniform sampler2D uAccumTexture;"
|
||||
EOL"uniform sampler2D uWeightTexture;"
|
||||
EOL
|
||||
EOL"THE_SHADER_IN vec2 TexCoord;"
|
||||
EOL
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" vec4 aAccum = occTexture2D (uAccumTexture, TexCoord);"
|
||||
EOL" float aWeight = occTexture2D (uWeightTexture, TexCoord).r;"
|
||||
EOL" occFragColor = vec4 (aAccum.rgb / max (aWeight, 0.00001), aAccum.a);"
|
||||
EOL"}";
|
||||
|
||||
if (myContext->IsGlGreaterEqual (3, 2))
|
||||
{
|
||||
aProgramSrc->SetHeader ("#version 150");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aSrcFrag =
|
||||
EOL"uniform sampler2DMS uAccumTexture;"
|
||||
EOL"uniform sampler2DMS uWeightTexture;"
|
||||
EOL
|
||||
EOL"THE_SHADER_IN vec2 TexCoord;"
|
||||
EOL
|
||||
EOL"void main()"
|
||||
EOL"{"
|
||||
EOL" ivec2 aTexel = ivec2 (textureSize (uAccumTexture) * TexCoord);"
|
||||
EOL" vec4 aAccum = texelFetch (uAccumTexture, aTexel, gl_SampleID);"
|
||||
EOL" float aWeight = texelFetch (uWeightTexture, aTexel, gl_SampleID).r;"
|
||||
EOL" occFragColor = vec4 (aAccum.rgb / max (aWeight, 0.00001), aAccum.a);"
|
||||
EOL"}";
|
||||
|
||||
if (myContext->IsGlGreaterEqual (4, 0))
|
||||
{
|
||||
aProgramSrc->SetHeader ("#version 400");
|
||||
}
|
||||
}
|
||||
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (Graphic3d_TOS_VERTEX, aSrcVert));
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (Graphic3d_TOS_FRAGMENT, aSrcFrag));
|
||||
TCollection_AsciiString aKey;
|
||||
if (!Create (aProgramSrc, aKey, aProgram))
|
||||
{
|
||||
aProgram = new OpenGl_ShaderProgram(); // just mark as invalid
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myContext->BindProgram (aProgram);
|
||||
aProgram->SetSampler (myContext, "uAccumTexture", 0);
|
||||
aProgram->SetSampler (myContext, "uWeightTexture", 1);
|
||||
myContext->BindProgram (NULL);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : pointSpriteAlphaSrc
|
||||
// purpose :
|
||||
@@ -1249,7 +1363,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
const Standard_Integer theBits)
|
||||
{
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraOut, aSrcVertExtraMain, aSrcVertExtraFunc, aSrcGetAlpha, aSrcFrag, aSrcFragExtraOut, aSrcFragExtraMain;
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraOut, aSrcVertExtraMain, aSrcVertExtraFunc, aSrcGetAlpha, aSrcFrag;
|
||||
TCollection_AsciiString aSrcFragExtraOut, aSrcFragExtraMain, aSrcFragWriteOit;
|
||||
TCollection_AsciiString aSrcFragGetColor = EOL"vec4 getColor(void) { return occColor; }";
|
||||
TCollection_AsciiString aSrcFragMainGetColor = EOL" occFragColor = getColor();";
|
||||
if ((theBits & OpenGl_PO_Point) != 0)
|
||||
@@ -1299,7 +1414,10 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
aSrcVertExtraMain += THE_VARY_TexCoord_Trsf;
|
||||
|
||||
aSrcFragGetColor =
|
||||
EOL"vec4 getColor(void) { return occTexture2D(occActiveSampler, TexCoord.st / TexCoord.w); }";
|
||||
EOL"vec4 getColor(void)"
|
||||
EOL"{"
|
||||
EOL" return occTexture2D(occActiveSampler, TexCoord.st / TexCoord.w) * occColor;"
|
||||
EOL"}";
|
||||
}
|
||||
else if ((theBits & OpenGl_PO_TextureEnv) != 0)
|
||||
{
|
||||
@@ -1351,6 +1469,10 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
aSrcFragExtraMain += THE_FRAG_CLIP_PLANES_N;
|
||||
}
|
||||
}
|
||||
if ((theBits & OpenGl_PO_WriteOit) != 0)
|
||||
{
|
||||
aSrcFragWriteOit += THE_FRAG_write_oit_buffers;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aSrcVertEndMain;
|
||||
if ((theBits & OpenGl_PO_StippleLine) != 0)
|
||||
@@ -1421,6 +1543,7 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFlat (Handle(OpenGl_Shad
|
||||
EOL"{"
|
||||
+ aSrcFragExtraMain
|
||||
+ aSrcFragMainGetColor
|
||||
+ aSrcFragWriteOit
|
||||
+ EOL"}";
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
@@ -1572,7 +1695,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramGouraud (Handle(OpenGl_S
|
||||
const Standard_Integer theBits)
|
||||
{
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
TCollection_AsciiString aSrcVert, aSrcVertColor, aSrcVertExtraOut, aSrcVertExtraMain, aSrcFrag, aSrcFragExtraOut, aSrcFragExtraMain;
|
||||
TCollection_AsciiString aSrcVert, aSrcVertColor, aSrcVertExtraOut, aSrcVertExtraMain, aSrcFrag, aSrcFragExtraOut;
|
||||
TCollection_AsciiString aSrcFragExtraMain, aSrcFragWriteOit;
|
||||
TCollection_AsciiString aSrcFragGetColor = EOL"vec4 getColor(void) { return gl_FrontFacing ? FrontColor : BackColor; }";
|
||||
if ((theBits & OpenGl_PO_Point) != 0)
|
||||
{
|
||||
@@ -1640,6 +1764,10 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramGouraud (Handle(OpenGl_S
|
||||
aSrcFragExtraMain += THE_FRAG_CLIP_PLANES_N;
|
||||
}
|
||||
}
|
||||
if ((theBits & OpenGl_PO_WriteOit) != 0)
|
||||
{
|
||||
aSrcFragWriteOit += THE_FRAG_write_oit_buffers;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString aLights = stdComputeLighting ((theBits & OpenGl_PO_VertColor) != 0);
|
||||
aSrcVert = TCollection_AsciiString()
|
||||
@@ -1673,7 +1801,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramGouraud (Handle(OpenGl_S
|
||||
EOL"{"
|
||||
+ aSrcFragExtraMain
|
||||
+ EOL" occFragColor = getColor();"
|
||||
EOL"}";
|
||||
+ aSrcFragWriteOit
|
||||
+ EOL"}";
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (myContext->core32 != NULL)
|
||||
@@ -1702,7 +1831,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
|
||||
#define thePhongCompLight "computeLighting (normalize (Normal), normalize (View), Position, gl_FrontFacing)"
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraOut, aSrcVertExtraMain, aSrcFrag, aSrcFragExtraOut, aSrcFragGetVertColor, aSrcFragExtraMain;
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraOut, aSrcVertExtraMain, aSrcFrag, aSrcFragExtraOut;
|
||||
TCollection_AsciiString aSrcFragGetVertColor, aSrcFragExtraMain, aSrcFragWriteOit;
|
||||
TCollection_AsciiString aSrcFragGetColor = EOL"vec4 getColor(void) { return " thePhongCompLight "; }";
|
||||
if ((theBits & OpenGl_PO_Point) != 0)
|
||||
{
|
||||
@@ -1763,6 +1893,10 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
|
||||
aSrcFragExtraMain += THE_FRAG_CLIP_PLANES_N;
|
||||
}
|
||||
}
|
||||
if ((theBits & OpenGl_PO_WriteOit) != 0)
|
||||
{
|
||||
aSrcFragWriteOit += THE_FRAG_write_oit_buffers;
|
||||
}
|
||||
|
||||
aSrcVert = TCollection_AsciiString()
|
||||
+ THE_FUNC_transformNormal
|
||||
@@ -1799,7 +1933,8 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
|
||||
EOL"{"
|
||||
+ aSrcFragExtraMain
|
||||
+ EOL" occFragColor = getColor();"
|
||||
EOL"}";
|
||||
+ aSrcFragWriteOit
|
||||
+ EOL"}";
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (myContext->core32 != NULL)
|
||||
|
@@ -23,12 +23,13 @@
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
#include <OpenGl_SetOfShaderPrograms.hxx>
|
||||
#include <OpenGl_ShaderStates.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_OitUniformState.hxx>
|
||||
#include <OpenGl_SetOfShaderPrograms.hxx>
|
||||
#include <OpenGl_ShaderStates.hxx>
|
||||
#include <OpenGl_MaterialState.hxx>
|
||||
#include <OpenGl_Texture.hxx>
|
||||
|
||||
@@ -168,6 +169,19 @@ public:
|
||||
&& myContext->BindProgram (myBlitProgram);
|
||||
}
|
||||
|
||||
//! Bind program for blended order-independent transparency buffers compositing.
|
||||
Standard_Boolean BindOitCompositingProgram (const Standard_Boolean theIsMSAAEnabled)
|
||||
{
|
||||
const Standard_Integer aProgramIdx = theIsMSAAEnabled ? 1 : 0;
|
||||
if (myOitCompositingProgram[aProgramIdx].IsNull())
|
||||
{
|
||||
prepareStdProgramOitCompositing (theIsMSAAEnabled);
|
||||
}
|
||||
|
||||
const Handle(OpenGl_ShaderProgram)& aProgram = myOitCompositingProgram [aProgramIdx];
|
||||
return !aProgram.IsNull() && myContext->BindProgram (aProgram);
|
||||
}
|
||||
|
||||
//! Bind program for rendering stereoscopic image.
|
||||
Standard_Boolean BindStereoProgram (const Graphic3d_StereoMode theStereoMode)
|
||||
{
|
||||
@@ -267,6 +281,20 @@ public:
|
||||
//! Pushes current state of material to specified program.
|
||||
void PushMaterialState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
|
||||
|
||||
public:
|
||||
|
||||
//! Set the state of OIT rendering pass.
|
||||
//! @param theToEnableOitWrite [in] flag indicating whether the special output should be written for OIT algorithm.
|
||||
//! @param theDepthWeight [in] the scalar factor of depth influence to the fragment's coverage.
|
||||
void SetOitState (const bool theToEnableOitWrite, const float theDepthWeight)
|
||||
{
|
||||
myOitUniformState.Set (theToEnableOitWrite, theDepthWeight);
|
||||
myOitUniformState.Update();
|
||||
}
|
||||
|
||||
//! Pushes state of OIT uniforms to the specified program.
|
||||
Standard_EXPORT void PushOitUniformState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
|
||||
|
||||
public:
|
||||
|
||||
//! Pushes current state of OCCT graphics parameters to specified program.
|
||||
@@ -339,6 +367,12 @@ protected:
|
||||
{
|
||||
aBits |= OpenGl_PO_VertColor;
|
||||
}
|
||||
|
||||
if (myOitUniformState.ToEnableWrite())
|
||||
{
|
||||
aBits |= OpenGl_PO_WriteOit;
|
||||
}
|
||||
|
||||
return aBits;
|
||||
}
|
||||
|
||||
@@ -378,6 +412,9 @@ protected:
|
||||
//! Prepare standard GLSL program for FBO blit operation.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramFboBlit();
|
||||
|
||||
//! Prepare standard GLSL programs for Oit compositing operation.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramOitCompositing (const Standard_Boolean theMsaa);
|
||||
|
||||
//! Prepare standard GLSL program without lighting.
|
||||
Standard_EXPORT Standard_Boolean prepareStdProgramFlat (Handle(OpenGl_ShaderProgram)& theProgram,
|
||||
const Standard_Integer theBits);
|
||||
@@ -452,13 +489,14 @@ protected:
|
||||
|
||||
Handle(OpenGl_ShaderProgramFFP) myFfpProgram;
|
||||
|
||||
Graphic3d_TypeOfShadingModel myShadingModel; //!< lighting shading model
|
||||
OpenGl_ShaderProgramList myProgramList; //!< The list of shader programs
|
||||
Handle(OpenGl_SetOfShaderPrograms) myLightPrograms; //!< pointer to active lighting programs matrix
|
||||
OpenGl_SetOfShaderPrograms myFlatPrograms; //!< programs matrix without lighting
|
||||
Handle(OpenGl_ShaderProgram) myFontProgram; //!< standard program for textured text
|
||||
Handle(OpenGl_ShaderProgram) myBlitProgram; //!< standard program for FBO blit emulation
|
||||
OpenGl_MapOfShaderPrograms myMapOfLightPrograms; //!< map of lighting programs depending on shading model and lights configuration
|
||||
Graphic3d_TypeOfShadingModel myShadingModel; //!< lighting shading model
|
||||
OpenGl_ShaderProgramList myProgramList; //!< The list of shader programs
|
||||
Handle(OpenGl_SetOfShaderPrograms) myLightPrograms; //!< pointer to active lighting programs matrix
|
||||
OpenGl_SetOfShaderPrograms myFlatPrograms; //!< programs matrix without lighting
|
||||
Handle(OpenGl_ShaderProgram) myFontProgram; //!< standard program for textured text
|
||||
Handle(OpenGl_ShaderProgram) myBlitProgram; //!< standard program for FBO blit emulation
|
||||
Handle(OpenGl_ShaderProgram) myOitCompositingProgram[2]; //!< standard program for OIT compositing (default and msaa).
|
||||
OpenGl_MapOfShaderPrograms myMapOfLightPrograms; //!< map of lighting programs depending on shading model and lights configuration
|
||||
|
||||
Handle(OpenGl_ShaderProgram) myStereoPrograms[Graphic3d_StereoMode_NB]; //!< standard stereo programs
|
||||
|
||||
@@ -472,6 +510,7 @@ protected:
|
||||
OpenGl_ClippingState myClippingState; //!< State of OCCT clipping planes
|
||||
OpenGl_LightSourceState myLightSourceState; //!< State of OCCT light sources
|
||||
OpenGl_MaterialState myMaterialState; //!< State of Front and Back materials
|
||||
OpenGl_OitUniformState myOitUniformState; //!< State of OIT uniforms
|
||||
|
||||
gp_XYZ myLocalOrigin; //!< local camera transformation
|
||||
Standard_Boolean myHasLocalOrigin; //!< flag indicating that local camera transformation has been set
|
||||
|
@@ -70,11 +70,27 @@ Standard_CString OpenGl_ShaderProgram::PredefinedKeywords[] =
|
||||
"occBackMaterial", // OpenGl_OCCT_BACK_MATERIAL
|
||||
"occColor", // OpenGl_OCCT_COLOR
|
||||
|
||||
"occOitEnableWrite", // OpenGl_OCCT_OIT_ENABLE_WRITE
|
||||
"occOitDepthWeight", // OpenGl_OCCT_OIT_DEPTH_WEIGHT
|
||||
|
||||
"occTexTrsf2d", // OpenGl_OCCT_TEXTURE_TRSF2D
|
||||
"occPointSize" // OpenGl_OCCT_POINT_SIZE
|
||||
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
#define EOL "\n"
|
||||
const char THE_enable_draw_buffers[] =
|
||||
EOL"#ifdef GL_ES"
|
||||
EOL" #if (__VERSION__ < 300)"
|
||||
EOL" #extension GL_EXT_draw_buffers : enable"
|
||||
EOL" #endif"
|
||||
EOL"#else"
|
||||
EOL" #extension GL_ARB_draw_buffers : enable"
|
||||
EOL"#endif"
|
||||
EOL"#define OCC_enable_draw_buffers 1";
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_VariableSetterSelector
|
||||
// purpose : Creates new variable setter selector
|
||||
@@ -204,11 +220,16 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
}
|
||||
|
||||
TCollection_AsciiString aSource = aDeclarations + anIter.Value()->Source();
|
||||
TCollection_AsciiString aExtensions;
|
||||
if (theCtx->MaxDrawBuffers() > 1) {
|
||||
aExtensions += THE_enable_draw_buffers;
|
||||
}
|
||||
|
||||
switch (anIter.Value()->Type())
|
||||
{
|
||||
case Graphic3d_TOS_VERTEX:
|
||||
{
|
||||
aSource = aHeader + TCollection_AsciiString ("#define VERTEX_SHADER\n") + aSource;
|
||||
aSource = aHeader + TCollection_AsciiString ("#define VERTEX_SHADER\n") + aExtensions + aSource;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOS_FRAGMENT:
|
||||
@@ -219,9 +240,9 @@ Standard_Boolean OpenGl_ShaderProgram::Initialize (const Handle(OpenGl_Context)&
|
||||
"precision highp int;\n"
|
||||
: "precision mediump float;\n"
|
||||
"precision mediump int;\n");
|
||||
aSource = aHeader + aPrefix + aSource;
|
||||
aSource = aHeader + aPrefix + aExtensions + aSource;
|
||||
#else
|
||||
aSource = aHeader + aSource;
|
||||
aSource = aHeader + aExtensions + aSource;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@@ -65,6 +65,11 @@ enum OpenGl_StateVariable
|
||||
OpenGl_OCCT_BACK_MATERIAL,
|
||||
OpenGl_OCCT_COLOR,
|
||||
|
||||
// Order-independent transparency rendering state
|
||||
OpenGl_OCCT_OIT_ENABLE_WRITE, //!< Enable bit for writing color (occFragColor) and coverage (occFragCoverage) buffers of OIT processing
|
||||
OpenGl_OCCT_OIT_DEPTH_WEIGHT, //!< Influence of the depth component to the coverage of the accumulated fragment
|
||||
|
||||
// Context-dependent state
|
||||
OpenGl_OCCT_TEXTURE_TRSF2D,
|
||||
OpenGl_OCCT_POINT_SIZE,
|
||||
|
||||
@@ -124,6 +129,7 @@ enum OpenGl_UniformStateType
|
||||
OpenGl_PROJECTION_STATE,
|
||||
OpenGl_MATERIAL_STATE,
|
||||
OpenGl_SURF_DETAIL_STATE,
|
||||
OpenGL_OIT_UNIFORM_STATE,
|
||||
OpenGl_UniformStateType_NB
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OpenGl_CappingAlgo.hxx>
|
||||
#include <OpenGl_CappingRenderer.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
@@ -653,10 +653,9 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
||||
}
|
||||
|
||||
// Render capping for structure groups
|
||||
if (hasClosedPrims
|
||||
&& aCtx->Clipping().IsCappingOn())
|
||||
if (hasClosedPrims && aCtx->Clipping().IsCappingOn())
|
||||
{
|
||||
OpenGl_CappingAlgo::RenderCapping (theWorkspace, *this);
|
||||
OpenGl_CappingRenderer::Render (theWorkspace, *this);
|
||||
}
|
||||
|
||||
// Revert structure clippings
|
||||
|
@@ -900,6 +900,20 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx,
|
||||
Unbind (theCtx);
|
||||
return false;
|
||||
}
|
||||
else if (theDataType == GL_HALF_FLOAT && !theCtx->arbTexHalfFloat)
|
||||
{
|
||||
TCollection_ExtendedString aMsg ("Error: half-precision floating-point textures are not supported by hardware.");
|
||||
|
||||
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
|
||||
Release (theCtx.operator->());
|
||||
Unbind (theCtx);
|
||||
return false;
|
||||
}
|
||||
|
||||
const GLint anIntFormat = theTextFormat;
|
||||
|
||||
|
@@ -61,11 +61,17 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||
myToShowGradTrihedron (false),
|
||||
myStateCounter (theCounter),
|
||||
myLastLightSourceState (0, 0),
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myFboColorFormat (GL_RGBA8),
|
||||
#else
|
||||
myFboColorFormat (GL_RGBA),
|
||||
#endif
|
||||
myFboDepthFormat (GL_DEPTH24_STENCIL8),
|
||||
myToFlipOutput (Standard_False),
|
||||
myFrameCounter (0),
|
||||
myHasFboBlit (Standard_True),
|
||||
myToDisableOIT (Standard_False),
|
||||
myToDisableOITMSAA (Standard_False),
|
||||
myToDisableMSAA (Standard_False),
|
||||
myTransientDrawToFront (Standard_True),
|
||||
myBackBufferRestored (Standard_False),
|
||||
@@ -90,17 +96,21 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
||||
aLight.Color.b() = 1.;
|
||||
myNoShadingLight.Append (aLight);
|
||||
|
||||
myCurrLightSourceState = myStateCounter->Increment();
|
||||
myMainSceneFbos[0] = new OpenGl_FrameBuffer();
|
||||
myMainSceneFbos[1] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbos[0] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbos[1] = new OpenGl_FrameBuffer();
|
||||
myOpenGlFBO = new OpenGl_FrameBuffer();
|
||||
myOpenGlFBO2 = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO1[0] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO1[1] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO2[0] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO2[1] = new OpenGl_FrameBuffer();
|
||||
myCurrLightSourceState = myStateCounter->Increment();
|
||||
myMainSceneFbos[0] = new OpenGl_FrameBuffer();
|
||||
myMainSceneFbos[1] = new OpenGl_FrameBuffer();
|
||||
myMainSceneFbosOit[0] = new OpenGl_FrameBuffer();
|
||||
myMainSceneFbosOit[1] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbos[0] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbos[1] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbosOit[0] = new OpenGl_FrameBuffer();
|
||||
myImmediateSceneFbosOit[1] = new OpenGl_FrameBuffer();
|
||||
myOpenGlFBO = new OpenGl_FrameBuffer();
|
||||
myOpenGlFBO2 = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO1[0] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO1[1] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO2[0] = new OpenGl_FrameBuffer();
|
||||
myRaytraceFBO2[1] = new OpenGl_FrameBuffer();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -142,14 +152,18 @@ void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
||||
myBgTextureArray->Release (theCtx.operator->());
|
||||
}
|
||||
|
||||
myMainSceneFbos[0] ->Release (theCtx.operator->());
|
||||
myMainSceneFbos[1] ->Release (theCtx.operator->());
|
||||
myImmediateSceneFbos[0]->Release (theCtx.operator->());
|
||||
myImmediateSceneFbos[1]->Release (theCtx.operator->());
|
||||
myOpenGlFBO ->Release (theCtx.operator->());
|
||||
myOpenGlFBO2 ->Release (theCtx.operator->());
|
||||
myFullScreenQuad .Release (theCtx.operator->());
|
||||
myFullScreenQuadFlip .Release (theCtx.operator->());
|
||||
myMainSceneFbos[0] ->Release (theCtx.operator->());
|
||||
myMainSceneFbos[1] ->Release (theCtx.operator->());
|
||||
myMainSceneFbosOit[0] ->Release (theCtx.operator->());
|
||||
myMainSceneFbosOit[1] ->Release (theCtx.operator->());
|
||||
myImmediateSceneFbos[0] ->Release (theCtx.operator->());
|
||||
myImmediateSceneFbos[1] ->Release (theCtx.operator->());
|
||||
myImmediateSceneFbosOit[0]->Release (theCtx.operator->());
|
||||
myImmediateSceneFbosOit[1]->Release (theCtx.operator->());
|
||||
myOpenGlFBO ->Release (theCtx.operator->());
|
||||
myOpenGlFBO2 ->Release (theCtx.operator->());
|
||||
myFullScreenQuad .Release (theCtx.operator->());
|
||||
myFullScreenQuadFlip .Release (theCtx.operator->());
|
||||
|
||||
releaseRaytraceResources (theCtx);
|
||||
}
|
||||
|
@@ -342,6 +342,22 @@ public:
|
||||
return myZLayers.NbImmediateStructures() != 0;
|
||||
}
|
||||
|
||||
//! Set filter for restricting rendering of particular elements.
|
||||
//! Filter can be applied for rendering passes used by recursive
|
||||
//! rendering algorithms for rendering elements of groups.
|
||||
//! @param theFilter [in] the filter instance.
|
||||
inline void SetRenderFilter(const Handle(OpenGl_RenderFilter)& theFilter)
|
||||
{
|
||||
myWorkspace->SetRenderFilter(theFilter);
|
||||
}
|
||||
|
||||
//! Get rendering filter.
|
||||
//! @return filter instance.
|
||||
inline const Handle(OpenGl_RenderFilter)& GetRenderFilter() const
|
||||
{
|
||||
return myWorkspace->GetRenderFilter();
|
||||
}
|
||||
|
||||
protected: //! @name Internal methods for managing GL resources
|
||||
|
||||
//! Initializes OpenGl resource for environment texture.
|
||||
@@ -351,7 +367,8 @@ protected: //! @name low-level redrawing sub-routines
|
||||
|
||||
//! Redraws view for the given monographic camera projection, or left/right eye.
|
||||
Standard_EXPORT virtual void redraw (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo);
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo);
|
||||
|
||||
//! Redraws view for the given monographic camera projection, or left/right eye.
|
||||
//!
|
||||
@@ -368,6 +385,7 @@ protected: //! @name low-level redrawing sub-routines
|
||||
Standard_EXPORT virtual bool redrawImmediate (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadFbo,
|
||||
OpenGl_FrameBuffer* theDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theIsPartialUpdate = Standard_False);
|
||||
|
||||
//! Blit image from/to specified buffers.
|
||||
@@ -383,17 +401,21 @@ protected: //! @name Rendering of GL graphics (with prepared drawing buffer).
|
||||
//! Renders the graphical contents of the view into the preprepared window or framebuffer.
|
||||
//! @param theProjection [in] the projection that should be used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void render (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Renders the graphical scene.
|
||||
//! @param theProjection [in] the projection that is used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Draw background (gradient / image)
|
||||
@@ -402,9 +424,11 @@ protected: //! @name Rendering of GL graphics (with prepared drawing buffer).
|
||||
//! Render set of structures presented in the view.
|
||||
//! @param theProjection [in] the projection that is used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Renders trihedron.
|
||||
@@ -444,6 +468,15 @@ private:
|
||||
//! Blend together views pair into stereo image.
|
||||
void drawStereoPair (OpenGl_FrameBuffer* theDrawFbo);
|
||||
|
||||
//! Check and update OIT compatibility with current OpenGL context's state.
|
||||
bool checkOitCompatibility (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Boolean theMSAA);
|
||||
|
||||
//! Chooses compatible internal color format for OIT frame buffer.
|
||||
bool chooseOitColorConfiguration (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Integer theConfigIndex,
|
||||
OpenGl_ColorFormats& theFormats);
|
||||
|
||||
protected:
|
||||
|
||||
OpenGl_GraphicDriver* myDriver;
|
||||
@@ -497,13 +530,18 @@ protected: //! @name Rendering properties
|
||||
//! of the view (without presentation of immediate layers).
|
||||
GLint myFboColorFormat; //!< sized format for color attachments
|
||||
GLint myFboDepthFormat; //!< sized format for depth-stencil attachments
|
||||
OpenGl_ColorFormats myFboOitColorConfig; //!< selected color format configuration for OIT color attachments
|
||||
Handle(OpenGl_FrameBuffer) myMainSceneFbos[2];
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbos[2]; //!< Additional buffers for immediate layer in stereo mode.
|
||||
Handle(OpenGl_FrameBuffer) myMainSceneFbosOit[2]; //!< Additional buffers for transparent draw of main layer.
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbos[2]; //!< Additional buffers for immediate layer in stereo mode.
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbosOit[2]; //!< Additional buffers for transparency draw of immediate layer.
|
||||
OpenGl_VertexBuffer myFullScreenQuad; //!< Vertices for full-screen quad rendering.
|
||||
OpenGl_VertexBuffer myFullScreenQuadFlip;
|
||||
Standard_Boolean myToFlipOutput; //!< Flag to draw result image upside-down
|
||||
unsigned int myFrameCounter; //!< redraw counter, for debugging
|
||||
Standard_Boolean myHasFboBlit; //!< disable FBOs on failure
|
||||
Standard_Boolean myToDisableOIT; //!< disable OIT on failure
|
||||
Standard_Boolean myToDisableOITMSAA; //!< disable OIT with MSAA on failure
|
||||
Standard_Boolean myToDisableMSAA; //!< disable MSAA after failure
|
||||
Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
|
||||
Standard_Boolean myBackBufferRestored;
|
||||
@@ -1035,6 +1073,7 @@ public:
|
||||
|
||||
friend class OpenGl_GraphicDriver;
|
||||
friend class OpenGl_Workspace;
|
||||
friend class OpenGl_LayerList;
|
||||
};
|
||||
|
||||
#endif // _OpenGl_View_Header
|
||||
|
@@ -163,6 +163,12 @@ void OpenGl_View::Redraw()
|
||||
aNbSamples = OpenGl_Context::GetPowerOfTwo (aNbSamples, aCtx->MaxMsaaSamples());
|
||||
}
|
||||
|
||||
bool toUseOit = myRenderParams.IsOitEnabled
|
||||
&& checkOitCompatibility (aCtx, aNbSamples > 0);
|
||||
|
||||
bool toInitImmediateFbo = myTransientDrawToFront
|
||||
&& (!aCtx->caps->useSystemBuffer || (toUseOit && HasImmediateStructures()));
|
||||
|
||||
if ( aFrameBuffer == NULL
|
||||
&& !aCtx->DefaultFrameBuffer().IsNull()
|
||||
&& aCtx->DefaultFrameBuffer()->IsValid())
|
||||
@@ -173,7 +179,8 @@ void OpenGl_View::Redraw()
|
||||
if (myHasFboBlit
|
||||
&& (myTransientDrawToFront
|
||||
|| aProjectType == Graphic3d_Camera::Projection_Stereo
|
||||
|| aNbSamples != 0))
|
||||
|| aNbSamples != 0
|
||||
|| toUseOit))
|
||||
{
|
||||
if (myMainSceneFbos[0]->GetVPSizeX() != aSizeX
|
||||
|| myMainSceneFbos[0]->GetVPSizeY() != aSizeY
|
||||
@@ -193,12 +200,10 @@ void OpenGl_View::Redraw()
|
||||
{
|
||||
myMainSceneFbos[0]->Init (aCtx, aSizeX, aSizeY, myFboColorFormat, myFboDepthFormat, aNbSamples);
|
||||
}
|
||||
if (myTransientDrawToFront
|
||||
&& !aCtx->caps->useSystemBuffer
|
||||
&& myMainSceneFbos[0]->IsValid())
|
||||
{
|
||||
myImmediateSceneFbos[0]->InitLazy (aCtx, *myMainSceneFbos[0]);
|
||||
}
|
||||
}
|
||||
if (myMainSceneFbos[0]->IsValid() && (toInitImmediateFbo || myImmediateSceneFbos[0]->IsValid()))
|
||||
{
|
||||
myImmediateSceneFbos[0]->InitLazy (aCtx, *myMainSceneFbos[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -238,6 +243,93 @@ void OpenGl_View::Redraw()
|
||||
}
|
||||
}
|
||||
|
||||
// create color and coverage accumulation buffers required for OIT algorithm
|
||||
if (toUseOit)
|
||||
{
|
||||
Standard_Integer anFboIt = 0;
|
||||
for (; anFboIt < 2; ++anFboIt)
|
||||
{
|
||||
if (myMainSceneFbos[anFboIt]->IsValid()
|
||||
&& (myMainSceneFbosOit[anFboIt]->GetVPSizeX() != aSizeX
|
||||
|| myMainSceneFbosOit[anFboIt]->GetVPSizeY() != aSizeY
|
||||
|| myMainSceneFbosOit[anFboIt]->NbSamples() != aNbSamples))
|
||||
{
|
||||
Standard_Integer aColorConfig = 0;
|
||||
for (;;) // seemly responding to driver limitation (GL_FRAMEBUFFER_UNSUPPORTED)
|
||||
{
|
||||
if (myFboOitColorConfig.IsEmpty())
|
||||
{
|
||||
if (!chooseOitColorConfiguration (aCtx, aColorConfig++, myFboOitColorConfig))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (myMainSceneFbosOit[anFboIt]->Init (aCtx, aSizeX, aSizeY, myFboOitColorConfig, myMainSceneFbos[anFboIt]->DepthStencilTexture(), aNbSamples))
|
||||
{
|
||||
break;
|
||||
}
|
||||
myFboOitColorConfig.Clear();
|
||||
}
|
||||
if (!myMainSceneFbosOit[anFboIt]->IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!myMainSceneFbosOit[anFboIt]->IsValid())
|
||||
{
|
||||
myMainSceneFbosOit[anFboIt]->Release (aCtx.operator->());
|
||||
myMainSceneFbosOit[anFboIt]->ChangeViewport (0, 0);
|
||||
}
|
||||
|
||||
if (myImmediateSceneFbos[anFboIt]->IsValid()
|
||||
&& (myImmediateSceneFbosOit[anFboIt]->GetVPSizeX() != aSizeX
|
||||
|| myImmediateSceneFbosOit[anFboIt]->GetVPSizeY() != aSizeY
|
||||
|| myImmediateSceneFbosOit[anFboIt]->NbSamples() != aNbSamples))
|
||||
{
|
||||
if (!myImmediateSceneFbosOit[anFboIt]->Init (aCtx, aSizeX, aSizeY, myFboOitColorConfig, myImmediateSceneFbos[anFboIt]->DepthStencilTexture(), aNbSamples))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!myImmediateSceneFbosOit[anFboIt]->IsValid())
|
||||
{
|
||||
myImmediateSceneFbosOit[anFboIt]->Release (aCtx.operator->());
|
||||
myImmediateSceneFbosOit[anFboIt]->ChangeViewport (0, 0);
|
||||
}
|
||||
}
|
||||
if (!anFboIt) // only the first OIT framebuffer is mandatory
|
||||
{
|
||||
TCollection_ExtendedString aMsg =
|
||||
"Initialization of float texture framebuffer for use with\n"
|
||||
" blended order-independent transparency rendering algorithm has failed.\n"
|
||||
" Blended order-independent transparency will not be available.\n";
|
||||
|
||||
aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
|
||||
if (aNbSamples > 0)
|
||||
myToDisableOITMSAA = Standard_True;
|
||||
else
|
||||
myToDisableOIT = Standard_True;
|
||||
|
||||
toUseOit = false;
|
||||
}
|
||||
}
|
||||
if (!toUseOit && myMainSceneFbosOit[0]->IsValid())
|
||||
{
|
||||
myMainSceneFbosOit [0]->Release (aCtx.operator->());
|
||||
myMainSceneFbosOit [1]->Release (aCtx.operator->());
|
||||
myImmediateSceneFbosOit[0]->Release (aCtx.operator->());
|
||||
myImmediateSceneFbosOit[1]->Release (aCtx.operator->());
|
||||
myMainSceneFbosOit [0]->ChangeViewport (0, 0);
|
||||
myMainSceneFbosOit [1]->ChangeViewport (0, 0);
|
||||
myImmediateSceneFbosOit[0]->ChangeViewport (0, 0);
|
||||
myImmediateSceneFbosOit[1]->ChangeViewport (0, 0);
|
||||
}
|
||||
|
||||
if (aProjectType == Graphic3d_Camera::Projection_Stereo)
|
||||
{
|
||||
OpenGl_FrameBuffer* aMainFbos[2] =
|
||||
@@ -245,34 +337,51 @@ void OpenGl_View::Redraw()
|
||||
myMainSceneFbos[0]->IsValid() ? myMainSceneFbos[0].operator->() : NULL,
|
||||
myMainSceneFbos[1]->IsValid() ? myMainSceneFbos[1].operator->() : NULL
|
||||
};
|
||||
OpenGl_FrameBuffer* aMainFbosOit[2] =
|
||||
{
|
||||
myMainSceneFbosOit[0]->IsValid() ? myMainSceneFbosOit[0].operator->() : NULL,
|
||||
myMainSceneFbosOit[1]->IsValid() ? myMainSceneFbosOit[1].operator->() :
|
||||
myMainSceneFbosOit[0]->IsValid() ? myMainSceneFbosOit[0].operator->() : NULL
|
||||
};
|
||||
|
||||
OpenGl_FrameBuffer* anImmFbos[2] =
|
||||
{
|
||||
myImmediateSceneFbos[0]->IsValid() ? myImmediateSceneFbos[0].operator->() : NULL,
|
||||
myImmediateSceneFbos[1]->IsValid() ? myImmediateSceneFbos[1].operator->() : NULL
|
||||
};
|
||||
OpenGl_FrameBuffer* anImmFbosOit[2] =
|
||||
{
|
||||
myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL,
|
||||
myImmediateSceneFbosOit[1]->IsValid() ? myImmediateSceneFbosOit[1].operator->() :
|
||||
myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL
|
||||
};
|
||||
|
||||
if (!myTransientDrawToFront)
|
||||
{
|
||||
anImmFbos[0] = aMainFbos[0];
|
||||
anImmFbos[1] = aMainFbos[1];
|
||||
anImmFbos [0] = aMainFbos [0];
|
||||
anImmFbos [1] = aMainFbos [1];
|
||||
anImmFbosOit[0] = aMainFbosOit[0];
|
||||
anImmFbosOit[1] = aMainFbosOit[1];
|
||||
}
|
||||
else if (aStereoMode == Graphic3d_StereoMode_SoftPageFlip
|
||||
|| aStereoMode == Graphic3d_StereoMode_QuadBuffer)
|
||||
{
|
||||
anImmFbos[0] = NULL;
|
||||
anImmFbos[1] = NULL;
|
||||
anImmFbos [0] = NULL;
|
||||
anImmFbos [1] = NULL;
|
||||
anImmFbosOit[0] = NULL;
|
||||
anImmFbosOit[1] = NULL;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||
#endif
|
||||
redraw (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0]);
|
||||
redraw (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0], aMainFbosOit[0]);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||
#endif
|
||||
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0], anImmFbos[0]))
|
||||
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0], anImmFbos[0], anImmFbosOit[0]))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -284,10 +393,10 @@ void OpenGl_View::Redraw()
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_RIGHT : GL_BACK);
|
||||
#endif
|
||||
redraw (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1]);
|
||||
redraw (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1], aMainFbosOit[1]);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1], anImmFbos[1]))
|
||||
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1], anImmFbos[1], anImmFbosOit[1]))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -299,15 +408,19 @@ void OpenGl_View::Redraw()
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_FrameBuffer* aMainFbo = myMainSceneFbos[0]->IsValid() ? myMainSceneFbos[0].operator->() : aFrameBuffer;
|
||||
OpenGl_FrameBuffer* anImmFbo = aFrameBuffer;
|
||||
if (!aCtx->caps->useSystemBuffer && myImmediateSceneFbos[0]->IsValid())
|
||||
{
|
||||
anImmFbo = myImmediateSceneFbos[0].operator->();
|
||||
}
|
||||
OpenGl_FrameBuffer* aMainFbo = myMainSceneFbos[0]->IsValid() ? myMainSceneFbos[0].operator->() : aFrameBuffer;
|
||||
OpenGl_FrameBuffer* aMainFboOit = myMainSceneFbosOit[0]->IsValid() ? myMainSceneFbosOit[0].operator->() : NULL;
|
||||
OpenGl_FrameBuffer* anImmFbo = aFrameBuffer;
|
||||
OpenGl_FrameBuffer* anImmFboOit = NULL;
|
||||
if (!myTransientDrawToFront)
|
||||
{
|
||||
anImmFbo = aMainFbo;
|
||||
anImmFbo = aMainFbo;
|
||||
anImmFboOit = aMainFboOit;
|
||||
}
|
||||
else if (myImmediateSceneFbos[0]->IsValid())
|
||||
{
|
||||
anImmFbo = myImmediateSceneFbos[0].operator->();
|
||||
anImmFboOit = myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
@@ -316,10 +429,10 @@ void OpenGl_View::Redraw()
|
||||
aCtx->SetReadDrawBuffer (GL_BACK);
|
||||
}
|
||||
#endif
|
||||
redraw (aProjectType, aMainFbo);
|
||||
redraw (aProjectType, aMainFbo, aMainFboOit);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
if (!redrawImmediate (aProjectType, aMainFbo, anImmFbo))
|
||||
if (!redrawImmediate (aProjectType, aMainFbo, anImmFbo, anImmFboOit))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -422,11 +535,19 @@ void OpenGl_View::RedrawImmediate()
|
||||
myImmediateSceneFbos[0]->IsValid() ? myImmediateSceneFbos[0].operator->() : NULL,
|
||||
myImmediateSceneFbos[1]->IsValid() ? myImmediateSceneFbos[1].operator->() : NULL
|
||||
};
|
||||
OpenGl_FrameBuffer* anImmFbosOit[2] =
|
||||
{
|
||||
myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL,
|
||||
myImmediateSceneFbosOit[1]->IsValid() ? myImmediateSceneFbosOit[1].operator->() :
|
||||
myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL
|
||||
};
|
||||
if (aStereoMode == Graphic3d_StereoMode_SoftPageFlip
|
||||
|| aStereoMode == Graphic3d_StereoMode_QuadBuffer)
|
||||
{
|
||||
anImmFbos[0] = NULL;
|
||||
anImmFbos[1] = NULL;
|
||||
anImmFbos[0] = NULL;
|
||||
anImmFbos[1] = NULL;
|
||||
anImmFbosOit[0] = NULL;
|
||||
anImmFbosOit[1] = NULL;
|
||||
}
|
||||
|
||||
if (aCtx->arbFBO != NULL)
|
||||
@@ -442,6 +563,7 @@ void OpenGl_View::RedrawImmediate()
|
||||
toSwap = redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye,
|
||||
aMainFbos[0],
|
||||
anImmFbos[0],
|
||||
anImmFbosOit[0],
|
||||
Standard_True) || toSwap;
|
||||
if (aStereoMode == Graphic3d_StereoMode_SoftPageFlip
|
||||
&& toSwap
|
||||
@@ -463,6 +585,7 @@ void OpenGl_View::RedrawImmediate()
|
||||
toSwap = redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye,
|
||||
aMainFbos[1],
|
||||
anImmFbos[1],
|
||||
anImmFbosOit[1],
|
||||
Standard_True) || toSwap;
|
||||
if (anImmFbos[0] != NULL)
|
||||
{
|
||||
@@ -473,9 +596,11 @@ void OpenGl_View::RedrawImmediate()
|
||||
{
|
||||
OpenGl_FrameBuffer* aMainFbo = myMainSceneFbos[0]->IsValid() ? myMainSceneFbos[0].operator->() : NULL;
|
||||
OpenGl_FrameBuffer* anImmFbo = aFrameBuffer;
|
||||
if (!aCtx->caps->useSystemBuffer && myImmediateSceneFbos[0]->IsValid())
|
||||
OpenGl_FrameBuffer* anImmFboOit = NULL;
|
||||
if (myImmediateSceneFbos[0]->IsValid())
|
||||
{
|
||||
anImmFbo = myImmediateSceneFbos[0].operator->();
|
||||
anImmFbo = myImmediateSceneFbos[0].operator->();
|
||||
anImmFboOit = myImmediateSceneFbosOit[0]->IsValid() ? myImmediateSceneFbosOit[0].operator->() : NULL;
|
||||
}
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (aMainFbo == NULL)
|
||||
@@ -486,6 +611,7 @@ void OpenGl_View::RedrawImmediate()
|
||||
toSwap = redrawImmediate (aProjectType,
|
||||
aMainFbo,
|
||||
anImmFbo,
|
||||
anImmFboOit,
|
||||
Standard_True) || toSwap;
|
||||
if (anImmFbo != NULL
|
||||
&& anImmFbo != aFrameBuffer)
|
||||
@@ -517,7 +643,9 @@ void OpenGl_View::RedrawImmediate()
|
||||
// function : redraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_View::redraw (const Graphic3d_Camera::Projection theProjection, OpenGl_FrameBuffer* theReadDrawFbo)
|
||||
void OpenGl_View::redraw (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo)
|
||||
{
|
||||
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
|
||||
if (theReadDrawFbo != NULL)
|
||||
@@ -552,7 +680,7 @@ void OpenGl_View::redraw (const Graphic3d_Camera::Projection theProjection, Open
|
||||
|
||||
glClear (toClear);
|
||||
|
||||
render (theProjection, theReadDrawFbo, Standard_False);
|
||||
render (theProjection, theReadDrawFbo, theOitAccumFbo, Standard_False);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -562,6 +690,7 @@ void OpenGl_View::redraw (const Graphic3d_Camera::Projection theProjection, Open
|
||||
bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadFbo,
|
||||
OpenGl_FrameBuffer* theDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theIsPartialUpdate)
|
||||
{
|
||||
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
|
||||
@@ -617,7 +746,7 @@ bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProject
|
||||
glClearDepthf (1.0f);
|
||||
#endif
|
||||
|
||||
render (theProjection, theDrawFbo, Standard_True);
|
||||
render (theProjection, theDrawFbo, theOitAccumFbo, Standard_True);
|
||||
|
||||
return !toCopyBackToFront;
|
||||
}
|
||||
@@ -628,6 +757,7 @@ bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProject
|
||||
//=======================================================================
|
||||
void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theOutputFBO,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate)
|
||||
{
|
||||
// ==================================
|
||||
@@ -752,7 +882,7 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
|
||||
|
||||
myWorkspace->SetEnvironmentTexture (myTextureEnv);
|
||||
|
||||
renderScene (theProjection, theOutputFBO, theToDrawImmediate);
|
||||
renderScene (theProjection, theOutputFBO, theOitAccumFbo, theToDrawImmediate);
|
||||
|
||||
myWorkspace->SetEnvironmentTexture (Handle(OpenGl_Texture)());
|
||||
|
||||
@@ -812,6 +942,7 @@ void OpenGl_View::InvalidateBVHData (const Graphic3d_ZLayerId theLayerId)
|
||||
//=======================================================================
|
||||
void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate)
|
||||
{
|
||||
if ( myZLayers.NbStructures() <= 0 )
|
||||
@@ -848,7 +979,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
if (aCtx->arbFBOBlit != NULL)
|
||||
{
|
||||
// Render bottom OSD layer
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Bottom);
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Bottom, theReadDrawFbo, theOitAccumFbo);
|
||||
|
||||
myWorkspace->SetRenderFilter (myRaytraceFilter);
|
||||
{
|
||||
@@ -862,7 +993,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
}
|
||||
|
||||
// Render non-polygonal elements in default layer
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Default);
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Default, theReadDrawFbo, theOitAccumFbo);
|
||||
}
|
||||
myWorkspace->SetRenderFilter (myRaytraceFilter->PrevRenderFilter());
|
||||
}
|
||||
@@ -884,7 +1015,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
raytrace (aSizeX, aSizeY, theProjection, theReadDrawFbo, aCtx);
|
||||
|
||||
// Render upper (top and topmost) OpenGL layers
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Upper);
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Upper, theReadDrawFbo, theOitAccumFbo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +1023,7 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
// mode or in case of ray-tracing failure
|
||||
if (toRenderGL)
|
||||
{
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_All);
|
||||
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_All, theReadDrawFbo, theOitAccumFbo);
|
||||
|
||||
// Set flag that scene was redrawn by standard pipeline
|
||||
myWasRedrawnGL = Standard_True;
|
||||
@@ -926,6 +1057,7 @@ void OpenGl_View::Invalidate()
|
||||
//=======================================================================
|
||||
void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
|
||||
@@ -942,7 +1074,7 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
myWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
|
||||
|
||||
// First pass
|
||||
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
|
||||
renderStructs (theProjection, theReadDrawFbo, theOitAccumFbo, theToDrawImmediate);
|
||||
myWorkspace->DisableTexture();
|
||||
|
||||
// Second pass
|
||||
@@ -972,7 +1104,7 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
|
||||
// Render the view
|
||||
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
|
||||
renderStructs (theProjection, theReadDrawFbo, theOitAccumFbo, theToDrawImmediate);
|
||||
myWorkspace->DisableTexture();
|
||||
|
||||
// Restore properties back
|
||||
@@ -1477,3 +1609,74 @@ void OpenGl_View::copyBackToFront()
|
||||
#endif
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : checkOitCompatibility
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_View::checkOitCompatibility (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Boolean theMSAA)
|
||||
{
|
||||
// determine if OIT is supported by current OpenGl context
|
||||
Standard_Boolean& aToDisableOIT = theMSAA ? myToDisableMSAA : myToDisableOIT;
|
||||
|
||||
if (!aToDisableOIT && theMSAA)
|
||||
{
|
||||
if (!theGlContext->arbSampleShading)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "Current version of GLSL does not support built-in sample variables.\n"
|
||||
+ " Blended order-independent transparency will not be available.\n";
|
||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
|
||||
aToDisableOIT = Standard_True;
|
||||
}
|
||||
}
|
||||
else if (!aToDisableOIT)
|
||||
{
|
||||
if (theGlContext->MaxDrawBuffers() < 2)
|
||||
{
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString()
|
||||
+ "OpenGL context does not support multiple rendering targets.\n"
|
||||
+ " Blended order-independent transparency will not be available.\n";
|
||||
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
|
||||
GL_DEBUG_TYPE_ERROR,
|
||||
0,
|
||||
GL_DEBUG_SEVERITY_HIGH,
|
||||
aMsg);
|
||||
aToDisableOIT = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return !aToDisableOIT;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : chooseOitColorConfiguration
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_View::chooseOitColorConfiguration (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Integer theConfigIndex,
|
||||
OpenGl_ColorFormats& theFormats)
|
||||
{
|
||||
theFormats.Clear();
|
||||
|
||||
switch (theConfigIndex)
|
||||
{
|
||||
case 0: // choose best applicable color format combination
|
||||
theFormats.Append (theGlContext->arbTexHalfFloat ? GL_RGBA16F : GL_RGBA32F);
|
||||
theFormats.Append (theGlContext->arbTexHalfFloat ? GL_R16F : GL_R32F);
|
||||
return true;
|
||||
|
||||
case 1: // choose non-optimal applicable color format combination
|
||||
theFormats.Append (theGlContext->arbTexHalfFloat ? GL_RGBA16F : GL_RGBA32F);
|
||||
theFormats.Append (theGlContext->arbTexHalfFloat ? GL_RGBA16F : GL_RGBA32F);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // color combination does not exist
|
||||
}
|
||||
|
@@ -16,18 +16,14 @@
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <OpenGl_ArbFBO.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <OpenGl_GlCore15.hxx>
|
||||
#include <OpenGl_SceneGeometry.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_Sampler.hxx>
|
||||
#include <OpenGl_SceneGeometry.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_Texture.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Window.hxx>
|
||||
@@ -169,7 +165,7 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
|
||||
#endif
|
||||
}
|
||||
|
||||
myDefaultCappingAlgoFilter = new OpenGl_CappingAlgoFilter();
|
||||
myCappingRenderFilter = new OpenGl_CappingRenderFilter();
|
||||
|
||||
myNoneCulling .Aspect()->SetSuppressBackFaces (false);
|
||||
myNoneCulling .Aspect()->SetDrawEdges (false);
|
||||
@@ -715,7 +711,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
|
||||
}
|
||||
else
|
||||
{
|
||||
myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, myUseDepthWrite, NamedStatus);
|
||||
myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, NamedStatus);
|
||||
}
|
||||
|
||||
if (myAspectFaceSet->Aspect()->ToMapTexture())
|
||||
@@ -1107,15 +1103,16 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CanRender
|
||||
// function : ShouldRender
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_RaytraceFilter::CanRender (const OpenGl_Element* theElement)
|
||||
Standard_Boolean OpenGl_RaytraceFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theElement)
|
||||
{
|
||||
Standard_Boolean aPrevFilterResult = Standard_True;
|
||||
if (!myPrevRenderFilter.IsNull())
|
||||
{
|
||||
aPrevFilterResult = myPrevRenderFilter->CanRender (theElement);
|
||||
aPrevFilterResult = myPrevRenderFilter->ShouldRender (theWorkspace, theElement);
|
||||
}
|
||||
return aPrevFilterResult &&
|
||||
!OpenGl_Raytrace::IsRaytracedElement (theElement);
|
||||
|
@@ -17,9 +17,13 @@
|
||||
#define _OpenGl_Workspace_Header
|
||||
|
||||
#include <Graphic3d_BufferType.hxx>
|
||||
#include <Graphic3d_PresentationAttributes.hxx>
|
||||
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_CappingAlgo.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_CappingRenderer.hxx>
|
||||
#include <OpenGl_FrameBuffer.hxx>
|
||||
#include <OpenGl_Material.hxx>
|
||||
#include <OpenGl_Matrix.hxx>
|
||||
@@ -62,7 +66,8 @@ public:
|
||||
//! Checks whether the element can be rendered or not.
|
||||
//! @param theElement [in] the element to check.
|
||||
//! @return True if element can be rendered.
|
||||
virtual Standard_Boolean CanRender (const OpenGl_Element* theElement) Standard_OVERRIDE;
|
||||
virtual Standard_Boolean ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_Element* theElement) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@@ -271,9 +276,9 @@ public:
|
||||
const Graphic3d_PolygonOffset& AppliedPolygonOffset() { return myPolygonOffsetApplied; }
|
||||
|
||||
//! Returns capping algorithm rendering filter.
|
||||
const Handle(OpenGl_CappingAlgoFilter)& DefaultCappingAlgoFilter() const
|
||||
const Handle(OpenGl_CappingRenderFilter)& CappingRenderFilter() const
|
||||
{
|
||||
return myDefaultCappingAlgoFilter;
|
||||
return myCappingRenderFilter;
|
||||
}
|
||||
|
||||
//! Returns face aspect for none culling mode.
|
||||
@@ -307,14 +312,14 @@ protected:
|
||||
|
||||
protected: //! @name protected fields
|
||||
|
||||
OpenGl_View* myView;
|
||||
Handle(OpenGl_Window) myWindow;
|
||||
Handle(OpenGl_Context) myGlContext;
|
||||
Standard_Boolean myUseZBuffer;
|
||||
Standard_Boolean myUseDepthWrite;
|
||||
Handle(OpenGl_CappingAlgoFilter) myDefaultCappingAlgoFilter;
|
||||
OpenGl_AspectFace myNoneCulling;
|
||||
OpenGl_AspectFace myFrontCulling;
|
||||
OpenGl_View* myView;
|
||||
Handle(OpenGl_Window) myWindow;
|
||||
Handle(OpenGl_Context) myGlContext;
|
||||
Standard_Boolean myUseZBuffer;
|
||||
Standard_Boolean myUseDepthWrite;
|
||||
Handle(OpenGl_CappingRenderFilter) myCappingRenderFilter;
|
||||
OpenGl_AspectFace myNoneCulling;
|
||||
OpenGl_AspectFace myFrontCulling;
|
||||
|
||||
protected: //! @name fields related to status
|
||||
|
||||
|
@@ -1097,19 +1097,6 @@
|
||||
#include <StepVisual_ViewVolume.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
|
||||
#include <StepVisual_TessellatedItem.hxx>
|
||||
#include <StepVisual_TessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_TessellatedCurveSet.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
|
||||
#include <RWStepVisual_RWTessellatedAnnotationOccurrence.hxx>
|
||||
#include <RWStepVisual_RWTessellatedItem.hxx>
|
||||
#include <RWStepVisual_RWTessellatedGeometricSet.hxx>
|
||||
#include <RWStepVisual_RWTessellatedCurveSet.hxx>
|
||||
#include <RWStepVisual_RWCoordinatesList.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule)
|
||||
|
||||
//#define DeclareAndCast(atype,result,start) \ NON car Name
|
||||
@@ -1363,6 +1350,14 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule)
|
||||
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
|
||||
#include <RWStepVisual_RWAnnotationFillArea.hxx>
|
||||
#include <RWStepVisual_RWAnnotationFillAreaOccurrence.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClipping.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
|
||||
static Standard_Integer catsh,catdr,catstr,catdsc,cataux;
|
||||
|
||||
@@ -5135,6 +5130,34 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
|
||||
RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 716:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClipping tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 717:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 718:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
case 719:
|
||||
{
|
||||
DeclareAndCast(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem, anent, ent);
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem tool;
|
||||
tool.Share(anent, iter);
|
||||
}
|
||||
break;
|
||||
default : break;
|
||||
}
|
||||
@@ -7136,6 +7159,18 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid
|
||||
case 715:
|
||||
ent = new StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation;
|
||||
break;
|
||||
case 716:
|
||||
ent = new StepVisual_CameraModelD3MultiClipping;
|
||||
break;
|
||||
case 717:
|
||||
ent = new StepVisual_CameraModelD3MultiClippingIntersection;
|
||||
break;
|
||||
case 718:
|
||||
ent = new StepVisual_CameraModelD3MultiClippingUnion;
|
||||
break;
|
||||
case 719:
|
||||
ent = new StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
@@ -7732,6 +7767,10 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber
|
||||
case 713: return catsh;
|
||||
case 714: return catstr;
|
||||
case 715: return catdsc;
|
||||
case 716:
|
||||
case 717:
|
||||
case 718: return cataux;
|
||||
case 719: return catdr;
|
||||
|
||||
default : break;
|
||||
}
|
||||
|
@@ -1398,6 +1398,14 @@ Handle(atype) result = Handle(atype)::DownCast (start)
|
||||
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
|
||||
#include <RWStepVisual_RWAnnotationFillArea.hxx>
|
||||
#include <RWStepVisual_RWAnnotationFillAreaOccurrence.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClipping.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
|
||||
|
||||
// -- General Declarations (Recognize, StepType) ---
|
||||
@@ -2037,6 +2045,9 @@ static TCollection_AsciiString Reco_CoordinatesList("COORDINATES_LIST");
|
||||
static TCollection_AsciiString Reco_ConstructiveGeometryRepresentation("CONSTRUCTIVE_GEOMETRY_REPRESENTATION");
|
||||
static TCollection_AsciiString Reco_ConstructiveGeometryRepresentationRelationship("CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP");
|
||||
static TCollection_AsciiString Reco_CharacterizedRepresentation("CHARACTERIZED_REPRESENTATION");
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClipping("CAMERA_MODEL_D3_MULTI_CLIPPING");
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClippingIntersection("CAMERA_MODEL_D3_MULTI_CLIPPING_INTERSECTION");
|
||||
static TCollection_AsciiString Reco_CameraModelD3MultiClippingUnion("CAMERA_MODEL_D3_MULTI_CLIPPING_UNION");
|
||||
// -- Definition of the libraries --
|
||||
|
||||
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
|
||||
@@ -2690,6 +2701,9 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
|
||||
typenums.Bind ( Reco_ConstructiveGeometryRepresentation, 712);
|
||||
typenums.Bind ( Reco_ConstructiveGeometryRepresentationRelationship, 713);
|
||||
typenums.Bind ( Reco_CharacterizedRepresentation, 714);
|
||||
typenums.Bind ( Reco_CameraModelD3MultiClipping, 716);
|
||||
typenums.Bind ( Reco_CameraModelD3MultiClippingIntersection, 717);
|
||||
typenums.Bind ( Reco_CameraModelD3MultiClippingUnion, 718);
|
||||
|
||||
|
||||
// SHORT NAMES
|
||||
@@ -3450,6 +3464,13 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
|
||||
types(5).IsEqual(StepType(624))))) {
|
||||
return 705;
|
||||
}
|
||||
if ((types(1).IsEqual(StepType(4))) &&
|
||||
(types(2).IsEqual(StepType(7))) &&
|
||||
(types(3).IsEqual(StepType(144))) &&
|
||||
(types(4).IsEqual(StepType(247))) &&
|
||||
(types(5).IsEqual(StepType(270)))) {
|
||||
return 719;
|
||||
}
|
||||
}
|
||||
else if (NbComp == 4) {
|
||||
if ((types(1).IsEqual(StepType(161))) &&
|
||||
@@ -3864,6 +3885,8 @@ Standard_Boolean RWStepAP214_ReadWriteModule::IsComplex
|
||||
return Standard_True;
|
||||
case 715:
|
||||
return Standard_True;
|
||||
case 719:
|
||||
return Standard_True;
|
||||
default:
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -4519,6 +4542,9 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType
|
||||
case 712 : return Reco_ConstructiveGeometryRepresentation;
|
||||
case 713 : return Reco_ConstructiveGeometryRepresentationRelationship;
|
||||
case 714 : return Reco_CharacterizedRepresentation;
|
||||
case 716 : return Reco_CameraModelD3MultiClipping;
|
||||
case 717 : return Reco_CameraModelD3MultiClippingIntersection;
|
||||
case 718 : return Reco_CameraModelD3MultiClippingUnion;
|
||||
|
||||
default : return PasReco;
|
||||
}
|
||||
@@ -4833,6 +4859,14 @@ Standard_Boolean RWStepAP214_ReadWriteModule::ComplexType(const Standard_Integer
|
||||
types.Append(StepType(714));
|
||||
types.Append(StepType(441));
|
||||
types.Append(StepType(245));
|
||||
break;
|
||||
case 719:
|
||||
types.Append(StepType(4));
|
||||
types.Append(StepType(7));
|
||||
types.Append(StepType(144));
|
||||
types.Append(StepType(247));
|
||||
types.Append(StepType(270));
|
||||
break;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -9383,6 +9417,35 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN,
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 716:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClipping tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 717:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 718:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
case 719:
|
||||
{
|
||||
DeclareAndCast(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem, anent, ent);
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem tool;
|
||||
tool.ReadStep(data, num, ach, anent);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ach->AddFail("Type Mismatch when reading - Entity");
|
||||
@@ -14211,6 +14274,34 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 716:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClipping tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 717:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 718:
|
||||
{
|
||||
DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent);
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
case 719:
|
||||
{
|
||||
DeclareAndCast(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem, anent, ent);
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem tool;
|
||||
tool.WriteStep(SW, anent);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
RWStepVisual_RWAnnotationCurveOccurrence.cxx
|
||||
RWStepVisual_RWAnnotationCurveOccurrence.hxx
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.cxx
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx
|
||||
RWStepVisual_RWAnnotationFillArea.cxx
|
||||
RWStepVisual_RWAnnotationFillArea.hxx
|
||||
RWStepVisual_RWAnnotationFillAreaOccurrence.cxx
|
||||
@@ -20,6 +22,12 @@ RWStepVisual_RWCameraModelD2.cxx
|
||||
RWStepVisual_RWCameraModelD2.hxx
|
||||
RWStepVisual_RWCameraModelD3.cxx
|
||||
RWStepVisual_RWCameraModelD3.hxx
|
||||
RWStepVisual_RWCameraModelD3MultiClipping.cxx
|
||||
RWStepVisual_RWCameraModelD3MultiClipping.hxx
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx
|
||||
RWStepVisual_RWCameraUsage.cxx
|
||||
RWStepVisual_RWCameraUsage.hxx
|
||||
RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.cxx
|
||||
|
@@ -0,0 +1,114 @@
|
||||
// Created on: 2017-02-06
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2017 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 <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepRepr_RepresentationItem.hxx>
|
||||
#include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
|
||||
#include <StepVisual_PresentationStyleAssignment.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::
|
||||
RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem () {}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num0,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const
|
||||
{
|
||||
Standard_Integer num = 0;
|
||||
data->NamedForComplex("REPRESENTATION_ITEM", "RPRITM", num0, num, ach);
|
||||
// Inherited field : name
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
data->ReadString(num, 1, "name", ach, aName);
|
||||
|
||||
data->NamedForComplex("STYLED_ITEM", "STYITM", num0, num, ach);
|
||||
// Inherited field : styles
|
||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aStyles;
|
||||
Handle(StepVisual_PresentationStyleAssignment) anEnt;
|
||||
Standard_Integer nsub;
|
||||
if (data->ReadSubList(num, 1, "styles", ach, nsub)) {
|
||||
Standard_Integer nb = data->NbParams(nsub);
|
||||
aStyles = new StepVisual_HArray1OfPresentationStyleAssignment(1, nb);
|
||||
for (Standard_Integer i = 1; i <= nb; i++) {
|
||||
if (data->ReadEntity(nsub, i, "presentation_style_assignment", ach,
|
||||
STANDARD_TYPE(StepVisual_PresentationStyleAssignment), anEnt))
|
||||
aStyles->SetValue(i, anEnt);
|
||||
}
|
||||
}
|
||||
|
||||
// Inherited field : item
|
||||
Handle(MMgt_TShared) aItem;
|
||||
data->ReadEntity(num, 2, "item", ach, STANDARD_TYPE(MMgt_TShared), aItem);
|
||||
|
||||
// Initialization of the read entity
|
||||
ent->Init(aName, aStyles, aItem);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const
|
||||
{
|
||||
SW.StartEntity("ANNOTATION_CURVE_OCCURRENCE");
|
||||
SW.StartEntity("ANNOTATION_OCCURRENCE");
|
||||
SW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
|
||||
SW.StartEntity("REPRESENTATION_ITEM");
|
||||
//Inherited field : name
|
||||
SW.Send(ent->Name());
|
||||
|
||||
SW.StartEntity("STYLED_ITEM");
|
||||
// Inherited field : styles
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i = 1; i <= ent->NbStyles(); i++) {
|
||||
SW.Send(ent->StylesValue(i));
|
||||
}
|
||||
SW.CloseSub();
|
||||
|
||||
// Inherited field : item
|
||||
SW.Send(ent->Item());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem::Share(
|
||||
const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
|
||||
Standard_Integer nbElem = ent->NbStyles();
|
||||
for (Standard_Integer i = 1; i <= nbElem; i++) {
|
||||
iter.GetOneItem(ent->StylesValue(i));
|
||||
}
|
||||
|
||||
iter.GetOneItem(ent->Item());
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
// Created on: 2017-02-06
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2017 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 _RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem_HeaderFile
|
||||
#define _RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! Read & Write Module for AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem
|
||||
class RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share (const Handle(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem)& ent, Interface_EntityIterator& iter) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem_HeaderFile
|
118
src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx
Normal file
118
src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx
Normal file
@@ -0,0 +1,118 @@
|
||||
// Created on: 2016-10-25
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClipping.hxx>
|
||||
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
|
||||
#include <StepVisual_ViewVolume.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWCameraModelD3MultiClipping
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepVisual_RWCameraModelD3MultiClipping::RWStepVisual_RWCameraModelD3MultiClipping() {}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClipping::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const
|
||||
{
|
||||
// Number of Parameter Control
|
||||
if (!data->CheckNbParams(num, 4, ach, "camera_model_d3_multi_clipping"))
|
||||
return;
|
||||
|
||||
// Inherited field : name
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
data->ReadString (num, 1, "name", ach, aName);
|
||||
|
||||
//Inherited field : view_reference_system
|
||||
Handle(StepGeom_Axis2Placement3d) aViewReferenceSystem;
|
||||
data->ReadEntity(num, 2, "view_reference_system", ach, STANDARD_TYPE(StepGeom_Axis2Placement3d), aViewReferenceSystem);
|
||||
|
||||
// Inherited field : perspective_of_volume
|
||||
Handle(StepVisual_ViewVolume) aPerspectiveOfVolume;
|
||||
data->ReadEntity(num, 3, "perspective_of_volume", ach, STANDARD_TYPE(StepVisual_ViewVolume), aPerspectiveOfVolume);
|
||||
|
||||
// Own field : shape_clipping
|
||||
Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) aShapeClipping;
|
||||
StepVisual_CameraModelD3MultiClippingInterectionSelect anEnt;
|
||||
Standard_Integer nbSub;
|
||||
if (data->ReadSubList(num, 4, "shape_clipping", ach, nbSub)) {
|
||||
Standard_Integer nbElements = data->NbParams(nbSub);
|
||||
aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect(1, nbElements);
|
||||
for (Standard_Integer i = 1; i <= nbElements; i++) {
|
||||
if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt))
|
||||
aShapeClipping->SetValue(i, anEnt);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization of the read entity
|
||||
ent->Init(aName, aViewReferenceSystem, aPerspectiveOfVolume, aShapeClipping);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClipping::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const
|
||||
{
|
||||
// Inherited field name
|
||||
SW.Send(ent->Name());
|
||||
|
||||
// Inherited field view_reference_system
|
||||
SW.Send(ent->ViewReferenceSystem());
|
||||
|
||||
// Inherited field view_reference_system
|
||||
SW.Send(ent->PerspectiveOfVolume());
|
||||
|
||||
// Own field: shape_clipping
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) {
|
||||
SW.Send(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
SW.CloseSub();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClipping::Share
|
||||
(const Handle(StepVisual_CameraModelD3MultiClipping)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
// Inherited field view_reference_system
|
||||
iter.GetOneItem(ent->ViewReferenceSystem());
|
||||
// Inherited field : perspective_of_volume
|
||||
iter.GetOneItem(ent->PerspectiveOfVolume());
|
||||
// Own field: shape_clipping
|
||||
Standard_Integer i, nb = ent->ShapeClipping()->Length();
|
||||
for (i = 1; i <= nb; i++)
|
||||
iter.AddItem(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
|
@@ -0,0 +1,48 @@
|
||||
// Created on: 2016-10-25
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile
|
||||
#define _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_CameraModelD3MultiClipping;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! Read & Write Module for CameraModelD3MultiClipping
|
||||
class RWStepVisual_RWCameraModelD3MultiClipping
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClipping();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClipping)& ent, Interface_EntityIterator& iter) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile
|
@@ -0,0 +1,98 @@
|
||||
// Created on: 2016-11-14
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWCameraModelD3MultiClippingIntersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepVisual_RWCameraModelD3MultiClippingIntersection::RWStepVisual_RWCameraModelD3MultiClippingIntersection() {}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingIntersection::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const
|
||||
{
|
||||
// Number of Parameter Control
|
||||
if (!data->CheckNbParams(num, 2, ach, "camera_model_d3_multi_clipping_intersection"))
|
||||
return;
|
||||
|
||||
// Inherited field : name
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
data->ReadString (num, 1, "name", ach, aName);
|
||||
|
||||
// Own field : shape_clipping
|
||||
Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) aShapeClipping;
|
||||
StepVisual_CameraModelD3MultiClippingInterectionSelect anEnt;
|
||||
Standard_Integer nbSub;
|
||||
if (data->ReadSubList(num, 2, "shape_clipping", ach, nbSub)) {
|
||||
Standard_Integer nbElements = data->NbParams(nbSub);
|
||||
aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect(1, nbElements);
|
||||
for (Standard_Integer i = 1; i <= nbElements; i++) {
|
||||
if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt))
|
||||
aShapeClipping->SetValue(i, anEnt);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization of the read entity
|
||||
ent->Init(aName, aShapeClipping);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingIntersection::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const
|
||||
{
|
||||
// Inherited field name
|
||||
SW.Send(ent->Name());
|
||||
|
||||
// Own field: shape_clipping
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) {
|
||||
SW.Send(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
SW.CloseSub();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingIntersection::Share
|
||||
(const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
// Own field: shape_clipping
|
||||
Standard_Integer i, nb = ent->ShapeClipping()->Length();
|
||||
for (i = 1; i <= nb; i++)
|
||||
iter.AddItem(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
|
@@ -0,0 +1,48 @@
|
||||
// Created on: 2016-11-14
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile
|
||||
#define _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_CameraModelD3MultiClippingIntersection;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! Read & Write Module for CameraModelD3MultiClippingIntersection
|
||||
class RWStepVisual_RWCameraModelD3MultiClippingIntersection
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClippingIntersection();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent, Interface_EntityIterator& iter) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile
|
@@ -0,0 +1,98 @@
|
||||
// Created on: 2016-11-14
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWCameraModelD3MultiClippingUnion
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
RWStepVisual_RWCameraModelD3MultiClippingUnion::RWStepVisual_RWCameraModelD3MultiClippingUnion() {}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingUnion::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const
|
||||
{
|
||||
// Number of Parameter Control
|
||||
if (!data->CheckNbParams(num, 2, ach, "camera_model_d3_multi_clipping_union"))
|
||||
return;
|
||||
|
||||
// Inherited field : name
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
data->ReadString (num, 1, "name", ach, aName);
|
||||
|
||||
// Own field : shape_clipping
|
||||
Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect) aShapeClipping;
|
||||
StepVisual_CameraModelD3MultiClippingUnionSelect anEnt;
|
||||
Standard_Integer nbSub;
|
||||
if (data->ReadSubList(num, 2, "shape_clipping", ach, nbSub)) {
|
||||
Standard_Integer nbElements = data->NbParams(nbSub);
|
||||
aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect(1, nbElements);
|
||||
for (Standard_Integer i = 1; i <= nbElements; i++) {
|
||||
if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt))
|
||||
aShapeClipping->SetValue(i, anEnt);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization of the read entity
|
||||
ent->Init(aName, aShapeClipping);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingUnion::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const
|
||||
{
|
||||
// Inherited field name
|
||||
SW.Send(ent->Name());
|
||||
|
||||
// Own field: shape_clipping
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) {
|
||||
SW.Send(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
SW.CloseSub();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Share
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void RWStepVisual_RWCameraModelD3MultiClippingUnion::Share
|
||||
(const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
// Own field: shape_clipping
|
||||
Standard_Integer i, nb = ent->ShapeClipping()->Length();
|
||||
for (i = 1; i <= nb; i++)
|
||||
iter.AddItem(ent->ShapeClipping()->Value(i).Value());
|
||||
}
|
||||
|
@@ -0,0 +1,48 @@
|
||||
// Created on: 2016-11-14
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright (c) 2016 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 _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile
|
||||
#define _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class StepVisual_CameraModelD3MultiClippingUnion;
|
||||
class StepData_StepWriter;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! Read & Write Module for CameraModelD3MultiClippingUnion
|
||||
class RWStepVisual_RWCameraModelD3MultiClippingUnion
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClippingUnion();
|
||||
|
||||
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const;
|
||||
|
||||
Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const;
|
||||
|
||||
Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent, Interface_EntityIterator& iter) const;
|
||||
};
|
||||
#endif // _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile
|
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
@@ -109,6 +111,7 @@
|
||||
#include <StepRepr_DerivedShapeAspect.hxx>
|
||||
#include <StepRepr_DescriptiveRepresentationItem.hxx>
|
||||
#include <StepRepr_HArray1OfRepresentationItem.hxx>
|
||||
#include <StepRepr_MappedItem.hxx>
|
||||
#include <StepRepr_MeasureRepresentationItem.hxx>
|
||||
#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
|
||||
#include <StepRepr_ProductDefinitionShape.hxx>
|
||||
@@ -117,6 +120,7 @@
|
||||
#include <StepRepr_Representation.hxx>
|
||||
#include <StepRepr_RepresentationItem.hxx>
|
||||
#include <StepRepr_HArray1OfRepresentationItem.hxx>
|
||||
#include <StepRepr_RepresentationMap.hxx>
|
||||
#include <StepRepr_RepresentationRelationship.hxx>
|
||||
#include <StepRepr_RepresentedDefinition.hxx>
|
||||
#include <StepRepr_ReprItemAndLengthMeasureWithUnit.hxx>
|
||||
@@ -177,6 +181,13 @@
|
||||
#include <StepVisual_AnnotationCurveOccurrence.hxx>
|
||||
#include <StepVisual_AnnotationFillArea.hxx>
|
||||
#include <StepVisual_AnnotationPlane.hxx>
|
||||
#include <StepVisual_CameraModelD3.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClipping.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
|
||||
#include <StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx>
|
||||
#include <StepVisual_DraughtingCallout.hxx>
|
||||
#include <StepVisual_DraughtingCalloutElement.hxx>
|
||||
#include <StepVisual_DraughtingModel.hxx>
|
||||
@@ -187,6 +198,7 @@
|
||||
#include <StepVisual_PresentationStyleByContext.hxx>
|
||||
#include <StepVisual_StyleContextSelect.hxx>
|
||||
#include <StepVisual_StyledItem.hxx>
|
||||
#include <StepVisual_ViewVolume.hxx>
|
||||
#include <StepShape_TypeQualifier.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
@@ -218,6 +230,7 @@
|
||||
#include <XCAFDoc.hxx>
|
||||
#include <XCAFDoc_Area.hxx>
|
||||
#include <XCAFDoc_Centroid.hxx>
|
||||
#include <XCAFDoc_ClippingPlaneTool.hxx>
|
||||
#include <XCAFDoc_ColorTool.hxx>
|
||||
#include <XCAFDoc_DataMapOfShapeLabel.hxx>
|
||||
#include <XCAFDoc_DimTolTool.hxx>
|
||||
@@ -229,12 +242,15 @@
|
||||
#include <XCAFDoc_LayerTool.hxx>
|
||||
#include <XCAFDoc_MaterialTool.hxx>
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
#include <XCAFDoc_View.hxx>
|
||||
#include <XCAFDoc_ViewTool.hxx>
|
||||
#include <XCAFDoc_Volume.hxx>
|
||||
#include <XCAFDimTolObjects_DimensionModifiersSequence.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceType.hxx>
|
||||
#include <XCAFDimTolObjects_DimensionObject.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
||||
#include <XCAFDimTolObjects_DatumObject.hxx>
|
||||
#include <XCAFView_Object.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||
@@ -321,7 +337,8 @@ STEPCAFControl_Reader::STEPCAFControl_Reader ():
|
||||
myPropsMode( Standard_True ),
|
||||
mySHUOMode ( Standard_False ),
|
||||
myGDTMode ( Standard_True ),
|
||||
myMatMode ( Standard_True )
|
||||
myMatMode(Standard_True),
|
||||
myViewMode(Standard_True)
|
||||
{
|
||||
STEPCAFControl_Controller::Init();
|
||||
}
|
||||
@@ -340,7 +357,8 @@ STEPCAFControl_Reader::STEPCAFControl_Reader (const Handle(XSControl_WorkSession
|
||||
myPropsMode( Standard_True ),
|
||||
mySHUOMode ( Standard_False ),
|
||||
myGDTMode ( Standard_True ),
|
||||
myMatMode ( Standard_True )
|
||||
myMatMode(Standard_True),
|
||||
myViewMode(Standard_True)
|
||||
{
|
||||
STEPCAFControl_Controller::Init();
|
||||
Init ( WS, scratch );
|
||||
@@ -685,6 +703,10 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
if(GetMatMode())
|
||||
ReadMaterials(reader.WS(),doc,SeqPDS);
|
||||
|
||||
// read View entities from STEP model
|
||||
if (GetViewMode())
|
||||
ReadViews(reader.WS(), doc);
|
||||
|
||||
// Expand resulting CAF structure for sub-shapes (optionally with their
|
||||
// names) if requested
|
||||
ExpandSubShapes(STool, map, ShapePDMap);
|
||||
@@ -1926,7 +1948,6 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th
|
||||
{
|
||||
if (theAnnotationPlane.IsNull())
|
||||
return Standard_False;
|
||||
gp_Ax2 aPlaneAxes;
|
||||
Handle(StepRepr_RepresentationItem) aPlaneItem = theAnnotationPlane->Item();
|
||||
if (aPlaneItem.IsNull())
|
||||
return Standard_False;
|
||||
@@ -1943,23 +1964,11 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th
|
||||
if (aA2P3D.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// build gp_Ax2 from axes
|
||||
Handle(StepGeom_Direction) anAxis = aA2P3D->Axis(),
|
||||
aRefDir = aA2P3D->RefDirection();
|
||||
if (anAxis.IsNull() || aRefDir.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aCoords;
|
||||
aCoords = anAxis->DirectionRatios();
|
||||
gp_Dir aXDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
|
||||
aCoords = aRefDir->DirectionRatios();
|
||||
gp_Dir aYDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
|
||||
aPlaneAxes.SetDirection(aXDir.Crossed(aYDir));
|
||||
aPlaneAxes.SetYDirection(aYDir);
|
||||
//set location of the annotation plane
|
||||
Handle(TColStd_HArray1OfReal) aLocCoords;
|
||||
Handle(StepGeom_CartesianPoint) aLoc = aA2P3D->Location();
|
||||
gp_Pnt aLocPos(aLoc->CoordinatesValue(1) * theFact, aLoc->CoordinatesValue(2) * theFact, aLoc->CoordinatesValue(3) * theFact);
|
||||
gp_Ax2 aPlaneAxes;
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D);
|
||||
aPlaneAxes = anAxis->Ax2();
|
||||
gp_XYZ aLocPos = aPlaneAxes.Location().XYZ();
|
||||
aLocPos *= theFact;
|
||||
aPlaneAxes.SetLocation(aLocPos);
|
||||
thePlane = aPlaneAxes;
|
||||
return Standard_True;
|
||||
@@ -2346,14 +2355,14 @@ static TDF_Label getShapeLabel(const Handle(StepRepr_RepresentationItem)& theIte
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
const TDF_Label theGDTL,
|
||||
const Standard_Integer thePositionCounter,
|
||||
const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers,
|
||||
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
|
||||
const Standard_Real theModifValue,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
const TDF_Label theGDTL,
|
||||
const Standard_Integer thePositionCounter,
|
||||
const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers,
|
||||
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
|
||||
const Standard_Real theModifValue,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
{
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
|
||||
@@ -2532,6 +2541,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
// Create datum target object
|
||||
if (isValidDT) {
|
||||
TDF_Label aDatL = aDGTTool->AddDatum();
|
||||
myGDTMap.Bind(aDT, aDatL);
|
||||
aDGTTool->Lock(aDatL);
|
||||
aDat = XCAFDoc_Datum::Set(aDatL);
|
||||
aDGTTool->SetDatum(aDTShapeLabels, aDatL);
|
||||
aDatTargetObj->SetName(theDat->Identification());
|
||||
@@ -2552,6 +2563,15 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
if (aShapeLabels.Length() > 0 || !isExistDatumTarget) {
|
||||
// Create object for datum
|
||||
TDF_Label aDatL = aDGTTool->AddDatum();
|
||||
myGDTMap.Bind(theDat, aDatL);
|
||||
// bind datum label with all reference datum_feature entities
|
||||
for (Standard_Integer i = 1; i <= aSAs.Length(); i++) {
|
||||
Handle(StepRepr_ShapeAspect) aSA = aSAs.Value(i);
|
||||
if (aSA.IsNull() || aSA->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)))
|
||||
continue;
|
||||
myGDTMap.Bind(aSA, aDatL);
|
||||
}
|
||||
aDGTTool->Lock(aDatL);
|
||||
aDat = XCAFDoc_Datum::Set(aDatL);
|
||||
aDGTTool->SetDatum(aShapeLabels, aDatL);
|
||||
aDatObj->SetName(theDat->Identification());
|
||||
@@ -2576,10 +2596,10 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
//function : ReadDatums
|
||||
//purpose : auxilary
|
||||
//=======================================================================
|
||||
static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label theGDTL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label theGDTL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
{
|
||||
const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
|
||||
const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
|
||||
@@ -2724,7 +2744,7 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt
|
||||
//function : createGeomTolObjectInXCAF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
{
|
||||
@@ -3092,6 +3112,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if(!theEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance)))
|
||||
{
|
||||
aGDTL = aDGTTool->AddDimension();
|
||||
myGDTMap.Bind(theEnt, aGDTL);
|
||||
aDGTTool->Lock(aGDTL);
|
||||
Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL);
|
||||
TCollection_AsciiString aStr("DGT:Dimensional_");
|
||||
if(theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)))
|
||||
@@ -3117,6 +3139,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
else
|
||||
{
|
||||
aGDTL = aDGTTool->AddGeomTolerance();
|
||||
myGDTMap.Bind(theEnt, aGDTL);
|
||||
aDGTTool->Lock(aGDTL);
|
||||
Handle(XCAFDoc_GeomTolerance) aGTol = XCAFDoc_GeomTolerance::Set(aGDTL);
|
||||
TCollection_AsciiString aStr("DGT:GeomTolerance");
|
||||
TDataStd_Name::Set(aGDTL, aStr);
|
||||
@@ -3791,7 +3815,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(TDocStd_Document)& theDoc) const
|
||||
Handle(TDocStd_Document)& theDoc)
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
|
||||
const Interface_Graph& aGraph = theWS->Graph();
|
||||
@@ -3920,6 +3944,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
|
||||
// Set object to XCAF
|
||||
TDF_Label aGDTL = aDGTTool->AddDimension();
|
||||
myGDTMap.Bind(anEnt, aGDTL);
|
||||
aDGTTool->Lock(aGDTL);
|
||||
Handle(XCAFDimTolObjects_DimensionObject) aDimObj = new XCAFDimTolObjects_DimensionObject();
|
||||
Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL);
|
||||
TCollection_AsciiString aStr("DGT:");
|
||||
@@ -4095,6 +4121,223 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : collectViewShapes
|
||||
//purpose : collect all labels of representations in given representation
|
||||
//=======================================================================
|
||||
|
||||
void collectViewShapes(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(StepRepr_Representation) theRepr,
|
||||
TDF_LabelSequence& theShapes)
|
||||
{
|
||||
Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
const Interface_Graph& aGraph = aTP->Graph();
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Standard_Integer anIndex = aTP->MapIndex(theRepr);
|
||||
TopoDS_Shape aSh;
|
||||
if (anIndex > 0) {
|
||||
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
|
||||
aSh = TransferBRep::ShapeResult(aBinder);
|
||||
}
|
||||
if (!aSh.IsNull()) {
|
||||
TDF_Label aShL;
|
||||
aSTool->FindShape(aSh, aShL);
|
||||
if (!aShL.IsNull())
|
||||
theShapes.Append(aShL);
|
||||
}
|
||||
Interface_EntityIterator anIter = aGraph.Sharings(theRepr);
|
||||
for (; anIter.More(); anIter.Next()) {
|
||||
if (!anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_RepresentationRelationship)))
|
||||
continue;
|
||||
Handle(StepRepr_RepresentationRelationship) aReprRelationship = Handle(StepRepr_RepresentationRelationship)::DownCast(anIter.Value());
|
||||
if (aReprRelationship->Rep1() != theRepr)
|
||||
collectViewShapes(theWS, theDoc, aReprRelationship->Rep1(), theShapes);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : buildClippingPlanes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel,
|
||||
TDF_LabelSequence& theClippingPlanes,
|
||||
const Handle(XCAFDoc_ClippingPlaneTool) theTool)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString();
|
||||
NCollection_Sequence<Handle(StepGeom_GeometricRepresentationItem)> aPlanes;
|
||||
Handle(TCollection_HAsciiString) anOperation = new TCollection_HAsciiString("*");
|
||||
|
||||
// Store operands
|
||||
if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClipping))) {
|
||||
Handle(StepVisual_CameraModelD3MultiClipping) aCameraModel =
|
||||
Handle(StepVisual_CameraModelD3MultiClipping)::DownCast(theClippingCameraModel);
|
||||
// Root of clipping planes tree
|
||||
if (aCameraModel->ShapeClipping()->Length() == 1) {
|
||||
Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModelUnion =
|
||||
aCameraModel->ShapeClipping()->Value(1).CameraModelD3MultiClippingUnion();
|
||||
if (!aCameraModelUnion.IsNull())
|
||||
return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool);
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) {
|
||||
aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value()));
|
||||
}
|
||||
}
|
||||
else if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion))) {
|
||||
Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModel =
|
||||
Handle(StepVisual_CameraModelD3MultiClippingUnion)::DownCast(theClippingCameraModel);
|
||||
anOperation = new TCollection_HAsciiString("+");
|
||||
for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) {
|
||||
aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value()));
|
||||
}
|
||||
}
|
||||
else if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection))) {
|
||||
Handle(StepVisual_CameraModelD3MultiClippingIntersection) aCameraModel =
|
||||
Handle(StepVisual_CameraModelD3MultiClippingIntersection)::DownCast(theClippingCameraModel);
|
||||
for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) {
|
||||
aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value()));
|
||||
}
|
||||
}
|
||||
// Build expression
|
||||
anExpression->AssignCat("(");
|
||||
for (Standard_Integer i = 1; i <= aPlanes.Length(); i++) {
|
||||
Handle(StepGeom_Plane) aPlaneEnt = Handle(StepGeom_Plane)::DownCast(aPlanes.Value(i));
|
||||
if (!aPlaneEnt.IsNull()) {
|
||||
Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt);
|
||||
if (!aPlane.IsNull()) {
|
||||
TDF_Label aPlaneL = theTool->AddClippingPlane(aPlane->Pln(), aPlaneEnt->Name());
|
||||
theClippingPlanes.Append(aPlaneL);
|
||||
TCollection_AsciiString anEntry;
|
||||
TDF_Tool::Entry(aPlaneL, anEntry);
|
||||
anExpression->AssignCat(new TCollection_HAsciiString(anEntry));
|
||||
}
|
||||
}
|
||||
else {
|
||||
anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool));
|
||||
}
|
||||
anExpression->AssignCat(anOperation);
|
||||
}
|
||||
// Insert brace instead of operation after last operand.
|
||||
anExpression->SetValue(anExpression->Length(), ')');
|
||||
return anExpression;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadViews
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
|
||||
Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(theDoc->Main());
|
||||
if (aDGTTool.IsNull()) return Standard_False;
|
||||
|
||||
Standard_Integer nb = aModel->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i++) {
|
||||
Handle(Standard_Transient) anEnt = aModel->Value(i);
|
||||
if (!anEnt->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3)))
|
||||
continue;
|
||||
Handle(XCAFView_Object) anObj = new XCAFView_Object();
|
||||
// Import attributes of view
|
||||
Handle(StepVisual_CameraModelD3) aCameraModel = Handle(StepVisual_CameraModelD3)::DownCast(anEnt);
|
||||
anObj->SetName(aCameraModel->Name());
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem());
|
||||
anObj->SetViewDirection(anAxis->Direction());
|
||||
anObj->SetUpDirection(anAxis->Direction() ^ anAxis->XDirection());
|
||||
Handle(StepVisual_ViewVolume) aViewVolume = aCameraModel->PerspectiveOfVolume();
|
||||
XCAFView_ProjectionType aType = XCAFView_ProjectionType_NoCamera;
|
||||
if (aViewVolume->ProjectionType() == StepVisual_copCentral)
|
||||
aType = XCAFView_ProjectionType_Central;
|
||||
else if (aViewVolume->ProjectionType() == StepVisual_copParallel)
|
||||
aType = XCAFView_ProjectionType_Parallel;
|
||||
anObj->SetType(aType);
|
||||
Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint());
|
||||
anObj->SetProjectionPoint(aPoint->Pnt());
|
||||
anObj->SetZoomFactor(aViewVolume->ViewPlaneDistance());
|
||||
anObj->SetWindowHorizontalSize(aViewVolume->ViewWindow()->SizeInX());
|
||||
anObj->SetWindowVerticalSize(aViewVolume->ViewWindow()->SizeInY());
|
||||
if (aViewVolume->FrontPlaneClipping())
|
||||
anObj->SetFrontPlaneDistance(aViewVolume->FrontPlaneDistance());
|
||||
if (aViewVolume->BackPlaneClipping())
|
||||
anObj->SetBackPlaneDistance(aViewVolume->BackPlaneDistance());
|
||||
anObj->SetViewVolumeSidesClipping(aViewVolume->ViewVolumeSidesClipping());
|
||||
// Clipping plane
|
||||
Handle(StepVisual_CameraModelD3MultiClipping) aClippingCameraModel =
|
||||
Handle(StepVisual_CameraModelD3MultiClipping)::DownCast(aCameraModel);
|
||||
TDF_LabelSequence aClippingPlanes;
|
||||
if (!aClippingCameraModel.IsNull()) {
|
||||
Handle(TCollection_HAsciiString) aClippingExpression;
|
||||
Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(theDoc->Main());
|
||||
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool);
|
||||
anObj->SetClippingExpression(aClippingExpression);
|
||||
}
|
||||
// Collect shapes and GDTs
|
||||
TDF_LabelSequence aShapes, aGDTs;
|
||||
Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
const Interface_Graph& aGraph = aTP->Graph();
|
||||
Handle(StepVisual_DraughtingModel) aDModel;
|
||||
Interface_EntityIterator anIter = aGraph.Sharings(aCameraModel);
|
||||
for (; anIter.More() && aDModel.IsNull(); anIter.Next()) {
|
||||
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(anIter.Value());
|
||||
}
|
||||
if (aDModel.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
anIter = aGraph.Shareds(aDModel);
|
||||
for (; anIter.More(); anIter.Next()) {
|
||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
|
||||
Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value());
|
||||
Handle(StepRepr_Representation) aRepr = anItem->MappingSource()->MappedRepresentation();
|
||||
collectViewShapes(theWS, theDoc, aRepr, aShapes);
|
||||
}
|
||||
else if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)) ||
|
||||
anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout))) {
|
||||
Interface_EntityIterator aDMIAIter = aGraph.Sharings(anIter.Value());
|
||||
for (; aDMIAIter.More(); aDMIAIter.Next()) {
|
||||
if (!aDMIAIter.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation)))
|
||||
continue;
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
|
||||
Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aDMIAIter.Value());
|
||||
TDF_Label aGDTL;
|
||||
Standard_Boolean isFind = myGDTMap.Find(aDMIA->Definition().Value(), aGDTL);
|
||||
if (!isFind) {
|
||||
isFind = myGDTMap.Find(anIter.Value(), aGDTL);
|
||||
}
|
||||
if (isFind)
|
||||
aGDTs.Append(aGDTL);
|
||||
}
|
||||
}
|
||||
else if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationPlane))) {
|
||||
Handle(StepVisual_AnnotationPlane) aPlane = Handle(StepVisual_AnnotationPlane)::DownCast(anIter.Value());
|
||||
for (Standard_Integer i = 1; i <= aPlane->NbElements(); i++) {
|
||||
Interface_EntityIterator aDMIAIter = aGraph.Sharings(anIter.Value());
|
||||
for (; aDMIAIter.More(); aDMIAIter.Next()) {
|
||||
if (!aDMIAIter.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation)))
|
||||
continue;
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
|
||||
Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aDMIAIter.Value());
|
||||
TDF_Label aGDTL;
|
||||
Standard_Boolean isFind = myGDTMap.Find(aDMIA->Definition().Value(), aGDTL);
|
||||
if (isFind)
|
||||
aGDTs.Append(aGDTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TDF_Label aViewL = aViewTool->AddView();
|
||||
Handle(XCAFDoc_View) aView = XCAFDoc_View::Set(aViewL);
|
||||
aView->SetObject(anObj);
|
||||
aViewTool->SetView(aShapes, aGDTs, aClippingPlanes, aViewL);
|
||||
aViewTool->Lock(aViewL);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SettleShapeData
|
||||
//purpose :
|
||||
@@ -4474,3 +4717,23 @@ Standard_Boolean STEPCAFControl_Reader::GetMatMode () const
|
||||
{
|
||||
return myMatMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetViewMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void STEPCAFControl_Reader::SetViewMode(const Standard_Boolean viewmode)
|
||||
{
|
||||
myViewMode = viewmode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetViewMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::GetViewMode() const
|
||||
{
|
||||
return myViewMode;
|
||||
}
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <STEPCAFControl_DataMapOfPDExternFile.hxx>
|
||||
#include <XCAFDoc_DataMapOfShapeLabel.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
|
||||
#include <XCAFDimTolObjects_DatumModifWithValue.hxx>
|
||||
class XSControl_WorkSession;
|
||||
class TDocStd_Document;
|
||||
class TCollection_AsciiString;
|
||||
@@ -44,6 +46,7 @@ class Transfer_TransientProcess;
|
||||
class StepShape_ConnectedFaceSet;
|
||||
class StepRepr_NextAssemblyUsageOccurrence;
|
||||
class STEPConstruct_Tool;
|
||||
class StepDimTol_Datum;
|
||||
|
||||
|
||||
//! Provides a tool to read STEP file and put it into
|
||||
@@ -153,6 +156,12 @@ public:
|
||||
Standard_EXPORT void SetMatMode (const Standard_Boolean matmode);
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetMatMode() const;
|
||||
|
||||
//! Set View mode
|
||||
Standard_EXPORT void SetViewMode(const Standard_Boolean viewmode);
|
||||
|
||||
//! Get View mode
|
||||
Standard_EXPORT Standard_Boolean GetViewMode() const;
|
||||
|
||||
|
||||
|
||||
@@ -201,12 +210,15 @@ protected:
|
||||
|
||||
//! Reads D> for instances defined in the STEP model and
|
||||
//! set reference between shape instances from different assemblyes
|
||||
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc) const;
|
||||
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc);
|
||||
|
||||
//! Reads materials for instances defined in the STEP model and
|
||||
//! set reference between shape instances from different assemblyes
|
||||
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;
|
||||
|
||||
//! Reads Views for instances defined in the STEP model
|
||||
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const;
|
||||
|
||||
//! Populates the sub-Label of the passed TDF Label with shape
|
||||
//! data associated with the given STEP Representation Item,
|
||||
//! including naming and topological information.
|
||||
@@ -238,6 +250,26 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//! Internal method. Import all Datum attributes and set them to XCAF object. Set connection of Datum to GeomTolerance (theGDTL).
|
||||
Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
const TDF_Label theGDTL,
|
||||
const Standard_Integer thePositionCounter,
|
||||
const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers,
|
||||
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
|
||||
const Standard_Real theModifValue,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
|
||||
//! Internal method. Read Datums, connected to GeomTolerance theGDTL.
|
||||
Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label theGDTL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
|
||||
//! Internal method. Read Dimension or GeomTolerance.
|
||||
TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
|
||||
|
||||
STEPControl_Reader myReader;
|
||||
@@ -249,7 +281,8 @@ private:
|
||||
Standard_Boolean mySHUOMode;
|
||||
Standard_Boolean myGDTMode;
|
||||
Standard_Boolean myMatMode;
|
||||
|
||||
Standard_Boolean myViewMode;
|
||||
NCollection_DataMap<Handle(Standard_Transient), TDF_Label> myGDTMap;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include <ShapeFix.hxx>
|
||||
#include <ShapeFix_ComposeShell.hxx>
|
||||
#include <ShapeUpgrade.hxx>
|
||||
#include <ShapeUpgrade_CombineToCylinder.hxx>
|
||||
#include <ShapeUpgrade_RemoveInternalWires.hxx>
|
||||
#include <ShapeUpgrade_RemoveLocations.hxx>
|
||||
#include <ShapeUpgrade_ShapeConvertToBezier.hxx>
|
||||
@@ -1476,6 +1477,69 @@ Standard_Integer reshape(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// CombineToCylinder
|
||||
//=======================================================================
|
||||
static Standard_Integer CombineToCylinder(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3)
|
||||
{
|
||||
di << "Use combinetocyl result shape [-t val] [-a val]\n";
|
||||
di << "options:\n";
|
||||
di << "-t val to set linear tolerance (default is 1e-7)\n";
|
||||
di << "-a val to set angular tolerance (default is 1e-12)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get(a[2]);
|
||||
if (aShape.IsNull())
|
||||
return 1;
|
||||
|
||||
// default values
|
||||
Standard_Real aLinTol = Precision::Confusion();
|
||||
Standard_Real aAngTol = Precision::Angular();
|
||||
|
||||
if (n > 3)
|
||||
{
|
||||
for (int i = 3; i < n; i++)
|
||||
{
|
||||
if (!strcmp(a[i], "-t") || !strcmp(a[i], "-a"))
|
||||
{
|
||||
if (++i < n)
|
||||
{
|
||||
if (a[i - 1][1] == 't')
|
||||
aLinTol = Draw::Atof(a[i]);
|
||||
else
|
||||
aAngTol = Draw::Atof(a[i]) * M_PI / 180.;
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "value expected after " << a[i - 1];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShapeUpgrade_CombineToCylinder aTool;
|
||||
aTool.SetShape(aShape);
|
||||
aTool.SetLinearTolerance(aLinTol);
|
||||
aTool.SetAngularTolerance(aAngTol);
|
||||
aTool.Build();
|
||||
if (!aTool.IsDone())
|
||||
{
|
||||
di << "Not done";
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Number of new merged faces: " << aTool.NbNewFaces();
|
||||
di << "\nNumber of replaced faces: " << aTool.NbReplacedFaces();
|
||||
const TopoDS_Shape& Result = aTool.Shape();
|
||||
DBRep::Set(a[1], Result);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitCommands
|
||||
//purpose :
|
||||
@@ -1589,4 +1653,7 @@ Standard_Integer reshape(Draw_Interpretor& di,
|
||||
"\n '-remove what' Removes 'what' sub-shape"
|
||||
"\n Requests '-replace' and '-remove' can be repeated many times.",
|
||||
__FILE__, reshape, g);
|
||||
|
||||
theCommands.Add("combinetocylinder",
|
||||
"run w/o arguments to get help", __FILE__, CombineToCylinder, g);
|
||||
}
|
||||
|
@@ -166,10 +166,11 @@ vec4 computeLighting (in vec3 theNormal,
|
||||
vec4 aMaterialDiffuse = gl_FrontFacing ? occFrontMaterial_Diffuse() : occBackMaterial_Diffuse();
|
||||
vec4 aMaterialSpecular = gl_FrontFacing ? occFrontMaterial_Specular() : occBackMaterial_Specular();
|
||||
vec4 aMaterialEmission = gl_FrontFacing ? occFrontMaterial_Emission() : occBackMaterial_Emission();
|
||||
return vec4 (Ambient, 1.0) * aMaterialAmbient
|
||||
+ vec4 (Diffuse, 1.0) * aMaterialDiffuse
|
||||
+ vec4 (Specular, 1.0) * aMaterialSpecular
|
||||
+ aMaterialEmission;
|
||||
vec3 aColor = Ambient * aMaterialAmbient.rgb
|
||||
+ Diffuse * aMaterialDiffuse.rgb
|
||||
+ Specular * aMaterialSpecular.rgb
|
||||
+ aMaterialEmission.rgb;
|
||||
return vec4 (aColor, aMaterialDiffuse.a);
|
||||
}
|
||||
|
||||
//! Entry point to the Fragment Shader
|
||||
@@ -185,7 +186,14 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = computeLighting (normalize (Normal),
|
||||
occFragColor = computeLighting (normalize (Normal),
|
||||
normalize (View),
|
||||
Position);
|
||||
|
||||
if (occOitEnableWrite != 0)
|
||||
{
|
||||
float aWeight = occFragColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthWeight, 3.0), 1e-2, 1e+2);
|
||||
occFragCoverage.r = occFragColor.a * aWeight;
|
||||
occFragColor = vec4 (occFragColor.rgb * occFragColor.a * aWeight, occFragColor.a);
|
||||
}
|
||||
}
|
||||
|
@@ -50,8 +50,16 @@ static const char Shaders_Declarations_glsl[] =
|
||||
" THE_ATTRIBUTE vec4 occVertColor;\n"
|
||||
"#elif (__VERSION__ >= 130)\n"
|
||||
" out vec4 occFragColor;\n"
|
||||
" #ifdef OCC_enable_draw_buffers\n"
|
||||
" out vec4 occFragCoverage;\n"
|
||||
" #endif\n"
|
||||
"#else\n"
|
||||
" #define occFragColor gl_FragColor\n"
|
||||
" #ifdef OCC_enable_draw_buffers\n"
|
||||
" #define occFragColor gl_FragData[0]\n"
|
||||
" #define occFragCoverage gl_FragData[1]\n"
|
||||
" #else\n"
|
||||
" #define occFragColor gl_FragColor\n"
|
||||
" #endif\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"// Matrix state\n"
|
||||
@@ -113,6 +121,10 @@ static const char Shaders_Declarations_glsl[] =
|
||||
"uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
|
||||
"uniform float occPointSize; //!< point size\n"
|
||||
"\n"
|
||||
"//! Parameters of blended order-independent transparency rendering algorithm\n"
|
||||
"uniform int occOitEnableWrite; //!< Enable bit for writing color (occFragColor), coverage (occFragCoverage) buffers of OIT processing\n"
|
||||
"uniform float occOitDepthWeight; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
|
||||
"\n"
|
||||
"//! Parameters of clipping planes\n"
|
||||
"uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];\n"
|
||||
"uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes\n";
|
||||
|
@@ -4,6 +4,8 @@ ShapeUpgrade_ClosedEdgeDivide.cxx
|
||||
ShapeUpgrade_ClosedEdgeDivide.hxx
|
||||
ShapeUpgrade_ClosedFaceDivide.cxx
|
||||
ShapeUpgrade_ClosedFaceDivide.hxx
|
||||
ShapeUpgrade_CombineToCylinder.cxx
|
||||
ShapeUpgrade_CombineToCylinder.hxx
|
||||
ShapeUpgrade_ConvertCurve2dToBezier.cxx
|
||||
ShapeUpgrade_ConvertCurve2dToBezier.hxx
|
||||
ShapeUpgrade_ConvertCurve3dToBezier.cxx
|
||||
|
901
src/ShapeUpgrade/ShapeUpgrade_CombineToCylinder.cxx
Normal file
901
src/ShapeUpgrade/ShapeUpgrade_CombineToCylinder.cxx
Normal file
@@ -0,0 +1,901 @@
|
||||
//-Copyright: Open CASCADE 2016
|
||||
// Created on: 2016-08-01
|
||||
// Created by: Mikhail Sazonov
|
||||
// Copyright (c) 2016 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 <ShapeUpgrade_CombineToCylinder.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTools_ReShape.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomAPI_PointsToBSpline.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <IntAna_IntConicQuad.hxx>
|
||||
#include <ShapeAnalysis_Curve.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeUpgrade_CombineToCylinder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeUpgrade_CombineToCylinder::ShapeUpgrade_CombineToCylinder()
|
||||
: myLinTol(Precision::Confusion()),
|
||||
myAngTol(Precision::Angular()),
|
||||
myNbNewFaces(0),
|
||||
myNbReplacedFaces(0),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myContext = new BRepTools_ReShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : sortEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void sortEdges(const TopoDS_Shape& theShape,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Real theAngTol,
|
||||
TopTools_MapOfShape& theStopEdges,
|
||||
NCollection_DataMap<TopoDS_Shape,gp_Cylinder>& theMapECyl)
|
||||
{
|
||||
TopExp_Explorer anEx(theShape, TopAbs_EDGE);
|
||||
for (; anEx.More(); anEx.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEx.Current());
|
||||
const TopTools_ListOfShape* pFaces = theMapEF.Seek(anEdge);
|
||||
if (!pFaces)
|
||||
continue;
|
||||
|
||||
// check for manifold edge
|
||||
if (pFaces->Extent() != 2)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get curve of the edge and check if it is a line
|
||||
BRepAdaptor_Curve aCurve(anEdge);
|
||||
if (aCurve.GetType() != GeomAbs_Line)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
// Check if the edge has enough length
|
||||
Standard_Real aLength = GCPnts_AbscissaPoint::Length(aCurve);
|
||||
if (aLength < 2.*theLinTol)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// check that both faces are planar, if no then add the edge to stop list
|
||||
TopoDS_Face aFaces[2] = { TopoDS::Face(pFaces->First()), TopoDS::Face(pFaces->Last()) };
|
||||
BRepAdaptor_Surface aSurf[2] = {
|
||||
BRepAdaptor_Surface(aFaces[0], Standard_False),
|
||||
BRepAdaptor_Surface(aFaces[1], Standard_False) };
|
||||
if (aSurf[0].GetType() != GeomAbs_Plane || aSurf[1].GetType() != GeomAbs_Plane)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// check if edge is sharp, if yes then add it to stop list
|
||||
gp_Pln aPl1 = aSurf[0].Plane();
|
||||
gp_Pln aPl2 = aSurf[1].Plane();
|
||||
if (aPl1.Axis().Direction().Angle(aPl2.Axis().Direction()) > theAngTol)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create plane perpendicular to the edge
|
||||
gp_Lin aLin = aCurve.Line();
|
||||
gp_Pln aPln(aLin.Location(), aLin.Direction());
|
||||
|
||||
// Get opposite edges on each face
|
||||
TopoDS_Edge anOpEdges[2];
|
||||
gp_Lin anOpLines[2];
|
||||
Standard_Integer i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
TopExp_Explorer anEx1(aFaces[i], TopAbs_EDGE);
|
||||
Standard_Integer nbE = 0;
|
||||
for (; anEx1.More(); anEx1.Next(), nbE++)
|
||||
{
|
||||
if (anOpEdges[i].IsNull())
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(anEx1.Current());
|
||||
if (!aE.IsSame(anEdge))
|
||||
{
|
||||
BRepAdaptor_Curve aC(aE);
|
||||
if (aC.GetType() == GeomAbs_Line)
|
||||
{
|
||||
gp_Lin aL = aC.Line();
|
||||
if (aL.Direction().IsParallel(aLin.Direction(), theAngTol))
|
||||
{
|
||||
anOpEdges[i] = aE;
|
||||
anOpLines[i] = aL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nbE != 4)
|
||||
break; // face has non-rectangular form
|
||||
}
|
||||
if (anOpEdges[0].IsNull() || anOpEdges[1].IsNull())
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// intersect all 3 edges with the plane
|
||||
gp_Lin aLines[3] = { anOpLines[0], aLin, anOpLines[1] };
|
||||
gp_Pnt anIntPnt[3];
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
IntAna_IntConicQuad anInter(aLines[i], aPln, theAngTol);
|
||||
if (!anInter.IsDone() || anInter.NbPoints() != 1)
|
||||
break;
|
||||
anIntPnt[i] = anInter.Point(1);
|
||||
}
|
||||
if (i < 3)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// check that distances to points on opposite edges are equal
|
||||
Standard_Real aDist1 = anIntPnt[0].Distance(anIntPnt[1]);
|
||||
Standard_Real aDist2 = anIntPnt[2].Distance(anIntPnt[1]);
|
||||
if (fabs(aDist1 - aDist2) > theLinTol)
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
|
||||
// compute the circle radius
|
||||
gce_MakeCirc aCircMaker(anIntPnt[0], anIntPnt[1], anIntPnt[2]);
|
||||
if (!aCircMaker.IsDone())
|
||||
{
|
||||
theStopEdges.Add(anEdge);
|
||||
continue;
|
||||
}
|
||||
Standard_Real aRadius = aCircMaker.Value().Radius();
|
||||
const gp_Ax1& aCylAxis = aCircMaker.Value().Axis();
|
||||
gp_Cylinder aCyl(gp_Ax3(aCylAxis.Location(), aCylAxis.Direction()), aRadius);
|
||||
theMapECyl.Bind(anEdge, aCyl);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : updateBoundary
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void updateBoundary(TopTools_ListOfShape& theBoundary,
|
||||
const TopoDS_Shape& theFace,
|
||||
const TopoDS_Shape& theConnectingEdge,
|
||||
const TopTools_MapOfShape& theStopEdges)
|
||||
{
|
||||
// iterate on all edges of the face
|
||||
TopExp_Explorer anEx(theFace, TopAbs_EDGE);
|
||||
for (; anEx.More(); anEx.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEx.Current());
|
||||
if (anEdge.IsSame(theConnectingEdge) || theStopEdges.Contains(anEdge))
|
||||
continue; // skip stop edges
|
||||
// find this edge in the boundary
|
||||
TopTools_ListIteratorOfListOfShape anIt(theBoundary);
|
||||
while (anIt.More())
|
||||
{
|
||||
if (anIt.Value().IsSame(anEdge))
|
||||
break;
|
||||
anIt.Next();
|
||||
}
|
||||
if (anIt.More())
|
||||
{
|
||||
// found, remove it from boundary
|
||||
theBoundary.Remove(anIt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// not found, add to boundary
|
||||
theBoundary.Append(anEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Auxiliary structures
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
namespace CombineToCylinder
|
||||
{
|
||||
struct Area
|
||||
{
|
||||
TopoDS_Compound Faces;
|
||||
const gp_Cylinder* pCylinder;
|
||||
Standard_Integer nbFaces;
|
||||
|
||||
Area() : pCylinder(0L), nbFaces(0)
|
||||
{}
|
||||
void Init()
|
||||
{
|
||||
Faces.Nullify();
|
||||
nbFaces = 0;
|
||||
BRep_Builder().MakeCompound(Faces);
|
||||
}
|
||||
void AddFace(const TopoDS_Shape& theFace)
|
||||
{
|
||||
BRep_Builder().Add(Faces, theFace);
|
||||
nbFaces++;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EqualCylinders
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean EqualCylinders(const gp_Cylinder& theCyl1,
|
||||
const gp_Cylinder& theCyl2,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Real theAngTol)
|
||||
{
|
||||
// check radii
|
||||
if (fabs(theCyl1.Radius() - theCyl2.Radius()) > theLinTol)
|
||||
return Standard_False;
|
||||
// check if parallel
|
||||
if (!theCyl1.Axis().Direction().IsParallel(theCyl2.Axis().Direction(), theAngTol))
|
||||
return Standard_False;
|
||||
// check distance between axes
|
||||
gp_XYZ aVecO1O2 = theCyl2.Location().XYZ() - theCyl1.Location().XYZ();
|
||||
Standard_Real aDist1 = aVecO1O2.CrossSquareMagnitude(theCyl2.Axis().Direction().XYZ());
|
||||
Standard_Real aDist2 = aVecO1O2.CrossSquareMagnitude(theCyl1.Axis().Direction().XYZ());
|
||||
Standard_Real aTol = theLinTol * theLinTol;
|
||||
return aDist1 <= aTol && aDist2 < aTol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : collectAreas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void collectAreas(const TopoDS_Shape& theShape,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
|
||||
const TopTools_MapOfShape& theStopEdges,
|
||||
const NCollection_DataMap<TopoDS_Shape, gp_Cylinder>& theMapECyl,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Real theAngTol,
|
||||
NCollection_List<CombineToCylinder::Area>& theAreas)
|
||||
{
|
||||
TopTools_MapOfShape aPassedFaces;
|
||||
|
||||
// Repeat while there are unprocessed faces
|
||||
for (;;)
|
||||
{
|
||||
// get first unprocessed face
|
||||
TopoDS_Shape aCurFace;
|
||||
TopExp_Explorer anEx(theShape, TopAbs_FACE);
|
||||
for (; anEx.More(); anEx.Next())
|
||||
{
|
||||
aCurFace = anEx.Current();
|
||||
if (!aPassedFaces.Contains(aCurFace))
|
||||
break;
|
||||
}
|
||||
if (!anEx.More())
|
||||
break; // all are processed, stop
|
||||
|
||||
// Start area with it
|
||||
CombineToCylinder::Area anArea;
|
||||
anArea.Init();
|
||||
anArea.AddFace(aCurFace);
|
||||
aPassedFaces.Add(aCurFace);
|
||||
|
||||
// Define edges of boundary of area
|
||||
TopTools_ListOfShape aBoundary;
|
||||
updateBoundary(aBoundary, aCurFace, TopoDS_Shape(), theStopEdges);
|
||||
|
||||
// Add all neighbors to the area while there are unprocessed edges of boundary
|
||||
while (!aBoundary.IsEmpty())
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape anIt(aBoundary);
|
||||
while (anIt.More())
|
||||
{
|
||||
const TopoDS_Shape& anEdge = anIt.Value();
|
||||
const gp_Cylinder* pCyl = theMapECyl.Seek(anEdge);
|
||||
const TopTools_ListOfShape* pFaces = theMapEF.Seek(anEdge);
|
||||
Standard_ASSERT_RAISE(pCyl && pFaces && pFaces->Extent() == 2, "collectAreas");
|
||||
if (!anArea.pCylinder || EqualCylinders(*anArea.pCylinder, *pCyl, theLinTol, theAngTol))
|
||||
{
|
||||
anArea.pCylinder = pCyl;
|
||||
aCurFace = (aPassedFaces.Contains(pFaces->First()) ? pFaces->Last() : pFaces->First());
|
||||
if (!aPassedFaces.Contains(aCurFace))
|
||||
{
|
||||
// Update boundary adding the next face
|
||||
updateBoundary(aBoundary, aCurFace, anEdge, theStopEdges);
|
||||
anArea.AddFace(aCurFace);
|
||||
aPassedFaces.Add(aCurFace);
|
||||
}
|
||||
}
|
||||
aBoundary.Remove(anIt);
|
||||
}
|
||||
}
|
||||
|
||||
// check if area is well formed
|
||||
if (anArea.pCylinder && anArea.nbFaces > 2)
|
||||
{
|
||||
// Add area to the result list
|
||||
theAreas.Append(anArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getNextEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean getNextEdge(const TopTools_ListOfShape& theChain,
|
||||
const Standard_Boolean theFwd,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
|
||||
const Standard_Real theSmoothAng,
|
||||
TopoDS_Edge& theNextEdge)
|
||||
{
|
||||
// Get end edge and vertex
|
||||
TopoDS_Edge anEndE, anOppoEdge;
|
||||
TopoDS_Vertex anEndV;
|
||||
if (theFwd)
|
||||
{
|
||||
anEndE = TopoDS::Edge(theChain.Last());
|
||||
anOppoEdge = TopoDS::Edge(theChain.First());
|
||||
anEndV = TopExp::LastVertex(anEndE, Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
anEndE = TopoDS::Edge(theChain.First());
|
||||
anOppoEdge = TopoDS::Edge(theChain.Last());
|
||||
anEndV = TopExp::FirstVertex(anEndE, Standard_True);
|
||||
}
|
||||
|
||||
// Get next edge using topology map; reject the case of multi-connected vertex,
|
||||
// when there are more than one candidate edge
|
||||
const TopTools_ListOfShape& aConnEdges = theMapVE.FindFromKey(anEndV);
|
||||
// Note! aConnEdges can contain duplicates
|
||||
theNextEdge.Nullify();
|
||||
TopTools_ListIteratorOfListOfShape itL(aConnEdges);
|
||||
for (; itL.More(); itL.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = itL.Value();
|
||||
if (aE.IsSame(anEndE))
|
||||
continue;
|
||||
if (theNextEdge.IsNull())
|
||||
theNextEdge = TopoDS::Edge(aE);
|
||||
else if(!aE.IsSame(theNextEdge))
|
||||
return Standard_False; // multi-connected vertex
|
||||
}
|
||||
|
||||
// check for closed chain
|
||||
if (theNextEdge.IsSame(anOppoEdge))
|
||||
return Standard_False;
|
||||
|
||||
// Orient the next edge
|
||||
TopoDS_Vertex aNextEndV = (theFwd ? TopExp::FirstVertex(theNextEdge, Standard_True) :
|
||||
TopExp::LastVertex(theNextEdge, Standard_True));
|
||||
if (!aNextEndV.IsSame(anEndV))
|
||||
theNextEdge.Reverse();
|
||||
|
||||
if (theSmoothAng > 0.)
|
||||
{
|
||||
// Check that the edge is linear
|
||||
BRepAdaptor_Curve aNextC(theNextEdge);
|
||||
if (aNextC.GetType() != GeomAbs_Line)
|
||||
return Standard_False;
|
||||
|
||||
// Verify smoothness of connection
|
||||
BRepAdaptor_Curve anEndC(anEndE);
|
||||
gp_Lin anEndLin = anEndC.Line();
|
||||
gp_Lin aNextLin = aNextC.Line();
|
||||
const gp_Dir& anEndDir = anEndLin.Direction();
|
||||
const gp_Dir& aNextDir = aNextLin.Direction();
|
||||
if (!anEndDir.IsParallel(aNextDir, theSmoothAng))
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : makeEdgesChain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void makeEdgesChain(TopTools_ListOfShape& theChain,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMapVE,
|
||||
const Standard_Real theSmoothAng)
|
||||
{
|
||||
// Cycle for both ends of the chain
|
||||
Standard_Boolean isFwd[2] = { Standard_True, Standard_False };
|
||||
for (Standard_Integer i = 0; i < 2; i++)
|
||||
{
|
||||
TopoDS_Edge aNextEdge;
|
||||
while (getNextEdge(theChain, isFwd[i], theMapVE, theSmoothAng, aNextEdge))
|
||||
{
|
||||
// add next edge to the chain
|
||||
if (isFwd[i])
|
||||
theChain.Append(aNextEdge);
|
||||
else
|
||||
theChain.Prepend(aNextEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createCylFaceFromArea
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static TopoDS_Face createCylFaceFromArea(const TopoDS_Compound& theFaces,
|
||||
const gp_Cylinder& theCylinder)
|
||||
{
|
||||
// Find boundary edges of the area
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMapEF, aMapVE;
|
||||
TopExp::MapShapesAndAncestors(theFaces, TopAbs_EDGE, TopAbs_FACE, aMapEF);
|
||||
TopTools_ListOfShape aBoundary;
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= aMapEF.Extent(); i++)
|
||||
{
|
||||
if (aMapEF(i).Extent() == 1)
|
||||
{
|
||||
const TopoDS_Shape& aE = aMapEF.FindKey(i);
|
||||
aBoundary.Append(aE);
|
||||
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
||||
}
|
||||
}
|
||||
|
||||
// Check the case of closed cylinder. In this case there will be two
|
||||
// distinct chains of boundary edges, and we need to create a seam edge
|
||||
TopoDS_Edge aSeamEdge;
|
||||
TopTools_ListOfShape aChain;
|
||||
aChain.Append(aBoundary.First());
|
||||
makeEdgesChain(aChain, aMapVE, 0.);
|
||||
TopTools_MapOfShape aMapChain;
|
||||
TopTools_ListIteratorOfListOfShape itC(aChain);
|
||||
for (; itC.More(); itC.Next())
|
||||
aMapChain.Add(itC.Value());
|
||||
TopTools_ListIteratorOfListOfShape itB(aBoundary);
|
||||
for (; itB.More(); itB.Next())
|
||||
{
|
||||
if (!aMapChain.Contains(itB.Value()))
|
||||
break;
|
||||
}
|
||||
if (itB.More())
|
||||
{
|
||||
// It is the case.
|
||||
// Get any multi-connected edge and use it as a seam
|
||||
for (i = 1; i <= aMapEF.Extent(); i++)
|
||||
if (aMapEF(i).Extent() == 2)
|
||||
aSeamEdge = TopoDS::Edge(aMapEF.FindKey(i));
|
||||
}
|
||||
|
||||
// Build new cylindrical face
|
||||
TopoDS_Wire aWire;
|
||||
BRep_Builder().MakeWire(aWire);
|
||||
for (itB.Init(aBoundary); itB.More(); itB.Next())
|
||||
{
|
||||
BRep_Builder().Add(aWire, itB.Value());
|
||||
}
|
||||
if (!aSeamEdge.IsNull())
|
||||
{
|
||||
BRep_Builder().Add(aWire, aSeamEdge);
|
||||
BRep_Builder().Add(aWire, aSeamEdge.Reversed());
|
||||
}
|
||||
TopoDS_Face aCylFace = BRepBuilderAPI_MakeFace(theCylinder, aWire);
|
||||
|
||||
// Check orientation of an initial face, so that possibly to reverse the new face.
|
||||
// The new cylindrical surface always has normal directed outside of cylinder.
|
||||
// If an initial face has normal (taking face orientation into account) directed
|
||||
// inside then we must reverse the new face.
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aBoundary.First());
|
||||
const TopoDS_Face& aF = TopoDS::Face(aMapEF.FindFromKey(aE).First());
|
||||
BRepAdaptor_Surface aSurf(aF, Standard_False);
|
||||
Standard_Real aParF, aParL;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(aE, aF, aParF, aParL);
|
||||
Standard_ASSERT_RAISE(!aPCurve.IsNull(), "createCylFaceFromArea");
|
||||
gp_Pnt2d aP2d = aPCurve->Value(aParF);
|
||||
gp_Pnt aP;
|
||||
gp_Vec aDU, aDV;
|
||||
aSurf.D1(aP2d.X(), aP2d.Y(), aP, aDU, aDV);
|
||||
gp_XYZ aN = aDU.XYZ() ^ aDV.XYZ();
|
||||
if (aF.Orientation() == TopAbs_REVERSED)
|
||||
aN.Reverse();
|
||||
gp_XYZ aVecFromAxis = aP.XYZ() - theCylinder.Location().XYZ();
|
||||
if (aVecFromAxis * aN < 0.)
|
||||
{
|
||||
// need reverse
|
||||
aCylFace.Reverse();
|
||||
}
|
||||
return aCylFace;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : updateVertexOnCirc
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean updateVertexOnCirc(const TopoDS_Vertex& theV,
|
||||
const gp_Circ& theCirc,
|
||||
Standard_Real theMaxDist,
|
||||
Standard_Real& thePar)
|
||||
{
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(theV);
|
||||
gp_Pnt aP = BRep_Tool::Pnt(theV);
|
||||
thePar = ElCLib::Parameter(theCirc, aP);
|
||||
gp_Pnt aProj = ElCLib::Value(thePar, theCirc);
|
||||
Standard_Real aDist = aProj.SquareDistance(aP);
|
||||
Standard_Boolean isOK = Standard_False;
|
||||
if (aDist > aTol*aTol)
|
||||
{
|
||||
if (aDist < theMaxDist*theMaxDist)
|
||||
{
|
||||
BRep_Builder().UpdateVertex(theV, sqrt(aDist)*1.001);
|
||||
isOK = Standard_True;
|
||||
}
|
||||
}
|
||||
return isOK;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createCurveEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static TopoDS_Edge createCurveEdge(const TopTools_ListOfShape& theChain,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
|
||||
const Standard_Real theLinTol)
|
||||
{
|
||||
// Find a cylindrical face common for all edges
|
||||
TopTools_ListOfShape aCylFaces;
|
||||
TopTools_ListIteratorOfListOfShape itL(theChain);
|
||||
for (; itL.More(); itL.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = itL.Value();
|
||||
const TopTools_ListOfShape& aFaces = theMapEF.FindFromKey(aE);
|
||||
// get cyl faces of the current edge
|
||||
TopTools_ListOfShape aCurCylFaces;
|
||||
TopTools_ListIteratorOfListOfShape itF(aFaces);
|
||||
for (; itF.More(); itF.Next())
|
||||
{
|
||||
const TopoDS_Face& aF = TopoDS::Face(itF.Value());
|
||||
BRepAdaptor_Surface aSurf(aF, Standard_False);
|
||||
if (aSurf.GetType() == GeomAbs_Cylinder)
|
||||
aCurCylFaces.Append(aF);
|
||||
}
|
||||
|
||||
if (aCylFaces.IsEmpty())
|
||||
// initialize cyl faces with the first edge
|
||||
aCylFaces.Append(aCurCylFaces);
|
||||
else
|
||||
{
|
||||
// filter cyl faces leaving only common ones
|
||||
TopTools_ListIteratorOfListOfShape itCF(aCylFaces);
|
||||
while (itCF.More())
|
||||
{
|
||||
const TopoDS_Shape& aF = itCF.Value();
|
||||
TopTools_ListIteratorOfListOfShape itCF1(aCurCylFaces);
|
||||
for (; itCF1.More(); itCF1.Next())
|
||||
if (itCF1.Value().IsSame(aF))
|
||||
break;
|
||||
if (!itCF1.More())
|
||||
aCylFaces.Remove(itCF);
|
||||
else
|
||||
itCF.Next();
|
||||
}
|
||||
}
|
||||
if (aCylFaces.IsEmpty())
|
||||
return TopoDS_Edge(); // no common cyl faces
|
||||
}
|
||||
if (aCylFaces.IsEmpty())
|
||||
return TopoDS_Edge();
|
||||
const TopoDS_Face& aCylFace = TopoDS::Face(aCylFaces.First());
|
||||
BRepAdaptor_Surface aCylSurf(aCylFace, Standard_False);
|
||||
gp_Cylinder aCyl = aCylSurf.Cylinder();
|
||||
const gp_Dir& aCylDir = aCyl.Axis().Direction();
|
||||
const gp_Pnt& aCylLoc = aCyl.Location();
|
||||
const Standard_Real aRadius = aCyl.Radius();
|
||||
|
||||
// Check if the chain is closed
|
||||
TopoDS_Vertex aVF, aVL;
|
||||
aVF = TopoDS::Vertex(TopExp::FirstVertex(TopoDS::Edge(theChain.First()), Standard_True));
|
||||
aVL = TopoDS::Vertex(TopExp::LastVertex(TopoDS::Edge(theChain.Last()), Standard_True));
|
||||
Standard_Boolean isClosed = aVF.IsSame(aVL);
|
||||
|
||||
// Check if all points are in plane perpendicular to the cylinder axis;
|
||||
// in such case the curve is a circle
|
||||
TColgp_Array1OfPnt aPnts(1, theChain.Extent()+1);
|
||||
Standard_Real aTol = 0.;
|
||||
Standard_Integer i = 1;
|
||||
for (itL.Init(theChain); itL.More(); itL.Next(), i++)
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(itL.Value());
|
||||
TopoDS_Shape aV = TopExp::FirstVertex(aE, Standard_True);
|
||||
aPnts(i) = BRep_Tool::Pnt(TopoDS::Vertex(aV));
|
||||
aTol = Max(aTol, BRep_Tool::Tolerance(aE));
|
||||
}
|
||||
aPnts(i) = BRep_Tool::Pnt(aVL);
|
||||
gp_XYZ aMidPnt(0, 0, 0);
|
||||
for (i = 1; i <= aPnts.Length(); i++)
|
||||
aMidPnt += aPnts(i).XYZ();
|
||||
aMidPnt /= aPnts.Length();
|
||||
aTol = Min(aTol, theLinTol);
|
||||
for (i = 1; i <= aPnts.Length(); i++)
|
||||
{
|
||||
Standard_Real aDist = fabs((aPnts(i).XYZ() - aMidPnt) * aCylDir.XYZ());
|
||||
if (aDist > aTol)
|
||||
break;
|
||||
}
|
||||
Standard_Boolean isCircle = (i > aPnts.Length());
|
||||
|
||||
// Create new edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
if (isCircle)
|
||||
{
|
||||
// Create circular edge.
|
||||
// Find center by projecting aMidPnt to the cylinder axis
|
||||
gp_XYZ aVecOM = aMidPnt - aCylLoc.XYZ();
|
||||
gp_Pnt aCenter = aCylLoc.Translated(aCylDir.XYZ() * (aVecOM * aCylDir.XYZ()));
|
||||
gp_XYZ aXDir = aPnts(1).XYZ() - aCenter.XYZ();
|
||||
gp_XYZ aCircDir = aCylDir.XYZ();
|
||||
gp_XYZ aTanDir = aPnts(2).XYZ() - aPnts(1).XYZ();
|
||||
if ((aXDir ^ aTanDir)* aCylDir.XYZ() < 0.)
|
||||
aCircDir.Reverse();
|
||||
gp_Circ aCirc(gp_Ax2(aCenter, aCircDir, aXDir), aRadius);
|
||||
Handle(Geom_Circle) aCurve = new Geom_Circle(aCirc);
|
||||
// update vertices tolerance, but not more than on a value aTol,
|
||||
// otherwise skip building a circle, and build bspline.
|
||||
Standard_Real aPar;
|
||||
if (updateVertexOnCirc(aVF, aCirc, aTol, aPar))
|
||||
{
|
||||
if (isClosed)
|
||||
{
|
||||
// full circle
|
||||
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0, M_PI*2.);
|
||||
}
|
||||
else
|
||||
{
|
||||
// an arc
|
||||
if (updateVertexOnCirc(aVL, aCirc, aTol, aPar))
|
||||
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, 0., aPar);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aNewEdge.IsNull())
|
||||
{
|
||||
// not a circle, try building bspline
|
||||
gp_Pnt aPnts1[3];
|
||||
const gp_Pnt* pPnts = &aPnts(1);
|
||||
Standard_Integer np = aPnts.Length();
|
||||
if (np == 2)
|
||||
{
|
||||
gp_XYZ anEdgeDir = aPnts(2).XYZ() - aPnts(1).XYZ();
|
||||
const Standard_Real anEpsAng = 1e-4;
|
||||
if (aCylDir.IsParallel(anEdgeDir, anEpsAng))
|
||||
return aNewEdge;
|
||||
// we have only two points; create additional point in the middle of the segment
|
||||
aPnts1[0] = aPnts(1);
|
||||
aPnts1[2] = aPnts(2);
|
||||
aPnts1[1] = (aPnts1[0].XYZ() + aPnts1[2].XYZ()) * 0.5;
|
||||
pPnts = aPnts1;
|
||||
np = 3;
|
||||
}
|
||||
TColgp_Array1OfPnt aPntA(*pPnts, 1, np);
|
||||
// Create b-spline curve
|
||||
Standard_Integer aDegMin = 3;
|
||||
Standard_Integer aDegMax = 3;
|
||||
GeomAbs_Shape aCont = GeomAbs_C2;
|
||||
GeomAPI_PointsToBSpline aCreator(aPntA, aDegMin, aDegMax, aCont, aTol);
|
||||
if (aCreator.IsDone())
|
||||
{
|
||||
const Handle(Geom_BSplineCurve)& aCurve = aCreator.Curve();
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(aVF);
|
||||
Standard_Real aParF = aCurve->FirstParameter();
|
||||
Standard_Real aParL = aCurve->LastParameter();
|
||||
Standard_Real aDist = aCurve->Value(aParF).SquareDistance(aPntA(1));
|
||||
if (aDist > aTol*aTol)
|
||||
BRep_Builder().UpdateVertex(aVF, sqrt(aDist));
|
||||
if (!isClosed)
|
||||
{
|
||||
aTol = BRep_Tool::Tolerance(aVL);
|
||||
aDist = aCurve->Value(aParL).SquareDistance(aPntA(np));
|
||||
if (aDist > aTol*aTol)
|
||||
BRep_Builder().UpdateVertex(aVL, sqrt(aDist));
|
||||
}
|
||||
aNewEdge = BRepBuilderAPI_MakeEdge(aCurve, aVF, aVL, aParF, aParL);
|
||||
}
|
||||
}
|
||||
return aNewEdge;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : mergeEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void mergeEdges(const TopoDS_Shape& theShape,
|
||||
const Standard_Real theLinTol,
|
||||
const Standard_Real theAngTol,
|
||||
const Handle(BRepTools_ReShape)& theContext)
|
||||
{
|
||||
// Create topological data maps
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMapVE, aMapEF;
|
||||
TopExp::MapShapesAndAncestors(theShape, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
|
||||
TopExp::MapShapesAndAncestors(theShape, TopAbs_EDGE, TopAbs_FACE, aMapEF);
|
||||
|
||||
// The idea is to gather chains of edges in which all intermediate vertices
|
||||
// have only two neighboring edges, and do not have connection to any other edges
|
||||
// from the shape.
|
||||
|
||||
// Prepare set of all edges
|
||||
TopTools_IndexedMapOfShape anEdges;
|
||||
TopExp::MapShapes(theShape, TopAbs_EDGE, anEdges);
|
||||
TColStd_MapOfInteger anEdgesInd; // set of indices of left edges
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= anEdges.Extent(); i++)
|
||||
anEdgesInd.Add(i);
|
||||
|
||||
// Process while there are unprocessed edges
|
||||
while (!anEdgesInd.IsEmpty())
|
||||
{
|
||||
// Get an unprocessed edge
|
||||
Standard_Integer aEInd = TColStd_MapIteratorOfMapOfInteger(anEdgesInd).Value();
|
||||
anEdgesInd.Remove(aEInd);
|
||||
TopoDS_Edge aFirstEdge = TopoDS::Edge(anEdges(aEInd));
|
||||
BRepAdaptor_Curve aCurve(aFirstEdge);
|
||||
if (aCurve.GetType() != GeomAbs_Line)
|
||||
continue; // only linear edges are to be merged
|
||||
|
||||
// Start a new chain
|
||||
TopTools_ListOfShape aChain;
|
||||
aChain.Append(aFirstEdge.Oriented(TopAbs_FORWARD));
|
||||
makeEdgesChain(aChain, aMapVE, theAngTol);
|
||||
|
||||
// Remove it from the left edges
|
||||
TopTools_ListIteratorOfListOfShape itL(aChain);
|
||||
for (; itL.More(); itL.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = itL.Value();
|
||||
Standard_Integer aEI = anEdges.FindIndex(aE);
|
||||
anEdgesInd.Remove(aEI);
|
||||
}
|
||||
|
||||
if (aChain.Extent() > 0)
|
||||
{
|
||||
// Create a new curvilinear edge from the polyline
|
||||
TopoDS_Edge aNewEdge = createCurveEdge(aChain, aMapEF, theLinTol);
|
||||
if (!aNewEdge.IsNull())
|
||||
{
|
||||
aNewEdge.Orientation(aFirstEdge.Orientation());
|
||||
// Replace edges from the chain with the new edge.
|
||||
Standard_Integer nbMerged = 0;
|
||||
for (itL.Init(aChain); itL.More(); itL.Next(), nbMerged++)
|
||||
{
|
||||
const TopoDS_Shape& aE = itL.Value();
|
||||
if (nbMerged == 0)
|
||||
theContext->Replace(aE, aNewEdge);
|
||||
else
|
||||
theContext->Remove(aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void ShapeUpgrade_CombineToCylinder::Build()
|
||||
{
|
||||
myDone = Standard_False;
|
||||
myNbNewFaces = myNbReplacedFaces = 0;
|
||||
myShape.Nullify();
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
|
||||
TopExp::MapShapesAndAncestors(myInitShape, TopAbs_EDGE, TopAbs_FACE, aMapEF);
|
||||
|
||||
// Sort edges in the shape on two groups - stop edges and smooth edges that are
|
||||
// to be located on a cylinder wall parallel to its axis.
|
||||
TopTools_MapOfShape aStopEdges;
|
||||
NCollection_DataMap<TopoDS_Shape, gp_Cylinder> aMapECyl;
|
||||
sortEdges(myInitShape, aMapEF, myLinTol, myAngTol, aStopEdges, aMapECyl);
|
||||
|
||||
#ifdef DEBUG_CombineToCylinder_StopEdges
|
||||
TopoDS_Compound aCompE;
|
||||
BRep_Builder().MakeCompound(aCompE);
|
||||
TopTools_MapIteratorOfMapOfShape aMapIt(aStopEdges);
|
||||
for (; aMapIt.More(); aMapIt.Next())
|
||||
BRep_Builder().Add(aCompE, aMapIt.Value());
|
||||
BRepTools::Write(aCompE, "stope.brep");
|
||||
#endif
|
||||
|
||||
// Collect faces forming same-cylinder areas
|
||||
NCollection_List<CombineToCylinder::Area> anAreas;
|
||||
collectAreas(myInitShape, aMapEF, aStopEdges, aMapECyl, myLinTol, myAngTol, anAreas);
|
||||
|
||||
#ifdef DEBUG_CombineToCylinder_Areas
|
||||
TopoDS_Compound aComp;
|
||||
BRep_Builder().MakeCompound(aComp);
|
||||
TopTools_ListIteratorOfListOfShape anItA(anAreas);
|
||||
for (; anItA.More(); anItA.Next())
|
||||
BRep_Builder().Add(aComp, anItA.Value());
|
||||
BRepTools::Write(aComp, "areas.brep");
|
||||
#endif
|
||||
|
||||
// Process each area
|
||||
NCollection_List<CombineToCylinder::Area>::Iterator anItAreas(anAreas);
|
||||
for (; anItAreas.More(); anItAreas.Next())
|
||||
{
|
||||
const CombineToCylinder::Area& anArea = anItAreas.Value();
|
||||
if (!anArea.pCylinder)
|
||||
continue;
|
||||
|
||||
TopoDS_Shape aCylFace = createCylFaceFromArea(anArea.Faces, *anArea.pCylinder);
|
||||
|
||||
// Replace faces from the list with the new face.
|
||||
TopExp_Explorer anEx(anArea.Faces, TopAbs_FACE);
|
||||
Standard_Integer nbMerged = 0;
|
||||
for (; anEx.More(); anEx.Next(), nbMerged++)
|
||||
{
|
||||
const TopoDS_Shape& aFace = anEx.Current();
|
||||
if (nbMerged == 0)
|
||||
myContext->Replace(aFace, aCylFace);
|
||||
else
|
||||
myContext->Remove(aFace);
|
||||
}
|
||||
myNbNewFaces++;
|
||||
myNbReplacedFaces += nbMerged;
|
||||
}
|
||||
|
||||
// Build intermediate result shape using replacement context.
|
||||
// This shape will contain chains of linear edges along cylinders
|
||||
// instead of circles or whatever curves.
|
||||
// The next step is to merge them.
|
||||
TopoDS_Shape aTempShape = myContext->Apply(myInitShape);
|
||||
mergeEdges(aTempShape, myLinTol, myAngTol, myContext);
|
||||
|
||||
// Rebuild the result shape using replacement context.
|
||||
myShape = myContext->Apply(myInitShape);
|
||||
|
||||
// build pcurves
|
||||
ShapeFix_Shape aFix(myShape);
|
||||
aFix.Perform();
|
||||
myShape = aFix.Shape();
|
||||
myDone = Standard_True;
|
||||
}
|
93
src/ShapeUpgrade/ShapeUpgrade_CombineToCylinder.hxx
Normal file
93
src/ShapeUpgrade/ShapeUpgrade_CombineToCylinder.hxx
Normal file
@@ -0,0 +1,93 @@
|
||||
//-Copyright: Open CASCADE 2016
|
||||
// Created on: 2016-08-01
|
||||
// Created by: Mikhail Sazonov
|
||||
// Copyright (c) 2016 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 _ShapeUpgrade_CombineToCylinder_HeaderFile
|
||||
#define _ShapeUpgrade_CombineToCylinder_HeaderFile
|
||||
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
class BRepTools_ReShape;
|
||||
|
||||
//! This tool tries to merge planar faces constituting a cylindrical surface into one face.
|
||||
//! The algorithm checks that all merged faces have smooth change of normal within the given
|
||||
//! angular tolerance.
|
||||
class ShapeUpgrade_CombineToCylinder
|
||||
{
|
||||
public:
|
||||
|
||||
//! empty constructor
|
||||
Standard_EXPORT ShapeUpgrade_CombineToCylinder();
|
||||
|
||||
//! Sets input shape
|
||||
void SetShape(const TopoDS_Shape& theShape)
|
||||
{
|
||||
myInitShape = theShape;
|
||||
}
|
||||
|
||||
//! Sets the linear tolerance. Default value is Precision::Confusion().
|
||||
void SetLinearTolerance(const Standard_Real theValue)
|
||||
{
|
||||
myLinTol = theValue;
|
||||
}
|
||||
|
||||
//! Sets the angular tolerance. Default value is Precision::Angular().
|
||||
void SetAngularTolerance(const Standard_Real theValue)
|
||||
{
|
||||
myAngTol = theValue;
|
||||
}
|
||||
|
||||
//! Builds the resulting shape
|
||||
Standard_EXPORT void Build();
|
||||
|
||||
//! Returns true if the result shape was successfully built.
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
|
||||
//! Returns the result shape.
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
//! Returns the number of new faces built by merging
|
||||
Standard_Integer NbNewFaces() const
|
||||
{
|
||||
return myNbNewFaces;
|
||||
}
|
||||
|
||||
//! Returns the number of replaced faces
|
||||
Standard_Integer NbReplacedFaces() const
|
||||
{
|
||||
return myNbReplacedFaces;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
TopoDS_Shape myInitShape;
|
||||
Standard_Real myLinTol;
|
||||
Standard_Real myAngTol;
|
||||
TopoDS_Shape myShape;
|
||||
Handle(BRepTools_ReShape) myContext;
|
||||
Standard_Integer myNbNewFaces;
|
||||
Standard_Integer myNbReplacedFaces;
|
||||
Standard_Boolean myDone;
|
||||
|
||||
};
|
||||
|
||||
#endif // _ShapeUpgrade_CombineToCylinder_HeaderFile
|
@@ -271,14 +271,15 @@ namespace
|
||||
}
|
||||
|
||||
//! Prepare shaded presentation for specified shape
|
||||
static Standard_Boolean shadeFromShape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const bool theIsClosed)
|
||||
static Standard_Boolean shadeFromShape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const bool theIsClosed)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (theShape, theHasTexels, theUVOrigin, theUVRepeat, theUVScale);
|
||||
if (aPArray.IsNull())
|
||||
@@ -289,6 +290,9 @@ namespace
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
|
||||
aGroup->SetClosed (theIsClosed);
|
||||
aGroup->SetGroupPrimitivesAspect (theDrawer->ShadingAspect()->Aspect());
|
||||
if (!theCappingStyle.IsNull())
|
||||
aGroup->SetGroupPrimitivesAspect (theCappingStyle);
|
||||
|
||||
aGroup->AddPrimitiveArray (aPArray);
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -491,28 +495,30 @@ void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape,
|
||||
// function : Add
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const StdPrs_Volume theVolume)
|
||||
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle,
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
gp_Pnt2d aDummy;
|
||||
StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer,
|
||||
Standard_False, aDummy, aDummy, aDummy, theVolume);
|
||||
Standard_False, aDummy, aDummy, aDummy, theCappingStyle, theVolume);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Add
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle (Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const StdPrs_Volume theVolume)
|
||||
void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle (Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle,
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
@@ -550,21 +556,21 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
TopoDS_Iterator aShapeIter (aClosed);
|
||||
if (aShapeIter.More())
|
||||
{
|
||||
shadeFromShape (aClosed, thePrs, theDrawer,
|
||||
shadeFromShape (aClosed, thePrs, theDrawer, theCappingStyle,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true);
|
||||
}
|
||||
|
||||
aShapeIter.Initialize (anOpened);
|
||||
if (aShapeIter.More())
|
||||
{
|
||||
shadeFromShape (anOpened, thePrs, theDrawer,
|
||||
shadeFromShape (anOpened, thePrs, theDrawer, theCappingStyle,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the shape type is not compound, composolid or solid, use autodetection back-facing filled
|
||||
shadeFromShape (theShape, thePrs, theDrawer,
|
||||
shadeFromShape (theShape, thePrs, theDrawer, theCappingStyle,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale,
|
||||
theVolume == StdPrs_Volume_Closed);
|
||||
}
|
||||
|
@@ -43,13 +43,25 @@ public:
|
||||
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
|
||||
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
|
||||
//! or to perform Autodetection (would split input shape into two groups)
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle = Handle(Graphic3d_AspectFillCapping)(),
|
||||
StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
|
||||
//! Shades <theShape> with texture coordinates.
|
||||
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
|
||||
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
|
||||
//! or to perform Autodetection (would split input shape into two groups)
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theHasTexels, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle = Handle(Graphic3d_AspectFillCapping)(),
|
||||
const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
|
||||
|
||||
//! Searches closed and unclosed subshapes in shape structure and puts them
|
||||
//! into two compounds for separate processing of closed and unclosed sub-shapes
|
||||
|
@@ -745,6 +745,10 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
|
||||
#include <StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.hxx>
|
||||
#include <StepVisual_AnnotationFillArea.hxx>
|
||||
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClipping.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
|
||||
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx>
|
||||
|
||||
static int init = 0;
|
||||
static Interface_DataMapOfTransientInteger types(800);
|
||||
@@ -1448,6 +1452,10 @@ StepAP214_Protocol::StepAP214_Protocol ()
|
||||
types.Bind (STANDARD_TYPE(StepRepr_ConstructiveGeometryRepresentationRelationship), 713);
|
||||
types.Bind (STANDARD_TYPE(StepRepr_CharacterizedRepresentation), 714);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation), 715);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClipping), 716);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection), 717);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion), 718);
|
||||
types.Bind (STANDARD_TYPE(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem), 719);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
StepVisual_AnnotationCurveOccurrence.cxx
|
||||
StepVisual_AnnotationCurveOccurrence.hxx
|
||||
StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.cxx
|
||||
StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem.hxx
|
||||
StepVisual_AnnotationFillArea.cxx
|
||||
StepVisual_AnnotationFillArea.hxx
|
||||
StepVisual_AnnotationFillAreaOccurrence.cxx
|
||||
@@ -20,6 +22,8 @@ StepVisual_AreaOrView.cxx
|
||||
StepVisual_AreaOrView.hxx
|
||||
StepVisual_Array1OfAnnotationPlaneElement.hxx
|
||||
StepVisual_Array1OfBoxCharacteristicSelect.hxx
|
||||
StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx
|
||||
StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx
|
||||
StepVisual_Array1OfCurveStyleFontPattern.hxx
|
||||
StepVisual_Array1OfDirectionCountSelect.hxx
|
||||
StepVisual_Array1OfDraughtingCalloutElement.hxx
|
||||
@@ -47,6 +51,16 @@ StepVisual_CameraModelD2.cxx
|
||||
StepVisual_CameraModelD2.hxx
|
||||
StepVisual_CameraModelD3.cxx
|
||||
StepVisual_CameraModelD3.hxx
|
||||
StepVisual_CameraModelD3MultiClipping.cxx
|
||||
StepVisual_CameraModelD3MultiClipping.hxx
|
||||
StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx
|
||||
StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx
|
||||
StepVisual_CameraModelD3MultiClippingIntersection.cxx
|
||||
StepVisual_CameraModelD3MultiClippingIntersection.hxx
|
||||
StepVisual_CameraModelD3MultiClippingUnion.cxx
|
||||
StepVisual_CameraModelD3MultiClippingUnion.hxx
|
||||
StepVisual_CameraModelD3MultiClippingUnionSelect.cxx
|
||||
StepVisual_CameraModelD3MultiClippingUnionSelect.hxx
|
||||
StepVisual_CameraUsage.cxx
|
||||
StepVisual_CameraUsage.hxx
|
||||
StepVisual_CentralOrParallel.hxx
|
||||
@@ -102,6 +116,8 @@ StepVisual_FontSelect.cxx
|
||||
StepVisual_FontSelect.hxx
|
||||
StepVisual_HArray1OfAnnotationPlaneElement.hxx
|
||||
StepVisual_HArray1OfBoxCharacteristicSelect.hxx
|
||||
StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx
|
||||
StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx
|
||||
StepVisual_HArray1OfCurveStyleFontPattern.hxx
|
||||
StepVisual_HArray1OfDirectionCountSelect.hxx
|
||||
StepVisual_HArray1OfDraughtingCalloutElement.hxx
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user