Comments (7)
Oh my god, it worked with __stdcall
. I'm out. Thanks for the booth 🙂
from libfive.
For what it's worth, this other test segment passes:
//home/lee/Code/lee/libfivejs/index.js:234.1,251.2
{
let str = "libfive_tree_print ";
const a = x();
const b = y();
const c = z();
const a2 = a.square();
const b2 = b.square();
const c2 = c.square();
const r_ = a2.add(b2);
const r = r_.add(c2);
const d = r.sub(1.0);
const ptr = d.toString();
if (ptr !== "(- (+ (square x) (square y) (square z)) 1)") throw Fail;
str += "passed";
console.log(str);
}
(Same test, just more idiomatic)
//home/lee/Code/lee/libfivejs/index.js:258.2,253.1
// Again, but more golfy :)
{
const [a,b,c] = [x(),y(),z()].map((d) => d.square());
const r = a.add(b).add(c).sub(1.0);
if (r.toString() !== "(- (+ (square x) (square y) (square z)) 1)") throw Fail;
}
from libfive.
libfive_tree_save_mesh
also works... properly outputs a cube. Hm.
from libfive.
Does it maybe have something to do with new libfive_mesh
? Is this equivalent to malloc'ing?
from libfive.
I'm thinking that everything is working fine, and it's the FFI (https://koffi.dev) which is having problems, potentially with what I mentioned...
Edit: Could it do with the call type you think? i.e. fastcall, stdcall, etc
Edit: the more I research, the more I think that maybe using new
from C++ is a bit of problem when providing the C api, although logically I don't understand why. It should be fine.
Edit: nope, changing it to malloc didnt do the trick.A
Edit: Yeah ok, adding an "output" argument onto render_mesh makes it work. I think the issue is this FFI system doesn't support using pointers as return types, unless they're opaque (in which case you don't access them) or strings (which it handles just fine).... gah, that really sucks, because everything else works!
Edit: So https://github.com/Koromix/rygel/blob/dd1cefe9c8e4efbff7c8b2ab71fcde21a0e81323/src/koffi/src/call.cc#L953 must be the reason. Anything allocated outside of the nodejs context is marked "External", otherwise, using output parameters, it's possible to have much more type information... Not sure how to fix it though.
Edit: from what I understand, it makes the most sense is beneficial for these systems to allocate and deallocate memory and pass these objects to the API. Then the GC can take care of things
from libfive.
Welp, upon revisiting this morning, it appears I was just very tired, and what I saw was just my old custom change to libfive working... So back to being screwed :). At least I can do mostly everything but this is necessary if I want to have a somewhat performant rendering loop (I'm going to use node-sdl with it). Is it possible to provide alternatives that take in output parameter pointers?
from libfive.
from libfive.
Related Issues (20)
- Double free or corruption error when trying to use libfive HOT 3
- Expose normals in libfive_mesh HOT 2
- Does Mesh::render consume the libfive_tree? HOT 3
- Unioning nothing at the top level causes things to mesh very slow HOT 6
- koffi and ffi-napi both segfault when meshing non-trivial models HOT 6
- Publish new release and set soversion for building shared libraries
- I've packaged this for OpenSuse
- Feature resolution is unexpectedly impacted by the size of the bounding box HOT 3
- Crash in DCTree<3u>::intersection
- QSocketNotifier error message
- Need precompiled Windows binaries of any kind HOT 4
- missing 'g++' package in Ubuntu instructions HOT 1
- Symbol visibility
- C5H12 is either moved or deleted
- cmake fails because python's distutil is obsolete as of 3.12 - possible workaround included
- Make fails on heightmap.cpp.o with "integer value -1 outside valid range" HOT 1
- stack overflow of interval evaluation HOT 1
- Interval evaluation bug HOT 1
- Compiling error: Could not find a package configuration file provided by "Qt5OpenGL" - Help?
- Illegal Instruction when compiling libfive with MXE and using in Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libfive.