ExBemined Posted February 24, 2015 Share Posted February 24, 2015 Hi, In the C++ API there is both a Texture and Image class, in script only the Image class seems to be present. In my C++ plugin I'm doing a bit of rendering into a Texture (using TextureRender class) and I want to show the final result on the screen. I can do this either in a WidgetSprite or through an ObjectMesh (by setting it as the diffuse texture in the material) from script. However both take an Image, so in the plugin I need to convert Texture->Image and return the image to script, and internally these function seem to again fill a texture with this image, which lowers the performance. As a test I added a function in the C++ plugin that sets the texture directly to the material and this went a lot faster, but this poking back and forward between C++ and script is not ideal. Is there a direct way to share render textures between C++ and UnigineScript (so render in plugin, get pointer to texture back in script and set it to widget/material, without internal conversions), or would this require the Texture class to be exposed to script first? Link to comment
unclebob Posted February 24, 2015 Share Posted February 24, 2015 Hello, Michiel! There's no way to share Texture instance between C++ and UnigineScript unfortunately. In order to reduce poking back and forward between both consider adding a bit more code on C++ side (something like 'prepareObject' function), export it to the script and use. Link to comment
Recommended Posts