package name changes and fixes
This commit is contained in:
1 parent
61e3ed179c
commit
77a68a11de
20 files changed
+106
-193
No files matched your search
+77
-98
@@ -1,11 +1,9 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:holovox_filament/filament_controller.dart';
|
||||
import 'package:holovox_filament/view/filament_widget.dart';
|
||||
import 'package:polyvox_filament/filament_controller.dart';
|
||||
import 'package:polyvox_filament/gesture_detecting_filament_view.dart';
|
||||
import 'package:polyvox_filament/view/filament_widget.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -19,9 +17,8 @@ class MyApp extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
final FilamentController _filamentController = HolovoxFilamentController();
|
||||
final FilamentController _filamentController = PolyvoxFilamentController();
|
||||
|
||||
bool _rotate = false;
|
||||
int _primitiveIndex = 0;
|
||||
final weights = List.filled(255, 0.0);
|
||||
List<String> _targets = [];
|
||||
@@ -38,123 +35,105 @@ class _MyAppState extends State<MyApp> {
|
||||
appBar: AppBar(
|
||||
title: const Text('Plugin example app'),
|
||||
),
|
||||
body: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanDown: (details) {
|
||||
_rotate
|
||||
? _filamentController.rotateStart(
|
||||
details.localPosition.dx, details.localPosition.dy)
|
||||
: _filamentController.panStart(
|
||||
details.localPosition.dx, details.localPosition.dy);
|
||||
},
|
||||
onPanUpdate: (details) {
|
||||
_rotate
|
||||
? _filamentController.rotateUpdate(
|
||||
details.localPosition.dx, details.localPosition.dy)
|
||||
: _filamentController.panUpdate(
|
||||
details.localPosition.dx, details.localPosition.dy);
|
||||
},
|
||||
onPanEnd: (d) {
|
||||
_rotate
|
||||
? _filamentController.rotateEnd()
|
||||
: _filamentController.panEnd();
|
||||
},
|
||||
child: Stack(children: [
|
||||
FilamentWidget(controller: _filamentController),
|
||||
body: Stack(children: [
|
||||
GestureDetectingFilamentView(
|
||||
controller: _filamentController,
|
||||
),
|
||||
Positioned.fill(
|
||||
top: 200,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100,
|
||||
child: Row(children: [
|
||||
ElevatedButton(
|
||||
child: Text("initialize"),
|
||||
child: const Text('load skybox'),
|
||||
onPressed: () async {
|
||||
await _filamentController.loadSkybox(
|
||||
"assets/default_env/default_env_skybox.ktx",
|
||||
"assets/default_env/default_env_ibl.ktx");
|
||||
'assets/default_env/default_env_skybox.ktx',
|
||||
'assets/default_env/default_env_ibl.ktx');
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('load cube'),
|
||||
onPressed: () async {
|
||||
await _filamentController.loadGltf(
|
||||
"assets/caleb_mouth_morph_target.gltf",
|
||||
"assets");
|
||||
'assets/cube.gltf', 'assets');
|
||||
await _filamentController.createMorpher('Cube', [0]);
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('stretch'),
|
||||
onPressed: () async {
|
||||
await _filamentController
|
||||
.applyWeights(List.filled(8, 1.0));
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('squeeze'),
|
||||
onPressed: () async {
|
||||
await _filamentController
|
||||
.applyWeights(List.filled(8, 0));
|
||||
}),
|
||||
ElevatedButton(
|
||||
child: const Text('load caleb'),
|
||||
onPressed: () async {
|
||||
await _filamentController.loadGltf(
|
||||
'assets/caleb_mouth_morph_target.gltf', 'assets');
|
||||
_targets = await _filamentController
|
||||
.getTargetNames("CC_Base_Body");
|
||||
.getTargetNames('CC_Base_Body');
|
||||
setState(() {});
|
||||
|
||||
_filamentController.createMorpher(
|
||||
"CC_Base_Body", [1, 7, 8]);
|
||||
}),
|
||||
Checkbox(
|
||||
value: _rotate,
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
_rotate = v == true;
|
||||
});
|
||||
}),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
_filamentController.zoom(30.0),
|
||||
child: const Text("-")),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
_filamentController.zoom(-30.0),
|
||||
child: const Text("+")),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
_filamentController.playAnimation(0),
|
||||
child: const Text("Play"))
|
||||
])),
|
||||
Column(
|
||||
children: _targets
|
||||
.asMap()
|
||||
.map((i, t) => MapEntry(
|
||||
i,
|
||||
Row(children: [
|
||||
Text(t),
|
||||
Slider(
|
||||
min: 0,
|
||||
max: 1,
|
||||
divisions: 10,
|
||||
value: weights[i],
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
weights[i] = v;
|
||||
_filamentController
|
||||
.applyWeights(weights);
|
||||
});
|
||||
})
|
||||
])))
|
||||
.values
|
||||
.toList(),
|
||||
)
|
||||
.createMorpher('CC_Base_Body', [1, 7, 8]);
|
||||
}),
|
||||
ElevatedButton(
|
||||
onPressed: () => _filamentController.playAnimation(0),
|
||||
child: const Text('Play'))
|
||||
],
|
||||
),
|
||||
)),
|
||||
])),
|
||||
),
|
||||
])),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ElevatedButton(
|
||||
// child: Text("load skybox"),
|
||||
// child: Text('load skybox'),
|
||||
// onPressed: () {
|
||||
// _filamentController.loadSkybox(
|
||||
// "assets/default_env/default_env_skybox.ktx",
|
||||
// "assets/default_env/default_env_ibl.ktx");
|
||||
// 'assets/default_env/default_env_skybox.ktx',
|
||||
// 'assets/default_env/default_env_ibl.ktx');
|
||||
// }),
|
||||
// ElevatedButton(
|
||||
// child: Text("load gltf"),
|
||||
// child: Text('load gltf'),
|
||||
// onPressed: () {
|
||||
// _filamentController.loadGltf(
|
||||
// "assets/guy.gltf", "assets", "Material");
|
||||
// 'assets/guy.gltf', 'assets', 'Material');
|
||||
// }),
|
||||
// ElevatedButton(
|
||||
// child: Text("create morpher"),
|
||||
// child: Text('create morpher'),
|
||||
// onPressed: () {
|
||||
// _filamentController.createMorpher(
|
||||
// "CC_Base_Body.003", "CC_Base_Body.003",
|
||||
// materialName: "Material");
|
||||
// 'CC_Base_Body.003', 'CC_Base_Body.003',
|
||||
// materialName: 'Material');
|
||||
// }),
|
||||
// ])),
|
||||
// Column(
|
||||
// children: _targets
|
||||
// .asMap()
|
||||
// .map((i, t) => MapEntry(
|
||||
// i,
|
||||
// Row(children: [
|
||||
// Text(t),
|
||||
// Slider(
|
||||
// min: 0,
|
||||
// max: 1,
|
||||
// divisions: 10,
|
||||
// value: weights[i],
|
||||
// onChanged: (v) {
|
||||
// setState(() {
|
||||
// weights[i] = v;
|
||||
// _filamentController
|
||||
// .applyWeights(weights);
|
||||
// });
|
||||
// })
|
||||
// ])))
|
||||
// .values
|
||||
// .toList(),
|
||||
// )
|
||||
@@ -8,7 +8,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:holovox_filament_example/main.dart';
|
||||
import 'package:polyvox_filament_example/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +0,0 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface HolovoxFilamentPlugin : NSObject<FlutterPlugin>
|
||||
@end
|
||||
@@ -0,0 +1,4 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface PolyvoxFilamentPlugin : NSObject<FlutterPlugin>
|
||||
@end
|
||||
@@ -1,9 +1,9 @@
|
||||
#import "HolovoxFilamentPlugin.h"
|
||||
#import "filament/FilamentNativeViewFactory.h"
|
||||
#import "PolyvoxFilamentPlugin.h"
|
||||
#import "FilamentNativeViewFactory.h"
|
||||
|
||||
FilamentNativeViewFactory* factory;
|
||||
|
||||
@implementation HolovoxFilamentPlugin
|
||||
@implementation PolyvoxFilamentPlugin
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
factory =
|
||||
[[FilamentNativeViewFactory alloc] initWithRegistrar:registrar];
|
||||
File renamed without changes.
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <gltfio/MaterialProvider.h>
|
||||
|
||||
#define JAVA_MATERIAL_KEY "com/google/android/filament/gltfio/MaterialProvider$MaterialKey"
|
||||
|
||||
class MaterialKeyHelper {
|
||||
public:
|
||||
static MaterialKeyHelper& get();
|
||||
|
||||
void copy(JNIEnv* env, gltfio::MaterialKey& dst, jobject src);
|
||||
void copy(JNIEnv* env, jobject dst, const gltfio::MaterialKey& src);
|
||||
|
||||
void init(JNIEnv* env); // called only from the Java static class constructor
|
||||
|
||||
private:
|
||||
jfieldID doubleSided;
|
||||
jfieldID unlit;
|
||||
jfieldID hasVertexColors;
|
||||
jfieldID hasBaseColorTexture;
|
||||
jfieldID hasNormalTexture;
|
||||
jfieldID hasOcclusionTexture;
|
||||
jfieldID hasEmissiveTexture;
|
||||
jfieldID useSpecularGlossiness;
|
||||
jfieldID alphaMode;
|
||||
jfieldID enableDiagnostics;
|
||||
jfieldID hasMetallicRoughnessTexture;
|
||||
jfieldID metallicRoughnessUV;
|
||||
jfieldID baseColorUV;
|
||||
jfieldID hasClearCoatTexture;
|
||||
jfieldID clearCoatUV;
|
||||
jfieldID hasClearCoatRoughnessTexture;
|
||||
jfieldID clearCoatRoughnessUV;
|
||||
jfieldID hasClearCoatNormalTexture;
|
||||
jfieldID clearCoatNormalUV;
|
||||
jfieldID hasClearCoat;
|
||||
jfieldID hasTransmission;
|
||||
jfieldID hasTextureTransforms;
|
||||
jfieldID emissiveUV;
|
||||
jfieldID aoUV;
|
||||
jfieldID normalUV;
|
||||
jfieldID hasTransmissionTexture;
|
||||
jfieldID transmissionUV;
|
||||
jfieldID hasSheenColorTexture;
|
||||
jfieldID sheenColorUV;
|
||||
jfieldID hasSheenRoughnessTexture;
|
||||
jfieldID sheenRoughnessUV;
|
||||
jfieldID hasVolumeThicknessTexture;
|
||||
jfieldID volumeThicknessUV;
|
||||
jfieldID hasSheen;
|
||||
jfieldID hasIOR;
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint holovox_filament.podspec` to validate before publishing.
|
||||
# Run `pod lib lint polyvox_filament.podspec` to validate before publishing.
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'holovox_filament'
|
||||
s.name = 'polyvox_filament'
|
||||
s.version = '0.0.1'
|
||||
s.summary = 'A new flutter plugin project.'
|
||||
s.description = <<-DESC
|
||||
@@ -13,8 +13,9 @@ A new flutter plugin project.
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*', 'src/*.*', 'src/morph/*.*', 'src/morph/UbershaderLoader.cpp'
|
||||
#s.dependency 'Filament', '~> 1.12.8'
|
||||
s.source_files = 'Classes/**/*', 'src/*.*', 'src/morph/*.*', 'src/morph/UbershaderLoader.cpp' #, "include/**/*"
|
||||
#s.header_dir = "include"
|
||||
#s.header_mappings_dir = "include"
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '12.1'
|
||||
s.static_framework = true
|
||||
@@ -24,21 +25,22 @@ A new flutter plugin project.
|
||||
s.user_target_xcconfig = {
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/morph"',
|
||||
'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules',
|
||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/morph" "$(inherited)"',
|
||||
'OTHER_CXXFLAGS' => '"--std=c++17" "-fmodules" "-fcxx-modules" "$(inherited)"',
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||||
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/lib"',
|
||||
#'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
||||
#"CLANG_CXX_LIBRARY" => "libc++"
|
||||
}
|
||||
s.pod_target_xcconfig = {
|
||||
'DEFINES_MODULE' => 'YES',
|
||||
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||||
'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules',
|
||||
#'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules -x c++',
|
||||
'OTHER_CXXFLAGS' => '"--std=c++17" "-fmodules" "-fcxx-modules" "$(inherited)"',
|
||||
"OTHER_LDFLAGS" => '-lfilament -lbackend -lmathio -lfilameshio -lviewer -lfilamat -lgeometry -lutils -lfilabridge -lgltfio_resources_lite -lgltfio_core -lfilament-iblprefilter -limage -lcamutils -lgltfio_resources -lmath -lfilaflat -ldracodec -libl',
|
||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/morph"',
|
||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/morph" "$(inherited)"',
|
||||
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
||||
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/holovox_filament/ios/lib"',
|
||||
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
||||
}
|
||||
|
||||
s.swift_version = '5.0'
|
||||
@@ -30,13 +30,13 @@ abstract class FilamentController {
|
||||
Future zoom(double z);
|
||||
}
|
||||
|
||||
class HolovoxFilamentController extends FilamentController {
|
||||
class PolyvoxFilamentController extends FilamentController {
|
||||
late int _id;
|
||||
late MethodChannel _channel;
|
||||
|
||||
final Function(int id)? onFilamentViewCreatedHandler;
|
||||
|
||||
HolovoxFilamentController({this.onFilamentViewCreatedHandler});
|
||||
PolyvoxFilamentController({this.onFilamentViewCreatedHandler});
|
||||
|
||||
@override
|
||||
void onFilamentViewCreated(int id) async {
|
||||
@@ -55,8 +55,8 @@ class HolovoxFilamentController extends FilamentController {
|
||||
@override
|
||||
Future _initialize() async {
|
||||
await _channel.invokeMethod("initialize", [
|
||||
"packages/holovox_filament/assets/lit_opaque.filamat",
|
||||
"packages/holovox_filament/assets/lit_fade.filamat"
|
||||
"packages/polyvox_filament/assets/lit_opaque.filamat",
|
||||
"packages/polyvox_filament/assets/lit_fade.filamat"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:holovox_filament/view/filament_view.dart';
|
||||
import 'package:polyvox_filament/view/filament_view.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
typedef void FilamentViewCreatedCallback(int id);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
name: holovox_filament
|
||||
description: The 3D rendering layer for the Holovox app.
|
||||
name: polyvox_filament
|
||||
description: The 3D rendering layer for the Polyvox app.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
|
||||
@@ -31,4 +31,4 @@ flutter:
|
||||
#package: com.thepipecat.flutter.filament
|
||||
#pluginClass: FilamentPlugin
|
||||
ios:
|
||||
pluginClass: HolovoxFilamentPlugin
|
||||
pluginClass: PolyvoxFilamentPlugin
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const MethodChannel channel = MethodChannel('holovox_filament');
|
||||
const MethodChannel channel = MethodChannel('polyvox_filament');
|
||||
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
|
||||
Reference in new issue
Block a user