Skip to content

Commit

Permalink
Prettier fix (#190)
Browse files Browse the repository at this point in the history
* config
* format fixes
  • Loading branch information
benallfree authored Jan 13, 2022
1 parent 6eb0851 commit a7508fd
Show file tree
Hide file tree
Showing 140 changed files with 33,965 additions and 24,497 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"scripts": {
"lint": "yarn workspaces run lint",
"lint:fix": "yarn workspaces run lint:fix",
"prepare": "husky install"
},
"devDependencies": {
Expand Down
13 changes: 3 additions & 10 deletions packages/react-babylonjs/.grenrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
"dataSource": "commits",
"prefix": "",
"includeMessages": "all",
"ignoreCommitsWith": [
"release.yml",
":package:"
],
"ignoreTagsWith": [
"beta",
"v2.2.15",
"v3.0.1-rc.1"
],
"ignoreCommitsWith": ["release.yml", ":package:"],
"ignoreTagsWith": ["beta", "v2.2.15", "v3.0.1-rc.1"],
"changelogFilename": "docs/CHANGELOG.md"
}
}
10 changes: 3 additions & 7 deletions packages/react-babylonjs/.nycrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"all": true,
"include": [
"src/**/*"
],
"exclude": [
"src/extensions/**/*"
]
}
"include": ["src/**/*"],
"exclude": ["src/extensions/**/*"]
}
225 changes: 170 additions & 55 deletions packages/react-babylonjs/README.md

Large diffs are not rendered by default.

185 changes: 143 additions & 42 deletions packages/react-babylonjs/docs/api.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,189 @@
# Hooks API
The hooks are useful to get access to scene or engine object or get access to render loop or hover/click on meshes, etc. The hooks for SceneLoader and AssetManager require that the component using them be enclosed in `Suspense`.

*(This is just generated for now and needs cleanup + examples)*
The hooks are useful to get access to scene or engine object or get access to
render loop or hover/click on meshes, etc. The hooks for SceneLoader and
AssetManager require that the component using them be enclosed in `Suspense`.

_(This is just generated for now and needs cleanup + examples)_

[Hooks API documentation](hooks/modules.md)

# Code generated API
Due to using code generation from the Babylon typings, all of these declarative elements will adhere to the same API (See CustomProps below for exceptions) as you find on [Babylon.js documentation site](https://doc.babylonjs.com/):

If you want to declaratively use something not listed here create an issue :) Some extensions have been added to allow for declarative scene creation (ie: Shadows, Textures, etc.)

# @babylonjs/core API Support
1. **Node -> Mesh** - abstractMesh, groundMesh, instancedLinesMesh, instancedMesh, linesMesh, mesh, node, transformNode, trailMesh

2. **Cameras** - anaglyphArcRotateCamera, anaglyphFreeCamera, anaglyphGamepadCamera, anaglyphUniversalCamera, arcFollowCamera, arcRotateCamera, camera, deviceOrientationCamera, flyCamera, followCamera, freeCamera, gamepadCamera, stereoscopicArcRotateCamera, stereoscopicFreeCamera, stereoscopicGamepadCamera, stereoscopicUniversalCamera, targetCamera, touchCamera, universalCamera, virtualJoysticksCamera, vrDeviceOrientationArcRotateCamera, vrDeviceOrientationFreeCamera, vrDeviceOrientationGamepadCamera, webVrFreeCamera, webXrCamera

3. **Geometries (meshes)** - box, capsule, cylinder, dashedLines, decal, disc, extrudePolygon, extrudeShape, extrudeShapeCustom, ground, groundFromHeightMap, icoSphere, lathe, lines, lineSystem, plane, babylon-polygon/Polygon, polyhedron, ribbon, sphere, tiledBox, tiledGround, tiledPlane, torus, torusKnot, tube
> note: `babylon-polygon` instead of `polygon` due to JSX conflict with `React.SVGProps<SVGPolygonElement>`

4. **Materials** - backgroundMaterial, fluentMaterial, material, multiMaterial, nodeMaterial, pbrBaseMaterial, pbrBaseSimpleMaterial, pbrMaterial, pbrMetallicRoughnessMaterial, pbrSpecularGlossinessMaterial, pushMaterial, shaderMaterial, standardMaterial
Due to using code generation from the Babylon typings, all of these declarative
elements will adhere to the same API (See CustomProps below for exceptions) as
you find on [Babylon.js documentation site](https://doc.babylonjs.com/):

> note: Materials can have configuration (read-only) properties as classes. With `assignFrom` prop you can declare detailMapConfiguration, pbrClearCoatConfiguration, pbrAnisotropicConfiguration, pbrbrdfConfiguration, pbrSheenConfiguration, pbrSubSurfaceConfiguration to attach to declaratively. PBRBaseMaterial has all, while StandardMaterial has only detailMapConfiguration. (prePassConfiguration has no updateable properties, but can be attached).
If you want to declaratively use something not listed here create an issue :)
Some extensions have been added to allow for declarative scene creation (ie:
Shadows, Textures, etc.)

5. **Lights** - directionalLight, hemisphericLight, light, pointLight, shadowLight, spotLight
# @babylonjs/core API Support

6. **Textures** - advancedDynamicTexture, baseTexture, colorGradingTexture, cubeTexture, customProceduralTexture, dynamicTexture, equiRectangularCubeTexture, hdrCubeTexture, htmlElementTexture, mirrorTexture, multiRenderTarget, multiviewRenderTarget, noiseProceduralTexture, proceduralTexture, rawCubeTexture, rawTexture, rawTexture2DArray, rawTexture3D, refractionTexture, renderTargetTexture, texture, thinTexture, videoTexture
1. **Node -> Mesh** - abstractMesh, groundMesh, instancedLinesMesh,
instancedMesh, linesMesh, mesh, node, transformNode, trailMesh

2. **Cameras** - anaglyphArcRotateCamera, anaglyphFreeCamera,
anaglyphGamepadCamera, anaglyphUniversalCamera, arcFollowCamera,
arcRotateCamera, camera, deviceOrientationCamera, flyCamera, followCamera,
freeCamera, gamepadCamera, stereoscopicArcRotateCamera,
stereoscopicFreeCamera, stereoscopicGamepadCamera,
stereoscopicUniversalCamera, targetCamera, touchCamera, universalCamera,
virtualJoysticksCamera, vrDeviceOrientationArcRotateCamera,
vrDeviceOrientationFreeCamera, vrDeviceOrientationGamepadCamera,
webVrFreeCamera, webXrCamera

3. **Geometries (meshes)** - box, capsule, cylinder, dashedLines, decal, disc,
extrudePolygon, extrudeShape, extrudeShapeCustom, ground,
groundFromHeightMap, icoSphere, lathe, lines, lineSystem, plane,
babylon-polygon/Polygon, polyhedron, ribbon, sphere, tiledBox, tiledGround,
tiledPlane, torus, torusKnot, tube

> note: `babylon-polygon` instead of `polygon` due to JSX conflict with
> `React.SVGProps<SVGPolygonElement>`
4. **Materials** - backgroundMaterial, fluentMaterial, material, multiMaterial,
nodeMaterial, pbrBaseMaterial, pbrBaseSimpleMaterial, pbrMaterial,
pbrMetallicRoughnessMaterial, pbrSpecularGlossinessMaterial, pushMaterial,
shaderMaterial, standardMaterial

> note: Materials can have configuration (read-only) properties as classes. With
> `assignFrom` prop you can declare detailMapConfiguration,
> pbrClearCoatConfiguration, pbrAnisotropicConfiguration, pbrbrdfConfiguration,
> pbrSheenConfiguration, pbrSubSurfaceConfiguration to attach to declaratively.
> PBRBaseMaterial has all, while StandardMaterial has only
> detailMapConfiguration. (prePassConfiguration has no updateable properties,
> but can be attached).
5. **Lights** - directionalLight, hemisphericLight, light, pointLight,
shadowLight, spotLight

6. **Textures** - advancedDynamicTexture, baseTexture, colorGradingTexture,
cubeTexture, customProceduralTexture, dynamicTexture,
equiRectangularCubeTexture, hdrCubeTexture, htmlElementTexture,
mirrorTexture, multiRenderTarget, multiviewRenderTarget,
noiseProceduralTexture, proceduralTexture, rawCubeTexture, rawTexture,
rawTexture2DArray, rawTexture3D, refractionTexture, renderTargetTexture,
texture, thinTexture, videoTexture

7. **EffectLayers** - effectLayer, glowLayer, highlightLayer

8. **Behaviors** - autoRotationBehavior, bouncingBehavior, framingBehavior, attachToBoxBehavior, fadeInOutBehavior, multiPointerScaleBehavior, pointerDragBehavior, sixDofDragBehavior

9. **PostProcessRenderPipelines**: defaultRenderingPipeline, lensRenderingPipeline, postProcessRenderPipeline, ssao2RenderingPipeline, ssaoRenderingPipeline, standardRenderingPipeline

10. **PostProcesss** anaglyphPostProcess, blackAndWhitePostProcess, bloomMergePostProcess, blurPostProcess, chromaticAberrationPostProcess, circleOfConfusionPostProcess, colorCorrectionPostProcess, convolutionPostProcess, depthOfFieldBlurPostProcess, depthOfFieldMergePostProcess, displayPassPostProcess, extractHighlightsPostProcess, filterPostProcess, fxaaPostProcess, grainPostProcess, highlightsPostProcess, imageProcessingPostProcess, motionBlurPostProcess, passCubePostProcess, passPostProcess, postProcess, refractionPostProcess, screenSpaceCurvaturePostProcess, screenSpaceReflectionPostProcess, sharpenPostProcess, stereoscopicInterlacePostProcess, stereoscopicInterlacePostProcessI, subSurfaceScatteringPostProcess, tonemapPostProcess, volumetricLightScatteringPostProcess, vrDistortionCorrectionPostProcess, vrMultiviewToSingleviewPostProcess
> note: for `PostProcess` (and `PostProcessRenderPipeline`) the `ImageProcessingConfiguration` and `PrePassConfiguration` properties can be declared with `assignFrom`.
11. **Gizmo** axisDragGizmo, axisScaleGizmo, boundingBoxGizmo, cameraGizmo, gizmo, lightGizmo, planeDragGizmo, planeRotationGizmo, positionGizmo, rotationGizmo, scaleGizmo

12. **Others** - adtForMesh, adtForMeshTexture, adtFullScreenUi, environmentHelper, physicsImpostor, pointsCloudSystem, shadowGenerator / cascadedShadowGenerator, layer, utilityLayerRenderer, viewport, vrExperienceHelper
8. **Behaviors** - autoRotationBehavior, bouncingBehavior, framingBehavior,
attachToBoxBehavior, fadeInOutBehavior, multiPointerScaleBehavior,
pointerDragBehavior, sixDofDragBehavior

9. **PostProcessRenderPipelines**: defaultRenderingPipeline,
lensRenderingPipeline, postProcessRenderPipeline, ssao2RenderingPipeline,
ssaoRenderingPipeline, standardRenderingPipeline

10. **PostProcesss** anaglyphPostProcess, blackAndWhitePostProcess,
bloomMergePostProcess, blurPostProcess, chromaticAberrationPostProcess,
circleOfConfusionPostProcess, colorCorrectionPostProcess,
convolutionPostProcess, depthOfFieldBlurPostProcess,
depthOfFieldMergePostProcess, displayPassPostProcess,
extractHighlightsPostProcess, filterPostProcess, fxaaPostProcess,
grainPostProcess, highlightsPostProcess, imageProcessingPostProcess,
motionBlurPostProcess, passCubePostProcess, passPostProcess, postProcess,
refractionPostProcess, screenSpaceCurvaturePostProcess,
screenSpaceReflectionPostProcess, sharpenPostProcess,
stereoscopicInterlacePostProcess, stereoscopicInterlacePostProcessI,
subSurfaceScatteringPostProcess, tonemapPostProcess,
volumetricLightScatteringPostProcess, vrDistortionCorrectionPostProcess,
vrMultiviewToSingleviewPostProcess

> note: for `PostProcess` (and `PostProcessRenderPipeline`) the
> `ImageProcessingConfiguration` and `PrePassConfiguration` properties can
> be declared with `assignFrom`.
11. **Gizmo** axisDragGizmo, axisScaleGizmo, boundingBoxGizmo, cameraGizmo,
gizmo, lightGizmo, planeDragGizmo, planeRotationGizmo, positionGizmo,
rotationGizmo, scaleGizmo

12. **Others** - adtForMesh, adtForMeshTexture, adtFullScreenUi,
environmentHelper, physicsImpostor, pointsCloudSystem, shadowGenerator /
cascadedShadowGenerator, layer, utilityLayerRenderer, viewport,
vrExperienceHelper

## @babylonjs/gui

1. GUI3DManager
2. **2D Controls** - scrollViewerWindow, baseSlider, babylon-button/Button, checkbox, colorPicker, container, control, displayGrid, babylon-ellipse/Ellipse, grid, babylon-image/Image, imageBasedSlider, imageScrollBar, inputPassword, inputText, babylon-line/Line, multiLine, radioButton, rectangle, scrollBar, scrollViewer, selectionPanel, slider, stackPanel, textBlock, virtualKeyboard
> note: 'babylon-*' for `button`, `ellipse`, `image` & `line` due to JSX conflict with `React.SVGProps<T>`, otherwise use the ProperCase equivalent, but you miss editor auto-completion.
2. **2D Controls** - scrollViewerWindow, baseSlider, babylon-button/Button,
checkbox, colorPicker, container, control, displayGrid,
babylon-ellipse/Ellipse, grid, babylon-image/Image, imageBasedSlider,
imageScrollBar, inputPassword, inputText, babylon-line/Line, multiLine,
radioButton, rectangle, scrollBar, scrollViewer, selectionPanel, slider,
stackPanel, textBlock, virtualKeyboard

3. **3D Controls** - abstractButton3D, button3D, container3D, control3D, cylinderPanel, holographicButton, meshButton3D, planePanel, scatterPanel, spherePanel, stackPanel3D, volumeBasedPanel
> note: 'babylon-\*' for `button`, `ellipse`, `image` & `line` due to JSX
> conflict with `React.SVGProps<T>`, otherwise use the ProperCase equivalent,
> but you miss editor auto-completion.
3. **3D Controls** - abstractButton3D, button3D, container3D, control3D,
cylinderPanel, holographicButton, meshButton3D, planePanel, scatterPanel,
spherePanel, stackPanel3D, volumeBasedPanel

## Extensions (new in 2.0)

1. dynamicTerrain

# Custom Props
To be able to allow more declarative capabilities there are additional props that are not on the default babylonjs object. Other than these properties the React host elements follow the babylon API docs. These are all optional.

To be able to allow more declarative capabilities there are additional props
that are not on the default babylonjs object. Other than these properties the
React host elements follow the babylon API docs. These are all optional.

## Props available to all host elements
1. `assignTo` - Assign to this property on the parent. Parent property is cleared on umnount (ie: texture can be assigned to bump/diffuse/etc.)
2. `assignFrom` - Assigned from a parent property and then participates with props (ie: PBR configurations or PostProcess properties like grain)
3. `fromInstance` - Attach an instance you create (or want re-used) and the renderer will use that instance instead.
4. `disposeInstanceOnUnmount` - Applicable only when using `fromInstance`. Defaults to `false`, but you can set to true for automatic cleanup.

1. `assignTo` - Assign to this property on the parent. Parent property is
cleared on umnount (ie: texture can be assigned to bump/diffuse/etc.)
2. `assignFrom` - Assigned from a parent property and then participates with
props (ie: PBR configurations or PostProcess properties like grain)
3. `fromInstance` - Attach an instance you create (or want re-used) and the
renderer will use that instance instead.
4. `disposeInstanceOnUnmount` - Applicable only when using `fromInstance`.
Defaults to `false`, but you can set to true for automatic cleanup.

### AdvancedDynamicTexture
1. `createForParentMesh` - Same as factory method for attaching an ADT to a plane and then the child components are 2D controls.

1. `createForParentMesh` - Same as factory method for attaching an ADT to a
plane and then the child components are 2D controls.

### Control3D

1. `childrenAsContent` - for 3D control ".content" (which is 2D)
2. `linkToTransformNodeByName` -for Control3D, which has position, but not other properties like rotation
2. `linkToTransformNodeByName` -for Control3D, which has position, but not other
properties like rotation
3. `onControlAdded` - callback when control is added.

### GlowLayer
1. `addIncludeOnlyChildren` - Adds all child nodes to the glow layer (and nothing else).

1. `addIncludeOnlyChildren` - Adds all child nodes to the glow layer (and
nothing else).

### Material
1. `attachToMeshesByName` - For attaching the same material to multiple meshes (by mesh name)

1. `attachToMeshesByName` - For attaching the same material to multiple meshes
(by mesh name)

### Meshes
1. `childMeshesNotTracked` - Useful if you attach children to a mesh and want the child meshes to participate in GlowLayer or ShadowGenerator (see props below).

1. `childMeshesNotTracked` - Useful if you attach children to a mesh and want
the child meshes to participate in GlowLayer or ShadowGenerator (see props
below).

### ShadowGenerator
1. `shadowCasters` - string array of mesh names to search for, which will be added as shadow casters.
2. `shadowCastersExcluding` - string array of mesh names to exclude from casting shadows (all other meshes by name will cast shadows)

1. `shadowCasters` - string array of mesh names to search for, which will be
added as shadow casters.
2. `shadowCastersExcluding` - string array of mesh names to exclude from casting
shadows (all other meshes by name will cast shadows)
3. `shadowCastChildren` - adds all child nodes as shadow casters.

### Virtual Keyboard

1. `connectControlNames` - 2d input control names
2. `defaultKeyboard` - Use default keyboard

### VRExperienceHelper

1. `enableInteractions` - call `enableInteractions()`.
31 changes: 24 additions & 7 deletions packages/react-babylonjs/docs/breaking-changes-0.x-to-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

> 'react-babylonjs' < 1.0.0 was experimental
There is so much new in 1.0.0. Most of the breaking changes will be because all naming matches BabylonJS API. This is good for consistency and makes using and transitioning to this library easier.
There is so much new in 1.0.0. Most of the breaking changes will be because all
naming matches BabylonJS API. This is good for consistency and makes using and
transitioning to this library easier.

The experimental builds had just enough subset of BabylonJS API to demonstrate a proof of concept. With v1.0.0 code generation is used to create a much larger API coverage of not only the types (ie: Cameras, Materials, Controls, etc.), but also factory methods (ie: Meshbuilder.createXX()), most of the properties and even some methods (ie: overservable, setTarget, etc.). Due to BabylonJS rarely making breaking changes this was a good way to go.
The experimental builds had just enough subset of BabylonJS API to demonstrate a
proof of concept. With v1.0.0 code generation is used to create a much larger
API coverage of not only the types (ie: Cameras, Materials, Controls, etc.), but
also factory methods (ie: Meshbuilder.createXX()), most of the properties and
even some methods (ie: overservable, setTarget, etc.). Due to BabylonJS rarely
making breaking changes this was a good way to go.

If moving to 1.0.0 from the experimental builds the biggest change is that you will need to import an Engine and it will be the parent of Scene. If you used custom engine properties then they move as well.
If moving to 1.0.0 from the experimental builds the biggest change is that you
will need to import an Engine and it will be the parent of Scene. If you used
custom engine properties then they move as well.

**BEFORE:**

```jsx
import { Scene } from 'react-babylonjs
...
Expand All @@ -18,6 +28,7 @@ import { Scene } from 'react-babylonjs
```
**AFTER:** Now needs to be
```jsx
import { Engine, Scene } from 'react-babylonjs

Expand All @@ -28,10 +39,16 @@ import { Engine, Scene } from 'react-babylonjs
</Scene>
</Engine>
```
** although multiple-scenes aren't supported yet. This change helps make that possible.

`VRExperience` renamed to `VRExperienceHelper`. Matching names with BabylonJS is more consistent.
\*\* although multiple-scenes aren't supported yet. This change helps make that
possible.

`VRExperience` renamed to `VRExperienceHelper`. Matching names with BabylonJS is
more consistent.

`Button.onPointerDown` has become `onPointerDownObservable`. In fact, all observables and 'on' events were added to v1 thanks to the code-generation that was added.
`Button.onPointerDown` has become `onPointerDownObservable`. In fact, all
observables and 'on' events were added to v1 thanks to the code-generation that
was added.

If you find something else that changed for the migration, please add a PR or create an issue. Thanks.
If you find something else that changed for the migration, please add a PR or
create an issue. Thanks.
Loading

0 comments on commit a7508fd

Please sign in to comment.