bạn có thể sửa đổi những thứ như vị trí của máy ảnh, hướng của máy ảnh, và hướng cho máy ảnh bằng cách đơn giản là thay đổi biến vector thích hợp và sau đó xây dựng lại các ma trận xem của máy ảnh với các vector mới. Để di chuyển và xoay máy ảnh của bạn, bạn sẽ cần phải thêm những điều sau đây | Figure 14-5. Stars make the game look much more realistic What You Just Did Before we get into all of that let s review what you did this chapter You learned about particles and particle systems. You created a custom vertex. You created a particle engine that moves adds and removes particles to create a sphere-shaped explosion. You created an HLSL effect file that sets the size of the vertices and sets the colors based on texture coordinates. You created a starfield background using a modified particle engine that draws particles but doesn t remove them or move them around. 330 Chapter 14 Particle Systems Summary A particle is simply a way of representing a single element within a group of elements that form a particle effect such as an explosion or some magical spell effect. A partcde engine ÍS a mcchanísm thtt manipulrrss adds eemovss and draws particles to make up a particle effect. Often particle engines simulate gravity and other external forces to make particle effects look more realistic. In addition to using vertex types such as VertexPositionColor and VertexPositionTexture you can create your own customized vertex types providing any kind of information you want. To understand your vertex type the graphics card needs a VertexDeclaration specifying what members exist in the vertex type and what data to send to certain semantics in HLSL. Point sprites were introduced in DirectX 8 as a way to allow developers to draw particles or other effects using only one vertex per particle. In HLSL you can specify the size of a vertex using the PSIZE n semantic which will let you create point sprites that vary in size. Anyone who knows XNA and can create sweet particle effects will have more friends than they know what to do with. Test Your Knowledge Quiz 1. If you want to get texture coordinates to your pixel shader what do you have to do in the vertex shader 2. What semantic affects the size of a vertex Where would you assign a value to a variable using that semantic .