Summerize Chapter 9: The Scene Graph

This commit is contained in:
daemyung jang 2022-02-16 14:34:17 +09:00
parent de1fc918ab
commit 273aa3e0ec
No known key found for this signature in database
GPG Key ID: 44160C9958A9C67B
2 changed files with 40 additions and 0 deletions

39
09-scene-graph/README.md Normal file
View File

@ -0,0 +1,39 @@
# Chapter 9: The Scene Graph
As I read this book, I summarize what I think is wrong. If you think my comments are wrong then please let me know. We can dicuss more and update your opinion.
## The scene graph
* You can also remove the light when you cleanup your code. In `Scene.swift`, add this:
```
var lighting = Lighting()
```
In `Renderer.swift`, in `func draw(in view: MTKView)`, replace:
```
var lights = lighting.lights
```
With:
```
var lights = scene.lighting.lights
```
* If you remove a camera in 'Renderer', you need to update `override func scrollWheel(with event: NSEvent)` in `ViewControllerExtension.swift`, replace:
```
override func scrollWheel(with event: NSEvent) {
renderer?.camera.zoom(delta: Float(event.deltaY))
}
```
With:
```
override func scrollWheel(with event: NSEvent) {
renderer?.scene?.camera.zoom(delta: Float(event.deltaY))
}
```

View File

@ -23,6 +23,7 @@ You can see color images in this book at [here](https://www.raywenderlich.com/bo
* [Chapter 5: Lighting Fundamentals](https://github.com/daemyung/MetalByTutorials/tree/main/05-lighting-fundamentals)
* [Chapter 6: Textures](https://github.com/daemyung/MetalByTutorials/tree/main/06-textures)
* [Chapter 8: Character Animation](https://github.com/daemyung/MetalByTutorials/tree/main/08-character-animation)
* [Chapter 9: The Scene Graph](https://github.com/daemyung/MetalByTutorials/tree/main/09-scene-graph)
## Copyright