Skip to content

Commit a7538f4

Browse files
committed
refactor: rename defaultCamera/defaultRaycaster canvas props to camera/raycaster
1 parent e8312ac commit a7538f4

33 files changed

Lines changed: 58 additions & 58 deletions

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ The `Canvas` component initializes the `three.js` rendering context and acts as
100100

101101
**Props:**
102102

103-
- **defaultCamera**: Configures the camera used in the scene. Can be partial props for a camera or an existing Camera instance.
103+
- **camera**: Configures the camera used in the scene. Can be partial props for a camera or an existing Camera instance.
104104
- **fallback**: Element to render while the main content is loading asynchronously.
105105
- **gl**: Defines options for the WebGLRenderer, a function returning a customized renderer, or an existing renderer instance.
106106
- **scene**: Provides custom settings for the Scene instance or an existing Scene.
107-
- **defaultRaycaster**: Configures the Raycaster for mouse and pointer events.
107+
- **raycaster**: Configures the Raycaster for mouse and pointer events.
108108
- **shadows**: Enables and configures shadows in the scene with various shadow mapping techniques.
109109
- **orthographic**: Toggles between Orthographic and Perspective camera for the default camera.
110110
- **linear**: Toggles linear interpolation for texture filtering.
@@ -122,11 +122,11 @@ The `Canvas` component initializes the `three.js` rendering context and acts as
122122

123123
```tsx
124124
interface CanvasProps {
125-
defaultCamera?: Partial<PerspectiveCamera | OrthographicCamera> | Camera
125+
camera?: Partial<PerspectiveCamera | OrthographicCamera> | Camera
126126
fallback?: JSX.Element
127127
gl?: Partial<WebGLRenderer> | ((canvas: HTMLCanvasElement) => WebGLRenderer) | WebGLRenderer
128128
scene?: Partial<Scene> | Scene
129-
defaultRaycaster?: Partial<Raycaster> | Raycaster
129+
raycaster?: Partial<Raycaster> | Raycaster
130130
shadows?: boolean | "basic" | "percentage" | "soft" | "variance" | WebGLRenderer["shadowMap"]
131131
orthographic?: boolean
132132
linear?: boolean
@@ -413,7 +413,7 @@ Provides access to the `three.js` context, including the renderer, scene, camera
413413
`solid-three` implements a stack-based system for managing its current camera and raycaster:
414414
415415
- **Stack-based Management**: Both cameras and raycasters are managed as stacks internally
416-
- **Default at Tail**: The `defaultCamera` and `defaultRaycaster` from Canvas props form the tail of their respective stacks
416+
- **Default at Tail**: The `camera` and `raycaster` from Canvas props form the tail of their respective stacks
417417
- **Current Active Camera at Head**: The camera/raycaster at the top of the stack is the currently active camera/raycaster
418418
- **Push To The Stack To Become Active**: By calling `setCamera(camera)` and `setRaycaster(raycaster)`, the camera/raycaster is pushed to the stack. This causes it to become the currently active camera/raycaster
419419
- **Pop From The Stack To Deactivate**: `setCamera(camera)` and `setRaycaster(raycaster)` return a cleanup-function to pop the camera/raycaster from the stack. If the camera/raycaster was on top of the stack, the previous camera/raycaster in the stack becomes active again
@@ -745,7 +745,7 @@ const App = () => {
745745
const raycaster = new CursorRaycaster()
746746

747747
// CursorRaycaster is used by default, but you can explicitly set it:
748-
return <Canvas defaultRaycaster={raycaster}>{/* Your scene */}</Canvas>
748+
return <Canvas raycaster={raycaster}>{/* Your scene */}</Canvas>
749749
}
750750
```
751751
@@ -760,7 +760,7 @@ import { CenterRaycaster } from "solid-three"
760760
const App = () => {
761761
const raycaster = new CenterRaycaster()
762762

763-
return <Canvas defaultRaycaster={raycaster}>>{/* Your scene */}</Canvas>
763+
return <Canvas raycaster={raycaster}>>{/* Your scene */}</Canvas>
764764
}
765765
```
766766
@@ -796,7 +796,7 @@ class CustomRaycaster extends Raycaster implements EventRaycaster {
796796
const App = () => {
797797
const raycaster = new CustomRaycaster()
798798

799-
return <Canvas defaultRaycaster={raycaster}>{/* Your scene */}</Canvas>
799+
return <Canvas raycaster={raycaster}>{/* Your scene */}</Canvas>
800800
}
801801
```
802802
@@ -1118,7 +1118,7 @@ const TreePropagation = () => {
11181118
```tsx
11191119
const RayPropagation = () => {
11201120
return (
1121-
<Canvas defaultCamera={{ position: [0, 0, 5] }}>
1121+
<Canvas camera={{ position: [0, 0, 5] }}>
11221122
<T.Mesh
11231123
name="front mesh"
11241124
position={[0, 0, 2]}

playground/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function App() {
150150
path="/"
151151
component={() => (
152152
<Canvas
153-
defaultCamera={{ position: new THREE.Vector3(0, 0, 15) }}
153+
camera={{ position: new THREE.Vector3(0, 0, 15) }}
154154
scene={{ background: [0.1, 0.1, 0.15] }}
155155
class="home-canvas"
156156
>

playground/src/api/autodispose/basic-usage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function () {
3232
</p>
3333
</details>
3434

35-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
35+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
3636
<T.AmbientLight intensity={0.5} />
3737
<T.PointLight position={[10, 10, 10]} intensity={0.8} />
3838

playground/src/api/autodispose/conditional-rendering.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function () {
4242
</p>
4343
</details>
4444

45-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
45+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
4646
<T.AmbientLight intensity={0.5} />
4747
<T.PointLight position={[10, 10, 10]} intensity={0.8} />
4848

playground/src/api/autodispose/shared-resources.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function () {
4646
</section>
4747
</details>
4848

49-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
49+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
5050
<T.AmbientLight intensity={0.5} />
5151
<T.PointLight position={[10, 10, 10]} intensity={0.8} />
5252
<Index each={Array.from({ length: instanceCount() })}>

playground/src/api/canvas/usage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function () {
5858
</details>
5959

6060
<Canvas
61-
defaultCamera={{
61+
camera={{
6262
position: orthographic() ? [5, 5, 5] : [0, 0, 5],
6363
fov: 75,
6464
}}
@@ -70,7 +70,7 @@ export default function () {
7070
background: new THREE.Color(0x202020),
7171
fog: new THREE.Fog(0x202020, 10, 50),
7272
}}
73-
defaultRaycaster={{
73+
raycaster={{
7474
params: {
7575
Mesh: {},
7676
Line: { threshold: 0.1 },

playground/src/api/entity/advanced-props.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
<p>Kebab-case props like position-x automatically map to object.position.x = value.</p>
3030
</details>
3131

32-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
32+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
3333
<Entity from={THREE.AmbientLight} args={[0.4]} />
3434
<Entity from={THREE.PointLight} position={[10, 10, 10]} args={[0xffffff, 0.8]} />
3535

playground/src/api/entity/constructor-usage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
</p>
3030
</details>
3131

32-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
32+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
3333
<Entity from={THREE.AmbientLight} args={[0.5]} />
3434
<Entity from={THREE.PointLight} position={[10, 10, 10]} args={[0xffffff, 0.8]} />
3535

playground/src/api/entity/instance-usage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function () {
3737
</p>
3838
</details>
3939

40-
<Canvas defaultCamera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
40+
<Canvas camera={{ position: [0, 0, 5] }} style={{ width: "100%", height: "100%" }}>
4141
<Entity from={THREE.AmbientLight} args={[0.5]} />
4242
<Entity from={THREE.PointLight} position={[10, 10, 10]} args={[0xffffff, 0.8]} />
4343

playground/src/api/events/click-outside.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function () {
4242
</p>
4343
</details>
4444

45-
<Canvas style={{ width: "100%", height: "100%" }} defaultCamera={{ position: [0, 0, 5] }}>
45+
<Canvas style={{ width: "100%", height: "100%" }} camera={{ position: [0, 0, 5] }}>
4646
<T.AmbientLight intensity={0.5} />
4747
<T.PointLight position={[10, 10, 10]} intensity={0.8} />
4848

0 commit comments

Comments
 (0)