introduce stronger native typing, camera projection/culling methods, update tests
This commit is contained in:
@@ -24,14 +24,15 @@ Matrix4 double4x4ToMatrix4(double4x4 mat) {
|
||||
]);
|
||||
}
|
||||
|
||||
double4x4 matrix4ToDouble4x4(Matrix4 mat, double4x4 out) {
|
||||
|
||||
double4x4 matrix4ToDouble4x4(Matrix4 mat) {
|
||||
final out = Struct.create<double4x4>();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
out.col1[i] = mat.storage[i];
|
||||
out.col2[i] = mat.storage[i + 4];
|
||||
out.col3[i] = mat.storage[i + 8];
|
||||
out.col4[i] = mat.storage[i + 12];
|
||||
}
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@ Future<void> withVoidCallback(
|
||||
nativeCallable.close();
|
||||
}
|
||||
|
||||
Future<int> withVoidPointerCallback(
|
||||
Function(Pointer<NativeFunction<Void Function(Pointer<Void>)>>)
|
||||
Future<int> withPointerCallback<T extends NativeType>(
|
||||
Function(Pointer<NativeFunction<Void Function(Pointer<T>)>>)
|
||||
func) async {
|
||||
final completer = Completer<Pointer<Void>>();
|
||||
final completer = Completer<Pointer<T>>();
|
||||
// ignore: prefer_function_declarations_over_variables
|
||||
void Function(Pointer<Void>) callback = (Pointer<Void> ptr) {
|
||||
completer.complete(ptr);
|
||||
void Function(Pointer<NativeType>) callback = (Pointer<NativeType> ptr) {
|
||||
completer.complete(ptr.cast<T>());
|
||||
};
|
||||
final nativeCallable =
|
||||
NativeCallable<Void Function(Pointer<Void>)>.listener(callback);
|
||||
NativeCallable<Void Function(Pointer<NativeType>)>.listener(callback);
|
||||
func.call(nativeCallable.nativeFunction);
|
||||
var ptr = await completer.future;
|
||||
nativeCallable.close();
|
||||
|
||||
22
thermion_dart/lib/thermion_dart/viewer/ffi/camera_ffi.dart
Normal file
22
thermion_dart/lib/thermion_dart/viewer/ffi/camera_ffi.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:thermion_dart/thermion_dart/utils/matrix.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/ffi/thermion_dart.g.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/shared_types/camera.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
class ThermionFFICamera extends Camera {
|
||||
final Pointer<TCamera> pointer;
|
||||
|
||||
ThermionFFICamera(this.pointer);
|
||||
|
||||
@override
|
||||
Future setProjectionMatrixWithCulling(Matrix4 projectionMatrix,
|
||||
double near, double far) async {
|
||||
Camera_setCustomProjectionWithCulling(
|
||||
pointer,
|
||||
matrix4ToDouble4x4(projectionMatrix),
|
||||
near,
|
||||
far);
|
||||
}
|
||||
}
|
||||
@@ -17,129 +17,141 @@ external ffi.Pointer<ffi.Void> make_resource_loader(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer> Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>(isLeaf: true)
|
||||
external ffi.Pointer<ffi.Void> create_filament_viewer(
|
||||
external ffi.Pointer<TViewer> create_filament_viewer(
|
||||
ffi.Pointer<ffi.Void> context,
|
||||
ffi.Pointer<ffi.Void> loader,
|
||||
ffi.Pointer<ffi.Void> platform,
|
||||
ffi.Pointer<ffi.Char> uberArchivePath,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void destroy_filament_viewer(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Pointer<ffi.Void> Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external ffi.Pointer<ffi.Void> get_scene_manager(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<TEngine> Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external ffi.Pointer<TEngine> Viewer_getEngine(
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<TEngine>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external ffi.Pointer<TCamera> Engine_getCameraComponent(
|
||||
ffi.Pointer<TEngine> tEngine,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32,
|
||||
ffi.Uint32)>(isLeaf: true)
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TViewer>, ffi.IntPtr, ffi.Uint32, ffi.Uint32)>(isLeaf: true)
|
||||
external void create_render_target(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int texture,
|
||||
int width,
|
||||
int height,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void clear_background_image(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Bool)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_background_image(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
bool fillHeight,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
external void set_background_image_position(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double x,
|
||||
double y,
|
||||
bool clamp,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Float)>(isLeaf: true)
|
||||
external void set_background_color(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double r,
|
||||
double g,
|
||||
double b,
|
||||
double a,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Int)>(isLeaf: true)
|
||||
external void set_tone_mapping(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int toneMapping,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float)>(isLeaf: true)
|
||||
external void set_bloom(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double strength,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>)>(
|
||||
isLeaf: true)
|
||||
external void load_skybox(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> skyboxPath,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Float)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>, ffi.Float)>(isLeaf: true)
|
||||
external void load_ibl(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> iblPath,
|
||||
double intensity,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Float)>(isLeaf: true)
|
||||
external void create_ibl(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double r,
|
||||
double g,
|
||||
double b,
|
||||
double intensity,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Float>)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Float>)>(
|
||||
isLeaf: true)
|
||||
external void rotate_ibl(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Float> rotationMatrix,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void remove_skybox(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void remove_ibl(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
EntityId Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
ffi.Uint8,
|
||||
ffi.Float,
|
||||
ffi.Float,
|
||||
@@ -157,7 +169,7 @@ external void remove_ibl(
|
||||
ffi.Float,
|
||||
ffi.Bool)>(isLeaf: true)
|
||||
external int add_light(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int type,
|
||||
double colour,
|
||||
double intensity,
|
||||
@@ -176,22 +188,22 @@ external int add_light(
|
||||
bool shadows,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, EntityId)>(isLeaf: true)
|
||||
external void remove_light(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void clear_lights(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Float, ffi.Float,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, EntityId, ffi.Float, ffi.Float,
|
||||
ffi.Float)>(isLeaf: true)
|
||||
external void set_light_position(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int light,
|
||||
double x,
|
||||
double y,
|
||||
@@ -199,10 +211,10 @@ external void set_light_position(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Float, ffi.Float,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, EntityId, ffi.Float, ffi.Float,
|
||||
ffi.Float)>(isLeaf: true)
|
||||
external void set_light_direction(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int light,
|
||||
double x,
|
||||
double y,
|
||||
@@ -262,34 +274,34 @@ external void get_instances(
|
||||
ffi.Pointer<EntityId> out,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void set_main_camera(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<EntityId Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<EntityId Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external int get_main_camera(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Bool Function(
|
||||
ffi.Pointer<ffi.Void>, EntityId, ffi.Pointer<ffi.Char>)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, EntityId, ffi.Pointer<ffi.Char>)>(isLeaf: true)
|
||||
external bool set_camera(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entity,
|
||||
ffi.Pointer<ffi.Char> nodeName,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_view_frustum_culling(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool enabled,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Bool Function(
|
||||
ffi.Pointer<TViewer>,
|
||||
ffi.Uint64,
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<
|
||||
@@ -297,8 +309,8 @@ external void set_view_frustum_culling(
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void> buf, ffi.Size size,
|
||||
ffi.Pointer<ffi.Void> data)>>,
|
||||
ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
external void render(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
external bool render(
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int frameTimeInNanos,
|
||||
ffi.Pointer<ffi.Void> pixelBuffer,
|
||||
ffi.Pointer<
|
||||
@@ -310,84 +322,84 @@ external void render(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void capture(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Uint8> pixelBuffer,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> callback,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, ffi.Uint32,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Void>, ffi.Uint32,
|
||||
ffi.Uint32)>(isLeaf: true)
|
||||
external void create_swap_chain(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Void> window,
|
||||
int width,
|
||||
int height,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void destroy_swap_chain(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float)>(isLeaf: true)
|
||||
external void set_frame_interval(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double interval,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Uint32, ffi.Uint32)>(
|
||||
isLeaf: true)
|
||||
external void update_viewport(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int width,
|
||||
int height,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void scroll_begin(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Float)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Float)>(isLeaf: true)
|
||||
external void scroll_update(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void scroll_end(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
external void grab_begin(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double x,
|
||||
double y,
|
||||
bool pan,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float, ffi.Float)>(
|
||||
isLeaf: true)
|
||||
external void grab_update(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double x,
|
||||
double y,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void grab_end(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
@@ -652,15 +664,15 @@ external int get_morph_target_name_count(
|
||||
int childEntity,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, EntityId)>(isLeaf: true)
|
||||
external void remove_entity(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int asset,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void clear_entities(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
@@ -780,10 +792,10 @@ external void set_camera_model_matrix(
|
||||
double4x4 matrix,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<ffi.Void>, EntityId)>(
|
||||
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<TViewer>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external ffi.Pointer<TCamera> get_camera(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entity,
|
||||
);
|
||||
|
||||
@@ -874,10 +886,10 @@ external void set_camera_focus_distance(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, _ManipulatorMode, ffi.Double,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, _ManipulatorMode, ffi.Double,
|
||||
ffi.Double, ffi.Double)>(isLeaf: true)
|
||||
external void set_camera_manipulator_options(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int mode,
|
||||
double orbitSpeedX,
|
||||
double orbitSpeedY,
|
||||
@@ -885,16 +897,22 @@ external void set_camera_manipulator_options(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<TCamera>, double4x4, double4x4, ffi.Double,
|
||||
ffi.Double)>(isLeaf: true)
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TCamera>, double4x4, ffi.Double, ffi.Double)>(isLeaf: true)
|
||||
external void Camera_setCustomProjectionWithCulling(
|
||||
ffi.Pointer<TCamera> camera,
|
||||
double4x4 projectionMatrix,
|
||||
double4x4 projectionMatrixForCulling,
|
||||
double near,
|
||||
double far,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<TEngine>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external ffi.Pointer<TCamera> get_camera_component(
|
||||
ffi.Pointer<TEngine> engine,
|
||||
int entity,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Int Function(
|
||||
ffi.Pointer<ffi.Void>, EntityId, ffi.Pointer<ffi.Char>)>(isLeaf: true)
|
||||
@@ -913,37 +931,37 @@ external int reveal_mesh(
|
||||
ffi.Pointer<ffi.Char> meshName,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_post_processing(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool enabled,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_shadows_enabled(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool enabled,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Int)>(isLeaf: true)
|
||||
external void set_shadow_type(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int shadowType,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float, ffi.Float)>(
|
||||
isLeaf: true)
|
||||
external void set_soft_shadow_options(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double penumbraScale,
|
||||
double penumbraRatioScale,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Bool, ffi.Bool, ffi.Bool)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Bool, ffi.Bool, ffi.Bool)>(isLeaf: true)
|
||||
external void set_antialiasing(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool msaa,
|
||||
bool fxaa,
|
||||
bool taa,
|
||||
@@ -951,7 +969,7 @@ external void set_antialiasing(
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
ffi.Int,
|
||||
ffi.Int,
|
||||
ffi.Pointer<
|
||||
@@ -959,7 +977,7 @@ external void set_antialiasing(
|
||||
ffi.Void Function(
|
||||
EntityId entityId, ffi.Int x, ffi.Int y)>>)>(isLeaf: true)
|
||||
external void filament_pick(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int x,
|
||||
int y,
|
||||
ffi.Pointer<
|
||||
@@ -1012,16 +1030,16 @@ external ffi.Pointer<ffi.Char> get_entity_name_at(
|
||||
bool renderableOnly,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_recording(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool recording,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>(
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>)>(
|
||||
isLeaf: true)
|
||||
external void set_recording_output_directory(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> outputDirectory,
|
||||
);
|
||||
|
||||
@@ -1267,7 +1285,7 @@ external void set_material_depth_write(
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
EntityId,
|
||||
ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Uint32,
|
||||
@@ -1276,7 +1294,7 @@ external void set_material_depth_write(
|
||||
ffi.Uint32,
|
||||
ffi.Uint32)>(isLeaf: true)
|
||||
external void unproject_texture(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entity,
|
||||
ffi.Pointer<ffi.Uint8> input,
|
||||
int inputWidth,
|
||||
@@ -1348,8 +1366,7 @@ external void MaterialInstance_setDepthCulling(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void> viewer)>>)>(isLeaf: true)
|
||||
ffi.Void Function(ffi.Pointer<TViewer> viewer)>>)>(isLeaf: true)
|
||||
external void create_filament_viewer_render_thread(
|
||||
ffi.Pointer<ffi.Void> context,
|
||||
ffi.Pointer<ffi.Void> platform,
|
||||
@@ -1361,19 +1378,19 @@ external void create_filament_viewer_render_thread(
|
||||
renderCallback,
|
||||
ffi.Pointer<ffi.Void> renderCallbackOwner,
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> viewer)>>
|
||||
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TViewer> viewer)>>
|
||||
callback,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Uint32,
|
||||
ffi.Uint32,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void create_swap_chain_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Void> surface,
|
||||
int width,
|
||||
int height,
|
||||
@@ -1381,39 +1398,39 @@ external void create_swap_chain_render_thread(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void destroy_swap_chain_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32, ffi.Uint32,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.IntPtr, ffi.Uint32, ffi.Uint32,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void create_render_target_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int nativeTextureId,
|
||||
int width,
|
||||
int height,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void destroy_filament_viewer_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void render_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void capture_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Uint8> out,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
);
|
||||
@@ -1425,46 +1442,46 @@ external FilamentRenderCallback make_render_callback_fn_pointer(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void set_rendering_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool rendering,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void request_frame_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float)>(isLeaf: true)
|
||||
external void set_frame_interval_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double frameInterval,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Float,
|
||||
ffi.Float)>(isLeaf: true)
|
||||
external void set_background_color_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double r,
|
||||
double g,
|
||||
double b,
|
||||
double a,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void clear_background_image_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Bool,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>, ffi.Bool,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void set_background_image_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
bool fillHeight,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
@@ -1472,57 +1489,57 @@ external void set_background_image_render_thread(
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Float, ffi.Float, ffi.Bool)>(isLeaf: true)
|
||||
external void set_background_image_position_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double x,
|
||||
double y,
|
||||
bool clamp,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Int)>(isLeaf: true)
|
||||
external void set_tone_mapping_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int toneMapping,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Float)>(isLeaf: true)
|
||||
external void set_bloom_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
double strength,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void load_skybox_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> skyboxPath,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, ffi.Float)>(isLeaf: true)
|
||||
ffi.Pointer<TViewer>, ffi.Pointer<ffi.Char>, ffi.Float)>(isLeaf: true)
|
||||
external void load_ibl_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.Char> iblPath,
|
||||
double intensity,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void remove_skybox_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void remove_ibl_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
ffi.Uint8,
|
||||
ffi.Float,
|
||||
ffi.Float,
|
||||
@@ -1542,7 +1559,7 @@ external void remove_ibl_render_thread(
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(EntityId)>>)>(
|
||||
isLeaf: true)
|
||||
external void add_light_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int type,
|
||||
double colour,
|
||||
double intensity,
|
||||
@@ -1562,15 +1579,15 @@ external void add_light_render_thread(
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(EntityId)>> callback,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, EntityId)>(isLeaf: true)
|
||||
external void remove_light_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entityId,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>)>(isLeaf: true)
|
||||
external void clear_lights_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
@@ -1638,31 +1655,28 @@ external void create_instance_render_thread(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, EntityId,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void remove_entity_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int asset,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> callback,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<ffi.Void>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void clear_entities_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> callback,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
EntityId,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Void Function(ffi.Pointer<TViewer>, EntityId, ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
||||
isLeaf: true)
|
||||
external void set_camera_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int asset,
|
||||
ffi.Pointer<ffi.Char> nodeName,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> callback,
|
||||
@@ -1794,9 +1808,9 @@ external void set_bone_transform_render_thread(
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> callback,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(isLeaf: true)
|
||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TViewer>, ffi.Bool)>(isLeaf: true)
|
||||
external void set_post_processing_render_thread(
|
||||
ffi.Pointer<ffi.Void> viewer,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
bool enabled,
|
||||
);
|
||||
|
||||
@@ -1843,7 +1857,7 @@ external void create_geometry_render_thread(
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<TViewer>,
|
||||
EntityId,
|
||||
ffi.Pointer<ffi.Uint8>,
|
||||
ffi.Uint32,
|
||||
@@ -1853,7 +1867,7 @@ external void create_geometry_render_thread(
|
||||
ffi.Uint32,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||
external void unproject_texture_render_thread(
|
||||
ffi.Pointer<ffi.Void> sceneManager,
|
||||
ffi.Pointer<TViewer> viewer,
|
||||
int entity,
|
||||
ffi.Pointer<ffi.Uint8> input,
|
||||
int inputWidth,
|
||||
@@ -1868,6 +1882,10 @@ final class TCamera extends ffi.Opaque {}
|
||||
|
||||
final class TMaterialInstance extends ffi.Opaque {}
|
||||
|
||||
final class TEngine extends ffi.Opaque {}
|
||||
|
||||
final class TViewer extends ffi.Opaque {}
|
||||
|
||||
final class TMaterialKey extends ffi.Struct {
|
||||
@ffi.Bool()
|
||||
external bool doubleSided;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
||||
@@ -8,6 +7,8 @@ import 'package:thermion_dart/thermion_dart/entities/gizmo.dart';
|
||||
import 'package:thermion_dart/thermion_dart/utils/matrix.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/events.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/ffi/callbacks.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/ffi/camera_ffi.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/shared_types/camera.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
import 'package:vector_math/vector_math_64.dart' as v64;
|
||||
import '../thermion_viewer_base.dart';
|
||||
@@ -25,7 +26,7 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
|
||||
Pointer<Void>? _sceneManager;
|
||||
|
||||
Pointer<Void>? _viewer;
|
||||
Pointer<TViewer>? _viewer;
|
||||
|
||||
final String? uberArchivePath;
|
||||
|
||||
@@ -102,7 +103,7 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
Future updateViewportAndCameraProjection(double width, double height) async {
|
||||
viewportDimensions = (width * pixelRatio, height * pixelRatio);
|
||||
update_viewport(_viewer!, width.toInt(), height.toInt());
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var near = await getCameraCullingNear();
|
||||
if (near.abs() < 0.000001) {
|
||||
near = kNear;
|
||||
@@ -113,11 +114,12 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
}
|
||||
|
||||
var aspect = viewportDimensions.$1 / viewportDimensions.$2;
|
||||
var focalLength = get_camera_focal_length(mainCamera);
|
||||
var focalLength = get_camera_focal_length(mainCamera.pointer);
|
||||
if (focalLength.abs() < 0.1) {
|
||||
focalLength = kFocalLength;
|
||||
}
|
||||
set_camera_lens_projection(mainCamera, near, far, aspect, focalLength);
|
||||
set_camera_lens_projection(
|
||||
mainCamera.pointer, near, far, aspect, focalLength);
|
||||
}
|
||||
|
||||
Future createSwapChain(double width, double height,
|
||||
@@ -141,8 +143,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
final uberarchivePtr =
|
||||
uberArchivePath?.toNativeUtf8(allocator: allocator).cast<Char>() ??
|
||||
nullptr;
|
||||
var viewer = await withVoidPointerCallback(
|
||||
(Pointer<NativeFunction<Void Function(Pointer<Void>)>> callback) {
|
||||
var viewer = await withPointerCallback(
|
||||
(Pointer<NativeFunction<Void Function(Pointer<TViewer>)>> callback) {
|
||||
create_filament_viewer_render_thread(
|
||||
_sharedContext,
|
||||
_driver,
|
||||
@@ -1144,8 +1146,25 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
set_main_camera(_viewer!);
|
||||
}
|
||||
|
||||
Future<ThermionEntity> getMainCamera() {
|
||||
return Future.value(get_main_camera(_viewer!));
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<ThermionEntity> getMainCameraEntity() async {
|
||||
return get_main_camera(_viewer!);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<Camera> getMainCamera() async {
|
||||
var camera = await getCameraComponent(await getMainCameraEntity());
|
||||
return camera!;
|
||||
}
|
||||
|
||||
Future<Camera?> getCameraComponent(ThermionEntity cameraEntity) async {
|
||||
var engine = Viewer_getEngine(_viewer!);
|
||||
var camera = Engine_getCameraComponent(engine, cameraEntity);
|
||||
return ThermionFFICamera(camera);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1229,8 +1248,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
///
|
||||
///
|
||||
Future<double> getCameraFov(bool horizontal) async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
return get_camera_fov(mainCamera, horizontal);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
return get_camera_fov(mainCamera.pointer, horizontal);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1258,8 +1277,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
}
|
||||
|
||||
Future<double> getCameraNear() async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
return get_camera_near(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
return get_camera_near(mainCamera.pointer);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1267,8 +1286,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
///
|
||||
@override
|
||||
Future<double> getCameraCullingFar() async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
return get_camera_culling_far(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
return get_camera_culling_far(mainCamera.pointer);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1276,8 +1295,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
///
|
||||
@override
|
||||
Future setCameraFocusDistance(double focusDistance) async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
set_camera_focus_distance(mainCamera, focusDistance);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
set_camera_focus_distance(mainCamera.pointer, focusDistance);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1312,8 +1331,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
@override
|
||||
Future setCameraExposure(
|
||||
double aperture, double shutterSpeed, double sensitivity) async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
set_camera_exposure(mainCamera, aperture, shutterSpeed, sensitivity);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
set_camera_exposure(mainCamera.pointer, aperture, shutterSpeed, sensitivity);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1341,10 +1360,9 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
///
|
||||
@override
|
||||
Future setCameraModelMatrix4(Matrix4 modelMatrix) async {
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
final out = Struct.create<double4x4>();
|
||||
matrix4ToDouble4x4(modelMatrix, out);
|
||||
set_camera_model_matrix(mainCamera, out);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
final out = matrix4ToDouble4x4(modelMatrix);
|
||||
set_camera_model_matrix(mainCamera.pointer, out);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1576,8 +1594,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var matrixStruct = get_camera_view_matrix(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var matrixStruct = get_camera_view_matrix(mainCamera.pointer);
|
||||
return double4x4ToMatrix4(matrixStruct);
|
||||
}
|
||||
|
||||
@@ -1589,8 +1607,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var matrixStruct = get_camera_model_matrix(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var matrixStruct = get_camera_model_matrix(mainCamera.pointer);
|
||||
return double4x4ToMatrix4(matrixStruct);
|
||||
}
|
||||
|
||||
@@ -1602,8 +1620,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var matrixStruct = get_camera_projection_matrix(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var matrixStruct = get_camera_projection_matrix(mainCamera.pointer);
|
||||
return double4x4ToMatrix4(matrixStruct);
|
||||
}
|
||||
|
||||
@@ -1615,8 +1633,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var matrixStruct = get_camera_culling_projection_matrix(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var matrixStruct = get_camera_culling_projection_matrix(mainCamera.pointer);
|
||||
return double4x4ToMatrix4(matrixStruct);
|
||||
}
|
||||
|
||||
@@ -1675,8 +1693,8 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available");
|
||||
}
|
||||
var mainCamera = get_camera(_viewer!, await getMainCamera());
|
||||
var arrayPtr = get_camera_frustum(mainCamera);
|
||||
var mainCamera = await getMainCamera() as ThermionFFICamera;
|
||||
var arrayPtr = get_camera_frustum(mainCamera.pointer);
|
||||
var doubleList = arrayPtr.asTypedList(24);
|
||||
|
||||
var frustum = Frustum();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// abstract class Camera {
|
||||
// Future setProjectionMatrixWithCulling(Matrix4 projectionMatrix, Matrix4 projectionMatrixForCUlling);
|
||||
// Future setDepthCullingEnabled(bool enabled);
|
||||
// }
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
abstract class Camera {
|
||||
|
||||
Future setProjectionMatrixWithCulling(Matrix4 projectionMatrix, double near, double far);
|
||||
|
||||
}
|
||||
|
||||
enum AlphaMode { OPAQUE, MASK, BLEND }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:thermion_dart/thermion_dart/viewer/events.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/shared_types/camera.dart';
|
||||
|
||||
import 'shared_types/shared_types.dart';
|
||||
export 'shared_types/shared_types.dart';
|
||||
@@ -444,9 +445,14 @@ abstract class ThermionViewer {
|
||||
Future setMainCamera();
|
||||
|
||||
///
|
||||
/// Returns the entity associated with the main camera.
|
||||
/// Returns the entity associated with the main camera. You probably never need this; use getMainCamera instead.
|
||||
///
|
||||
Future<ThermionEntity> getMainCamera();
|
||||
Future<ThermionEntity> getMainCameraEntity();
|
||||
|
||||
///
|
||||
/// Returns the entity associated with the main camera. You probably never need this; use getMainCamera instead.
|
||||
///
|
||||
Future<Camera> getMainCamera();
|
||||
|
||||
///
|
||||
/// Sets the horizontal field of view (if [horizontal] is true) or vertical field of view for the currently active camera to [degrees].
|
||||
@@ -498,7 +504,10 @@ abstract class ThermionViewer {
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setCameraLensProjection({double near = kNear, double far = kFar, double? aspect,
|
||||
Future setCameraLensProjection(
|
||||
{double near = kNear,
|
||||
double far = kFar,
|
||||
double? aspect,
|
||||
double focalLength = kFocalLength});
|
||||
|
||||
///
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'dart:typed_data';
|
||||
import 'package:thermion_dart/thermion_dart/entities/abstract_gizmo.dart';
|
||||
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/events.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/shared_types/camera.dart';
|
||||
import 'package:thermion_dart/thermion_dart/viewer/thermion_viewer_base.dart';
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
import 'dart:async';
|
||||
@@ -214,12 +215,6 @@ class ThermionViewerStub extends ThermionViewer {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ThermionEntity> getMainCamera() {
|
||||
// TODO: implement getMainCamera
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getMorphTargetNames(
|
||||
ThermionEntity entity, ThermionEntity childEntity) {
|
||||
@@ -958,6 +953,18 @@ class ThermionViewerStub extends ThermionViewer {
|
||||
// TODO: implement setCameraLensProjection
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ThermionEntity> getMainCameraEntity() {
|
||||
// TODO: implement getMainCameraEntity
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Camera> getMainCamera() {
|
||||
// TODO: implement getMainCamera
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user