Skip to content

Commit

Permalink
Enhance Hello World Documentation and Update Meta Configuration
Browse files Browse the repository at this point in the history
- Added a new 'hello-world' entry in `_meta.global.ts` to improve navigation.
- Refactored the `hello-world.mdx` file to provide a more comprehensive example of rendering a box with a camera, lighting, and shadow catcher.
- Introduced new components such as `EnvAtlasComponent`, `Grid`, and improved camera settings for better visual representation.
  • Loading branch information
marklundin committed Jan 8, 2025
1 parent f373b34 commit 2ce6cbf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/docs/src/app/_meta.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
"Basic" : {
type: 'separator',
},
'hello-world' : '',
'pointer-events' : '',
"Advanced" : {
type: 'separator',
Expand Down
45 changes: 33 additions & 12 deletions packages/docs/src/content/hello-world.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
{/*
This is a live playground.
You can edit the code below and see livve changes, or try some other examples in the menu above.
*/}

<Entity>
<Entity position={[0, 0, 5]}>
<Camera clearColor='red' />
</Entity>
<Entity>
<Render type="box" />
export const HelloWorld = () => {

/**
* Your first pc/react example!
* We're just going to render a box with a camera, some lighting and a shadow catcher
*/

const material = useMaterial({ diffuse: 'gray' })

return <Entity>

<EnvAtlasComponent src='/environment-map.png' intensity={2}/>

{/* Render the background grid */}
<Grid />

{/* Create a camera entity */}
<Entity name='camera' position={[4, 3, 4]}>
<Camera clearColor='#111111' fov={28} />
<OrbitControls inertiaFactor={0.07} distanceMin={6} distanceMax={10} pitchAngleMin={1} pitchAngleMax={90}/>
<AutoRotate />
<StaticPostEffects bloom={{ intensity: 0.02 }} vignette={false} fringing={{ intensity: 3 }}/>
</Entity>

{/* Create the right box entity */}
<Entity position={[0, 0.5, 0]}>
<Render type='box' material={material} />
<ShadowCatcher width={5} depth={5} />
</Entity>

</Entity>
</Entity>
}

<HelloWorld />

0 comments on commit 2ce6cbf

Please sign in to comment.