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

Refactor: Isolate and abstract three.js related code. #50

Merged
merged 14 commits into from
Sep 10, 2019

Conversation

freezy
Copy link
Member

@freezy freezy commented Sep 10, 2019

This PR abstracts render-related code into an interface that can be implemented by other WebGL frameworks. The main goal is to be able to tree-shake non-used render code (and specially three.js) in case another WebGL framework is used.

Future candidates for render support are Babylon.js, PlayCanvas and maybe Google's Filament.

There are still a few quirks that probably will need to be resolved once support for another renderer is added:

  • Playfield light meshes aren't stored as vertices in the VPX file. Currently we use three.js to extrude a 3D mesh out of a path. So unless we can rewrite this to generate vertices the whole light mesh generation is current part of the API and needs to be re-implemented for every framework
  • Idem for the playfield itself, although Handle playfield mesh properly #49 will probably solve that.

@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

Merging #50 into master will increase coverage by 0.4%.
The diff coverage is 91.8%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master     #50     +/-   ##
========================================
+ Coverage    90.2%   90.6%   +0.4%     
========================================
  Files         155     158      +3     
  Lines       10011    9938     -73     
  Branches     1156    1125     -31     
========================================
- Hits         9027    8998     -29     
+ Misses        610     570     -40     
+ Partials      374     370      -4
Impacted Files Coverage Δ
lib/math/matrix3d.ts 97% <ø> (+1.6%) ⬆️
lib/vpt/primitive/primitive.ts 88.9% <ø> (ø) ⬆️
lib/vpt/mesh.ts 91.3% <ø> (+0.7%) ⬆️
lib/vpt/item-state.ts 100% <ø> (+40%) ⬆️
lib/vpt/light/light-data.ts 94.9% <ø> (-2.5%) ⬇️
lib/util/object-pool.ts 97% <ø> (+54.5%) ⬆️
lib/gltf/image.node.ts 64.5% <ø> (-2.6%) ⬇️
lib/vpt/rubber/rubber.ts 95.3% <ø> (ø) ⬆️
lib/vpt/item-data.ts 95.2% <ø> (ø) ⬆️
lib/vpt/light/light-mesh-generator.ts 100% <ø> (+2.1%) ⬆️
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f1578d...2241a4b. Read the comment docs.

@freezy freezy merged commit 2fe1462 into master Sep 10, 2019
@freezy freezy deleted the feature/render-api branch September 10, 2019 19:54
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.

1 participant