# LabA 03 Meshes and Scene Graphs

## Key points

Load mesh models

Draw mesh models

Organise models in a Scene Graph

## Source code

Startup project with Assimp (Vistudio 2022) with updated CMakeLists.txt and the model files

{% file src="<https://3464970502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3JUKGJZ67JX02QZdPhsy%2Fuploads%2FGDSmbITU2651t22OSEIz%2FLab03_start_v_1_1_cmake_updated.zip?alt=media&token=ac060e12-3bab-44eb-ae89-b2c2b91e3cb2>" %}

## CMakeLists.txt Update

{% file src="<https://3464970502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3JUKGJZ67JX02QZdPhsy%2Fuploads%2FGksaCuPyf1tx7hJcHWcM%2FCMakeLists.txt?alt=media&token=4f4780fc-f7ba-4141-a0a3-6fa76bc50f6a>" %}

CMakeLists.txt has been updated to fix the copy dll bug.

Consistent relative path to shaders and models used by Visual Studio and VSCode are now supported.\ <mark style="color:red;">As this update is made after the completion of this lab guide, you need to manually update CMakeLists.txt and revise related code.</mark>

```cpp
// for both VSCode and Visual Studio
initShader( "shaders/colour.vert", "shaders/colour.frag");

//----------------------------------------------------
// Meshes
std::shared_ptr<Mesh> cube = std::make_shared<Mesh>();
cube->init("models/cube.obj", shader.program);


std::shared_ptr<Mesh> teapot = std::make_shared<Mesh>();
teapot->init("models/teapot.obj", shader.program);
```

## Downloads

cube.obj and teapot.obj, please put the models folder in your project folder

{% file src="<https://3464970502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3JUKGJZ67JX02QZdPhsy%2Fuploads%2F6ueCPT7fTP1OJHi1zNyG%2Fmodels.zip?alt=media&token=099fb608-43d9-4dd2-8b8d-29972e02865d>" %}

<figure><img src="https://3464970502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3JUKGJZ67JX02QZdPhsy%2Fuploads%2Fl4MGV1ADHQyALrSAxeQ1%2Fimage.png?alt=media&#x26;token=bfa686a4-2a5f-4dfb-bbdd-56ca94d7108a" alt="" width="483"><figcaption></figcaption></figure>

## Tutorial

Scene graph

{% embed url="<https://learnopengl.com/Guest-Articles/2021/Scene/Scene-Graph>" %}

Loading model with Assimp (optional)

{% embed url="<https://learnopengl.com/Model-Loading/Model>" %}
