Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
docs: add missing code changes to render 2 cubes (#115)
Browse files Browse the repository at this point in the history
In order to render two cubes in the scene it is necessary to add some lines of code to cube.component.html and cube.component.ts that were missing.
  • Loading branch information
fonzane authored May 8, 2022
1 parent 43e257c commit c094683
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions libs/documentations/docs/first-scene.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,43 @@ Good. Now we can update our `app.component.html` to render another cube
</ngt-canvas>
```

</TabItem>

<TabItem value="cubeTs" label="cube.component.ts">

```diff
export class CubeComponent implements OnInit {
+ @Input('position') position? :NgtVector3;
hovered = false;
active = false;

onCubeBeforeRender($event: {state: NgtRenderState, object: Mesh}) {
const cube = $event.object;
cube.rotation.x += 0.01;
cube.rotation.y += 0.005
}
}
```

</TabItem>

<TabItem value="cubeHtml" value="cube.component.html">

```diff
<ngt-mesh
(beforeRender)="onCubeBeforeRender($event)"
(click)="active = !active"
(pointerover)="hovered = true"
(pointerout)="hovered = false"
[scale]="active ? 1.5 : 1"
+ [position]="position">
<ngt-box-geometry></ngt-box-geometry>
<ngt-mesh-basic-material
[color]="hovered ? 'turquoise' : 'tomato'">
</ngt-mesh-basic-material>
</ngt-mesh>
```

</TabItem>

</Tabs>
Expand Down

0 comments on commit c094683

Please sign in to comment.