diff --git a/.travis.yml b/.travis.yml index 70e77a2..8aac7df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ language: cpp -dist: bionic // 18.04 +dist: bionic os: - linux - osx env: - NODE_PRE_GYP_GITHUB_TOKEN: - secure: QLn52YaMzobrIzERHGZ3AL32uLr6RN9FfkMwenFOA8SXjGecZ8WXBZq+xg3QLwW/rRb4FWO2Dd83Djrbj5X+NfW82H6YXoLRWKmTxRfqeIJ47BdXi8DYXLrEAOZs6LcIcJ/A2oM64UIJtb4gKnKze3dfxGAIciBQA+tjNqfc6kvtzUGnXDJ/9HSOG6YbqZiZtUtPTK1f5OElhPFeQL1OkqMLQp5E0lqzQG/+b0Rkx6AX+kDSga7vSmG7CWjXanHjaeCvy6lIAAzLpRWuE43oN0USWMAynAlZ9bWt2Fj7KNv63wUmIgK2ykOFCGZK15HEJjoT4TVmEa6FH6A76KLUFm/sSEgLpGe8C3mWpIjQdoLQbw5xEl1bFWfM/3Yyg7Qx/b6bAnuhnocqsEd+eoYE80KdxC2CUziRSq0dwzhvWT92SJKyuOVHPMnij/vGKeRup4jcuzdRwwyibD0osQG3JiPkSwVeQQ4gtPHvRdfo8I/8KV55UX0wdhq29HMkh7o4bBMd/ywiw5LZb5yXPhIXGfUn2hh1ODo+N7zb3NZt03TTE/igFL1exZIn6eiSrTzcUtkEiQKrSnVTq1Afom2slOoTpE+LtrWPKIlXde6fF50wKvu6x8KpwmikZUMsCNdTDGI9Xfh3Zx0O+PsEn7/HkRv8Wy5E3hGTn1piksypqXU= matrix: - TRAVIS_NODE_VERSION="8" - TRAVIS_NODE_VERSION="9" diff --git a/src/OCC.h b/src/OCC.h index e8dcf16..3a58b18 100644 --- a/src/OCC.h +++ b/src/OCC.h @@ -8,7 +8,7 @@ #include #include -#include +//#include #include #include @@ -175,4 +175,4 @@ #define OUTER_SHELL(x) BRepClass3d::OuterShell(x) #endif -#undef Handle +#undef Handle \ No newline at end of file diff --git a/src/ShapeFactory.cc b/src/ShapeFactory.cc index 4d3fe63..32be1a3 100644 --- a/src/ShapeFactory.cc +++ b/src/ShapeFactory.cc @@ -1245,12 +1245,20 @@ static int chamfer(Solid* pNewSolid, Solid* pSolid, const std::vector& ed if (distances_size == 1) { // single distance +#if (OCC_VERSION_MAJOR ==7 && OCC_VERSION_MINOR <=3) CF.Add(distances[0], edge, face); +#else + CF.Add(edge); +#endif } else if (distances_size == edges_size) { // distance given for each edge +#if (OCC_VERSION_MAJOR ==7 && OCC_VERSION_MINOR <=3) CF.Add(distances[i], edge, face); +#else + CF.Add(edge); +#endif } else { @@ -1391,4 +1399,3 @@ NAN_METHOD(ShapeFactory::makePipe) - diff --git a/src/Util.h b/src/Util.h index 68f842b..69891a2 100644 --- a/src/Util.h +++ b/src/Util.h @@ -82,34 +82,42 @@ inline v8::Local makeArrayBuffer(int length) { return array_buffer.ToLocalChecked(); } +template T* getArrayData(V&& value) { + #if (V8_MAJOR_VERSION >= 8) + return (T*)(static_cast(value->Buffer()->GetBackingStore()->Data()) + value->ByteOffset()); + #else + return (T*)(static_cast(value->Buffer()->GetContents().Data()) + value->ByteOffset()); + #endif +} + #define IS_FLOAT32ARRAY(value) (value->IsFloat32Array() && (value.As()->Length() == 2)) -#define GET_FLOAT32ARRAY_DATA(value) (float*)(static_cast(value.As()->Buffer()->GetContents().Data()) + value.As()->ByteOffset()) +#define GET_FLOAT32ARRAY_DATA(value) getArrayData(value.As()) #define IS_FLOAT32ARRAY_ARRAY(value) (value->IsFloat32Array() && ((value.As()->Length() % 2) == 0)) #define GET_FLOAT32ARRAY_ARRAY_DATA(value) GET_FLOAT32ARRAY_DATA(value) #define GET_FLOAT32ARRAY_ARRAY_LENGTH(value) (value.As()->Length()) #define IS_INT32ARRAY(value) (value->IsInt32Array() && (value.As()->Length() == 2)) -#define GET_INT32ARRAY_DATA(value) (int*)(static_cast(value.As()->Buffer()->GetContents().Data()) + value.As()->ByteOffset()) +#define GET_INT32ARRAY_DATA(value) getArrayData(value.As()) #define IS_INT32ARRAY_ARRAY(value) (value->IsInt32Array() && ((value.As()->Length() % 2) == 0)) #define GET_INT32ARRAY_ARRAY_DATA(value) GET_INT32ARRAY_DATA(value) #define GET_INT32ARRAY_ARRAY_LENGTH(value) (value.As()->Length()) #define IS_UINT32ARRAY(value) (value->IsUint32Array() && (value.As()->Length() == 2)) -#define GET_UINT32ARRAY_DATA(value) (unsigned int*)(static_cast(value.As()->Buffer()->GetContents().Data()) + value.As()->ByteOffset()) +#define GET_UINT32ARRAY_DATA(value) getArrayData(value.As()) #define IS_UINT32ARRAY_ARRAY(value) (value->IsUint32Array() && ((value.As()->Length() % 2) == 0)) #define GET_UINT32ARRAY_ARRAY_DATA(value) GET_UINT32ARRAY_DATA(value) #define GET_UINT32ARRAY_ARRAY_LENGTH(value) (value.As()->Length()) #define IS_UINT16ARRAY(value) (value->IsUint16Array() && (value.As()->Length() == 2)) -#define GET_UINT16ARRAY_DATA(value) (unsigned short*)(static_cast(value.As()->Buffer()->GetContents().Data()) + value.As()->ByteOffset()) +#define GET_UINT16ARRAY_DATA(value) getArrayData(value.As()) #define IS_UINT16ARRAY_ARRAY(value) (value->IsUint32Array() && ((value.As()->Length() % 2) == 0)) #define GET_UINT16ARRAY_ARRAY_DATA(value) GET_UINT16ARRAY_DATA(value) #define GET_UINT16ARRAY_ARRAY_LENGTH(value) (value.As()->Length()) #define IS_UINT8ARRAY(value) (value->IsUint8Array() && (value.As()->Length() == 2)) -#define GET_UINT8ARRAY_DATA(value) (unsigned char*)(static_cast(value.As()->Buffer()->GetContents().Data()) + value.As()->ByteOffset()) +#define GET_UINT8ARRAY_DATA(value) getArrayData(value.As()) #define IS_UINT8ARRAY_ARRAY(value) (value->IsUint8Array() && ((value.As()->Length() % 2) == 0)) #define GET_UINT8ARRAY_ARRAY_DATA(value) GET_UINT8ARRAY_DATA(value) #define GET_UINT8ARRAY_ARRAY_LENGTH(value) (value.As()->Length()) @@ -224,4 +232,4 @@ template NAN_METHOD(_NewInstance) { auto instance = Nan::NewInstance(Constructor(),argc,argv); delete [] argv; info.GetReturnValue().Set(instance.ToLocalChecked()); -} +} \ No newline at end of file