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

Higher-order components and helpers #34

Open
Izzimach opened this issue Sep 10, 2015 · 0 comments
Open

Higher-order components and helpers #34

Izzimach opened this issue Sep 10, 2015 · 0 comments

Comments

@Izzimach
Copy link
Owner

Creating the various components (most notably <Scene> and <Mesh>) are pretty cumbersome even if you just want a simple scene with a single mesh in it. There are a lot of fiddly props and boilerplate that feels very Un-React-ish.

However, IMO the basic react-three components should try to mirror three.js as close as possible which makes it easier to maintain and test the components. A possible approach is to create a set of "higher-order components" which wrap the default components and add sensible defaults or common boilerplate. Some examples:

  • <DefaultScene> would provide a default camera at some prescribed distance and size itself to fit into the browser window
  • <OrbitCamera> would rotate/pan/zoom child objects based on mouse/touch actions, similar to the code already added by 8318719
  • <Box> creates a box of a certain size and color
  • <AutoMesh> handles the loading of mesh geometry and materials and things.

This will probably go into an addons directory or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant