standardize on Int32 for ResourceBuffer size/id
This commit is contained in:
@@ -105,13 +105,15 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
}
|
||||
}
|
||||
do {
|
||||
print("Opening data from path \(path)")
|
||||
let data = try Data(contentsOf: URL(fileURLWithPath:path!))
|
||||
let resId = instance.resources.count
|
||||
let nsData = data as NSData
|
||||
instance.resources[resId] = nsData
|
||||
let rawPtr = nsData.bytes
|
||||
return ResourceBuffer(data:rawPtr, size:Int64(nsData.count), id:UInt32(resId))
|
||||
let length = Int32(nsData.count)
|
||||
print("Opened asset of length \(Int32(length)) at path \(path!)")
|
||||
|
||||
return ResourceBuffer(data:rawPtr, size:length, id:Int32(resId))
|
||||
} catch {
|
||||
print("Error opening file: \(error)")
|
||||
}
|
||||
|
||||
@@ -48,9 +48,8 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
let resId = UInt32(instance.resources.count)
|
||||
instance.resources[resId] = nsData
|
||||
let length = nsData.length
|
||||
print("Resolved asset to file of length \(length) at path \(path!)")
|
||||
|
||||
return ResourceBuffer(data:nsData.bytes, size:Int64(nsData.length), id:UInt32(resId))
|
||||
print("Resolved asset to file of length \(Int32(length)) at path \(path!)")
|
||||
return ResourceBuffer(data:nsData.bytes, size:Int32(UInt32(nsData.length)), id:Int32(UInt32(resId)))
|
||||
} catch {
|
||||
print("ERROR LOADING RESOURCE")
|
||||
}
|
||||
@@ -60,7 +59,7 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
|
||||
var freeResource : @convention(c) (ResourceBuffer,UnsafeMutableRawPointer?) -> () = { rbuf, resourcesPtr in
|
||||
let instance:SwiftPolyvoxFilamentPlugin = Unmanaged<SwiftPolyvoxFilamentPlugin>.fromOpaque(resourcesPtr!).takeUnretainedValue()
|
||||
instance.resources.removeValue(forKey:rbuf.id)
|
||||
instance.resources.removeValue(forKey:UInt32(rbuf.id))
|
||||
}
|
||||
|
||||
var markTextureFrameAvailable : @convention(c) (UnsafeMutableRawPointer?) -> () = { instancePtr in
|
||||
|
||||
Reference in New Issue
Block a user