Skip to content

Commit

Permalink
Fix Model typings. Add Shadow Caster Exclude list. Release 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzinn committed Feb 4, 2020
1 parent 191b1a0 commit 310bb1d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class WithVR extends React.Component
/>
...
<vrExperienceHelper createDeviceOrientationCamera={false} teleportEnvironmentGround={true} />
<environmentHelper enableGroundShadow= {true} groundYBias={1} mainColor={Color3.FromHexString("#74b9ff")} />
<environmentHelper enableGroundShadow= {true} groundYBias={1}} />
</Scene>
</Engine>
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-babylonjs",
"version": "2.0.2",
"version": "2.0.3",
"description": "React for BabylonJS",
"homepage": "https://brianzinn.github.io/react-babylonjs/",
"keywords": [
Expand Down
4 changes: 4 additions & 0 deletions src/CreatedInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export type CustomProps = {
* List of mesh names to search for, which will be added as shadow casters.
*/
shadowCasters?: string[]
/**
* List of mesh names to exclude from casting shadows (all other meshes by name will cast shadows)
*/
shadowCastersExcluding?: string[]
/**
* For attaching the same material multiple meshes (by mesh name)
*/
Expand Down
1 change: 1 addition & 0 deletions src/customComponents/EnvironmentHelperLifecycleListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class EnvironmentHelperLifecycleListener implements LifecycleList
return;
}

// for TypeScript people use <... setMainColor={[mainColor]} />
if (this.props.mainColor) {
instance.hostInstance.setMainColor(this.props.mainColor)
}
Expand Down
1 change: 0 additions & 1 deletion src/customHosts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
export { default as HostWithEventsFiber } from "./hostWithEventsFiber"

export const HostWithEvents: string = "HostWithEvents"
export const Model: string = "Model"
2 changes: 1 addition & 1 deletion src/model/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { LoaderStatus, LoadedModel } from "./Model"
export { FiberModel, ModelPropsHandler } from "./ModelProps"
export { ModelProps, FiberModel, ModelPropsHandler } from "./ModelProps"
2 changes: 1 addition & 1 deletion src/react-babylonjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from "./customComponents" // TODO: Except for Skybox - these should not
export { default as Engine, withBabylonJS, BabylonJSContext, useBabylonEngine, useBabylonCanvas } from "./Engine"
export { default as Scene, withScene, WithSceneContext, SceneContext, SceneEventArgs, useBabylonScene } from "./Scene"

export { HostWithEvents, Model } from "./customHosts"
export { HostWithEvents } from "./customHosts"
4 changes: 2 additions & 2 deletions stories/babylonjs/2-withVR/withVr.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class WithVR extends Component {
radius={2} minZ={0.001} wheelPrecision={50} />

<directionalLight name='dl' direction={new Vector3(0, -0.5, 0.5)} position={new Vector3(0, 2, 0.5)}>
<shadowGenerator mapSize={1024} useBlurExponentialShadowMap blurKernel={32} shadowCasters={['counterClockwise', 'clockwise', 'BoomBox']} />
<shadowGenerator mapSize={1024} useBlurExponentialShadowMap blurKernel={32} shadowCastersExcluding={['gazeTracker', 'BackgroundHelper', 'BackgroundPlane', 'BackgroundSkybox']} />
</directionalLight>

<icoSphere name='counterClockwise' position={new Vector3(-0.5, 1, 0)} radius={0.2} flat subdivisions={1}>
Expand All @@ -79,7 +79,7 @@ export class WithVR extends Component {
<SingleAxisRotateMeshBehavior rpm={4} axis={Axis.Y} />
</icoSphere>
<vrExperienceHelper webVROptions={{ createDeviceOrientationCamera: false }} teleportEnvironmentGround enableInteractions />
<environmentHelper options={{ enableGroundShadow: true /* true by default */, groundYBias: 1 }} mainColor={Color3.FromHexString('#74b9ff')} />
<environmentHelper options={{ enableGroundShadow: true /* true by default */, groundYBias: 1 }} setMainColor={[Color3.FromHexString('#74b9ff')]} />
</Scene>
</Engine>
)
Expand Down
2 changes: 1 addition & 1 deletion stories/babylonjs/ScaledModelWithProgress.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'

import { withScene, Model } from '../../dist/react-babylonjs.es5'
import { withScene } from '../../dist/react-babylonjs.es5'
import { Vector3, Matrix, Color3 } from '@babylonjs/core/Maths/math'

// try with later versions of RHL to get hooks working here:
Expand Down

0 comments on commit 310bb1d

Please sign in to comment.