Chapter 9 - cont - 05march2013

MSDN Primitives in 3D rotating cubes, spheres, cylinders, teapot zip

msdn.microsoft.com/en-us/library/bb200104%28v=xnagamestudio.40%29.aspx

XNA Game Studio 4.0
XNA Game Studio 4.0
Other Versions
26 out of 42 rated this helpful - Rate this topic
XNA Game Studio 4.0 is a programming environment that allows you to use Visual Studio to create games for Windows Phone, the Xbox 360 console, and Windows-based computers. XNA Game Studio includes the XNA Framework, which is a set of managed libraries designed for game development based on Microsoft .NET Framework 2.0. This documentation collection contains technology overviews, tutorials, and reference material related to XNA Game Studio.
In This Section

Introduction to XNA Game Studio 4.0
    Provides helpful prerequisities for installing and using Microsoft XNA Game Studio 4.0. 
Getting Started with XNA Game Studio Development
    Provides introductory documentation for developing games with XNA Game Studio.
Writing Game Code
    Describes how to use XNA Game Studio and the XNA Framework to develop multiplatform games for Windows, Xbox 360, and Windows Phone. 
msdn.microsoft.com/en-us/library/bb975154%28v=xnagamestudio.40%29.aspx Rendering 3D with Effects
msdn.microsoft.com/en-us/library/dd282490%28v=xnagamestudio.40%29.aspx What is Articles for Sprites and Effects
Adding Art, Music, and Other Game Assets
    Describes game assets, such as bitmaps, models, textures, and sounds. These assets, a collection of data files used to support gameplay, are managed by the XNA Framework Content Pipeline. 
Packing and Distributing Your Game
    Describes how to share and distribute your game to XNA Game Studio users and others. 
Advanced Topics
    Describes how XNA Game Studio provides numerous feature extensions to Visual Studio and Visual C# Express to help create eye-popping games. 
XNA Framework Class Library
    The XNA Framework class library is a library of classes, interfaces, and value types that are included in XNA Game Studio.
Content Pipeline Class Library
    The Content Pipeline class library is a library of classes, interfaces, and value types that are included in XNA Game Studio. This library provides access to XNA Framework Content Pipeline functionality and is designed to be the foundation on which Content Pipeline–related applications, components, and controls are built.
XNA Creators Club Online Web Site
    More samples and tutorials, as well as developer community forums, are available at the XNA Creators Club Online Web site.


or the details from the textbook:

9.4 Drawing Primitives

Now that we have a screen, we need to draw something on the screen. Fundamental for all 3D dawings is the triangle.
To draw your first triangle, you need to define some points, or vertices, to represent each of the corners of the triangle. You also need an object called a VertexBuffer in which you will store your vertex information for use on the graphics device. In your Game1 class, create an array of VertexPositionColor objects at the class level as well as a variable of type VertexBuffer:

VertexPositionColor[] verts;
    VertexBuffer vertexBuffer;
You also need something called a BasicEffect in order to draw your primitives.

Essentially, everything in XNA 3D must be drawn using effects
(typically high-level shaders)

The BasicEffect class will be explained in more detail later, but basically it allows you to draw in 3D by using default shader code:
BasicEffect effect;
You use these objects to create those points. A VertexPositionColor object represents a vertex that has both a position and a color. You specify these values in the constructor for the objects when you create them. In the LoadContent method of your Game1 class, initialize the points with this code:
// Initialize vertices
verts = new VertexPositionColor[3];
verts[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
verts[1] = new VertexPositionColor(new Vector3(1, -1, 0), Color.Red);
verts[2] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Green);
Please finish reading this chapter and we will cover quickly along with Ch 10: Models next week.

Here's a previous of items left uncovered at the moment.


9.5 Matrix Multiplication

9.6 Movement and Rotation

9.7 Move on Rotations

9.8 Even More Rotations

9.9 Primitive Types \

remaining codes

Program.cs GameThumbnail.png

Summary

3D development uses a coordinate system with X-, Y-, and Z-axes. XNA uses a right-handed coordinate system.

Creating a game in 3D differs from 2D development in ways similar to how painting on a canvas differs from recording a video with a camcorder. In 3D development, you place objects at different points in the world and create a camera that you move around that world.

A camera defines a viewing frustum, or field of view, that determines which portions of a 3D world are visible on the screen. Anything that exists inside the viewing frustum is visible; if an object is not in the viewing frustum, it won't be visible on the screen.

XNA uses High Level Shader Language (HLSL) to draw objects in 3D. The Effect class is used to draw objects from XNA code and allows developers to modify parameters of the HLSL effect being used. The BasicEffect class derives from Effect and allows you to draw objects without having to code the HLSL yourself.

Nearly everything in XNA 3D is drawn using primitives. Triangles are one such primitive, and you draw them by specifying a series of vertices. The VertexPositionColor and VertexPositionTexture objects are two objects used to draw different types of primitives.

When a triangle is drawn in 3D, the back side of it is not drawn. This is because, to improve performance, only the parts of an object that are facing the camera are drawn (this is called backface culling). Objects drawn in counterclockwise fashion in XNA are culled by default.

Matrix multiplication is behind most calculations in 3D graphics. Translations, rotations, and scaling operations all use matrix multiplication.

The order in which translations, rotations, and scaling operations are applied to an object is important when determining what type of effect is desired. Objects will behave differently when the order of these operations is changed.

Triangle lists, triangle strips, and triangle fans are all different ways of drawing triangle primitives. Each will draw different types of triangles based on a series of vertices.

When applying a texture to a primitive, you specify (U, V) coordinates for each vertex and the texture is mapped accordingly.

XNA 3D is among man's top five inventions of all time; fire, the wheel, football, and peanut butter round out the rest of the top five.