Skip to content

Commit

Permalink
Close #88
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjglgamedev committed Jun 15, 2024
1 parent 80b2554 commit 401345c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bookcontents/chapter-08/chapter-08.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class ModelLoader {
}
```

We get the the texture associated to the diffuse color of the material by calling the `aiGetMaterialTexture` function. This function receives as a parameter an instance of an `AIString` that will be used to return the texture path. If the path is present (if it is not null or empty) we insert the path where the textures for this model will reside. Many models use absolute paths, which probably won't fit with the path were you store the model. This is the reason why get just the file name, without the possible path (either absolute or relative)that could be used in the model. Once we have got the texture path, we retrieve the material diffuse color by calling the `aiGetMaterialColor` function. All that information is stored in an instance of the `ModelData.Material` class. The constructed instance is appended to the list passed as a parameter that will contain all the materials of the model. The `ModelData` needs to be modified to include the definition of the `ModelData.Material` class and to hold the data for the associated materials:
First we retrieve the material diffuse color by calling the `aiGetMaterialColor` function. After that we get the the texture associated to the diffuse color of the material by calling the `aiGetMaterialTexture` function. This function receives as a parameter an instance of an `AIString` that will be used to return the texture path. If the path is present (if it is not null or empty) we insert the path where the textures for this model will reside. Many models use absolute paths, which probably won't fit with the path were you store the model. This is the reason why get just the file name, without the possible path (either absolute or relative)that could be used in the model. If we can find a texture we just set the diffuse color to black (in next chapter, in the shader we will combine these two values, if we have a texture and diffuse color is black, we will end up using just the texture color. If we do not have a texture, we will combine diffuse color with a default texture, which is just black, and we will end up using just diffuse color). All that information is stored in an instance of the `ModelData.Material` class. The constructed instance is appended to the list passed as a parameter that will contain all the materials of the model. The `ModelData` needs to be modified to include the definition of the `ModelData.Material` class and to hold the data for the associated materials:

```java
public class ModelData {
Expand Down

0 comments on commit 401345c

Please sign in to comment.