mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9e4269d8e6 | ||
|
5f55b8e615 | ||
|
057d4b15e3 |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -878,18 +878,7 @@ The test grid name is constructed depending on the type of the tested chamfers.
|
||||
| dist_angle_complex | | Distance from edge and given angle |
|
||||
| dist_angle_sequence | | Distance from edge and given angle |
|
||||
|
||||
@subsubsection testmanual_5_1_7 de
|
||||
|
||||
This group tests reading and writing of CAD data files (iges, step) to and from OCCT.
|
||||
|
||||
Test cases check transfer status, shape and attributes against expected reference values.
|
||||
|
||||
| Grid | Commands | Functionality |
|
||||
| :---- | :----- | :------- |
|
||||
| iges_1, iges_2, iges_3 | igesbrep, brepiges, ReadIges, WriteIges | IGES tests |
|
||||
| step_1, step_2, step_3, step_4, step_5 | stepread, stepwrite, ReadStep, WriteStep | STEP tests |
|
||||
|
||||
@subsubsection testmanual_5_1_8 demo
|
||||
@subsubsection testmanual_5_1_7 demo
|
||||
|
||||
This group allows demonstrating how testing cases are created, and testing DRAW commands and the test system as a whole.
|
||||
|
||||
@@ -900,7 +889,7 @@ This group allows demonstrating how testing cases are created, and testing DRAW
|
||||
| samples | | OCCT samples |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_9 draft
|
||||
@subsubsection testmanual_5_1_8 draft
|
||||
|
||||
This group allows testing draft operations.
|
||||
|
||||
@@ -911,7 +900,7 @@ DRAW module: MODELING.
|
||||
| Angle | depouille | Drafts with angle (inclined walls) |
|
||||
|
||||
|
||||
@subsubsection testmanual_5_1_10 feat
|
||||
@subsubsection testmanual_5_1_9 feat
|
||||
|
||||
This group allows testing creation of features on a shape.
|
||||
|
||||
@@ -925,7 +914,7 @@ DRAW module: MODELING (package *BRepTest*).
|
||||
| featrevol | | |
|
||||
| featrf | | |
|
||||
|
||||
@subsubsection testmanual_5_1_11 heal
|
||||
@subsubsection testmanual_5_1_10 heal
|
||||
|
||||
This group allows testing the functionality provided by *ShapeHealing* toolkit.
|
||||
|
||||
@@ -954,7 +943,7 @@ DRAW module: XSDRAW
|
||||
| surface_to_revolution_standard | DT_ShapeConvertRev | Convert elementary surfaces to revolutions, simple cases |
|
||||
| update_tolerance_locked | updatetolerance | Update the tolerance of shape so that it satisfy the rule: toler(face)<=toler(edge)<=toler(vertex) |
|
||||
|
||||
@subsubsection testmanual_5_1_12 mesh
|
||||
@subsubsection testmanual_5_1_11 mesh
|
||||
|
||||
This group allows testing shape tessellation (*BRepMesh*) and shading.
|
||||
|
||||
@@ -971,7 +960,7 @@ DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*
|
||||
| advanced_incmesh_parallel | incmesh | Meshing of complex shapes, parallel mode |
|
||||
| standard_incmesh_parallel | incmesh | Meshing of simple shapes, parallel mode |
|
||||
|
||||
@subsubsection testmanual_5_1_13 mkface
|
||||
@subsubsection testmanual_5_1_12 mkface
|
||||
|
||||
This group allows testing creation of simple surfaces.
|
||||
|
||||
@@ -986,7 +975,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| after_revsurf_and_offset | mkface | |
|
||||
| mkplane | mkplane | |
|
||||
|
||||
@subsubsection testmanual_5_1_14 nproject
|
||||
@subsubsection testmanual_5_1_13 nproject
|
||||
|
||||
This group allows testing normal projection of edges and wires onto a face.
|
||||
|
||||
@@ -996,7 +985,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Base | nproject | |
|
||||
|
||||
@subsubsection testmanual_5_1_15 offset
|
||||
@subsubsection testmanual_5_1_14 offset
|
||||
|
||||
This group allows testing offset functionality for curves and surfaces.
|
||||
|
||||
@@ -1012,7 +1001,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| shape | offsetshape | |
|
||||
| wire_closed_outside_0_005, wire_closed_outside_0_025, wire_closed_outside_0_075, wire_closed_inside_0_005, wire_closed_inside_0_025, wire_closed_inside_0_075, wire_unclosed_outside_0_005, wire_unclosed_outside_0_025, wire_unclosed_outside_0_075 | mkoffset | 2d offset of closed and unclosed planar wires with different offset step and directions of offset ( inside / outside ) |
|
||||
|
||||
@subsubsection testmanual_5_1_16 pipe
|
||||
@subsubsection testmanual_5_1_15 pipe
|
||||
|
||||
This group allows testing construction of pipes (sweeping of a contour along profile).
|
||||
|
||||
@@ -1022,7 +1011,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| Standard | pipe | |
|
||||
|
||||
@subsubsection testmanual_5_1_17 prism
|
||||
@subsubsection testmanual_5_1_16 prism
|
||||
|
||||
This group allows testing construction of prisms.
|
||||
|
||||
@@ -1032,7 +1021,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| :---- | :----- | :------- |
|
||||
| seminf | prism | |
|
||||
|
||||
@subsubsection testmanual_5_1_18 sewing
|
||||
@subsubsection testmanual_5_1_17 sewing
|
||||
|
||||
This group allows testing sewing of faces by connecting edges.
|
||||
|
||||
@@ -1044,7 +1033,7 @@ DRAW module: MODELING (package *BRepTest*)
|
||||
| tol_1 | sewing | Sewing faces with tolerance 1 |
|
||||
| tol_100 | sewing | Sewing faces with tolerance 100 |
|
||||
|
||||
@subsubsection testmanual_5_1_19 thrusection
|
||||
@subsubsection testmanual_5_1_18 thrusection
|
||||
|
||||
This group allows testing construction of shell or a solid passing through a set of sections in a given sequence (loft).
|
||||
|
||||
@@ -1053,7 +1042,7 @@ This group allows testing construction of shell or a solid passing through a set
|
||||
| solids | thrusection | Lofting with resulting solid |
|
||||
| not_solids | thrusection | Lofting with resulting shell or face |
|
||||
|
||||
@subsubsection testmanual_5_1_20 xcaf
|
||||
@subsubsection testmanual_5_1_19 xcaf
|
||||
|
||||
This group allows testing extended data exchange packages.
|
||||
|
||||
|
@@ -633,9 +633,6 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
{
|
||||
aShadedGroup = thePrs->NewGroup();
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
if (isClosed
|
||||
&& !myCappingStyle.IsNull())
|
||||
aShadedGroup->SetGroupPrimitivesAspect (myCappingStyle);
|
||||
}
|
||||
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
|
||||
aShadedGroup->AddPrimitiveArray (aTriangles);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
@@ -84,37 +83,6 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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);
|
||||
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 : HasPresentation
|
||||
//purpose :
|
||||
|
@@ -104,12 +104,6 @@ public:
|
||||
void ClearOwner() { myOwner.Nullify(); }
|
||||
|
||||
public:
|
||||
//! 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; }
|
||||
|
||||
|
||||
//! Returns the context pointer to the interactive context.
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
@@ -134,7 +128,6 @@ protected:
|
||||
|
||||
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
|
||||
Handle(Standard_Transient) myOwner; //!< application-specific owner object
|
||||
Handle(Graphic3d_AspectFillCapping) myCappingStyle;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -180,7 +180,10 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myCappingStyle);
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
|
||||
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
|
||||
myUVOrigin, myUVRepeat, myUVScale);
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
|
@@ -20,7 +20,9 @@
|
||||
#include <BRepMesh_FaceDiscret.hxx>
|
||||
#include <BRepMesh_ModelPreProcessor.hxx>
|
||||
#include <BRepMesh_ModelPostProcessor.hxx>
|
||||
|
||||
#include <BRepMesh_MeshAlgoFactory.hxx>
|
||||
#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
@@ -28,11 +30,33 @@
|
||||
//=======================================================================
|
||||
BRepMesh_Context::BRepMesh_Context ()
|
||||
{
|
||||
enum MeshAlgo
|
||||
{
|
||||
MeshAlgo_Default = 0x0,
|
||||
MeshAlgo_Delabella = 0x1
|
||||
};
|
||||
|
||||
char* anAlgoVar;
|
||||
anAlgoVar = getenv ("CSF_MeshAlgo");
|
||||
const Standard_Integer anAlgoId = (anAlgoVar ? atoi (anAlgoVar) : MeshAlgo_Default);
|
||||
|
||||
Handle (IMeshTools_MeshAlgoFactory) aAlgoFactory;
|
||||
switch (anAlgoId)
|
||||
{
|
||||
case MeshAlgo_Delabella:
|
||||
aAlgoFactory = new BRepMesh_DelabellaMeshAlgoFactory;
|
||||
break;
|
||||
|
||||
default:
|
||||
aAlgoFactory = new BRepMesh_MeshAlgoFactory;
|
||||
break;
|
||||
}
|
||||
|
||||
SetModelBuilder (new BRepMesh_ModelBuilder);
|
||||
SetEdgeDiscret (new BRepMesh_EdgeDiscret);
|
||||
SetModelHealer (new BRepMesh_ModelHealer);
|
||||
SetPreProcessor (new BRepMesh_ModelPreProcessor);
|
||||
SetFaceDiscret (new BRepMesh_FaceDiscret(new BRepMesh_MeshAlgoFactory));
|
||||
SetFaceDiscret (new BRepMesh_FaceDiscret (aAlgoFactory));
|
||||
SetPostProcessor(new BRepMesh_ModelPostProcessor);
|
||||
}
|
||||
|
||||
|
@@ -49,12 +49,35 @@ protected:
|
||||
Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
|
||||
{
|
||||
const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
|
||||
const Standard_Integer aNodesNb = aStructure->NbNodes ();
|
||||
|
||||
buildBaseTriangulation ();
|
||||
|
||||
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
|
||||
BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
|
||||
|
||||
const Standard_Integer aNewNodesNb = aStructure->NbNodes ();
|
||||
const Standard_Boolean isRemoveAux = aNewNodesNb > aNodesNb;
|
||||
if (isRemoveAux)
|
||||
{
|
||||
IMeshData::VectorOfInteger aAuxVertices (aNewNodesNb - aNodesNb);
|
||||
for (Standard_Integer aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
|
||||
{
|
||||
aAuxVertices.Append (aExtNodesIt);
|
||||
}
|
||||
|
||||
// Set aux vertices if there are some to clean up mesh correctly.
|
||||
aMesher.SetAuxVertices (aAuxVertices);
|
||||
}
|
||||
|
||||
aMesher.ProcessConstraints ();
|
||||
|
||||
// Destruction of triangles containing aux vertices added (possibly) during base mesh computation.
|
||||
if (isRemoveAux)
|
||||
{
|
||||
aMesher.RemoveAuxElements ();
|
||||
}
|
||||
|
||||
BRepMesh_MeshTool aCleaner (aStructure);
|
||||
aCleaner.EraseFreeLinks ();
|
||||
|
||||
|
155
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx
Normal file
155
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx
Normal file
@@ -0,0 +1,155 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 <BRepMesh_DelabellaBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_MeshTool.hxx>
|
||||
#include <BRepMesh_Delaun.hxx>
|
||||
|
||||
#include "delabella.h"
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaBaseMeshAlgo::BRepMesh_DelabellaBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Destructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaBaseMeshAlgo::~BRepMesh_DelabellaBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : buildBaseTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation()
|
||||
{
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
|
||||
|
||||
Bnd_B2d aBox;
|
||||
const Standard_Integer aNodesNb = aStructure->NbNodes ();
|
||||
std::vector<Standard_Real> aPoints (2 * (aNodesNb + 4));
|
||||
for (Standard_Integer aNodeIt = 0; aNodeIt < aNodesNb; ++aNodeIt)
|
||||
{
|
||||
const BRepMesh_Vertex& aVertex = aStructure->GetNode (aNodeIt + 1);
|
||||
|
||||
const size_t aBaseIdx = 2 * static_cast<size_t> (aNodeIt);
|
||||
aPoints[aBaseIdx + 0] = aVertex.Coord ().X ();
|
||||
aPoints[aBaseIdx + 1] = aVertex.Coord ().Y ();
|
||||
|
||||
aBox.Add (gp_Pnt2d(aVertex.Coord ()));
|
||||
}
|
||||
|
||||
aBox.Enlarge (0.1 * (aBox.CornerMax () - aBox.CornerMin ()).Modulus ());
|
||||
const gp_XY aMin = aBox.CornerMin ();
|
||||
const gp_XY aMax = aBox.CornerMax ();
|
||||
|
||||
aPoints[2 * aNodesNb + 0] = aMin.X ();
|
||||
aPoints[2 * aNodesNb + 1] = aMin.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 0],
|
||||
aPoints[2 * aNodesNb + 1], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 2] = aMax.X ();
|
||||
aPoints[2 * aNodesNb + 3] = aMin.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 2],
|
||||
aPoints[2 * aNodesNb + 3], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 4] = aMax.X ();
|
||||
aPoints[2 * aNodesNb + 5] = aMax.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 4],
|
||||
aPoints[2 * aNodesNb + 5], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 6] = aMin.X ();
|
||||
aPoints[2 * aNodesNb + 7] = aMax.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 6],
|
||||
aPoints[2 * aNodesNb + 7], BRepMesh_Free));
|
||||
|
||||
const Standard_Real aDiffX = (aMax.X () - aMin.X ());
|
||||
const Standard_Real aDiffY = (aMax.Y () - aMin.Y ());
|
||||
for (size_t i = 0; i < aPoints.size(); i += 2)
|
||||
{
|
||||
aPoints[i + 0] = (aPoints[i + 0] - aMin.X ()) / aDiffX - 0.5;
|
||||
aPoints[i + 1] = (aPoints[i + 1] - aMin.Y ()) / aDiffY - 0.5;
|
||||
}
|
||||
|
||||
IDelaBella* aTriangulator = IDelaBella::Create();
|
||||
try
|
||||
{
|
||||
if (aTriangulator != NULL)
|
||||
{
|
||||
const int aVerticesNb = aTriangulator->Triangulate (
|
||||
static_cast<int>(aPoints.size () / 2),
|
||||
&aPoints[0], &aPoints[1], 2 * sizeof (Standard_Real));
|
||||
|
||||
if (aVerticesNb > 0)
|
||||
{
|
||||
const DelaBella_Triangle* aTrianglePtr = aTriangulator->GetFirstDelaunayTriangle();
|
||||
while (aTrianglePtr != NULL)
|
||||
{
|
||||
Standard_Integer aNodes[3] = {
|
||||
aTrianglePtr->v[0]->i + 1,
|
||||
aTrianglePtr->v[2]->i + 1,
|
||||
aTrianglePtr->v[1]->i + 1
|
||||
};
|
||||
|
||||
Standard_Integer aEdges [3];
|
||||
Standard_Boolean aOrientations[3];
|
||||
for (Standard_Integer k = 0; k < 3; ++k)
|
||||
{
|
||||
const BRepMesh_Edge aLink (aNodes[k], aNodes[(k + 1) % 3], BRepMesh_Free);
|
||||
|
||||
const Standard_Integer aLinkInfo = aStructure->AddLink (aLink);
|
||||
aEdges [k] = Abs (aLinkInfo);
|
||||
aOrientations[k] = aLinkInfo > 0;
|
||||
}
|
||||
|
||||
const BRepMesh_Triangle aTriangle (aEdges, aOrientations, BRepMesh_Free);
|
||||
aStructure->AddElement (aTriangle);
|
||||
|
||||
aTrianglePtr = aTrianglePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
aTriangulator->Destroy ();
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure const& theException)
|
||||
{
|
||||
if (aTriangulator != NULL)
|
||||
{
|
||||
aTriangulator->Destroy ();
|
||||
}
|
||||
|
||||
throw Standard_Failure (theException);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (aTriangulator != NULL)
|
||||
{
|
||||
aTriangulator->Destroy ();
|
||||
}
|
||||
|
||||
throw Standard_Failure ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: exception in triangulation algorithm");
|
||||
}
|
||||
}
|
46
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx
Normal file
46
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
|
||||
|
||||
#include <BRepMesh_CustomBaseMeshAlgo.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using Delabella project.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_DelabellaBaseMeshAlgo : public BRepMesh_CustomBaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_DelabellaBaseMeshAlgo ();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelabellaBaseMeshAlgo ();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Builds base triangulation using Delabella project.
|
||||
Standard_EXPORT virtual void buildBaseTriangulation() Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
143
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx
Normal file
143
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx
Normal file
@@ -0,0 +1,143 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 <BRepMesh_DelabellaMeshAlgoFactory.hxx>
|
||||
#include <BRepMesh_DefaultRangeSplitter.hxx>
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
#include <BRepMesh_SphereRangeSplitter.hxx>
|
||||
#include <BRepMesh_CylinderRangeSplitter.hxx>
|
||||
#include <BRepMesh_ConeRangeSplitter.hxx>
|
||||
#include <BRepMesh_TorusRangeSplitter.hxx>
|
||||
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_CustomDelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
|
||||
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DefaultBaseMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayBaseMeshAlgo Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct DefaultNodeInsertionMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
|
||||
};
|
||||
|
||||
struct BaseMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelabellaBaseMeshAlgo Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct NodeInsertionMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct DeflectionControlMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaMeshAlgoFactory::BRepMesh_DelabellaMeshAlgoFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Destructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaMeshAlgoFactory::~BRepMesh_DelabellaMeshAlgoFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: GetAlgo
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Handle(IMeshTools_MeshAlgo) BRepMesh_DelabellaMeshAlgoFactory::GetAlgo(
|
||||
const GeomAbs_SurfaceType theSurfaceType,
|
||||
const IMeshTools_Parameters& theParameters) const
|
||||
{
|
||||
switch (theSurfaceType)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new DefaultNodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new DefaultBaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfRevolution:
|
||||
{
|
||||
DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type* aMeshAlgo =
|
||||
new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type* aMeshAlgo =
|
||||
new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
}
|
||||
}
|
44
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx
Normal file
44
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx
Normal file
@@ -0,0 +1,44 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// 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 _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
|
||||
#define _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <IMeshTools_MeshAlgoFactory.hxx>
|
||||
|
||||
//! Implementation of IMeshTools_MeshAlgoFactory providing Delabella-based
|
||||
//! algorithms of different compexity depending on type of target surface.
|
||||
class BRepMesh_DelabellaMeshAlgoFactory : public IMeshTools_MeshAlgoFactory
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_DelabellaMeshAlgoFactory ();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelabellaMeshAlgoFactory ();
|
||||
|
||||
//! Creates instance of meshing algorithm for the given type of surface.
|
||||
Standard_EXPORT virtual Handle(IMeshTools_MeshAlgo) GetAlgo(
|
||||
const GeomAbs_SurfaceType theSurfaceType,
|
||||
const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
};
|
||||
|
||||
#endif
|
@@ -89,7 +89,8 @@ BRepMesh_Delaun::BRepMesh_Delaun (
|
||||
const Standard_Boolean isFillCircles)
|
||||
: myMeshData ( theOldMesh ),
|
||||
myCircles (new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3)
|
||||
{
|
||||
if (isFillCircles)
|
||||
{
|
||||
@@ -103,7 +104,8 @@ BRepMesh_Delaun::BRepMesh_Delaun (
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myCircles (theVertices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3)
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
@@ -123,7 +125,8 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3)
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
@@ -140,7 +143,8 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
IMeshData::VectorOfInteger& theVertexIndices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3)
|
||||
{
|
||||
perform(theVertexIndices);
|
||||
}
|
||||
@@ -155,7 +159,8 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
|
||||
const Standard_Integer theCellsCountV)
|
||||
: myMeshData (theOldMesh),
|
||||
myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3)
|
||||
{
|
||||
perform (theVertexIndices, theCellsCountU, theCellsCountV);
|
||||
}
|
||||
@@ -284,14 +289,14 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
|
||||
Standard_Real aDelta = aDeltaX + aDeltaY;
|
||||
|
||||
mySupVert[0] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) ) );
|
||||
|
||||
mySupVert[1] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
|
||||
|
||||
mySupVert[2] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
|
||||
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
@@ -300,7 +305,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
Standard_Integer aFirstNode = aNodeId;
|
||||
Standard_Integer aLastNode = (aNodeId + 1) % 3;
|
||||
Standard_Integer aLinkIndex = myMeshData->AddLink( BRepMesh_Edge(
|
||||
mySupVert[aFirstNode], mySupVert[aLastNode], BRepMesh_Free ) );
|
||||
mySupVert (aFirstNode), mySupVert (aLastNode), BRepMesh_Free ) );
|
||||
|
||||
e[aNodeId] = Abs(aLinkIndex);
|
||||
o[aNodeId] = (aLinkIndex > 0);
|
||||
@@ -367,28 +372,41 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
createTrianglesOnNewVertices( theVertexIndexes );
|
||||
}
|
||||
|
||||
RemoveAuxElements ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveAuxElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::RemoveAuxElements ()
|
||||
{
|
||||
Handle (NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator (
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges (10, aAllocator);
|
||||
|
||||
// Destruction of triangles containing a top of the super triangle
|
||||
BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
|
||||
aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
|
||||
|
||||
aLoopEdges.Clear();
|
||||
IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
|
||||
for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
|
||||
deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
|
||||
BRepMesh_SelectorOfDataStructureOfDelaun aSelector (myMeshData);
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size(); ++aSupVertId)
|
||||
aSelector.NeighboursOfNode (mySupVert (aSupVertId));
|
||||
|
||||
IMeshData::IteratorOfMapOfInteger aFreeTriangles (aSelector.Elements ());
|
||||
for (; aFreeTriangles.More (); aFreeTriangles.Next ())
|
||||
deleteTriangle (aFreeTriangles.Key (), aLoopEdges);
|
||||
|
||||
// All edges that remain free are removed from aLoopEdges;
|
||||
// only the boundary edges of the triangulation remain there
|
||||
IMeshData::MapOfIntegerInteger::Iterator aFreeEdges( aLoopEdges );
|
||||
for ( ; aFreeEdges.More(); aFreeEdges.Next() )
|
||||
IMeshData::MapOfIntegerInteger::Iterator aFreeEdges (aLoopEdges);
|
||||
for (; aFreeEdges.More (); aFreeEdges.Next ())
|
||||
{
|
||||
if ( myMeshData->ElementsConnectedTo( aFreeEdges.Key() ).IsEmpty() )
|
||||
myMeshData->RemoveLink( aFreeEdges.Key() );
|
||||
if (myMeshData->ElementsConnectedTo (aFreeEdges.Key ()).IsEmpty ())
|
||||
myMeshData->RemoveLink (aFreeEdges.Key ());
|
||||
}
|
||||
|
||||
// The tops of the super triangle are destroyed
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
|
||||
myMeshData->RemoveNode( mySupVert[aSupVertId] );
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size (); ++aSupVertId)
|
||||
myMeshData->RemoveNode (mySupVert (aSupVertId));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -771,9 +789,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
myMeshData->ElementNodes (aCurTriangle, v);
|
||||
for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
|
||||
{
|
||||
if (v[aNodeIdx] == mySupVert[0] ||
|
||||
v[aNodeIdx] == mySupVert[1] ||
|
||||
v[aNodeIdx] == mySupVert[2])
|
||||
if (isSupVertex (v[aNodeIdx]))
|
||||
{
|
||||
isCanNotBeRemoved = Standard_False;
|
||||
}
|
||||
|
@@ -147,6 +147,17 @@ public:
|
||||
const Standard_Real theSqTolerance,
|
||||
Standard_Integer& theEdgeOn) const;
|
||||
|
||||
//! Explicitly sets ids of auxiliary vertices used to build mesh and used by 3rd-party algorithms.
|
||||
inline void SetAuxVertices (const IMeshData::VectorOfInteger& theSupVert)
|
||||
{
|
||||
mySupVert = theSupVert;
|
||||
}
|
||||
|
||||
//! Destruction of auxiliary triangles containing the given vertices.
|
||||
//! Removes auxiliary vertices also.
|
||||
//! @param theAuxVertices auxiliary vertices to be cleaned up.
|
||||
Standard_EXPORT void RemoveAuxElements ();
|
||||
|
||||
private:
|
||||
|
||||
enum ReplaceFlag
|
||||
@@ -354,11 +365,25 @@ private:
|
||||
//! Performs insertion of internal edges into mesh.
|
||||
void insertInternalEdges();
|
||||
|
||||
//! Checks whether the given vertex id relates to super contour.
|
||||
inline Standard_Boolean isSupVertex (const Standard_Integer theVertexIdx)
|
||||
{
|
||||
for (IMeshData::VectorOfInteger::Iterator aIt (mySupVert); aIt.More (); aIt.Next ())
|
||||
{
|
||||
if (theVertexIdx == aIt.Value ())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Handle(BRepMesh_DataStructureOfDelaun) myMeshData;
|
||||
BRepMesh_CircleTool myCircles;
|
||||
Standard_Integer mySupVert[3];
|
||||
IMeshData::VectorOfInteger mySupVert;
|
||||
BRepMesh_Triangle mySupTrian;
|
||||
|
||||
};
|
||||
|
22
src/BRepMesh/DELABELLA_LICENSE
Normal file
22
src/BRepMesh/DELABELLA_LICENSE
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
DELABELLA - Delaunay triangulation library
|
||||
Copyright (C) 2018 GUMIX - Marcin Sokalski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@@ -86,3 +86,9 @@ BRepMesh_VertexTool.cxx
|
||||
BRepMesh_VertexTool.hxx
|
||||
BRepMesh_CustomBaseMeshAlgo.hxx
|
||||
BRepMesh_CustomDelaunayBaseMeshAlgo.hxx
|
||||
delabella.h
|
||||
delabella.cpp
|
||||
BRepMesh_DelabellaBaseMeshAlgo.hxx
|
||||
BRepMesh_DelabellaBaseMeshAlgo.cxx
|
||||
BRepMesh_DelabellaMeshAlgoFactory.hxx
|
||||
BRepMesh_DelabellaMeshAlgoFactory.cxx
|
||||
|
1021
src/BRepMesh/delabella.cpp
Normal file
1021
src/BRepMesh/delabella.cpp
Normal file
File diff suppressed because it is too large
Load Diff
68
src/BRepMesh/delabella.h
Normal file
68
src/BRepMesh/delabella.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
DELABELLA - Delaunay triangulation library
|
||||
Copyright (C) 2018 GUMIX - Marcin Sokalski
|
||||
*/
|
||||
|
||||
#ifndef DELABELLA_H
|
||||
#define DELABELLA_H
|
||||
|
||||
// returns: positive value: number of triangle indices, negative: number of line segment indices (degenerated input)
|
||||
// triangle indices in abc array are always returned in clockwise order
|
||||
// DEPRECIATED. move to new API either extern "C" or IDelaBella (C++)
|
||||
int DelaBella(int points, const double* xy/*[points][2]*/, int* abc/*[2*points-5][3]*/, int (*errlog)(const char* fmt,...) = printf);
|
||||
|
||||
struct DelaBella_Vertex
|
||||
{
|
||||
int i; // index of original point
|
||||
double x, y; // coordinates (input copy)
|
||||
DelaBella_Vertex* next; // next silhouette vertex
|
||||
};
|
||||
|
||||
struct DelaBella_Triangle
|
||||
{
|
||||
DelaBella_Vertex* v[3]; // 3 vertices spanning this triangle
|
||||
DelaBella_Triangle* f[3]; // 3 adjacent faces, f[i] is at the edge opposite to vertex v[i]
|
||||
DelaBella_Triangle* next; // next triangle (of delaunay set or hull set)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct IDelaBella
|
||||
{
|
||||
static IDelaBella* Create();
|
||||
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
virtual void SetErrLog(int(*proc)(void* stream, const char* fmt, ...), void* stream) = 0;
|
||||
|
||||
// return 0: no output
|
||||
// negative: all points are colinear, output hull vertices form colinear segment list, no triangles on output
|
||||
// positive: output hull vertices form counter-clockwise ordered segment contour, delaunay and hull triangles are available
|
||||
// if 'y' pointer is null, y coords are treated to be located immediately after every x
|
||||
// if advance_bytes is less than 2*sizeof coordinate type, it is treated as 2*sizeof coordinate type
|
||||
virtual int Triangulate(int points, const float* x, const float* y = 0, int advance_bytes = 0) = 0;
|
||||
virtual int Triangulate(int points, const double* x, const double* y = 0, int advance_bytes = 0) = 0;
|
||||
|
||||
// num of points passed to last call to Triangulate()
|
||||
virtual int GetNumInputPoints() const = 0;
|
||||
|
||||
// num of verts returned from last call to Triangulate()
|
||||
virtual int GetNumOutputVerts() const = 0;
|
||||
|
||||
virtual const DelaBella_Triangle* GetFirstDelaunayTriangle() const = 0; // valid only if Triangulate() > 0
|
||||
virtual const DelaBella_Triangle* GetFirstHullTriangle() const = 0; // valid only if Triangulate() > 0
|
||||
virtual const DelaBella_Vertex* GetFirstHullVertex() const = 0; // if Triangulate() < 0 it is list, otherwise closed contour!
|
||||
};
|
||||
#else
|
||||
void* DelaBella_Create();
|
||||
void DelaBella_Destroy(void* db);
|
||||
void DelaBella_SetErrLog(void* db, int(*proc)(void* stream, const char* fmt, ...), void* stream);
|
||||
int DelaBella_TriangulateFloat(void* db, int points, float* x, float* y = 0, int advance_bytes = 0);
|
||||
int DelaBella_TriangulateDouble(void* db, int points, double* x, double* y = 0, int advance_bytes = 0);
|
||||
int DelaBella_GetNumInputPoints(void* db);
|
||||
int DelaBella_GetNumOutputVerts(void* db);
|
||||
const DelaBella_Triangle* GetFirstDelaunayTriangle(void* db);
|
||||
const DelaBella_Triangle* GetFirstHullTriangle(void* db);
|
||||
const DelaBella_Vertex* GetFirstHullVertex(void* db);
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,6 @@ Graphic3d_Aspects.cxx
|
||||
Graphic3d_Aspects.hxx
|
||||
Graphic3d_AspectFillArea3d.cxx
|
||||
Graphic3d_AspectFillArea3d.hxx
|
||||
Graphic3d_AspectFillCapping.cxx
|
||||
Graphic3d_AspectFillCapping.hxx
|
||||
Graphic3d_AspectLine3d.cxx
|
||||
Graphic3d_AspectLine3d.hxx
|
||||
Graphic3d_AspectMarker3d.cxx
|
||||
|
@@ -1,110 +0,0 @@
|
||||
// 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++;
|
||||
}
|
@@ -1,164 +0,0 @@
|
||||
// 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_Aspects.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 Graphic3d_Aspects
|
||||
{
|
||||
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, Graphic3d_Aspects)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_AspectFillCapping, Graphic3d_Aspects)
|
||||
|
||||
#endif // _Graphic3d_AspectFillCapping_HeaderFile
|
@@ -103,21 +103,6 @@ Graphic3d_Camera::Graphic3d_Camera()
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Camera::Graphic3d_Camera (const Handle(Graphic3d_Camera)& theOther)
|
||||
: myUp (0.0, 1.0, 0.0),
|
||||
myEye (0.0, 0.0, -1500.0),
|
||||
myCenter (0.0, 0.0, 0.0),
|
||||
myAxialScale (1.0, 1.0, 1.0),
|
||||
myProjType (Projection_Orthographic),
|
||||
myFOVy (45.0),
|
||||
myFOVyTan (Tan (DTR_HALF * 45.0)),
|
||||
myZNear (DEFAULT_ZNEAR),
|
||||
myZFar (DEFAULT_ZFAR),
|
||||
myAspect (1.0),
|
||||
myScale (1000.0),
|
||||
myZFocus (1.0),
|
||||
myZFocusType (FocusType_Relative),
|
||||
myIOD (0.05),
|
||||
myIODType (IODType_Relative)
|
||||
{
|
||||
myWorldViewProjState.Initialize (this);
|
||||
|
||||
|
@@ -24,6 +24,19 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -31,8 +44,19 @@ namespace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (0.0, 0.0, 1.0, 0.0),
|
||||
myEquation (0.0, 0.0, 1.0, 0.0),
|
||||
myEquationRev(0.0, 0.0,-1.0, 0.0),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
init();
|
||||
makeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -40,8 +64,19 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w()),
|
||||
myEquation (theEquation),
|
||||
myEquationRev(0.0, 0.0,-1.0, 0.0),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
init (gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.a()));
|
||||
makeId();
|
||||
updateInversedPlane();
|
||||
}
|
||||
|
||||
@@ -49,27 +84,42 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient (theOther)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient(theOther),
|
||||
myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (theOther.myPlane),
|
||||
myEquation (theOther.myEquation),
|
||||
myEquationRev(theOther.myEquationRev),
|
||||
myChainLenFwd(1),
|
||||
myFlags (theOther.myFlags),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (theOther.myIsOn),
|
||||
myIsCapping (theOther.myIsCapping)
|
||||
{
|
||||
*mySectionStyle = *theOther.CappingSectionStyle();
|
||||
init (theOther.myPlane,
|
||||
theOther.myEquationRev,
|
||||
theOther.myIsOn,
|
||||
theOther.myIsCapping,
|
||||
theOther.ToOverrideCappingAspect(),
|
||||
theOther.CappingSectionStyle());
|
||||
updateInversedPlane();
|
||||
makeId();
|
||||
*myAspect = *theOther.CappingAspect();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const gp_Pln& thePlane)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (thePlane),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
init (thePlane);
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
updateInversedPlane();
|
||||
makeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -81,7 +131,7 @@ void Graphic3d_ClipPlane::SetEquation (const Graphic3d_Vec4d& theEquation)
|
||||
myPlane = gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w());
|
||||
myEquation = theEquation;
|
||||
updateInversedPlane();
|
||||
myOrientationDirty = Standard_True;
|
||||
myEquationMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -93,7 +143,7 @@ void Graphic3d_ClipPlane::SetEquation (const gp_Pln& thePlane)
|
||||
myPlane = thePlane;
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
updateInversedPlane();
|
||||
myOrientationDirty = Standard_True;
|
||||
myEquationMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -128,106 +178,119 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingSectionStyle
|
||||
// function : SetCappingMaterial
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
mySectionStyle = theStyle;
|
||||
myAspect->SetFrontMaterial (theMat);
|
||||
myAspect->SetInteriorColor (theMat.Color());
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OrientationMatrix
|
||||
// function : SetCappingTexture
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const Graphic3d_Mat4& Graphic3d_ClipPlane::OrientationMatrix() const
|
||||
void Graphic3d_ClipPlane::SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
{
|
||||
if (myOrientationDirty)
|
||||
if (!theTexture.IsNull())
|
||||
{
|
||||
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())
|
||||
myAspect->SetTextureMapOn();
|
||||
Handle(Graphic3d_TextureSet) aTextureSet = myAspect->TextureSet();
|
||||
if (aTextureSet.IsNull() || aTextureSet->Size() != 1)
|
||||
{
|
||||
aSide1[0] = 1.0f;
|
||||
aTextureSet = new Graphic3d_TextureSet (theTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSide1[0] = aDirection[2] / aMagintude;
|
||||
aSide1[2] = -aDirection[0] / aMagintude;
|
||||
aTextureSet->SetFirst (theTexture);
|
||||
}
|
||||
|
||||
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;
|
||||
myAspect->SetTextureSet (aTextureSet);
|
||||
}
|
||||
|
||||
return myOrientationMat;
|
||||
else
|
||||
{
|
||||
myAspect->SetTextureMapOff();
|
||||
myAspect->SetTextureSet (Handle(Graphic3d_TextureSet)());
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : init
|
||||
// function : SetCappingHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::init (const gp_Pln& thePlane,
|
||||
const Graphic3d_Vec4d& theEquationRev,
|
||||
const Standard_Boolean theIsOn,
|
||||
const Standard_Boolean theIsCapping,
|
||||
const Standard_Boolean theOverrideStyle,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
void Graphic3d_ClipPlane::SetCappingHatch (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
if (myEntityUID.IsEmpty())
|
||||
{
|
||||
myEntityUID = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
}
|
||||
myAspect->SetHatchStyle (theStyle);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
myPrevInChain = NULL;
|
||||
myEquationRev = theEquationRev;
|
||||
myChainLenFwd = 1;
|
||||
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;
|
||||
// =======================================================================
|
||||
// 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));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -249,7 +312,7 @@ void Graphic3d_ClipPlane::updateChainLen()
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
|
||||
{
|
||||
myOrientationDirty = Standard_True;
|
||||
++myEquationMod;
|
||||
if (!myNextInChain.IsNull())
|
||||
{
|
||||
myNextInChain->myPrevInChain = NULL;
|
||||
|
@@ -19,12 +19,9 @@
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_BndBox3d.hxx>
|
||||
#include <Graphic3d_CappingFlags.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>
|
||||
@@ -169,6 +166,44 @@ public:
|
||||
|
||||
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.
|
||||
Handle(Graphic3d_TextureMap) CappingTexture() const { return !myAspect->TextureSet().IsNull() && !myAspect->TextureSet()->IsEmpty()
|
||||
? myAspect->TextureSet()->First()
|
||||
: Handle(Graphic3d_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
|
||||
@@ -179,18 +214,41 @@ public: // @name user-defined graphical attributes
|
||||
//! @return clip plane resource identifier string.
|
||||
const TCollection_AsciiString& GetId() const
|
||||
{
|
||||
return myEntityUID;
|
||||
return myId;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Returns style used for drawing capping section.
|
||||
//! Return capping aspect.
|
||||
//! @return capping surface rendering aspect.
|
||||
const Handle(Graphic3d_AspectFillCapping)& CappingSectionStyle() const { return mySectionStyle; }
|
||||
const Handle(Graphic3d_AspectFillArea3d)& CappingAspect() const { return myAspect; }
|
||||
|
||||
//! Sets clipping section filling aspect.
|
||||
Standard_EXPORT void SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
|
||||
//! Assign capping aspect.
|
||||
Standard_EXPORT void SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
|
||||
|
||||
//! 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; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane material.
|
||||
void SetUseObjectMaterial (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectMaterial); }
|
||||
|
||||
//! Flag indicating whether texture for capping plane should be taken from object.
|
||||
//! Default value: FALSE.
|
||||
bool ToUseObjectTexture() const { return (myFlags & Graphic3d_CappingFlags_ObjectTexture) != 0; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane texture.
|
||||
void SetUseObjectTexture (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectTexture); }
|
||||
|
||||
//! 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:
|
||||
|
||||
@@ -294,25 +352,14 @@ public: // @name modification counters
|
||||
{
|
||||
return myAspectMod;
|
||||
}
|
||||
//! 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; }
|
||||
|
||||
//! Sets flag for controlling the preference of using section style between clip plane and object.
|
||||
void SetToOverrideCappingAspect (const bool theToOverride) { myOverrideObjectStyle = theToOverride; }
|
||||
|
||||
//! Returns plane's orientation matrix.
|
||||
Standard_EXPORT const Graphic3d_Mat4& OrientationMatrix() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Initializes plane and makes unique identifier (UID) to differentiate clipping plane entities.
|
||||
void init (const gp_Pln& thePlane = gp_Pln(),
|
||||
const Graphic3d_Vec4d& theEquationRev = Graphic3d_Vec4d(0.0, 0.0,-1.0, 0.0),
|
||||
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)());
|
||||
//! Generate unique object id for OpenGL graphic resource manager.
|
||||
void makeId();
|
||||
|
||||
//! Set capping flag.
|
||||
Standard_EXPORT void setCappingFlag (bool theToUse, int theFlag);
|
||||
|
||||
//! Update chain length in backward direction.
|
||||
void updateChainLen();
|
||||
@@ -327,10 +374,10 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
Handle(Graphic3d_AspectFillCapping) mySectionStyle; //!< Style set for drawing capped solid section.
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect; //!< fill area aspect
|
||||
Handle(Graphic3d_ClipPlane) myNextInChain; //!< next plane in a chain of planes defining logical AND operation
|
||||
Graphic3d_ClipPlane* myPrevInChain; //!< previous plane in a chain of planes defining logical AND operation
|
||||
TCollection_AsciiString myEntityUID; //!< Unique identifier for the plane
|
||||
TCollection_AsciiString myId; //!< resource id
|
||||
gp_Pln myPlane; //!< plane definition
|
||||
Graphic3d_Vec4d myEquation; //!< plane equation vector
|
||||
Graphic3d_Vec4d myEquationRev; //!< reversed plane equation
|
||||
@@ -340,9 +387,6 @@ private:
|
||||
unsigned int myAspectMod; //!< modification counter of aspect
|
||||
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
|
||||
mutable Standard_Boolean myOrientationDirty; //!< Boolean flag indicating whether orientation matrix is dirty or not.
|
||||
mutable Graphic3d_Mat4 myOrientationMat; //!< Plane orientation matrix (for visualization purposes).
|
||||
|
||||
};
|
||||
|
||||
|
@@ -37,7 +37,6 @@
|
||||
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
class Graphic3d_AspectFillCapping;
|
||||
|
||||
//! This class allows the definition of groups
|
||||
//! of primitives inside of graphic objects (presentations).
|
||||
@@ -105,9 +104,6 @@ public:
|
||||
//! Modifies the current context of the group to give another aspect for all the primitives created after this call in the group.
|
||||
virtual void SetPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) = 0;
|
||||
|
||||
//! Returns style of filling clipping sections on closed shell primitives.
|
||||
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const = 0;
|
||||
|
||||
//! Update presentation aspects after their modification.
|
||||
virtual void SynchronizeAspects() = 0;
|
||||
|
||||
|
@@ -21,15 +21,13 @@
|
||||
//! - 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;
|
||||
//! - Graphic3d_ASPECT_FILL_CAPPING: aspect for filling clipping sections.
|
||||
//! - ASPECT_FILL_AREA: aspect for face primitives.
|
||||
enum Graphic3d_GroupAspect
|
||||
{
|
||||
Graphic3d_ASPECT_LINE,
|
||||
Graphic3d_ASPECT_TEXT,
|
||||
Graphic3d_ASPECT_MARKER,
|
||||
Graphic3d_ASPECT_FILL_AREA,
|
||||
Graphic3d_ASPECT_FILL_CAPPING
|
||||
Graphic3d_ASPECT_FILL_AREA
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_GroupAspect_HeaderFile
|
||||
|
@@ -21,16 +21,11 @@
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_CappingPlaneResource.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
static const OpenGl_CappingPlaneResource THE_DEFAULT_ASPECT = OpenGl_CappingPlaneResource (new Graphic3d_AspectFillCapping);
|
||||
static const TCollection_AsciiString THE_QUAD_PARRAY = "OpenGl_CappingAlgo_Quad";
|
||||
static const TCollection_AsciiString THE_PLANE_STYLE = "OpenGl_CappingAlgo_CappingStyle_";
|
||||
|
||||
//! Auxiliary sentry object managing stencil test.
|
||||
struct StencilTestSentry
|
||||
{
|
||||
@@ -63,113 +58,21 @@ namespace
|
||||
GLint myDepthFuncPrev;
|
||||
};
|
||||
|
||||
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; }
|
||||
|
||||
//! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
|
||||
Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
|
||||
|
||||
private:
|
||||
OpenGl_Element* myGlElement;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE (OpenGl_SharedElement, OpenGl_Resource)
|
||||
};
|
||||
|
||||
//! Iitializes and returns vertex buffer for plane section
|
||||
OpenGl_PrimitiveArray* initQuad (const Handle(OpenGl_Context)& theContext)
|
||||
{
|
||||
Handle(OpenGl_SharedElement) aSharedResource;
|
||||
|
||||
if (!theContext->GetResource (THE_QUAD_PARRAY, aSharedResource))
|
||||
{
|
||||
aSharedResource = new OpenGl_SharedElement (OpenGl_CappingPlaneResource::BuildInfinitPlaneVertices());
|
||||
theContext->ShareResource (THE_QUAD_PARRAY, aSharedResource);
|
||||
}
|
||||
|
||||
return dynamic_cast<OpenGl_PrimitiveArray*> (aSharedResource->GlElement());
|
||||
}
|
||||
|
||||
//! Render section plane using the given aspects.
|
||||
void renderSection (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_PrimitiveArray* theQuad,
|
||||
const OpenGl_Aspects* theCappingAspect,
|
||||
const OpenGl_Aspects* theHatchAspect,
|
||||
const OpenGl_Mat4& theCappingMatrix,
|
||||
const Standard_ShortReal theHatchScale,
|
||||
const Standard_ShortReal theHatchRotate)
|
||||
//! 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 Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
const bool wasCullAllowed = theWorkspace->SetAllowFaceCulling (true);
|
||||
|
||||
const Standard_Boolean isTextureHatch =
|
||||
theHatchAspect != NULL
|
||||
&& theHatchAspect->Aspect()->TextureMapState();
|
||||
|
||||
// set identity model matrix
|
||||
aContext->ModelWorldState.Push();
|
||||
aContext->ModelWorldState.SetCurrent (theCappingMatrix);
|
||||
aContext->ModelWorldState.SetCurrent (OpenGl_Mat4::Map (*thePlane->Orientation()->mat));
|
||||
aContext->ApplyModelViewMatrix();
|
||||
|
||||
theWorkspace->SetAspects (theCappingAspect);
|
||||
theWorkspace->ApplyAspects();
|
||||
|
||||
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) && !theHatchAspect->TextureSet(aContext)->IsEmpty())
|
||||
{
|
||||
Handle(OpenGl_Texture) aTexture = theHatchAspect->TextureSet(aContext)->First();
|
||||
const Handle(Graphic3d_TextureParams)& aTexParams = aTexture->Sampler()->Parameters();
|
||||
|
||||
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->SetAspects (theHatchAspect);
|
||||
theWorkspace->ApplyAspects();
|
||||
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
|
||||
theQuad->Render (theWorkspace);
|
||||
|
||||
glDepthFunc (GL_LESS);
|
||||
|
||||
if (isTextureHatch)
|
||||
{
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
if (theHatchScale != 1.0 || theHatchRotate != 0.0)
|
||||
{
|
||||
Handle(OpenGl_Texture) aTexture = theHatchAspect->TextureSet(aContext)->First();
|
||||
const Handle(Graphic3d_TextureParams)& aTexParams = aTexture->Sampler()->Parameters();
|
||||
|
||||
aTexParams->SetScale (aPrevScale);
|
||||
aTexParams->SetRotation (aPrevRotate);
|
||||
}
|
||||
}
|
||||
}
|
||||
thePlane->Primitives().Render (theWorkspace);
|
||||
|
||||
aContext->ModelWorldState.Pop();
|
||||
aContext->ApplyModelViewMatrix();
|
||||
@@ -183,23 +86,13 @@ namespace
|
||||
const OpenGl_Structure& theStructure,
|
||||
const Handle(Graphic3d_ClipPlane)& theClipChain,
|
||||
const Standard_Integer theSubPlaneIndex,
|
||||
const Handle(OpenGl_CappingPlaneResource)& thePlane,
|
||||
const OpenGl_PrimitiveArray* theQuad)
|
||||
const Handle(OpenGl_CappingPlaneResource)& thePlane)
|
||||
{
|
||||
const Standard_Integer aPrevFilter = theWorkspace->RenderFilter();
|
||||
const Standard_Integer anAnyFilter = aPrevFilter & ~(Standard_Integer )(OpenGl_RenderFilter_OpaqueOnly | OpenGl_RenderFilter_TransparentOnly);
|
||||
|
||||
const Handle(Graphic3d_ClipPlane)& aPlane = theClipChain;
|
||||
|
||||
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;
|
||||
|
||||
const Handle(Graphic3d_ClipPlane)& aRenderPlane = thePlane->Plane();
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (theStructure.Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!aGroupIter.Value()->IsClosed())
|
||||
@@ -210,6 +103,16 @@ namespace
|
||||
// clear stencil only if something has been actually drawn
|
||||
theStencilSentry.Init();
|
||||
|
||||
// check if capping plane should be rendered within current pass (only opaque / only transparent)
|
||||
const OpenGl_Aspects* anObjAspectFace = aRenderPlane->ToUseObjectProperties() ? aGroupIter.Value()->GlAspects() : NULL;
|
||||
thePlane->Update (aContext, anObjAspectFace != NULL ? anObjAspectFace->Aspect() : Handle(Graphic3d_Aspects)());
|
||||
theWorkspace->SetAspects (thePlane->AspectFace());
|
||||
theWorkspace->SetRenderFilter (aPrevFilter);
|
||||
if (!theWorkspace->ShouldRender (&thePlane->Primitives()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// suppress only opaque/transparent filter since for filling stencil the whole geometry should be drawn
|
||||
theWorkspace->SetRenderFilter (anAnyFilter);
|
||||
|
||||
@@ -218,7 +121,7 @@ namespace
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
glClear (GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
const bool aColorMaskBack = aContext->SetColorMask (false);
|
||||
|
||||
// override aspects, disable culling
|
||||
theWorkspace->SetAspects (&theWorkspace->NoneCulling());
|
||||
@@ -237,7 +140,20 @@ namespace
|
||||
glStencilOp (GL_KEEP, GL_INVERT, GL_INVERT);
|
||||
|
||||
// render closed primitives
|
||||
aGroupIter.Value()->Render (theWorkspace);
|
||||
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->SetAspects (&theWorkspace->FrontCulling());
|
||||
@@ -248,7 +164,7 @@ namespace
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
|
||||
// render capping plane using the generated stencil mask
|
||||
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
aContext->SetColorMask (aColorMaskBack);
|
||||
if (theWorkspace->UseDepthWrite())
|
||||
{
|
||||
glDepthMask (GL_TRUE);
|
||||
@@ -260,66 +176,8 @@ namespace
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
const OpenGl_Aspects* aGroupAspectFace = aGroupIter.Value()->GlAspects();
|
||||
const OpenGl_CappingPlaneResource* aGroupAspectCapping = aGroupIter.Value()->AspectFillCapping();
|
||||
const OpenGl_CappingPlaneResource* anAspectCapping =
|
||||
thePlane && (!aGroupAspectCapping || aGroupAspectCapping->Aspect().IsNull() || aPlane->ToOverrideCappingAspect())
|
||||
? thePlane.get()
|
||||
: aGroupAspectCapping;
|
||||
|
||||
if (anAspectCapping == NULL)
|
||||
{
|
||||
anAspectCapping = &THE_DEFAULT_ASPECT;
|
||||
}
|
||||
|
||||
const OpenGl_Aspects* anAspectFace = anAspectCapping->CappingFaceAspect (aGroupAspectFace);
|
||||
const Standard_Boolean hasHatch = anAspectCapping->Aspect()->ToDrawHatch();
|
||||
const OpenGl_Aspects* 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]);
|
||||
}
|
||||
|
||||
if (!anAspectHatching->TextureSet(aContext)->IsEmpty())
|
||||
aHatchScale = 1.0f / (aViewScale * anAspectHatching->TextureSet(aContext)->First()->SizeY());
|
||||
}
|
||||
}
|
||||
|
||||
renderSection (theWorkspace, theQuad, anAspectFace, hasHatch ? anAspectCapping->HatchingFaceAspect() : NULL, aPlaneMat, aHatchScale, aHatchAngle);
|
||||
theWorkspace->SetAspects (thePlane->AspectFace());
|
||||
renderPlane (theWorkspace, thePlane);
|
||||
|
||||
// turn on the current plane to restore initial state
|
||||
aContext->ChangeClipping().ResetCappingFilter();
|
||||
@@ -329,7 +187,7 @@ namespace
|
||||
|
||||
if (theStructure.InstancedStructure() != NULL)
|
||||
{
|
||||
renderCappingForStructure (theStencilSentry, theWorkspace, *theStructure.InstancedStructure(), theClipChain, theSubPlaneIndex, thePlane, theQuad);
|
||||
renderCappingForStructure (theStencilSentry, theWorkspace, *theStructure.InstancedStructure(), theClipChain, theSubPlaneIndex, thePlane);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,12 +206,6 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
||||
return;
|
||||
}
|
||||
|
||||
const OpenGl_PrimitiveArray* aCappingQuad = initQuad (aContext);
|
||||
if (!aCappingQuad)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// remember current aspect face defined in workspace
|
||||
const OpenGl_Aspects* aFaceAsp = theWorkspace->Aspects();
|
||||
|
||||
@@ -362,16 +214,6 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
||||
theWorkspace->SetRenderFilter (aPrevFilter | OpenGl_RenderFilter_FillModeOnly);
|
||||
StencilTestSentry aStencilSentry;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// generate capping for every clip plane
|
||||
for (OpenGl_ClippingIterator aCappingIt (aContext->Clipping()); aCappingIt.More(); aCappingIt.Next())
|
||||
{
|
||||
@@ -387,33 +229,23 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
||||
for (const Graphic3d_ClipPlane* aSubPlaneIter = aClipChain.get(); aSubPlaneIter != NULL; aSubPlaneIter = aSubPlaneIter->ChainNextPlane().get(), ++aSubPlaneIndex)
|
||||
{
|
||||
// get resource for the plane
|
||||
const TCollection_AsciiString& aResId = THE_PLANE_STYLE + aSubPlaneIter->GetId();
|
||||
const TCollection_AsciiString& aResId = aSubPlaneIter->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 (aSubPlaneIter->CappingSectionStyle());
|
||||
aPlaneRes = new OpenGl_CappingPlaneResource (aSubPlaneIter);
|
||||
aContext->ShareResource (aResId, aPlaneRes);
|
||||
}
|
||||
|
||||
renderCappingForStructure (aStencilSentry, theWorkspace, theStructure, aClipChain, aSubPlaneIndex, aPlaneRes, aCappingQuad);
|
||||
renderCappingForStructure (aStencilSentry, theWorkspace, theStructure, aClipChain, aSubPlaneIndex, aPlaneRes);
|
||||
|
||||
// set delayed resource release
|
||||
aPlaneRes.Nullify();
|
||||
if (!aResId.IsEmpty())
|
||||
{
|
||||
// schedule release of resource if not used
|
||||
aContext->ReleaseResource (aResId, Standard_True);
|
||||
}
|
||||
aContext->ReleaseResource (aResId, Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
if (aPrevBlend == GL_TRUE)
|
||||
{
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (aPrevBlendSrc, aPrevBlendDst);
|
||||
}
|
||||
|
||||
// restore rendering aspects
|
||||
theWorkspace->SetAspects (aFaceAsp);
|
||||
theWorkspace->SetRenderFilter (aPrevFilter);
|
||||
|
@@ -56,28 +56,21 @@ namespace
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f } }
|
||||
};
|
||||
|
||||
Handle(Graphic3d_Aspects) 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 : BuildInfinitPlaneVertices
|
||||
// function : OpenGl_CappingPlaneResource
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_PrimitiveArray* OpenGl_CappingPlaneResource::BuildInfinitPlaneVertices()
|
||||
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)
|
||||
{
|
||||
OpenGl_PrimitiveArray* aPrimitives = NULL;
|
||||
// Fill primitive array
|
||||
Handle(NCollection_AlignedAllocator) anAlloc = new NCollection_AlignedAllocator (16);
|
||||
Handle(Graphic3d_Buffer) anAttribs = new Graphic3d_Buffer (anAlloc);
|
||||
@@ -90,26 +83,8 @@ OpenGl_PrimitiveArray* OpenGl_CappingPlaneResource::BuildInfinitPlaneVertices()
|
||||
if (anAttribs->Init (12, anAttribInfo, 3))
|
||||
{
|
||||
memcpy (anAttribs->ChangeData(), THE_CAPPING_PLN_VERTS, sizeof(THE_CAPPING_PLN_VERTS));
|
||||
|
||||
aPrimitives = new OpenGl_PrimitiveArray (NULL);
|
||||
aPrimitives->InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
||||
myPrimitives.InitBuffers (NULL, Graphic3d_TOPA_TRIANGLES, NULL, anAttribs, NULL);
|
||||
}
|
||||
return aPrimitives;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_CappingPlaneResource
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d_AspectFillCapping)& theAspect)
|
||||
: myCappingAspect(),//defaultMaterial()),
|
||||
myHatchingAspect(),//defaultMaterial()),
|
||||
myHatchingState (0)
|
||||
{
|
||||
myCappingAspect.SetAspect (defaultMaterial());
|
||||
myHatchingAspect.SetAspect (defaultMaterial());
|
||||
|
||||
SetAspect (theAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -118,83 +93,18 @@ OpenGl_CappingPlaneResource::OpenGl_CappingPlaneResource (const Handle(Graphic3d
|
||||
// =======================================================================
|
||||
OpenGl_CappingPlaneResource::~OpenGl_CappingPlaneResource()
|
||||
{
|
||||
Release (NULL);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspect
|
||||
// function : Update
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::SetAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect)
|
||||
void OpenGl_CappingPlaneResource::Update (const Handle(OpenGl_Context)& theCtx,
|
||||
const Handle(Graphic3d_Aspects)& theObjAspect)
|
||||
{
|
||||
myAspect = theAspect;
|
||||
|
||||
if (theAspect.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theAspect->ToUseObjectMaterial()
|
||||
|| !theAspect->ToUseObjectTexture()
|
||||
|| !theAspect->ToUseObjectShader())
|
||||
{
|
||||
Handle(Graphic3d_Aspects) 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_Aspects) 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();
|
||||
}
|
||||
updateTransform (theCtx);
|
||||
updateAspect (theObjAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -203,109 +113,123 @@ void OpenGl_CappingPlaneResource::SetAspect (const Handle(Graphic3d_AspectFillCa
|
||||
// =======================================================================
|
||||
void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
|
||||
{
|
||||
myCappingAspect .Release (theContext);
|
||||
myHatchingAspect.Release (theContext);
|
||||
OpenGl_Element::Destroy (theContext, myAspect);
|
||||
myPrimitives.Release (theContext);
|
||||
myEquationMod = (unsigned int )-1;
|
||||
myAspectMod = (unsigned int )-1;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CappingFaceAspect
|
||||
// function : updateAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const OpenGl_Aspects* OpenGl_CappingPlaneResource::CappingFaceAspect (const OpenGl_Aspects* theObjectAspect) const
|
||||
void OpenGl_CappingPlaneResource::updateAspect (const Handle(Graphic3d_Aspects)& theObjAspect)
|
||||
{
|
||||
if (myAspect.IsNull())
|
||||
if (myAspect == NULL)
|
||||
{
|
||||
return NULL;
|
||||
myAspect = new OpenGl_Aspects();
|
||||
myAspectMod = myPlaneRoot->MCountAspect() - 1; // mark out of sync
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Aspects) aFillAspect = myCappingAspect.Aspect();
|
||||
if (theObjAspect.IsNull())
|
||||
{
|
||||
if (myAspectMod != myPlaneRoot->MCountAspect())
|
||||
{
|
||||
myAspect->SetAspect (myPlaneRoot->CappingAspect());
|
||||
myAspectMod = myPlaneRoot->MCountAspect();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (myAspect->ToUseObjectMaterial() && theObjectAspect != NULL)
|
||||
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
|
||||
aFillAspect->SetFrontMaterial (theObjectAspect->Aspect()->FrontMaterial());
|
||||
aFillAspect->SetInteriorColor (theObjectAspect->Aspect()->InteriorColor());
|
||||
myFillAreaAspect->SetFrontMaterial (theObjAspect->FrontMaterial());
|
||||
myFillAreaAspect->SetInteriorColor (theObjAspect->InteriorColor());
|
||||
}
|
||||
else
|
||||
if (myPlaneRoot->ToUseObjectTexture())
|
||||
{
|
||||
aFillAspect->SetFrontMaterial (myAspect->Material());
|
||||
aFillAspect->SetInteriorColor (myAspect->Material().Color());
|
||||
}
|
||||
|
||||
if (myAspect->ToUseObjectTexture() && theObjectAspect != NULL)
|
||||
{
|
||||
if (theObjectAspect->Aspect()->ToMapTexture())
|
||||
myFillAreaAspect->SetTextureSet (theObjAspect->TextureSet());
|
||||
if (theObjAspect->ToMapTexture())
|
||||
{
|
||||
aFillAspect->SetTextureMap (theObjectAspect->Aspect()->TextureMap());
|
||||
aFillAspect->SetTextureMapOn();
|
||||
myFillAreaAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
myFillAreaAspect->SetTextureMapOff();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (myPlaneRoot->ToUseObjectShader())
|
||||
{
|
||||
aFillAspect->SetTextureMap (myAspect->Texture());
|
||||
if (!myAspect->Texture().IsNull())
|
||||
{
|
||||
aFillAspect->SetTextureMapOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetTextureMapOff();
|
||||
}
|
||||
myFillAreaAspect->SetShaderProgram (theObjAspect->ShaderProgram());
|
||||
}
|
||||
|
||||
if (myAspect->ToUseObjectShader() && theObjectAspect != NULL)
|
||||
{
|
||||
aFillAspect->SetShaderProgram (theObjectAspect->Aspect()->ShaderProgram());
|
||||
}
|
||||
else
|
||||
{
|
||||
aFillAspect->SetShaderProgram (myAspect->Shader());
|
||||
}
|
||||
|
||||
myCappingAspect.SetAspect (aFillAspect);
|
||||
|
||||
return &myCappingAspect;
|
||||
myAspect->SetAspect (myFillAreaAspect);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : HatchingFaceAspect
|
||||
// function : updateTransform
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const OpenGl_Aspects* OpenGl_CappingPlaneResource::HatchingFaceAspect() const
|
||||
void OpenGl_CappingPlaneResource::updateTransform (const Handle(OpenGl_Context)& theCtx)
|
||||
{
|
||||
if (myAspect.IsNull())
|
||||
if (myEquationMod == myPlaneRoot->MCountEquation()
|
||||
&& myLocalOrigin.IsEqual (theCtx->ShaderManager()->LocalOrigin(), gp::Resolution()))
|
||||
{
|
||||
return NULL;
|
||||
return; // nothing to update
|
||||
}
|
||||
|
||||
const Standard_Size aHatchingState = myAspect->HatchingState();
|
||||
if (myHatchingState != aHatchingState)
|
||||
{
|
||||
if (myAspect->ToDrawHatch())
|
||||
{
|
||||
Handle(Graphic3d_Aspects) aFillAspect = myHatchingAspect.Aspect();
|
||||
myEquationMod = myPlaneRoot->MCountEquation();
|
||||
myLocalOrigin = theCtx->ShaderManager()->LocalOrigin();
|
||||
|
||||
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;
|
||||
}
|
||||
const Graphic3d_ClipPlane::Equation& anEq = myPlaneRoot->GetEquation();
|
||||
const Standard_Real anEqW = theCtx->ShaderManager()->LocalClippingPlaneW (*myPlaneRoot);
|
||||
|
||||
// re-evaluate infinite plane transformation matrix
|
||||
const Graphic3d_Vec3 aNorm (anEq.xyz());
|
||||
const Graphic3d_Vec3 T (anEq.xyz() * -anEqW);
|
||||
|
||||
// project plane normal onto OX to find left vector
|
||||
const Standard_ShortReal aProjLen = sqrt ((Standard_ShortReal)anEq.xz().SquareModulus());
|
||||
Graphic3d_Vec3 aLeft;
|
||||
if (aProjLen < ShortRealSmall())
|
||||
{
|
||||
aLeft[0] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
aLeft[0] = aNorm[2] / aProjLen;
|
||||
aLeft[2] = -aNorm[0] / aProjLen;
|
||||
}
|
||||
|
||||
return &myHatchingAspect;
|
||||
const Graphic3d_Vec3 F = Graphic3d_Vec3::Cross (-aLeft, aNorm);
|
||||
|
||||
myOrientation.mat[0][0] = aLeft[0];
|
||||
myOrientation.mat[0][1] = aLeft[1];
|
||||
myOrientation.mat[0][2] = aLeft[2];
|
||||
myOrientation.mat[0][3] = 0.0f;
|
||||
|
||||
myOrientation.mat[1][0] = aNorm[0];
|
||||
myOrientation.mat[1][1] = aNorm[1];
|
||||
myOrientation.mat[1][2] = aNorm[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;
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <OpenGl_Resource.hxx>
|
||||
#include <OpenGl_Aspects.hxx>
|
||||
#include <OpenGl_Matrix.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_ClipPlane.hxx>
|
||||
|
||||
class OpenGl_CappingPlaneResource;
|
||||
DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
|
||||
@@ -30,23 +30,25 @@ DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
|
||||
//! 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_AspectFillCapping data.
|
||||
//! - 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:
|
||||
|
||||
//! Create and assign style.
|
||||
Standard_EXPORT OpenGl_CappingPlaneResource (const Handle(Graphic3d_AspectFillCapping)& theAspect);
|
||||
//! 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();
|
||||
|
||||
//! Assign section style.
|
||||
Standard_EXPORT void SetAspect (const Handle(Graphic3d_AspectFillCapping)& theAspect);
|
||||
|
||||
//! Returns section style parameters.
|
||||
const Handle(Graphic3d_AspectFillCapping)& Aspect() const { return myAspect; }
|
||||
//! 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_Aspects)& theObjAspect);
|
||||
|
||||
//! Release associated OpenGl resources.
|
||||
//! @param theContext [in] the resource context.
|
||||
@@ -55,23 +57,17 @@ public:
|
||||
//! Returns estimated GPU memory usage - not implemented.
|
||||
virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
|
||||
|
||||
//! Return parent clipping plane structure.
|
||||
const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
|
||||
|
||||
//! @return aspect face for rendering capping surface.
|
||||
inline const OpenGl_Aspects* 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.
|
||||
static OpenGl_PrimitiveArray* BuildInfinitPlaneVertices();
|
||||
|
||||
//! 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_Aspects* CappingFaceAspect (const OpenGl_Aspects* theObjectAspect) const;
|
||||
|
||||
//! Returns the shading aspect for drawing hatch layer of a section.
|
||||
Standard_EXPORT const OpenGl_Aspects* HatchingFaceAspect() const;
|
||||
inline const OpenGl_PrimitiveArray& Primitives() const { return myPrimitives; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -83,11 +79,14 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
Handle(Graphic3d_AspectFillCapping) myAspect; //!< Section style settings from application's level.
|
||||
mutable OpenGl_Aspects myCappingAspect; //!< GL aspect for shading base layer of a capping section.
|
||||
mutable OpenGl_Aspects myHatchingAspect; //!< GL aspect for shading hatching layer (additional to base) of a capping section.
|
||||
mutable Standard_Size myHatchingState;
|
||||
gp_XYZ myLocalOrigin; //!< layer origin
|
||||
OpenGl_PrimitiveArray myPrimitives; //!< vertices and texture coordinates for rendering
|
||||
OpenGl_Matrix myOrientation; //!< plane transformation matrix.
|
||||
OpenGl_Aspects* myAspect; //!< capping face aspect.
|
||||
Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
|
||||
Handle(Graphic3d_Aspects) myFillAreaAspect;//!< own capping aspect
|
||||
gp_XYZ myLocalOrigin; //!< layer origin
|
||||
unsigned int myEquationMod; //!< modification counter for plane equation.
|
||||
unsigned int myAspectMod; //!< modification counter for aspect.
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_GroupDefinitionError.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group)
|
||||
@@ -91,20 +90,6 @@ void OpenGl_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_Aspects)& th
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theAspect.IsNull() && theAspect->IsKind (STANDARD_TYPE(Graphic3d_AspectFillCapping)))
|
||||
{
|
||||
Handle(Graphic3d_AspectFillCapping) aFillCappingAspect = Handle(Graphic3d_AspectFillCapping)::DownCast (theAspect);
|
||||
if (myAspectFillCapping == NULL)
|
||||
{
|
||||
myAspectFillCapping = new OpenGl_CappingPlaneResource (aFillCappingAspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
myAspectFillCapping->SetAspect (aFillCappingAspect);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (myAspects == NULL)
|
||||
{
|
||||
myAspects = new OpenGl_Aspects (theAspect);
|
||||
|
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
#include <OpenGl_Aspects.hxx>
|
||||
#include <OpenGl_CappingPlaneResource.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
||||
class OpenGl_Group;
|
||||
@@ -118,17 +117,6 @@ public:
|
||||
//! Is the group ray-tracable (contains ray-tracable elements)?
|
||||
Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
|
||||
|
||||
//! Returns section style aspect.
|
||||
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const Standard_OVERRIDE
|
||||
{
|
||||
return myAspectFillCapping != NULL
|
||||
? myAspectFillCapping->Aspect()
|
||||
: Handle(Graphic3d_AspectFillCapping)();
|
||||
}
|
||||
|
||||
//! Returns OpenGL capping filling aspect.
|
||||
const OpenGl_CappingPlaneResource* AspectFillCapping() const { return myAspectFillCapping; }
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual ~OpenGl_Group();
|
||||
@@ -136,7 +124,6 @@ protected:
|
||||
protected:
|
||||
|
||||
OpenGl_Aspects* myAspects;
|
||||
OpenGl_CappingPlaneResource* myAspectFillCapping;
|
||||
OpenGl_ElementNode* myFirst;
|
||||
OpenGl_ElementNode* myLast;
|
||||
Standard_Boolean myIsRaytracable;
|
||||
|
@@ -14,6 +14,13 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// 26-Mar-96 : xab : inclusion des inlines trop gros
|
||||
// 15-Oct-96 : alr : extraction des inlines (pas tous ceux inclus par xab)
|
||||
// 19-Fev-97 : jct : ajout des methodes UVBox et UVConstraints (G1134)
|
||||
// 10-Dec-97 : jag : Gros debug sur delete, et sur la methode Copy...
|
||||
// 13-Jan-98 : alr : ajout des derivees pour contraintes G3 et approx. C2
|
||||
// 28-Avr-98 : alr : Prise en compte des Linear*Constraint, methodes SolveTI1,SolveTI2,SolveTI3
|
||||
|
||||
#include <gp_XY.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
@@ -767,7 +774,7 @@ void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber, const Handle(
|
||||
}
|
||||
|
||||
algo_gauss.Solve(sec_member, sol);
|
||||
// iteration to refine the solution
|
||||
//alr iteration pour affiner la solution
|
||||
{
|
||||
math_Vector sol1(0,n_dimat-1);
|
||||
math_Vector sec_member1(0,n_dimat-1);
|
||||
@@ -778,6 +785,7 @@ void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber, const Handle(
|
||||
sol += sol1;
|
||||
}
|
||||
}
|
||||
//finalr
|
||||
|
||||
for(icoor=1; icoor<=3;icoor++){
|
||||
for(i=0;i<nCC1;i++) Solution(i).SetCoord (icoor, sol((icoor-1)*n_dimsousmat+i));
|
||||
@@ -1047,7 +1055,7 @@ gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const Standard_Inte
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Plate_Plate::CoefPol
|
||||
//purpose : give back the array of power basis coefficient of
|
||||
//purpose :give back the array of power basis coefficient of
|
||||
// the polynomial part of the Plate function
|
||||
//=======================================================================
|
||||
|
||||
@@ -1060,14 +1068,15 @@ gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const Standard_Inte
|
||||
{
|
||||
Coefs->ChangeValue(iu,iv) = Solution(i)*ddu[iu]*ddv[iv];
|
||||
//Coefs->ChangeValue(idu,idv) = Solution(i);
|
||||
// it is necessary to reset this line if one remove factors in method Polm.
|
||||
// il faut remettre cette ligne si on enleve ls facteurs dans
|
||||
// la methode Polm.
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Plate_Plate::Continuity
|
||||
//purpose : give back the continuity order of the Plate function
|
||||
//purpose :give back the continuity order of the Plate function
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Plate_Plate::Continuity() const
|
||||
@@ -1077,7 +1086,7 @@ gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const Standard_Inte
|
||||
|
||||
//=======================================================================
|
||||
//function : Plate_Plate::SolEm
|
||||
//purpose : compute the (iu,iv)th derivative of the fundamental solution
|
||||
//purpose : compute the (iu,iv)th derivative of the fondamental solution
|
||||
// of Laplcian at the power order
|
||||
//=======================================================================
|
||||
|
||||
@@ -1090,7 +1099,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
|
||||
if(iv>iu)
|
||||
{
|
||||
// SolEm is symmetric in (u<->v) : we swap u and v if iv>iu
|
||||
// SolEm is symetric in (u<->v) : we swap u and v if iv>iu
|
||||
// to avoid some code
|
||||
IU = iv;
|
||||
IV = iu;
|
||||
@@ -1126,8 +1135,8 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
|
||||
|
||||
//Standard_Real pr = pow(R, mm1 - IU - IV);
|
||||
// this expression takes a lot of time
|
||||
//(does not take into account a small integer value of the exponent)
|
||||
// cette expression prend beaucoup de temps
|
||||
//(ne tient pas compte de la petite valeur entiere de l'exposant)
|
||||
//
|
||||
|
||||
Standard_Integer expo = mm1 - IU - IV;
|
||||
@@ -1257,7 +1266,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real u2v2 = v2*U2;
|
||||
Standard_Real r2 = r*r;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
-100*ru2 + 48*L*ru2 + 140*m*ru2 - 100*L*m*ru2 - 60*m2*ru2 + 70*L*m2*ru2 + 8*m3*ru2 -
|
||||
20*L*m3*ru2 + 2*L*m4*ru2 - 300*rv2 + 144*L*rv2 + 420*m*rv2 - 300*L*m*rv2 - 180*m2*rv2 + 210*L*m2*rv2 +
|
||||
@@ -1282,7 +1291,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real u2v2 = v2*U2;
|
||||
Standard_Real r2 = r*r;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
1644*ru2 - 720*L*ru2 - 2700*m*ru2 + 1644*L*m*ru2 + 1530*m2*ru2 - 1350*L*m2*ru2 -
|
||||
360*m3*ru2 + 510*L*m3*ru2 + 30*m4*ru2 - 90*L*m4*ru2 + 6*L*m5*ru2 + 1644*rv2 - 720*L*rv2 - 2700*m*rv2 +
|
||||
@@ -1326,7 +1335,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real ru2 = R*U2;
|
||||
Standard_Real r2 = R*R;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
-600*ru2 + 288*L*ru2 + 840*m*ru2 - 600*L*m*ru2 - 360*m2*ru2 + 420*L*m2*ru2 + 48*m3*ru2 -
|
||||
120*L*m3*ru2 + 12*L*m4*ru2 + 33*r2 - 18*L*r2 - 36*m*r2 + 33*L*m*r2 + 9*m2*r2 - 18*L*m2*r2 + 3*L*m3*r2 +
|
||||
@@ -1355,7 +1364,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real ru4 = r*u4;
|
||||
Standard_Real r2v2 = r2*v2;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
6576*ru2v2 - 2880*L*ru2v2 - 10800*m*ru2v2 + 6576*L*m*ru2v2 + 6120*m2*ru2v2 - 5400*L*m2*ru2v2 -
|
||||
1440*m3*ru2v2 + 2040*L*m3*ru2v2 + 120*m4*ru2v2 - 360*L*m4*ru2v2 + 24*L*m5*ru2v2 + 1096*ru4 - 480*L*ru4 -
|
||||
@@ -1389,7 +1398,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real r2v2 = r2*v2;
|
||||
Standard_Real ru4 = r*u4;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
-42336*ru2v2 + 17280*L*ru2v2 + 77952*m*ru2v2 - 42336*L*m*ru2v2 - 52920*m2*ru2v2 +
|
||||
38976*L*m2*ru2v2 + 16800*m3*ru2v2 - 17640*L*m3*ru2v2 - 2520*m4*ru2v2 + 4200*L*m4*ru2v2 + 144*m5*ru2v2 -
|
||||
@@ -1425,7 +1434,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real r2 = R*R;
|
||||
Standard_Real ru2 = R*U2;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
-1000*ru2 + 480*L*ru2 + 1400*m*ru2 - 1000*L*m*ru2 - 600*m2*ru2 + 700*L*m2*ru2 + 80*m3*ru2 -
|
||||
200*L*m3*ru2 + 20*L*m4*ru2 + 165*r2 - 90*L*r2 - 180*m*r2 + 165*L*m*r2 + 45*m2*r2 - 90*L*m2*r2 + 15*L*m3*r2 +
|
||||
@@ -1448,7 +1457,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real r2 = r*r;
|
||||
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
5480*ru2 - 2400*L*ru2 - 9000*m*ru2 + 5480*L*m*ru2 + 5100*m2*ru2 - 4500*L*m2*ru2 - 1200*m3*ru2 +
|
||||
1700*L*m3*ru2 + 100*m4*ru2 - 300*L*m4*ru2 + 20*L*m5*ru2 - 750*r2 + 360*L*r2 + 1050*m*r2 - 750*L*m*r2 -
|
||||
@@ -1479,7 +1488,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real r2v2 = r2*v2;
|
||||
Standard_Real ru4 = r*u4;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
|
||||
-70560*ru2v2 + 28800*L*ru2v2 + 129920*m*ru2v2 - 70560*L*m*ru2v2 - 88200*m2*ru2v2 +
|
||||
@@ -1520,7 +1529,7 @@ Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu
|
||||
Standard_Real r2u2 = r2*U2;
|
||||
Standard_Real ru4 = r*u4;
|
||||
|
||||
// copy-paste the mathematics
|
||||
// copier-coller de mathematica
|
||||
DUV =
|
||||
16440*ru4 - 7200*L*ru4 - 27000*m*ru4 + 16440*L*m*ru4 + 15300*m2*ru4 - 13500*L*m2*ru4 -
|
||||
3600*m3*ru4 + 5100*L*m3*ru4 + 300*m4*ru4 - 900*L*m4*ru4 + 60*L*m5*ru4 - 4500*r2u2 + 2160*L*r2u2 + 6300*m*r2u2 -
|
||||
|
@@ -283,7 +283,6 @@ namespace
|
||||
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,
|
||||
@@ -299,9 +298,6 @@ 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;
|
||||
}
|
||||
@@ -521,12 +517,11 @@ void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape,
|
||||
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, theCappingStyle, theVolume);
|
||||
Standard_False, aDummy, aDummy, aDummy, theVolume);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -540,7 +535,6 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theCappingStyle,
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
@@ -578,20 +572,20 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
|
||||
if (aClosed.NbChildren() > 0)
|
||||
{
|
||||
shadeFromShape (aClosed, thePrs, theDrawer, theCappingStyle,
|
||||
shadeFromShape (aClosed, thePrs, theDrawer,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale, true);
|
||||
}
|
||||
|
||||
if (anOpened.NbChildren() > 0)
|
||||
{
|
||||
shadeFromShape (anOpened, thePrs, theDrawer, theCappingStyle,
|
||||
shadeFromShape (anOpened, thePrs, theDrawer,
|
||||
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, theCappingStyle,
|
||||
shadeFromShape (theShape, thePrs, theDrawer,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale,
|
||||
theVolume == StdPrs_Volume_Closed);
|
||||
}
|
||||
|
@@ -38,25 +38,13 @@ 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 Handle(Graphic3d_AspectFillCapping)& theCappingStyle = Handle(Graphic3d_AspectFillCapping)(),
|
||||
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 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 Handle(Graphic3d_AspectFillCapping)& theCappingStyle = Handle(Graphic3d_AspectFillCapping)(),
|
||||
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 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
|
||||
|
@@ -9309,7 +9309,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetUseObjectMaterial (toEnable == Standard_True);
|
||||
aClipPlane->SetUseObjectMaterial (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
@@ -9326,7 +9326,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetUseObjectTexture (toEnable == Standard_True);
|
||||
aClipPlane->SetUseObjectTexture (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
@@ -9341,7 +9341,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetUseObjectShader (toEnable == Standard_True);
|
||||
aClipPlane->SetUseObjectShader (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
@@ -9358,10 +9358,10 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
return 1;
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect aMat = aClipPlane->CappingSectionStyle()->Material();
|
||||
Graphic3d_MaterialAspect aMat = aClipPlane->CappingMaterial();
|
||||
aMat.SetAmbientColor (aColor);
|
||||
aMat.SetDiffuseColor (aColor);
|
||||
aClipPlane->CappingSectionStyle()->SetMaterial (aMat);
|
||||
aClipPlane->SetCappingMaterial (aMat);
|
||||
anArgIter += aNbParsed;
|
||||
}
|
||||
else if ((aChangeArg == "-transparency"
|
||||
@@ -9369,34 +9369,44 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
&& aNbChangeArgs >= 2)
|
||||
{
|
||||
TCollection_AsciiString aValStr (aChangeArgs[1]);
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect = aClipPlane->CappingAspect();
|
||||
if (aValStr.IsRealValue())
|
||||
{
|
||||
Graphic3d_MaterialAspect aMat = aClipPlane->CappingSectionStyle()->Material();
|
||||
Graphic3d_MaterialAspect aMat = aClipPlane->CappingMaterial();
|
||||
aMat.SetTransparency ((float )aValStr.RealValue());
|
||||
aClipPlane->CappingSectionStyle()->SetMaterial (aMat);
|
||||
anAspect->SetAlphaMode (Graphic3d_AlphaMode_BlendAuto);
|
||||
aClipPlane->SetCappingMaterial (aMat);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Syntax error at '" << aValStr << "'\n";
|
||||
return 1;
|
||||
aValStr.LowerCase();
|
||||
Graphic3d_AlphaMode aMode = Graphic3d_AlphaMode_BlendAuto;
|
||||
if (aValStr == "opaque")
|
||||
{
|
||||
aMode = Graphic3d_AlphaMode_Opaque;
|
||||
}
|
||||
else if (aValStr == "mask")
|
||||
{
|
||||
aMode = Graphic3d_AlphaMode_Mask;
|
||||
}
|
||||
else if (aValStr == "blend")
|
||||
{
|
||||
aMode = Graphic3d_AlphaMode_Blend;
|
||||
}
|
||||
else if (aValStr == "blendauto")
|
||||
{
|
||||
aMode = Graphic3d_AlphaMode_BlendAuto;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Syntax error at '" << aValStr << "'\n";
|
||||
return 1;
|
||||
}
|
||||
anAspect->SetAlphaMode (aMode);
|
||||
aClipPlane->SetCappingAspect (anAspect);
|
||||
}
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-overrideaspect"
|
||||
|| aChangeArg == "overrideaspect")
|
||||
{
|
||||
if (aNbChangeArgs < 2)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->SetToOverrideCappingAspect (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
else if (aChangeArg == "-texname"
|
||||
|| aChangeArg == "texname")
|
||||
{
|
||||
@@ -9410,22 +9420,20 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(aTextureName);
|
||||
if (!aTexture->IsDone())
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetTexture (Handle(Graphic3d_TextureMap)());
|
||||
aClipPlane->SetCappingTexture (NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTexture->EnableModulate();
|
||||
aTexture->EnableRepeat();
|
||||
aClipPlane->CappingSectionStyle()->SetTexture (aTexture.get());
|
||||
aClipPlane->SetCappingTexture (aTexture);
|
||||
}
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-texscale"
|
||||
|| aChangeArg == "texscale")
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->Texture();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
if (aClipPlane->CappingTexture().IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
@@ -9439,15 +9447,13 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
|
||||
Standard_ShortReal aSx = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
Standard_ShortReal aSy = (Standard_ShortReal)Draw::Atof (aChangeArgs[2]);
|
||||
aHatchTexture->GetParams()->SetScale (Graphic3d_Vec2 (aSx, aSy));
|
||||
aClipPlane->CappingTexture()->GetParams()->SetScale (Graphic3d_Vec2 (aSx, aSy));
|
||||
anArgIter += 2;
|
||||
}
|
||||
else if (aChangeArg == "-texorigin"
|
||||
|| aChangeArg == "texorigin") // texture origin
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->Texture();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
if (aClipPlane->CappingTexture().IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
@@ -9462,15 +9468,13 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
Standard_ShortReal aTx = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
Standard_ShortReal aTy = (Standard_ShortReal)Draw::Atof (aChangeArgs[2]);
|
||||
|
||||
aHatchTexture->GetParams()->SetTranslation (Graphic3d_Vec2 (aTx, aTy));
|
||||
aClipPlane->CappingTexture()->GetParams()->SetTranslation (Graphic3d_Vec2 (aTx, aTy));
|
||||
anArgIter += 2;
|
||||
}
|
||||
else if (aChangeArg == "-texrotate"
|
||||
|| aChangeArg == "texrotate") // texture rotation
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->Texture();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
if (aClipPlane->CappingTexture().IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
@@ -9483,7 +9487,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
}
|
||||
|
||||
Standard_ShortReal aRot = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
aHatchTexture->GetParams()->SetRotation (aRot);
|
||||
aClipPlane->CappingTexture()->GetParams()->SetRotation (aRot);
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-hatch"
|
||||
@@ -9495,165 +9499,22 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
TCollection_AsciiString aHatchStr (aChangeArgs[1]);
|
||||
aHatchStr.LowerCase();
|
||||
if (aHatchStr == "on")
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetToDrawHatch (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
aClipPlane->SetCappingHatchOn();
|
||||
}
|
||||
}
|
||||
else if (aChangeArg == "-hatchtexture"
|
||||
|| aChangeArg == "hatchtexture")
|
||||
{
|
||||
if (aNbChangeArgs < 2)
|
||||
else if (aHatchStr == "off")
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aTextureName (aChangeArgs[1]);
|
||||
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(aTextureName);
|
||||
if (!aTexture->IsDone())
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetHatchStyle (Handle(Graphic3d_TextureMap)());
|
||||
aClipPlane->SetCappingHatchOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
aTexture->EnableModulate();
|
||||
aTexture->EnableRepeat();
|
||||
aClipPlane->CappingSectionStyle()->SetHatchStyle (aTexture.get());
|
||||
aClipPlane->CappingSectionStyle()->SetToDrawHatch (true);
|
||||
aClipPlane->SetCappingHatch ((Aspect_HatchStyle)Draw::Atoi (aChangeArgs[1]));
|
||||
}
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-hatchstipple"
|
||||
|| aChangeArg == "hatchstipple")
|
||||
{
|
||||
if (aNbChangeArgs < 2)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
aClipPlane->CappingSectionStyle()->SetHatchStyle ((Aspect_HatchStyle)Draw::Atoi (aChangeArgs[1]));
|
||||
aClipPlane->CappingSectionStyle()->SetToDrawHatch (true);
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-hatchcolor"
|
||||
|| aChangeArg == "hatchcolor")
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
Standard_Integer aNbParsed = ViewerTest::ParseColor (aNbChangeArgs - 1,
|
||||
aChangeArgs + 1,
|
||||
aColor);
|
||||
if (aNbParsed == 0)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect aMat = aClipPlane->CappingSectionStyle()->HatchMaterial();
|
||||
aMat.SetAmbientColor (aColor);
|
||||
aMat.SetDiffuseColor (aColor);
|
||||
aClipPlane->CappingSectionStyle()->SetHatchMaterial (aMat);
|
||||
anArgIter += aNbParsed;
|
||||
}
|
||||
|
||||
else if (aChangeArg == "-hatchscale"
|
||||
|| aChangeArg == "hatchscale")
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->TextureHatch();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aNbChangeArgs < 3)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_ShortReal aSx = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
Standard_ShortReal aSy = (Standard_ShortReal)Draw::Atof (aChangeArgs[2]);
|
||||
aHatchTexture->GetParams()->SetScale (Graphic3d_Vec2 (aSx, aSy));
|
||||
anArgIter += 2;
|
||||
}
|
||||
else if (aChangeArg == "-hatchorigin"
|
||||
|| aChangeArg == "hatchorigin") // texture origin
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->TextureHatch();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aNbChangeArgs < 3)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_ShortReal aTx = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
Standard_ShortReal aTy = (Standard_ShortReal)Draw::Atof (aChangeArgs[2]);
|
||||
|
||||
aHatchTexture->GetParams()->SetTranslation (Graphic3d_Vec2 (aTx, aTy));
|
||||
anArgIter += 2;
|
||||
}
|
||||
else if (aChangeArg == "-hatchrotate"
|
||||
|| aChangeArg == "hatchrotate") // texture rotation
|
||||
{
|
||||
const Handle(Graphic3d_TextureMap)& aHatchTexture = aClipPlane->CappingSectionStyle()->TextureHatch();
|
||||
|
||||
if (aHatchTexture.IsNull())
|
||||
{
|
||||
std::cout << "Error: no texture is set.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aNbChangeArgs < 2)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_ShortReal aRot = (Standard_ShortReal)Draw::Atof (aChangeArgs[1]);
|
||||
aHatchTexture->GetParams()->SetRotation (aRot);
|
||||
anArgIter += 1;
|
||||
}
|
||||
else if (aChangeArg == "-hatchzoompers"
|
||||
|| aChangeArg == "hatchzoompers")
|
||||
{
|
||||
if (aNbChangeArgs < 2)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetHatchZoomPeristent (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
else if (aChangeArg == "-hatchrotatepers"
|
||||
|| aChangeArg == "hatchrotatepers")
|
||||
{
|
||||
if (aNbChangeArgs < 2)
|
||||
{
|
||||
std::cout << "Syntax error: need more arguments.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
|
||||
{
|
||||
aClipPlane->CappingSectionStyle()->SetHatchRotationPeristent (toEnable == Standard_True);
|
||||
anArgIter += 1;
|
||||
}
|
||||
}
|
||||
else if (aChangeArg == "-delete"
|
||||
|| aChangeArg == "delete")
|
||||
{
|
||||
@@ -13800,16 +13661,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: [-color R G B] [-transparency Value] [-hatch {on|off|ID}]"
|
||||
"\n\t\t: [-texName Texture] [-texScale SX SY] [-texOrigin TX TY]"
|
||||
"\n\t\t: [-texRotate Angle]"
|
||||
/*"\n\t\t: [-overrideAspect {0|1}]"
|
||||
"\n\t\t: [-color R G B]"
|
||||
"\n\t\t: [-texture Texture] [-texScale SX SY]"
|
||||
"\n\t\t: [-texOrigin TX TY] [-texRotate Angle]"
|
||||
"\n\t\t: [-hatch {on|off}] [-hatchStipple mask]"
|
||||
"\n\t\t: [-hatchColor R G B] [-hatchTexture texture]"
|
||||
"\n\t\t: [-hatchScale SX SY] [-hatchOrigin TX TY]"
|
||||
"\n\t\t: [-hatchRotate Angle]"
|
||||
"\n\t\t: [-hatchZoomPers {0|1}]"
|
||||
"\n\t\t: [-hatchRotatePers {0|1}]"*/
|
||||
"\n\t\t: [-useObjMaterial {0|1}] [-useObjTexture {0|1}]"
|
||||
"\n\t\t: [-useObjShader {0|1}]"
|
||||
"\n\t\t: Clipping planes management:"
|
||||
@@ -13822,22 +13673,13 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -clone SourcePlane NewPlane clone the plane definition."
|
||||
"\n\t\t: Capping options:"
|
||||
"\n\t\t: -capping {off|on|0|1} turn capping on/off"
|
||||
"\n\t\t: -overrideAspect override presentation aspect (if defined)"
|
||||
"\n\t\t: -color R G B set capping color"
|
||||
"\n\t\t: -transparency Value set capping transparency 0..1"
|
||||
"\n\t\t: -texName Texture set capping texture"
|
||||
"\n\t\t: -texScale SX SY set capping tex scale"
|
||||
"\n\t\t: -texOrigin TX TY set capping tex origin"
|
||||
"\n\t\t: -texRotate Angle set capping tex rotation"
|
||||
"\n\t\t: -hatch {on|off} turn on/off hatch style on capping"
|
||||
"\n\t\t: -hatchStipple ID set stipple mask for drawing hatch"
|
||||
"\n\t\t: -hatchColor R G B set color for hatch material"
|
||||
"\n\t\t: -hatchTexture Texture set texture (semi-opaque) for drawing hatch"
|
||||
"\n\t\t: -hatchScale SX SY set hatch texture scale"
|
||||
"\n\t\t: -hatchOrigin TX TY set hatch texture origin"
|
||||
"\n\t\t: -hatchRotate Angle set hatch texture rotation"
|
||||
"\n\t\t: -hatchZoomPers allow hatch tetxure mapping to be constant when zooming"
|
||||
"\n\t\t: -hatchRotatePers allow hatch tetxure mapping to be constant when rotating"
|
||||
"\n\t\t: -hatch {on|off|ID} set capping hatching mask"
|
||||
"\n\t\t: -useObjMaterial {off|on|0|1} use material of clipped object"
|
||||
"\n\t\t: -useObjTexture {off|on|0|1} use texture of clipped object"
|
||||
"\n\t\t: -useObjShader {off|on|0|1} use shader program of object",
|
||||
|
@@ -221,7 +221,7 @@ void XCAFPrs_DocumentExplorer::Init (const Handle(TDocStd_Document)& theDocument
|
||||
const XCAFPrs_DocumentExplorerFlags theFlags,
|
||||
const XCAFPrs_Style& theDefStyle)
|
||||
{
|
||||
if ((theFlags & XCAFPrs_DocumentExplorerFlags_NoStyle) == 0)
|
||||
if ((theFlags & XCAFPrs_DocumentExplorerFlags_NoStyle) != 0)
|
||||
{
|
||||
myColorTool = XCAFDoc_DocumentTool::ColorTool (theDocument->Main());
|
||||
}
|
||||
@@ -230,6 +230,7 @@ void XCAFPrs_DocumentExplorer::Init (const Handle(TDocStd_Document)& theDocument
|
||||
myColorTool.Nullify();
|
||||
}
|
||||
|
||||
///myColorTool = theColorTool;
|
||||
myDefStyle = theDefStyle;
|
||||
myRoots = theRoots;
|
||||
myRootIter = TDF_LabelSequence::Iterator (myRoots);
|
||||
@@ -262,7 +263,7 @@ void XCAFPrs_DocumentExplorer::initRoot()
|
||||
if (aRootLab.IsNull())
|
||||
{
|
||||
// assert - invalid input
|
||||
//Standard_ProgramError::Raise ("XCAFPrs_DocumentExplorer - NULL label in the input");
|
||||
//Standard_ProgramError::Raise ("CadDocumentExplorer - NULL label in the input");
|
||||
myRootIter.Next();
|
||||
continue;
|
||||
}
|
||||
@@ -293,7 +294,7 @@ void XCAFPrs_DocumentExplorer::initCurrent (Standard_Boolean theIsAssmebly)
|
||||
{
|
||||
if (myTop < 0)
|
||||
{
|
||||
Standard_ProgramError::Raise ("XCAFPrs_DocumentExplorer - internal error");
|
||||
Standard_ProgramError::Raise ("CadDocumentExplorer - internal error");
|
||||
}
|
||||
myCurrent = myNodeStack.Value (myTop);
|
||||
}
|
||||
@@ -333,7 +334,7 @@ void XCAFPrs_DocumentExplorer::Next()
|
||||
{
|
||||
if (!myHasMore)
|
||||
{
|
||||
Standard_ProgramError::Raise ("XCAFPrs_DocumentExplorer::Next() - out of range");
|
||||
Standard_ProgramError::Raise ("CadDocumentExplorer::Next() - out of range");
|
||||
return; // assert
|
||||
}
|
||||
|
||||
|
19
tests/bugs/mesh/bug26074
Normal file
19
tests/bugs/mesh/bug26074
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "========="
|
||||
puts "0026074: BRepMesh_IncrementalMesh meshes a specific shape for a long time"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
set ::env(CSF_MeshAlgo) 1
|
||||
|
||||
restore [locate_data_file bug26074.brep] result
|
||||
tclean result
|
||||
|
||||
incmesh result 0.01116 -a 15 -parallel
|
||||
checktrinfo result -tri
|
||||
|
||||
vinit
|
||||
vsetdispmode 1
|
||||
vdefaults -autoTriang 0
|
||||
vdisplay result
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
19
tests/bugs/mesh/bug29506
Normal file
19
tests/bugs/mesh/bug29506
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "========="
|
||||
puts "0029506: DRAW command 'incmesh' hangs on the attached planar face with specified deflection."
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
set ::env(CSF_MeshAlgo) 1
|
||||
|
||||
restore [locate_data_file bug29506.brep] result
|
||||
tclean result
|
||||
|
||||
incmesh result 1e-6
|
||||
checktrinfo result -tri 44437 -nod 44437 -defl 9.9999999999999995e-07
|
||||
|
||||
vinit
|
||||
vsetdispmode 1
|
||||
vdefaults -autoTriang 0
|
||||
vdisplay result
|
||||
vfit
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
@@ -46,7 +46,6 @@ vclipplane change pln2 equation -0.707 0.707 0 -25
|
||||
vclipplane change pln2 capping on
|
||||
vclipplane change pln2 capping color 0.5 0.5 0.9
|
||||
vclipplane change pln2 capping hatch on
|
||||
vclipplane change pln2 capping hatchStipple 7
|
||||
vclipplane set pln2 object b3
|
||||
|
||||
checkcolor $x3_coord $y3_coord 0.5 0.5 0.9
|
||||
|
@@ -71,5 +71,5 @@ vdisplay pp1 pp2
|
||||
vzoom 0.8
|
||||
|
||||
puts "Enable capping planes"
|
||||
vclipplane pln1 -set -equation 0 0 -1 $aPln1Z -capping 1 -color 0.5 0.5 0.5 -hatchtexture $aHatch -hatchscale 0.02 -0.02 -useObjMaterial 1
|
||||
vclipplane pln2 -set -equation 0 1 0 [expr -$aPln2Y] -capping 1 -color 0.8 0.8 0.9 -hatchtexture $aHatch -hatchscale 0.02 -0.02
|
||||
vclipplane pln1 -set -equation 0 0 -1 $aPln1Z -capping 1 -color 0.5 0.5 0.5 -texname $aHatch -texscale 0.02 -0.02 -useObjMaterial 1
|
||||
vclipplane pln2 -set -equation 0 1 0 [expr -$aPln2Y] -capping 1 -color 0.8 0.8 0.9 -texname $aHatch -texscale 0.02 -0.02
|
||||
|
Reference in New Issue
Block a user