Domanda

I have written an NPAPI browser plug-in (using Firebreath) that Unity uses to access a Kinect camera. I can retrieve skeleton data from Unity through JavaScript easily since it isn't too big, but the problem is in retrieving color image data.

Is it possible to send a native texture pointer (GetNativeTexturePtr) from Unity through JavaScript into the C++ plug-in so that it can write the texture data directly? (tested in standalone version and it works)

Any other suggestions on how to transfer image data from browser plug-ins to Unity web player are very welcome.

È stato utile?

Soluzione

Unfortunately NPAPI plugins do not contain any mechanisms for exchanging binary data with the page. Probably the most performant way of doing that that I know of would be to base64 encode it and send it as part of a string.

Note that strings in NPAPI are UTF8.

The only way to get anything from Unity in your plugin would be to use the javascript interface, so you can use whatever methods you can find and then pass the data into your plugin; however, note that Unity is most likely running in another process, so you probably can't use any direct memory pointers that you might get from it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top