CHAPTER 3 ■ WORKING WITH 2D IMAGES/TEXTURES IN XNA 3.0
236
Makesureyoucallthismethodeachtimethecamera’spositionorrotationchanges,
because the rotations of all your billboards have to be adjusted accordingly! To be safe, you
can call it at the end of the Update method.
Rendering from the Vertex Array
Once you have all vertices containing the correct 3D position and texture coordinate, you can
render them to the screen in the Draw method,asexplainedinrecipe5-1:
//draw billboards
basicEffect.World = Matrix.Identity;
basicEffect.View = quatMousCam.ViewMatrix;
basicEffect.Projection = quatMousCam.ProjectionMatrix;
basicEffect.TextureEnabled = true;
basicEffect.Texture = myTexture;
basicEffect.Begin();
foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) ...