From e5c32cceaad65b6d0d4725e5a0947ac5a17d1c6c Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 11 Jul 2024 12:48:53 +0200 Subject: [PATCH] chore: change FilamentContext -> FilamentScene + cleanups (#222) --- README.md | 12 +++--- package/example/Shared/src/AnimatedRotate.tsx | 6 +-- .../Shared/src/AnimationTransitions.tsx | 6 +-- .../src/AnimationTransitionsRecording.tsx | 6 +-- package/example/Shared/src/CameraPan.tsx | 6 +-- .../example/Shared/src/ChangeMaterials.tsx | 6 +-- package/example/Shared/src/ImageExample.tsx | 6 +-- package/example/Shared/src/LoadFromFile.tsx | 6 +-- .../example/Shared/src/MultipleInstances.tsx | 6 +-- .../example/Shared/src/NoneTransparent.tsx | 16 ++------ .../internal/useApplyTransformations.tsx | 2 +- package/src/hooks/useAnimator.ts | 2 +- package/src/hooks/useCameraManipulator.ts | 2 +- package/src/hooks/useConfigureAssetShadow.ts | 2 +- .../useFilamentContext.ts} | 13 +++---- package/src/hooks/useLightEntity.ts | 2 +- package/src/hooks/useModel.ts | 2 +- package/src/hooks/useRecorder.ts | 2 +- package/src/hooks/useSkybox.ts | 2 +- package/src/hooks/useWorkletCallback.ts | 2 +- package/src/hooks/useWorkletEffect.ts | 2 +- package/src/hooks/useWorkletMemo.ts | 2 +- package/src/index.tsx | 4 +- package/src/react/BackgroundImage.tsx | 2 +- package/src/react/Camera.tsx | 2 +- package/src/react/Configurator.tsx | 4 +- package/src/react/DebugBox.tsx | 2 +- package/src/react/EnvironmentalLight.tsx | 2 +- ...{FilamentContext.tsx => FilamentScene.tsx} | 38 +++++++++++++++---- package/src/react/FilamentView.tsx | 27 +++++++------ package/src/react/Light.tsx | 2 +- package/src/react/Model.tsx | 2 +- 32 files changed, 104 insertions(+), 92 deletions(-) rename package/src/{react/Context.tsx => hooks/useFilamentContext.ts} (63%) rename package/src/react/{FilamentContext.tsx => FilamentScene.tsx} (73%) diff --git a/README.md b/README.md index 82abfe12..753f31f0 100644 --- a/README.md +++ b/README.md @@ -39,21 +39,21 @@ cd ios && pod install ### Example ```tsx -import { FilamentContext, FilamentView, Model, Camera } from 'react-native-filament' +import { FilamentScene, FilamentView, Model, Camera } from 'react-native-filament' function App() { return ( - + // Render with the default camera: - + // Add a model to the scene (only glb supported yet): - + ) } ``` @@ -85,7 +85,7 @@ yarn build-bullet3 yarn build-filament:release # or yarn build-filament:debug ``` -You can then build one of the example apps in `package/example/AppExamplePaper` or `package/example/AppExampleFabric`. +You can then build one of the example apps in `package/example/AppExamplePaper` or `package/example/AppExampleFabric`. ### Adopting at scale @@ -102,4 +102,4 @@ If you need help with integrating react-native-filament in your app or have addi The example app in this project uses several free assets: - Image by freepik -- "Buster Drone" (https://skfb.ly/TBnX) by LaVADraGoN is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/). \ No newline at end of file +- "Buster Drone" (https://skfb.ly/TBnX) by LaVADraGoN is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/). diff --git a/package/example/Shared/src/AnimatedRotate.tsx b/package/example/Shared/src/AnimatedRotate.tsx index ff9aa389..b68c8bff 100644 --- a/package/example/Shared/src/AnimatedRotate.tsx +++ b/package/example/Shared/src/AnimatedRotate.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import { StyleSheet } from 'react-native' -import { FilamentContext, FilamentView, Camera, Skybox, Model, DefaultLight, RenderCallback, ModelInstance } from 'react-native-filament' +import { FilamentScene, FilamentView, Camera, Skybox, Model, DefaultLight, RenderCallback, ModelInstance } from 'react-native-filament' import DroneGlb from '~/assets/buster_drone.glb' import { useSharedValue } from 'react-native-worklets-core' import { useCallback } from 'react' @@ -45,9 +45,9 @@ function Renderer() { export function AnimatedRotate() { return ( - + - + ) } diff --git a/package/example/Shared/src/AnimationTransitions.tsx b/package/example/Shared/src/AnimationTransitions.tsx index e69ad0a2..ed4fc5ac 100644 --- a/package/example/Shared/src/AnimationTransitions.tsx +++ b/package/example/Shared/src/AnimationTransitions.tsx @@ -1,7 +1,7 @@ import { useNavigation } from '@react-navigation/native' import * as React from 'react' import { Alert, Button, ScrollView, StyleSheet, View } from 'react-native' -import { FilamentContext, FilamentView, Camera, Model, Animator, AnimationItem, Entity, DefaultLight } from 'react-native-filament' +import { FilamentScene, FilamentView, Camera, Model, Animator, AnimationItem, Entity, DefaultLight } from 'react-native-filament' import { useSharedValue } from 'react-native-worklets-core' import HipHopGirlGlb from '~/assets/hiphopgirl.glb' import { SafeAreaView } from 'react-native-safe-area-context' @@ -60,9 +60,9 @@ export function AnimationTransitions() { return ( - + - +