renaming to Thermion
This commit is contained in:
3
examples/dart/cli_wasm/.gitignore
vendored
Normal file
3
examples/dart/cli_wasm/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://dart.dev/guides/libraries/private-files
|
||||
# Created by `dart pub`
|
||||
.dart_tool/
|
||||
3
examples/dart/cli_wasm/CHANGELOG.md
Normal file
3
examples/dart/cli_wasm/CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## 1.0.0
|
||||
|
||||
- Initial version.
|
||||
2
examples/dart/cli_wasm/README.md
Normal file
2
examples/dart/cli_wasm/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
A sample command-line application with an entrypoint in `bin/`, library code
|
||||
in `lib/`, and example unit test in `test/`.
|
||||
30
examples/dart/cli_wasm/analysis_options.yaml
Normal file
30
examples/dart/cli_wasm/analysis_options.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file configures the static analysis results for your project (errors,
|
||||
# warnings, and lints).
|
||||
#
|
||||
# This enables the 'recommended' set of lints from `package:lints`.
|
||||
# This set helps identify many issues that may lead to problems when running
|
||||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
|
||||
# style and format.
|
||||
#
|
||||
# If you want a smaller set of lints you can change this to specify
|
||||
# 'package:lints/core.yaml'. These are just the most critical lints
|
||||
# (the recommended set includes the core lints).
|
||||
# The core lints are also what is used by pub.dev for scoring packages.
|
||||
|
||||
include: package:lints/recommended.yaml
|
||||
|
||||
# Uncomment the following section to specify additional rules.
|
||||
|
||||
# linter:
|
||||
# rules:
|
||||
# - camel_case_types
|
||||
|
||||
# analyzer:
|
||||
# exclude:
|
||||
# - path/to/excluded/files/**
|
||||
|
||||
# For more information about the core and recommended set of lints, see
|
||||
# https://dart.dev/go/core-lints
|
||||
|
||||
# For additional information about configuring this file, see
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
4
examples/dart/cli_wasm/bin/.gitignore
vendored
Normal file
4
examples/dart/cli_wasm/bin/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
example_cli.mjs
|
||||
example_cli.wasm
|
||||
example_cli.unopt.wasm
|
||||
node_modules/**/*
|
||||
98
examples/dart/cli_wasm/bin/build.log
Normal file
98
examples/dart/cli_wasm/bin/build.log
Normal file
@@ -0,0 +1,98 @@
|
||||
MAIN
|
||||
initializing
|
||||
gto uberarchive ptr
|
||||
create void ptr callback
|
||||
resolve
|
||||
try
|
||||
done, returning
|
||||
created
|
||||
got promise [object Promise]
|
||||
got fn ptr address 2720
|
||||
Calling create_filament_viewer_ffi
|
||||
Call complete
|
||||
Created viewer, waiting for initialization
|
||||
Creating WebGL context.
|
||||
Created WebGL context 2.0
|
||||
Made WebGL context current
|
||||
FEngine (32 bits) created at 0x1937d0 (threading is disabled)
|
||||
|
||||
[stack-gl], [ANGLE], [OpenGL ES 3.0 (WebGL 1.0 stack-gl 8.0.2)], [OpenGL ES GLSL ES 1.00 (WebGL GLSL ES 1.0 stack-gl)]
|
||||
|
||||
Feature level: 1
|
||||
Active workarounds:
|
||||
|
||||
Backend feature level: 1
|
||||
|
||||
FEngine feature level: 1
|
||||
|
||||
Set frame interval to 16.666666
|
||||
Setting tone mapping to ACES
|
||||
Bloom is disabled on WebGL builds as it causes instability with certain drivers. setBloom will be ignored
|
||||
View created
|
||||
Camera aperture 16.000000 shutter 0.008000 sensitivity 100.000000
|
||||
Created ubershader provider.
|
||||
Added imageEntity 6
|
||||
Got void ptr callback
|
||||
Set viewer to true
|
||||
Created viewer 1652064
|
||||
Initialied
|
||||
Loading GLB from buffer of length 116948
|
||||
Loaded glb
|
||||
Entities : [10, 11, 12]
|
||||
entityName : Cone
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
morph targets : [Key 1, Key 2, Key 3, Key 4, Key 5, Key 6, Key 7, Key 8]
|
||||
entityName : Cube
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
morph targets : [Key 1, Key 2]
|
||||
entityName : Cylinder
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
Getting morpht arget names
|
||||
No insdtance
|
||||
Using asset instance
|
||||
morph targets : [Key 1, Key 2, Key 3, Key 4]
|
||||
33
examples/dart/cli_wasm/bin/example_cli.dart
Normal file
33
examples/dart/cli_wasm/bin/example_cli.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:thermion_dart/thermion_dart/compatibility/compatibility.dart';
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
final resourceLoader = thermion_dart_web_get_resource_loader_wrapper();
|
||||
var viewer = FilamentViewer(resourceLoader: resourceLoader.cast<Void>());
|
||||
viewer.initialized.then((_) async {
|
||||
var entity = await viewer.loadGlb(
|
||||
"/Users/nickfisher/Documents/polyvox/apps/packages/thermion_flutter/thermion_flutter_federated/thermion_flutter/example/assets/shapes/shapes.glb");
|
||||
var entities = await viewer.getChildEntities(entity, true);
|
||||
for (final childEntity in entities) {
|
||||
final childName = await viewer.getNameForEntity(childEntity);
|
||||
var morphTargetNames =
|
||||
await viewer.getMorphTargetNames(entity, childEntity!);
|
||||
if (morphTargetNames.isNotEmpty) {
|
||||
await viewer.setMorphTargetWeights(
|
||||
childEntity, List<double>.filled(morphTargetNames.length, 1.0));
|
||||
}
|
||||
var animationData = MorphAnimationData(
|
||||
List.generate(
|
||||
10, (_) => List<double>.filled(morphTargetNames.length, 1.0)),
|
||||
morphTargetNames);
|
||||
|
||||
await viewer.setMorphAnimationData(entity, animationData,
|
||||
targetMeshNames: [childName!]);
|
||||
}
|
||||
});
|
||||
|
||||
while (true) {
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
}
|
||||
}
|
||||
123
examples/dart/cli_wasm/bin/main.js
Normal file
123
examples/dart/cli_wasm/bin/main.js
Normal file
@@ -0,0 +1,123 @@
|
||||
const fs = require('node:fs');
|
||||
const thermion_dart = require("./thermion_dart.js")
|
||||
const GLctx = require('gl')(100, 100, { preserveDrawingBuffer: true })
|
||||
|
||||
// queueMicrotask = (func) => {
|
||||
// func();
|
||||
// }
|
||||
// read('thermion_dart.wasm', 'binary')
|
||||
// const exports = {};
|
||||
// const module = {};
|
||||
|
||||
const wasmBuffer = fs.readFileSync('thermion_dart.wasm');
|
||||
|
||||
var dartFilamentModulePromise = WebAssembly.compile(wasmBuffer);
|
||||
let globalDf;
|
||||
thermion_dart({
|
||||
dartFilamentResolveCallback: (cb, data) => {
|
||||
const fn = globalDf.wasmTable.get(cb);
|
||||
if(data) {
|
||||
fn(data);
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
},
|
||||
ctx:GLctx}).then((df) => {
|
||||
globalDf = df;
|
||||
createVoidCallback = () => {
|
||||
let res; //placeholder for resolver callback, outside of promise
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
res = resolve;
|
||||
});
|
||||
try {
|
||||
const callback = () => {
|
||||
try {
|
||||
res({});
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
const fnPtr = df.addFunction(callback, 'v');
|
||||
return [promise, fnPtr];
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
createIntCallback = () => {
|
||||
let res;
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
res = resolve;
|
||||
});
|
||||
try {
|
||||
const callback = (val) => {
|
||||
try {
|
||||
res(val);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
const fnPtr = df.addFunction(callback, 'vi');
|
||||
return [promise, fnPtr];
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
createVoidPointerCallback = () => {
|
||||
console.log("create void ptr callback");
|
||||
let res; //placeholder for resolver callback, outside of promise
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
console.log("resolve");
|
||||
res = resolve;
|
||||
});
|
||||
try {
|
||||
console.log("try");
|
||||
const callback = (voidPtr) => {
|
||||
try {
|
||||
res(voidPtr);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
const fnPtr = df.addFunction(callback, 'vi');
|
||||
console.log("done, returning");
|
||||
return [promise, fnPtr];
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
createBoolCallback = () => {
|
||||
let res; //placeholder for resolver callback, outside of promise
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
res = resolve;
|
||||
});
|
||||
try {
|
||||
const callback = (val) => {
|
||||
try {
|
||||
res(val);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
const fnPtr = df.addFunction(callback, 'vi');
|
||||
return [promise, fnPtr];
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
import('./example_cli.mjs').then((dart2wasm_runtime) => {
|
||||
var dartModulePromise = WebAssembly.compile(fs.readFileSync('./example_cli.wasm'));
|
||||
const imports = {"thermion_dart": df, "ctx": GLctx};
|
||||
dart2wasm_runtime.instantiate(dartModulePromise, imports).then((moduleInstance) => {
|
||||
dart2wasm_runtime.invoke(moduleInstance);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// // dartModulePromise.then((dartModule) => { console.log(dartModule.exports); dart2wasm_runtime.invoke(dartModule, imports);}); });
|
||||
1559
examples/dart/cli_wasm/bin/package-lock.json
generated
Normal file
1559
examples/dart/cli_wasm/bin/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
5
examples/dart/cli_wasm/bin/package.json
Normal file
5
examples/dart/cli_wasm/bin/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"gl": "^8.0.2"
|
||||
}
|
||||
}
|
||||
1
examples/dart/cli_wasm/bin/thermion_dart.js
Symbolic link
1
examples/dart/cli_wasm/bin/thermion_dart.js
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../native/web/build/build/out/dart_filament.js
|
||||
1
examples/dart/cli_wasm/bin/thermion_dart.wasm
Symbolic link
1
examples/dart/cli_wasm/bin/thermion_dart.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../native/web/build/build/out/dart_filament.wasm
|
||||
1
examples/dart/cli_wasm/bin/thermion_dart.worker.js
Symbolic link
1
examples/dart/cli_wasm/bin/thermion_dart.worker.js
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../native/web/build/build/out/dart_filament.worker.js
|
||||
18
examples/dart/cli_wasm/pubspec.yaml
Normal file
18
examples/dart/cli_wasm/pubspec.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
name: example_cli
|
||||
description: A sample command-line application.
|
||||
version: 1.0.0
|
||||
# repository: https://github.com/my_org/my_repo
|
||||
|
||||
environment:
|
||||
sdk: ^3.3.0
|
||||
|
||||
# Add regular dependencies here.
|
||||
dependencies:
|
||||
thermion_dart:
|
||||
path: ../../
|
||||
ffi:
|
||||
|
||||
dev_dependencies:
|
||||
ffigen: ^11.0.0
|
||||
lints: ^3.0.0
|
||||
test: ^1.24.0
|
||||
8
examples/dart/cli_wasm/test/example_cli_test.dart
Normal file
8
examples/dart/cli_wasm/test/example_cli_test.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
import 'package:example_cli/example_cli.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('calculate', () {
|
||||
expect(calculate(), 42);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user