Skip to content

Commit

Permalink
fix: rename "render" to "generate" in outlines (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
vis-prime authored Sep 10, 2023
1 parent 689b7b7 commit 60726e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .storybook/stories/Outlines.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let gui: GUI
let allOutlines: OutlinesType[] = []

const outlinesParams = {
color: '#ffff00',
color: '#ffff00' as THREE.ColorRepresentation,
thickness: 0.1,
}

Expand Down Expand Up @@ -42,7 +42,7 @@ const setupTourMesh = () => {
})
torusMesh.position.set(0, 5, 0)
torusMesh.add(outlines.group)
outlines.render()
outlines.generate()
allOutlines.push(outlines)
return torusMesh
}
Expand All @@ -57,7 +57,7 @@ const setupBox = () => {
allOutlines.push(outlines)
boxMesh.add(outlines.group)
boxMesh.castShadow = true
outlines.render()
outlines.generate()
return boxMesh
}

Expand Down Expand Up @@ -113,7 +113,7 @@ const addOutlineGui = () => {
const params = Object.assign({}, outlinesParams)
const folder = gui.addFolder('O U T L I N E S')
folder.open()
folder.addColor(params, 'color').onChange((color: string) => {
folder.addColor(params, 'color').onChange((color: THREE.ColorRepresentation) => {
allOutlines.forEach((outline) => {
outline.updateProps({ color: new THREE.Color(color) })
})
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ const outlines = Outlines()
const mesh = new THREE.Mesh(geometry, material)
mesh.add(outlines.group)

// must call render() if added
outlines.render()
// must call generate() to create the outline mesh
outlines.generate()

scene.add(mesh)
```
Expand All @@ -463,7 +463,7 @@ Outlines function returns the following
export type OutlinesType = {
group: THREE.Group
updateProps: (props: Partial<OutlinesProps>) => void
render: () => void
generate: () => void
}
```

Expand Down
6 changes: 3 additions & 3 deletions src/core/Outlines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export type OutlinesType = {
group: THREE.Group
updateProps: (props: Partial<OutlinesProps>) => void
/**
* **Note**: Call this method after adding group to mesh.
* **Note**: Call this method to generate the outline mesh
*/
render: () => void
generate: () => void
}

const OutlinesMaterial = shaderMaterial(
Expand Down Expand Up @@ -120,7 +120,7 @@ export function Outlines({
}
updateProps(props)
},
render() {
generate() {
updateMesh(shapeProps.angle)
updateProps(shapeProps)
},
Expand Down

0 comments on commit 60726e1

Please sign in to comment.