Conversation
tools/generate.js
Outdated
| // @todo Verify Structs that have array properties | ||
| 'VrStereoConfig', // Matrix[2], float[2] | ||
| 'BoneInfo', // char[32] | ||
| 'VrDeviceInfo', // float[4] | ||
| 'Material', // float[4] | ||
|
|
||
| // raymath | ||
| // @todo Fix helper structs for float arrays | ||
| 'Vector3ToFloatV', // float3 | ||
| 'MatrixToFloatV' // float16 |
There was a problem hiding this comment.
Need to fix porting the array types.
There was a problem hiding this comment.
so I tried to do some work on this front - but ended up throwing out the changes. my understanding of types there was a little wrong. looking at the structs in question - i don't see a need to implicitly cast to/from a JS array anywhere for these unless a user really wanted to manipulate this data manually. I think we can get by with simply casting the pointers for these types into uint64_t, and then (float[]) or what the proper syntax might be on the way into C++.
for Matrix/Vector3V - can these just be implemented in JS? or does raylib do anything extra under the hood when making these?
There was a problem hiding this comment.
Maybe be difficult to handle directly through the generator. We could likely put together wrapper functions for them though. Similar to the Shader ones you did.
Arrays can be passed by value as arrays in C++, but returned as pointers. Certainly not the best.
There was a problem hiding this comment.
Could we do it in js wrapper-space? Like how ref-array-napi does it?
|
[ 96%] Building CXX object CMakeFiles/node-raylib.dir/src/generated/node-raylib.cc.o |
|
I'm not sure I totally follow what changes are being made and what is failing, but I'd like to help. Is the issue that the generated code uses |
|
I got it to build by hand-editing this: inline BoneInfo BoneInfoFromValue(const Napi::CallbackInfo& info, int index) {
return {
(char) pointerFromValue(info, index + 0),
charFromValue(info, index + 1)
};
}instead of inline BoneInfo BoneInfoFromValue(const Napi::CallbackInfo& info, int index) {
return {
pointerFromValue(info, index + 0),
charFromValue(info, index + 1)
};
}Not sure if that will actually work right, but might lead to a solution. |
|
I added a small change that gets it building in a542777 but I'm really not sure if that is the right way to go. Seems like it probly isn't dealing with arrays right, but I'm not sure how to test it. |
Given that the parser has changed, and it's difficult for us to target different versions of the API vs parser version, it may be worth it to manage it ourselves. The provided
raylib_api.jsonwas built using the latest Parser Generator frommaster, with the4.0.0raylib.h.DO NOT MERGE YET! It's not compiling with this yet. We'll need to wrap...
float[4]char[32]Matrix[2]float[2]float[16]Fixes #145