Skip to content

Commit

Permalink
add support for PostProcessRenderPipeline and Image PostProcess. #124
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzinn committed Mar 8, 2021
1 parent bc13efe commit c5f2774
Show file tree
Hide file tree
Showing 9 changed files with 9,341 additions and 31 deletions.
10 changes: 8 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you want to declaratively use something not listed here create an issue :) S
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)
> 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

Expand All @@ -30,7 +30,13 @@ If you want to declaratively use something not listed here create an issue :) S

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

9. **Others** - adtForMesh, adtFullScreenUi, environmentHelper, physicsImpostor, pointsCloudSystem, shadowGenerator, cascadedShadowGenerator, vrExperienceHelper
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. **Others** - adtForMesh, adtFullScreenUi, environmentHelper, physicsImpostor, pointsCloudSystem, shadowGenerator, cascadedShadowGenerator, vrExperienceHelper

## @babylonjs/gui
1. GUI3DManager
Expand Down
10 changes: 8 additions & 2 deletions src/ReactBabylonJSHostConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,14 @@ const ReactBabylonJSHostConfig: HostConfig<
appendChildToContainer: (container: Container, child: HostCreatedInstance<any>): void => {
if (child) {
// doubly link child to root
container.rootInstance.children.push(child)
child.parent = container.rootInstance
container.rootInstance.children.push(child);
child.parent = container.rootInstance;

// hostInstance is undefined when using "assignFrom".
if (child.hostInstance === undefined && child.lifecycleListener) {
// From perspective of declarative syntax the "Scene" is the parent.
child.lifecycleListener!.onParented(container.rootInstance, child);
}
}
},

Expand Down
10 changes: 8 additions & 2 deletions src/customHosts/BaseLifecycleListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ export default abstract class BaseLifecycleListener<T, U> implements LifecycleLi

onParented(parent: CreatedInstance<any>, child: CreatedInstance<any>): void {
if (child.customProps.assignFrom !== undefined) {
if (parent.hostInstance[child.customProps.assignFrom] === undefined) {
// when mounted to the root container the parent is considered the "Scene". Needed for ie: scene.imageProcessingConfiguration property.
const parentHostInstance = parent.metadata.className === 'root'
? this.scene
: parent.hostInstance;

if (parentHostInstance[child.customProps.assignFrom] === undefined) {
console.error(`Cannot find existing property ${child.customProps.assignFrom} on parent component (check your 'assignFrom')`)
} else {
// TODO: should we try to verify types like we do in 'fromInstance'?
child.hostInstance = parent.hostInstance[child.customProps.assignFrom];
child.hostInstance = parentHostInstance[child.customProps.assignFrom];

if (child.deferredCreationProps && child.propsHandlers) {
applyInitialPropsToCreatedInstance(child, child.deferredCreationProps);
} else {
Expand Down
Loading

0 comments on commit c5f2774

Please sign in to comment.