Skip to content

Commit

Permalink
Fix compilation with OCCT 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rainman110 committed Dec 7, 2023
1 parent e2ac77d commit d35551e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 4 additions & 5 deletions TIGLViewer/src/TIGLAISTriangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,21 @@ void TIGLAISTriangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& a
);


gp_Vec3f aNormal;
if (hasVNormals) {
if (hasVColors) {
const TColStd_Array1OfInteger& colors = myColor->Array1();
for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) {
anArray->AddVertex(myTriangulation->Node(i), AttenuateColor(colors(i), ambient));
myTriangulation->Normal(i, aNormal);
anArray->SetVertexNormal(i, aNormal.x(), aNormal.y(), aNormal.z());
auto aNormal = myTriangulation->Normal(i);
anArray->SetVertexNormal(i, aNormal.X(), aNormal.Y(), aNormal.Z());
}
}
// !hasVColors
else {
for (int i = 1; i <= myTriangulation->NbNodes(); i++ ) {
anArray->AddVertex(myTriangulation->Node(i));
myTriangulation->Normal(i, aNormal);
anArray->SetVertexNormal(i, aNormal.x(), aNormal.y(), aNormal.z());
auto aNormal = myTriangulation->Normal(i);
anArray->SetVertexNormal(i, aNormal.X(), aNormal.Y(), aNormal.Z());

}
}
Expand Down
11 changes: 11 additions & 0 deletions src/common/tiglcommonfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@
#include "TopTools_IndexedMapOfShape.hxx"
#include "TopTools_HSequenceOfShape.hxx"
#include "GeomAdaptor_Curve.hxx"

#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,6,0)
#include "BRepAdaptor_CompCurve.hxx"
#else
#include "BRepAdaptor_HCompCurve.hxx"
#endif

#include "BRepAdaptor_Curve.hxx"
#include "GCPnts_AbscissaPoint.hxx"
#include "BRep_Builder.hxx"
Expand Down Expand Up @@ -1102,8 +1108,13 @@ TopoDS_Face BuildRuledFace(const TopoDS_Wire& wire1, const TopoDS_Wire& wire2)

// Wrap the adaptor in a class which manages curve access via handle (HCurve). According to doxygen
// this is required by the algorithms
#if OCC_VERSION_HEX >= VERSION_HEX_CODE(7,6,0)
const Handle(Adaptor3d_Curve) curve1 = new BRepAdaptor_CompCurve(compCurve1);
const Handle(Adaptor3d_Curve) curve2 = new BRepAdaptor_CompCurve(compCurve2);
#else
Handle(Adaptor3d_HCurve) curve1 = new BRepAdaptor_HCompCurve(compCurve1);
Handle(Adaptor3d_HCurve) curve2 = new BRepAdaptor_HCompCurve(compCurve2);
#endif

// We have to generate an approximated curve now from the wire using the adaptor
// NOTE: last parameter value unknown
Expand Down

0 comments on commit d35551e

Please sign in to comment.