-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Huge Typed Array? #61
Comments
Continuing from the above... I was able to get a BlueprintFunctionLibrary compiled, however FArrayBufferAccessor is not found. According to some examples found in the Unreal.js plugin, it comes from one of these: #include "JavascriptEditor.h" However the source for that is not accessible. Am I going about this the right way? Am I supposed to include the plugin source to have access to these functions? |
Array buffer accessor is located at 'JavascriptContext.h`. (https://github.com/ncsoft/Unreal.js-core/blob/master/Source/V8/Public/JavascriptContext.h) If you want to read back from huge typed array (which is passed from C++), there is a working example. (https://github.com/nakosung/UnrealDarknet/blob/master/Content/Scripts/yolo.js) |
Thanks Nako What's the proper way to include JavascriptContext.h? Should I include all the project files for the plugin into my game project/folder? |
No. Add project dependency in your game.Build.cs. And add |
https://github.com/nakosung/UnrealDarknet/blob/master/Source/darknet/darknet.Build.cs#L26 This is a working example. |
Ah thanks! Add V8 instead of Unreal.js? How does Unreal's build system know where to look for this dependency? I currently have the V8 source in my Program Files/Epic/UE/4.1/plugin/UnrealJS/etc... folder. Does the path matter? Should it be inside my project folder instead? |
If you build engine from source, plugin can be installed as an engine plugin. I'm not sure with packaged build from epic. |
Alright, will look into it, thanks! |
I got it mostly working. It looks like memory.bind is deprecated?
Should it be like this?
I couldn't find any documentation of memory.exec. The yolo.js example you linked https://github.com/nakosung/UnrealDarknet/blob/master/Content/Scripts/yolo.js made no use of memory.bind either. Furthermore, the Hello.js example has this but it isn't clear to me how the memory value is being used afterwards:
|
Yes, unguarded operations are deprecated. :) memory.exec(ab, function() {
// all operations which accesses array buffer should be guarded within this function.
GWorld.FastArrayCopy();
}) |
Haha. Yes, that seems much safer. Are there examples of accessing the data inside a FArrayBufferAccessor? For example looping over it? |
I figured it out 👍 In Javascript
In C++
|
Hi Nako, I seem to be running into speed issues passing large arrays from JS into Unreal. The size range is between 3000 to 16000 floats, for passing geometry data from JS to Unreal.
I'm 99% sure the speed loss is due to JS transfering data and needs to use: https://github.com/ncsoft/Unreal.js/wiki/Huge-typed-array
However, I'm uncertain how to actually pass to for example, ProceduralMesh component's UpdateMeshSection function.
I'm comfortable enough with C++ do dive in however this is still confusing to me:
What is MySuperMemoryFunction()? Is this compiled from somewhere? How do you go about creating that function? Is 'ab' variable supposed to be passed in?
Is there just a single FArrayBufferAccessor that's bound as a global variable? What's the best way to go from here to ProceduralMesh's UpdateMeshSection?
The text was updated successfully, but these errors were encountered: