package name change

This commit is contained in:
Nick Fisher
2021-11-06 12:38:56 +08:00
parent 4a87ccd143
commit 51ba4b2377
29 changed files with 252 additions and 57 deletions

19
.idea/libraries/Dart_SDK.xml generated Normal file
View File

@@ -0,0 +1,19 @@
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file:///Users/admin/Downloads/flutter/bin/cache/dart-sdk/lib/typed_data" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

10
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/holovox_filament.iml" filepath="$PROJECT_DIR$/holovox_filament.iml" />
<module fileurl="file://$PROJECT_DIR$/android/holovox_filament_android.iml" filepath="$PROJECT_DIR$/android/holovox_filament_android.iml" />
<module fileurl="file://$PROJECT_DIR$/example/android/holovox_filament_example_android.iml" filepath="$PROJECT_DIR$/example/android/holovox_filament_example_android.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="example/lib/main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" />
<method />
</configuration>
</component>

45
.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="holovox_filament.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/holovox_filament.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="ToolWindowManager">
<editor active="true" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
</navigator>
<panes>
<pane id="ProjectPane">
<option name="show-excluded-files" value="false" />
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="dart.analysis.tool.window.force.activate" value="true" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
</project>

View File

@@ -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 <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.

View File

@@ -1,4 +1,4 @@
group 'com.example.mimetic_filament'
group 'com.example.holovox_filament'
version '1.0-SNAPSHOT'
buildscript {

View File

@@ -1 +1 @@
rootProject.name = 'mimetic_filament'
rootProject.name = 'holovox_filament'

View File

@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mimetic_filament">
package="com.example.holovox_filament">
</manifest>

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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()

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mimetic_filament_example">
package="com.example.holovox_filament_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mimetic_filament_example">
package="com.example.holovox_filament_example">
<application
android:label="mimetic_filament_example"
android:label="holovox_filament_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"

View File

@@ -1,4 +1,4 @@
package com.example.mimetic_filament_example
package com.example.holovox_filament_example
import io.flutter.embedding.android.FlutterActivity

View File

@@ -1,4 +1,4 @@
package com.example.mimetic_filament_example
package com.example.holovox_filament_example
import io.flutter.embedding.android.FlutterActivity

View File

@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mimetic_filament_example">
package="com.example.holovox_filament_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>mimetic_filament_example</string>
<string>holovox_filament_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@@ -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());

View File

@@ -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

View File

@@ -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 {

View File

@@ -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'

View File

@@ -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<double, std::milli> 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);
}
}

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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);

View File

@@ -1,4 +1,4 @@
name: mimetic_filament
name: holovox_filament
description: The 3D rendering layer for the Mimetic app.
version: 0.0.1
homepage:

131
scratch/material.cpp Normal file
View File

@@ -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; i<num_primitives;i++) {
// mAsset->mEngine->getRenderableManager().setMaterialInstanceAt(rInst, i, materialInstance);
// }

View File

@@ -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();