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

feat: Add API for controlling the scene (#15) #27

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

mrousavy
Copy link
Member

@mrousavy mrousavy commented Mar 5, 2024

Warning

Based on the following PR which should be merged first

Goal:

To provide an API from JS that can be used to setup the scene and control the transform of the elements.

(Most important) Changes:

  • Camera:

  • Renamed lookAt -> lookAtCameraManipulator Can be used to make camera look at camera manipulator

  • New lookAt function, which can be used to manually control the position, target and up vector of the camera

  • New setLensProjection & setProjection function to Control the lens configuration from JS

  • ⚠️ Note: @mrousavy The user would also need to call this when the surface size changes (as we need to pass the aspect ratio to this function). Lets discuss in a quick meeting how to solve this best

  • Engine:

  • Renamed createDefaultLight -> setIndirectLight, only sets the indirect light from an FilamentBuffer now (decouples the function from setting a default directional light, which can be now configured by the user)

  • New createLightEntity Function to create a light with the configuration you want

  • Exposed transformToUnitCube. Pass an asset and it will transform the asset to fit into a unit cube

  • New setEntityPosition, setEntityRotation and setEntityScale to set or update an entities transform

  • loadAsset now returns a FilamentAsset. The asset can be used for various operations in the scene.


hannojg and others added 5 commits March 5, 2024 14:14
>[!WARNING]
> Based on the following PR which should be merged first
> - #13

**Goal:**

To provide an API from JS that can be used to setup the scene and
control the transform of the elements.

(Most important) **Changes:**

- **Camera:**
- Renamed `lookAt` -> `lookAtCameraManipulator` Can be used to make
camera look at camera manipulator
- New `lookAt` function, which can be used to manually control the
position, target and up vector of the camera
- New `setLensProjection` & `setProjection` function to Control the lens
configuration from JS
- **⚠️ Note:** @mrousavy The user would also need to call this when the
surface size changes (as we need to pass the aspect ratio to this
function). Lets discuss in a quick meeting how to solve this best

- **Engine:**
- Renamed `createDefaultLight` -> `setIndirectLight`, only sets the
indirect light from an FilamentBuffer now (decouples the function from
setting a default directional light, which can be now configured by the
user)
- New `createLightEntity` Function to create a light with the
configuration you want
- Exposed `transformToUnitCube`. Pass an asset and it will transform the
asset to fit into a unit cube
- New `setEntityPosition`, `setEntityRotation` and `setEntityScale` to
set or update an entities transform
- `loadAsset` now returns a `FilamentAsset`. The asset can be used for
various operations in the scene.

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
@mrousavy mrousavy merged commit 12dec30 into main Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants