package and namespace changes
This commit is contained in:
@@ -7,6 +7,6 @@ FilamentNativeViewFactory* factory;
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
factory =
|
||||
[[FilamentNativeViewFactory alloc] initWithRegistrar:registrar];
|
||||
[registrar registerViewFactory:factory withId:@"mimetic.app/filament_view"];
|
||||
[registrar registerViewFactory:factory withId:@"holovox.app/filament_view"];
|
||||
}
|
||||
@end
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "FilamentViewer.hpp"
|
||||
|
||||
static const id VIEW_TYPE = @"mimetic.app/filament_view";
|
||||
static const id VIEW_TYPE = @"holovox.app/filament_view";
|
||||
|
||||
@interface FilamentMethodCallHandler : FlutterMethodChannel
|
||||
- (void)handleMethodCall:(FlutterMethodCall* _Nonnull)call result:( FlutterResult _Nonnull)result;
|
||||
- (mimetic::FilamentViewer*) _viewer;
|
||||
- (mimetic::ResourceBuffer)loadResource:(const char* const)path;
|
||||
- (holovox::FilamentViewer*) _viewer;
|
||||
- (holovox::ResourceBuffer)loadResource:(const char* const)path;
|
||||
- (void)freeResource:(void*)mem size:(size_t)size misc:(void*)misc;
|
||||
- (void)ready;
|
||||
- (instancetype)initWithController:(FilamentViewController*)controller
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
static const FilamentMethodCallHandler* _handler;
|
||||
|
||||
static mimetic::ResourceBuffer loadResourceGlobal(const char* name) {
|
||||
static holovox::ResourceBuffer loadResourceGlobal(const char* name) {
|
||||
return [_handler loadResource:name];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) {
|
||||
@implementation FilamentMethodCallHandler {
|
||||
FilamentViewController *_controller;
|
||||
FlutterMethodChannel* _channel;
|
||||
mimetic::FilamentViewer* _viewer;
|
||||
holovox::FilamentViewer* _viewer;
|
||||
void* _layer;
|
||||
|
||||
NSObject<FlutterPluginRegistrar>* _registrar;
|
||||
@@ -43,9 +43,9 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) {
|
||||
- (void)handleMethodCall:(FlutterMethodCall* _Nonnull)call result:(FlutterResult _Nonnull )result {
|
||||
if([@"initialize" isEqualToString:call.method]) {
|
||||
if(!call.arguments)
|
||||
_viewer = new mimetic::FilamentViewer(_layer, nullptr, loadResourceGlobal, freeResourceGlobal);
|
||||
_viewer = new holovox::FilamentViewer(_layer, nullptr, loadResourceGlobal, freeResourceGlobal);
|
||||
else
|
||||
_viewer = new mimetic::FilamentViewer(_layer, [call.arguments UTF8String], loadResourceGlobal, freeResourceGlobal);
|
||||
_viewer = new holovox::FilamentViewer(_layer, [call.arguments UTF8String], loadResourceGlobal, freeResourceGlobal);
|
||||
[_controller setViewer:_viewer];
|
||||
[_controller startDisplayLink];
|
||||
result(@"OK");
|
||||
@@ -117,7 +117,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) {
|
||||
_viewer->playAnimation([call.arguments intValue]);
|
||||
result(@"OK");
|
||||
} else if([@"getTargetNames" isEqualToString:call.method]) {
|
||||
mimetic::StringList list = _viewer->getTargetNames([call.arguments UTF8String]);
|
||||
holovox::StringList list = _viewer->getTargetNames([call.arguments UTF8String]);
|
||||
NSMutableArray* asArray = [NSMutableArray arrayWithCapacity:list.count];
|
||||
for(int i = 0; i < list.count; i++) {
|
||||
asArray[i] = [NSString stringWithFormat:@"%s", list.strings[i]];
|
||||
@@ -146,7 +146,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) {
|
||||
}
|
||||
}
|
||||
|
||||
- (mimetic::ResourceBuffer)loadResource:(const char* const)path {
|
||||
- (holovox::ResourceBuffer)loadResource:(const char* const)path {
|
||||
NSString* p = [NSString stringWithFormat:@"%s", path];
|
||||
NSString* key = [_registrar lookupKeyForAsset:p];
|
||||
NSString* nsPath = [[NSBundle mainBundle] pathForResource:key
|
||||
@@ -159,7 +159,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) {
|
||||
NSData* buffer = [NSData dataWithContentsOfFile:nsPath];
|
||||
void* cpy = malloc([buffer length]);
|
||||
memcpy(cpy, [buffer bytes], [buffer length]); // can we avoid this copy somehow?
|
||||
mimetic::ResourceBuffer rbuf(cpy, [buffer length]);
|
||||
holovox::ResourceBuffer rbuf(cpy, [buffer length]);
|
||||
return rbuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
@implementation FilamentNativeView {
|
||||
FilamentView* _view;
|
||||
FilamentViewController* _controller;
|
||||
mimetic::FilamentViewer* _viewer;
|
||||
holovox::FilamentViewer* _viewer;
|
||||
FilamentMethodCallHandler* _handler;
|
||||
void* _layer;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*
|
||||
*/
|
||||
@interface FilamentView : UIView
|
||||
- (void)setViewer:(mimetic::FilamentViewer*)viewer;
|
||||
- (void)setViewer:(holovox::FilamentViewer*)viewer;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -23,14 +23,14 @@ using namespace std;
|
||||
|
||||
@interface FilamentView ()
|
||||
- (void)initCommon;
|
||||
- (void)setViewer:(mimetic::FilamentViewer*)viewer;
|
||||
- (void)setViewer:(holovox::FilamentViewer*)viewer;
|
||||
@end
|
||||
|
||||
@implementation FilamentView {
|
||||
mimetic::FilamentViewer* _viewer;
|
||||
holovox::FilamentViewer* _viewer;
|
||||
}
|
||||
|
||||
- (void)setViewer:(mimetic::FilamentViewer*)viewer {
|
||||
- (void)setViewer:(holovox::FilamentViewer*)viewer {
|
||||
_viewer = viewer;
|
||||
_viewer->updateViewportAndCameraProjection(self.bounds.size.width, self.bounds.size.height, self.contentScaleFactor);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
@interface FilamentViewController : UIViewController
|
||||
|
||||
@property(weak, nonatomic) IBOutlet FilamentView* modelView;
|
||||
- (void)setViewer:(mimetic::FilamentViewer*)viewer;
|
||||
- (void)setViewer:(holovox::FilamentViewer*)viewer;
|
||||
- (void)startDisplayLink;
|
||||
- (void)stopDisplayLink;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
@implementation FilamentViewController {
|
||||
CADisplayLink* _displayLink;
|
||||
NSObject<FlutterPluginRegistrar>* _registrar;
|
||||
mimetic::FilamentViewer* _viewer;
|
||||
holovox::FilamentViewer* _viewer;
|
||||
FilamentView* _view;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
return self;
|
||||
}
|
||||
- (void)setViewer:(mimetic::FilamentViewer*)viewer {
|
||||
- (void)setViewer:(holovox::FilamentViewer*)viewer {
|
||||
_viewer = viewer;
|
||||
[_view setViewer:_viewer];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user