merge
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -68,4 +68,5 @@ linux/lib/libtinyexr.a filter=lfs diff=lfs merge=lfs -text
|
|||||||
linux/lib/libz.a filter=lfs diff=lfs merge=lfs -text
|
linux/lib/libz.a filter=lfs diff=lfs merge=lfs -text
|
||||||
linux/lib/libmatdbg.a filter=lfs diff=lfs merge=lfs -text
|
linux/lib/libmatdbg.a filter=lfs diff=lfs merge=lfs -text
|
||||||
linux/lib/libSPIRV-Tools-opt.a filter=lfs diff=lfs merge=lfs -text
|
linux/lib/libSPIRV-Tools-opt.a filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/** filter=lfs diff=lfs merge=lfs -text
|
||||||
*.a filter=lfs diff=lfs merge=lfs -text
|
*.a filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|||||||
@@ -345,6 +345,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -476,6 +477,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -499,6 +501,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
|
|||||||
@@ -119,11 +119,6 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
|||||||
kCVPixelFormatType_32BGRA, pixelBufferAttrs, &targetPixelBuffer) != kCVReturnSuccess) {
|
kCVPixelFormatType_32BGRA, pixelBufferAttrs, &targetPixelBuffer) != kCVReturnSuccess) {
|
||||||
print("Error allocating pixel buffer")
|
print("Error allocating pixel buffer")
|
||||||
}
|
}
|
||||||
if(self.viewer != nil) {
|
|
||||||
create_swap_chain(self.viewer, unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self))
|
|
||||||
update_viewport_and_camera_projection(self.viewer!, Int32(width), Int32(height), 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
print("Pixel buffer created")
|
print("Pixel buffer created")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,12 +131,17 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
|||||||
freeResourcePtr = unsafeBitCast(freeResource, to: UnsafeMutableRawPointer.self)
|
freeResourcePtr = unsafeBitCast(freeResource, to: UnsafeMutableRawPointer.self)
|
||||||
|
|
||||||
viewer = filament_viewer_new_ios(
|
viewer = filament_viewer_new_ios(
|
||||||
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
|
nil,
|
||||||
loadResourcePtr!,
|
loadResourcePtr!,
|
||||||
freeResourcePtr!,
|
freeResourcePtr!,
|
||||||
Unmanaged.passUnretained(self).toOpaque()
|
Unmanaged.passUnretained(self).toOpaque()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
create_swap_chain(
|
||||||
|
self.viewer,
|
||||||
|
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
|
||||||
|
UInt32(width), UInt32(height))
|
||||||
|
|
||||||
update_viewport_and_camera_projection(self.viewer!, Int32(width), Int32(height), 1.0);
|
update_viewport_and_camera_projection(self.viewer!, Int32(width), Int32(height), 1.0);
|
||||||
|
|
||||||
createDisplayLink()
|
createDisplayLink()
|
||||||
@@ -285,6 +285,10 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
|||||||
let width = Int(args[0])
|
let width = Int(args[0])
|
||||||
let height = Int(args[1])
|
let height = Int(args[1])
|
||||||
createPixelBuffer(width: width, height:height)
|
createPixelBuffer(width: width, height:height)
|
||||||
|
create_swap_chain(
|
||||||
|
self.viewer,
|
||||||
|
unsafeBitCast(targetPixelBuffer!, to: UnsafeMutableRawPointer.self),
|
||||||
|
UInt32(width), UInt32(height))
|
||||||
result("OK")
|
result("OK")
|
||||||
case "rotateStart":
|
case "rotateStart":
|
||||||
let args = call.arguments as! Array<Any>
|
let args = call.arguments as! Array<Any>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void* load_glb(void* viewer, const char* assetPath);
|
|||||||
void* load_gltf(void* viewer, const char* assetPath, const char* relativePath);
|
void* load_gltf(void* viewer, const char* assetPath, const char* relativePath);
|
||||||
bool set_camera(void* viewer, void* asset, const char* nodeName);
|
bool set_camera(void* viewer, void* asset, const char* nodeName);
|
||||||
void render(void* viewer, uint64_t frameTimeInNanos);
|
void render(void* viewer, uint64_t frameTimeInNanos);
|
||||||
void create_swap_chain(void* viewer, void* surface = nullptr, uint32_t width = 0, uint32_t height = 0);
|
void create_swap_chain(void* viewer, void* surface, uint32_t width, uint32_t height);
|
||||||
void destroy_swap_chain(void* viewer);
|
void destroy_swap_chain(void* viewer);
|
||||||
void set_frame_interval(void* viewer, float interval);
|
void set_frame_interval(void* viewer, float interval);
|
||||||
void* get_renderer(void* viewer);
|
void* get_renderer(void* viewer);
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
|
void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
|
||||||
void create_swap_chain(void* viewer, void* texture);
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SwiftPolyvoxFilamentPlugin_Bridging_Header_h
|
#ifndef SwiftPolyvoxFilamentPlugin_Bridging_Header_h
|
||||||
#define SwiftPolyvoxFilamentPlugin_Bridging_Header_h
|
#define SwiftPolyvoxFilamentPlugin_Bridging_Header_h
|
||||||
|
|
||||||
void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
|
// void* filament_viewer_new_ios(void* texture, void* loadResource, void* freeResource, void* resources);
|
||||||
|
|
||||||
#import "PolyvoxFilamentIOSApi.h"
|
#import "PolyvoxFilamentIOSApi.h"
|
||||||
#import "PolyvoxFilamentApi.h"
|
#import "PolyvoxFilamentApi.h"
|
||||||
|
|||||||
@@ -26,7 +26,4 @@ extern "C" {
|
|||||||
|
|
||||||
return (void*)viewer;
|
return (void*)viewer;
|
||||||
}
|
}
|
||||||
void create_swap_chain(void* viewer, void* texture) {
|
|
||||||
((FilamentViewer*)viewer)->createSwapChain(texture);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,65 +83,61 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(children: [
|
return Stack(children: [
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Listener(
|
// pinch zoom on mobile
|
||||||
onPointerSignal: (pointerSignal) async {
|
// couldn't find any equivalent for pointerCount in Listener so we use two widgets:
|
||||||
if (pointerSignal is PointerScrollEvent) {
|
// - outer is a GestureDetector only for pinch zoom
|
||||||
_scrollTimer?.cancel();
|
// - inner is a Listener for all other gestures
|
||||||
|
child: GestureDetector(
|
||||||
|
onScaleStart: (d) async {
|
||||||
|
if (d.pointerCount == 2) {
|
||||||
|
await widget.controller.zoomEnd();
|
||||||
await widget.controller.zoomBegin();
|
await widget.controller.zoomBegin();
|
||||||
await widget.controller.zoomUpdate(
|
|
||||||
pointerSignal.scrollDelta.dy > 0 ? 100 : -100);
|
|
||||||
_scrollTimer = Timer(Duration(milliseconds: 100), () {
|
|
||||||
widget.controller.zoomEnd();
|
|
||||||
_scrollTimer = null;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
print(pointerSignal);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPointerPanZoomStart: (pzs) {
|
onScaleEnd: (d) async {
|
||||||
print(pzs);
|
if (d.pointerCount == 2) {
|
||||||
|
_lastScale = 0;
|
||||||
|
await widget.controller.zoomEnd();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPointerDown: (d) async {
|
onScaleUpdate: (d) async {
|
||||||
await _functionStart(d.localPosition.dx, d.localPosition.dy);
|
if (d.pointerCount == 2) {
|
||||||
|
if (_lastScale != 0) {
|
||||||
|
await widget.controller
|
||||||
|
.zoomUpdate(100 * (_lastScale - d.scale));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_lastScale = d.scale;
|
||||||
},
|
},
|
||||||
onPointerMove: (d) async {
|
child: Listener(
|
||||||
await _functionUpdate(d.localPosition.dx, d.localPosition.dy);
|
onPointerSignal: (pointerSignal) async {
|
||||||
},
|
// scroll-wheel zoom on desktop
|
||||||
onPointerUp: (d) async {
|
if (pointerSignal is PointerScrollEvent) {
|
||||||
await _functionEnd();
|
_scrollTimer?.cancel();
|
||||||
},
|
await widget.controller.zoomBegin();
|
||||||
// on
|
await widget.controller.zoomUpdate(
|
||||||
// onScaleStart: (d) async {
|
pointerSignal.scrollDelta.dy > 0 ? 100 : -100);
|
||||||
// print("SCALE START");
|
_scrollTimer = Timer(Duration(milliseconds: 100), () {
|
||||||
// if (d.pointerCount == 2) {
|
widget.controller.zoomEnd();
|
||||||
// await widget.controller.zoomEnd();
|
_scrollTimer = null;
|
||||||
// await widget.controller.zoomBegin();
|
});
|
||||||
// } else {
|
} else {
|
||||||
// await _functionStart(d.focalPoint.dx, d.focalPoint.dy);
|
print(pointerSignal);
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// onScaleEnd: (d) async {
|
onPointerPanZoomStart: (pzs) {},
|
||||||
// print("SCALE END");
|
onPointerDown: (d) async {
|
||||||
|
await _functionStart(
|
||||||
// if (d.pointerCount == 2) {
|
d.localPosition.dx, d.localPosition.dy);
|
||||||
// _lastScale = 0;
|
},
|
||||||
// await widget.controller.zoomEnd();
|
onPointerMove: (d) async {
|
||||||
// } else {
|
await _functionUpdate(
|
||||||
// await _functionEnd();
|
d.localPosition.dx, d.localPosition.dy);
|
||||||
// }
|
},
|
||||||
// },
|
onPointerUp: (d) async {
|
||||||
// onScaleUpdate: (d) async {
|
await _functionEnd();
|
||||||
// if (d.pointerCount == 2) {
|
},
|
||||||
// if (_lastScale != 0) {
|
child: widget.child))),
|
||||||
// await widget.controller
|
|
||||||
// .zoomUpdate(100 * (_lastScale - d.scale));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// await _functionUpdate(d.focalPoint.dx, d.focalPoint.dy);
|
|
||||||
// }
|
|
||||||
// _lastScale = d.scale;
|
|
||||||
// },
|
|
||||||
child: widget.child)),
|
|
||||||
widget.showControls
|
widget.showControls
|
||||||
? Align(
|
? Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
|
|||||||
Reference in New Issue
Block a user