diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 00000000..9947e786
--- /dev/null
+++ b/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..f0496777
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml
new file mode 100644
index 00000000..5fd9159d
--- /dev/null
+++ b/.idea/runConfigurations/example_lib_main_dart.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 00000000..67826e51
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index 5954fcde..fc371805 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,3 @@
-# mimetic_filament
+# holovox_filament
-A new flutter plugin project.
-
-## Getting Started
-
-This project is a starting point for a Flutter
-[plug-in package](https://flutter.dev/developing-packages/),
-a specialized package that includes platform-specific implementation code for
-Android and/or iOS.
-
-For help getting started with Flutter, view our
-[online documentation](https://flutter.dev/docs), which offers tutorials,
-samples, guidance on mobile development, and a full API reference.
-
-The plugin project was generated without specifying the `--platforms` flag, no platforms are currently supported.
-To add platforms, run `flutter create -t plugin --platforms .` under the same
-directory. You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
+3D rendering utilities for the Holovox app.
diff --git a/android/build.gradle b/android/build.gradle
index f3639bde..b98ac941 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,4 +1,4 @@
-group 'com.example.mimetic_filament'
+group 'com.example.holovox_filament'
version '1.0-SNAPSHOT'
buildscript {
diff --git a/android/settings.gradle b/android/settings.gradle
index d593e549..1fdc8a90 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -1 +1 @@
-rootProject.name = 'mimetic_filament'
+rootProject.name = 'holovox_filament'
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index b47e7009..6e03cd96 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,3 +1,3 @@
+ package="com.example.holovox_filament">
diff --git a/android/src/main/kotlin/com/example/mimetic_avatar/MimeticAvatarPlugin.kt b/android/src/main/kotlin/com/example/mimetic_avatar/MimeticAvatarPlugin.kt
index b4147e78..22fe6be8 100644
--- a/android/src/main/kotlin/com/example/mimetic_avatar/MimeticAvatarPlugin.kt
+++ b/android/src/main/kotlin/com/example/mimetic_avatar/MimeticAvatarPlugin.kt
@@ -1,4 +1,4 @@
-package com.example.mimetic_filament
+package com.example.holovox_filament
import androidx.annotation.NonNull
@@ -17,7 +17,7 @@ class MimeticAvatarPlugin: FlutterPlugin, MethodCallHandler {
private lateinit var channel : MethodChannel
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
- channel = MethodChannel(flutterPluginBinding.binaryMessenger, "mimetic_filament")
+ channel = MethodChannel(flutterPluginBinding.binaryMessenger, "holovox_filament")
channel.setMethodCallHandler(this)
}
diff --git a/android/src/main/kotlin/com/example/mimetic_filament/MimeticFilamentPlugin.kt b/android/src/main/kotlin/com/example/mimetic_filament/MimeticFilamentPlugin.kt
index db222949..5333bf9e 100644
--- a/android/src/main/kotlin/com/example/mimetic_filament/MimeticFilamentPlugin.kt
+++ b/android/src/main/kotlin/com/example/mimetic_filament/MimeticFilamentPlugin.kt
@@ -1,4 +1,4 @@
-package com.example.mimetic_filament
+package com.example.holovox_filament
import androidx.annotation.NonNull
@@ -17,7 +17,7 @@ class MimeticFilamentPlugin: FlutterPlugin, MethodCallHandler {
private lateinit var channel : MethodChannel
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
- channel = MethodChannel(flutterPluginBinding.binaryMessenger, "mimetic_filament")
+ channel = MethodChannel(flutterPluginBinding.binaryMessenger, "holovox_filament")
channel.setMethodCallHandler(this)
}
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 4abd36fc..61fae8fa 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -43,7 +43,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.example.mimetic_filament_example"
+ applicationId "com.example.holovox_filament_example"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
index 7b9c026e..d82f7efc 100644
--- a/example/android/app/src/debug/AndroidManifest.xml
+++ b/example/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.example.holovox_filament_example">
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index 9a6f1b89..2decfbf3 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
+ package="com.example.holovox_filament_example">
+ package="com.example.holovox_filament_example">
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index b0cc6bd9..1fa3a5e2 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -11,7 +11,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- mimetic_filament_example
+ holovox_filament_example
CFBundlePackageType
APPL
CFBundleShortVersionString
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 68e1fe25..18fe229b 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
-import 'package:mimetic_filament/filament_controller.dart';
-import 'package:mimetic_filament/view/filament_widget.dart';
+import 'package:holovox_filament/filament_controller.dart';
+import 'package:holovox_filament/view/filament_widget.dart';
void main() {
runApp(const MyApp());
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index b0f205ba..8c52c112 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -1,5 +1,5 @@
-name: mimetic_filament_example
-description: Demonstrates how to use the mimetic_filament plugin.
+name: holovox_filament_example
+description: Demonstrates how to use the holovox_filament plugin.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
@@ -18,7 +18,7 @@ dependencies:
flutter:
sdk: flutter
- mimetic_filament:
+ holovox_filament:
path: ../
cupertino_icons: ^1.0.2
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
index 63b0bc32..3656091a 100644
--- a/example/test/widget_test.dart
+++ b/example/test/widget_test.dart
@@ -8,7 +8,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:mimetic_filament_example/main.dart';
+import 'package:holovox_filament_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
diff --git a/ios/mimetic_filament.podspec b/ios/holovox_filament.podspec
similarity index 77%
rename from ios/mimetic_filament.podspec
rename to ios/holovox_filament.podspec
index 65b7b407..496fbf4a 100644
--- a/ios/mimetic_filament.podspec
+++ b/ios/holovox_filament.podspec
@@ -1,9 +1,9 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
-# Run `pod lib lint mimetic_filament.podspec` to validate before publishing.
+# Run `pod lib lint holovox_filament.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
- s.name = 'mimetic_filament'
+ s.name = 'holovox_filament'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
@@ -23,7 +23,7 @@ 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/mimetic_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/morph"',
+ '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',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
#"CLANG_CXX_LIBRARY" => "libc++"
@@ -33,7 +33,7 @@ A new flutter plugin project.
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules',
- 'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/morph"',
+ '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"',
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
}
s.swift_version = '5.0'
diff --git a/ios/src/FilamentViewer.cpp b/ios/src/FilamentViewer.cpp
index ad763534..2c89bb78 100644
--- a/ios/src/FilamentViewer.cpp
+++ b/ios/src/FilamentViewer.cpp
@@ -362,7 +362,7 @@ void FilamentViewer::render() {
_renderer->render(_view);
_renderer->endFrame();
} else {
- std::cout << "Skipping frame" << std::endl;
+ // std::cout << "Skipping frame" << std::endl;
}
}
@@ -396,14 +396,13 @@ void FilamentViewer::updateMorphAnimation() {
if(morphAnimationBuffer->frameIndex == -1) {
morphAnimationBuffer->frameIndex++;
- morphAnimationBuffer->lastTime = std::chrono::high_resolution_clock::now();
+ morphAnimationBuffer->startTime = std::chrono::high_resolution_clock::now();
applyWeights(morphAnimationBuffer->frameData, morphAnimationBuffer->numWeights);
} else {
- duration dur = std::chrono::high_resolution_clock::now() - morphAnimationBuffer->lastTime;
- float microsElapsed = dur.count();
- if(microsElapsed > (morphAnimationBuffer->frameLength * 1000000)) {
- morphAnimationBuffer->frameIndex++;
- morphAnimationBuffer->lastTime = std::chrono::high_resolution_clock::now();
+ std::chrono::duration dur = std::chrono::high_resolution_clock::now() - morphAnimationBuffer->startTime;
+ int frameIndex = dur.count() / morphAnimationBuffer->frameLength;
+ if(frameIndex != morphAnimationBuffer->frameIndex) {
+ morphAnimationBuffer->frameIndex = frameIndex;
applyWeights(morphAnimationBuffer->frameData + (morphAnimationBuffer->frameIndex * morphAnimationBuffer->numWeights), morphAnimationBuffer->numWeights);
}
}
diff --git a/ios/src/FilamentViewer.hpp b/ios/src/FilamentViewer.hpp
index 132c7006..322e4a0e 100644
--- a/ios/src/FilamentViewer.hpp
+++ b/ios/src/FilamentViewer.hpp
@@ -74,7 +74,7 @@ namespace mimetic {
int frameIndex = -1;
int numFrames;
float frameLength;
- time_point_t lastTime;
+ time_point_t startTime;
float* frameData;
int numWeights;
diff --git a/lib/filament_controller.dart b/lib/filament_controller.dart
index d588847f..4093e776 100644
--- a/lib/filament_controller.dart
+++ b/lib/filament_controller.dart
@@ -31,7 +31,7 @@ class MimeticFilamentController extends FilamentController {
final String materialPath;
MimeticFilamentController(
- {this.materialPath = "packages/mimetic_filament/assets/compiled.mat"});
+ {this.materialPath = "packages/holovox_filament/assets/compiled.mat"});
@override
void onFilamentViewCreated(int id) async {
diff --git a/lib/gesture_detecting_filament_view.dart b/lib/gesture_detecting_filament_view.dart
index a38a6f7b..eaf1ce7f 100644
--- a/lib/gesture_detecting_filament_view.dart
+++ b/lib/gesture_detecting_filament_view.dart
@@ -1,6 +1,7 @@
import 'package:flutter/widgets.dart';
-import 'package:mimetic_filament/filament_controller.dart';
-import 'package:mimetic_filament/view/filament_widget.dart';
+
+import 'filament_controller.dart';
+import 'view/filament_widget.dart';
class GestureDetectingFilamentView extends StatefulWidget {
final FilamentController controller;
diff --git a/lib/view/filament_view_platform.dart b/lib/view/filament_view_platform.dart
index 97f05ece..e775fb67 100644
--- a/lib/view/filament_view_platform.dart
+++ b/lib/view/filament_view_platform.dart
@@ -1,7 +1,6 @@
import 'package:flutter/widgets.dart';
-import 'package:mimetic_filament/view/filament_view.dart';
+import 'package:holovox_filament/view/filament_view.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
-import '../../filament_controller.dart';
typedef void FilamentViewCreatedCallback(int id);
diff --git a/pubspec.yaml b/pubspec.yaml
index f4273854..0aa3f98e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,4 +1,4 @@
-name: mimetic_filament
+name: holovox_filament
description: The 3D rendering layer for the Mimetic app.
version: 0.0.1
homepage:
diff --git a/scratch/material.cpp b/scratch/material.cpp
new file mode 100644
index 00000000..7f12c688
--- /dev/null
+++ b/scratch/material.cpp
@@ -0,0 +1,131 @@
+
+
+//VertexBuffer* vBuf = VertexBuffer::Builder()
+// .vertexCount(numVertices)
+// .bufferCount(numPrimitives)
+// .attribute(VertexAttribute::POSITION, 0, VertexBuffer::AttributeType::FLOAT4, 0)
+// .build(*engine);
+
+//numIndices = maxIndex+1; */
+//numIndices = prim.indices->count;
+
+/*indicesBuffer = (uint32_t*)malloc(sizeof(unsigned int) * prim.indices->count);
+
+//materialInstance->setParameter("vertexIndices", indicesBuffer, numIndices);
+
+//.require(VertexAttribute::UV0)
+//.require(MaterialBuilder.VertexAttribute.CUSTOM0)
+//MaterialBuilder::init();
+//MaterialBuilder builder = MaterialBuilder()
+// .name("DefaultMaterial")
+// .platform(MaterialBuilder::Platform::MOBILE)
+// .targetApi(MaterialBuilder::TargetApi::ALL)
+// .optimization(MaterialBuilderBase::Optimization::NONE)
+// .shading(MaterialBuilder::Shading::LIT)
+// .parameter(MaterialBuilder::UniformType::FLOAT3, "baseColor")
+// .parameter(MaterialBuilder::UniformType::INT3, "dimensions")
+// .parameter(MaterialBuilder::UniformType::FLOAT, numTargets, MaterialBuilder::ParameterPrecision::DEFAULT, "morphTargetWeights")
+// .parameter(MaterialBuilder::SamplerType::SAMPLER_2D_ARRAY, MaterialBuilder::SamplerFormat::FLOAT, MaterialBuilder::ParameterPrecision::DEFAULT, "morphTargets")
+// .vertexDomain(VertexDomain::WORLD)
+// .material(R"SHADER(void material(inout MaterialInputs material) {
+// prepareMaterial(material);
+// material.baseColor.rgb = materialParams.baseColor;
+// })SHADER")
+// .materialVertex(R"SHADER(
+// vec3 getMorphTarget(int vertexIndex, int morphTargetIndex) {
+// // our texture is laid out as (x,y,z) where y is 1, z is the number of morph targets, and x is the number of vertices * 2 (multiplication accounts for position + normal)
+// // UV coordinates are normalized to (-1,1), so we divide the current vertex index by the total number of vertices to find the correct coordinate for this vertex
+// vec3 uv = vec3(
+// (float(vertexIndex) + 0.5) / float(materialParams.dimensions.x),
+// 0.0f,
+// //(float(morphTargetIndex) + 0.5f) / float(materialParams.dimensions.z));
+// float(morphTargetIndex));
+// return texture(materialParams_morphTargets, uv).xyz;
+// }
+//
+// void materialVertex(inout MaterialVertexInputs material) {
+// return;
+// // for every morph target
+// for(int morphTargetIndex = 0; morphTargetIndex < materialParams.dimensions.z; morphTargetIndex++) {
+//
+// // get the weight to apply
+// float weight = materialParams.morphTargetWeights[morphTargetIndex];
+//
+// // get the ID of this vertex, which will be the x-offset of the position attribute in the texture sampler
+// int vertexId = getVertexIndex();
+//
+// // get the position of the target for this vertex
+// vec3 morphTargetPosition = getMorphTarget(vertexId, morphTargetIndex);
+// // update the world position of this vertex
+// material.worldPosition.xyz += (weight * morphTargetPosition);
+//
+// // increment the vertexID by half the size of the texture to get the x-offset of the normal (all positions stored in the first half, all normals stored in the second half)
+//
+// vertexId += (materialParams.dimensions.x / 2);
+//
+// // get the normal of this target for this vertex
+// vec3 morphTargetNormal = getMorphTarget(vertexId, morphTargetIndex);
+// material.worldNormal += (weight * morphTargetNormal);
+// }
+// mat4 transform = getWorldFromModelMatrix();
+// material.worldPosition = mulMat4x4Float3(transform, material.worldPosition.xyz);
+// })SHADER");
+//
+//Package pkg = builder.build(mAsset->mEngine->getJobSystem());
+//Material* material = Material::Builder().package(pkg.getData(), pkg.getSize())
+// .build(*mAsset->mEngine);
+
+//size_t normal_size = sizeof(short4);
+//assert(textureWidth * (position_size + normal_size) == textureSize);
+//assert(textureWidth * position_size == textureSize);
+/*__android_log_print(ANDROID_LOG_INFO, "MyTag", "Expected size %d width at level 0 %d height", Texture::PixelBufferDescriptor::computeDataSize(Texture::Format::RGB,
+ Texture::Type::FLOAT, 24, 1, 4), texture->getWidth(0),texture->getHeight(0)); */
+
+/* Texture::PixelBufferDescriptor descriptor(
+ textureBuffer,
+ textureSize,
+ Texture::Format::RGB,
+ Texture::Type::FLOAT,
+ 4, 0,0, 24,
+ FREE_CALLBACK,
+ nullptr); */
+
+/*for(int i = 0; i < int(textureSize / sizeof(float)); i++) {
+ __android_log_print(ANDROID_LOG_INFO, "MyTag", "offset %d %f", i, *(textureBuffer+i));
+//}*/
+//std::cout << "Checking for " << materialInstanceName << std::endl;
+//if(materialInstanceName) {
+// for(int i = 0; i < asset->getMaterialInstanceCount(); i++) {
+// const char* name = instances[i]->getName();
+// std::cout << name << std::endl;
+// if(strcmp(name, materialInstanceName) == 0) {
+// materialInstance = instances[i];
+// break;
+// }
+// }
+//} else {
+// materialInstance = instances[0];
+//}
+//
+//if(!materialInstance) {
+// exit(-1);
+//}
+
+// std::cout << std::endl;
+ /* for (int i = 0; i < 4; i++) {
+ morphHelperPrim.positions[i] = gltfioPrim.morphPositions[i];
+ morphHelperPrim.tangents[i] = gltfioPrim.morphTangents[i];
+ } */
+
+// applyTextures(materialInstance);
+
+/* const Entity* entities = mAsset->getEntities();
+ for(int i=0; i < mAsset->getEntityCount();i++) {
+ std::cout << mAsset->getName(entities[i]);
+ } */
+
+// Entity entity = mAsset->getFirstEntityByName(entityName);
+// RenderableManager::Instance rInst = mAsset->mEngine->getRenderableManager().getInstance(entity);
+// for(int i = 0; imEngine->getRenderableManager().setMaterialInstanceAt(rInst, i, materialInstance);
+// }
diff --git a/test/mimetic_filament_test.dart b/test/mimetic_filament_test.dart
index 4258952e..b77f8916 100644
--- a/test/mimetic_filament_test.dart
+++ b/test/mimetic_filament_test.dart
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
- const MethodChannel channel = MethodChannel('mimetic_filament');
+ const MethodChannel channel = MethodChannel('holovox_filament');
TestWidgetsFlutterBinding.ensureInitialized();