2D or3D?

Sylither

Newcomer
Joined
Nov 14, 2004
Messages
3
I want to make a game that has spheres going around the screen. They will be moving only horizontal and vertical but I'm thinking it might look better if they were 3D spheres.

I also have anothere question how do we use meshes and .X files?
 
Code to load and draw a DirectX .X model

The following code is from book source MDX Kick Start to load a .X mesh file:

======================================
private void LoadMesh(string file)
{
ExtendedMaterial[] mtrl;

// Load our mesh
mesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl);

// If we have any materials, store them
if ((mtrl != null) && (mtrl.Length > 0))
{
meshMaterials = new Material[mtrl.Length];
meshTextures = new Texture[mtrl.Length];

// Store each material and texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials = mtrl.Material3D;
if ((mtrl.TextureFilename != null) && (mtrl.TextureFilename != string.Empty))
{
// We have a texture, try to load it
meshTextures = TextureLoader.FromFile(device, @"..\..\" + mtrl.TextureFilename);
}
}
}
}
============================================


You also need to have declared the following:

Mesh mesh = null;
Material[] meshMaterials;
Texture[] meshTextures;

The 'mesh' can be drawn using the following code:

============================================
for (int i = 0; i < meshMaterials.Length; i++)
{
device.Material = meshMaterials;
device.SetTexture(0, meshTextures);
mesh.DrawSubset(i);
}
 
thanx a lot but I can't use it. I forget to say that I use VB.net not C# which I know very little for but I'll try to translate it it's not that diffcult
 
Back
Top