CECS 455 Midterm Study Guide Spring 2010 (Revised 3-9-10) Chapter 4 Supplement: DirectX Tutorial 4: 3D Spaces Understand the concepts of object space, world space, view space, and projection space the view frustrum, and clipping. What shape does the view frustrum have in projection space? What are the coordinates of its endpoints? Know how to create the world, view, and projection matrices in XNA. Describe the purpose of each parameter in the CreateLookAt method. Describe the purpose of each parameter in the CreatePerspectiveFieldOfView method. Know how to create vertices for a shape. Create the vertices for a cube of side 2 centered at the origin using a position, normal, and texture. Know how to use the each PrimitiveType -- LineList, LineStrip, PointList TriangleList, TriagleFan, and TriangleStrip. Let v be an array of vertices for a hexagon with v[0] at the top and the vertices in clockwise order. For each part list the array of vertices (no indices) that you could use a. to draw the boundary using a LineList. b. to draw the boundary using a LineStrip. c. to draw the hexagon using a TriangleList. d. to draw the hexagon using a TriangleStrip. e. to draw the hexagon using a TriangleFan. Understand the difference between UserPrimitives and Primitives in XNA. Explain the difference. Describe what additional is needed in XNA when using Primitives instead of UserPrimitives. Know why and how to use indices. Let v be an array of vertices for a hexagon with v[0] at the top and the vertices in clockwise order. For each part list the array of indices that you could use a. to draw the boundary using a LineList. b. to draw the boundary using a LineStrip. c. to draw the hexagon using a TriangleList. d. to draw the hexagon using a TriangleStrip. e. to draw the hexagon using a TriangleFan. Understand how to map a texture to a shape. Know how to create and use an XNA game component. What is the difference between the two types of game components? How to you make a game component available? Describe the coordination of a game component with the main game. Know how to use transformations to position an object in world space. Suppose a cube is facing front in object space and that you want to rotate it to show more than one face and position it in world space. Should you rotate first and then translate or translate first and then rotate? Explain. Using XNA, compute the matrix for the transformation described above. Chapter 5 Know how to create and use an XNA game service. Describe what a game needs to do to use the InputHandler game service. What does the IInputHandler interface contain? Know how to create and use a library in XNA. Describe how to create an XNA library project. Know how to use keyboard and mouse input. What XNA code would you use to determine if the left arrow key was pressed? What XNA code would you use to determine if the left mouse button was pressed? Understand how the InputHandler service works. (See also Chapter 7) What operations does the InputHandler service provide? How can you use the InputHandler service to respond to a mouse press only once when the user presses it rather than many times because update is called 60 times per second? In the Chapter 5 version of InputHandler the IInputHandler interface exposes a KeyboardState property of type KeyboardState, while in the Chater 7 version the type of the KeyboardState property is KeyboardHandler. Explain carefully the reason for the change and how the new version would be used in getting keyboard input. How could you revise the InputHandler service to expose a method WasMousePressed that would only be called once per user press. (See Chapter 7 for how it is done for the keyboard.) Know how to create a stationary camera and a first-person camera. What does the camera reference represent? How do we change it when we want the camera to look in a different direction? What does the camera target represent? How do we change it when we want the camera to look in a different direction? What does the camera position represent? How do we change it when we want the camera to move. Describe carefully all quantities used and how they are determined? Chapter 6 Supplement: Models, Meshes, Parts, and Bones Supplement: Simple Animation Sample (available from creators.xna.com) Understand the concepts of Model, ModelMesh, ModelMeshPart, ModelBone. What does a ModelMesh represent?, a ModelMeshPart?, a ModelBone? Know how to draw a model in XNA. Describe how to use the ModelBone associated with a ModeMesh to make sure that the mesh is drawn in the correct position. Explain (no code) how the simple animation changes the ModelBones so that the ModelMeshes are animated. Explain (no code) how the ModelMesh.Effects property is a shortcut. Understand how to use a texture referenced in a model and a texture that isn't. What additional do you need to do when drawing a model if you want to replace the texture included with the model? Chapter 9 Additive Blending: SourceBlend and DestinationBlend both Blend.One. Understand the sprite blend modes. Given source color (.3, .3, .3, .6) and destination color (.2,.2, .2, 1.0) find the resulting color using a. alpha blending b. additive blending c. no blending When might you use additive blending? Understand the sprite sort modes. Define each of the five modes. When might you use BackToFront? What can you do only in Immediate mode? Know how to add a font to an XNA project. Describe how to add a font to a project. Chapter 10 Know how to animate sprites in XNA. Describe carefully (no code) what the Update method has to do to perform an animation. Describe carefully (no code) what the Draw method needs to do to determine the correct part of an animation sheet to use. Suppose that the animation may use only a range, and not all images on the sheet. Understand how to rotate and scale sprites in XNA. Describe how to rotate and/or scale a sprite using XNA. Understand how to use various source blend and destination blend choices and what the resulting colors will be. Given source color (.3, .3, .3, .6) and destination color (.2,.2, .2, 1.0) find the final color if a. SourceBlend is Blend.DestinationColor DestinationBlend is Blend.SourceColor b. DestinationColor and Source Alpha c. InverseSourceColor and InverseDestinationColor Know how to fade to a color in XNA. Describe how the Draw method can be used to fade a texture in or out.