|
1735 | 1735 | Storing Texture Image Data
|
1736 | 1736 | ---------------------------
|
1737 | 1737 | Now we also need to create a texture class that holds an image. I am going to use my favorite image
|
1738 |
| -utility `stb_image`. It reads in an image into a big array of unsigned char. These are just packed |
1739 |
| -RGBs that each range 0..255 for black to fully-on. |
| 1738 | +utility [stb_image][]. It reads in an image into a big array of unsigned char. These are just |
| 1739 | +packed RGBs that each range 0..255 (black to full white). The `image_texture` class uses the |
| 1740 | +resulting image data. |
1740 | 1741 |
|
1741 | 1742 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1742 |
| - #include "texture.h" |
| 1743 | + #include "rtweekend.h" |
1743 | 1744 |
|
1744 | 1745 | class image_texture : public texture {
|
1745 | 1746 | public:
|
|
1776 | 1777 | int nx, ny;
|
1777 | 1778 | };
|
1778 | 1779 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1779 |
| - [Listing [img-texture]: <kbd>[surface_texture.h]</kbd> Image texture class] |
| 1780 | + [Listing [img-texture]: <kbd>[texture.h]</kbd> Image texture class] |
1780 | 1781 |
|
1781 | 1782 | <div class='together'>
|
1782 |
| -The representation of a packed array in that order is pretty standard. Thankfully, the `stb_image` |
1783 |
| -package makes that super simple -- just include the header `rtw_stb_image.h` in `main.h`: |
| 1783 | +The representation of a packed array in that order is pretty standard. Thankfully, the |
| 1784 | +[stb_image][] package makes that super simple -- just include the header `rtw_stb_image.h` (found in |
| 1785 | +the project source code at `src/common/rtw_stb_image.h`) in `main.h`: |
1784 | 1786 |
|
1785 | 1787 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
|
1786 | 1788 | #include "rtw_stb_image.h"
|
|
2966 | 2968 |
|
2967 | 2969 |
|
2968 | 2970 | [acknowledgments]: #acknowledgments
|
2969 |
| -[Limnu]: https://limnu.com/ |
2970 |
| -[Markdeep]: https://casual-effects/markdeep/ |
| 2971 | +[Limnu]: https://limnu.com/ |
| 2972 | +[Markdeep]: https://casual-effects/markdeep/ |
| 2973 | +[stb_image]: https://github.com/nothings/stb |
2971 | 2974 |
|
2972 | 2975 |
|
2973 | 2976 | <!-- Markdeep: https://casual-effects.com/markdeep/ -->
|
|
0 commit comments