react-babylonjs icon indicating copy to clipboard operation
react-babylonjs copied to clipboard

useBeforeCameraRender and useAfterCameraRender hook

Open saidmoya12 opened this issue 3 years ago • 7 comments

implement of useBeforeCameraRender and useAfterCameraRender to work with multiple cameras like VR eyes

This is an easy alternative to get active shader for camera

useBeforeCameraRender is used in textureDome (PhotoDome) to check current eye of camera https://github.com/BabylonJS/Babylon.js/blob/fdbf393d1d7699dc7cc69cec1dca0819ebd2622a/packages/dev/core/src/Helpers/textureDome.ts

saidmoya12 avatar Nov 09 '22 02:11 saidmoya12

thanks @saidmoya12 this is great! if you don't mind could you change the import to fully qualified (with .js) I think

import { Camera } from "@babylonjs/core/Cameras/camera"

would become:

import { Camera } from "@babylonjs/core/Cameras/camera.js"
//                                                     ^^

That's needed for compat with bundlers. I don't mind making that change just let me know and then I'll merge 😄

brianzinn avatar Nov 09 '22 03:11 brianzinn

also, let me know if it's ok to at mention you in main readme as a contributor. thx

brianzinn avatar Nov 09 '22 03:11 brianzinn

@saidmoya12 Do you have an example codepen or code sample for using it - would be cool to have a working page up for the hook in the docs.

brianzinn avatar Nov 09 '22 16:11 brianzinn

Sounds great, but you can give me some example to install from my fork while isn't merge?

Thanks!

saidmoya12 avatar Nov 11 '22 16:11 saidmoya12

@saidmoya12 what about a codesandbox with current NPM version? I can add the sample to the new doc - it would be great to have an example of how to use the hooks. You could also just post some snippets of how you found those hooks useful here. If you wanted to do a codesandbox this may be a useful starting point: https://codesandbox.io/s/floral-water-els13w

brianzinn avatar Nov 12 '22 04:11 brianzinn

you can also npm link current version if you want to make a separate CRA example. the other option is to use the 'static' folder to make an example in the Gatsby site (I have no docs to run it yet), but the storybook site is currently broken - otherwise normally you can test out new features directly in the repo.

brianzinn avatar Nov 12 '22 04:11 brianzinn

Thanks, I will working with it soon!

saidmoya12 avatar Nov 28 '22 22:11 saidmoya12

hi @saidmoya12 - sorry i didn't merge this earlier. i think i was waiting on a sample from you and then... ⏲️ anyway. Better late then never! Thank-you for your contribution.

brianzinn avatar Jun 01 '24 04:06 brianzinn

hi @saidmoya12 - sorry i didn't merge this earlier. i think i was waiting on a sample from you and then... ⏲️ anyway. Better late then never! Thank-you for your contribution.

saidmoya12 avatar Jun 01 '24 16:06 saidmoya12