@ -125,16 +125,18 @@ public partial class RenderModule: CallbackHandler<RenderModule>
return GetSelf ( target ) . UploadTexture ( texture , dataBytes , ref texNum ) ;
}
private readonly byte [ ] lightmapBytes = new byte [ QConstants . LightmapBlockWidth * QConstants . LightmapBlockHeight * 4 ] ; // 32 bits per pixel
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool UploadLightmapCallback ( IntPtr target , int lmap , int width , int height , IntPtr data ) ;
private delegate bool UploadLightmapCallback ( IntPtr target , int lmap , IntPtr data ) ;
[MonoPInvokeCallback(typeof(UploadLightmapCallback))]
private static bool Callback_UploadLightmap ( IntPtr target , int lmap , int width , int height , IntPtr data )
private static bool Callback_UploadLightmap ( IntPtr target , int lmap , IntPtr data )
{
// TODO: this is a fairly pointless additional data copy step; we could probably make this faster by wrapping the IntPtr directly into a NativeArray
byte [ ] dataBytes = new byte [ width * height * 4 ] ; // 32 bits per pixel (RGBA)
Marshal . Copy ( data , data Bytes, 0 , data Bytes. Length ) ;
return GetSelf ( target ) . UploadLightmap ( lmap , width , height , data Bytes) ;
var self = GetSelf ( target ) ;
Marshal . Copy ( data , self . lightmap Bytes, 0 , self . lightmap Bytes. Length ) ;
return self . UploadLightmap ( lmap , QConstants . LightmapBlockWidth , QConstants . LightmapBlockHeight , self . lightmap Bytes) ;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]