Language:EN
Pages: 3
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
texture set effect basiceffect effect effect new b

Texture set effect basiceffect effect effect new basiceffect device

7/29/2008

Mathematical Objects
Input Objects

PUTTING TEXT ON THE SCREEN

A model is usually composed of triangles Quad models are often used in modelling
packages, because they are easier to work with The need to keep them flat can be a problem Quads are easy to break into triangles
Triangles are supported by the graphics card — (and lines and points)
A triangle has three vertices

USING A GRAPHICS CARD: FIXED PIPELINE

Point list

Can be used to minimise the amount of data

Each vertex includes
Position (x, y, z)
And various of
Colour (r, g, b)
Normal (x, y, z)
Texture Coordinate(s) (u, v)
Other stuff for special purposes
As a first example we will try Position/Colour

MAKING VERTICES

VertexPositionColor.VertexElements);

VertexPositionColor[] vertices;

// | 0--------1 |

// +----X | 6-----|--7

vertices[1].Position = new Vector3(1, 1, 1);

vertices[2].Position = new Vector3(0, 0, 1);

vertices[7].Position = new Vector3(1, 0, 0);

VERTICES FOR A CUBE

// Z
4--------5 G--------Y
// /| /| /|
//
/ |
/ |

/ |

//

|

C--------W
//
|

6-----|--7

|

Bk----|--R

//
| / | / | / | /
// |/ |/ |/ |/
//

TRIANGLES

PrimitiveType defines the order in which vertices should be sent to the graphics card

int[] indices;

indices = new short[] {0, 1, 2, 1, 3, 2, // front

2, 3, 6, 3, 7, 6}; // bottom

The vertices of a triangle should be given in

APPEARANCE

The appearance of a shape (colour, texture) is set as an ‘effect’
BasicEffect effect;
effect = new BasicEffect(graphics device, null); effect.VertexColorEnabled = true;

AND DRAW

effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes) {
pass.Begin();
graphics.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(
PrimitiveType.TriangleList, vertices, 0, 8, indices, 0, 12);
pass.End();
}
effect.End();

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Douglas Martin

PageId: DOC043EDDD