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