Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/js api - Introduce new consumer JS API #22

Merged
merged 127 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
cc3eb54
create engine + createRenderer
hannojg Feb 23, 2024
0f7de42
format cpp
hannojg Feb 23, 2024
87a2ebb
create camera
hannojg Feb 23, 2024
7562bf3
scene + camera + view scaffolding
hannojg Feb 23, 2024
8064705
wip: asset loading
hannojg Feb 23, 2024
84ddaf3
wip: create default light + add entity to scene
hannojg Feb 23, 2024
1f35415
wip
hannojg Feb 23, 2024
7588a0d
use getter camera
hannojg Feb 23, 2024
4be6e4c
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 23, 2024
6e3b6eb
using new reference heuristics
hannojg Feb 23, 2024
6794753
wip: adding missing types
hannojg Feb 23, 2024
2c109ac
setup swap chain
hannojg Feb 23, 2024
88b8a4c
cleanup
hannojg Feb 23, 2024
7b0ca1a
implemented renderer methods
hannojg Feb 23, 2024
628084c
cleanup
hannojg Feb 23, 2024
639249b
implemented camera manipulator
hannojg Feb 23, 2024
7dbbebf
safe guard code + make internal private
hannojg Feb 24, 2024
2026812
cleanup listener
hannojg Feb 26, 2024
df1028d
wip: FilamentBuffer
hannojg Feb 26, 2024
ffabde0
wip: example assets
hannojg Feb 26, 2024
d9fd876
fix reading bytes broken
hannojg Feb 26, 2024
2306932
load asset resources
hannojg Feb 26, 2024
6c08d06
first render output of the pengu
hannojg Feb 26, 2024
85884ac
remove black background
hannojg Feb 26, 2024
5151a2c
wip: rendering indirect light
hannojg Feb 26, 2024
23ad358
restructure, create everything in the EngineWrapper
hannojg Feb 27, 2024
f1118e0
new render implementation
hannojg Feb 27, 2024
5ff5f8c
cleanup
hannojg Feb 27, 2024
73ef9f9
remove choreographer listener
hannojg Feb 27, 2024
a62bb78
export the types
hannojg Feb 27, 2024
ddd286a
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
6aa20e9
updating code to new render engine
hannojg Feb 27, 2024
c15754d
change loadModel -> getAssetByteBuffer
hannojg Feb 27, 2024
83288a8
linking assets
hannojg Feb 27, 2024
29eddd5
fix ios
hannojg Feb 27, 2024
daba148
wip: populateScene?
hannojg Feb 27, 2024
a3a82b6
wip: try with animator
hannojg Feb 27, 2024
ede8005
remove animator
hannojg Feb 27, 2024
ebf6520
fix: android iOS show the same output - almost there
hannojg Feb 27, 2024
3f6c51f
there is a penguin looking at me
hannojg Feb 27, 2024
dbfc2f2
Revert "remove animator"
hannojg Feb 27, 2024
949656a
fix: Disable source builds for iOS
mrousavy Feb 27, 2024
3bd1f07
Remove `filament` source lib from `ios`
mrousavy Feb 27, 2024
18d9ccd
return in nano seconds to match android
hannojg Feb 27, 2024
c72e4a1
Update FilamentView.java
mrousavy Feb 27, 2024
13c337c
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 27, 2024
30c82ab
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
05829a4
check-all
hannojg Feb 27, 2024
438fe18
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
4f31f90
Update package/cpp/core/EngineWrapper.cpp
hannojg Feb 27, 2024
fede57d
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
363c423
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
e2f46d6
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
0b02994
workaround bad_weak_ptr exception
hannojg Feb 28, 2024
826ba3d
comment manipulator
hannojg Feb 28, 2024
9ca913a
remove todo, add comment
hannojg Feb 28, 2024
b9a40c8
remove empty decl
hannojg Feb 28, 2024
61fa84e
Update package/cpp/core/EngineWrapper.cpp
hannojg Feb 28, 2024
47b637b
clean
hannojg Feb 28, 2024
4c599dd
name values
hannojg Feb 28, 2024
1bad969
remove unnecessary check
hannojg Feb 28, 2024
07ca08e
remove unnecessary check
hannojg Feb 28, 2024
5dbb1be
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 28, 2024
a68986e
update todo
hannojg Feb 28, 2024
2bd25ee
check all
hannojg Feb 28, 2024
0de95a7
fix swap chain wrapper
hannojg Feb 28, 2024
fa3ae0f
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 28, 2024
f35b6d3
cleanup camera logic
hannojg Feb 28, 2024
7d1be07
type cleanup
hannojg Feb 28, 2024
908710a
restructure js code
hannojg Feb 29, 2024
14463f0
wip: separarte light creation
hannojg Feb 29, 2024
8584933
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 29, 2024
4f8fccf
fix issues after merge
hannojg Feb 29, 2024
b1b82a5
Merge branch 'feat/asset-loader' into feat/api-for-maintaining-scene
hannojg Feb 29, 2024
53cb229
use double instead of float
hannojg Feb 29, 2024
2efe5a8
remove cast
hannojg Feb 29, 2024
958fa4a
create correct light in JS
hannojg Feb 29, 2024
a178794
fix: Fix enums not converting properly (#19)
mrousavy Feb 29, 2024
c27be15
fix: Remove unneeded template
mrousavy Feb 29, 2024
b335d80
fix: Fix invalidUnion template arg
mrousavy Feb 29, 2024
b947cc7
wip: restructure
hannojg Feb 29, 2024
6ba1383
temp
hannojg Feb 29, 2024
4c995b0
use string for now
hannojg Feb 29, 2024
d71bdd0
expose transform to unit cube
hannojg Feb 29, 2024
de2b1b7
camera look at
hannojg Feb 29, 2024
2ee53b4
configure camera dynamically
hannojg Feb 29, 2024
680f32f
check-all
hannojg Feb 29, 2024
8ba2e3c
remove unnecessary checks
hannojg Feb 29, 2024
ca28eca
wip: translate system
hannojg Feb 29, 2024
9b1e7b9
wip
hannojg Feb 29, 2024
ceb5e87
transform API
hannojg Feb 29, 2024
1741f9c
docs
hannojg Feb 29, 2024
08786e3
clean
hannojg Feb 29, 2024
5047078
implement animator
hannojg Feb 29, 2024
be46793
wip animations impl
hannojg Feb 29, 2024
8fa7e5f
link new assets
hannojg Mar 1, 2024
5afc5d5
wip
hannojg Mar 1, 2024
1783dd9
reset to building release
hannojg Mar 1, 2024
6013f26
feat: add createAnimatorWithAnimationsFrom api
hannojg Mar 1, 2024
e6810c4
increment version
hannojg Mar 2, 2024
7eebf54
wip: restructure JS API
hannojg Mar 2, 2024
9aa2407
remove timeout
hannojg Mar 2, 2024
75ecdcb
remove unused code
hannojg Mar 2, 2024
b849d82
move code over to app
hannojg Mar 2, 2024
eae0e5f
call setup code w/o requestAnimationFrame
hannojg Mar 2, 2024
6963db8
align prettier + eslint trailing comma rule
hannojg Mar 2, 2024
d10c298
configure camera in render callback
hannojg Mar 2, 2024
b58fb90
check-all
hannojg Mar 2, 2024
272360e
add cleanup for assets
hannojg Mar 2, 2024
bc09bb2
remove todo, fixed by moving to render callback
hannojg Mar 2, 2024
c269ac4
fix building for iOS
hannojg Mar 3, 2024
a978ece
Merge branch 'feat/copy-animations' into fix/js-api
hannojg Mar 3, 2024
972010d
fix ios nothing showing up
hannojg Mar 3, 2024
84c31d6
Merge branch 'main' into feat/animation-api
hannojg Mar 5, 2024
f06bcb9
fix Animator
hannojg Mar 5, 2024
23013d2
check-all
hannojg Mar 6, 2024
2e120a9
fix name
hannojg Mar 6, 2024
74a57b8
cleanup
hannojg Mar 6, 2024
6d8a0b3
Merge branch 'feat/animation-api' into feat/copy-animations
hannojg Mar 6, 2024
8c7af88
fix destructor + cleanup
hannojg Mar 6, 2024
edd9712
Merge branch 'feat/copy-animations' into fix/js-api
hannojg Mar 6, 2024
074a2ef
enable transparent view android
hannojg Mar 6, 2024
996cb45
chore: release 0.2.0
hannojg Mar 6, 2024
eee3b4f
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Mar 8, 2024
e96ffdd
remove
hannojg Mar 8, 2024
185535b
delete old patch
hannojg Mar 8, 2024
e2d588b
remove bullet
hannojg Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
trailingComma: 'es5',
semi: false,
tabWidth: 2,
useTabs: false,
printWidth: 140
printWidth: 140,
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private void setupView() {
textureView.setClipToOutline(true);
textureView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
textureView.setSurfaceTextureListener(this);
textureView.setOpaque(false);
addView(textureView);
}

Expand Down
3 changes: 0 additions & 3 deletions package/cpp/core/EngineWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ void EngineWrapper::surfaceSizeChanged(int width, int height) {
if (_view) {
_view->setViewport(0, 0, width, height);
}

// TODO: when the surface resizes we need to update the camera projection, but that one is owned by JS now.
// updateCameraProjection();
}

void EngineWrapper::destroySurface() {
Expand Down
26 changes: 18 additions & 8 deletions package/example/ios/FilamentExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
89C6BE57DB24E9ADA2F236DE /* Pods-FilamentExample-FilamentExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FilamentExample-FilamentExampleTests.release.xcconfig"; path = "Target Support Files/Pods-FilamentExample-FilamentExampleTests/Pods-FilamentExample-FilamentExampleTests.release.xcconfig"; sourceTree = "<group>"; };
BE173E0B3B23427D84C92C91 /* pijamas.glb */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = pijamas.glb; path = ../assets/pijamas.glb; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
7A69823713B34897AF31CAF0 /* default_env_ibl.ktx */ = {isa = PBXFileReference; name = "default_env_ibl.ktx"; path = "../assets/default_env_ibl.ktx"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
3E2439B417DA497E83EB1F05 /* pengu.glb */ = {isa = PBXFileReference; name = "pengu.glb"; path = "../assets/pengu.glb"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
BE173E0B3B23427D84C92C91 /* pijamas.glb */ = {isa = PBXFileReference; name = "pijamas.glb"; path = "../assets/pijamas.glb"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
034C2E5BF6EE449290528E8D /* pirate.glb */ = {isa = PBXFileReference; name = "pirate.glb"; path = "../assets/pirate.glb"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -169,6 +173,18 @@
path = Pods;
sourceTree = "<group>";
};
995DFB4F30584326AD631A9F /* Resources */ = {
isa = "PBXGroup";
children = (
7A69823713B34897AF31CAF0 /* default_env_ibl.ktx */,
3E2439B417DA497E83EB1F05 /* pengu.glb */,
BE173E0B3B23427D84C92C91 /* pijamas.glb */,
034C2E5BF6EE449290528E8D /* pirate.glb */,
);
name = Resources;
sourceTree = "<group>";
path = "";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -607,10 +623,7 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -678,10 +691,7 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
67 changes: 64 additions & 3 deletions package/example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,71 @@
import * as React from 'react'
import { useCallback, useEffect, useMemo, useRef } from 'react'

import { StyleSheet } from 'react-native'
import { FilamentView } from 'react-native-filament'
import { Platform, StyleSheet } from 'react-native'
import { FilamentProxy, FilamentView, Float3, RenderCallback } from 'react-native-filament'

const engine = FilamentProxy.createEngine()

const penguModelPath = Platform.select({
android: 'custom/pengu.glb',
ios: 'pengu.glb',
})!

const indirectLightPath = Platform.select({
android: 'custom/default_env_ibl.ktx',
ios: 'default_env_ibl.ktx',
})!

// Camera config:
const cameraPosition: Float3 = [0, 0, 8]
const cameraTarget: Float3 = [0, 0, 0]
const cameraUp: Float3 = [0, 1, 0]
const focalLengthInMillimeters = 28
const near = 0.1
const far = 1000

export default function App() {
return <FilamentView style={styles.filamentView} />
const [_pengu, penguAnimator] = useMemo(() => {
const modelBuffer = FilamentProxy.getAssetByteBuffer(penguModelPath)
const asset = engine.loadAsset(modelBuffer)
const animator = asset.getAnimator()
asset.releaseSourceData()

return [asset, animator]
}, [])

const prevAspectRatio = useRef(0)
const renderCallback: RenderCallback = useCallback(
(_timestamp, _startTime, passedSeconds) => {
const view = engine.getView()
const aspectRatio = view.aspectRatio
if (prevAspectRatio.current !== aspectRatio) {
prevAspectRatio.current = aspectRatio
// Setup camera lens:
const camera = engine.getCamera()
camera.setLensProjection(focalLengthInMillimeters, aspectRatio, near, far)
}

penguAnimator.applyAnimation(0, passedSeconds)
penguAnimator.updateBoneMatrices()

engine.getCamera().lookAt(cameraPosition, cameraTarget, cameraUp)
},
[penguAnimator]
)

// Setup the 3D scene:
useEffect(() => {
// Create a default light:
const indirectLightBuffer = FilamentProxy.getAssetByteBuffer(indirectLightPath)
engine.setIndirectLight(indirectLightBuffer)

// Create a directional light for supporting shadows
const light = engine.createLightEntity('directional', 6500, 10000, 0, -1, 0, true)
engine.getScene().addEntity(light)
}, [])

return <FilamentView style={styles.filamentView} engine={engine} renderCallback={renderCallback} />
}

const styles = StyleSheet.create({
Expand Down
5 changes: 3 additions & 2 deletions package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-filament",
"version": "0.1.0",
"version": "0.2.0",
"description": "A real-time physically based 3D rendering engine for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -97,7 +97,8 @@
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}"
"tagName": "v${version}",
"requireCleanWorkingDir": false
},
"npm": {
"publish": true
Expand Down
146 changes: 16 additions & 130 deletions package/src/FilamentView.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,22 @@
import React from 'react'
import { Button, findNodeHandle, NativeMethods, Platform, ScrollView, View } from 'react-native'
import { findNodeHandle, NativeMethods } from 'react-native'
import { FilamentProxy } from './native/FilamentProxy'
import { FilamentNativeView, NativeProps } from './native/FilamentNativeView'
import type { Float3 } from './types/float3'
import { Animator } from './types/Animator'
import { Engine, RenderCallback } from './types'

type FilamentViewProps = NativeProps
type FilamentViewProps = NativeProps & {
engine: Engine
renderCallback: RenderCallback
}

type RefType = React.Component<NativeProps> & Readonly<NativeMethods>

const penguModelPath = Platform.select({
android: 'custom/pengu.glb',
ios: 'pengu.glb',
})!

const indirectLightPath = Platform.select({
android: 'custom/default_env_ibl.ktx',
ios: 'default_env_ibl.ktx',
})!

const pirateHatPath = Platform.select({
android: 'custom/pirate.glb',
ios: 'pirate.glb',
})!

const pijamaPath = Platform.select({
android: 'custom/pijamas.glb',
ios: 'pijamas.glb',
})!

// Temporarily
type _State = {
animationNames: string[]
currentAnimation: number
}

export class FilamentView extends React.PureComponent<FilamentViewProps, _State> {
export class FilamentView extends React.PureComponent<FilamentViewProps> {
private readonly ref: React.RefObject<RefType>
private readonly engine = FilamentProxy.createEngine()
private animator: Animator
private hatAnimator: Animator
private pijamaAnimator: Animator

constructor(props: FilamentViewProps) {
super(props)
this.ref = React.createRef<RefType>()

const pengu = this.loadPengu()
this.animator = pengu.getAnimator()
this.state = {
animationNames: Array.from({ length: this.animator.getAnimationCount() }, (_, i) => this.animator.getAnimationName(i)),
currentAnimation: 0,
}

const pirateHatBuffer = FilamentProxy.getAssetByteBuffer(pirateHatPath)
const pirateHatAsset = this.engine.loadAsset(pirateHatBuffer)
this.hatAnimator = pirateHatAsset.createAnimatorWithAnimationsFrom(pengu)
const pijamaBuffer = FilamentProxy.getAssetByteBuffer(pijamaPath)
const pijamaAsset = this.engine.loadAsset(pijamaBuffer)
this.pijamaAnimator = pijamaAsset.createAnimatorWithAnimationsFrom(pengu)

// Cleanup memory after loading the asset
pengu.releaseSourceData()
pirateHatAsset.releaseSourceData()
pijamaAsset.releaseSourceData()

this.setup3dScene()
}

// TODO: Does this also work for Fabric?
Expand All @@ -79,49 +30,9 @@ export class FilamentView extends React.PureComponent<FilamentViewProps, _State>
}

componentDidMount() {
// TODO: lets get rid of this timeout
setTimeout(() => {
this.setupSurface()
}, 100)
}

loadPengu = () => {
// Load a model into the scene:
const modelBuffer = FilamentProxy.getAssetByteBuffer(penguModelPath)
const penguAsset = this.engine.loadAsset(modelBuffer)

return penguAsset
}

setup3dScene = () => {
// Create a default light:
const indirectLightBuffer = FilamentProxy.getAssetByteBuffer(indirectLightPath)
this.engine.setIndirectLight(indirectLightBuffer)

// Create a directional light for supporting shadows
const light = this.engine.createLightEntity('directional', 6500, 10000, 0, -1, 0, true)
this.engine.getScene().addEntity(light)
}

renderCallback = (_timestamp: number, _startTime: number, passedSeconds: number) => {
const cameraPosition: Float3 = [0, 0, 8]
const cameraTarget: Float3 = [0, 0, 0]
const cameraUp: Float3 = [0, 1, 0]

if (this.animator) {
this.animator.applyAnimation(this.state.currentAnimation, passedSeconds)
this.animator.updateBoneMatrices()
}
if (this.hatAnimator) {
this.hatAnimator.applyAnimation(this.state.currentAnimation, passedSeconds)
this.hatAnimator.updateBoneMatrices()
}
if (this.pijamaAnimator) {
this.pijamaAnimator.applyAnimation(this.state.currentAnimation, passedSeconds)
this.pijamaAnimator.updateBoneMatrices()
}

this.engine.getCamera().lookAt(cameraPosition, cameraTarget, cameraUp)
// TODO(Marc): I had to add this setTimeout(, 0), otherwise there would be no render output on iOS.
// I assume its because the surface isn't ready yet or something?
setTimeout(this.setupSurface, 0)
}

setupSurface = () => {
Expand All @@ -130,41 +41,16 @@ export class FilamentView extends React.PureComponent<FilamentViewProps, _State>
const surfaceProvider = fView.getSurfaceProvider()

// Link the surface with the engine:
this.engine.setSurfaceProvider(surfaceProvider)

// Configure camera lens (Important, do so after linking the surface)
const view = this.engine.getView()
const aspectRatio = view.aspectRatio
const focalLengthInMillimeters = 28
const near = 0.1
const far = 1000
this.engine.getCamera().setLensProjection(focalLengthInMillimeters, aspectRatio, near, far)
console.log('aspectRatio', aspectRatio)
// Alternatively setProjection can be used
this.props.engine.setSurfaceProvider(surfaceProvider)

// Callback for rendering every frame
this.engine.setRenderCallback(this.renderCallback)
// Set the render callback:
this.props.engine.setRenderCallback(this.props.renderCallback)
}

/** @internal */
public render(): React.ReactNode {
return (
<View style={this.props.style}>
<FilamentNativeView ref={this.ref} {...this.props} />

<ScrollView style={{ position: 'absolute', bottom: 0, maxHeight: 200, width: '100%' }}>
{this.state.animationNames.map((name, i) => (
<Button
key={i}
onPress={() => {
// this.prevAnimationIndex = this.state.currentAnimation
this.setState({ currentAnimation: i })
}}
title={name}
/>
))}
</ScrollView>
</View>
)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { engine, renderCallback, ...nativeProps } = this.props
return <FilamentNativeView ref={this.ref} {...nativeProps} />
}
}
6 changes: 4 additions & 2 deletions package/src/types/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { Entity } from './Entity'
import { FilamentAsset } from './FilamentAsset'
import { Float3 } from './float3'

export type RenderCallback = (timestamp: number, startTime: number, passedSeconds: number) => void

export interface Engine {
setSurfaceProvider(surfaceProvider: SurfaceProvider): void
setRenderCallback(callback: (timestamp: number, startTime: number, passedSeconds: number) => void): void
setRenderCallback(callback: RenderCallback): void

/**
* Given a @see FilamentBuffer (e.g. from a .glb file), load the asset into the engine.
Expand Down Expand Up @@ -50,7 +52,7 @@ export interface Engine {
directionX: number,
directionY: number,
directionZ: number,
castShadows: boolean
castShadows: boolean,
): Entity

/**
Expand Down
1 change: 1 addition & 0 deletions package/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './Renderer'
export * from './Scene'
export * from './View'
export * from './SwapChain'
export * from './float3'