Adding texture – a gentle introduction to HLSL
We have already specified the texture we want to use for the terrain in the LoadContent()
event, so now we just need to adjust our code to take the texture into account. Since we are not using a BasicEffect
for rendering, we will need to expand the
code in the Terrain.fx
file in order to utilize the texture we pass to the Terrain
class.
While a full discussion of the intricacies of High Level Shader Language (HLSL) is well beyond the scope of this book – entire books can and have been written about writing shaders – we can certainly cover enough of the basics to allow us to generate all of the effects we will need for Tank Battles.
Originally developed by Microsoft and NVIDIA for Direct3D, HLSL is a programming language designed for the creation of shaders. We can work with both vertex shaders, which convert the vertex information for our triangles into pixels to be rendered to the display, and pixel shaders, which describe the characteristics...