refactor
This commit is contained in:
@@ -33,10 +33,16 @@ class FFIAsset extends ThermionAsset {
|
|||||||
///
|
///
|
||||||
late final ThermionEntity entity;
|
late final ThermionEntity entity;
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
FFIAsset(this.asset, this.app, {this.isInstance = false}) {
|
FFIAsset(this.asset, this.app, {this.isInstance = false}) {
|
||||||
entity = SceneAsset_getEntity(asset);
|
entity = SceneAsset_getEntity(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future<List<ThermionEntity>> getChildEntities() async {
|
Future<List<ThermionEntity>> getChildEntities() async {
|
||||||
var count = SceneAsset_getChildEntityCount(asset);
|
var count = SceneAsset_getChildEntityCount(asset);
|
||||||
@@ -45,6 +51,22 @@ class FFIAsset extends ThermionAsset {
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
@override
|
||||||
|
Future<ThermionEntity?> getChildEntity(
|
||||||
|
FFIAsset asset, String childName) async {
|
||||||
|
final childEntities = await getChildEntities();
|
||||||
|
for (final entity in childEntities) {
|
||||||
|
var name = NameComponentManager_getName(app.nameComponentManager, entity);
|
||||||
|
if (name == childName) {
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ThermionAsset> getInstance(int index) async {
|
Future<ThermionAsset> getInstance(int index) async {
|
||||||
if (isInstance) {
|
if (isInstance) {
|
||||||
@@ -141,7 +163,8 @@ class FFIAsset extends ThermionAsset {
|
|||||||
}
|
}
|
||||||
var sourceMaterialInstance = FFIMaterialInstance(
|
var sourceMaterialInstance = FFIMaterialInstance(
|
||||||
RenderableManager_getMaterialInstanceAt(
|
RenderableManager_getMaterialInstanceAt(
|
||||||
app.renderableManager, targetEntity, 0), app);
|
app.renderableManager, targetEntity, 0),
|
||||||
|
app);
|
||||||
|
|
||||||
await sourceMaterialInstance.setStencilWriteEnabled(true);
|
await sourceMaterialInstance.setStencilWriteEnabled(true);
|
||||||
await sourceMaterialInstance.setDepthWriteEnabled(true);
|
await sourceMaterialInstance.setDepthWriteEnabled(true);
|
||||||
@@ -328,6 +351,9 @@ class FFIAsset extends ThermionAsset {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
Future setCastShadows(bool castShadows) async {
|
Future setCastShadows(bool castShadows) async {
|
||||||
RenderableManager_setCastShadows(
|
RenderableManager_setCastShadows(
|
||||||
app.renderableManager, this.entity, castShadows);
|
app.renderableManager, this.entity, castShadows);
|
||||||
@@ -337,6 +363,9 @@ class FFIAsset extends ThermionAsset {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
Future setReceiveShadows(bool receiveShadows) async {
|
Future setReceiveShadows(bool receiveShadows) async {
|
||||||
RenderableManager_setReceiveShadows(
|
RenderableManager_setReceiveShadows(
|
||||||
app.renderableManager, this.entity, receiveShadows);
|
app.renderableManager, this.entity, receiveShadows);
|
||||||
@@ -345,4 +374,22 @@ class FFIAsset extends ThermionAsset {
|
|||||||
app.renderableManager, entity, receiveShadows);
|
app.renderableManager, entity, receiveShadows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
Future<bool> isCastShadowsEnabled(ThermionEntity entity) async {
|
||||||
|
return RenderableManager_isShadowCaster(app.renderableManager, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
Future<bool> isReceiveShadowsEnabled(ThermionEntity entity) async {
|
||||||
|
return RenderableManager_isShadowReceiver(app.renderableManager, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future transformToUnitCube() async {
|
||||||
|
SceneAsset_transformToUnitCube(asset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,61 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_filament_app.dart';
|
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_filament_app.dart';
|
||||||
|
import 'package:thermion_dart/src/viewer/src/ffi/src/thermion_dart.g.dart';
|
||||||
import 'package:thermion_dart/src/viewer/src/shared_types/layers.dart';
|
import 'package:thermion_dart/src/viewer/src/shared_types/layers.dart';
|
||||||
import 'package:vector_math/vector_math_64.dart';
|
import 'package:vector_math/vector_math_64.dart';
|
||||||
|
|
||||||
import '../../../../utils/src/matrix.dart';
|
import '../../../../utils/src/matrix.dart';
|
||||||
import '../../thermion_viewer_base.dart';
|
import '../../thermion_viewer_base.dart';
|
||||||
import 'thermion_dart.g.dart' as g;
|
|
||||||
|
|
||||||
class FFICamera extends Camera {
|
class FFICamera extends Camera {
|
||||||
final Pointer<g.TCamera> camera;
|
final Pointer<TCamera> camera;
|
||||||
final FFIFilamentApp app;
|
final FFIFilamentApp app;
|
||||||
late ThermionEntity _entity;
|
late ThermionEntity _entity;
|
||||||
|
|
||||||
FFICamera(this.camera, this.app) {
|
FFICamera(this.camera, this.app) {
|
||||||
_entity = g.Camera_getEntity(camera);
|
_entity = Camera_getEntity(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future setProjectionMatrixWithCulling(
|
Future setProjectionMatrixWithCulling(
|
||||||
Matrix4 projectionMatrix, double near, double far) async {
|
Matrix4 projectionMatrix, double near, double far) async {
|
||||||
g.Camera_setCustomProjectionWithCulling(
|
Camera_setCustomProjectionWithCulling(
|
||||||
camera, matrix4ToDouble4x4(projectionMatrix), near, far);
|
camera, matrix4ToDouble4x4(projectionMatrix), near, far);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
Future<Matrix4> getModelMatrix() async {
|
Future<Matrix4> getModelMatrix() async {
|
||||||
return double4x4ToMatrix4(g.Camera_getModelMatrix(camera));
|
return double4x4ToMatrix4(Camera_getModelMatrix(camera));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
@override
|
||||||
|
Future<Matrix4> getProjectionMatrix() async {
|
||||||
|
var matrixStruct = Camera_getProjectionMatrix(camera);
|
||||||
|
return double4x4ToMatrix4(matrixStruct);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
@override
|
||||||
|
Future<Matrix4> getCullingProjectionMatrix() async {
|
||||||
|
var matrixStruct = Camera_getCullingProjectionMatrix(camera);
|
||||||
|
return double4x4ToMatrix4(matrixStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setTransform(Matrix4 transform) async {
|
Future setTransform(Matrix4 transform) async {
|
||||||
var entity = g.Camera_getEntity(camera);
|
var entity = Camera_getEntity(camera);
|
||||||
g.TransformManager_setTransform(
|
TransformManager_setTransform(
|
||||||
app.transformManager, entity, matrix4ToDouble4x4(transform));
|
app.transformManager, entity, matrix4ToDouble4x4(transform));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,17 +65,23 @@ class FFICamera extends Camera {
|
|||||||
double far = kFar,
|
double far = kFar,
|
||||||
double aspect = 1.0,
|
double aspect = 1.0,
|
||||||
double focalLength = kFocalLength}) async {
|
double focalLength = kFocalLength}) async {
|
||||||
g.Camera_setLensProjection(camera, near, far, aspect, focalLength);
|
Camera_setLensProjection(camera, near, far, aspect, focalLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
ThermionEntity getEntity() {
|
ThermionEntity getEntity() {
|
||||||
return _entity;
|
return _entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future setModelMatrix(Matrix4 matrix) async {
|
Future setModelMatrix(Matrix4 matrix) async {
|
||||||
g.Camera_setModelMatrix(camera, matrix4ToDouble4x4(matrix));
|
Camera_setModelMatrix(camera, matrix4ToDouble4x4(matrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -64,30 +94,60 @@ class FFICamera extends Camera {
|
|||||||
@override
|
@override
|
||||||
int get hashCode => camera.hashCode;
|
int get hashCode => camera.hashCode;
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future<double> getCullingFar() async {
|
Future<double> getCullingFar() async {
|
||||||
return g.Camera_getCullingFar(camera);
|
return Camera_getCullingFar(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future<double> getNear() async {
|
Future<double> getNear() async {
|
||||||
return g.Camera_getNear(camera);
|
return Camera_getNear(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
@override
|
@override
|
||||||
Future<double> getFocalLength() async {
|
Future<double> getFocalLength() async {
|
||||||
return g.Camera_getFocalLength(camera);
|
return Camera_getFocalLength(camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
Future<Frustum> getFrustum() async {
|
||||||
|
var out = Float64List(24);
|
||||||
|
Camera_getFrustum(camera, out.address);
|
||||||
|
|
||||||
|
var frustum = Frustum();
|
||||||
|
frustum.plane0.setFromComponents(out[0], out[1], out[2], out[3]);
|
||||||
|
frustum.plane1.setFromComponents(out[4], out[5], out[6], out[7]);
|
||||||
|
frustum.plane2.setFromComponents(out[8], out[9], out[10], out[11]);
|
||||||
|
frustum.plane3.setFromComponents(out[12], out[13], out[14], out[15]);
|
||||||
|
frustum.plane4.setFromComponents(out[16], out[17], out[18], out[19]);
|
||||||
|
frustum.plane5.setFromComponents(out[20], out[21], out[22], out[23]);
|
||||||
|
return frustum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Matrix4> getViewMatrix() async {
|
Future<Matrix4> getViewMatrix() async {
|
||||||
return double4x4ToMatrix4(g.Camera_getViewMatrix(camera));
|
return double4x4ToMatrix4(Camera_getViewMatrix(camera));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setProjection(Projection projection, double left, double right,
|
Future setProjection(Projection projection, double left, double right,
|
||||||
double bottom, double top, double near, double far) async {
|
double bottom, double top, double near, double far) async {
|
||||||
var pType = g.Projection.values[projection.index];
|
Camera_setProjection(camera, TProjection.values[projection.index], left,
|
||||||
g.Camera_setProjection(camera, pType, left, right, bottom, top, near, far);
|
right, bottom, top, near, far);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future destroy() async {
|
||||||
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,4 +152,17 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
|||||||
|
|
||||||
return FFIRenderTarget(renderTarget, this);
|
return FFIRenderTarget(renderTarget, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ///
|
||||||
|
// ///
|
||||||
|
// ///
|
||||||
|
// Future<RenderTarget> createRenderTarget(int width, int height,
|
||||||
|
// {covariant FFITexture? color, covariant FFITexture? depth}) async {
|
||||||
|
// final renderTarget = await withPointerCallback<TRenderTarget>((cb) {
|
||||||
|
// RenderTarget_createRenderThread(app.engine, width, height,
|
||||||
|
// color?.pointer ?? nullptr, depth?.pointer ?? nullptr, cb);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return FFIRenderTarget(renderTarget, app);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class FFIGizmo extends FFIAsset implements GizmoAsset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isNonPickable(ThermionEntity entity) {
|
bool isNonPickable(ThermionEntity entity) {
|
||||||
return SceneManager_isGridEntity(sceneManager, entity);
|
throw UnimplementedError();
|
||||||
|
// return SceneManager_isGridEntity(sceneManager, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isGizmoEntity(ThermionEntity entity) => gizmoEntities.contains(entity);
|
bool isGizmoEntity(ThermionEntity entity) => gizmoEntities.contains(entity);
|
||||||
@@ -29,10 +30,7 @@ class FFIGizmo extends FFIAsset implements GizmoAsset {
|
|||||||
FFIGizmo(
|
FFIGizmo(
|
||||||
this._view,
|
this._view,
|
||||||
super.pointer,
|
super.pointer,
|
||||||
super.sceneManager,
|
super.app,
|
||||||
super.renderableManager,
|
|
||||||
super.unlitMaterialProvider,
|
|
||||||
super.viewer,
|
|
||||||
this.gizmoEntities) {
|
this.gizmoEntities) {
|
||||||
_nativeCallback =
|
_nativeCallback =
|
||||||
NativeCallable<GizmoPickCallbackFunction>.listener(_onPickResult);
|
NativeCallable<GizmoPickCallbackFunction>.listener(_onPickResult);
|
||||||
@@ -60,17 +58,17 @@ class FFIGizmo extends FFIAsset implements GizmoAsset {
|
|||||||
final viewport = await _view.getViewport();
|
final viewport = await _view.getViewport();
|
||||||
y = viewport.height - y;
|
y = viewport.height - y;
|
||||||
|
|
||||||
Gizmo_pick(pointer.cast<TGizmo>(), x, y, _nativeCallback.nativeFunction);
|
Gizmo_pick(asset.cast<TGizmo>(), x, y, _nativeCallback.nativeFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future highlight(Axis axis) async {
|
Future highlight(Axis axis) async {
|
||||||
Gizmo_unhighlight(pointer.cast<TGizmo>());
|
Gizmo_unhighlight(asset.cast<TGizmo>());
|
||||||
Gizmo_highlight(pointer.cast<TGizmo>(), TGizmoAxis.values[axis.index]);
|
Gizmo_highlight(asset.cast<TGizmo>(), TGizmoAxis.values[axis.index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future unhighlight() async {
|
Future unhighlight() async {
|
||||||
Gizmo_unhighlight(pointer.cast<TGizmo>());
|
Gizmo_unhighlight(asset.cast<TGizmo>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_filament_app.dart';
|
|||||||
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_render_target.dart';
|
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_render_target.dart';
|
||||||
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_scene.dart';
|
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_scene.dart';
|
||||||
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_swapchain.dart';
|
import 'package:thermion_dart/src/viewer/src/ffi/src/ffi_swapchain.dart';
|
||||||
import 'package:thermion_dart/src/viewer/src/shared_types/scene.dart';
|
import 'package:thermion_dart/src/viewer/src/shared_types/layers.dart';
|
||||||
import 'package:thermion_dart/src/viewer/src/shared_types/shared_types.dart';
|
import 'package:thermion_dart/src/viewer/src/shared_types/shared_types.dart';
|
||||||
import 'callbacks.dart';
|
import 'callbacks.dart';
|
||||||
import 'ffi_camera.dart';
|
import 'ffi_camera.dart';
|
||||||
@@ -52,9 +52,8 @@ class FFIView extends View {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Camera> getCamera() async {
|
Future<Camera> getCamera() async {
|
||||||
final transformManager = Engine_getTransformManager(app.engine);
|
|
||||||
final cameraPtr = View_getCamera(view);
|
final cameraPtr = View_getCamera(view);
|
||||||
return FFICamera(cameraPtr, app.engine, transformManager);
|
return FFICamera(cameraPtr, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -85,7 +84,7 @@ class FFIView extends View {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future setToneMapper(ToneMapper mapper) async {
|
Future setToneMapper(ToneMapper mapper) async {
|
||||||
View_setToneMappingRenderThread(view, app.engine, mapper.index);
|
View_setToneMappingRenderThread(view, app.engine, TToneMapping.values[mapper.index].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setStencilBufferEnabled(bool enabled) async {
|
Future setStencilBufferEnabled(bool enabled) async {
|
||||||
@@ -112,4 +111,9 @@ class FFIView extends View {
|
|||||||
Future setScene(covariant FFIScene scene) async {
|
Future setScene(covariant FFIScene scene) async {
|
||||||
await withVoidCallback((cb) => View_setScene(view, scene.scene));
|
await withVoidCallback((cb) => View_setScene(view, scene.scene));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setLayerVisibility(VisibilityLayers layer, bool visible) async {
|
||||||
|
View_setLayerEnabled(view, layer.value, visible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -917,7 +917,7 @@ external void _View_setToneMapping(
|
|||||||
void View_setToneMapping(
|
void View_setToneMapping(
|
||||||
ffi.Pointer<TView> tView,
|
ffi.Pointer<TView> tView,
|
||||||
ffi.Pointer<TEngine> tEngine,
|
ffi.Pointer<TEngine> tEngine,
|
||||||
ToneMapping toneMapping,
|
TToneMapping toneMapping,
|
||||||
) =>
|
) =>
|
||||||
_View_setToneMapping(
|
_View_setToneMapping(
|
||||||
tView,
|
tView,
|
||||||
@@ -1019,6 +1019,26 @@ external void IndirectLight_setRotation(
|
|||||||
ffi.Pointer<ffi.Double> rotation,
|
ffi.Pointer<ffi.Double> rotation,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Pointer<TGizmo> Function(ffi.Pointer<TEngine>, ffi.Pointer<TView>,
|
||||||
|
ffi.UnsignedInt)>(symbol: "Gizmo_create", isLeaf: true)
|
||||||
|
external ffi.Pointer<TGizmo> _Gizmo_create(
|
||||||
|
ffi.Pointer<TEngine> tEngine,
|
||||||
|
ffi.Pointer<TView> tView,
|
||||||
|
int tGizmoType,
|
||||||
|
);
|
||||||
|
|
||||||
|
ffi.Pointer<TGizmo> Gizmo_create(
|
||||||
|
ffi.Pointer<TEngine> tEngine,
|
||||||
|
ffi.Pointer<TView> tView,
|
||||||
|
TGizmoType tGizmoType,
|
||||||
|
) =>
|
||||||
|
_Gizmo_create(
|
||||||
|
tEngine,
|
||||||
|
tView,
|
||||||
|
tGizmoType.value,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Void Function(ffi.Pointer<TGizmo>, ffi.Uint32, ffi.Uint32,
|
ffi.Void Function(ffi.Pointer<TGizmo>, ffi.Uint32, ffi.Uint32,
|
||||||
GizmoPickCallback)>(isLeaf: true)
|
GizmoPickCallback)>(isLeaf: true)
|
||||||
@@ -1113,135 +1133,135 @@ external void Scene_addFilamentAsset(
|
|||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<ffi.Int>, ffi.Float, ffi.Float, ffi.Float)>(isLeaf: true)
|
ffi.Pointer<TCamera>, ffi.Float, ffi.Float, ffi.Float)>(isLeaf: true)
|
||||||
external int set_camera_exposure(
|
external void Camera_setExposure(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
double aperture,
|
double aperture,
|
||||||
double shutterSpeed,
|
double shutterSpeed,
|
||||||
double sensitivity,
|
double sensitivity,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Int)>(isLeaf: true)
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TCamera>, double4x4)>(isLeaf: true)
|
||||||
external int set_camera_model_matrix(
|
external void Camera_setModelMatrix(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
int matrix,
|
double4x4 matrix,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int>(symbol: "double4x4")
|
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external int double4x41;
|
external double4x4 Camera_getModelMatrix(
|
||||||
|
ffi.Pointer<TCamera> camera,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Pointer<ffi.Int> Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external ffi.Pointer<ffi.Int> get_camera_frustum(
|
external double4x4 Camera_getViewMatrix(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
|
external double4x4 Camera_getProjectionMatrix(
|
||||||
|
ffi.Pointer<TCamera> camera,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
|
external double4x4 Camera_getCullingProjectionMatrix(
|
||||||
|
ffi.Pointer<TCamera> camera,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TCamera>, ffi.Pointer<ffi.Double>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Camera_getFrustum(
|
||||||
|
ffi.Pointer<TCamera> camera,
|
||||||
|
ffi.Pointer<ffi.Double> out,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<ffi.Int>, ffi.Int, ffi.Double, ffi.Double)>(isLeaf: true)
|
ffi.Pointer<TCamera>, double4x4, ffi.Double, ffi.Double)>(isLeaf: true)
|
||||||
external int set_camera_projection_matrix(
|
external void Camera_setProjectionMatrix(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
int matrix,
|
double4x4 matrix,
|
||||||
double near,
|
double near,
|
||||||
double far,
|
double far,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Double, ffi.Double, ffi.Double,
|
ffi.Void Function(ffi.Pointer<TCamera>, ffi.Double, ffi.Double, ffi.Double,
|
||||||
ffi.Double, ffi.Int)>(isLeaf: true)
|
ffi.Double, ffi.Bool)>(isLeaf: true)
|
||||||
external int set_camera_projection_from_fov(
|
external void Camera_setProjectionFromFov(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
double fovInDegrees,
|
double fovInDegrees,
|
||||||
double aspect,
|
double aspect,
|
||||||
double near,
|
double near,
|
||||||
double far,
|
double far,
|
||||||
int horizontal,
|
bool horizontal,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
@ffi.Native<ffi.Double Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external int get_camera_focal_length(
|
external double Camera_getFocalLength(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TCamera>, double3, double3, double3)>(
|
||||||
external int Camera_getFocalLength(
|
|
||||||
ffi.Pointer<ffi.Int> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
|
||||||
external int Camera_getNear(
|
|
||||||
ffi.Pointer<ffi.Int> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
|
||||||
external int Camera_getCullingFar(
|
|
||||||
ffi.Pointer<ffi.Int> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Int, ffi.Int, ffi.Int)>(
|
|
||||||
isLeaf: true)
|
isLeaf: true)
|
||||||
external int Camera_lookAt(
|
external void Camera_lookAt(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
int eye,
|
double3 eye,
|
||||||
int focus,
|
double3 focus,
|
||||||
int up,
|
double3 up,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
@ffi.Native<ffi.Double Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external int get_camera_near(
|
external double Camera_getNear(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>)>(isLeaf: true)
|
@ffi.Native<ffi.Double Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external int get_camera_culling_far(
|
external double Camera_getCullingFar(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Int)>(isLeaf: true)
|
@ffi.Native<ffi.Float Function(ffi.Pointer<TCamera>, ffi.Bool)>(isLeaf: true)
|
||||||
external int get_camera_fov(
|
external double Camera_getFov(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
int horizontal,
|
bool horizontal,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Float)>(isLeaf: true)
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TCamera>, ffi.Float)>(isLeaf: true)
|
||||||
external int set_camera_focus_distance(
|
external void Camera_setFocusDistance(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
double focusDistance,
|
double focusDistance,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<ffi.Int>, ffi.Int, ffi.Double, ffi.Double)>(isLeaf: true)
|
ffi.Pointer<TCamera>, double4x4, ffi.Double, ffi.Double)>(isLeaf: true)
|
||||||
external int Camera_setCustomProjectionWithCulling(
|
external void Camera_setCustomProjectionWithCulling(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
int projectionMatrix,
|
double4x4 projectionMatrix,
|
||||||
double near,
|
double near,
|
||||||
double far,
|
double far,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Int)>(isLeaf: true)
|
|
||||||
external int Camera_setModelMatrix(
|
|
||||||
ffi.Pointer<ffi.Int> camera,
|
|
||||||
int modelMatrix,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Double, ffi.Double, ffi.Double,
|
ffi.Void Function(ffi.Pointer<TCamera>, ffi.Double, ffi.Double, ffi.Double,
|
||||||
ffi.Double)>(isLeaf: true)
|
ffi.Double)>(isLeaf: true)
|
||||||
external int Camera_setLensProjection(
|
external void Camera_setLensProjection(
|
||||||
ffi.Pointer<ffi.Int> camera,
|
ffi.Pointer<TCamera> camera,
|
||||||
double near,
|
double near,
|
||||||
double far,
|
double far,
|
||||||
double aspect,
|
double aspect,
|
||||||
double focalLength,
|
double focalLength,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int>(symbol: "EntityId")
|
@ffi.Native<EntityId Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
||||||
external int EntityId1;
|
external int Camera_getEntity(
|
||||||
|
ffi.Pointer<TCamera> camera,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Int Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<ffi.Int>,
|
ffi.Pointer<TCamera>,
|
||||||
ffi.UnsignedInt,
|
ffi.UnsignedInt,
|
||||||
ffi.Double,
|
ffi.Double,
|
||||||
ffi.Double,
|
ffi.Double,
|
||||||
@@ -1249,8 +1269,8 @@ external int EntityId1;
|
|||||||
ffi.Double,
|
ffi.Double,
|
||||||
ffi.Double,
|
ffi.Double,
|
||||||
ffi.Double)>(symbol: "Camera_setProjection", isLeaf: true)
|
ffi.Double)>(symbol: "Camera_setProjection", isLeaf: true)
|
||||||
external int _Camera_setProjection(
|
external void _Camera_setProjection(
|
||||||
ffi.Pointer<ffi.Int> tCamera,
|
ffi.Pointer<TCamera> tCamera,
|
||||||
int projection,
|
int projection,
|
||||||
double left,
|
double left,
|
||||||
double right,
|
double right,
|
||||||
@@ -1260,9 +1280,9 @@ external int _Camera_setProjection(
|
|||||||
double far,
|
double far,
|
||||||
);
|
);
|
||||||
|
|
||||||
int Camera_setProjection(
|
void Camera_setProjection(
|
||||||
ffi.Pointer<ffi.Int> tCamera,
|
ffi.Pointer<TCamera> tCamera,
|
||||||
Projection projection,
|
TProjection projection,
|
||||||
double left,
|
double left,
|
||||||
double right,
|
double right,
|
||||||
double bottom,
|
double bottom,
|
||||||
@@ -1450,6 +1470,11 @@ external void RenderLoop_create();
|
|||||||
@ffi.Native<ffi.Void Function()>(isLeaf: true)
|
@ffi.Native<ffi.Void Function()>(isLeaf: true)
|
||||||
external void RenderLoop_destroy();
|
external void RenderLoop_destroy();
|
||||||
|
|
||||||
|
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
||||||
|
external void RenderLoop_requestAnimationFrame(
|
||||||
|
ffi.Pointer<ffi.Void> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TRenderTicker>, ffi.Uint64)>(
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TRenderTicker>, ffi.Uint64)>(
|
||||||
isLeaf: true)
|
isLeaf: true)
|
||||||
external void RenderTicker_renderRenderThread(
|
external void RenderTicker_renderRenderThread(
|
||||||
@@ -1859,7 +1884,7 @@ external void Material_createInstanceRenderThread(
|
|||||||
external void View_setToneMappingRenderThread(
|
external void View_setToneMappingRenderThread(
|
||||||
ffi.Pointer<TView> tView,
|
ffi.Pointer<TView> tView,
|
||||||
ffi.Pointer<TEngine> tEngine,
|
ffi.Pointer<TEngine> tEngine,
|
||||||
int thermion,
|
int toneMapping,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TView>, ffi.Bool, ffi.Double)>(
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TView>, ffi.Bool, ffi.Double)>(
|
||||||
@@ -2692,16 +2717,6 @@ external void TextureSampler_destroyRenderThread(
|
|||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId,
|
|
||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external void update_bone_matrices_render_thread(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
int asset,
|
|
||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> callback,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Void Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<TSceneManager>,
|
ffi.Pointer<TSceneManager>,
|
||||||
@@ -2790,364 +2805,6 @@ external void Scene_addFilamentAssetRenderThread(
|
|||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> callback,
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> callback,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 get_camera_model_matrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 get_camera_view_matrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 get_camera_projection_matrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 get_camera_culling_projection_matrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 Camera_getViewMatrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<double4x4 Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external double4x4 Camera_getModelMatrix(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<EntityId Function(ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external int Camera_getEntity(
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TGizmo> Function(
|
|
||||||
ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<TView>,
|
|
||||||
ffi.Pointer<TScene>,
|
|
||||||
ffi.UnsignedInt)>(symbol: "SceneManager_createGizmo", isLeaf: true)
|
|
||||||
external ffi.Pointer<TGizmo> _SceneManager_createGizmo(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
ffi.Pointer<TView> tView,
|
|
||||||
ffi.Pointer<TScene> tScene,
|
|
||||||
int tGizmoType,
|
|
||||||
);
|
|
||||||
|
|
||||||
ffi.Pointer<TGizmo> SceneManager_createGizmo(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
ffi.Pointer<TView> tView,
|
|
||||||
ffi.Pointer<TScene> tScene,
|
|
||||||
TGizmoType tGizmoType,
|
|
||||||
) =>
|
|
||||||
_SceneManager_createGizmo(
|
|
||||||
tSceneManager,
|
|
||||||
tView,
|
|
||||||
tScene,
|
|
||||||
tGizmoType.value,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TSceneAsset> Function(
|
|
||||||
ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<ffi.Float>,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Pointer<ffi.Float>,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Pointer<ffi.Float>,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Pointer<ffi.Uint16>,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Pointer<ffi.Pointer<TMaterialInstance>>,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Bool)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TSceneAsset> SceneManager_createGeometry(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<ffi.Float> vertices,
|
|
||||||
int numVertices,
|
|
||||||
ffi.Pointer<ffi.Float> normals,
|
|
||||||
int numNormals,
|
|
||||||
ffi.Pointer<ffi.Float> uvs,
|
|
||||||
int numUvs,
|
|
||||||
ffi.Pointer<ffi.Uint16> indices,
|
|
||||||
int numIndices,
|
|
||||||
int primitiveType,
|
|
||||||
ffi.Pointer<ffi.Pointer<TMaterialInstance>> materialInstances,
|
|
||||||
int materialInstanceCount,
|
|
||||||
bool keepData,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TMaterialProvider> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TMaterialProvider>
|
|
||||||
SceneManager_getUbershaderMaterialProvider(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TMaterialProvider> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TMaterialProvider> SceneManager_getUnlitMaterialProvider(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TMaterialInstance> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TMaterialInstance>
|
|
||||||
SceneManager_createUnlitMaterialInstance(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TMaterialInstance> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TMaterialInstance>
|
|
||||||
SceneManager_createUnlitFixedSizeMaterialInstance(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(ffi.Pointer<TSceneManager>, ffi.Pointer<EntityId>,
|
|
||||||
ffi.Pointer<ffi.Double>, ffi.Int)>(isLeaf: true)
|
|
||||||
external void SceneManager_queueTransformUpdates(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<EntityId> entities,
|
|
||||||
ffi.Pointer<ffi.Double> transforms,
|
|
||||||
int numEntities,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TCamera> Function(ffi.Pointer<TSceneManager>, EntityId,
|
|
||||||
ffi.Pointer<ffi.Char>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TCamera> SceneManager_findCameraByName(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entity,
|
|
||||||
ffi.Pointer<ffi.Char> name,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId, ffi.Int)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external void SceneManager_setVisibilityLayer(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entity,
|
|
||||||
int layer,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Pointer<TScene> Function(ffi.Pointer<TSceneManager>)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external ffi.Pointer<TScene> SceneManager_getScene(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Pointer<TCamera> Function(ffi.Pointer<TSceneManager>)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external ffi.Pointer<TCamera> SceneManager_createCamera(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(
|
|
||||||
ffi.Pointer<TSceneManager>, ffi.Pointer<TCamera>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyCamera(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<TCamera> camera,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Size Function(ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external int SceneManager_getCameraCount(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TCamera> Function(
|
|
||||||
ffi.Pointer<TSceneManager>, ffi.Size)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TCamera> SceneManager_getCameraAt(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
int index,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<TMaterialInstance>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyMaterialInstance(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<TMaterialInstance> instance,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<Aabb3 Function(ffi.Pointer<TSceneManager>, EntityId)>(isLeaf: true)
|
|
||||||
external Aabb3 SceneManager_getRenderableBoundingBox(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<TSceneManager>, EntityId)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external int SceneManager_addToScene(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Int Function(ffi.Pointer<TSceneManager>, EntityId)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external int SceneManager_removeFromScene(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entity,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external void SceneManager_transformToUnitCube(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
int asset,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TSceneAsset> Function(
|
|
||||||
ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<ffi.Uint8>,
|
|
||||||
ffi.Size,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Bool,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Int,
|
|
||||||
ffi.Bool)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TSceneAsset> SceneManager_loadGlbFromBuffer(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
ffi.Pointer<ffi.Uint8> arg1,
|
|
||||||
int length,
|
|
||||||
int numInstances,
|
|
||||||
bool keepData,
|
|
||||||
int priority,
|
|
||||||
int layer,
|
|
||||||
bool loadResourcesAsync,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TSceneAsset> Function(ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<ffi.Char>, ffi.Int, ffi.Bool)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TSceneAsset> SceneManager_loadGlb(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<ffi.Char> assetPath,
|
|
||||||
int numInstances,
|
|
||||||
bool keepData,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TSceneAsset> Function(ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, ffi.Bool)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TSceneAsset> SceneManager_loadGltf(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<ffi.Char> assetPath,
|
|
||||||
ffi.Pointer<ffi.Char> relativePath,
|
|
||||||
bool keepData,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
EntityId Function(
|
|
||||||
ffi.Pointer<TSceneManager>,
|
|
||||||
ffi.Uint8,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Float,
|
|
||||||
ffi.Bool)>(isLeaf: true)
|
|
||||||
external int SceneManager_addLight(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int type,
|
|
||||||
double colour,
|
|
||||||
double intensity,
|
|
||||||
double posX,
|
|
||||||
double posY,
|
|
||||||
double posZ,
|
|
||||||
double dirX,
|
|
||||||
double dirY,
|
|
||||||
double dirZ,
|
|
||||||
double falloffRadius,
|
|
||||||
double spotLightConeInner,
|
|
||||||
double spotLightConeOuter,
|
|
||||||
double sunAngularRadius,
|
|
||||||
double sunHaloSize,
|
|
||||||
double sunHaloFallof,
|
|
||||||
bool shadows,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external void SceneManager_removeLight(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entityId,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyLights(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(
|
|
||||||
ffi.Pointer<TSceneManager>, ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyAsset(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
ffi.Pointer<TSceneAsset> sceneAsset,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyAssets(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external void SceneManager_destroyAll(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TAnimationManager> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TAnimationManager> SceneManager_getAnimationManager(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TNameComponentManager> Function(
|
|
||||||
ffi.Pointer<TSceneManager>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TNameComponentManager>
|
|
||||||
SceneManager_getNameComponentManager(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<TSceneAsset> Function(
|
|
||||||
ffi.Pointer<TSceneManager>, ffi.Pointer<TMaterial>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<TSceneAsset> SceneManager_createGrid(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
ffi.Pointer<TMaterial> tMaterial,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TSceneManager>, EntityId)>(
|
|
||||||
isLeaf: true)
|
|
||||||
external bool SceneManager_isGridEntity(
|
|
||||||
ffi.Pointer<TSceneManager> tSceneManager,
|
|
||||||
int entityId,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Void Function(ffi.Pointer<TRenderableManager>, EntityId, ffi.Int,
|
ffi.Void Function(ffi.Pointer<TRenderableManager>, EntityId, ffi.Int,
|
||||||
ffi.Pointer<TMaterialInstance>)>(isLeaf: true)
|
ffi.Pointer<TMaterialInstance>)>(isLeaf: true)
|
||||||
@@ -3158,15 +2815,6 @@ external void RenderableManager_setMaterialInstanceAt(
|
|||||||
ffi.Pointer<TMaterialInstance> tMaterialInstance,
|
ffi.Pointer<TMaterialInstance> tMaterialInstance,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(
|
|
||||||
ffi.Pointer<TRenderableManager>, EntityId, ffi.Int)>(isLeaf: true)
|
|
||||||
external void RenderableManager_setPriority(
|
|
||||||
ffi.Pointer<TRenderableManager> tRenderableManager,
|
|
||||||
int entityId,
|
|
||||||
int priority,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Pointer<TMaterialInstance> Function(
|
ffi.Pointer<TMaterialInstance> Function(
|
||||||
ffi.Pointer<TRenderableManager>, EntityId, ffi.Int)>(isLeaf: true)
|
ffi.Pointer<TRenderableManager>, EntityId, ffi.Int)>(isLeaf: true)
|
||||||
@@ -3250,6 +2898,24 @@ external Aabb3 RenderableManager_getAabb(
|
|||||||
int entityId,
|
int entityId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TRenderableManager>, EntityId, ffi.Uint8)>(isLeaf: true)
|
||||||
|
external void RenderableManager_setVisibilityLayer(
|
||||||
|
ffi.Pointer<TRenderableManager> tRenderableManager,
|
||||||
|
int entityId,
|
||||||
|
int layer,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TRenderableManager>, EntityId, ffi.Uint8)>(isLeaf: true)
|
||||||
|
external void RenderableManager_setPriority(
|
||||||
|
ffi.Pointer<TRenderableManager> tRenderableManager,
|
||||||
|
int entityId,
|
||||||
|
int priority,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Pointer<TEngine> Function(
|
ffi.Pointer<TEngine> Function(
|
||||||
ffi.UnsignedInt,
|
ffi.UnsignedInt,
|
||||||
@@ -3515,6 +3181,11 @@ external ffi.Pointer<TSceneAsset> SceneAsset_loadGltf(
|
|||||||
int numInstances,
|
int numInstances,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
||||||
|
external void SceneAsset_destroy(
|
||||||
|
ffi.Pointer<TSceneAsset> tSceneAsset,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneAsset>, ffi.Pointer<TScene>)>(
|
@ffi.Native<ffi.Void Function(ffi.Pointer<TSceneAsset>, ffi.Pointer<TScene>)>(
|
||||||
isLeaf: true)
|
isLeaf: true)
|
||||||
external void SceneAsset_addToScene(
|
external void SceneAsset_addToScene(
|
||||||
@@ -3546,14 +3217,23 @@ external void SceneAsset_getChildEntities(
|
|||||||
ffi.Pointer<EntityId> out,
|
ffi.Pointer<EntityId> out,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Int>()
|
@ffi.Native<ffi.Pointer<EntityId> Function(ffi.Pointer<TSceneAsset>)>(
|
||||||
external final int utils;
|
isLeaf: true)
|
||||||
|
external ffi.Pointer<EntityId> SceneAsset_getCameraEntities(
|
||||||
|
ffi.Pointer<TSceneAsset> tSceneAsset,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Size Function(ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
@ffi.Native<ffi.Size Function(ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
||||||
external int SceneAsset_getCameraEntityCount(
|
external int SceneAsset_getCameraEntityCount(
|
||||||
ffi.Pointer<TSceneAsset> tSceneAsset,
|
ffi.Pointer<TSceneAsset> tSceneAsset,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<ffi.Pointer<EntityId> Function(ffi.Pointer<TSceneAsset>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external ffi.Pointer<EntityId> SceneAsset_getLightEntities(
|
||||||
|
ffi.Pointer<TSceneAsset> tSceneAsset,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<ffi.Size Function(ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
@ffi.Native<ffi.Size Function(ffi.Pointer<TSceneAsset>)>(isLeaf: true)
|
||||||
external int SceneAsset_getLightEntityCount(
|
external int SceneAsset_getLightEntityCount(
|
||||||
ffi.Pointer<TSceneAsset> tSceneAsset,
|
ffi.Pointer<TSceneAsset> tSceneAsset,
|
||||||
@@ -3821,15 +3501,6 @@ external void AnimationManager_setGltfAnimationFrame(
|
|||||||
int frame,
|
int frame,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Pointer<ffi.Void> Function(LoadFilamentResourceFromOwner,
|
|
||||||
FreeFilamentResourceFromOwner, ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
|
||||||
external ffi.Pointer<ffi.Void> make_resource_loader(
|
|
||||||
LoadFilamentResourceFromOwner loadFn,
|
|
||||||
FreeFilamentResourceFromOwner freeFn,
|
|
||||||
ffi.Pointer<ffi.Void> owner,
|
|
||||||
);
|
|
||||||
|
|
||||||
final class TCamera extends ffi.Opaque {}
|
final class TCamera extends ffi.Opaque {}
|
||||||
|
|
||||||
final class TEngine extends ffi.Opaque {}
|
final class TEngine extends ffi.Opaque {}
|
||||||
@@ -3844,6 +3515,8 @@ final class TLightManager extends ffi.Opaque {}
|
|||||||
|
|
||||||
final class TRenderer extends ffi.Opaque {}
|
final class TRenderer extends ffi.Opaque {}
|
||||||
|
|
||||||
|
final class TRenderTicker extends ffi.Opaque {}
|
||||||
|
|
||||||
final class TFence extends ffi.Opaque {}
|
final class TFence extends ffi.Opaque {}
|
||||||
|
|
||||||
final class TRenderTarget extends ffi.Opaque {}
|
final class TRenderTarget extends ffi.Opaque {}
|
||||||
@@ -4115,7 +3788,7 @@ enum TGizmoType {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class TPrimitiveType {
|
sealed class TPrimitiveType {
|
||||||
/// !< points
|
/// !< points
|
||||||
static const PRIMITIVETYPE_POINTS = 0;
|
static const PRIMITIVETYPE_POINTS = 0;
|
||||||
|
|
||||||
@@ -4533,7 +4206,7 @@ enum TTextureFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ! Pixel Data Format
|
/// ! Pixel Data Format
|
||||||
abstract class TPixelDataFormat {
|
sealed class TPixelDataFormat {
|
||||||
/// !< One Red channel, float
|
/// !< One Red channel, float
|
||||||
static const PIXELDATAFORMAT_R = 0;
|
static const PIXELDATAFORMAT_R = 0;
|
||||||
|
|
||||||
@@ -4567,7 +4240,7 @@ abstract class TPixelDataFormat {
|
|||||||
static const PIXELDATAFORMAT_ALPHA = 11;
|
static const PIXELDATAFORMAT_ALPHA = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class TPixelDataType {
|
sealed class TPixelDataType {
|
||||||
/// !< unsigned byte
|
/// !< unsigned byte
|
||||||
static const PIXELDATATYPE_UBYTE = 0;
|
static const PIXELDATATYPE_UBYTE = 0;
|
||||||
|
|
||||||
@@ -4738,19 +4411,19 @@ final class TViewport extends ffi.Struct {
|
|||||||
external int height;
|
external int height;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ToneMapping {
|
enum TToneMapping {
|
||||||
ACES(0),
|
ACES(0),
|
||||||
FILMIC(1),
|
FILMIC(1),
|
||||||
LINEAR(2);
|
LINEAR(2);
|
||||||
|
|
||||||
final int value;
|
final int value;
|
||||||
const ToneMapping(this.value);
|
const TToneMapping(this.value);
|
||||||
|
|
||||||
static ToneMapping fromValue(int value) => switch (value) {
|
static TToneMapping fromValue(int value) => switch (value) {
|
||||||
0 => ACES,
|
0 => ACES,
|
||||||
1 => FILMIC,
|
1 => FILMIC,
|
||||||
2 => LINEAR,
|
2 => LINEAR,
|
||||||
_ => throw ArgumentError("Unknown value for ToneMapping: $value"),
|
_ => throw ArgumentError("Unknown value for TToneMapping: $value"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4832,22 +4505,20 @@ typedef GizmoPickCallbackFunction = ffi.Void Function(
|
|||||||
typedef DartGizmoPickCallbackFunction = void Function(
|
typedef DartGizmoPickCallbackFunction = void Function(
|
||||||
TGizmoPickResultType resultType, double x, double y, double z);
|
TGizmoPickResultType resultType, double x, double y, double z);
|
||||||
|
|
||||||
enum Projection {
|
enum TProjection {
|
||||||
Perspective(0),
|
Perspective(0),
|
||||||
Orthographic(1);
|
Orthographic(1);
|
||||||
|
|
||||||
final int value;
|
final int value;
|
||||||
const Projection(this.value);
|
const TProjection(this.value);
|
||||||
|
|
||||||
static Projection fromValue(int value) => switch (value) {
|
static TProjection fromValue(int value) => switch (value) {
|
||||||
0 => Perspective,
|
0 => Perspective,
|
||||||
1 => Orthographic,
|
1 => Orthographic,
|
||||||
_ => throw ArgumentError("Unknown value for Projection: $value"),
|
_ => throw ArgumentError("Unknown value for TProjection: $value"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef TRenderTicker = ffi.Int;
|
|
||||||
typedef DartTRenderTicker = int;
|
|
||||||
typedef FilamentRenderCallback
|
typedef FilamentRenderCallback
|
||||||
= ffi.Pointer<ffi.NativeFunction<FilamentRenderCallbackFunction>>;
|
= ffi.Pointer<ffi.NativeFunction<FilamentRenderCallbackFunction>>;
|
||||||
typedef FilamentRenderCallbackFunction = ffi.Void Function(
|
typedef FilamentRenderCallbackFunction = ffi.Void Function(
|
||||||
@@ -4884,55 +4555,6 @@ enum TBackend {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ResourceBuffer extends ffi.Struct {
|
|
||||||
external ffi.Pointer<ffi.Void> data;
|
|
||||||
|
|
||||||
@ffi.Int32()
|
|
||||||
external int size;
|
|
||||||
|
|
||||||
@ffi.Int32()
|
|
||||||
external int id;
|
|
||||||
}
|
|
||||||
|
|
||||||
final class ResourceLoaderWrapper extends ffi.Struct {
|
|
||||||
external LoadFilamentResource loadResource;
|
|
||||||
|
|
||||||
external FreeFilamentResource freeResource;
|
|
||||||
|
|
||||||
external LoadFilamentResourceFromOwner loadFromOwner;
|
|
||||||
|
|
||||||
external FreeFilamentResourceFromOwner freeFromOwner;
|
|
||||||
|
|
||||||
external ffi.Pointer<ffi.Void> owner;
|
|
||||||
|
|
||||||
external LoadFilamentResourceIntoOutPointer loadToOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef LoadFilamentResource
|
|
||||||
= ffi.Pointer<ffi.NativeFunction<LoadFilamentResourceFunction>>;
|
|
||||||
typedef LoadFilamentResourceFunction = ResourceBuffer Function(
|
|
||||||
ffi.Pointer<ffi.Char> uri);
|
|
||||||
typedef FreeFilamentResource
|
|
||||||
= ffi.Pointer<ffi.NativeFunction<FreeFilamentResourceFunction>>;
|
|
||||||
typedef FreeFilamentResourceFunction = ffi.Void Function(ResourceBuffer);
|
|
||||||
typedef DartFreeFilamentResourceFunction = void Function(ResourceBuffer);
|
|
||||||
typedef LoadFilamentResourceFromOwner
|
|
||||||
= ffi.Pointer<ffi.NativeFunction<LoadFilamentResourceFromOwnerFunction>>;
|
|
||||||
typedef LoadFilamentResourceFromOwnerFunction = ResourceBuffer Function(
|
|
||||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Void>);
|
|
||||||
typedef FreeFilamentResourceFromOwner
|
|
||||||
= ffi.Pointer<ffi.NativeFunction<FreeFilamentResourceFromOwnerFunction>>;
|
|
||||||
typedef FreeFilamentResourceFromOwnerFunction = ffi.Void Function(
|
|
||||||
ResourceBuffer, ffi.Pointer<ffi.Void>);
|
|
||||||
typedef DartFreeFilamentResourceFromOwnerFunction = void Function(
|
|
||||||
ResourceBuffer, ffi.Pointer<ffi.Void>);
|
|
||||||
typedef LoadFilamentResourceIntoOutPointer = ffi
|
|
||||||
.Pointer<ffi.NativeFunction<LoadFilamentResourceIntoOutPointerFunction>>;
|
|
||||||
typedef LoadFilamentResourceIntoOutPointerFunction = ffi.Void Function(
|
|
||||||
ffi.Pointer<ffi.Char> uri, ffi.Pointer<ResourceBuffer> out);
|
|
||||||
typedef DartLoadFilamentResourceIntoOutPointerFunction = void Function(
|
|
||||||
ffi.Pointer<ffi.Char> uri, ffi.Pointer<ResourceBuffer> out);
|
|
||||||
|
|
||||||
const int __bool_true_false_are_defined = 1;
|
const int __bool_true_false_are_defined = 1;
|
||||||
|
|
||||||
const int true1 = 1;
|
const int true1 = 1;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
|
import 'package:thermion_dart/src/viewer/src/shared_types/layers.dart';
|
||||||
import 'package:vector_math/vector_math_64.dart';
|
import 'package:vector_math/vector_math_64.dart';
|
||||||
|
|
||||||
import '../thermion_viewer_base.dart';
|
import '../thermion_viewer_base.dart';
|
||||||
|
|
||||||
enum Projection { Perspective, Orthographic }
|
enum Projection { Perspective, Orthographic }
|
||||||
@@ -26,6 +26,8 @@ abstract class Camera {
|
|||||||
|
|
||||||
Future<Matrix4> getViewMatrix();
|
Future<Matrix4> getViewMatrix();
|
||||||
Future<Matrix4> getModelMatrix();
|
Future<Matrix4> getModelMatrix();
|
||||||
|
Future<Matrix4> getProjectionMatrix();
|
||||||
|
Future<Matrix4> getCullingProjectionMatrix();
|
||||||
Future setModelMatrix(Matrix4 matrix);
|
Future setModelMatrix(Matrix4 matrix);
|
||||||
|
|
||||||
ThermionEntity getEntity();
|
ThermionEntity getEntity();
|
||||||
@@ -35,4 +37,6 @@ abstract class Camera {
|
|||||||
Future<double> getNear();
|
Future<double> getNear();
|
||||||
Future<double> getCullingFar();
|
Future<double> getCullingFar();
|
||||||
Future<double> getFocalLength();
|
Future<double> getFocalLength();
|
||||||
|
|
||||||
|
Future destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:thermion_dart/src/viewer/src/shared_types/layers.dart';
|
||||||
import 'package:thermion_dart/thermion_dart.dart';
|
import 'package:thermion_dart/thermion_dart.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -14,12 +15,7 @@ class Viewport {
|
|||||||
Viewport(this.left, this.bottom, this.width, this.height);
|
Viewport(this.left, this.bottom, this.width, this.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum QualityLevel {
|
enum QualityLevel { LOW, MEDIUM, HIGH, ULTRA }
|
||||||
LOW,
|
|
||||||
MEDIUM,
|
|
||||||
HIGH,
|
|
||||||
ULTRA
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class View {
|
abstract class View {
|
||||||
Future<Viewport> getViewport();
|
Future<Viewport> getViewport();
|
||||||
@@ -39,4 +35,5 @@ abstract class View {
|
|||||||
Future<bool> isDitheringEnabled();
|
Future<bool> isDitheringEnabled();
|
||||||
Future setBloom(bool enabled, double strength);
|
Future setBloom(bool enabled, double strength);
|
||||||
Future setRenderQuality(QualityLevel quality);
|
Future setRenderQuality(QualityLevel quality);
|
||||||
|
Future setLayerVisibility(VisibilityLayers layer, bool visible);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -622,20 +622,6 @@ abstract class ThermionViewer {
|
|||||||
///
|
///
|
||||||
Future removeAnimationComponent(ThermionEntity entity);
|
Future removeAnimationComponent(ThermionEntity entity);
|
||||||
|
|
||||||
///
|
|
||||||
/// Makes [entity] collidable.
|
|
||||||
/// This allows you to call [testCollisions] with any other entity ("entity B") to see if [entity] has collided with entity B. The callback will be invoked if so.
|
|
||||||
/// Alternatively, if [affectsTransform] is true and this entity collides with another entity, any queued position updates to the latter entity will be ignored.
|
|
||||||
///
|
|
||||||
Future addCollisionComponent(ThermionEntity entity,
|
|
||||||
{void Function(int entityId1, int entityId2)? callback,
|
|
||||||
bool affectsTransform = false});
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Removes the collision component from [entity], meaning this will no longer be tested when [testCollisions] or [queuePositionUpdate] is called with another entity.
|
|
||||||
///
|
|
||||||
Future removeCollisionComponent(ThermionEntity entity);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Creates a (renderable) entity with the specified geometry and adds to the scene.
|
/// Creates a (renderable) entity with the specified geometry and adds to the scene.
|
||||||
/// If [keepData] is true, the source data will not be released.
|
/// If [keepData] is true, the source data will not be released.
|
||||||
@@ -660,12 +646,6 @@ abstract class ThermionViewer {
|
|||||||
Future setParent(ThermionEntity child, ThermionEntity? parent,
|
Future setParent(ThermionEntity child, ThermionEntity? parent,
|
||||||
{bool preserveScaling});
|
{bool preserveScaling});
|
||||||
|
|
||||||
///
|
|
||||||
/// Test all collidable entities against this entity to see if any have collided.
|
|
||||||
/// This method returns void; the relevant callback passed to [addCollisionComponent] will be fired if a collision is detected.
|
|
||||||
///
|
|
||||||
Future testCollisions(ThermionEntity entity);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Sets the draw priority for the given entity. See RenderableManager.h for more details.
|
/// Sets the draw priority for the given entity. See RenderableManager.h for more details.
|
||||||
///
|
///
|
||||||
@@ -811,11 +791,6 @@ abstract class ThermionViewer {
|
|||||||
///
|
///
|
||||||
Future<MaterialInstance> createUnlitMaterialInstance();
|
Future<MaterialInstance> createUnlitMaterialInstance();
|
||||||
|
|
||||||
///
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<MaterialInstance> createUnlitFixedSizeMaterialInstance();
|
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1244,7 +1244,7 @@
|
|||||||
|
|
||||||
// @override
|
// @override
|
||||||
// Future<double> getCameraCullingFar() async {
|
// Future<double> getCameraCullingFar() async {
|
||||||
// final result = _module!.ccall("get_camera_culling_far", "double",
|
// final result = _module!.ccall("Camera_getCullingFar", "double",
|
||||||
// ["void*".toJS].toJS, [_viewer!].toJS, null) as JSNumber;
|
// ["void*".toJS].toJS, [_viewer!].toJS, null) as JSNumber;
|
||||||
// return result.toDartDouble;
|
// return result.toDartDouble;
|
||||||
// }
|
// }
|
||||||
@@ -1259,7 +1259,7 @@
|
|||||||
// @override
|
// @override
|
||||||
// Future<Matrix4> getCameraCullingProjectionMatrix() async {
|
// Future<Matrix4> getCameraCullingProjectionMatrix() async {
|
||||||
// final ptr = _module!._malloc(16 * 8);
|
// final ptr = _module!._malloc(16 * 8);
|
||||||
// _module!.ccall("get_camera_culling_projection_matrix", "void",
|
// _module!.ccall("Camera_getCullingProjectionMatrix", "void",
|
||||||
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
||||||
// final matrix = Matrix4.zero();
|
// final matrix = Matrix4.zero();
|
||||||
// for (int i = 0; i < 16; i++) {
|
// for (int i = 0; i < 16; i++) {
|
||||||
@@ -1303,7 +1303,7 @@
|
|||||||
|
|
||||||
// @override
|
// @override
|
||||||
// Future<Matrix4> getCameraModelMatrix() async {
|
// Future<Matrix4> getCameraModelMatrix() async {
|
||||||
// final ptr = _module!.ccall("get_camera_model_matrix", "void*",
|
// final ptr = _module!.ccall("Camera_getModelMatrix", "void*",
|
||||||
// ["void*".toJS].toJS, [_viewer!].toJS, null) as JSNumber;
|
// ["void*".toJS].toJS, [_viewer!].toJS, null) as JSNumber;
|
||||||
// final matrix = _matrixFromPtr(ptr);
|
// final matrix = _matrixFromPtr(ptr);
|
||||||
// _module!.ccall(
|
// _module!.ccall(
|
||||||
@@ -1331,7 +1331,7 @@
|
|||||||
// @override
|
// @override
|
||||||
// Future<Matrix4> getCameraProjectionMatrix() async {
|
// Future<Matrix4> getCameraProjectionMatrix() async {
|
||||||
// final ptr = _module!._malloc(16 * 8);
|
// final ptr = _module!._malloc(16 * 8);
|
||||||
// _module!.ccall("get_camera_projection_matrix", "void",
|
// _module!.ccall("Camera_getProjectionMatrix", "void",
|
||||||
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
||||||
// final matrix = _matrixFromPtr(ptr);
|
// final matrix = _matrixFromPtr(ptr);
|
||||||
// _module!._free(ptr);
|
// _module!._free(ptr);
|
||||||
@@ -1348,7 +1348,7 @@
|
|||||||
// @override
|
// @override
|
||||||
// Future<Matrix4> getCameraViewMatrix() async {
|
// Future<Matrix4> getCameraViewMatrix() async {
|
||||||
// final ptr = _module!._malloc(16 * 8);
|
// final ptr = _module!._malloc(16 * 8);
|
||||||
// _module!.ccall("get_camera_view_matrix", "void",
|
// _module!.ccall("Camera_getViewMatrix", "void",
|
||||||
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
// ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
||||||
// final matrix = Matrix4.zero();
|
// final matrix = Matrix4.zero();
|
||||||
// for (int i = 0; i < 16; i++) {
|
// for (int i = 0; i < 16; i++) {
|
||||||
@@ -1761,7 +1761,7 @@
|
|||||||
// Future setCameraExposure(
|
// Future setCameraExposure(
|
||||||
// double aperture, double shutterSpeed, double sensitivity) async {
|
// double aperture, double shutterSpeed, double sensitivity) async {
|
||||||
// _module!.ccall(
|
// _module!.ccall(
|
||||||
// "set_camera_exposure",
|
// "Camera_setExposure",
|
||||||
// "void",
|
// "void",
|
||||||
// ["void*".toJS, "float".toJS, "float".toJS, "float".toJS].toJS,
|
// ["void*".toJS, "float".toJS, "float".toJS, "float".toJS].toJS,
|
||||||
// [
|
// [
|
||||||
@@ -1786,7 +1786,7 @@
|
|||||||
// @override
|
// @override
|
||||||
// Future setCameraFocusDistance(double focusDistance) async {
|
// Future setCameraFocusDistance(double focusDistance) async {
|
||||||
// _module!.ccall(
|
// _module!.ccall(
|
||||||
// "set_camera_focus_distance",
|
// "Camera_setFocusDistance",
|
||||||
// "void",
|
// "void",
|
||||||
// ["void*".toJS, "float".toJS].toJS,
|
// ["void*".toJS, "float".toJS].toJS,
|
||||||
// [_viewer!, focusDistance.toJS].toJS,
|
// [_viewer!, focusDistance.toJS].toJS,
|
||||||
@@ -1812,7 +1812,7 @@
|
|||||||
// _module!
|
// _module!
|
||||||
// .setValue((ptr.toDartInt + (i * 8)).toJS, matrix[i].toJS, "double");
|
// .setValue((ptr.toDartInt + (i * 8)).toJS, matrix[i].toJS, "double");
|
||||||
// }
|
// }
|
||||||
// _module!.ccall("set_camera_model_matrix", "void",
|
// _module!.ccall("Camera_setModelMatrix", "void",
|
||||||
// ["void*".toJS, "float*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
// ["void*".toJS, "float*".toJS].toJS, [_viewer!, ptr].toJS, null);
|
||||||
// _module!._free(ptr);
|
// _module!._free(ptr);
|
||||||
// }
|
// }
|
||||||
@@ -2125,7 +2125,7 @@
|
|||||||
// @override
|
// @override
|
||||||
// Future<double> getCameraFov(bool horizontal) async {
|
// Future<double> getCameraFov(bool horizontal) async {
|
||||||
// var fov = _module!.ccall(
|
// var fov = _module!.ccall(
|
||||||
// "get_camera_fov",
|
// "Camera_getFov",
|
||||||
// "float",
|
// "float",
|
||||||
// ["void*".toJS, "bool".toJS].toJS,
|
// ["void*".toJS, "bool".toJS].toJS,
|
||||||
// [_viewer!, horizontal.toJS].toJS,
|
// [_viewer!, horizontal.toJS].toJS,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ extern "C"
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "APIExport.h"
|
#include "APIExport.h"
|
||||||
typedef TRenderTicker TRenderTicker;
|
|
||||||
typedef int32_t EntityId;
|
typedef int32_t EntityId;
|
||||||
typedef struct TCamera TCamera;
|
typedef struct TCamera TCamera;
|
||||||
typedef struct TEngine TEngine;
|
typedef struct TEngine TEngine;
|
||||||
@@ -17,6 +17,7 @@ extern "C"
|
|||||||
typedef struct TSceneManager TSceneManager;
|
typedef struct TSceneManager TSceneManager;
|
||||||
typedef struct TLightManager TLightManager;
|
typedef struct TLightManager TLightManager;
|
||||||
typedef struct TRenderer TRenderer;
|
typedef struct TRenderer TRenderer;
|
||||||
|
typedef struct TRenderTicker TRenderTicker;
|
||||||
typedef struct TFence TFence;
|
typedef struct TFence TFence;
|
||||||
typedef struct TRenderTarget TRenderTarget;
|
typedef struct TRenderTarget TRenderTarget;
|
||||||
typedef struct TSwapChain TSwapChain;
|
typedef struct TSwapChain TSwapChain;
|
||||||
|
|||||||
@@ -6,41 +6,44 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ThermionDartApi.h"
|
#include "APIExport.h"
|
||||||
|
#include "APIBoundaryTypes.h"
|
||||||
|
|
||||||
enum Projection {
|
enum TProjection {
|
||||||
Perspective,
|
Perspective,
|
||||||
Orthographic
|
Orthographic
|
||||||
};
|
};
|
||||||
|
|
||||||
// Camera methods
|
// Camera methods
|
||||||
EMSCRIPTEN_KEEPALIVE void set_camera_exposure(TCamera *camera, float aperture, float shutterSpeed, float sensitivity);
|
EMSCRIPTEN_KEEPALIVE void Camera_setExposure(TCamera *camera, float aperture, float shutterSpeed, float sensitivity);
|
||||||
EMSCRIPTEN_KEEPALIVE void set_camera_model_matrix(TCamera *camera, double4x4 matrix);
|
EMSCRIPTEN_KEEPALIVE void Camera_setModelMatrix(TCamera *camera, double4x4 matrix);
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 get_camera_model_matrix(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getModelMatrix(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 get_camera_view_matrix(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getViewMatrix(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 get_camera_projection_matrix(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getProjectionMatrix(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 get_camera_culling_projection_matrix(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getCullingProjectionMatrix(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE const double *const get_camera_frustum(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE void Camera_getFrustum(TCamera *camera, double* out);
|
||||||
EMSCRIPTEN_KEEPALIVE void set_camera_projection_matrix(TCamera *camera, double4x4 matrix, double near, double far);
|
EMSCRIPTEN_KEEPALIVE void Camera_setProjectionMatrix(TCamera *camera, double4x4 matrix, double near, double far);
|
||||||
EMSCRIPTEN_KEEPALIVE void set_camera_projection_from_fov(TCamera *camera, double fovInDegrees, double aspect, double near, double far, bool horizontal);
|
EMSCRIPTEN_KEEPALIVE void Camera_setProjectionFromFov(TCamera *camera, double fovInDegrees, double aspect, double near, double far, bool horizontal);
|
||||||
EMSCRIPTEN_KEEPALIVE double get_camera_focal_length(TCamera *const camera);
|
|
||||||
EMSCRIPTEN_KEEPALIVE double Camera_getFocalLength(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double Camera_getFocalLength(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double Camera_getNear(TCamera *const camera);
|
|
||||||
EMSCRIPTEN_KEEPALIVE double Camera_getCullingFar(TCamera *const camera);
|
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getViewMatrix(TCamera *const camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getViewMatrix(TCamera *const camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getModelMatrix(TCamera* camera);
|
EMSCRIPTEN_KEEPALIVE double4x4 Camera_getModelMatrix(TCamera* camera);
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_lookAt(TCamera* camera, double3 eye, double3 focus, double3 up);
|
EMSCRIPTEN_KEEPALIVE void Camera_lookAt(TCamera* camera, double3 eye, double3 focus, double3 up);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE double get_camera_near(TCamera *camera);
|
EMSCRIPTEN_KEEPALIVE double Camera_getNear(TCamera *camera);
|
||||||
EMSCRIPTEN_KEEPALIVE double get_camera_culling_far(TCamera *camera);
|
EMSCRIPTEN_KEEPALIVE double Camera_getCullingFar(TCamera *camera);
|
||||||
EMSCRIPTEN_KEEPALIVE float get_camera_fov(TCamera *camera, bool horizontal);
|
EMSCRIPTEN_KEEPALIVE float Camera_getFov(TCamera *camera, bool horizontal);
|
||||||
EMSCRIPTEN_KEEPALIVE void set_camera_focus_distance(TCamera *camera, float focusDistance);
|
EMSCRIPTEN_KEEPALIVE void Camera_setFocusDistance(TCamera *camera, float focusDistance);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_setCustomProjectionWithCulling(TCamera* camera, double4x4 projectionMatrix, double near, double far);
|
EMSCRIPTEN_KEEPALIVE void Camera_setCustomProjectionWithCulling(
|
||||||
|
TCamera* camera,
|
||||||
|
double4x4 projectionMatrix,
|
||||||
|
double near,
|
||||||
|
double far
|
||||||
|
);
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_setModelMatrix(TCamera* camera, double4x4 modelMatrix);
|
EMSCRIPTEN_KEEPALIVE void Camera_setModelMatrix(TCamera* camera, double4x4 modelMatrix);
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_setLensProjection(TCamera *camera, double near, double far, double aspect, double focalLength);
|
EMSCRIPTEN_KEEPALIVE void Camera_setLensProjection(TCamera *camera, double near, double far, double aspect, double focalLength);
|
||||||
EMSCRIPTEN_KEEPALIVE EntityId Camera_getEntity(TCamera* camera);
|
EMSCRIPTEN_KEEPALIVE EntityId Camera_getEntity(TCamera* camera);
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_setProjection(TCamera *const tCamera, Projection projection, double left, double right,
|
EMSCRIPTEN_KEEPALIVE void Camera_setProjection(TCamera *const tCamera, TProjection projection, double left, double right,
|
||||||
double bottom, double top,
|
double bottom, double top,
|
||||||
double near, double far);
|
double near, double far);
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
#include "TMaterialInstance.h"
|
#include "TMaterialInstance.h"
|
||||||
#include "TTexture.h"
|
#include "TTexture.h"
|
||||||
#include "ResourceBuffer.hpp"
|
|
||||||
#include "MathUtils.hpp"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -21,7 +19,13 @@ enum TBackend {
|
|||||||
BACKEND_NOOP = 4, //!< Selects the no-op driver for testing purposes.
|
BACKEND_NOOP = 4, //!< Selects the no-op driver for testing purposes.
|
||||||
};
|
};
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TEngine *Engine_create(TBackend backend, void* platform, void* sharedContext, uint8_t stereoscopicEyeCount, bool disableHandleUseAfterFreeCheck);
|
EMSCRIPTEN_KEEPALIVE TEngine *Engine_create(
|
||||||
|
TBackend backend,
|
||||||
|
void* platform,
|
||||||
|
void* sharedContext,
|
||||||
|
uint8_t stereoscopicEyeCount,
|
||||||
|
bool disableHandleUseAfterFreeCheck
|
||||||
|
);
|
||||||
EMSCRIPTEN_KEEPALIVE TRenderer *Engine_createRenderer(TEngine *tEngine);
|
EMSCRIPTEN_KEEPALIVE TRenderer *Engine_createRenderer(TEngine *tEngine);
|
||||||
EMSCRIPTEN_KEEPALIVE TSwapChain *Engine_createSwapChain(TEngine *tEngine, void *window, uint64_t flags);
|
EMSCRIPTEN_KEEPALIVE TSwapChain *Engine_createSwapChain(TEngine *tEngine, void *window, uint64_t flags);
|
||||||
EMSCRIPTEN_KEEPALIVE TSwapChain *Engine_createHeadlessSwapChain(TEngine *tEngine, uint32_t width, uint32_t height, uint64_t flags);
|
EMSCRIPTEN_KEEPALIVE TSwapChain *Engine_createHeadlessSwapChain(TEngine *tEngine, uint32_t width, uint32_t height, uint64_t flags);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utils/Entity.h>
|
|
||||||
|
|
||||||
#include "APIExport.h"
|
#include "APIExport.h"
|
||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ enum TGizmoPickResultType { AxisX, AxisY, AxisZ, Parent, None };
|
|||||||
|
|
||||||
typedef void (*GizmoPickCallback)(TGizmoPickResultType resultType, float x, float y, float z);
|
typedef void (*GizmoPickCallback)(TGizmoPickResultType resultType, float x, float y, float z);
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE TGizmo *Gizmo_create(TEngine *tEngine, TView *tView, TGizmoType tGizmoType);
|
||||||
EMSCRIPTEN_KEEPALIVE void Gizmo_pick(TGizmo *tGizmo, uint32_t x, uint32_t y, GizmoPickCallback callback);
|
EMSCRIPTEN_KEEPALIVE void Gizmo_pick(TGizmo *tGizmo, uint32_t x, uint32_t y, GizmoPickCallback callback);
|
||||||
EMSCRIPTEN_KEEPALIVE void Gizmo_highlight(TGizmo *tGizmo, TGizmoAxis axis);
|
EMSCRIPTEN_KEEPALIVE void Gizmo_highlight(TGizmo *tGizmo, TGizmoAxis axis);
|
||||||
EMSCRIPTEN_KEEPALIVE void Gizmo_unhighlight(TGizmo *tGizmo);
|
EMSCRIPTEN_KEEPALIVE void Gizmo_unhighlight(TGizmo *tGizmo);
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
#include "TMaterialInstance.h"
|
#include "TMaterialInstance.h"
|
||||||
#include "TTexture.h"
|
#include "TTexture.h"
|
||||||
#include "ResourceBuffer.hpp"
|
|
||||||
#include "MathUtils.hpp"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
#include "APIExport.h"
|
#include "APIExport.h"
|
||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
#include "TMaterialInstance.h"
|
|
||||||
#include "TTexture.h"
|
|
||||||
#include "ResourceBuffer.hpp"
|
|
||||||
#include "MathUtils.hpp"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setMaterialInstanceAt(TRenderableManager *tRenderableManager, EntityId entityId, int primitiveIndex, TMaterialInstance *tMaterialInstance);
|
EMSCRIPTEN_KEEPALIVE void RenderableManager_setMaterialInstanceAt(TRenderableManager *tRenderableManager, EntityId entityId, int primitiveIndex, TMaterialInstance *tMaterialInstance);
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setPriority(TRenderableManager *tRenderableManager, EntityId entityId, int priority);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *RenderableManager_getMaterialInstanceAt(TRenderableManager *tRenderableManager, EntityId entityId, int primitiveIndex);
|
EMSCRIPTEN_KEEPALIVE TMaterialInstance *RenderableManager_getMaterialInstanceAt(TRenderableManager *tRenderableManager, EntityId entityId, int primitiveIndex);
|
||||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isRenderable(TRenderableManager *tRenderableManager, EntityId entityId);
|
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isRenderable(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_hasComponent(TRenderableManager *tRenderableManager, EntityId entityId);
|
EMSCRIPTEN_KEEPALIVE bool RenderableManager_hasComponent(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||||
@@ -21,6 +20,9 @@ extern "C"
|
|||||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isShadowReceiver(TRenderableManager *tRenderableManager, EntityId entityId);
|
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isShadowReceiver(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_getFogEnabled(TRenderableManager *tRenderableManager, EntityId entityId);
|
EMSCRIPTEN_KEEPALIVE bool RenderableManager_getFogEnabled(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||||
EMSCRIPTEN_KEEPALIVE Aabb3 RenderableManager_getAabb(TRenderableManager *tRenderableManager, EntityId entityId);
|
EMSCRIPTEN_KEEPALIVE Aabb3 RenderableManager_getAabb(TRenderableManager *tRenderableManager, EntityId entityId);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderableManager_setVisibilityLayer(TRenderableManager *tRenderableManager, EntityId entityId, uint8_t layer);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderableManager_setPriority(TRenderableManager *tRenderableManager, EntityId entityId, uint8_t priority);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#ifndef _T_RENDERER_H
|
#pragma once
|
||||||
#define _T_RENDERER_H
|
|
||||||
|
|
||||||
#include "APIExport.h"
|
#include "APIExport.h"
|
||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
@@ -36,4 +35,3 @@ EMSCRIPTEN_KEEPALIVE void Renderer_setFrameInterval(
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utils/Entity.h>
|
|
||||||
|
|
||||||
#include "APIExport.h"
|
#include "APIExport.h"
|
||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@ extern "C"
|
|||||||
uint32_t numUvs,
|
uint32_t numUvs,
|
||||||
uint16_t *indices,
|
uint16_t *indices,
|
||||||
uint32_t numIndices,
|
uint32_t numIndices,
|
||||||
TPrimitiveType tPrimitiveType,
|
enum TPrimitiveType tPrimitiveType,
|
||||||
TMaterialInstance **materialInstances,
|
TMaterialInstance **materialInstances,
|
||||||
int materialInstanceCount
|
int materialInstanceCount
|
||||||
);
|
);
|
||||||
@@ -45,19 +43,21 @@ extern "C"
|
|||||||
size_t numInstances
|
size_t numInstances
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_destroy(TSceneAsset *tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_addToScene(TSceneAsset *tSceneAsset, TScene *tScene);
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_addToScene(TSceneAsset *tSceneAsset, TScene *tScene);
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_removeFromScene(TSceneAsset *tSceneAsset, TScene *tScene);
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_removeFromScene(TSceneAsset *tSceneAsset, TScene *tScene);
|
||||||
EMSCRIPTEN_KEEPALIVE EntityId SceneAsset_getEntity(TSceneAsset *tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE EntityId SceneAsset_getEntity(TSceneAsset *tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE int SceneAsset_getChildEntityCount(TSceneAsset* tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE int SceneAsset_getChildEntityCount(TSceneAsset* tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_getChildEntities(TSceneAsset* tSceneAsset, EntityId *out);
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_getChildEntities(TSceneAsset* tSceneAsset, EntityId *out);
|
||||||
EMSCRIPTEN_KEEPALIVE const utils::Entity *SceneAsset_getCameraEntities(TSceneAsset* tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE EntityId *SceneAsset_getCameraEntities(TSceneAsset* tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getCameraEntityCount(TSceneAsset *tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getCameraEntityCount(TSceneAsset *tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE const utils::Entity *SceneAsset_getLightEntities(TSceneAsset* tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE EntityId *SceneAsset_getLightEntities(TSceneAsset* tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getLightEntityCount(TSceneAsset *tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getLightEntityCount(TSceneAsset *tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneAsset_getInstance(TSceneAsset *tSceneAsset, int index);
|
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneAsset_getInstance(TSceneAsset *tSceneAsset, int index);
|
||||||
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getInstanceCount(TSceneAsset *tSceneAsset);
|
EMSCRIPTEN_KEEPALIVE size_t SceneAsset_getInstanceCount(TSceneAsset *tSceneAsset);
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset * SceneAsset_createInstance(TSceneAsset *asset, TMaterialInstance **materialInstances, int materialInstanceCount);
|
EMSCRIPTEN_KEEPALIVE TSceneAsset * SceneAsset_createInstance(TSceneAsset *asset, TMaterialInstance **materialInstances, int materialInstanceCount);
|
||||||
EMSCRIPTEN_KEEPALIVE Aabb3 SceneAsset_getBoundingBox(TSceneAsset *asset);
|
EMSCRIPTEN_KEEPALIVE Aabb3 SceneAsset_getBoundingBox(TSceneAsset *asset);
|
||||||
|
EMSCRIPTEN_KEEPALIVE Aabb3 SceneAsset_getBoundingBox(TSceneAsset *asset);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "APIBoundaryTypes.h"
|
|
||||||
#include "ResourceBuffer.hpp"
|
|
||||||
#include "MathUtils.hpp"
|
|
||||||
#include "TCamera.h"
|
|
||||||
#include "TMaterialInstance.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TGizmo *SceneManager_createGizmo(TSceneManager *tSceneManager, TView *tView, TScene *tScene, TGizmoType tGizmoType);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_createGeometry(
|
|
||||||
TSceneManager *sceneManager,
|
|
||||||
float *vertices,
|
|
||||||
int numVertices,
|
|
||||||
float *normals,
|
|
||||||
int numNormals,
|
|
||||||
float *uvs,
|
|
||||||
int numUvs,
|
|
||||||
uint16_t *indices,
|
|
||||||
int numIndices,
|
|
||||||
int primitiveType,
|
|
||||||
TMaterialInstance **materialInstances,
|
|
||||||
int materialInstanceCount,
|
|
||||||
bool keepData);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TMaterialProvider *SceneManager_getUbershaderMaterialProvider(TSceneManager *sceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TMaterialProvider *SceneManager_getUnlitMaterialProvider(TSceneManager *sceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitMaterialInstance(TSceneManager *sceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitFixedSizeMaterialInstance(TSceneManager *sceneManager);
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_queueTransformUpdates(TSceneManager *sceneManager, EntityId *entities, const double *const transforms, int numEntities);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_findCameraByName(TSceneManager *tSceneManager, EntityId entity, const char *name);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_setVisibilityLayer(TSceneManager *tSceneManager, EntityId entity, int layer);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TScene *SceneManager_getScene(TSceneManager *tSceneManager);
|
|
||||||
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_createCamera(TSceneManager *sceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyCamera(TSceneManager *sceneManager, TCamera *camera);
|
|
||||||
EMSCRIPTEN_KEEPALIVE size_t SceneManager_getCameraCount(TSceneManager *sceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_getCameraAt(TSceneManager *sceneManager, size_t index);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstance(TSceneManager *sceneManager, TMaterialInstance *instance);
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE Aabb3 SceneManager_getRenderableBoundingBox(TSceneManager *tSceneManager, EntityId entity);
|
|
||||||
EMSCRIPTEN_KEEPALIVE int SceneManager_addToScene(TSceneManager *tSceneManager, EntityId entity);
|
|
||||||
EMSCRIPTEN_KEEPALIVE int SceneManager_removeFromScene(TSceneManager *tSceneManager, EntityId entity);
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_transformToUnitCube(TSceneManager *sceneManager, EntityId asset);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGlbFromBuffer(TSceneManager *tSceneManager, const uint8_t *const, size_t length, int numInstances, bool keepData, int priority, int layer, bool loadResourcesAsync);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGlb(TSceneManager *sceneManager, const char *assetPath, int numInstances, bool keepData);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGltf(TSceneManager *sceneManager, const char *assetPath, const char *relativePath, bool keepData);
|
|
||||||
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE EntityId SceneManager_addLight(
|
|
||||||
TSceneManager *tSceneManager,
|
|
||||||
uint8_t type,
|
|
||||||
float colour,
|
|
||||||
float intensity,
|
|
||||||
float posX,
|
|
||||||
float posY,
|
|
||||||
float posZ,
|
|
||||||
float dirX,
|
|
||||||
float dirY,
|
|
||||||
float dirZ,
|
|
||||||
float falloffRadius,
|
|
||||||
float spotLightConeInner,
|
|
||||||
float spotLightConeOuter,
|
|
||||||
float sunAngularRadius,
|
|
||||||
float sunHaloSize,
|
|
||||||
float sunHaloFallof,
|
|
||||||
bool shadows);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_removeLight(TSceneManager *tSceneManager, EntityId entityId);
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyLights(TSceneManager *tSceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAsset(TSceneManager *tSceneManager, TSceneAsset *sceneAsset);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAssets(TSceneManager *tSceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAll(TSceneManager *tSceneManager);
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TAnimationManager *SceneManager_getAnimationManager(TSceneManager *tSceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TNameComponentManager *SceneManager_getNameComponentManager(TSceneManager *tSceneManager);
|
|
||||||
EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_createGrid(TSceneManager *tSceneManager, TMaterial *tMaterial);
|
|
||||||
EMSCRIPTEN_KEEPALIVE bool SceneManager_isGridEntity(TSceneManager *tSceneManager, EntityId entityId);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
88
thermion_dart/native/include/c_api/TSceneManager_HBAK
Normal file
88
thermion_dart/native/include/c_api/TSceneManager_HBAK
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// #pragma once
|
||||||
|
|
||||||
|
// #include "APIBoundaryTypes.h"
|
||||||
|
// #include "MathUtils.hpp"
|
||||||
|
// #include "TCamera.h"
|
||||||
|
// #include "TMaterialInstance.h"
|
||||||
|
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// extern "C"
|
||||||
|
// {
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TGizmo *SceneManager_createGizmo(TSceneManager *tSceneManager, TView *tView, TScene *tScene, TGizmoType tGizmoType);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_createGeometry(
|
||||||
|
// TSceneManager *sceneManager,
|
||||||
|
// float *vertices,
|
||||||
|
// int numVertices,
|
||||||
|
// float *normals,
|
||||||
|
// int numNormals,
|
||||||
|
// float *uvs,
|
||||||
|
// int numUvs,
|
||||||
|
// uint16_t *indices,
|
||||||
|
// int numIndices,
|
||||||
|
// int primitiveType,
|
||||||
|
// TMaterialInstance **materialInstances,
|
||||||
|
// int materialInstanceCount,
|
||||||
|
// bool keepData);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TMaterialProvider *SceneManager_getUbershaderMaterialProvider(TSceneManager *sceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TMaterialProvider *SceneManager_getUnlitMaterialProvider(TSceneManager *sceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitMaterialInstance(TSceneManager *sceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitFixedSizeMaterialInstance(TSceneManager *sceneManager);
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_queueTransformUpdates(TSceneManager *sceneManager, EntityId *entities, const double *const transforms, int numEntities);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_findCameraByName(TSceneManager *tSceneManager, EntityId entity, const char *name);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_setVisibilityLayer(TSceneManager *tSceneManager, EntityId entity, int layer);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TScene *SceneManager_getScene(TSceneManager *tSceneManager);
|
||||||
|
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_createCamera(TSceneManager *sceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyCamera(TSceneManager *sceneManager, TCamera *camera);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE size_t SceneManager_getCameraCount(TSceneManager *sceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TCamera *SceneManager_getCameraAt(TSceneManager *sceneManager, size_t index);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstance(TSceneManager *sceneManager, TMaterialInstance *instance);
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE Aabb3 SceneManager_getRenderableBoundingBox(TSceneManager *tSceneManager, EntityId entity);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE int SceneManager_addToScene(TSceneManager *tSceneManager, EntityId entity);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE int SceneManager_removeFromScene(TSceneManager *tSceneManager, EntityId entity);
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_transformToUnitCube(TSceneManager *sceneManager, EntityId asset);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGlbFromBuffer(TSceneManager *tSceneManager, const uint8_t *const, size_t length, int numInstances, bool keepData, int priority, int layer, bool loadResourcesAsync);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGlb(TSceneManager *sceneManager, const char *assetPath, int numInstances, bool keepData);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_loadGltf(TSceneManager *sceneManager, const char *assetPath, const char *relativePath, bool keepData);
|
||||||
|
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE EntityId SceneManager_addLight(
|
||||||
|
// TSceneManager *tSceneManager,
|
||||||
|
// uint8_t type,
|
||||||
|
// float colour,
|
||||||
|
// float intensity,
|
||||||
|
// float posX,
|
||||||
|
// float posY,
|
||||||
|
// float posZ,
|
||||||
|
// float dirX,
|
||||||
|
// float dirY,
|
||||||
|
// float dirZ,
|
||||||
|
// float falloffRadius,
|
||||||
|
// float spotLightConeInner,
|
||||||
|
// float spotLightConeOuter,
|
||||||
|
// float sunAngularRadius,
|
||||||
|
// float sunHaloSize,
|
||||||
|
// float sunHaloFallof,
|
||||||
|
// bool shadows);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_removeLight(TSceneManager *tSceneManager, EntityId entityId);
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyLights(TSceneManager *tSceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAsset(TSceneManager *tSceneManager, TSceneAsset *sceneAsset);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAssets(TSceneManager *tSceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE void SceneManager_destroyAll(TSceneManager *tSceneManager);
|
||||||
|
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TAnimationManager *SceneManager_getAnimationManager(TSceneManager *tSceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TNameComponentManager *SceneManager_getNameComponentManager(TSceneManager *tSceneManager);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE TSceneAsset *SceneManager_createGrid(TSceneManager *tSceneManager, TMaterial *tMaterial);
|
||||||
|
// EMSCRIPTEN_KEEPALIVE bool SceneManager_isGridEntity(TSceneManager *tSceneManager, EntityId entityId);
|
||||||
|
|
||||||
|
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
@@ -5,9 +5,6 @@
|
|||||||
#include "APIBoundaryTypes.h"
|
#include "APIBoundaryTypes.h"
|
||||||
#include "TMaterialInstance.h"
|
#include "TMaterialInstance.h"
|
||||||
|
|
||||||
#include "ResourceBuffer.hpp"
|
|
||||||
#include "MathUtils.hpp"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -215,7 +212,13 @@ EMSCRIPTEN_KEEPALIVE TTexture *Texture_build(TEngine *engine,
|
|||||||
intptr_t import,
|
intptr_t import,
|
||||||
TTextureSamplerType sampler,
|
TTextureSamplerType sampler,
|
||||||
TTextureFormat format);
|
TTextureFormat format);
|
||||||
EMSCRIPTEN_KEEPALIVE bool Texture_loadImage(TEngine *tEngine, TTexture *tTexture, TLinearImage *tImage, TPixelDataFormat bufferFormat, TPixelDataType pixelDataType);
|
EMSCRIPTEN_KEEPALIVE bool Texture_loadImage(
|
||||||
|
TEngine *tEngine,
|
||||||
|
TTexture *tTexture,
|
||||||
|
TLinearImage *tImage,
|
||||||
|
TPixelDataFormat bufferFormat,
|
||||||
|
TPixelDataType pixelDataType
|
||||||
|
);
|
||||||
EMSCRIPTEN_KEEPALIVE bool Texture_setImage(
|
EMSCRIPTEN_KEEPALIVE bool Texture_setImage(
|
||||||
TEngine *tEngine,
|
TEngine *tEngine,
|
||||||
TTexture *tTexture,
|
TTexture *tTexture,
|
||||||
@@ -250,7 +253,7 @@ EMSCRIPTEN_KEEPALIVE uint32_t Texture_getDepth(TTexture *tTexture, uint32_t leve
|
|||||||
EMSCRIPTEN_KEEPALIVE TTextureUsage Texture_getUsage(TTexture *tTexture, uint32_t level);
|
EMSCRIPTEN_KEEPALIVE TTextureUsage Texture_getUsage(TTexture *tTexture, uint32_t level);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_createEmpty(uint32_t width,uint32_t height,uint32_t channel);
|
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_createEmpty(uint32_t width,uint32_t height,uint32_t channel);
|
||||||
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_decode(uint8_t* data, size_t length, const char* name = "image");
|
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_decode(uint8_t* data, size_t length, const char* name);
|
||||||
EMSCRIPTEN_KEEPALIVE float *Image_getBytes(TLinearImage *tLinearImage);
|
EMSCRIPTEN_KEEPALIVE float *Image_getBytes(TLinearImage *tLinearImage);
|
||||||
EMSCRIPTEN_KEEPALIVE void Image_destroy(TLinearImage *tLinearImage);
|
EMSCRIPTEN_KEEPALIVE void Image_destroy(TLinearImage *tLinearImage);
|
||||||
EMSCRIPTEN_KEEPALIVE uint32_t Image_getWidth(TLinearImage *tLinearImage);
|
EMSCRIPTEN_KEEPALIVE uint32_t Image_getWidth(TLinearImage *tLinearImage);
|
||||||
@@ -287,14 +290,14 @@ enum TSamplerCompareMode {
|
|||||||
|
|
||||||
typedef TSamplerCompareFunc TTextureSamplerCompareFunc ;
|
typedef TSamplerCompareFunc TTextureSamplerCompareFunc ;
|
||||||
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_create();
|
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_create();
|
||||||
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_createWithFiltering(
|
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_createWithFiltering(
|
||||||
TSamplerMinFilter minFilter,
|
TSamplerMinFilter minFilter,
|
||||||
TSamplerMagFilter magFilter,
|
TSamplerMagFilter magFilter,
|
||||||
TSamplerWrapMode wrapS,
|
TSamplerWrapMode wrapS,
|
||||||
TSamplerWrapMode wrapT,
|
TSamplerWrapMode wrapT,
|
||||||
TSamplerWrapMode wrapR);
|
TSamplerWrapMode wrapR
|
||||||
|
);
|
||||||
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_createWithComparison(
|
EMSCRIPTEN_KEEPALIVE TTextureSampler* TextureSampler_createWithComparison(
|
||||||
TSamplerCompareMode compareMode,
|
TSamplerCompareMode compareMode,
|
||||||
TSamplerCompareFunc compareFunc);
|
TSamplerCompareFunc compareFunc);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ struct TViewport {
|
|||||||
};
|
};
|
||||||
typedef struct TViewport TViewport;
|
typedef struct TViewport TViewport;
|
||||||
|
|
||||||
enum ToneMapping
|
enum TToneMapping
|
||||||
{
|
{
|
||||||
ACES,
|
ACES,
|
||||||
FILMIC,
|
FILMIC,
|
||||||
@@ -46,7 +46,7 @@ EMSCRIPTEN_KEEPALIVE void View_setShadowType(TView* tView, int shadowType);
|
|||||||
EMSCRIPTEN_KEEPALIVE void View_setSoftShadowOptions(TView* tView, float penumbraScale, float penumbraRatioScale);
|
EMSCRIPTEN_KEEPALIVE void View_setSoftShadowOptions(TView* tView, float penumbraScale, float penumbraRatioScale);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setBloom(TView* tView, bool enabled, float strength);
|
EMSCRIPTEN_KEEPALIVE void View_setBloom(TView* tView, bool enabled, float strength);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setRenderQuality(TView* tView, TQualityLevel qualityLevel);
|
EMSCRIPTEN_KEEPALIVE void View_setRenderQuality(TView* tView, TQualityLevel qualityLevel);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setToneMapping(TView* tView, TEngine* tEngine, ToneMapping toneMapping);
|
EMSCRIPTEN_KEEPALIVE void View_setToneMapping(TView* tView, TEngine* tEngine, TToneMapping toneMapping);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setAntiAliasing(TView *tView, bool msaa, bool fxaa, bool taa);
|
EMSCRIPTEN_KEEPALIVE void View_setAntiAliasing(TView *tView, bool msaa, bool fxaa, bool taa);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setLayerEnabled(TView *tView, int layer, bool visible);
|
EMSCRIPTEN_KEEPALIVE void View_setLayerEnabled(TView *tView, int layer, bool visible);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setCamera(TView *tView, TCamera *tCamera);
|
EMSCRIPTEN_KEEPALIVE void View_setCamera(TView *tView, TCamera *tCamera);
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace thermion
|
|||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderLoop_create();
|
EMSCRIPTEN_KEEPALIVE void RenderLoop_create();
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderLoop_destroy();
|
EMSCRIPTEN_KEEPALIVE void RenderLoop_destroy();
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderLoop_requestAnimationFrame(void (*onComplete));
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, uint64_t frameTimeInNanos,);
|
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, uint64_t frameTimeInNanos);
|
||||||
// EMSCRIPTEN_KEEPALIVE void RenderLoop_addTask(TRenderLoop* tRenderLoop, void (*task)());
|
// EMSCRIPTEN_KEEPALIVE void RenderLoop_addTask(TRenderLoop* tRenderLoop, void (*task)());
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void AnimationManager_createRenderThread(TEngine *tEngine, TScene *tScene, void (*onComplete)(TAnimationManager *));
|
EMSCRIPTEN_KEEPALIVE void AnimationManager_createRenderThread(TEngine *tEngine, TScene *tScene, void (*onComplete)(TAnimationManager *));
|
||||||
@@ -75,7 +75,7 @@ namespace thermion
|
|||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *));
|
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *));
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setToneMappingRenderThread(TView *tView, TEngine *tEngine, thermion::ToneMapping toneMapping);
|
EMSCRIPTEN_KEEPALIVE void View_setToneMappingRenderThread(TView *tView, TEngine *tEngine, ToneMapping toneMapping);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setBloomRenderThread(TView *tView, bool enabled, double strength);
|
EMSCRIPTEN_KEEPALIVE void View_setBloomRenderThread(TView *tView, bool enabled, double strength);
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setCameraRenderThread(TView *tView, TCamera *tCamera, void (*callback)());
|
EMSCRIPTEN_KEEPALIVE void View_setCameraRenderThread(TView *tView, TCamera *tCamera, void (*callback)());
|
||||||
|
|
||||||
@@ -184,7 +184,10 @@ namespace thermion
|
|||||||
uint16_t tUsage,
|
uint16_t tUsage,
|
||||||
intptr_t import,
|
intptr_t import,
|
||||||
TTextureSamplerType sampler,
|
TTextureSamplerType sampler,
|
||||||
TTextureFormat format, void (*onComplete)(TTexture *));
|
TTextureFormat format,
|
||||||
|
void (*onComplete)(TTexture *)
|
||||||
|
);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Texture_loadImageRenderThread(
|
EMSCRIPTEN_KEEPALIVE void Texture_loadImageRenderThread(
|
||||||
TEngine *tEngine,
|
TEngine *tEngine,
|
||||||
TTexture *tTexture,
|
TTexture *tTexture,
|
||||||
@@ -289,7 +292,7 @@ namespace thermion
|
|||||||
void (*onComplete)()
|
void (*onComplete)()
|
||||||
);
|
);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void update_bone_matrices_render_thread(TSceneManager *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void AnimationManager_updateBoneMatricesRenderThread(TSceneManager *sceneManager,
|
||||||
EntityId asset, void (*callback)(bool));
|
EntityId asset, void (*callback)(bool));
|
||||||
EMSCRIPTEN_KEEPALIVE void set_bone_transform_render_thread(
|
EMSCRIPTEN_KEEPALIVE void set_bone_transform_render_thread(
|
||||||
TSceneManager *sceneManager,
|
TSceneManager *sceneManager,
|
||||||
|
|||||||
@@ -102,32 +102,6 @@ namespace thermion
|
|||||||
scene->removeEntities(_asset->getCameraEntities(), _asset->getCameraEntityCount());
|
scene->removeEntities(_asset->getCameraEntities(), _asset->getCameraEntityCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPriority(RenderableManager &rm, int priority) override
|
|
||||||
{
|
|
||||||
const Entity *entities = _asset->getEntities();
|
|
||||||
for (int i = 0; i < _asset->getEntityCount(); i++)
|
|
||||||
{
|
|
||||||
if (rm.hasComponent(entities[i]))
|
|
||||||
{
|
|
||||||
auto renderableInstance = rm.getInstance(entities[i]);
|
|
||||||
rm.setPriority(renderableInstance, priority);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setLayer(RenderableManager &rm, int layer) override
|
|
||||||
{
|
|
||||||
const Entity *entities = _asset->getEntities();
|
|
||||||
for (int i = 0; i < _asset->getEntityCount(); i++)
|
|
||||||
{
|
|
||||||
if (rm.hasComponent(entities[i]))
|
|
||||||
{
|
|
||||||
auto renderableInstance = rm.getInstance(entities[i]);
|
|
||||||
rm.setLayerMask(renderableInstance, 0xFF, 1u << (uint8_t)layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneAsset *getInstanceByEntity(utils::Entity entity) override
|
SceneAsset *getInstanceByEntity(utils::Entity entity) override
|
||||||
{
|
{
|
||||||
for (auto &instance : _instances)
|
for (auto &instance : _instances)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class SceneAsset {
|
|||||||
virtual SceneAsset* getInstanceOwner() = 0;
|
virtual SceneAsset* getInstanceOwner() = 0;
|
||||||
virtual void destroyInstance(SceneAsset *instance) = 0;
|
virtual void destroyInstance(SceneAsset *instance) = 0;
|
||||||
|
|
||||||
|
|
||||||
virtual SceneAsset* createInstance(MaterialInstance **materialInstances, size_t materialInstanceCount) = 0;
|
virtual SceneAsset* createInstance(MaterialInstance **materialInstances, size_t materialInstanceCount) = 0;
|
||||||
|
|
||||||
virtual MaterialInstance **getMaterialInstances() = 0;
|
virtual MaterialInstance **getMaterialInstances() = 0;
|
||||||
@@ -50,9 +49,6 @@ class SceneAsset {
|
|||||||
virtual const Entity* getChildEntities() = 0;
|
virtual const Entity* getChildEntities() = 0;
|
||||||
virtual Entity findEntityByName(const char* name) = 0;
|
virtual Entity findEntityByName(const char* name) = 0;
|
||||||
|
|
||||||
virtual void setPriority(RenderableManager& rm, int mask) = 0;
|
|
||||||
virtual void setLayer(RenderableManager& rm, int layer) = 0;
|
|
||||||
|
|
||||||
virtual const filament::Aabb getBoundingBox() const = 0;
|
virtual const filament::Aabb getBoundingBox() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ namespace thermion
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Camera_getFrustum(TCamera *tCamera, double *out) {
|
||||||
|
auto *camera = reinterpret_cast<Camera *>(tCamera);
|
||||||
|
auto &frustum = camera->getFrustum();
|
||||||
|
auto planes = frustum.getPlanes();
|
||||||
|
for(int i = 0; i < 6; i++) {
|
||||||
|
for(int j = 0; j < 4; j++) {
|
||||||
|
out[(i*4) + j] = planes[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Camera_setCustomProjectionWithCulling(TCamera *tCamera, double4x4 projectionMatrix, double near, double far)
|
EMSCRIPTEN_KEEPALIVE void Camera_setCustomProjectionWithCulling(TCamera *tCamera, double4x4 projectionMatrix, double near, double far)
|
||||||
{
|
{
|
||||||
auto *camera = reinterpret_cast<Camera *>(tCamera);
|
auto *camera = reinterpret_cast<Camera *>(tCamera);
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ namespace thermion
|
|||||||
return reinterpret_cast<TMaterialInstance*>(materialInstance);
|
return reinterpret_cast<TMaterialInstance*>(materialInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderableManager_setPriority(TRenderableManager *tRenderableManager, EntityId entityId, int priority) {
|
|
||||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
|
||||||
const auto &entity = utils::Entity::import(entityId);
|
|
||||||
auto renderableInstance = renderableManager->getInstance(entity);
|
|
||||||
renderableManager->setPriority(renderableInstance, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isRenderable(TRenderableManager *tRenderableManager, EntityId entityId) {
|
EMSCRIPTEN_KEEPALIVE bool RenderableManager_isRenderable(TRenderableManager *tRenderableManager, EntityId entityId) {
|
||||||
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||||
const auto &entity = utils::Entity::import(entityId);
|
const auto &entity = utils::Entity::import(entityId);
|
||||||
@@ -131,5 +124,29 @@ namespace thermion
|
|||||||
auto box = rm.getAxisAlignedBoundingBox(instance);
|
auto box = rm.getAxisAlignedBoundingBox(instance);
|
||||||
return Aabb3{box.center.x, box.center.y, box.center.z, box.halfExtent.x, box.halfExtent.y, box.halfExtent.z};
|
return Aabb3{box.center.x, box.center.y, box.center.z, box.halfExtent.x, box.halfExtent.y, box.halfExtent.z};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderableManager_setVisibilityLayer(TRenderableManager *tRenderableManager, EntityId entityId, uint8_t layer) {
|
||||||
|
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||||
|
const auto &entity = utils::Entity::import(entityId);
|
||||||
|
if (!renderableManager.hasComponent(entity)) {
|
||||||
|
Log("Not renderable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto renderableInstance = renderableManager->getInstance(entity);
|
||||||
|
renderableManager->setLayerMask(renderableInstance, 0xFF, 1u << (uint8_t)layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderableManager_setPriority(TRenderableManager *tRenderableManager, EntityId entityId, uint8_t priority) {
|
||||||
|
auto *renderableManager = reinterpret_cast<filament::RenderableManager *>(tRenderableManager);
|
||||||
|
const auto &entity = utils::Entity::import(entityId);
|
||||||
|
|
||||||
|
if (!renderableManager.hasComponent(entity)) {
|
||||||
|
Log("Not renderable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto renderableInstance = renderableManager->getInstance(entity);
|
||||||
|
renderableManager->setPriority(renderableInstance, layer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,11 @@ extern "C"
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_destroy(TSceneAsset *tSceneAsset) {
|
||||||
|
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
||||||
|
delete asset;
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_addToScene(TSceneAsset *tSceneAsset, TScene *tScene) {
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_addToScene(TSceneAsset *tSceneAsset, TScene *tScene) {
|
||||||
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
||||||
auto *scene = reinterpret_cast<Scene*>(tScene);
|
auto *scene = reinterpret_cast<Scene*>(tScene);
|
||||||
@@ -121,13 +126,14 @@ extern "C"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE const utils::Entity *SceneAsset_getCameraEntities(TSceneAsset* tSceneAsset)
|
EMSCRIPTEN_KEEPALIVE EntityId *SceneAsset_getCameraEntities(TSceneAsset* tSceneAsset)
|
||||||
{
|
{
|
||||||
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
||||||
if (asset->getType() == SceneAsset::SceneAssetType::Gltf && !asset->isInstance())
|
if (asset->getType() == SceneAsset::SceneAssetType::Gltf && !asset->isInstance())
|
||||||
{
|
{
|
||||||
auto gltfSceneAsset = reinterpret_cast<GltfSceneAsset *>(asset);
|
auto gltfSceneAsset = reinterpret_cast<GltfSceneAsset *>(asset);
|
||||||
return gltfSceneAsset->getAsset()->getCameraEntities();
|
auto *entities = gltfSceneAsset->getAsset()->getCameraEntities();
|
||||||
|
return reinterpret_cast<EntityId *>(const_cast<filament::gltfio::FilamentAsset::Entity *>(entities));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -148,13 +154,14 @@ extern "C"
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE const utils::Entity *SceneAsset_getLightEntities(TSceneAsset* tSceneAsset)
|
EMSCRIPTEN_KEEPALIVE EntityId *SceneAsset_getLightEntities(TSceneAsset* tSceneAsset)
|
||||||
{
|
{
|
||||||
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
auto *asset = reinterpret_cast<SceneAsset*>(tSceneAsset);
|
||||||
if (asset->getType() == SceneAsset::SceneAssetType::Gltf && !asset->isInstance())
|
if (asset->getType() == SceneAsset::SceneAssetType::Gltf && !asset->isInstance())
|
||||||
{
|
{
|
||||||
auto gltfSceneAsset = reinterpret_cast<GltfSceneAsset *>(asset);
|
auto gltfSceneAsset = reinterpret_cast<GltfSceneAsset *>(asset);
|
||||||
return gltfSceneAsset->getAsset()->getLightEntities();
|
auto *entities = gltfSceneAsset->getAsset()->getLightEntities();
|
||||||
|
return reinterpret_cast<EntityId *>(const_cast<filament::gltfio::FilamentAsset::Entity *>(entities));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullptr_t();
|
return std::nullptr_t();
|
||||||
|
|||||||
@@ -57,23 +57,23 @@ extern "C"
|
|||||||
transformManager->setTransform(transformInstance, convert_double4x4_to_mat4(transform));
|
transformManager->setTransform(transformInstance, convert_double4x4_to_mat4(transform));
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMSCRIPTEN_KEEPALIVE void TransformManager_transformToUnitCube(TTransformManager *tTransformManager, EntityId entityId) {
|
EMSCRIPTEN_KEEPALIVE void TransformManager_transformToUnitCube(TTransformManager *tTransformManager, EntityId entityId, Aabb3 boundingBox) {
|
||||||
// auto *transformManager = reinterpret_cast<filament::TransformManager*>(tTransformManager);
|
|
||||||
// const auto &entity = utils::Entity::import(entityId);
|
|
||||||
// auto transformInstance = transformManager->getInstance(entity);
|
|
||||||
// if (!transformInstance)
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// auto aabb = instance->getBoundingBox();
|
auto *transformManager = reinterpret_cast<filament::TransformManager*>(tTransformManager);
|
||||||
// auto center = aabb.center();
|
const auto &entity = utils::Entity::import(entityId);
|
||||||
// auto halfExtent = aabb.extent();
|
auto transformInstance = transformManager->getInstance(entity);
|
||||||
// auto maxExtent = max(halfExtent) * 2;
|
if (!transformInstance || !transformInstance.isValid())
|
||||||
// auto scaleFactor = 2.0f / maxExtent;
|
{
|
||||||
// auto transform = math::mat4f::scaling(scaleFactor) * math::mat4f::translation(-center);
|
return;
|
||||||
// tm.setTransform(tm.getInstance(instance->getRoot()), transform);
|
}
|
||||||
// }
|
|
||||||
|
auto center = aabb.center();
|
||||||
|
auto halfExtent = aabb.extent();
|
||||||
|
auto maxExtent = max(halfExtent) * 2;
|
||||||
|
auto scaleFactor = 2.0f / maxExtent;
|
||||||
|
auto transform = math::mat4f::scaling(scaleFactor) * math::mat4f::translation(-center);
|
||||||
|
transformManager->setTransform(transformInstance, transform);
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void TransformManager_setParent(TTransformManager *tTransformManager, EntityId childId, EntityId parentId, bool preserveScaling)
|
EMSCRIPTEN_KEEPALIVE void TransformManager_setParent(TTransformManager *tTransformManager, EntityId childId, EntityId parentId, bool preserveScaling)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ extern "C"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderLoop_requestAnimationFrame(void (*onComplete)) {
|
||||||
|
_rl->requestFrame(onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, , uint64_t frameTimeInNanos, void (*onComplete)()) {
|
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, , uint64_t frameTimeInNanos, void (*onComplete)()) {
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
|
|||||||
@@ -966,32 +966,5 @@ namespace thermion
|
|||||||
return _cameras[index - 1];
|
return _cameras[index - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::transformToUnitCube(EntityId entityId)
|
|
||||||
{
|
|
||||||
auto entity = utils::Entity::import(entityId);
|
|
||||||
for (auto &asset : _sceneAssets)
|
|
||||||
{
|
|
||||||
auto *instance = reinterpret_cast<GltfSceneAssetInstance *>(asset->getInstanceByEntity(entity));
|
|
||||||
if (instance)
|
|
||||||
{
|
|
||||||
auto &transformManager = _engine->getTransformManager();
|
|
||||||
const auto &entity = utils::Entity::import(entityId);
|
|
||||||
auto transformInstance = transformManager.getInstance(entity);
|
|
||||||
if (!transformInstance)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto aabb = instance->getInstance()->getBoundingBox();
|
|
||||||
auto center = aabb.center();
|
|
||||||
auto halfExtent = aabb.extent();
|
|
||||||
auto maxExtent = max(halfExtent) * 2;
|
|
||||||
auto scaleFactor = 2.0f / maxExtent;
|
|
||||||
auto transform = math::mat4f::scaling(scaleFactor) * math::mat4f::translation(-center);
|
|
||||||
transformManager.setTransform(transformManager.getInstance(entity), transform);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace thermion
|
} // namespace thermion
|
||||||
|
|||||||
Reference in New Issue
Block a user