From 273aa3e0ec31a778ca69ce0f85f3a92bf6919ac0 Mon Sep 17 00:00:00 2001 From: daemyung jang Date: Wed, 16 Feb 2022 14:34:17 +0900 Subject: [PATCH] Summerize Chapter 9: The Scene Graph --- 09-scene-graph/README.md | 39 +++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 40 insertions(+) create mode 100644 09-scene-graph/README.md diff --git a/09-scene-graph/README.md b/09-scene-graph/README.md new file mode 100644 index 0000000..7c4550e --- /dev/null +++ b/09-scene-graph/README.md @@ -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)) +} +``` diff --git a/README.md b/README.md index f62a527..28a8cf1 100644 --- a/README.md +++ b/README.md @@ -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