Skip to content

Commit

Permalink
custom node-pre-gyp + cherry pick
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymarion committed Dec 8, 2020
1 parent 6914eb9 commit bbca9fb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/OCC.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <BRep_Tool.hxx>
#include <BRepCheck_Analyzer.hxx>

#include <BRepMesh.hxx>
//#include <BRepMesh.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRepMesh_FastDiscret.hxx>

Expand Down Expand Up @@ -175,4 +175,4 @@
#define OUTER_SHELL(x) BRepClass3d::OuterShell(x)
#endif

#undef Handle
#undef Handle
9 changes: 8 additions & 1 deletion src/ShapeFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1245,12 +1245,20 @@ static int chamfer(Solid* pNewSolid, Solid* pSolid, const std::vector<Edge*>& 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 {
Expand Down Expand Up @@ -1391,4 +1399,3 @@ NAN_METHOD(ShapeFactory::makePipe)




20 changes: 14 additions & 6 deletions src/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,42 @@ inline v8::Local<v8::Value> makeArrayBuffer(int length) {
return array_buffer.ToLocalChecked();
}

template <typename T,class V> T* getArrayData(V&& value) {
#if (V8_MAJOR_VERSION >= 8)
return (T*)(static_cast<char*>(value->Buffer()->GetBackingStore()->Data()) + value->ByteOffset());
#else
return (T*)(static_cast<char*>(value->Buffer()->GetContents().Data()) + value->ByteOffset());
#endif
}

#define IS_FLOAT32ARRAY(value) (value->IsFloat32Array() && (value.As<v8::Float32Array>()->Length() == 2))
#define GET_FLOAT32ARRAY_DATA(value) (float*)(static_cast<char*>(value.As<v8::Float32Array>()->Buffer()->GetContents().Data()) + value.As<v8::Float32Array>()->ByteOffset())
#define GET_FLOAT32ARRAY_DATA(value) getArrayData<float>(value.As<v8::Float32Array>())
#define IS_FLOAT32ARRAY_ARRAY(value) (value->IsFloat32Array() && ((value.As<v8::Float32Array>()->Length() % 2) == 0))
#define GET_FLOAT32ARRAY_ARRAY_DATA(value) GET_FLOAT32ARRAY_DATA(value)
#define GET_FLOAT32ARRAY_ARRAY_LENGTH(value) (value.As<v8::Float32Array>()->Length())


#define IS_INT32ARRAY(value) (value->IsInt32Array() && (value.As<v8::Int32Array>()->Length() == 2))
#define GET_INT32ARRAY_DATA(value) (int*)(static_cast<char*>(value.As<v8::Int32Array>()->Buffer()->GetContents().Data()) + value.As<v8::Int32Array>()->ByteOffset())
#define GET_INT32ARRAY_DATA(value) getArrayData<int32_t>(value.As<v8::Int32Array>())
#define IS_INT32ARRAY_ARRAY(value) (value->IsInt32Array() && ((value.As<v8::Int32Array>()->Length() % 2) == 0))
#define GET_INT32ARRAY_ARRAY_DATA(value) GET_INT32ARRAY_DATA(value)
#define GET_INT32ARRAY_ARRAY_LENGTH(value) (value.As<v8::Int32Array>()->Length())

#define IS_UINT32ARRAY(value) (value->IsUint32Array() && (value.As<v8::Uint32Array>()->Length() == 2))
#define GET_UINT32ARRAY_DATA(value) (unsigned int*)(static_cast<char*>(value.As<v8::Uint32Array>()->Buffer()->GetContents().Data()) + value.As<v8::Uint32Array>()->ByteOffset())
#define GET_UINT32ARRAY_DATA(value) getArrayData<uint32_t>(value.As<v8::Uint32Array>())
#define IS_UINT32ARRAY_ARRAY(value) (value->IsUint32Array() && ((value.As<v8::Uint32Array>()->Length() % 2) == 0))
#define GET_UINT32ARRAY_ARRAY_DATA(value) GET_UINT32ARRAY_DATA(value)
#define GET_UINT32ARRAY_ARRAY_LENGTH(value) (value.As<v8::Uint32Array>()->Length())


#define IS_UINT16ARRAY(value) (value->IsUint16Array() && (value.As<v8::Uint16Array>()->Length() == 2))
#define GET_UINT16ARRAY_DATA(value) (unsigned short*)(static_cast<char*>(value.As<v8::Uint16Array>()->Buffer()->GetContents().Data()) + value.As<v8::Uint16Array>()->ByteOffset())
#define GET_UINT16ARRAY_DATA(value) getArrayData<uint16_t>(value.As<v8::Uint16Array>())
#define IS_UINT16ARRAY_ARRAY(value) (value->IsUint32Array() && ((value.As<v8::Uint16Array>()->Length() % 2) == 0))
#define GET_UINT16ARRAY_ARRAY_DATA(value) GET_UINT16ARRAY_DATA(value)
#define GET_UINT16ARRAY_ARRAY_LENGTH(value) (value.As<v8::Uint16Array>()->Length())

#define IS_UINT8ARRAY(value) (value->IsUint8Array() && (value.As<v8::Uint8Array>()->Length() == 2))
#define GET_UINT8ARRAY_DATA(value) (unsigned char*)(static_cast<char*>(value.As<v8::Uint8Array>()->Buffer()->GetContents().Data()) + value.As<v8::Uint8Array>()->ByteOffset())
#define GET_UINT8ARRAY_DATA(value) getArrayData<uint8_t>(value.As<v8::Uint8Array>())
#define IS_UINT8ARRAY_ARRAY(value) (value->IsUint8Array() && ((value.As<v8::Uint8Array>()->Length() % 2) == 0))
#define GET_UINT8ARRAY_ARRAY_DATA(value) GET_UINT8ARRAY_DATA(value)
#define GET_UINT8ARRAY_ARRAY_LENGTH(value) (value.As<v8::Uint8Array>()->Length())
Expand Down Expand Up @@ -224,4 +232,4 @@ template<class T> NAN_METHOD(_NewInstance) {
auto instance = Nan::NewInstance(Constructor<T>(),argc,argv);
delete [] argv;
info.GetReturnValue().Set(instance.ToLocalChecked());
}
}

0 comments on commit bbca9fb

Please sign in to comment.