RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

What is?

FingersMcSteal

Sorceror
Be interested to see how to define 3 dimensional shapes, start with a simple cube and build from that small program you did to explain the spinning triangle... while i'm here :D can you explain this part please...

Code:
//Vertices of our primitive
vertices = new VertexPositionColor[3];
//Top left vertex
vertices[0].Position = new Vector3(-1, 1, 0);
//Top right vertex
vertices[1].Position = new Vector3(0, 2, 1);
//Bottom left vertex
vertices[2].Position = new Vector3(1, -1, 0);
//Setup the colors of each vertex
vertices[0].Color = Color.Red;
vertices[1].Color = Color.Blue;
vertices[2].Color = Color.Green;
//Index of each corner
indices = new int[] { 0, 1, 2 };
//Position of our primitive
position = Vector3.Zero;

If i'm getting this right (probably not but anyway...),

The 3D world is the matrix,
Vector3 is that particular triangle,
And thats defined here...

Code:
//Top left vertex
vertices[0].Position = new Vector3([COLOR=red]-1, 1, 0[/COLOR]);
//Top right vertex
vertices[1].Position = new Vector3([COLOR=red]0, 2, 1[/COLOR]);
//Bottom left vertex
vertices[2].Position = new Vector3([COLOR=red]1, -1, 0[/COLOR]);

The RED are x,y,z in 3D space??? (or am i way off) and what are they relative to?

And :)

Code:
//Index of each corner
indices = new int[] { 0, 1, 2 };

What roll does this line play in it?

The way i think it works is,
You have a primative (Your shape/object),
Which is made up of vertices,
Each vertice has a Vector3(-1, 1, 0) type definition ???, which are called indices???

Like... A Primative made up of vertices (Refrenced by Vector3?) and the indices are what make your shape?

Anyway... now i have a headache thinking about this :confused: i'll leave it in your hands :D.
 

Chase.XNA

Sorceror
Primative = A line (two vertices), point (one vertex), or triangle (three vertices).

A Vector is used to tell the graphics card where to draw a vertex (a group of vertexs are called vertices).

Vector3(X, Y, Z)

Indices are used when you have more then one vertex in the same spot, instead of using 2 vertices you can use indices to tell the graphics card something like "use the vertex at position X in the vertex buffer when drawing this vertex."

That should be right, but Jeff knows much more then I do and might be able to explain better.
 
Top